瀏覽代碼

支持核销代金券

skym1024 2 年之前
父節點
當前提交
311186cc2f
共有 2 個文件被更改,包括 34 次插入9 次删除
  1. 10 1
      src/api/goods/voucher/index.js
  2. 24 8
      src/views/goods/voucher/exchange.vue

+ 10 - 1
src/api/goods/voucher/index.js

@@ -35,6 +35,15 @@ export function updateVoucher(data) {
   })
 }
 
+// 核销代金券
+export function verificationVoucher(data) {
+  return request({
+    url: `/discount/record/${data.recordId}`,
+    method: 'put',
+    data: data
+  })
+}
+
 // 删除代金券管理
 export function delVoucher(data) {
   return request({
@@ -68,4 +77,4 @@ export function getRecord(query) {
     method: 'get',
     params: query
   })
-}
+}

+ 24 - 8
src/views/goods/voucher/exchange.vue

@@ -30,7 +30,7 @@
           <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
@@ -42,8 +42,9 @@
             >导出</el-button>
         </el-col>
       </el-row>
-  
-      <el-table v-loading="loading" :data="taskList">
+
+      <el-table  v-loading="loading" :data="taskList">
+        <el-table-column label="序号" type="index" width="50" />
         <el-table-column label="代金券名称" align="center" prop="discountInfo.name" />
         <el-table-column label="姓名" align="center" prop="user.name" />
         <el-table-column label="手机号" align="center" prop="user.phone" />
@@ -56,6 +57,11 @@
             <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
           </template>
         </el-table-column>
+        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+          <template slot-scope="scope">
+            <el-button size="mini" type="text" icon="el-icon-delete" @click="handleVerification(scope)">核销</el-button>
+          </template>
+        </el-table-column>
       </el-table>
       <pagination
         v-show="total>0"
@@ -66,10 +72,10 @@
       />
     </div>
   </template>
-  
+
   <script>
-  import { recordList } from "@/api/goods/voucher/index";
-  
+  import { recordList, verificationVoucher } from "@/api/goods/voucher/index";
+
   export default {
     name: "voucher",
     dicts: ['receive_tags', 'voucher_category', 'voucher_status', 'community'],
@@ -109,7 +115,7 @@
             if (dict) e.discountInfo.categoryText = dict.label;
             const dictstatus = this.dict.type.voucher_status.find(j => j.value == e.status)
             if (dictstatus) e.statusText = dictstatus.label;
-            
+
             return e;
           });
           this.total = response.total;
@@ -132,7 +138,17 @@
             ...this.queryParams
         }, `${new Date().getTime()}.xlsx`)
       },
+    /** 核销按钮操作 */
+    handleVerification(scope) {
+      console.log("scope.row", scope.row);
+      this.$modal.confirm(`是否确认核销序号为 ${ scope.$index} 的代金券?`).then(function() {
+        console.log("scope.row.recordId", scope.row.recordId);
+        return verificationVoucher(scope.row);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("核销成功");
+      }).catch(() => {});
+    },
     }
   };
   </script>
-