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

Loading…
Cancel
Save