Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/bjcz_his_scrm' into bjcz_his_scrm

yjwang 1 mese fa
parent
commit
8bb5d82ebf

+ 10 - 4
src/views/hisStore/storeInstanDiscountIssue/index.vue

@@ -41,17 +41,16 @@
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="ID" align="center" prop="id" />
       <el-table-column label="立减金券" align="center" prop="couponName" />
-      <el-table-column label="优惠券面值" align="center" prop="couponPrice" />
+      <el-table-column label="立减金面值" align="center" prop="couponPrice" />
       <el-table-column label="最低消费" align="center" prop="useMinPrice" />
-      <el-table-column label="优惠券有效期限(天)" align="center" prop="couponTime" />
       <el-table-column label="类型" align="center" prop="couponType" >
           <template slot-scope="scope">
-              <el-tag prop="couponType" v-for="(item, index) in couponTypeOptions"    v-if="scope.row.couponType==item.dictValue">{{item.dictLabel}}</el-tag>
+              <el-tag type="warning">立减金</el-tag>
           </template>
       </el-table-column>
       <el-table-column label="状态" align="center" prop="status" >
           <template slot-scope="scope">
-              <el-tag prop="status" v-for="(item, index) in statusOptions"    v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</el-tag>
+              <el-tag prop="status" v-for="(item, index) in statusOptions" :key="index" v-if="scope.row.status == item.dictValue || scope.row.status == parseInt(item.dictValue)">{{item.dictLabel}}</el-tag>
           </template>
       </el-table-column>
       <el-table-column label="发布时间" align="center" prop="createTime" />
@@ -180,6 +179,13 @@ export default {
         this.storeCouponIssueList = response.rows;
         this.total = response.total;
         this.loading = false;
+        
+        // 调试信息:检查数据类型
+        if (this.storeCouponIssueList.length > 0) {
+          console.log('立减金数据示例:', this.storeCouponIssueList[0]);
+          console.log('couponType 类型:', typeof this.storeCouponIssueList[0].couponType, '值:', this.storeCouponIssueList[0].couponType);
+          console.log('字典数据:', this.couponTypeOptions);
+        }
       });
     },
     // 取消按钮

+ 130 - 151
src/views/hisStore/storeInstantDiscount/index.vue

@@ -72,7 +72,7 @@
           :disabled="multiple"
           size="mini"
           type="success"
-          @click="handleBatchPublish"
+          @click="handleDirectBatchPublish"
         >批量发布
         </el-button>
       </el-col>
@@ -82,10 +82,11 @@
 
     <el-table v-loading="loading" :data="storeCouponList" border height="500" @selection-change="handleSelectionChange">
       <el-table-column align="center" type="selection" width="55"/>
-      <el-table-column align="center" label="优惠券表ID" prop="couponId"/>
-      <el-table-column align="center" label="优惠券名称" prop="title"/>
-      <el-table-column align="center" label="优惠券面值" prop="couponPrice"/>
+      <el-table-column align="center" label="立减金表ID" prop="couponId"/>
+      <el-table-column align="center" label="立减金名称" prop="title"/>
+      <el-table-column align="center" label="立减金面值" prop="couponPrice"/>
       <el-table-column align="center" label="用户购买金额" prop="payPrice"/>
+      <el-table-column align="center" label="使用最低金额" prop="useMinPrice"/>
       <el-table-column align="center" label="排序" prop="sort"/>
       <el-table-column align="center" label="类型" prop="type">
         <template slot-scope="scope">
@@ -107,7 +108,7 @@
             v-hasPermi="['store:storeCoupon:publish']"
             size="mini"
             type="text"
-            @click="handlePublish(scope.row)"
+            @click="handleDirectPublish(scope.row)"
           >发布
           </el-button>
           <el-button
@@ -141,15 +142,18 @@
     <!-- 添加或修改优惠券对话框 -->
     <el-dialog :title="title" :visible.sync="open" append-to-body width="600px">
       <el-form ref="form" :model="form" :rules="rules" label-width="150px">
-        <el-form-item label="立减金名称" prop="title">
-          <el-input v-model="form.title" placeholder="请输入立减金名称"/>
+        <el-form-item label="立减金名称" prop="title">
+          <el-input v-model="form.title" placeholder="请输入立减金名称"/>
         </el-form-item>
         <el-form-item label="面值" prop="couponPrice">
