Просмотр исходного кода

新增收单修改接口判断,已经收单的不再调收单接口

Yannay 1 месяц назад
Родитель
Сommit
a188775573
1 измененных файлов с 55 добавлено и 52 удалено
  1. 55 52
      pages/orderDetailRefactored/components/PageFour.vue

+ 55 - 52
pages/orderDetailRefactored/components/PageFour.vue

@@ -741,11 +741,14 @@ export default {
741 741
         success: async (res) => {
742 742
           if (res.confirm) {
743 743
             try {
744
-              // 修改订单状态
745
-              await uni.$u.api.oderForm({
746
-                status: '3',
747
-                id: this.orderDetail.id
748
-              })
744
+              // 先判断当前的状态是不是3(收单),如果是3的话就不调这个接口,修改订单状态
745
+              if (this.orderDetail.status != '3') {
746
+                // 当前的收单状态不是收单状态,则修改订单状态
747
+                await uni.$u.api.oderForm({
748
+                  status: '3',
749
+                  id: this.orderDetail.id
750
+                })
751
+              }
749 752
 
750 753
               // 更新收单表单
751 754
               await uni.$u.api.updateReceiptForm({
@@ -798,7 +801,7 @@ export default {
798 801
               //       console.error('获取高清实物图失败:', error)
799 802
               //     }
800 803
               //   }
801
-                
804
+
802 805
               //   const warehouseData = {
803 806
               //     goodPicFileList: goodPicFileUrls,//商品图片 page3的高清实物图的url数组
804 807
               //     type: this.warehouseInfo.category || '',//商品分类 
@@ -842,10 +845,10 @@ export default {
842 845
 
843 846
 
844 847
     //确认入库
845
-     confirmWarehouseEntry() {
848
+    confirmWarehouseEntry() {
846 849
       //点击了入库按钮
847 850
       //首先判断该大单的status是否为3,3代表已收单,如果为3,则提示已收单,不能入库
848
-      console.log('xxxxx',this.orderDetail)
851
+      console.log('xxxxx', this.orderDetail)
849 852
       if (this.orderDetail.status != '3') {
850 853
         uni.$u.toast('该订单未收单,不能入库')
851 854
         return
@@ -860,52 +863,52 @@ export default {
860 863
             try {
861 864
               // 获取品牌ID
862 865
               const brandObj = this.brandList.find(item => item.dictLabel === this.currentReceipt.brand)
863
-                const brandId = brandObj ? brandObj.dictValue : ''
864
-
865
-                //建立入库data
866
-                // 获取 PageThree 的高清实物图的 fileUrl 数组
867
-                // 直接使用 imageUpload 获取图片列表,与 PageThree 保持一致
868
-                let goodPicFileUrls = []
869
-                if (this.currentReceipt.id && this.orderDetail.itemBrand) {
870
-                  try {
871
-                    const list = await imageUpload.getFileList(
872
-                      '2',
873
-                      '3',
874
-                      this.currentReceipt.id,
875
-                      this.orderDetail.itemBrand,
876
-                      this.currentReceipt.clueId
877
-                    )
878
-                    // 获取前6个图片的 fileUrl(与 PageThree 的 displayImages 保持一致)
879
-                    // goodPicFileUrls = (list || []).slice(0, 6).map(item => item.fileUrl).filter(url => url)
880
-                    goodPicFileUrls = (list || []).map(item => item.fileUrl).filter(url => url)
881
-                  } catch (error) {
882
-                    console.error('获取高清实物图失败:', error)
883
-                  }
884
-                }
885
-                
886
-                const warehouseData = {
887
-                  goodPicFileList: goodPicFileUrls,//商品图片 page3的高清实物图的url数组
888
-                  type: this.warehouseInfo.category || '',//商品分类 
889
-                  dictLabel: this.currentReceipt.brand || '',//品牌名称 
890
-                  dictValue: brandId || '',//品牌id 
891
-                  indentifyCode:this.warehouseInfo.codeStorage|| '',//独立编码
892
-                  costPrice: this.computedTotalCost || '',//总成本价
893
-                  recycleTime: dayjs().format('YYYY-MM-DD'),//回收时间 必填
894
-                  stockStatus:0,//库存状态,0待入库,1已入库,因为是我们是预入库,所以是0
895
-                  origin:this.orderDetail.website,//来源
896
-                  actualPrice:this.currentReceipt.sellingPrice|| '',//实价,也就是顶部的第三个价格sellingPrice
897
-                  price:this.currentReceipt.sellingPrice|| '',//官方指导价,也就是顶部的第三个价格sellingPrice
898
-                }
899
-                if (!this.currentReceipt.warehouseId) {
900
-                  //当没有仓库id的时候调用新增仓库接口
901
-                  await uni.$u.api.wareHouseAdd(warehouseData)
902
-                } else {
903
-                  // //当有仓库id的时候调用编辑仓库接口
904
-                  // warehouseData.id = this.currentReceipt.warehouseId
905
-                  // await uni.$u.api.wareHouseUpdate(warehouseData)
866
+              const brandId = brandObj ? brandObj.dictValue : ''
867
+
868
+              //建立入库data
869
+              // 获取 PageThree 的高清实物图的 fileUrl 数组
870
+              // 直接使用 imageUpload 获取图片列表,与 PageThree 保持一致
871
+              let goodPicFileUrls = []
872
+              if (this.currentReceipt.id && this.orderDetail.itemBrand) {
873
+                try {
874
+                  const list = await imageUpload.getFileList(
875
+                    '2',
876
+                    '3',
877
+                    this.currentReceipt.id,
878
+                    this.orderDetail.itemBrand,
879
+                    this.currentReceipt.clueId
880
+                  )
881
+                  // 获取前6个图片的 fileUrl(与 PageThree 的 displayImages 保持一致)
882
+                  // goodPicFileUrls = (list || []).slice(0, 6).map(item => item.fileUrl).filter(url => url)
883
+                  goodPicFileUrls = (list || []).map(item => item.fileUrl).filter(url => url)
884
+                } catch (error) {
885
+                  console.error('获取高清实物图失败:', error)
906 886
                 }
887
+              }
888
+
889
+              const warehouseData = {
890
+                goodPicFileList: goodPicFileUrls,//商品图片 page3的高清实物图的url数组
891
+                type: this.warehouseInfo.category || '',//商品分类 
892
+                dictLabel: this.currentReceipt.brand || '',//品牌名称 
893
+                dictValue: brandId || '',//品牌id 
894
+                indentifyCode: this.warehouseInfo.codeStorage || '',//独立编码
895
+                costPrice: this.computedTotalCost || '',//总成本价
896
+                recycleTime: dayjs().format('YYYY-MM-DD'),//回收时间 必填
897
+                stockStatus: 0,//库存状态,0待入库,1已入库,因为是我们是预入库,所以是0
898
+                origin: this.orderDetail.website,//来源
899
+                actualPrice: this.currentReceipt.sellingPrice || '',//实价,也就是顶部的第三个价格sellingPrice
900
+                price: this.currentReceipt.sellingPrice || '',//官方指导价,也就是顶部的第三个价格sellingPrice
901
+              }
902
+              if (!this.currentReceipt.warehouseId) {
903
+                //当没有仓库id的时候调用新增仓库接口
904
+                await uni.$u.api.wareHouseAdd(warehouseData)
905
+              } else {
906
+                // //当有仓库id的时候调用编辑仓库接口
907
+                // warehouseData.id = this.currentReceipt.warehouseId
908
+                // await uni.$u.api.wareHouseUpdate(warehouseData)
909
+              }
907 910
 
908
-                this.$refs.uToast.show({
911
+              this.$refs.uToast.show({
909 912
                 type: 'success',
910 913
                 message: '入库成功',
911 914
                 complete: () => {