2 Commits a1b4e46e42 ... 7c86253efc

Author SHA1 Message Date
  peter 7c86253efc feat: cargo集货.货物体积增加计算单位切换.显示逻辑优化. 3 weeks ago
  peter f91fbe4a12 change: indent计价.国外本土运费调整-补充优化. 3 weeks ago

+ 22 - 5
src/pages/cargo-consolidation-request/index.vue

@@ -625,13 +625,19 @@
         label-position="right"
         label-width="95px"
       >
-        <el-form-item label="length (m)">
+        <el-form-item label="长短单位">
+          <el-radio-group v-model="unitType">
+            <el-radio-button :label="1">米 (m)</el-radio-button>
+            <el-radio-button :label="2">厘米 (cm)</el-radio-button>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item :label="`length (${unitType === 1 ? 'm' : 'cm'})`">
           <el-input v-model="cubeForm.l"></el-input>
         </el-form-item>
-        <el-form-item label="width (m)">
+        <el-form-item :label="`width (${unitType === 1 ? 'm' : 'cm'})`">
           <el-input v-model="cubeForm.w"></el-input>
         </el-form-item>
-        <el-form-item label="height (m)">
+        <el-form-item :label="`height (${unitType === 1 ? 'm' : 'cm'})`">
           <el-input v-model="cubeForm.h"></el-input>
         </el-form-item>
         <el-form-item label="箱数(整数)">
@@ -689,6 +695,9 @@ import {
   ElDrawer,
   ElDialog,
   ElCheckbox,
+  ElRadio,
+  ElRadioGroup,
+  ElRadioButton,
 } from 'element-plus'
 import cloneDeep from 'lodash.clonedeep'
 import dayjs from 'dayjs'
@@ -1388,6 +1397,7 @@ const closeMapDrawer = () => {
   mapDrawerVisible.value = false
 }
 let cubeDialogVisible = ref(-1)
+let unitType = ref(1) // 1:m 2:cm
 let cubeForm = ref({
   l: '',
   w: '',
@@ -1397,14 +1407,21 @@ let cubeForm = ref({
 let cubeForm2 = ref({
   c: '' as string | number, // 体积
 })
+watch(unitType, () => {
+  cubeForm.value.l = Number(cubeForm.value.l) * (unitType.value === 1 ? 0.01 : 100) + ''
+  cubeForm.value.w = Number(cubeForm.value.w) * (unitType.value === 1 ? 0.01 : 100) + ''
+  cubeForm.value.h = Number(cubeForm.value.h) * (unitType.value === 1 ? 0.01 : 100) + ''
+})
 watch(
   cubeForm,
   () => {
-    cubeForm2.value.c =
+    cubeForm2.value.c = (
       Number(cubeForm.value.l) *
       Number(cubeForm.value.w) *
       Number(cubeForm.value.h) *
-      Number(cubeForm.value.Carton)
+      Number(cubeForm.value.Carton) *
+      (unitType.value === 2 ? 0.000001 : 1)
+    ).toFixed(2)
   },
   {
     immediate: true,

+ 20 - 2
src/pages/indent-manage/indent/components/calcPrice/index.vue

@@ -816,6 +816,7 @@ let getForginCityFreight = (p: any, num: number) =>
         if (response.code === 1) {
           forginCityFreight.value[`${num}`] = response.result
           queryArea.value = response.result.area || ''
+          formData.value.cal_city.local_city = queryArea.value
           resolve(response.result)
         }
       })
@@ -876,6 +877,7 @@ let resetData = () => {
     other_notes: '',
     saleperson: '',
   }
+  currentTab.value = 0
 }
 
 // 总箱数. 购买数量/每箱数量.
@@ -1002,6 +1004,19 @@ let computedCityFreightParams = computed(() => {
   return []
 })
 
+/**
+ * 对旧的 城市数据 做一个简单的转换, 让它能对应上新的地区数据.
+ * @param str
+ */
+let transCity = (str: string) => {
+  let cityObj: any = {
+    SYD: 'NSW',
+    Melb: 'VIC',
+    Brisbane: 'QLD',
+  }
+
+  return cityObj[str] || str
+}
 /**
  * 初始化图片价格等信息, step3已保存的计价数据, step2已保存的城市/地区/邮编信息
  */
@@ -1046,8 +1061,11 @@ let initProductInfo = async () => {
   // 初始化之前选择的城市
   if (temp.save_cal.cal_city) {
     let local_city = temp.save_cal.cal_city.local_city || areaList.value[0].label
-    formData.value.cal_city.local_city = local_city
-    let tempResult = areaList.value.filter((i) => i.label === local_city)
+
+    formData.value.cal_city.local_city = transCity(local_city)
+
+    let tempResult = areaList.value.filter((i) => i.label === formData.value.cal_city.local_city)
+
     formData.value.cal_city.postcode =
       temp.save_cal.cal_city.postcode ||
       (tempResult.length ? tempResult[0].value : areaList.value[0].value)