-          <el-input-number v-model="form.couponPrice" :min="0" placeholder="请输入优惠券面值"/>
+          <el-input-number v-model="form.couponPrice" :min="0" placeholder="请输入立减金面值"/>
         </el-form-item>
         <el-form-item label="用户购买金额" prop="payPrice">
           <el-input-number v-model="form.payPrice" :min="0" placeholder="支付金额"/>
         </el-form-item>
+        <el-form-item label="最低消费金额" prop="useMinPrice">
+          <el-input-number v-model="form.useMinPrice" :min="0" placeholder="请输入最低消费金额"/>
+        </el-form-item>
         <el-form-item label="排序" prop="sort">
           <el-input-number v-model="form.sort" :min="0" placeholder="请输入排序"/>
         </el-form-item>
@@ -164,62 +168,7 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
-    <el-dialog :title="publish.title" :visible.sync="publish.open" append-to-body width="500px">
-      <el-form ref="publishForm" :model="publishForm" :rules="publishRules" label-width="150px">
-        <el-form-item label="优惠券名称" prop="title">
-          <el-input v-model="publishForm.title" disabled/>
-        </el-form-item>
-        <el-form-item label="优惠券开始时间" prop="startTime">
-          <el-date-picker v-model="publishForm.startTime" clearable placeholder="选择开始时间"
-                          size="small"
-                          style="width: 200px"
-                          type="date"
-                          value-format="yyyy-MM-dd"
-          >
-          </el-date-picker>
-        </el-form-item>
-        <el-form-item label="优惠券结束时间" prop="limitTime">
-          <el-date-picker v-model="publishForm.limitTime" clearable placeholder="选择结束时间"
-                          size="small"
-                          style="width: 200px"
-                          type="date"
-                          value-format="yyyy-MM-dd"
-          >
-          </el-date-picker>
-        </el-form-item>
-        <el-form-item label="优惠券领取数量" prop="totalCount">
-          <el-input-number v-model="publishForm.totalCount" :min="0" placeholder="请输入优惠券领取数量"/>
-        </el-form-item>
-
-        <el-form-item label="状态">
-          <el-radio-group v-model="publishForm.status">
-            <el-radio v-for="item in statusOptions" :label="item.dictValue">{{ item.dictLabel }}</el-radio>
-          </el-radio-group>
-        </el-form-item>
-      </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitPublishForm">确 定</el-button>
-        <el-button @click="cancelPublish">取 消</el-button>
-      </div>
-    </el-dialog>
-    <el-dialog :title="batchPublish.title" :visible.sync="batchPublish.open" append-to-body width="500px">
-      <div class="warning-content">
-        <h2 style="color: red; margin-bottom: 16px;">
-          {{ ids.length === 1 ? '是否发布当前勾选1张立减金券!' : `是否发布当前勾选${ids.length}张立减金券` }}
-        </h2>
-        <div class="alert-warning" style="padding: 12px; background-color: #fff3cd; border-left: 4px solid #ffc107; margin-bottom: 16px;">
-          <p style="margin: 0; color: #856404;">
-            <i class="el-icon-warning" style="margin-right: 6px;"></i>
-            请确认立减金券的发布面值与购买金额设置正确,避免因设置错误导致损失。
-          </p>
-        </div>
-      </div>
 
-      <div slot="footer" class="dialog-footer">
-        <el-button @click="batchPublish.open = false">取消</el-button>
-        <el-button type="primary" @click="handlePublish">确认发布</el-button>
-      </div>
-    </el-dialog>
   </div>
 </template>
 
