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

修改核价流程,使其与询价流程一致

Yannay пре 1 недеља
родитељ
комит
9a4af39740
2 измењених фајлова са 73 додато и 45 уклоњено
  1. 71 43
      pages/orderDetailRefactored/components/PageThree.vue
  2. 2 2
      store/modules/user.js

+ 71 - 43
pages/orderDetailRefactored/components/PageThree.vue

@@ -59,7 +59,10 @@
59
         </u-col>
59
         </u-col>
60
         <u-col span="6">
60
         <u-col span="6">
61
           <view class="info-label">核价价格</view>
61
           <view class="info-label">核价价格</view>
62
-          <view class="info-value">¥{{ currentReceipt.inquiryPrice || 0 }}</view>
62
+          <view class="info-value">
63
+            ¥{{ currentReceipt.inquiryPrice || 0 }}
64
+            <text v-if="hasMorePricingPrice" class="pricing-more" @click.stop="handlePricing">更多</text>
65
+          </view>
63
         </u-col>
66
         </u-col>
64
       </u-row>
67
       </u-row>
65
     </view>
68
     </view>
@@ -153,9 +156,10 @@
153
       confirmText="确认并继续付款" :show="riskWarningModalVisible" title="付款警示" :content="'湖南耒阳地区身份证号请确认!'">
156
       confirmText="确认并继续付款" :show="riskWarningModalVisible" title="付款警示" :content="'湖南耒阳地区身份证号请确认!'">
154
     </u-modal>
157
     </u-modal>
155
 
158
 
156
-    <!-- 核价对话框 -->
159
+    <!-- 核价对话框:与公海询价一致,不传 isShowHistory(不显示核价历史),编辑用 editForm(不显示价格/备注输入栏) -->
157
     <add-inquiry-dialog ref="pricingDialog" :clueId="pricingClueId" :editOrAdd="pricingEditOrAdd"
160
     <add-inquiry-dialog ref="pricingDialog" :clueId="pricingClueId" :editOrAdd="pricingEditOrAdd"
158
-      :editInfo="pricingEditInfo" :type="2" title="询价" />
161
+      :editInfo="pricingEditInfo" :type="2" title="核价" :isShowChart="pricingIsShowChart"
162
+      @submitSuccess="onPricingSuccess" />
159
 
163
 
160
     <u-modal :show="payNowModalVisible" title="确认支付信息" :showConfirmButton="false">
164
     <u-modal :show="payNowModalVisible" title="确认支付信息" :showConfirmButton="false">
161
       <view class="modal-content">
165
       <view class="modal-content">
@@ -245,7 +249,8 @@ export default {
245
       // 核价相关
249
       // 核价相关
246
       pricingClueId: '',
250
       pricingClueId: '',
247
       pricingEditOrAdd: 'receptFormAdd',
251
       pricingEditOrAdd: 'receptFormAdd',
248
-      pricingEditInfo: {}
252
+      pricingEditInfo: {},
253
+      pricingIsShowChart: false
249
     }
254
     }
250
   },
255
   },
