Commit b6d347d4 by LJM

平板快递模式"物流公司"默认了顺丰

parent 61db5430
Showing with 25 additions and 41 deletions
...@@ -469,16 +469,6 @@ ...@@ -469,16 +469,6 @@
value: parseInt(value) value: parseInt(value)
})); }));
if(this.real_shipping_type_data.length === 0) {
this.real_shipping_type_data = [];
this.real_shipping_id_data = [];
this.real_shipping_mode_data = [];
this.real_shipping_type_index = 0;
this.real_shipping_id_index = 0;
this.real_shipping_mode_index = 0;
return;
}
// 如果有传入交货方式,则选中对应的值 // 如果有传入交货方式,则选中对应的值
if (selected_shipping_type) { if (selected_shipping_type) {
this.shippingListParams.shipping_type = selected_shipping_type; this.shippingListParams.shipping_type = selected_shipping_type;
...@@ -488,8 +478,12 @@ ...@@ -488,8 +478,12 @@
this.formParams.real_shipping_type = selected_shipping_type; this.formParams.real_shipping_type = selected_shipping_type;
} }
} else { } else {
// 如果没有传入交货方式,则选择第一个作为默认值
this.real_shipping_type_index = 0;
this.shippingListParams.shipping_type = this.real_shipping_type_data[0].value; this.shippingListParams.shipping_type = this.real_shipping_type_data[0].value;
this.formParams.real_shipping_type = this.real_shipping_type_data[0].value;
} }
this.getShippingList(selected_shipping_type, selected_shipping_id, selected_shipping_mode); this.getShippingList(selected_shipping_type, selected_shipping_id, selected_shipping_mode);
return; return;
} }
...@@ -502,14 +496,6 @@ ...@@ -502,14 +496,6 @@
value: item.id value: item.id
})); }));
if(this.real_shipping_id_data.length === 0) {
this.real_shipping_id_data = [];
this.real_shipping_mode_data = [];
this.real_shipping_id_index = 0;
this.real_shipping_mode_index = 0;
return;
}
// 如果有传入物流公司,则选中对应的值 // 如果有传入物流公司,则选中对应的值
if (selected_shipping_id) { if (selected_shipping_id) {
this.shippingListParams.shipping_id = selected_shipping_id; this.shippingListParams.shipping_id = selected_shipping_id;
...@@ -519,8 +505,12 @@ ...@@ -519,8 +505,12 @@
this.formParams.real_shipping_id = selected_shipping_id; this.formParams.real_shipping_id = selected_shipping_id;
} }
} else { } else {
// 如果没有传入物流公司,则选择第一个作为默认值
this.real_shipping_id_index = 0;
this.shippingListParams.shipping_id = this.real_shipping_id_data[0].value; this.shippingListParams.shipping_id = this.real_shipping_id_data[0].value;
this.formParams.real_shipping_id = this.real_shipping_id_data[0].value;
} }
this.getShippingList(selected_shipping_type, selected_shipping_id, selected_shipping_mode); this.getShippingList(selected_shipping_type, selected_shipping_id, selected_shipping_mode);
return; return;
} }
...@@ -530,15 +520,10 @@ ...@@ -530,15 +520,10 @@
const shippingMode = res.data.shipping_mode || []; const shippingMode = res.data.shipping_mode || [];
this.real_shipping_mode_data = shippingMode.map(item => ({ this.real_shipping_mode_data = shippingMode.map(item => ({
name: item.shipping_mode_name, name: item.shipping_mode_name,
value: item.id value: item.id,
is_default:item.is_default
})); }));
if(this.real_shipping_mode_data.length === 0) {
this.real_shipping_mode_data = [];
this.real_shipping_mode_index = 0;
return;
}
// 如果有传入物流模式,则选中对应的值 // 如果有传入物流模式,则选中对应的值
if (selected_shipping_mode) { if (selected_shipping_mode) {
const index = this.real_shipping_mode_data.findIndex(item => item.value === selected_shipping_mode); const index = this.real_shipping_mode_data.findIndex(item => item.value === selected_shipping_mode);
...@@ -546,6 +531,21 @@ ...@@ -546,6 +531,21 @@
this.real_shipping_mode_index = index; this.real_shipping_mode_index = index;
this.formParams.real_shipping_mode = selected_shipping_mode; this.formParams.real_shipping_mode = selected_shipping_mode;
} }
} else {
// 如果没有传入物流模式,则选择第一个作为默认值
// 查找默认物流模式(is_default=1)
const defaultMode = this.real_shipping_mode_data.find(item => item.is_default === 1);
if (defaultMode) {
// 如果存在默认物流模式则使用默认值
this.real_shipping_mode_index = this.real_shipping_mode_data.findIndex(item => item.value === defaultMode.value);
this.shippingListParams.shipping_mode = defaultMode.value;
this.formParams.real_shipping_mode = defaultMode.value;
} else {
// 如果没有默认值则使用第一个
this.real_shipping_mode_index = 0;
this.shippingListParams.shipping_mode = this.real_shipping_mode_data[0].value;
this.formParams.real_shipping_mode = this.real_shipping_mode_data[0].value;
}
} }
} }
...@@ -590,27 +590,11 @@ ...@@ -590,27 +590,11 @@
setTimeout(() => { setTimeout(() => {
// this.formParams.real_shipping_type = res.data.stock_out_address.real_shipping_type; //交货方式
// let real_shipping_type_index = this.findIndex(this.real_shipping_type_data, this.formParams.real_shipping_type);
// this.real_shipping_type_index = real_shipping_type_index[0];
//显示对应的index的物流公司
// this.formParams.real_shipping_id = res.data.stock_out_address.real_shipping_id; //物流公司
// let real_shipping_id_index = this.findIndex(this.real_shipping_id_data, this.formParams.real_shipping_id);
// this.real_shipping_id_index = real_shipping_id_index[0];
//显示对应index的物流模式
// this.formParams.real_shipping_mode = res.data.stock_out_address.real_shipping_mode; //物流模式
// let real_shipping_mode_index = this.findIndex(this.real_shipping_mode_data, this.formParams.real_shipping_mode);
// this.real_shipping_mode_index = real_shipping_mode_index[0];
//显示对应index的物流付费 //显示对应index的物流付费
this.formParams.shipping_payment_type = res.data.stock_out_address.shipping_payment_type; //物流付费 this.formParams.shipping_payment_type = res.data.stock_out_address.shipping_payment_type; //物流付费
let shipping_payment_type_index = this.findIndex(this.shipping_payment_type_data, this.formParams.shipping_payment_type); let shipping_payment_type_index = this.findIndex(this.shipping_payment_type_data, this.formParams.shipping_payment_type);
this.shipping_payment_type_index = shipping_payment_type_index[0]; this.shipping_payment_type_index = shipping_payment_type_index[0];
this.formParams.shipping_code = res.data.stock_out_address.shipping_code; //物流单号 this.formParams.shipping_code = res.data.stock_out_address.shipping_code; //物流单号
//显示对应的地址栏信息 //显示对应的地址栏信息
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment