Bläddra i källkod

前端增加客户购买次数逻辑

cgp 5 dagar sedan
förälder
incheckning
b093689e8f

+ 10 - 0
src/api/member/handwriteCollection/handwriteCollection.js

@@ -76,3 +76,13 @@ export function ocrImage(data) {
     data: data
     data: data
   })
   })
 }
 }
+
+// 导出手写信息采集表
+export function exportCollection(data) {
+  return request({
+    url: '/handwrite/collection/export',
+    method: 'post',
+    data: data,
+    responseType: 'blob' //返回二进制流
+  });
+}

+ 10 - 1
src/api/qw/companyCustomer.js

@@ -146,4 +146,13 @@ export function getAddress(address) {
     method: 'get',
     method: 'get',
     params: { address: address }
     params: { address: address }
   })
   })
-}
+}
+
+// 增加客户购买次数
+export function addBuyTimes(id) {
+  return request({
+    url: '/qw/companyCustomer/addBuyTimes',
+    method: 'post',
+    data: { id: id }
+  });
+}

+ 25 - 20
src/views/qw/companyCustomer/index.vue

@@ -69,7 +69,7 @@
           size="small"
           size="small"
           style="width: 120px"
           style="width: 120px"
         >
         >
-          <el-option label="认领" :value="0" />
+          <el-option label="认领" :value="0" />
           <el-option label="已认领" :value="1" />
           <el-option label="已认领" :value="1" />
         </el-select>
         </el-select>
       </el-form-item>
       </el-form-item>
@@ -81,7 +81,7 @@
           size="small"
           size="small"
           style="width: 120px"
           style="width: 120px"
         >
         >
-          <el-option label="完善" :value="0" />
+          <el-option label="完善" :value="0" />
           <el-option label="已完善" :value="1" />
           <el-option label="已完善" :value="1" />
         </el-select>
         </el-select>
       </el-form-item>
       </el-form-item>
@@ -220,18 +220,21 @@
       <el-table-column label="归属分组" align="center" prop="deptName" />
       <el-table-column label="归属分组" align="center" prop="deptName" />
       <el-table-column label="负责医生" align="center" prop="doctorName" />
       <el-table-column label="负责医生" align="center" prop="doctorName" />
       <el-table-column label="购买次数" align="center" prop="buyCount" />
       <el-table-column label="购买次数" align="center" prop="buyCount" />
-      <el-table-column
-        label="认领状态"
-        align="center"
-        prop="claimStatus"
-        :formatter="claimStatusFormat"
-      />
-      <el-table-column
-        label="完善状态"
-        align="center"
-        prop="completeStatus"
-        :formatter="completeStatusFormat"
-      />
+      <el-table-column label="认领状态" align="center" prop="claimStatus">
+        <template slot-scope="scope">
+          <el-tag :type="scope.row.claimStatus === 1 ? 'success' : 'danger'">
+            {{ scope.row.claimStatus === 1 ? '已认领' : '待认领' }}
+          </el-tag>
+        </template>
+      </el-table-column>
+
+      <el-table-column label="完善状态" align="center" prop="completeStatus">
+        <template slot-scope="scope">
+          <el-tag :type="scope.row.completeStatus === 1 ? 'success' : 'warning'">
+            {{ scope.row.completeStatus === 1 ? '已完善' : '待完善' }}
+          </el-tag>
+        </template>
+      </el-table-column>
       <el-table-column
       <el-table-column
         label="操作"
         label="操作"
         align="center"
         align="center"
@@ -1170,6 +1173,7 @@ import {
   getOrderList,
   getOrderList,
   getQRCode,
   getQRCode,
   getAddress,
   getAddress,
+  addBuyTimes,
 } from "@/api/qw/companyCustomer";
 } from "@/api/qw/companyCustomer";
 import { parseTime } from "@/utils/common";
 import { parseTime } from "@/utils/common";
 import { getCitys } from "@/api/hisStore/city";
 import { getCitys } from "@/api/hisStore/city";
@@ -1620,6 +1624,13 @@ export default {
     handleOrderCreateSuccess(order, orderParams) {
     handleOrderCreateSuccess(order, orderParams) {
       this.createOrder.open = false;
       this.createOrder.open = false;
       this.createOrderReset();
       this.createOrderReset();
+      // 调用增加客户购买次数接口
+      if (this.currentCustomerId) {
+        addBuyTimes(this.currentCustomerId).catch(err => {
+          console.error('增加购买次数失败', err);
+          // 不阻塞主流程,仅记录错误
+        });
+      }
       // 弹出提示确认框
       // 弹出提示确认框
       this.$confirm(`<div style="text-align: center; padding: 10px 0;">
       this.$confirm(`<div style="text-align: center; padding: 10px 0;">
      <i class="el-icon-warning-outline" style="font-size: 48px; color: #E6A23C;"></i>
      <i class="el-icon-warning-outline" style="font-size: 48px; color: #E6A23C;"></i>
@@ -1882,12 +1893,6 @@ export default {
       this.sAddress(row);
       this.sAddress(row);
       this.fetchReceiptList();
       this.fetchReceiptList();
     },
     },
-    claimStatusFormat(row) {
-      return row.claimStatus === 1 ? "已认领" : "未认领";
-    },
-    completeStatusFormat(row) {
-      return row.completeStatus === 1 ? "已完善" : "未完善";
-    },
     parseTime,
     parseTime,
     getCurrentDateTime() {
     getCurrentDateTime() {
       const now = new Date();
       const now = new Date();