251
   computed: {
256
   computed: {
@@ -273,9 +278,15 @@ export default {
273
     bankAccountPlaceholder() {
278
     bankAccountPlaceholder() {
274
       return this.isAlipayPayment ? '请输入支付宝账号' : '请输入银行账号'
279
       return this.isAlipayPayment ? '请输入支付宝账号' : '请输入银行账号'
275
     },
280
     },
276
-    // 是否有核价信息
281
+    // 是否有核价信息(至少一人出价时才展示卡片)
277
     hasInquiryInfo() {
282
     hasInquiryInfo() {
278
-      return this.currentReceipt && (this.currentReceipt.inquiryCount || this.currentReceipt.inquiryPrice)
283
+      const n = this.currentReceipt && this.currentReceipt.inquiryCount
284
+      return n != null && Number(n) > 0
285
+    },
286
+    // 是否有多人核价出价(显示「更多」)
287
+    hasMorePricingPrice() {
288
+      const n = this.currentReceipt && this.currentReceipt.inquiryCount
289
+      return (n != null && Number(n) > 1)
279
     }
290
     }
280
   },
291
   },
281
   watch: {
292
   watch: {
@@ -833,12 +844,10 @@ export default {
833
     },
844
     },
834
 
845
 
835
     /**
846
     /**
836
-     * 核价
847
+     * 核价:与公海询价一致逻辑。count 为 null → 未提出,新增;count 为 0 → 已提出无人出价,回显不显示柱状图;count > 0 → 显示柱状图。多人出价时核价信息区显示「更多」点击也走此处并带柱状图。
837
      */
848
      */
838
     async handlePricing() {
849
     async handlePricing() {
839
-      const brandList = await this.$getDicts("crm_form_brand");
840
-
841
-
850
+      const brandList = await this.$getDicts('crm_form_brand')
842
       if (!this.currentReceipt || !this.currentReceipt.clueId) {
851
       if (!this.currentReceipt || !this.currentReceipt.clueId) {
843
         uni.$u.toast('缺少线索ID')
852
         uni.$u.toast('缺少线索ID')
844
         return
853
         return
@@ -852,67 +861,77 @@ export default {
852
         return
861
         return
853
       }
862
       }
854
 
863
 
855
-      //我这里询价要用receiptid来询价
856
       this.pricingClueId = this.currentReceipt.id
864
       this.pricingClueId = this.currentReceipt.id
857
-
858
-      // brand 是品牌的 id(dictValue),itemBrand 是品牌的 label(dictLabel)
859
       const brandDictLabel = this.currentReceipt.brand
865
       const brandDictLabel = this.currentReceipt.brand
860
-      const brandDictValue = brandList.find(item => item.dictLabel === this.currentReceipt.brand).dictValue;
861
-
862
-      // 将图片转换为 imgsUrl 格式
866
+      const brandDictValue = brandList.find(item => item.dictLabel === this.currentReceipt.brand)?.dictValue
863
       const imgsUrl = this.displayImages.map(item => item.fileUrl).filter(url => url)
867
       const imgsUrl = this.displayImages.map(item => item.fileUrl).filter(url => url)
864
 
868
 
865
-      // 检查是否已有核价记录
866
-      try {
867
-        const data = {
868
-          clueId: this.pricingClueId,
869
-          type: 2
869
+      const count = this.currentReceipt.inquiryCount != null ? Number(this.currentReceipt.inquiryCount) : null
870
+
871
+      if (count === null) {
872
+        // 未提出核价:新增
873
+        this.pricingIsShowChart = false
874
+        this.pricingEditOrAdd = 'receptFormAdd'
875
+        this.pricingEditInfo = {
876
+          dictLabel: brandDictLabel,
877
+          dictValue: brandDictValue,
878
+          imgsUrl,
879
+          model: this.currentReceipt.model,
880
+          code: this.currentReceipt.code || '',
881
+          price: ''
870
         }
882
         }
883
+        this.$nextTick(() => this.$refs.pricingDialog.showDialog())
884
+        return
885
+      }
886
+
887
+      // 已提出核价(count 为 0 或 >0):拉详情回显
888
+      try {
889
+        const data = { clueId: this.pricingClueId, type: 2 }
871
         const res = await uni.$u.api.inquiryDetail(data)
890
         const res = await uni.$u.api.inquiryDetail(data)
872
         if (res.code === 200 && res.data) {
891
         if (res.code === 200 && res.data) {
873
-          // 编辑模式:保留原有数据,但更新品牌和图片
874
-          this.pricingEditOrAdd = 'edit'
892
+          this.pricingEditOrAdd = 'editForm'
893
+          this.pricingIsShowChart = (res.data.count != null && Number(res.data.count) > 0)
875
           this.pricingEditInfo = {
894
           this.pricingEditInfo = {
876
             ...res.data,
895
             ...res.data,
877
-            dictLabel: brandDictLabel || res.data.dictLabel,
878
-            dictValue: brandDictValue || res.data.dictValue,
879
-            imgsUrl: imgsUrl.length > 0 ? imgsUrl : (res.data.imgsUrl || [])
896
+            // dictLabel: brandDictLabel || res.data.dictLabel,
897
+            // dictValue: brandDictValue || res.data.dictValue,
898
+            // imgsUrl: imgsUrl.length > 0 ? imgsUrl : (res.data.imgsUrl || [])
880
           }
899
           }
881
-          this.$nextTick(() => {
882
-            this.$refs.pricingDialog.showDialog()
883
-          })
900
+          this.$nextTick(() => this.$refs.pricingDialog.showDialog())
884
         } else {
901
         } else {
885
-          // 新增模式:设置品牌和图片
902
+          this.pricingIsShowChart = false
886
           this.pricingEditOrAdd = 'receptFormAdd'
903
           this.pricingEditOrAdd = 'receptFormAdd'
887
           this.pricingEditInfo = {
904
           this.pricingEditInfo = {
888
             dictLabel: brandDictLabel,
905
             dictLabel: brandDictLabel,
889
             dictValue: brandDictValue,
906
             dictValue: brandDictValue,
890
-            imgsUrl: imgsUrl,
907
+            imgsUrl,
891
             model: this.currentReceipt.model,
908
             model: this.currentReceipt.model,
892
-            code: '',
909
+            code: this.currentReceipt.code || '',
893
             price: ''
910
             price: ''
894
           }
911
           }
895
-          this.$nextTick(() => {
896
-            this.$refs.pricingDialog.showDialog()
897
-          })
912
+          this.$nextTick(() => this.$refs.pricingDialog.showDialog())
898
         }
913
         }
899
-      } catch (error) {
900
-        // 如果没有记录,则新增
901
-        this.pricingEditOrAdd = 'add'
914
+      } catch (e) {
915
+        this.pricingIsShowChart = false
916
+        this.pricingEditOrAdd = 'receptFormAdd'
902
         this.pricingEditInfo = {
917
         this.pricingEditInfo = {
903
           dictLabel: brandDictLabel,
918
           dictLabel: brandDictLabel,
904
           dictValue: brandDictValue,
919
           dictValue: brandDictValue,
905
-          imgsUrl: imgsUrl,
920
+          imgsUrl,
906
           model: this.currentReceipt.model,
921
           model: this.currentReceipt.model,
907
-          code: '',
922
+          code: this.currentReceipt.code || '',
908
           price: ''
923
           price: ''
909
         }
924
         }
910
-        this.$nextTick(() => {
911
-          this.$refs.pricingDialog.showDialog()
912
-        })
925
+        this.$nextTick(() => this.$refs.pricingDialog.showDialog())
913
       }
926
       }
914
     },
927
     },
915
 
928
 
929
+    /** 核价提交成功后刷新当前回单,以便核价人数/价格更新 */
930
+    onPricingSuccess() {
931
+      this.$refs.pricingDialog.closeDialog()
932
+      this.$emit('price-updated')
933
+    },
934
+
916
   }
935
   }
917
 }
