|
|
|
@ -268,10 +268,14 @@
|
|
|
|
|
width="70%" |
|
|
|
|
v-model="details.popUpShow.addVsitied" |
|
|
|
|
> |
|
|
|
|
<el-form inline label-width="130px"> |
|
|
|
|
<el-form-item label="始发地"> |
|
|
|
|
<el-form inline :model="details.form" ref="lineFormRef" label-width="130px"> |
|
|
|
|
<el-form-item |
|
|
|
|
label="始发地" |
|
|
|
|
prop="startCity" |
|
|
|
|
:rules="[{ required: true, message: '请选择始发地', trigger: ['blur', 'change'] }]" |
|
|
|
|
> |
|
|
|
|
<el-cascader |
|
|
|
|
pleceholder="请选择到站地址" |
|
|
|
|
pleceholder="请选择始发地" |
|
|
|
|
:options="details.regionOptione" |
|
|
|
|
style="width: 100%" |
|
|
|
|
v-model="details.form.startCity" |
|
|
|
@ -286,9 +290,13 @@
|
|
|
|
|
</el-cascader> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="目的地"> |
|
|
|
|
<el-form-item |
|
|
|
|
label="目的地" |
|
|
|
|
prop="endCity" |
|
|
|
|
:rules="[{ required: true, message: '请选择目的地', trigger: ['blur', 'change'] }]" |
|
|
|
|
> |
|
|
|
|
<el-cascader |
|
|
|
|
pleceholder="请选择到站地址" |
|
|
|
|
pleceholder="请选择目的地" |
|
|
|
|
:options="details.regionOptione" |
|
|
|
|
style="width: 100%" |
|
|
|
|
v-model="details.form.endCity" |
|
|
|
@ -303,7 +311,11 @@
|
|
|
|
|
</el-cascader> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="发货单位"> |
|
|
|
|
<el-form-item |
|
|
|
|
label="发货单位" |
|
|
|
|
prop="sendOrg" |
|
|
|
|
:rules="[{ required: true, message: '请选择发货单位', trigger: ['blur', 'change'] }]" |
|
|
|
|
> |
|
|
|
|
<el-select |
|
|
|
|
class="w100" |
|
|
|
|
v-model="details.form.sendOrg" |
|
|
|
@ -541,6 +553,9 @@ console.log('props :>> ', props);
|
|
|
|
|
/** 表单实例 */ |
|
|
|
|
const formRef = ref(); |
|
|
|
|
|
|
|
|
|
/** 提货路径表单 */ |
|
|
|
|
const lineFormRef = ref(); |
|
|
|
|
|
|
|
|
|
const VehicleBillingFormRef = ref(); |
|
|
|
|
|
|
|
|
|
// 品类价格 |
|
|
|
@ -565,7 +580,7 @@ interface BillTemplateDetail {
|
|
|
|
|
/** 整车计费 */ |
|
|
|
|
interface VehicleBilling { |
|
|
|
|
/** 车型 */ |
|
|
|
|
pickupPricingType: string; |
|
|
|
|
vehicleType: string; |
|
|
|
|
/** 车型计费(元/车) */ |
|
|
|
|
price: number; |
|
|
|
|
} |
|
|
|
@ -604,7 +619,7 @@ const details = reactive({
|
|
|
|
|
VehicleBillingDetal: [ |
|
|
|
|
{ |
|
|
|
|
/** 车型 */ |
|
|
|
|
pickupPricingType: '', |
|
|
|
|
vehicleType: '', |
|
|
|
|
/** 车型计费(元/车) */ |
|
|
|
|
price: 0, |
|
|
|
|
}, |
|
|
|
@ -824,16 +839,18 @@ const handleVehicleTypeArr = response => {
|
|
|
|
|
|
|
|
|
|
/** 获取业务字典 */ |
|
|
|
|
const initDictionaryBiz = async () => { |
|
|
|
|
console.log('123213213 :>> ', 123213213); |
|
|
|
|
try { |
|
|
|
|
// 干线计费方式 |
|
|
|
|
const trunkLinePromise = getDictionaryBiz('trunk_line_pricing_type'); |
|
|
|
|
// 车辆类型 |
|
|
|
|
const priceVehiclePromise = getDictionaryBiz('price_vehicle_type'); |
|
|
|
|
const { trunkLineResult, priceVehicleResult, regionOptione } = props.templateData; |
|
|
|
|
// // 干线计费方式 |
|
|
|
|
// const trunkLinePromise = getDictionaryBiz('trunk_line_pricing_type'); |
|
|
|
|
// // 车辆类型 |
|
|
|
|
// const priceVehiclePromise = getDictionaryBiz('price_vehicle_type'); |
|
|
|
|
|
|
|
|
|
const [trunkLineResult, priceVehicleResult] = await Promise.all([ |
|
|
|
|
trunkLinePromise, |
|
|
|
|
priceVehiclePromise, |
|
|
|
|
]); |
|
|
|
|
// const [trunkLineResult, priceVehicleResult] = await Promise.all([ |
|
|
|
|
// trunkLinePromise, |
|
|
|
|
// priceVehiclePromise, |
|
|
|
|
// ]); |
|
|
|
|
|
|
|
|
|
await nextTick(); |
|
|
|
|
|
|
|
|
@ -853,12 +870,15 @@ const initDictionaryBiz = async () => {
|
|
|
|
|
|
|
|
|
|
// 不按统一区域计费, 初始化获取数据 |
|
|
|
|
if (details.form.pickupIsUnifyAreaBill === '0') { |
|
|
|
|
console.log('123 :>> ', 123); |
|
|
|
|
|
|
|
|
|
// 获取省市区信息 |
|
|
|
|
const res = await getLazyTreeAll(); |
|
|
|
|
if (res.data.success) { |
|
|
|
|
details.regionOptione = res.data.data || []; |
|
|
|
|
if (regionOptione.data.success) { |
|
|
|
|
details.regionOptione = regionOptione.data.data || []; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
console.log('123321 :>> ', 123321); |
|
|
|
|
|
|
|
|
|
initLineData(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -867,6 +887,7 @@ const initDictionaryBiz = async () => {
|
|
|
|
|
handleTrunkLinePricingType(trunkLineResult); |
|
|
|
|
handleVehicleTypeArr(priceVehicleResult); |
|
|
|
|
|
|
|
|
|
initAssignmentForm(props.templateData.requestInfo.pickup, false); |
|
|
|
|
// 初始化复制form数据 |
|
|
|
|
initFormData(); |
|
|
|
|
} catch (error) { |
|
|
|
@ -894,7 +915,7 @@ const handlePlusVehicle = async (index: number) => {
|
|
|
|
|
|
|
|
|
|
details.VehicleBillingDetal.splice(index + 1, 0, { |
|
|
|
|
/** 车型 */ |
|
|
|
|
pickupPricingType: '', |
|
|
|
|
vehicleType: '', |
|
|
|
|
/** 车型计费(元/车) */ |
|
|
|
|
price: 0, |
|
|
|
|
}); |
|
|
|
@ -972,7 +993,7 @@ const initLineData = async () => {
|
|
|
|
|
try { |
|
|
|
|
details.loadingObj.list = true; |
|
|
|
|
|
|
|
|
|
const res = await getPage({ ...details.page, priceId: $route.query.id }); |
|
|
|
|
const res = await getPage({ ...details.page, priceId: $route.query.id, serviceType: '1' }); |
|
|
|
|
const { code, data } = res.data; |
|
|
|
|
|
|
|
|
|
if (code !== 200) return; |
|
|
|
@ -1081,7 +1102,7 @@ const handleAdd = () => {
|
|
|
|
|
details.VehicleBillingDetal = [ |
|
|
|
|
{ |
|
|
|
|
/** 车型 */ |
|
|
|
|
pickupPricingType: '', |
|
|
|
|
vehicleType: '', |
|
|
|
|
/** 车型计费(元/车) */ |
|
|
|
|
price: 0, |
|
|
|
|
}, |
|
|
|
@ -1091,7 +1112,8 @@ const handleAdd = () => {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** 给form赋值 */ |
|
|
|
|
const initAssignmentForm = data => { |
|
|
|
|
const initAssignmentForm = (data, isLine = true) => { |
|
|
|
|
if (isLine) { |
|
|
|
|
details.form.startCity = [ |
|
|
|
|
...new Set([data.startProvinceId + '', data.startCityId + '', data.startCountyId + '']), |
|
|
|
|
]; |
|
|
|
@ -1101,12 +1123,20 @@ const initAssignmentForm = data => {
|
|
|
|
|
details.form.sendOrgId = data.sendOrgId; |
|
|
|
|
details.form.sendOrg = data.sendOrgName; |
|
|
|
|
details.form.priceId = data.priceId; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
details.form.minCost = data.minCost || 0; |
|
|
|
|
details.form.additionalCost = data.additionalCost || 0; |
|
|
|
|
|
|
|
|
|
// 车辆赋值 |
|
|
|
|
details.VehicleBillingDetal = data.fullVehicle || []; |
|
|
|
|
details.VehicleBillingDetal = data.fullVehicle || [ |
|
|
|
|
{ |
|
|
|
|
/** 车型 */ |
|
|
|
|
vehicleType: '', |
|
|
|
|
/** 车型计费(元/车) */ |
|
|
|
|
price: 0, |
|
|
|
|
}, |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
for (let i = 0; i < details.VehicleBillingDetal.length; i++) { |
|
|
|
|
const value = details.VehicleBillingDetal[i]; |
|
|
|
@ -1169,7 +1199,7 @@ const handleEdit = async ({ row }) => {
|
|
|
|
|
details.VehicleBillingDetal = [ |
|
|
|
|
{ |
|
|
|
|
/** 车型 */ |
|
|
|
|
pickupPricingType: '', |
|
|
|
|
vehicleType: '', |
|
|
|
|
/** 车型计费(元/车) */ |
|
|
|
|
price: 0, |
|
|
|
|
}, |
|
|
|
@ -1240,24 +1270,14 @@ const resetFormData = () => {
|
|
|
|
|
|
|
|
|
|
/** 提交 */ |
|
|
|
|
const handleSubmit = async () => { |
|
|
|
|
if (details.form.pickupPricingType.length === 0) ElMessage.error('请选择计价方式'); |
|
|
|
|
|
|
|
|
|
let isRetrun = false; |
|
|
|
|
|
|
|
|
|
await formRef.value.validate(valid => { |
|
|
|
|
// if (!valid) return; |
|
|
|
|
console.log('222 :>> ', 222); |
|
|
|
|
isRetrun = !valid; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
if (isRetrun) return; |
|
|
|
|
ElMessageBox.confirm('确认提交', '', { |
|
|
|
|
confirmButtonText: '确认', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'success', |
|
|
|
|
}).then(async () => { |
|
|
|
|
try { |
|
|
|
|
details.loadingObj.pageLoading = true; |
|
|
|
|
|
|
|
|
|
const submitData: any = { |
|
|
|
|
checkType: '1', |
|
|
|
@ -1283,9 +1303,25 @@ const handleSubmit = async () => {
|
|
|
|
|
// 按重量 |
|
|
|
|
else if (item.code === '4') submitData.pickup.weightCategory = item.categories; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 按整车 |
|
|
|
|
if (details.form.pickupPricingType.includes('2')) |
|
|
|
|
if (details.form.pickupPricingType.includes('2')) { |
|
|
|
|
for (let i = 0; i < details.VehicleBillingDetal.length; i++) { |
|
|
|
|
const value = details.VehicleBillingDetal[i]; |
|
|
|
|
|
|
|
|
|
if (!value.vehicleType) return ElMessage.warning('存在未选车型, 请选择车型'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
submitData.pickup.fullVehicle = details.VehicleBillingDetal; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ElMessageBox.confirm('确认提交', '', { |
|
|
|
|
confirmButtonText: '确认', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'success', |
|
|
|
|
}).then(async () => { |
|
|
|
|
try { |
|
|
|
|
details.loadingObj.pageLoading = true; |
|
|
|
|
|
|
|
|
|
const res = await putBasicdataPrice(submitData); |
|
|
|
|
|
|
|
|
@ -1304,17 +1340,15 @@ const handleSubmit = async () => {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** 提货线路提交 */ |
|
|
|
|
const handleSubmitLine = () => { |
|
|
|
|
ElMessageBox.confirm('确认提交', '', { |
|
|
|
|
confirmButtonText: '确认', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'success', |
|
|
|
|
}).then(async () => { |
|
|
|
|
try { |
|
|
|
|
details.popUpShow.addVsitied = false; // 关闭弹窗 |
|
|
|
|
details.loadingObj.pageLoading = true; // 开启loading |
|
|
|
|
const handleSubmitLine = async () => { |
|
|
|
|
let isRetrun = false; |
|
|
|
|
|
|
|
|
|
console.log('details.form :>> ', details.form); |
|
|
|
|
await lineFormRef.value.validate(valid => { |
|
|
|
|
// if (!valid) return; |
|
|
|
|
isRetrun = !valid; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
if (isRetrun) return; |
|
|
|
|
|
|
|
|
|
const submitData: any = { |
|
|
|
|
startProvinceId: details.form.startProvinceId, // 省 |
|
|
|
@ -1350,9 +1384,28 @@ const handleSubmitLine = () => {
|
|
|
|
|
// 按重量 |
|
|
|
|
else if (item.code === '4') submitData.weightCategory = item.categories; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 按整车 |
|
|
|
|
if (details.form.pickupPricingType.includes('2')) |
|
|
|
|
if (details.form.pickupPricingType.includes('2')) { |
|
|
|
|
for (let i = 0; i < details.VehicleBillingDetal.length; i++) { |
|
|
|
|
const value = details.VehicleBillingDetal[i]; |
|
|
|
|
|
|
|
|
|
if (!value.vehicleType) return ElMessage.warning('存在未选车型, 请选择车型'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
submitData.fullVehicle = details.VehicleBillingDetal; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ElMessageBox.confirm('确认提交', '', { |
|
|
|
|
confirmButtonText: '确认', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'success', |
|
|
|
|
}).then(async () => { |
|
|
|
|
try { |
|
|
|
|
details.popUpShow.addVsitied = false; // 关闭弹窗 |
|
|
|
|
details.loadingObj.pageLoading = true; // 开启loading |
|
|
|
|
|
|
|
|
|
console.log('details.form :>> ', details.form); |
|
|
|
|
|
|
|
|
|
const res = await postSubmit(submitData); |
|
|
|
|
|
|
|
|
|