Explorar o código

feat(订单详情): 添加品牌列表加载功能并完善入库数据

- 新增品牌列表加载方法 loadBrandList
- 在入库数据 warehouseData 中添加品牌相关字段
- 使用 dayjs 处理回收时间字段
Yannay hai 1 mes
pai
achega
f64f0a6c25
Modificáronse 1 ficheiros con 68 adicións e 1 borrados
  1. 68 1
      pages/orderDetailRefactored/components/PageFour.vue

+ 68 - 1
pages/orderDetailRefactored/components/PageFour.vue

@@ -266,6 +266,7 @@
266 266
 
267 267
 <script>
268 268
 import imageUpload from '../utils/imageUpload.js'
269
+import dayjs from 'dayjs'
269 270
 
270 271
 export default {
271 272
   name: 'PageFour',
@@ -335,6 +336,7 @@ export default {
335 336
         { label: '确认入库', value: '1' },
336 337
         { label: '不入库', value: '2' }
337 338
       ]],
339
+      brandList: []
338 340
     }
339 341
   },
340 342
   computed: {
@@ -370,9 +372,22 @@ export default {
370 372
   },
371 373
   mounted() {
372 374
     this.loadCommissionUserList()
375
+    this.loadBrandList()
373 376
   },
374 377
   methods: {
375 378
     /**
379
+     * 加载品牌列表
380
+     */
381
+    async loadBrandList() {
382
+      try {
383
+        const res = await this.$getDicts('crm_form_brand')
384
+        this.brandList = res
385
+      } catch (error) {
386
+        console.error('加载品牌列表失败:', error)
387
+      }
388
+    },
389
+
390
+    /**
376 391
      * 初始化入库信息
377 392
      */
378 393
     initWarehouseInfo(data) {
@@ -750,15 +765,67 @@ export default {
750 765
               //新增仓库或者编辑仓库
751 766
               //等于1的时候放入仓库表
752 767
               if (this.isWarehouse == '1') {
768
+                // 获取品牌ID
769
+                const brandObj = this.brandList.find(item => item.dictLabel === this.currentReceipt.brand)
770
+                const brandId = brandObj ? brandObj.dictValue : ''
771
+
753 772
                 //建立入库data
754 773
                 const warehouseData = {
774
+                  // goodPicFileList: [''],//商品图片 必填
775
+                  // desc: '',//商品描述 必填  
776
+                  type: this.warehouseInfo.category || '',//商品分类 
777
+                  dictLabel: this.currentReceipt.brand || '',//品牌名称 必填
778
+                  dictValue: brandId || '',//品牌id 必填
779
+                  // series: '',//系列
780
+                  // model: this.warehouseInfo.model||'',//型号
781
+                  // dialType: '',//机芯类型
782
+                  // caseMaterial: '',//表壳材质
783
+                  // dialDiameter: '',//表盘直径
784
+                  // material: '',//材质
785
+                  // size: '',//尺寸
786
+                  // yardage: '',//尺码
787
+                  // price: '',//官方指导价
788
+                  // productCondition: '',//商品成色 必填 1-闲置未使用 2-二手 
789
+                  // detailPicFileList: [''],//细节图片
790
+                  // title: '',//商品标题
791
+                  // productNo: '',//商品货号
792
+                  // productAttribute: '1',//商品属性 必填 1-自有商品 2-寄卖商品 3-质押商品 4-其它
793
+                  // stock: '',//库存数量 必填
794
+                  costPrice: this.computedTotalCost || '',//总成本价
795
+                  // peerPrice: '',//同行价格
796
+                  // agentPrice: '',//代理价格
797
+                  // salePrice: '',//销售价格
798
+                  // productPosition: '',//商品位置
799
+                  // watchYear: '',//手表年份
800
+                  // identifyingPerson: '',//鉴定人员
801
+                  // identifyingPersonId: '',//鉴定人员id
802
+                  // recycleType: '1',//回收类型 1-线上 2-同行 3-门店 4-其它
803
+                  // label: '1', 1-完美 2-普通 3-瑕疵 4-假货 5-亏损
804
+                  // recyclePerson: '',//回收人员
805
+                  // recyclePersonId: '',//回收人员id
806
+                  // recycleBottomDesc: '',//回收留底图描述
807
+                  // recycleBottomFileList: [' '],//回收留底图
808
+                  recycleTime: dayjs().format('YYYY-MM-DD'),//回收时间 必填
809
+                  // indentifyCode: '',//独立编码
810
+                  // targetAudience: 'general',// general-通用 man-男 woman-女
811
+                  // productCard: '',//商品保卡 has-有 no-无
812
+                  // cardYear: '',//保卡年份 如果有商品保卡就有这个字段,如果没有商品保卡,这个字段为空
813
+                  // productCardPicFileList: [''],//商品保卡图片留底
814
+                  // productTag: '',//商品标签  
815
+                  // productAttachment: '',//商品附件
816
+                  // productDesc: '',//商品备注
817
+                  // productDescPicFileList: [''],//商品备注图片
818
+                  // payType: '1',//付款方式 1:微信 2:支付宝 3:银行卡 4:现金 5:数字货币 6:挂账
819
+                  // submitType: 'inAndUp',//提交类型 onlyIn:仅入库 inAndUp:入库并上架
820
+                  // continuousWarehousing: '0',//是否连续入库 1:是 0:否
755 821
 
756 822
                 }
757
-                if (!warehouseData.warehouseId) {
823
+                if (!this.currentReceipt.warehouseId) {
758 824
                   //当没有仓库id的时候调用新增仓库接口
759 825
                   await uni.$u.api.addWarehouse(warehouseData)
760 826
                 } else {
761 827
                   //当有仓库id的时候调用编辑仓库接口
828
+                  warehouseData.id = this.currentReceipt.warehouseId
762 829
                   await uni.$u.api.updateWarehouse(warehouseData)
763 830
                 }
764 831
               } else if (this.isWarehouse == '2') {