|
|
|
@ -59,28 +59,6 @@
|
|
|
|
|
></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="发站:" prop="departure"> |
|
|
|
|
<div class="w100"> |
|
|
|
|
<el-cascader |
|
|
|
|
pleceholder="请选择到站地址" |
|
|
|
|
:options="details.regionOptione" |
|
|
|
|
style="width: 100%" |
|
|
|
|
v-model="query.departure" |
|
|
|
|
:props="{ |
|
|
|
|
checkStrictly: true, |
|
|
|
|
}" |
|
|
|
|
@change="() => handleFindPrice()" |
|
|
|
|
filterable |
|
|
|
|
clearable |
|
|
|
|
> |
|
|
|
|
<template #default="{ node, data }"> |
|
|
|
|
<span>{{ data.label }}</span> |
|
|
|
|
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span> |
|
|
|
|
</template> |
|
|
|
|
</el-cascader> |
|
|
|
|
</div> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="到站:" prop="destination"> |
|
|
|
|
<div class="w100"> |
|
|
|
|
<el-cascader |
|
|
|
@ -177,12 +155,7 @@
|
|
|
|
|
<el-table |
|
|
|
|
:data="details.shipperOptions" |
|
|
|
|
style="width: 100%" |
|
|
|
|
@row-click=" |
|
|
|
|
(column, prop, order) => { |
|
|
|
|
handleChooseShipper(column, prop, order); |
|
|
|
|
handleFindPrice(); |
|
|
|
|
} |
|
|
|
|
" |
|
|
|
|
@row-click="handleChooseShipper" |
|
|
|
|
v-loading="details.loadingObj.consignerLoading" |
|
|
|
|
> |
|
|
|
|
<el-table-column prop="clientName" label="发货单位" width="130" /> |
|
|
|
@ -304,6 +277,7 @@
|
|
|
|
|
@row-click=" |
|
|
|
|
(column, prop, order) => { |
|
|
|
|
handleChooseConsigner(column, prop, order); |
|
|
|
|
handleFindPrice(); |
|
|
|
|
} |
|
|
|
|
" |
|
|
|
|
v-loading="details.loadingObj.consignerLoading" |
|
|
|
@ -333,6 +307,7 @@
|
|
|
|
|
@row-click=" |
|
|
|
|
(column, prop, order) => { |
|
|
|
|
handleChooseConsigner(column, prop, order); |
|
|
|
|
handleFindPrice(); |
|
|
|
|
} |
|
|
|
|
" |
|
|
|
|
v-loading="details.loadingObj.consignerLoading" |
|
|
|
@ -359,109 +334,6 @@
|
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div class="table-row table_row_number"> |
|
|
|
|
<div class="flex-c-c title">提 货</div> |
|
|
|
|
<el-form-item label="是否提货:" label-width="fit-content" prop="num" class="flex1"> |
|
|
|
|
<el-radio-group |
|
|
|
|
@change=" |
|
|
|
|
() => { |
|
|
|
|
if (!details.query.isPickUp) details.query.pickupFee = 0; |
|
|
|
|
} |
|
|
|
|
" |
|
|
|
|
v-model="query.isPickUp" |
|
|
|
|
class="flex-a" |
|
|
|
|
> |
|
|
|
|
<el-radio :label="1">是</el-radio> |
|
|
|
|
<el-radio :label="0">否</el-radio> |
|
|
|
|
</el-radio-group> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="是否整车:" label-width="fit-content" prop="num" class="flex1"> |
|
|
|
|
<el-radio-group |
|
|
|
|
:disabled="!query.isPickUp" |
|
|
|
|
v-model="query.pickupCompleteOrNot" |
|
|
|
|
class="flex-a" |
|
|
|
|
@change=" |
|
|
|
|
() => { |
|
|
|
|
details.query.pickupFee = 0; |
|
|
|
|
handlePrice(); |
|
|
|
|
} |
|
|
|
|
" |
|
|
|
|
> |
|
|
|
|
<el-radio :label="1">是</el-radio> |
|
|
|
|
<el-radio :label="0">否</el-radio> |
|
|
|
|
</el-radio-group> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="车型:" label-width="fit-content" prop="num" class="flex1"> |
|
|
|
|
<el-select |
|
|
|
|
class="w100" |
|
|
|
|
:disabled="!query.isPickUp || !query.pickupCompleteOrNot" |
|
|
|
|
v-model="query.pickupVehicleType" |
|
|
|
|
filterable |
|
|
|
|
clearable |
|
|
|
|
placeholder="请选择车型" |
|
|
|
|
@change=" |
|
|
|
|
() => { |
|
|
|
|
details.query.pickupFee = 0; |
|
|
|
|
handlePrice(); |
|
|
|
|
} |
|
|
|
|
" |
|
|
|
|
> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in details.vehicleTypeArr" |
|
|
|
|
:key="item.dictKey" |
|
|
|
|
:label="item.dictValue" |
|
|
|
|
:value="item.dictKey" |
|
|
|
|
:disabled="item.isCheck === true" |
|
|
|
|
/> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<div class="flex-c-c title">干 线</div> |
|
|
|
|
|
|
|
|
|
<el-form-item label="是否整车:" label-width="fit-content" prop="num" class="flex1"> |
|
|
|
|
<el-radio-group |
|
|
|
|
v-model="query.trunklineCompleteOrNot" |
|
|
|
|
class="flex-a" |
|
|
|
|
@change=" |
|
|
|
|
() => { |
|
|
|
|
details.query.totalFreight = 0; |
|
|
|
|
handlePrice(); |
|
|
|
|
} |
|
|
|
|
" |
|
|
|
|
> |
|
|
|
|
<el-radio :label="1">是</el-radio> |
|
|
|
|
<el-radio :label="0">否</el-radio> |
|
|
|
|
</el-radio-group> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="车型:" label-width="fit-content" prop="num" class="flex1"> |
|
|
|
|
<el-select |
|
|
|
|
class="w100" |
|
|
|
|
:disabled="!query.trunklineCompleteOrNot" |
|
|
|
|
v-model="query.trunklineVehicleType" |
|
|
|
|
filterable |
|
|
|
|
clearable |
|
|
|
|
placeholder="请选择车型" |
|
|
|
|
@change=" |
|
|
|
|
() => { |
|
|
|
|
details.query.totalFreight = 0; |
|
|
|
|
handlePrice(); |
|
|
|
|
} |
|
|
|
|
" |
|
|
|
|
> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in details.vehicleTypeArr" |
|
|
|
|
:key="item.dictKey" |
|
|
|
|
:label="item.dictValue" |
|
|
|
|
:value="item.dictKey" |
|
|
|
|
:disabled="item.isCheck === true" |
|
|
|
|
/> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<!-- 计价方式行 --> |
|
|
|
|
<div |
|
|
|
|
class="table-row table_row_number" |
|
|
|
@ -490,7 +362,7 @@
|
|
|
|
|
></el-button> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div> |
|
|
|
|
<div style="width: 230px; flex: none"> |
|
|
|
|
<el-form-item |
|
|
|
|
label="计价方式:" |
|
|
|
|
label-width="fit-content" |
|
|
|
@ -599,19 +471,12 @@
|
|
|
|
|
<el-input-number |
|
|
|
|
:controls="false" |
|
|
|
|
v-model="item.subtotalFreight" |
|
|
|
|
controls-position="right" |
|
|
|
|
:precision="2" |
|
|
|
|
:min="0" |
|
|
|
|
:step="0.1" |
|
|
|
|
:value-on-clear="0" |
|
|
|
|
:disabled="item.price > 0 || Number(item.price) !== Number(item.price)" |
|
|
|
|
@change=" |
|
|
|
|
() => { |
|
|
|
|
handleTrunkLinePrice( |
|
|
|
|
details.priceTemplate.trunkLine, |
|
|
|
|
details.priceTemplate.template |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
" |
|
|
|
|
/> |
|
|
|
|
</el-form-item> |
|
|
|
|
</div> |
|
|
|
@ -619,7 +484,7 @@
|
|
|
|
|
<!-- 合计行 --> |
|
|
|
|
<div class="table-row table_row_number table_row_total"> |
|
|
|
|
<div style="width: 55px; flex: none" class="flex-c-c"></div> |
|
|
|
|
<div>合计</div> |
|
|
|
|
<div style="width: 230px; flex: none">合计</div> |
|
|
|
|
<!-- 货物名称 --> |
|
|
|
|
<div>{{ details.goodsList.length }}</div> |
|
|
|
|
<!-- 件数 --> |
|
|
|
@ -651,21 +516,11 @@
|
|
|
|
|
<el-form label-width="fit-content"> |
|
|
|
|
<el-row> |
|
|
|
|
<el-form-item label="运费:"> |
|
|
|
|
<!-- <el-input |
|
|
|
|
<el-input |
|
|
|
|
controls-position="right" |
|
|
|
|
v-model="details.totalObj.totalFreight" |
|
|
|
|
disabled |
|
|
|
|
></el-input> --> |
|
|
|
|
|
|
|
|
|
<el-input-number |
|
|
|
|
:controls="false" |
|
|
|
|
controls-position="right" |
|
|
|
|
:precision="2" |
|
|
|
|
:min="0" |
|
|
|
|
:step="0.1" |
|
|
|
|
v-model="query.totalFreight" |
|
|
|
|
:value-on-clear="0" |
|
|
|
|
></el-input-number> |
|
|
|
|
></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="送货费:"> |
|
|
|
@ -682,8 +537,8 @@
|
|
|
|
|
|
|
|
|
|
<el-form-item label="提货费:"> |
|
|
|
|
<el-input-number |
|
|
|
|
:disabled="!query.isPickUp" |
|
|
|
|
:controls="false" |
|
|
|
|
controls-position="right" |
|
|
|
|
:precision="2" |
|
|
|
|
:min="0" |
|
|
|
|
:step="0.1" |
|
|
|
@ -1195,6 +1050,8 @@ import {
|
|
|
|
|
postFindArrPrice, |
|
|
|
|
} from '@/api/distribution/CreateOrder.js'; |
|
|
|
|
|
|
|
|
|
console.log('111 :>> ', 111); |
|
|
|
|
|
|
|
|
|
// 获取vue实例 |
|
|
|
|
const instance = getCurrentInstance(); |
|
|
|
|
|
|
|
|
@ -1211,6 +1068,8 @@ let $store = useStore();
|
|
|
|
|
|
|
|
|
|
const tableNode = ref(); |
|
|
|
|
|
|
|
|
|
console.log('$store :>> ', $store); |
|
|
|
|
|
|
|
|
|
const details = reactive<any>({ |
|
|
|
|
/** 页面数据 */ |
|
|
|
|
pageInfo: {}, |
|
|
|
@ -1398,10 +1257,6 @@ const details = reactive<any>({
|
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
options: [], |
|
|
|
|
/** 价格模板数据 */ |
|
|
|
|
priceTemplate: {} as any, |
|
|
|
|
/** 车型 */ |
|
|
|
|
vehicleTypeArr: [], |
|
|
|
|
/** 到站地区数组 */ |
|
|
|
|
regionOptione: [], |
|
|
|
|
/** 支付字典 */ |
|
|
|
@ -1596,14 +1451,6 @@ const details = reactive<any>({
|
|
|
|
|
trigger: ['change', 'blur'], |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
/** 发站 */ |
|
|
|
|
departure: [ |
|
|
|
|
{ |
|
|
|
|
required: true, |
|
|
|
|
message: '请填写或选择发站地', |
|
|
|
|
trigger: ['change', 'blur'], |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
/** 到站 */ |
|
|
|
|
destination: [ |
|
|
|
|
{ |
|
|
|
@ -1818,7 +1665,7 @@ const goodsNameRef = ref();
|
|
|
|
|
|
|
|
|
|
// 合计费用 |
|
|
|
|
const totalCost = computed(() => { |
|
|
|
|
const _num = computeNumber(0, '+', details.query.totalFreight || 0) |
|
|
|
|
const _num = computeNumber(0, '+', details.totalObj.totalFreight || 0) |
|
|
|
|
.next('+', details.query.deliveryFee || 0) |
|
|
|
|
.next('+', details.query.pickupFee || 0) |
|
|
|
|
.next('+', details.query.warehouseManagementFee || 0) |
|
|
|
@ -1886,14 +1733,6 @@ getLazyTreeAll().then(res => {
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
/** 获取车型 */ |
|
|
|
|
getDictionaryBiz('price_vehicle_type').then(res => { |
|
|
|
|
const { code, data } = res.data; |
|
|
|
|
if (code !== 200) return; |
|
|
|
|
|
|
|
|
|
details.vehicleTypeArr = data || []; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
/** 初始化获取暂存单转运单信息 */ |
|
|
|
|
const onLoad = async (idsArr = []) => { |
|
|
|
|
try { |
|
|
|
@ -1918,16 +1757,6 @@ const onLoad = async (idsArr = []) => {
|
|
|
|
|
|
|
|
|
|
details.query.destination = data.destinationArray; |
|
|
|
|
details.query.queryDestinationWarehouseName = data.destinationWarehouseName || ''; |
|
|
|
|
// 是否提货 |
|
|
|
|
details.query.isPickUp = details.query.isPickUp ? details.query.isPickUp : 0; |
|
|
|
|
// 是否整车 -- 提货 |
|
|
|
|
details.query.pickupCompleteOrNot = details.query.pickupCompleteOrNot |
|
|
|
|
? details.query.pickupCompleteOrNot |
|
|
|
|
: 0; |
|
|
|
|
// 是否整车 -- 干线 |
|
|
|
|
details.query.trunklineCompleteOrNot = details.query.trunklineCompleteOrNot |
|
|
|
|
? details.query.trunklineCompleteOrNot |
|
|
|
|
: 0; |
|
|
|
|
|
|
|
|
|
if (data.goodsList.length === 0) { |
|
|
|
|
details.goodsList = [ |
|
|
|
@ -2000,23 +1829,12 @@ const initPageInfo = async (idsArr = []) => {
|
|
|
|
|
|
|
|
|
|
details.query = { ...data, ...data.warehouseWaybill }; |
|
|
|
|
delete details.query.warehouseWaybill; |
|
|
|
|
|
|
|
|
|
// 是否提货 |
|
|
|
|
details.query.isPickUp = details.query.isPickUp ? details.query.isPickUp : 0; |
|
|
|
|
// 是否整车 -- 提货 |
|
|
|
|
details.query.pickupCompleteOrNot = details.query.pickupCompleteOrNot |
|
|
|
|
? details.query.pickupCompleteOrNot |
|
|
|
|
: 0; |
|
|
|
|
// 是否整车 -- 干线 |
|
|
|
|
details.query.trunklineCompleteOrNot = details.query.trunklineCompleteOrNot |
|
|
|
|
? details.query.trunklineCompleteOrNot |
|
|
|
|
: 0; |
|
|
|
|
|
|
|
|
|
console.log('details.query :>> ', details.query); |
|
|
|
|
details.query.openOrderUserName = details.query.agent; |
|
|
|
|
details.query.queryDestinationWarehouseName = details.query.destinationWarehouseName; |
|
|
|
|
details.query.openOrderDate = data.warehouseWaybill.createTime; |
|
|
|
|
details.query.orderCode = data.warehouseWaybill.orderNo; |
|
|
|
|
details.query.transportType = details.query.transportType ? details.query.transportType : '1'; |
|
|
|
|
details.query.transportType = '1'; |
|
|
|
|
details.query.receipt = data.warehouseWaybill.receipt |
|
|
|
|
? data.warehouseWaybill.receipt.split(',') |
|
|
|
|
: []; |
|
|
|
@ -2150,16 +1968,16 @@ const handleAdd = () => {
|
|
|
|
|
}); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
if (val.chargeType === 2 && val.volume === 0) { |
|
|
|
|
if (val.chargeType === 2 && val.weight === 0) { |
|
|
|
|
ElMessage({ |
|
|
|
|
message: '请填写方数', |
|
|
|
|
message: '请填写重量', |
|
|
|
|
type: 'warning', |
|
|
|
|
}); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
if (val.chargeType === 3 && val.weight === 0) { |
|
|
|
|
if (val.chargeType === 3 && val.price === 0) { |
|
|
|
|
ElMessage({ |
|
|
|
|
message: '请填写重量', |
|
|
|
|
message: '请填写价格', |
|
|
|
|
type: 'warning', |
|
|
|
|
}); |
|
|
|
|
return false; |
|
|
|
@ -2188,7 +2006,6 @@ const handleAdd = () => {
|
|
|
|
|
price: 0, |
|
|
|
|
/** 运费小计 */ |
|
|
|
|
subtotalFreight: 0, |
|
|
|
|
goodsListOptions: [], |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -2385,12 +2202,7 @@ const handleComputed = (row: any) => {
|
|
|
|
|
row.subtotalFreight = computeNumber(row.volume, '*', row.price).result; |
|
|
|
|
else if (row.chargeType === 3) |
|
|
|
|
row.subtotalFreight = computeNumber(row.weight, '*', row.price).result; |
|
|
|
|
|
|
|
|
|
row.totalPickupPrice = computeNumber(row.num, '*', row.pickupPrice || 0).result; |
|
|
|
|
|
|
|
|
|
console.log('row :>> ', row); |
|
|
|
|
|
|
|
|
|
handleTrunkLinePrice(details.priceTemplate.trunkLine, details.priceTemplate.template); |
|
|
|
|
// row.subtotalFreight = 1; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** 查询客户信息 */ |
|
|
|
@ -2502,7 +2314,6 @@ const handleDetectionPayWay = () => {
|
|
|
|
|
return content; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** 处理付款方式对应费用 */ |
|
|
|
|
const handlePayWay = (number?: number) => { |
|
|
|
|
const payType = Number(details.query.payWay); |
|
|
|
|
const enumPayType = { |
|
|
|
@ -2524,137 +2335,6 @@ const handlePayWay = (number?: number) => {
|
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** 处理提货费用 */ |
|
|
|
|
const handlePickUpPrice = (pickup, template) => { |
|
|
|
|
// 是否存在提货费用 |
|
|
|
|
if (!details.query.isPickUp) return (details.query.pickupFee = 0); |
|
|
|
|
|
|
|
|
|
// 是否存在模板和维护价格 |
|
|
|
|
if (!pickup || !template) return; |
|
|
|
|
|
|
|
|
|
// 是否整车 |
|
|
|
|
if (details.query.pickupCompleteOrNot) { |
|
|
|
|
// 是否存在模板和维护价格 |
|
|
|
|
if (!pickup || !template) return (details.query.pickupFee = 0); |
|
|
|
|
|
|
|
|
|
const { fullVehicle } = pickup; |
|
|
|
|
|
|
|
|
|
if (getObjType(fullVehicle) !== 'array') return; |
|
|
|
|
|
|
|
|
|
let item = {}; |
|
|
|
|
|
|
|
|
|
for (let i = 0; i < fullVehicle.length; i++) { |
|
|
|
|
const value = fullVehicle[i]; |
|
|
|
|
|
|
|
|
|
if (Number(value.vehicleType) !== Number(details.query.pickupVehicleType)) continue; |
|
|
|
|
item = value; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
details.query.pickupFee = details.query.pickupFee ? details.query.pickupFee : item.price || 0; |
|
|
|
|
} else { |
|
|
|
|
// 非整车 |
|
|
|
|
let _total = 0; |
|
|
|
|
|
|
|
|
|
for (let i = 0; i < details.goodsList.length; i++) { |
|
|
|
|
_total += computeNumber(_total, '+', details.goodsList[i].totalPickupPrice || 0).result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
details.query.pickupFee = _total; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** 处理干线费用 */ |
|
|
|
|
const handleTrunkLinePrice = (trunkLine, template) => { |
|
|
|
|
// 是否整车 |
|
|
|
|
if (details.query.trunklineCompleteOrNot) { |
|
|
|
|
// 是否存在模板和维护价格 |
|
|
|
|
if (!trunkLine || !template) return; |
|
|
|
|
|
|
|
|
|
const { fullVehicle } = trunkLine; |
|
|
|
|
|
|
|
|
|
if (getObjType(fullVehicle) !== 'array') return; |
|
|
|
|
|
|
|
|
|
let item: any = {}; |
|
|
|
|
|
|
|
|
|
for (let i = 0; i < fullVehicle.length; i++) { |
|
|
|
|
const value = fullVehicle[i]; |
|
|
|
|
|
|
|
|
|
if (Number(value.vehicleType) !== Number(details.query.trunklineVehicleType)) continue; |
|
|
|
|
item = value; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
details.query.totalFreight = details.query.totalFreight |
|
|
|
|
? details.query.totalFreight |
|
|
|
|
: item.price || 0; |
|
|
|
|
} else { |
|
|
|
|
// 非整车 |
|
|
|
|
let _total = 0; |
|
|
|
|
|
|
|
|
|
for (let i = 0; i < details.goodsList.length; i++) { |
|
|
|
|
const value = details.goodsList[i]; |
|
|
|
|
if (value.subtotalFreight) _total += computeNumber(_total, '+', value.subtotalFreight).result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 是否存在最低计费 |
|
|
|
|
if ((trunkLine || template) && template.trunklineIsMinCost) { |
|
|
|
|
switch (Number(template.trunklineMinCostType)) { |
|
|
|
|
// 价格 |
|
|
|
|
case 1: |
|
|
|
|
details.query.totalFreight = template.minCost > _total ? template.minCost : _total; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
// 件 |
|
|
|
|
case 2: |
|
|
|
|
details.query.totalFreight = |
|
|
|
|
template.minCost > details.totalObj.totalCount |
|
|
|
|
? _total + (template.additionalCost || 0) |
|
|
|
|
: _total; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
// 方 |
|
|
|
|
case 3: |
|
|
|
|
details.query.totalFreight = |
|
|
|
|
template.minCost > details.totalObj.totalVolume |
|
|
|
|
? _total + (template.additionalCost || 0) |
|
|
|
|
: _total; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
// 重量 |
|
|
|
|
case 4: |
|
|
|
|
details.query.totalFreight = |
|
|
|
|
template.minCost > details.totalObj.totalFreight |
|
|
|
|
? _total + (template.additionalCost || 0) |
|
|
|
|
: _total; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
default: |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} else details.query.totalFreight = _total; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** 处理配送费 */ |
|
|
|
|
const handleDispatchPrice = (dispatch, template) => { |
|
|
|
|
// 是否存在模板和维护价格 |
|
|
|
|
if (!dispatch || !template) return; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** 处理模板费用 */ |
|
|
|
|
const handlePrice = () => { |
|
|
|
|
const { dispatch, pickup, template, trunkLine } = details.priceTemplate; |
|
|
|
|
|
|
|
|
|
/** 处理提货费用 */ |
|
|
|
|
handlePickUpPrice(pickup, template); |
|
|
|
|
/** 处理干线费用 */ |
|
|
|
|
handleTrunkLinePrice(trunkLine, template); |
|
|
|
|
/** 处理配送费 */ |
|
|
|
|
handleDispatchPrice(dispatch, template); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** 重置值 */ |
|
|
|
|
const handleRefreshText = (key, value, refreshValue?: string | number) => { |
|
|
|
|
if (value) return; |
|
|
|
|
query.value[key] = refreshValue ? refreshValue : ''; |
|
|
|
@ -2896,219 +2576,113 @@ const handleFindGoods = async (goodsName, item, isClearId = 0) => {
|
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** 转译始发地和目的地 |
|
|
|
|
* @param {Array} 循环数组 |
|
|
|
|
* @param {String} province 省 |
|
|
|
|
* @param {String} city 市 |
|
|
|
|
* @param {String} region 区 |
|
|
|
|
*/ |
|
|
|
|
const handleTranslation = (province, city, region) => { |
|
|
|
|
let name = []; |
|
|
|
|
|
|
|
|
|
for (let i = 0; i < details.regionOptione.length; i++) { |
|
|
|
|
const value = details.regionOptione[i]; |
|
|
|
|
|
|
|
|
|
if (value.value !== province + '') continue; |
|
|
|
|
name.push(value.value); |
|
|
|
|
|
|
|
|
|
if (!value.children || value.children.length === 0) return name; |
|
|
|
|
/** 获取价格 */ |
|
|
|
|
const handleFindPrice = async (condition?: any) => { |
|
|
|
|
try { |
|
|
|
|
// item.loading = true; |
|
|
|
|
|
|
|
|
|
for (let index = 0; index < value.children.length; index++) { |
|
|
|
|
const element = value.children[index]; |
|
|
|
|
const { destination } = details.query; |
|
|
|
|
|
|
|
|
|
if (element.value !== city + '') continue; |
|
|
|
|
name.push(element.value); |
|
|
|
|
if (!destination || destination.length <= 1) return; |
|
|
|
|
if (!details.query.consigneeId) return; |
|
|
|
|
if (!details.query.departureWarehouseId) return; |
|
|
|
|
if (!details.query.destinationWarehouseId) return; |
|
|
|
|
|
|
|
|
|
if (!element.children || element.children.length === 0) return name; |
|
|
|
|
const submitData = { |
|
|
|
|
consigneeId: details.query.consigneeId, |
|
|
|
|
departureWarehouseId: details.query.departureWarehouseId, |
|
|
|
|
destinationWarehouseId: details.query.destinationWarehouseId, |
|
|
|
|
destinationCode: '', |
|
|
|
|
goodsIds: [] as any[], |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
for (let j = 0; j < element.children.length; j++) { |
|
|
|
|
const item = element.children[j]; |
|
|
|
|
// 货物id |
|
|
|
|
if (condition) { |
|
|
|
|
const { goodsId } = condition; |
|
|
|
|
if (!goodsId) return; |
|
|
|
|
submitData.goodsIds = [goodsId]; |
|
|
|
|
} else { |
|
|
|
|
const _goodsIdsArr = []; |
|
|
|
|
|
|
|
|
|
if (item.value === region + '') { |
|
|
|
|
name.push(item.value); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
// 筛选有goodsId的货物信息 |
|
|
|
|
for (let index = 0; index < details.goodsList.length; index++) { |
|
|
|
|
const { goodsId } = details.goodsList[index]; |
|
|
|
|
if (goodsId) _goodsIdsArr.push(goodsId); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return name; |
|
|
|
|
}; |
|
|
|
|
if (_goodsIdsArr.length === 0) return; |
|
|
|
|
submitData.goodsIds = _goodsIdsArr; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** 价格赋值 */ |
|
|
|
|
const handleAssignmentItemPrice = value => { |
|
|
|
|
// 处理品类费用 |
|
|
|
|
const { pickup, template, trunkLine } = details.priceTemplate; |
|
|
|
|
// 筛选到站 |
|
|
|
|
const _findeLocation = details.regionOptione |
|
|
|
|
.find(val => val.value === destination[0]) |
|
|
|
|
.children.find(val => val.value === destination[1]); |
|
|
|
|
|
|
|
|
|
// 干线 |
|
|
|
|
if (trunkLine && template) { |
|
|
|
|
const { pieceCategory, cubeCategory, weightCategory } = trunkLine; |
|
|
|
|
let _item: any = {}; |
|
|
|
|
if (destination.length === 2) { |
|
|
|
|
_item = _findeLocation; |
|
|
|
|
} else { |
|
|
|
|
_item = _findeLocation.children.find(val => val.value === destination[2]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 是否区分品类 |
|
|
|
|
if (template.trunklineIsByCategory) { |
|
|
|
|
// 品类是否存在id |
|
|
|
|
if (!value.goodsId) value.price = 0; |
|
|
|
|
else { |
|
|
|
|
let _item: any = {}; |
|
|
|
|
// 件 |
|
|
|
|
if (getObjType(pieceCategory) === 'array') { |
|
|
|
|
for (let j = 0; j < pieceCategory.length; j++) { |
|
|
|
|
const item = pieceCategory[j]; |
|
|
|
|
submitData.destinationCode = _item.value; |
|
|
|
|
|
|
|
|
|
if (item.categoryId !== value.goodsId) continue; |
|
|
|
|
_item = item; |
|
|
|
|
const res = await postFindArrPrice(submitData); |
|
|
|
|
// const { code, data } = res.data; |
|
|
|
|
const { code, data } = res.data; |
|
|
|
|
|
|
|
|
|
_item.chargeType = 1; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (code !== 200 || data.length === 0) return; |
|
|
|
|
|
|
|
|
|
// 方 |
|
|
|
|
if (getObjType(cubeCategory) === 'array' && !_item.chargeType) { |
|
|
|
|
for (let j = 0; j < cubeCategory.length; j++) { |
|
|
|
|
const item = cubeCategory[j]; |
|
|
|
|
if (condition) { |
|
|
|
|
// 循环赋值 |
|
|
|
|
for (let i = 0; i < details.priceArr.length; i++) { |
|
|
|
|
const value = details.priceArr[i]; |
|
|
|
|
condition[value.key] = 0; |
|
|
|
|
|
|
|
|
|
if (item.categoryId !== value.goodsId) continue; |
|
|
|
|
_item = item; |
|
|
|
|
for (let index = 0; index < data[0].arrPrice.length; index++) { |
|
|
|
|
const element = data[0].arrPrice[index]; |
|
|
|
|
|
|
|
|
|
_item.chargeType = 2; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
if (element.itemName === value.name) |
|
|
|
|
condition[value.key] = isNumber(element.cost) ? Number(element.cost) : 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
handleComputed(condition); |
|
|
|
|
} else { |
|
|
|
|
for (let idx = 0; idx < details.goodsList.length; idx++) { |
|
|
|
|
const val = details.goodsList[idx]; |
|
|
|
|
|
|
|
|
|
// 重量 |
|
|
|
|
if (getObjType(weightCategory) === 'array' && !_item.chargeType) { |
|
|
|
|
for (let j = 0; j < weightCategory.length; j++) { |
|
|
|
|
const item = weightCategory[j]; |
|
|
|
|
if (!val.goodsId) continue; |
|
|
|
|
|
|
|
|
|
if (item.categoryId !== value.goodsId) continue; |
|
|
|
|
_item = item; |
|
|
|
|
let _data = null; |
|
|
|
|
|
|
|
|
|
_item.chargeType = 3; |
|
|
|
|
for (let index = 0; index < data.length; index++) { |
|
|
|
|
const element = data[index]; |
|
|
|
|
if (element.goodsId === val.goodsId) { |
|
|
|
|
_data = element; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!_item.chargeType) value.price = 0; |
|
|
|
|
else { |
|
|
|
|
value.chargeType = _item.chargeType; |
|
|
|
|
value.price = _item.price; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// 不区分品类 |
|
|
|
|
switch (value.chargeType) { |
|
|
|
|
// 件 |
|
|
|
|
case 1: |
|
|
|
|
value.price = |
|
|
|
|
getObjType(pieceCategory) === 'array' && pieceCategory.length > 0 |
|
|
|
|
? pieceCategory[0].price || 0 |
|
|
|
|
: 0; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
// 方 |
|
|
|
|
case 2: |
|
|
|
|
value.price = |
|
|
|
|
getObjType(cubeCategory) === 'array' && cubeCategory.length > 0 |
|
|
|
|
? cubeCategory[0].price || 0 |
|
|
|
|
: 0; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
// 公斤 |
|
|
|
|
case 3: |
|
|
|
|
value.price = |
|
|
|
|
getObjType(weightCategory) === 'array' && weightCategory.length > 0 |
|
|
|
|
? weightCategory[0].price || 0 |
|
|
|
|
: 0; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
default: |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 是否为区分品类 |
|
|
|
|
} else value.price = 0; |
|
|
|
|
|
|
|
|
|
// 提货 |
|
|
|
|
if (pickup && template) { |
|
|
|
|
const { pieceCategory } = pickup; |
|
|
|
|
// 是否区分品类 |
|
|
|
|
if (template.pickupIsByCategory) { |
|
|
|
|
// 品类是否存在id |
|
|
|
|
if (!value.goodsId) value.pickupPrice = 0; |
|
|
|
|
else { |
|
|
|
|
let _item: any = {}; |
|
|
|
|
// 件 |
|
|
|
|
if (getObjType(pieceCategory) === 'array') { |
|
|
|
|
for (let j = 0; j < pieceCategory.length; j++) { |
|
|
|
|
const item = pieceCategory[j]; |
|
|
|
|
// 循环赋值 |
|
|
|
|
for (let i = 0; i < details.priceArr.length; i++) { |
|
|
|
|
const value = details.priceArr[i]; |
|
|
|
|
val[value.key] = 0; |
|
|
|
|
|
|
|
|
|
if (item.categoryId !== value.goodsId) continue; |
|
|
|
|
_item = item; |
|
|
|
|
for (let index = 0; index < _data.arrPrice.length; index++) { |
|
|
|
|
const element = _data.arrPrice[index]; |
|
|
|
|
|
|
|
|
|
_item.chargeType = 1; |
|
|
|
|
break; |
|
|
|
|
if (element.itemName === value.name) |
|
|
|
|
val[value.key] = isNumber(element.cost) ? Number(element.cost) : 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
value.pickupPrice = _item.chargeType ? _item.price : 0; |
|
|
|
|
handleComputed(val); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
value.pickupPrice = |
|
|
|
|
getObjType(pieceCategory) === 'array' && pieceCategory.length > 0 |
|
|
|
|
? pieceCategory[0].price || 0 |
|
|
|
|
: 0; |
|
|
|
|
} |
|
|
|
|
} else value.pickupPrice = 0; |
|
|
|
|
|
|
|
|
|
// 计算每行价格 |
|
|
|
|
handleComputed(value); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** 获取价格 */ |
|
|
|
|
const handleFindPrice = async () => { |
|
|
|
|
try { |
|
|
|
|
if (!details.query.brandId || !details.query.consigneeId) return; |
|
|
|
|
let startArea = []; |
|
|
|
|
let endArea = []; |
|
|
|
|
|
|
|
|
|
details.query.departure && (startArea = handleTranslation(...details.query.departure)); |
|
|
|
|
details.query.destination && (endArea = handleTranslation(...details.query.destination)); |
|
|
|
|
|
|
|
|
|
const submitData = { |
|
|
|
|
// 品牌 |
|
|
|
|
brandId: details.query.brandId, |
|
|
|
|
// 收货方 |
|
|
|
|
clientId: details.query.consigneeId, |
|
|
|
|
// 发货方 |
|
|
|
|
sendOrgId: details.query.shipperId, |
|
|
|
|
// 发站 |
|
|
|
|
startProvinceId: startArea[0], |
|
|
|
|
startCityId: startArea[1], |
|
|
|
|
startCountyId: startArea[2], |
|
|
|
|
// 到站 |
|
|
|
|
endProvinceId: endArea[0], |
|
|
|
|
endCityId: endArea[1], |
|
|
|
|
endCountyId: endArea[2], |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
console.log('submitData :>> ', submitData); |
|
|
|
|
|
|
|
|
|
const res = await postFindArrPrice(submitData); |
|
|
|
|
const { code, data } = res.data; |
|
|
|
|
|
|
|
|
|
if (code !== 200) return; |
|
|
|
|
|
|
|
|
|
details.priceTemplate = data || {}; |
|
|
|
|
|
|
|
|
|
// 赋值 |
|
|
|
|
for (let i = 0; i < details.goodsList.length; i++) { |
|
|
|
|
handleAssignmentItemPrice(details.goodsList[i]); |
|
|
|
|
} |
|
|
|
|
} catch (error) { |
|
|
|
|
console.log('error :>> ', error); |
|
|
|
|
} finally { |
|
|
|
|
// item.loading = false; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -3132,7 +2706,7 @@ const handleChooseGoods = (item, val) => {
|
|
|
|
|
|
|
|
|
|
item.goodsName = val.goodsName; |
|
|
|
|
item.goodsId = val.goodsId; |
|
|
|
|
handleAssignmentItemPrice(item); |
|
|
|
|
handleFindPrice(item); |
|
|
|
|
handleCloseSelcet(); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -3193,8 +2767,6 @@ const handleSubmitCause = () => {
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss"> |
|
|
|
|
$borderColor: #172e60; |
|
|
|
|
$borderType: 1px solid $borderColor; |
|
|
|
|
|
|
|
|
|
.table_form { |
|
|
|
|
:deep(.el-date-editor.el-input, .el-date-editor.el-input__wrapper) { |
|
|
|
|
height: 100% !important; |
|
|
|
@ -3212,7 +2784,7 @@ $borderType: 1px solid $borderColor;
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.border-left { |
|
|
|
|
border-left: $borderType; |
|
|
|
|
border-left: 1px dashed $borderColor; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 页面字体大小 |
|
|
|
@ -3225,36 +2797,21 @@ $borderType: 1px solid $borderColor;
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.border-top { |
|
|
|
|
border-top: $borderType; |
|
|
|
|
border-top: 1px dashed $borderColor; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.table-row { |
|
|
|
|
width: 100%; |
|
|
|
|
display: flex; |
|
|
|
|
// border-top: 1px dashed $borderColor; |
|
|
|
|
border-left: $borderType; |
|
|
|
|
border-left: 1px dashed $borderColor; |
|
|
|
|
border-bottom: none; |
|
|
|
|
box-sizing: border-box; |
|
|
|
|
|
|
|
|
|
.title { |
|
|
|
|
width: fit-content; |
|
|
|
|
flex: none; |
|
|
|
|
padding: 0 20px; |
|
|
|
|
font-size: 0.9rem; |
|
|
|
|
background: var(--el-color-primary); |
|
|
|
|
color: #fff; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.flex-a { |
|
|
|
|
display: flex; |
|
|
|
|
width: 100%; |
|
|
|
|
justify-content: space-around; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
&:first-child { |
|
|
|
|
display: block; |
|
|
|
|
border-top: $borderType; |
|
|
|
|
border-left: $borderType; |
|
|
|
|
border-top: 1px dashed $borderColor; |
|
|
|
|
border-left: 1px dashed $borderColor; |
|
|
|
|
|
|
|
|
|
> div { |
|
|
|
|
width: 100%; |
|
|
|
@ -3264,8 +2821,8 @@ $borderType: 1px solid $borderColor;
|
|
|
|
|
|
|
|
|
|
&:last-child { |
|
|
|
|
display: block; |
|
|
|
|
border-bottom: $borderType; |
|
|
|
|
border-right: $borderType; |
|
|
|
|
border-bottom: 1px dashed $borderColor; |
|
|
|
|
border-right: 1px dashed $borderColor; |
|
|
|
|
box-sizing: border-box; |
|
|
|
|
|
|
|
|
|
> div { |
|
|
|
@ -3277,8 +2834,8 @@ $borderType: 1px solid $borderColor;
|
|
|
|
|
> div { |
|
|
|
|
flex: 1; |
|
|
|
|
padding: 5px; |
|
|
|
|
border-bottom: $borderType; |
|
|
|
|
border-right: $borderType; |
|
|
|
|
border-bottom: 1px dashed $borderColor; |
|
|
|
|
border-right: 1px dashed $borderColor; |
|
|
|
|
display: inline-flex; |
|
|
|
|
box-sizing: border-box; |
|
|
|
|
} |