Pārlūkot izejas kodu

在入库的时候使用最新的订单状态

Yannay 2 nedēļas atpakaļ
vecāks
revīzija
31f62da0ef

+ 1 - 0
pages/orderDetailRefactored/components/OrderDetailView.vue

@@ -55,6 +55,7 @@
55 55
             :current-receipt="currentReceipt"
56 56
             @next="handleNext"
57 57
             @confirm-warehouse="handleConfirmWarehouse"
58
+            @update-order-detail="$emit('update-order-detail', $event)"
58 59
           />
59 60
         </view>
60 61
       </view>

+ 26 - 10
pages/orderDetailRefactored/components/PageFour.vue

@@ -103,12 +103,14 @@
103 103
         <u-row class="info-row" justify="space-between">
104 104
           <u-col span="5.8">
105 105
             <u-form-item label="好处费">
106
-              <u--input v-model="warehouseInfo.benefitFee" placeholder="请输入好处费" class="info-input" type="number" />
106
+              <u--input v-model="warehouseInfo.benefitFee" placeholder="请输入好处费" class="info-input" type="number"
107
+                @blur="saveWarehouseInfoOnBlur" />
107 108
             </u-form-item>
108 109
           </u-col>
109 110
           <u-col span="5.8">
110 111
             <u-form-item label="运费">
111
-              <u--input v-model="warehouseInfo.freight" placeholder="请输入运费" class="info-input" type="number" />
112
+              <u--input v-model="warehouseInfo.freight" placeholder="请输入运费" class="info-input" type="number"
113
+                @blur="saveWarehouseInfoOnBlur" />
112 114
             </u-form-item>
113 115
           </u-col>
114 116
         </u-row>
@@ -905,17 +907,31 @@ export default {
905 907
 
906 908
 
907 909
     //确认入库
908
-    confirmWarehouseEntry() {
909
-      // 校验表单
910
-      this.$refs.form.validate().then(() => {
911
-        //点击了入库按钮
912
-        //首先判断该大单的status是否为3,3代表已收单,如果为3,则提示已收单,不能入库
913
-        console.log('xxxxx', this.orderDetail)
914
-        if (this.orderDetail.status != '3') {
910
+    async confirmWarehouseEntry() {
911
+      if (!this.orderDetail || !this.orderDetail.id) {
912
+        uni.$u.toast('订单信息不存在')
913
+        return
914
+      }
915
+      // 先请求最新订单状态,避免刚点完「确认收单」后仍是旧数据
916
+      try {
917
+        const res = await uni.$u.api.getClueSendFormVoByOrderId({ id: this.orderDetail.id })
918
+        const latestOrder = (res.code === 200 && res.data) ? res.data : null
919
+        if (latestOrder) {
920
+          this.$emit('update-order-detail', latestOrder)
921
+        }
922
+        const orderToCheck = latestOrder || this.orderDetail
923
+        if (orderToCheck.status != '3') {
915 924
           uni.$u.toast('该订单未收单,不能入库')
916 925
           return
917 926
         }
918
-  
927
+      } catch (e) {
928
+        console.error('获取订单状态失败', e)
929
+        uni.$u.toast('获取订单状态失败')
930
+        return
931
+      }
932
+
933
+      // 校验表单
934
+      this.$refs.form.validate().then(() => {
919 935
         uni.showModal({
920 936
           title: '确认入库',
921 937
           content: `是否确认入库该订单:${this.orderDetail.item}-${this.currentReceipt.brand}?`,

+ 2 - 1
pages/orderDetailRefactored/index.vue

@@ -24,7 +24,8 @@
24 24
 
25 25
     <!-- 订单详情视图 -->
26 26
     <OrderDetailView :order-detail="orderDetail" :top-info="topInfo" :order-id="orderId"
27
-      :current-receipt="currentReceipt" @price-updated="refreshCurrentReceipt" />
27
+      :current-receipt="currentReceipt" @price-updated="refreshCurrentReceipt"
28
+      @update-order-detail="orderDetail = $event" />
28 29
 
29 30
     <!-- 加一单模态窗 -->
30 31
     <u-modal :show="addOneModalVisible" title="加一单" showCancelButton @cancel="handleAddOneCancel"