|
|
|
@ -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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|