소스 검색

feat: 添加保卡日期选择功能到订单详情页面

Yannay 1 주 전
부모
커밋
58ed5c2130
2개의 변경된 파일70개의 추가작업 그리고 5개의 파일을 삭제
  1. 68 3
      pages/orderDetailRefactored/components/PageFour.vue
  2. 2 2
      store/modules/user.js

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

@@ -137,6 +137,17 @@
137 137
                 @blur="saveWarehouseInfoOnBlur" />
138 138
             </u-form-item>
139 139
           </u-col>
140
+          <u-col span="5.8">
141
+            <view @tap="openCardDatePicker">
142
+              <u-form-item label="保卡日期" prop="cardDate">
143
+                <view class="click-wrapper info-input">
144
+                  {{ warehouseInfo.cardDate || '点击选择保卡日期' }}
145
+                </view>
146
+              </u-form-item>
147
+            </view>
148
+            <u-datetime-picker :show="showCardDatePicker" :value="cardDatePickerValue" mode="date"
149
+              @confirm="confirmCardDate" @close="showCardDatePicker = false" @cancel="showCardDatePicker = false" />
150
+          </u-col>
140 151
         </u-row>
141 152
         <!-- 成本合计、业绩、毛业绩 -->
142 153
         <u-row class="info-row" justify="space-between">
@@ -318,6 +329,7 @@ export default {
318 329
         performance: '',
319 330
         splitRatio: '',
320 331
         remarks: '',
332
+        cardDate: '',
321 333
         customerServiceNameLabel: '',
322 334
         customerServiceName: '',
323 335
         categoryLabel: '',
@@ -325,6 +337,7 @@ export default {
325 337
         needCheckCodeLabel: '',
326 338
         needCheckCode: ''
327 339
       },
340
+      showCardDatePicker: false,
328 341
       profitSharingList: [],
329 342
       showOrgPicker: false,
330 343
       showPersonPicker: false,
@@ -383,6 +396,12 @@ export default {
383 396
       const performance = this.computedPerformance || 0
384 397
       const splitRatio = Number(this.warehouseInfo.splitRatio) / 100 || 0
385 398
       return (performance * splitRatio).toFixed(2)
399
+    },
400
+    // 保卡日期选择器用:转为时间戳
401
+    cardDatePickerValue() {
402
+      if (!this.warehouseInfo.cardDate) return Date.now()
403
+      const t = dayjs(this.warehouseInfo.cardDate, 'YYYY-MM-DD').valueOf()
404
+      return Number.isNaN(t) ? Date.now() : t
386 405
     }
387 406
   },
