1.1.26 邮寄申请改为监听省份、重量以计算最优资费。

dev
yinq 1 week ago
parent 3bdbdfa883
commit a76bcf1ee4

@ -115,7 +115,7 @@
<el-input v-model="form.expressNo" placeholder="请输入快递单号" :disabled="!isFormEditable" />
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.mailingType === '1' && (bestSolutionLoading || bestSolution)">
<el-col :span="24" v-if="(bestSolutionLoading || bestSolution)">
<el-alert
v-loading="bestSolutionLoading"
:title="bestSolution ? `最优惠方案推荐:${bestSolution.solutionName} (预估费用:¥${bestSolution.price}` : '正在查询最优方案...'"
@ -318,6 +318,7 @@ const routeParams = ref<Record<string, any>>({});
//
const bestSolution = ref<CrmShippingTariffVO | null>(null);
const bestSolutionLoading = ref(false);
const bestSolutionReqSeq = ref(0);
//
const taskVariables = ref<any>({});
@ -443,18 +444,29 @@ watch(
//
watch(
() => [form.value.province, form.value.weight, form.value.mailingType],
async ([province, weight, type]) => {
if (type === '1' && province && weight) {
async ([province, weight, mailingType]) => {
const provinceName = typeof province === 'string' ? province.trim() : '';
const validWeight = typeof weight === 'number' && !Number.isNaN(weight);
if (provinceName && validWeight) {
const reqSeq = ++bestSolutionReqSeq.value;
bestSolutionLoading.value = true;
try {
const res = await getBestSolution(province as string, weight as number);
bestSolution.value = res.data;
const res = await getBestSolution(provinceName, weight);
if (reqSeq === bestSolutionReqSeq.value) {
bestSolution.value = res.data;
}
} catch (e) {
bestSolution.value = null;
if (reqSeq === bestSolutionReqSeq.value) {
bestSolution.value = null;
}
} finally {
bestSolutionLoading.value = false;
if (reqSeq === bestSolutionReqSeq.value) {
bestSolutionLoading.value = false;
}
}
} else {
bestSolutionReqSeq.value++;
bestSolutionLoading.value = false;
bestSolution.value = null;
}
},

Loading…
Cancel
Save