Parcourir la source

在page4增加入库按钮,入库当前已收单订单

Yannay il y a 1 mois
Parent
commit
ee6e6c5508
1 fichiers modifiés avec 116 ajouts et 29 suppressions
  1. 116 29
      pages/orderDetailRefactored/components/PageFour.vue

+ 116 - 29
pages/orderDetailRefactored/components/PageFour.vue

@@ -148,7 +148,7 @@
148 148
         </u-row>
149 149
 
150 150
         <!-- 是否入库 -->
151
-        <u-row class="info-row">
151
+        <!-- <u-row class="info-row">
152 152
           <u-col span="12">
153 153
             <view @tap="selectIsWarehouse">
154 154
               <u-form-item label="是否入库" prop="isWarehouse">
@@ -160,7 +160,7 @@
160 160
                 @confirm="handleConfirmIsWarehouse" @cancel="showIsWarehousePicker = false" />
161 161
             </view>
162 162
           </u-col>
163
-        </u-row>
163
+        </u-row> -->
164 164
 
165 165
         <!-- 收单备注 -->
166 166
         <u-row class="info-row">
@@ -243,13 +243,22 @@
243 243
       </view>
244 244
     </view>
245 245
 
246
-    <!-- 确认入库按钮 -->
246
+    <!-- 确认收单、确认入库按钮 -->
247 247
     <view class="confirm-button-container">
248
-      <u-button class="next-btn" type="success" @click="confirmWarehouseEntry">
249
-        <u-icon name="checkmark-circle-fill" size="28rpx" color="#fff" />
250
-        <text style="margin-left: 8rpx;" v-show="isWarehouse == '2'">确认收单</text>
251
-        <text style="margin-left: 8rpx;" v-show="isWarehouse == '1'">确认收单并入库</text>
252
-      </u-button>
248
+      <u-row gutter="24">
249
+        <u-col span="6">
250
+          <u-button class="next-btn" type="success" @click="confirmReceiveOrder">
251
+            <u-icon name="checkmark-circle-fill" size="28rpx" color="#fff" />
252
+            <text style="margin-left: 8rpx;">确认收单</text>
253
+          </u-button>
254
+        </u-col>
255
+        <u-col span="6">
256
+          <u-button class="next-btn" type="success" @click="confirmWarehouseEntry">
257
+            <u-icon name="checkmark-circle-fill" size="28rpx" color="#fff" />
258
+            <text style="margin-left: 8rpx;">确认入库</text>
259
+          </u-button>
260
+        </u-col>
261
+      </u-row>
253 262
     </view>
254 263
 
255 264
     <!-- 组织选择器 -->
@@ -723,12 +732,12 @@ export default {
723 732
     },
724 733
 
725 734
     /**
726
-     * 确认入库
735
+     * 确认收单
727 736
      */