936
 }
918
 </script>
937
 </script>
@@ -951,6 +970,15 @@ export default {
951
   display: block;
970
   display: block;
952
 }
971
 }
953
 
972
 
973
+.pricing-more {
974
+  margin-left: 12rpx;
975
+  font-size: 24rpx;
976
+  color: #3c9cff;
977
+  border: 1rpx solid #3c9cff;
978
+  border-radius: 10rpx;
979
+  padding: 4rpx 12rpx;
980
+}
981
+
954
 .info-input {
982
 .info-input {
955
   border-radius: 8rpx;
983
   border-radius: 8rpx;
956
   border: 1rpx solid #e5e7eb;
984
   border: 1rpx solid #e5e7eb;

+ 2 - 2
store/modules/user.js

@@ -31,8 +31,8 @@ export default {
31
 		netConfig: {
31
 		netConfig: {
32
 			// http://59.42.9.166:9520/proxy
32
 			// http://59.42.9.166:9520/proxy
33
 			// http://10.0.7.100:9500
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
 			// ip : "/api", // 测试环境ip
36
 			// ip : "/api", // 测试环境ip
37
 			// ip : "http://47.113.184.101", // 测试环境ip
37
 			// ip : "http://47.113.184.101", // 测试环境ip
38
 			// ip: "http://172.16.7.200", // ip
38
 			// ip: "http://172.16.7.200", // ip