Sfoglia il codice sorgente

feat:自提订单-核销

caoliqin 2 ore fa
parent
commit
1d09d136b6

+ 8 - 0
src/api/hisStore/storeOrder.js

@@ -313,3 +313,11 @@ export function refundStorePayment(data) {
   })
 }
 
+export function redeemStoreOrder(data) {
+  return request({
+    url: '/store/store/storeOrder/redeem',
+    method: 'post',
+    data: data
+  })
+}
+

+ 30 - 1
src/views/hisStore/storeOrderPick/components/productOrderPick.vue

@@ -39,6 +39,7 @@
           </div>
             <div class="operate-button-container">
                 <el-button size="mini"  v-if="showRefundButton" @click="handleRefund" v-hasPermi="['store:storePaymentScrm:refund']">退款</el-button>
+                <el-button size="mini" v-if="showRedeemButton" @click="handleRedeem" v-hasPermi="['store:storeOrder:redeem']">核销</el-button>
             </div>
         </div>
         <div style="margin: 20px 0px" v-if="order!=null">
@@ -627,7 +628,8 @@ import {
   uploadCredentials,
   getUserPhone,
   editPayDelivery,
-  refundStorePayment
+  refundStorePayment,
+  redeemStoreOrder
 } from "@/api/hisStore/storeOrder";
 import {updateUser, getUser} from "@/api/users/user";
 import {getTcmScheduleList} from "@/api/company/tcmScheduleReport";
@@ -827,6 +829,13 @@ export default {
       if (this.order.payMoney == null || Number(this.order.payMoney) <= 0) return false;
       const payment = this.getLatestPayment();
       return !!(payment && payment.paymentId);
+    },
+    /** 订单状态>0且待核销时显示核销按钮 */
+    showRedeemButton() {
+      if (!this.order) return false;
+      if (Number(this.order.status) <= 0) return false;
+      const redeemedStatus = this.order.redeemedStatus ?? this.order.redeemed_status;
+      return String(redeemedStatus) === '1';
     }
 
   },
@@ -989,6 +998,26 @@ export default {
         });
       }).catch(() => {});
     },
+    handleRedeem() {
+      if (!this.order || !this.order.id) {
+        this.msgError('订单信息异常');
+        return;
+      }
+      this.$confirm('是否确认核销该订单?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        redeemStoreOrder({
+          orderId: this.order.id
+        }).then(response => {
+          if (response.code === 200) {
+            this.msgSuccess('核销成功');
+            this.getOrder(this.order.id);
+          }
+        });
+      }).catch(() => {});
+    },
     districtChange(val) {
       var item = this.district.find((item) => {
         return item.value == val;