Преглед изворни кода

feat:接单中心 型号字段必填

zhangxin пре 1 месец
родитељ
комит
1f1d1b5cfb
1 измењених фајлова са 201 додато и 177 уклоњено
  1. 201 177
      pages/orderDetailRefactored/components/PageFour.vue

+ 201 - 177
pages/orderDetailRefactored/components/PageFour.vue

@@ -2,7 +2,7 @@
2 2
   <view class="page-four-container">
3 3
     <!-- 入库信息卡片 -->
4 4
     <view class="card-wrap">
5
-      <u--form labelPosition="top" :model="warehouseInfo" ref="form" class="address-section">
5
+      <u--form labelPosition="top" :model="warehouseInfo" ref="form" :rules="rules" class="address-section">
6 6
         <view class="address-header">
7 7
           <u-icon name="car-fill" size="36rpx" color="#108cff" class="location-icon" />
8 8
           <text class="address-title">入库信息</text>
@@ -124,7 +124,13 @@
124 124
             </u-form-item>
125 125
           </u-col>
126 126
         </u-row>
127
-
127
+        <u-row class="info-row" justify="space-between">
128
+          <u-col span="5.8">
129
+            <u-form-item label="型号" required prop="model"> 
130
+              <u--input v-model="warehouseInfo.model" placeholder="请输入型号" class="info-input" type="number" />
131
+            </u-form-item>
132
+          </u-col>
133
+        </u-row>
128 134
         <!-- 成本合计、业绩、毛业绩 -->
129 135
         <u-row class="info-row" justify="space-between">
130 136
           <u-col span="3.8">
@@ -345,7 +351,12 @@ export default {
345 351
         { label: '确认入库', value: '1' },
346 352
         { label: '不入库', value: '2' }
347 353
       ]],
348
-      brandList: []
354
+      brandList: [],
355
+      rules: {
356
+        model: [
357
+          { required: true, message: '请输入型号', trigger: 'blur' }
358
+        ]
359
+      }
349 360
     }
350 361
   },