@@ -242,14 +191,7 @@ export default {
     return {
       cateOptions: [],
       couponTypeOptions: [],
-      publish: {
-        title: '发布',
-        open: false
-      },
-      batchPublish: {
-        title: '批量发布',
-        open: false
-      },
+
       dateRange: [],
       statusOptions: [],
       // 遮罩层
@@ -290,59 +232,25 @@ export default {
       // 表单校验
       rules: {
         title: [
-          { required: true, message: '优惠券名称不能为空', trigger: 'blur' }
-        ],
-        integral: [
-          { required: true, message: '兑换消耗积分值不能为空', trigger: 'blur' }
+          { required: true, message: '立减金券名称不能为空', trigger: 'blur' }
         ],
         couponPrice: [
-          { required: true, message: '兑换的优惠券面值不能为空', trigger: 'blur' }
+          { required: true, message: '立减金面值不能为空', trigger: 'blur' }
         ],
         useMinPrice: [
-          { required: true, message: '最低消费多少金额可用优惠券不能为空', trigger: 'blur' }
+          { required: true, message: '最低消费金额不能为空', trigger: 'blur' }
         ],
         payPrice: [
           { required: true, message: '支付金额不能为空', trigger: 'blur' }
         ],
-        couponTime: [
-          { required: true, message: '优惠券有效期限不能为空', trigger: 'blur' }
-        ],
         sort: [
           { required: true, message: '排序不能为空', trigger: 'blur' }
         ],
         status: [
           { required: true, message: '状态不能为空', trigger: 'blur' }
-        ],
-        createTime: [
-          { required: true, message: '兑换项目添加时间不能为空', trigger: 'blur' }
-        ],
-        type: [
-          { required: true, message: '类型不能为空', trigger: 'blur' }
-        ],
-        packageCateIds: [
-          { required: true, message: '套餐分类不能为空', trigger: 'blur' }
-        ],
-        isDel: [
-          { required: true, message: '是否删除不能为空', trigger: 'blur' }
         ]
-
       },
-      publishForm: {
-        totalCount: 0,
-        status: '0'
-      },
-      // 表单校验
-      publishRules: {
-        totalCount: [
-          { required: true, message: '数量不能为空', trigger: 'blur' }
-        ],
-        startTime: [
-          { required: true, message: '开始时间不能为空', trigger: 'blur' }
-        ],
-        limitTime: [
-          { required: true, message: '结束时间不能为空', trigger: 'blur' }
-        ]
-      }
+
     }
   },
   created() {
@@ -381,15 +289,11 @@ export default {
       this.form = {
         couponId: null,
         title: null,
-        integral: null,
         couponPrice: null,
         useMinPrice: null,
-        couponTime: null,
+        payPrice: null,
         sort: null,
         status: '0',
-        type: '0',
-        productIds: null,
-        packageCateIds: [],
         createTime: null,
         updateTime: null,
         isDel: null
@@ -426,25 +330,19 @@ export default {
       getStoreCoupon(couponId).then(response => {
         this.form = response.data
         this.form.status = response.data.status.toString()
-        this.form.type = response.data.type.toString()
-        if (this.form.packageCateIds != null) {
-          this.form.packageCateIds = this.form.packageCateIds.split(',')
-        }
         this.open = true
-        this.title = '修改优惠券'
+        this.title = '修改立减金券'
       })
     },
     /** 提交按钮 */
     submitForm() {
       this.$refs['form'].validate(valid => {
         if (valid) {
-          if (this.form.packageCateIds != null) {
-            this.form.packageCateIds = this.form.packageCateIds.toString()
-          }
-
           //验证金额
           if (this.form.couponPrice <= 0) {
             return this.$message.warning('提交失败,面值要大于0')
+          } else if (this.form.useMinPrice < 0) {
+            return this.$message.warning('提交失败,最低消费金额不能小于0')
           } else if (this.form.payPrice <= 0) {
             return this.$message.warning('提交失败,立减金金额要大于0')
           }
@@ -470,38 +368,119 @@ export default {
         }
       })
     },
-    handleBatchPublish() {
-      this.batchPublish.open = true
-      var that = this
-      setTimeout(() => {
-        that.$refs.batchPublish.handleBatch(that.ids)
-      }, 200)
-    },
-    closeBatchPublish() {
-      this.batchPublish.open = false
-      this.getList()
-    },
-    handlePublish(row) {
-      this.publish.open = true
-      this.publishForm.title = row.title
-      this.publishForm.couponId = row.couponId
-    },
-    cancelPublish() {
-      this.publish.open = false
-      this.reset()
+    /** 直接发布单个立减金券 */
+    handleDirectPublish(row) {
+      this.$confirm(`确认发布立减金券"${row.title}"?发布后将设置为无限张数、永不过期的立减金券。`, '发布立减金券', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        // 构建立减金券发布参数,按照后端逻辑设置
+        const publishParams = {
+          couponId: row.couponId,
+          title: row.title,
+          // startTime 由后端自动设置为当前时间
+          limitTime: null, // 永不过期
+          totalCount: 99999, // 设置大数量(后端会设置为无限)
+          remainCount: 99999, // 剩余数量与总数量相同
+          isPermanent: 1, // 标识为无限张数
+          status: 1 // 启用状态
+        }
+        
+        publishCoupon(publishParams).then(response => {
+          if (response.code === 200) {
+            this.msgSuccess('立减金券发布成功,已设置为无限张数、永不过期')
+            this.getList()
+          } else {
+            this.msgError(response.msg || '发布失败')
+          }
+        }).catch(error => {
+          console.error('发布立减金券失败:', error)
+          this.msgError('发布失败,请重试')
+        })
+      }).catch(() => {
+        // 用户取消操作
+      })
     },
-    submitPublishForm() {
-      this.$refs['publishForm'].validate(valid => {
-        if (valid) {
-          publishCoupon(this.publishForm).then(response => {
-            if (response.code === 200) {
-              this.msgSuccess('发布成功')
-              this.publish.open = false
-            }
+    /** 直接批量发布立减金券 */
+    handleDirectBatchPublish() {
+      if (this.ids.length === 0) {
+        this.msgWarning('请先选择要发布的立减金券')
+        return
+      }
+      
+      this.$confirm(`确认发布选中的${this.ids.length}张立减金券?所有立减金券将设置为无限张数、永不过期。`, '批量发布立减金券', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        // 显示发布进度
+        const loading = this.$loading({
+          lock: true,
+          text: `正在发布立减金券 0/${this.ids.length}`,
+          spinner: 'el-icon-loading',
+          background: 'rgba(0, 0, 0, 0.7)'
+        })
+        
+        // 批量发布处理
+        const promises = this.ids.map((couponId, index) => {
+          const publishParams = {
+            couponId: couponId,
+            // startTime 由后端自动设置为当前时间
+            limitTime: null, // 永不过期
+            totalCount: 99999, // 设置大数量(后端会设置为无限)
+            remainCount: 99999, // 剩余数量与总数量相同
+            isPermanent: 1, // 标识为无限张数
+            status: 1 // 启用状态
+          }
+          
+          return publishCoupon(publishParams).then(response => {
+            // 更新进度
+            loading.text = `正在发布立减金券 ${index + 1}/${this.ids.length}`
+            return response
           })
-        }
+        })
+        
+        Promise.allSettled(promises).then(results => {
+          loading.close()
+          
+          const successResults = results.filter(result => 
+            result.status === 'fulfilled' && result.value.code === 200
+          )
+          const failedResults = results.filter(result => 
+            result.status === 'rejected' || (result.status === 'fulfilled' && result.value.code !== 200)
+          )
+          
+          const successCount = successResults.length
+          const failedCount = failedResults.length
+          
+          if (failedCount === 0) {
+            this.msgSuccess(`批量发布成功!共发布${successCount}张立减金券,均已设置为无限张数、永不过期`)
+          } else if (successCount > 0) {
+            this.msgWarning(`部分发布成功:成功${successCount}张,失败${failedCount}张`)
+          } else {
+            this.msgError('批量发布失败,请检查网络连接后重试')
+          }
+          
+          this.getList()
+        }).catch(error => {
+          loading.close()
+          console.error('批量发布立减金券失败:', error)
+          this.msgError('批量发布失败,请重试')
+        })
+      }).catch(() => {
+        // 用户取消操作
       })
     },
+    /** 获取默认结束日期(用于非立减金券) */
+    getDefaultEndDate() {
+      const now = new Date()
+      now.setDate(now.getDate() + 30) // 30天后
+      const year = now.getFullYear()
+      const month = String(now.getMonth() + 1).padStart(2, '0')
+      const day = String(now.getDate()).padStart(2, '0')
+      return `${year}-${month}-${day}`
+    },
     /** 删除按钮操作 */
     handleDelete(row) {
       const couponIds = row.couponId || this.ids

+ 310 - 0
src/views/hisStore/storeInstantDiscountUser/index.vue

@@ -0,0 +1,310 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
+      <el-form-item label="立减金名称" prop="couponTitle">
+        <el-input
+          v-model="queryParams.couponTitle"
+          placeholder="请输入立减金名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="会员手机号" prop="phone">
+        <el-input
+          v-model="queryParams.phone"
+          placeholder="请输入会员手机号"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="状态" prop="status">
+        <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
+          <el-option
+            v-for="item in statusOptions"
+            :key="item.dictValue"
+            :label="item.dictLabel"
+            :value="item.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="领取时间">
+        <el-date-picker v-model="dateRange" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+    
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          icon="el-icon-download"
+          size="mini"
+          @click="handleExport"
+          v-hasPermi="['store:storeInstantDiscountUser:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table height="500" border v-loading="loading" :data="storeInstantDiscountUserList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="ID" align="center" prop="id" />
+      <el-table-column label="会员昵称" align="center" prop="nickname" />
+      <el-table-column label="会员手机号" align="center" prop="phone" />
+      <el-table-column label="立减金名称" align="center" prop="couponTitle" />
+      <el-table-column label="立减金面值" align="center" prop="couponPrice" />
+      <el-table-column label="最低消费" align="center" prop="useMinPrice" />
+      <el-table-column label="立减金结束时间" align="center" prop="limitTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.limitTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="领取时间" align="center" prop="createTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="使用时间" align="center" prop="useTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ scope.row.useTime ? parseTime(scope.row.useTime, '{y}-{m}-{d} {h}:{i}:{s}') : '-' }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="类型" align="center" prop="couponType">
+        <template slot-scope="scope">
+          <el-tag type="warning">立减金</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="状态" align="center" prop="status">
+        <template slot-scope="scope">
+          <dict-tag :options="statusOptions" :value="scope.row.status"/>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </div>
+</template>
+
+<script>
+import { listStoreCouponUser, getStoreCouponUser, delStoreCouponUser, addStoreCouponUser, updateStoreCouponUser, exportStoreCouponUser } from "@/api/hisStore/storeCouponUser";
+
+export default {
+  name: "HisStoreInstantDiscountUser",
+  data() {
+    return {
+      statusOptions: [],
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      dateRange: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 立减金领取用户记录表格数据
+      storeInstantDiscountUserList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        couponId: null,
+        userId: null,
+        couponTitle: null,
+        couponPrice: null,
+        useMinPrice: null,
+        endTime: null,
+        useTime: null,
+        type: null,
+        status: null,
+        isFail: null,
+        isDel: null,
+        phone: null,
+        couponType: 3 // 立减金类型固定为3
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        couponId: [
+          { required: true, message: "立减金ID不能为空", trigger: "blur" }
+        ],
+        userId: [
+          { required: true, message: "立减金所属用户不能为空", trigger: "blur" }
+        ],
+        couponTitle: [
+          { required: true, message: "立减金名称不能为空", trigger: "blur" }
+        ],
+        couponPrice: [
+          { required: true, message: "立减金面值不能为空", trigger: "blur" }
+        ],
+        useMinPrice: [
+          { required: true, message: "最低消费多少金额可用立减金不能为空", trigger: "blur" }
+        ],
+        createTime: [
+          { required: true, message: "立减金创建时间不能为空", trigger: "blur" }
+        ],
+        endTime: [
+          { required: true, message: "立减金结束时间不能为空", trigger: "blur" }
+        ],
+        type: [
+          { required: true, message: "获取方式不能为空", trigger: "change" }
+        ],
+        status: [
+          { required: true, message: "状态不能为空", trigger: "blur" }
+        ],
+        isFail: [
+          { required: true, message: "是否有效不能为空", trigger: "blur" }
+        ],
+      }
+    };
+  },
+  created() {
+    this.getDicts("store_coupon_user_status").then((response) => {
+      this.statusOptions = response.data;
+    });
+    this.getList();
+  },
+  methods: {
+    /** 查询立减金领取用户记录列表 */
+    getList() {
+      this.loading = true;
+      // 固定查询立减金类型(couponType=3)
+      this.queryParams.couponType = 3;
+      listStoreCouponUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
+        this.storeInstantDiscountUserList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        couponId: null,
+        userId: null,
+        couponTitle: null,
+        couponPrice: null,
+        useMinPrice: null,
+        createTime: null,
+        updateTime: null,
+        endTime: null,
+        useTime: null,
+        type: null,
+        status: 0,
+        isFail: null,
+        isDel: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.dateRange = [];
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id);
+      this.single = selection.length !== 1;
+      this.multiple = !selection.length;
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加立减金领取用户记录";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids;
+      getStoreCouponUser(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改立减金领取用户记录";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateStoreCouponUser(this.form).then(response => {
+              if (response.code === 200) {
+                this.msgSuccess("修改成功");
+                this.open = false;
+                this.getList();
+              }
+            });
+          } else {
+            addStoreCouponUser(this.form).then(response => {
+              if (response.code === 200) {
+                this.msgSuccess("新增成功");
+                this.open = false;
+                this.getList();
+              }
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除立减金领取用户记录编号为"' + ids + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delStoreCouponUser(ids);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(function() {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有立减金领取用户记录数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return exportStoreCouponUser(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+        }).catch(function() {});
+    }
+  }
+};
+</script>