388 407
   watch: {
@@ -441,6 +460,7 @@ export default {
441 460
         splitRatio: data.splitRatio || '',
442 461
         remarks: remarkParts[0] || '',
443 462
         model: data.model || '',
463
+        cardDate: data.cardDate || '',
444 464
         customerServiceName: defaultCustomerServiceName,
445 465
         customerServiceNameLabel: this.getLabelByValue(
446 466
           this.customerServiceColumns[0],
@@ -467,6 +487,17 @@ export default {
467 487
       return item ? item.label : ''
468 488
     },
469 489
 
490
+    openCardDatePicker() {
491
+      this.showCardDatePicker = true
492
+    },
493
+    confirmCardDate(e) {
494
+      this.$nextTick(() => {
495
+        this.warehouseInfo.cardDate = e.value ? dayjs(e.value).format('YYYY-MM-DD') : ''
496
+        this.showCardDatePicker = false
497
+        this.saveWarehouseInfoOnBlur()
498
+      })
499
+    },
500
+
470 501
     /**
471 502
      * 入库信息失焦 / 物流图片变更后保存
472 503
      */
@@ -491,7 +522,8 @@ export default {
491 522
           category: this.warehouseInfo.category || '',
492 523
           needCheckCode: this.warehouseInfo.needCheckCode || '',
493 524
           totalCost: this.computedTotalCost || '',
494
-          model: this.warehouseInfo.model || ''
525
+          model: this.warehouseInfo.model || '',
526
+          cardDate: this.warehouseInfo.cardDate || ''
495 527
         })
496 528
       } catch (e) {
497 529
         console.error('保存入库信息失败:', e)
@@ -826,6 +858,7 @@ export default {
826 858
                   needCheckCode: this.warehouseInfo.needCheckCode || '',
827 859
                   totalCost: this.computedTotalCost || '',
828 860
                   model: this.warehouseInfo.model || '',
861
+                  cardDate: this.warehouseInfo.cardDate || '',
829 862
                 })
830 863
 
831 864
                 // 上传分成数据
@@ -934,10 +967,39 @@ export default {
934 967
       }
935 968
 
936 969
       // 校验表单
937
-      this.$refs.form.validate().then(() => {
970
+      this.$refs.form.validate().then(async () => {
971
+        // 先解析收单人、鉴定人,用于弹窗展示及入库提交(与 PC warehouseDialog 一致)
972
+        const orderSource = this._latestOrderForWarehouse || this.orderDetail
973
+        const receiptNickName = orderSource?.receiptNickName ?? ''
974
+        const authUserId = orderSource?.authenticateUserId ?? null
975
+        let identifyingPerson = orderSource?.authenticateNickName ?? ''
976
+        const identifyingPersonId = authUserId != null ? String(authUserId) : ''
977
+        if (authUserId != null && authUserId !== '') {
978
+          try {
979
+            const userRes = await uni.$u.api.getUserByUserIds({ userIds: String(authUserId) })
980
+            const list = userRes?.data ?? userRes
981
+            const user = Array.isArray(list) ? list[0] : list
982
+            if (user && (user.nickName != null || user.nickname != null)) {
983
+              identifyingPerson = user.nickName ?? user.nickname ?? ''
984
+            }
985
+          } catch (e) {
986
+            console.warn('根据鉴定人 id 获取昵称失败,使用发单返回的昵称', e)
987
+          }
988
+        }
989
+        const receiptLabel = receiptNickName || '-'
990
+        const identifyingLabel = identifyingPerson || '-'
991
+        // 与 PC warehouseDialog 一致:品牌、来源、实价、型号、编码、保卡日期、备注
992
+        const brandLabel = this.currentReceipt.brand || '-'
993
+        const websiteLabel = this.orderDetail.website || '-'
994
+        const sellingPriceLabel = this.currentReceipt.sellingPrice != null && this.currentReceipt.sellingPrice !== '' ? this.currentReceipt.sellingPrice : '-'
995
+        const modelLabel = this.warehouseInfo.model || '-'
996
+        const codeLabel = this.warehouseInfo.codeStorage || '-'
997
+        const cardDateLabel = this.warehouseInfo.cardDate || '-'
998
+        const receiptRemarkLabel = `${this.warehouseInfo.remarks || ''}${this.warehouseInfo.uploadedImage ? ';' + this.warehouseInfo.uploadedImage : ''}`.trim() || '-'
999
+
938 1000
         uni.showModal({
939 1001
           title: '确认入库',
940
-          content: `是否确认入库该订单:${this.orderDetail.item}-${this.currentReceipt.brand}?`,
1002
+          content: `是否确认入库该订单:${this.orderDetail.item}-${this.currentReceipt.brand}?\n收单人:${receiptLabel}\n鉴定人:${identifyingLabel}\n品牌:${brandLabel}\n来源:${websiteLabel}\n实价:${sellingPriceLabel}\n型号:${modelLabel}\n编码:${codeLabel}\n保卡日期:${cardDateLabel}\n备注:${receiptRemarkLabel}`,
941 1003
           success: async (res) => {
942 1004
             if (res.confirm) {
943 1005
               //点击了确认入库,执行入库方法
@@ -985,6 +1047,7 @@ export default {
985 1047
                   indentifyCode: this.warehouseInfo.codeStorage || '',//独立编码
986 1048
                   costPrice: this.computedTotalCost || '',//总成本价
987 1049
                   recycleTime: dayjs().format('YYYY-MM-DD'),//回收时间 必填
1050
+                  cardDate: this.warehouseInfo.cardDate || '',//保卡日期
988 1051
                   stockStatus: 0,//库存状态,0待入库,1已入库,因为是我们是预入库,所以是0
989 1052
                   origin: this.orderDetail.website,//来源
990 1053
                   actualPrice: this.currentReceipt.sellingPrice || '',//实价,也就是顶部的第三个价格sellingPrice
@@ -992,6 +1055,8 @@ export default {
992 1055
                   model: this.warehouseInfo.model || '',//型号
993 1056
                   recyclePerson: (this._latestOrderForWarehouse && this._latestOrderForWarehouse.receiptNickName != null) ? this._latestOrderForWarehouse.receiptNickName : (this.warehouseInfo.recyclePerson || ''),//回收人员:使用接口返回的收单人员姓名
994 1057
                   recyclePersonId: (this._latestOrderForWarehouse && this._latestOrderForWarehouse.receiptUserId != null) ? this._latestOrderForWarehouse.receiptUserId : (this.warehouseInfo.recyclePersonId || ''),//回收人员id:使用接口返回的收单人员id
1058
+                  identifyingPerson: identifyingPerson || '',   // 鉴定人:发单鉴定人,昵称由系统接口按 id 查询
1059
+                  identifyingPersonId: identifyingPersonId || ''  // 鉴定人 id:来自发单 authenticateUserId
995 1060
                 }
996 1061
                 if (!this.currentReceipt.warehouseId) {
997 1062
                   //当没有仓库id的时候调用新增仓库接口

+ 2 - 2
store/modules/user.js

@@ -31,8 +31,8 @@ export default {
31 31
 		netConfig: {
32 32
 			// http://59.42.9.166:9520/proxy
33 33
 			// http://10.0.7.100:9500
34
-			ip: "https://crm.nanjingshiyu.com/prod-api/", // ip
35
-			// ip: "https://crmtest.nanjingshiyu.com/prod-api", // 测试环境ip
34
+			// ip: "https://crm.nanjingshiyu.com/prod-api/", // ip
35
+			ip: "https://crmtest.nanjingshiyu.com/prod-api", // 测试环境ip
36 36
 			// ip : "/api", // 测试环境ip
37 37
 			// ip : "http://47.113.184.101", // 测试环境ip
38 38
 			// ip: "http://172.16.7.200", // ip