351 362
   computed: {
@@ -735,195 +746,208 @@ export default {
735 746
      * 确认收单
736 747
      */
737 748
     async confirmReceiveOrder() {
738
-      uni.showModal({
739
-        title: '确认收单',
740
-        content: `是否确认收单该订单:${this.orderDetail.item}?`,
741
-        success: async (res) => {
742
-          if (res.confirm) {
743
-            try {
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
-              }
752
-
753
-              // 更新收单表单
754
-              await uni.$u.api.updateReceiptForm({
755
-                id: this.currentReceipt.id,
756
-                code: this.warehouseInfo.codeStorage || '',
757
-                expressOrderNo: this.warehouseInfo.expressOrderNo || '',
758
-                item: this.warehouseInfo.item || '',
759
-                checkCodeFee: this.warehouseInfo.checkCodeFee || '',
760
-                tableFee: this.warehouseInfo.watchPrice || '',
761
-                benefitFee: this.warehouseInfo.benefitFee || '',
762
-                freight: this.warehouseInfo.freight || '',
763
-                repairAmount: this.warehouseInfo.repairAmount || '',
764
-                grossPerformance: this.computedGrossPerformance || '',
765
-                performance: this.computedPerformance || '',
766
-                splitRatio: this.warehouseInfo.splitRatio || '',
767
-                receiptRemark: `${this.warehouseInfo.remarks || ''};${this.warehouseInfo.uploadedImage || ''}`,
768
-                customerServiceName: this.warehouseInfo.customerServiceName || '',
769
-                category: this.warehouseInfo.category || '',
770
-                needCheckCode: this.warehouseInfo.needCheckCode || '',
771
-                totalCost: this.computedTotalCost || ''
772
-              })
773
-
774
-              // 上传分成数据
775
-              await this.addShare()
776
-
777
-              // //新增仓库或者编辑仓库
778
-              // //等于1的时候放入仓库表
779
-              // if (this.isWarehouse == '1') {
780
-              //   // 获取品牌ID
781
-              //   const brandObj = this.brandList.find(item => item.dictLabel === this.currentReceipt.brand)
782
-              //   const brandId = brandObj ? brandObj.dictValue : ''
783
-
784
-              //   //建立入库data
785
-              //   // 获取 PageThree 的高清实物图的 fileUrl 数组
786
-              //   // 直接使用 imageUpload 获取图片列表,与 PageThree 保持一致
787
-              //   let goodPicFileUrls = []
788
-              //   if (this.currentReceipt.id && this.orderDetail.itemBrand) {
789
-              //     try {
790
-              //       const list = await imageUpload.getFileList(
791
-              //         '2',
792
-              //         '3',
793
-              //         this.currentReceipt.id,
794
-              //         this.orderDetail.itemBrand,
795
-              //         this.currentReceipt.clueId
796
-              //       )
797
-              //       // 获取前6个图片的 fileUrl(与 PageThree 的 displayImages 保持一致)
798
-              //       // goodPicFileUrls = (list || []).slice(0, 6).map(item => item.fileUrl).filter(url => url)
799
-              //       goodPicFileUrls = (list || []).map(item => item.fileUrl).filter(url => url)
800
-              //     } catch (error) {
801
-              //       console.error('获取高清实物图失败:', error)
802
-              //     }
803
-              //   }
804
-
805
-              //   const warehouseData = {
806
-              //     goodPicFileList: goodPicFileUrls,//商品图片 page3的高清实物图的url数组
807
-              //     type: this.warehouseInfo.category || '',//商品分类 
808
-              //     dictLabel: this.currentReceipt.brand || '',//品牌名称 
809
-              //     dictValue: brandId || '',//品牌id 
810
-              //     indentifyCode:this.warehouseInfo.codeStorage|| '',//独立编码
811
-              //     costPrice: this.computedTotalCost || '',//总成本价
812
-              //     recycleTime: dayjs().format('YYYY-MM-DD'),//回收时间 必填
813
-              //     stockStatus:0,//库存状态,0待入库,1已入库,因为是我们是预入库,所以是0
814
-              //     origin:this.orderDetail.website//来源
815
-              //   }
816
-              //   if (!this.currentReceipt.warehouseId) {
817
-              //     //当没有仓库id的时候调用新增仓库接口
818
-              //     await uni.$u.api.wareHouseAdd(warehouseData)
819
-              //   } else {
820
-              //     //当有仓库id的时候调用编辑仓库接口
821
-              //     warehouseData.id = this.currentReceipt.warehouseId
822
-              //     await uni.$u.api.wareHouseUpdate(warehouseData)
823
-              //   }
824
-              // } else if (this.isWarehouse == '2') {
825
-              //   //等于2的时候不放入仓库表
826
-              // }
827
-
828
-              this.$refs.uToast.show({
829
-                type: 'success',
830
-                message: '收单成功',
831
-                complete: () => {
832
-                  uni.navigateBack({
833
-                    delta: 1
749
+      // 校验表单
750
+      await this.$refs.form.validate().then(() => {
751
+        uni.showModal({
752
+          title: '确认收单',
753
+          content: `是否确认收单该订单:${this.orderDetail.item}?`,
754
+          success: async (res) => {
755
+            if (res.confirm) {
756
+              try {
757
+                // 先判断当前的状态是不是3(收单),如果是3的话就不调这个接口,修改订单状态
758
+                if (this.orderDetail.status != '3') {
759
+                  // 当前的收单状态不是收单状态,则修改订单状态
760
+                  await uni.$u.api.oderForm({
761
+                    status: '3',
762
+                    id: this.orderDetail.id
834 763
                   })
835 764
                 }
836
-              })
837
-            } catch (error) {
838
-              console.error('收单失败:', error)
839
-              uni.$u.toast('收单失败')
765
+
766
+                // 更新收单表单
767
+                await uni.$u.api.updateReceiptForm({
768
+                  id: this.currentReceipt.id,
769
+                  code: this.warehouseInfo.codeStorage || '',
770
+                  expressOrderNo: this.warehouseInfo.expressOrderNo || '',
771
+                  item: this.warehouseInfo.item || '',
772
+                  checkCodeFee: this.warehouseInfo.checkCodeFee || '',
773
+                  tableFee: this.warehouseInfo.watchPrice || '',
774
+                  benefitFee: this.warehouseInfo.benefitFee || '',
775
+                  freight: this.warehouseInfo.freight || '',
776
+                  repairAmount: this.warehouseInfo.repairAmount || '',
777
+                  grossPerformance: this.computedGrossPerformance || '',
778
+                  performance: this.computedPerformance || '',
779
+                  splitRatio: this.warehouseInfo.splitRatio || '',
780
+                  receiptRemark: `${this.warehouseInfo.remarks || ''};${this.warehouseInfo.uploadedImage || ''}`,
781
+                  customerServiceName: this.warehouseInfo.customerServiceName || '',
782
+                  category: this.warehouseInfo.category || '',
783
+                  needCheckCode: this.warehouseInfo.needCheckCode || '',
784
+                  totalCost: this.computedTotalCost || ''
785
+                })
786
+
787
+                // 上传分成数据
788
+                await this.addShare()
789
+
790
+                // //新增仓库或者编辑仓库
791
+                // //等于1的时候放入仓库表
792
+                // if (this.isWarehouse == '1') {
793
+                //   // 获取品牌ID
794
+                //   const brandObj = this.brandList.find(item => item.dictLabel === this.currentReceipt.brand)
795
+                //   const brandId = brandObj ? brandObj.dictValue : ''
796
+
797
+                //   //建立入库data
798
+                //   // 获取 PageThree 的高清实物图的 fileUrl 数组
799
+                //   // 直接使用 imageUpload 获取图片列表,与 PageThree 保持一致
800
+                //   let goodPicFileUrls = []
801
+                //   if (this.currentReceipt.id && this.orderDetail.itemBrand) {
802
+                //     try {
803
+                //       const list = await imageUpload.getFileList(
804
+                //         '2',
805
+                //         '3',
806
+                //         this.currentReceipt.id,
807
+                //         this.orderDetail.itemBrand,
808
+                //         this.currentReceipt.clueId
809
+                //       )
810
+                //       // 获取前6个图片的 fileUrl(与 PageThree 的 displayImages 保持一致)
811
+                //       // goodPicFileUrls = (list || []).slice(0, 6).map(item => item.fileUrl).filter(url => url)
812
+                //       goodPicFileUrls = (list || []).map(item => item.fileUrl).filter(url => url)
813
+                //     } catch (error) {
814
+                //       console.error('获取高清实物图失败:', error)
815
+                //     }
816
+                //   }
817
+
818
+                //   const warehouseData = {
819
+                //     goodPicFileList: goodPicFileUrls,//商品图片 page3的高清实物图的url数组
820
+                //     type: this.warehouseInfo.category || '',//商品分类 
821
+                //     dictLabel: this.currentReceipt.brand || '',//品牌名称 
822
+                //     dictValue: brandId || '',//品牌id 
823
+                //     indentifyCode:this.warehouseInfo.codeStorage|| '',//独立编码
824
+                //     costPrice: this.computedTotalCost || '',//总成本价
825
+                //     recycleTime: dayjs().format('YYYY-MM-DD'),//回收时间 必填
826
+                //     stockStatus:0,//库存状态,0待入库,1已入库,因为是我们是预入库,所以是0
827
+                //     origin:this.orderDetail.website//来源
828
+                //   }
829
+                //   if (!this.currentReceipt.warehouseId) {
830
+                //     //当没有仓库id的时候调用新增仓库接口
831
+                //     await uni.$u.api.wareHouseAdd(warehouseData)
832
+                //   } else {
833
+                //     //当有仓库id的时候调用编辑仓库接口
834
+                //     warehouseData.id = this.currentReceipt.warehouseId
835
+                //     await uni.$u.api.wareHouseUpdate(warehouseData)
836
+                //   }
837
+                // } else if (this.isWarehouse == '2') {
838
+                //   //等于2的时候不放入仓库表
839
+                // }
840
+
841
+                this.$refs.uToast.show({
842
+                  type: 'success',
843
+                  message: '收单成功',
844
+                  complete: () => {
845
+                    uni.navigateBack({
846
+                      delta: 1
847
+                    })
848
+                  }
849
+                })
850
+              } catch (error) {
851
+                console.error('收单失败:', error)
852
+                uni.$u.toast('收单失败')
853
+              }
840 854
             }
841 855
           }
842
-        }
856
+        })
857
+      }).catch(() => {
858
+        uni.$u.toast('请输入正确的信息')
843 859
       })
860
+
861
+      
844 862
     },
845 863
 
846 864
 
847 865
     //确认入库
848 866
     confirmWarehouseEntry() {
849
-      //点击了入库按钮
850
-      //首先判断该大单的status是否为3,3代表已收单,如果为3,则提示已收单,不能入库
851
-      console.log('xxxxx', this.orderDetail)
852
-      if (this.orderDetail.status != '3') {
853
-        uni.$u.toast('该订单未收单,不能入库')
854
-        return
855
-      }
856
-
857
-      uni.showModal({
858
-        title: '确认入库',
859
-        content: `是否确认入库该订单:${this.orderDetail.item}-${this.currentReceipt.brand}?`,
860
-        success: async (res) => {
861
-          if (res.confirm) {
862
-            //点击了确认入库,执行入库方法
863
-            try {
864
-              // 获取品牌ID
865
-              const brandObj = this.brandList.find(item => item.dictLabel === this.currentReceipt.brand)
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)
867
+      // 校验表单
868
+      this.$refs.form.validate().then(() => {
869
+        //点击了入库按钮
870
+        //首先判断该大单的status是否为3,3代表已收单,如果为3,则提示已收单,不能入库
871
+        console.log('xxxxx', this.orderDetail)
872
+        if (this.orderDetail.status != '3') {
873
+          uni.$u.toast('该订单未收单,不能入库')
874
+          return
875
+        }
876
+  
877
+        uni.showModal({
878
+          title: '确认入库',
879
+          content: `是否确认入库该订单:${this.orderDetail.item}-${this.currentReceipt.brand}?`,
880
+          success: async (res) => {
881
+            if (res.confirm) {
882
+              //点击了确认入库,执行入库方法
883
+              try {
884
+                // 获取品牌ID
885
+                const brandObj = this.brandList.find(item => item.dictLabel === this.currentReceipt.brand)
886
+                const brandId = brandObj ? brandObj.dictValue : ''
887
+  
888
+                //建立入库data
889
+                // 获取 PageThree 的高清实物图的 fileUrl 数组
890
+                // 直接使用 imageUpload 获取图片列表,与 PageThree 保持一致
891
+                let goodPicFileUrls = []
892
+                if (this.currentReceipt.id && this.orderDetail.itemBrand) {
893
+                  try {
894
+                    const list = await imageUpload.getFileList(
895
+                      '2',
896
+                      '3',
897
+                      this.currentReceipt.id,
898
+                      this.orderDetail.itemBrand,
899
+                      this.currentReceipt.clueId
900
+                    )
901
+                    // 获取前6个图片的 fileUrl(与 PageThree 的 displayImages 保持一致)
902
+                    // goodPicFileUrls = (list || []).slice(0, 6).map(item => item.fileUrl).filter(url => url)
903
+                    goodPicFileUrls = (list || []).map(item => item.fileUrl).filter(url => url)
904
+                  } catch (error) {
905
+                    console.error('获取高清实物图失败:', error)
906
+                  }
886 907
                 }
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
-              }
910
-
911
-              this.$refs.uToast.show({
912
-                type: 'success',
913
-                message: '入库成功',
914
-                complete: () => {
915
-                  uni.navigateBack({
916
-                    delta: 1
917
-                  })
908
+  
909
+                const warehouseData = {
910
+                  goodPicFileList: goodPicFileUrls,//商品图片 page3的高清实物图的url数组
911
+                  type: this.warehouseInfo.category || '',//商品分类 
912
+                  dictLabel: this.currentReceipt.brand || '',//品牌名称 
913
+                  dictValue: brandId || '',//品牌id 
914
+                  indentifyCode: this.warehouseInfo.codeStorage || '',//独立编码
915
+                  costPrice: this.computedTotalCost || '',//总成本价
916
+                  recycleTime: dayjs().format('YYYY-MM-DD'),//回收时间 必填
917
+                  stockStatus: 0,//库存状态,0待入库,1已入库,因为是我们是预入库,所以是0
918
+                  origin: this.orderDetail.website,//来源
919
+                  actualPrice: this.currentReceipt.sellingPrice || '',//实价,也就是顶部的第三个价格sellingPrice
920
+                  price: this.currentReceipt.sellingPrice || '',//官方指导价,也就是顶部的第三个价格sellingPrice
918 921
                 }
919
-              })
920
-            } catch (error) {
921
-              console.error('入库失败:', error)
922
-              uni.$u.toast('入库失败')
922
+                if (!this.currentReceipt.warehouseId) {
923
+                  //当没有仓库id的时候调用新增仓库接口
924
+                  await uni.$u.api.wareHouseAdd(warehouseData)
925
+                } else {
926
+                  // //当有仓库id的时候调用编辑仓库接口
927
+                  // warehouseData.id = this.currentReceipt.warehouseId
928
+                  // await uni.$u.api.wareHouseUpdate(warehouseData)
929
+                }
930
+  
931
+                this.$refs.uToast.show({
932
+                  type: 'success',
933
+                  message: '入库成功',
934
+                  complete: () => {
935
+                    uni.navigateBack({
936
+                      delta: 1
937
+                    })
938
+                  }
939
+                })
940
+              } catch (error) {
941
+                console.error('入库失败:', error)
942
+                uni.$u.toast('入库失败')
943
+              }
923 944
             }
924 945
           }
925
-        }
946
+        })
947
+      }).catch(() => {
948
+        uni.$u.toast('请输入正确的信息')
926 949
       })
950
+      
927 951
     },
928 952
 
929 953
     /**