728
-    async confirmWarehouseEntry() {
737
+    async confirmReceiveOrder() {
729 738
       uni.showModal({
730
-        title: '确认入库',
731
-        content: `是否确认入库该订单:${this.orderDetail.item}?`,
739
+        title: '确认收单',
740
+        content: `是否确认收单该订单:${this.orderDetail.item}?`,
732 741
         success: async (res) => {
733 742
           if (res.confirm) {
734 743
             try {
@@ -762,11 +771,95 @@ export default {
762 771
               // 上传分成数据
763 772
               await this.addShare()
764 773
 
765
-              //新增仓库或者编辑仓库
766
-              //等于1的时候放入仓库表
767
-              if (this.isWarehouse == '1') {
768
-                // 获取品牌ID
769
-                const brandObj = this.brandList.find(item => item.dictLabel === this.currentReceipt.brand)
774
+              // //新增仓库或者编辑仓库
775
+              // //等于1的时候放入仓库表
776
+              // if (this.isWarehouse == '1') {
777
+              //   // 获取品牌ID
778
+              //   const brandObj = this.brandList.find(item => item.dictLabel === this.currentReceipt.brand)
779
+              //   const brandId = brandObj ? brandObj.dictValue : ''
780
+
781
+              //   //建立入库data
782
+              //   // 获取 PageThree 的高清实物图的 fileUrl 数组
783
+              //   // 直接使用 imageUpload 获取图片列表,与 PageThree 保持一致
784
+              //   let goodPicFileUrls = []
785
+              //   if (this.currentReceipt.id && this.orderDetail.itemBrand) {
786
+              //     try {
787
+              //       const list = await imageUpload.getFileList(
788
+              //         '2',
789
+              //         '3',
790
+              //         this.currentReceipt.id,
791
+              //         this.orderDetail.itemBrand,
792
+              //         this.currentReceipt.clueId
793
+              //       )
794
+              //       // 获取前6个图片的 fileUrl(与 PageThree 的 displayImages 保持一致)
795
+              //       // goodPicFileUrls = (list || []).slice(0, 6).map(item => item.fileUrl).filter(url => url)
796
+              //       goodPicFileUrls = (list || []).map(item => item.fileUrl).filter(url => url)
797
+              //     } catch (error) {
798
+              //       console.error('获取高清实物图失败:', error)
799
+              //     }
800
+              //   }
801
+                
802
+              //   const warehouseData = {
803
+              //     goodPicFileList: goodPicFileUrls,//商品图片 page3的高清实物图的url数组
804
+              //     type: this.warehouseInfo.category || '',//商品分类 
805
+              //     dictLabel: this.currentReceipt.brand || '',//品牌名称 
806
+              //     dictValue: brandId || '',//品牌id 
807
+              //     indentifyCode:this.warehouseInfo.codeStorage|| '',//独立编码
808
+              //     costPrice: this.computedTotalCost || '',//总成本价
809
+              //     recycleTime: dayjs().format('YYYY-MM-DD'),//回收时间 必填
810
+              //     stockStatus:0,//库存状态,0待入库,1已入库,因为是我们是预入库,所以是0
811
+              //     origin:this.orderDetail.website//来源
812
+              //   }
813
+              //   if (!this.currentReceipt.warehouseId) {
814
+              //     //当没有仓库id的时候调用新增仓库接口
815
+              //     await uni.$u.api.wareHouseAdd(warehouseData)
816
+              //   } else {
817
+              //     //当有仓库id的时候调用编辑仓库接口
818
+              //     warehouseData.id = this.currentReceipt.warehouseId
819
+              //     await uni.$u.api.wareHouseUpdate(warehouseData)
820
+              //   }
821
+              // } else if (this.isWarehouse == '2') {
822
+              //   //等于2的时候不放入仓库表
823
+              // }
824
+
825
+              this.$refs.uToast.show({
826
+                type: 'success',
827
+                message: '收单成功',
828
+                complete: () => {
829
+                  uni.navigateBack({
830
+                    delta: 1
831
+                  })
832
+                }
833
+              })
834
+            } catch (error) {
835
+              console.error('收单失败:', error)
836
+              uni.$u.toast('收单失败')
837
+            }
838
+          }
839
+        }
840
+      })
841
+    },
842
+
843
+
844
+    //确认入库
845
+     confirmWarehouseEntry() {
846
+      //点击了入库按钮
847
+      //首先判断该大单的status是否为3,3代表已收单,如果为3,则提示已收单,不能入库
848
+      console.log('xxxxx',this.orderDetail)
849
+      if (this.orderDetail.status != '3') {
850
+        uni.$u.toast('该订单未收单,不能入库')
851
+        return
852
+      }
853
+
854
+      uni.showModal({
855
+        title: '确认入库',
856
+        content: `是否确认入库该订单:${this.orderDetail.item}-${this.currentReceipt.brand}?`,
857
+        success: async (res) => {
858
+          if (res.confirm) {
859
+            //点击了确认入库,执行入库方法
860
+            try {
861
+              // 获取品牌ID
862
+              const brandObj = this.brandList.find(item => item.dictLabel === this.currentReceipt.brand)
770 863
                 const brandId = brandObj ? brandObj.dictValue : ''
771 864
 
772 865
                 //建立入库data
@@ -805,15 +898,12 @@ export default {
805 898
                   //当没有仓库id的时候调用新增仓库接口
806 899
                   await uni.$u.api.wareHouseAdd(warehouseData)
807 900
                 } else {
808
-                  //当有仓库id的时候调用编辑仓库接口
809
-                  warehouseData.id = this.currentReceipt.warehouseId
810
-                  await uni.$u.api.wareHouseUpdate(warehouseData)
901
+                  // //当有仓库id的时候调用编辑仓库接口
902
+                  // warehouseData.id = this.currentReceipt.warehouseId
903
+                  // await uni.$u.api.wareHouseUpdate(warehouseData)
811 904
                 }
812
-              } else if (this.isWarehouse == '2') {
813
-                //等于2的时候不放入仓库表
814
-              }
815 905
 
816
-              this.$refs.uToast.show({
906
+                this.$refs.uToast.show({
817 907
                 type: 'success',
818 908
                 message: '入库成功',
819 909
                 complete: () => {
@@ -1023,15 +1113,12 @@ export default {
1023 1113
 }
1024 1114
 
1025 1115
 .confirm-button-container {
1026
-  display: flex;
1027
-  justify-content: center;
1028
-  align-items: center;
1029 1116
   padding: 40rpx 0;
1030 1117
   margin-top: 20rpx;
1031 1118
 }
1032 1119
 
1033
-.next-btn {
1034
-  width: 95%;
1120
+.confirm-button-container .next-btn {
1121
+  width: 100%;
1035 1122
   height: 80rpx;
1036 1123
   line-height: 80rpx;
1037 1124
   text-align: center;