|
|
|
@ -654,6 +654,7 @@
|
|
|
|
|
:value-on-clear="0" |
|
|
|
|
:controls="false" |
|
|
|
|
:precision="2" |
|
|
|
|
disabled |
|
|
|
|
:min="0" |
|
|
|
|
:step="0.1" |
|
|
|
|
v-model="query.deliveryFee" |
|
|
|
@ -663,7 +664,7 @@
|
|
|
|
|
<el-form-item label="提货费:"> |
|
|
|
|
<el-input-number |
|
|
|
|
:value-on-clear="0" |
|
|
|
|
:disabled="!query.isPickUp" |
|
|
|
|
disabled |
|
|
|
|
:controls="false" |
|
|
|
|
:precision="2" |
|
|
|
|
:min="0" |
|
|
|
@ -896,7 +897,7 @@
|
|
|
|
|
:value-on-clear="0" |
|
|
|
|
:controls="false" |
|
|
|
|
v-model="query.thirdOperationFee" |
|
|
|
|
:precision="0" |
|
|
|
|
:precision="2" |
|
|
|
|
:step="0.1" |
|
|
|
|
/> |
|
|
|
|
</el-form-item> |
|
|
|
@ -1074,6 +1075,12 @@
|
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script lang="ts"> |
|
|
|
|
export default { |
|
|
|
|
name: '/waybill/CreateZeroOrder' |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
|
import { |
|
|
|
|
ref, |
|
|
|
@ -1111,7 +1118,7 @@ import {
|
|
|
|
|
postFindArrPrice, |
|
|
|
|
} from '@/api/distribution/CreateOrder.js'; |
|
|
|
|
import { postFindBrandList } from '@/api/waybill/TemporaryStorageList.js'; |
|
|
|
|
import { isNumber, getObjType, deepClone } from '@/utils/util.js'; |
|
|
|
|
import { isNumber, getObjType, deepClone,floorToDecimalPlaces } from '@/utils/util.js'; |
|
|
|
|
import { ITEM_RENDER_EVT } from 'element-plus/es/components/virtual-list/src/defaults'; |
|
|
|
|
|
|
|
|
|
// 获取vue实例 |
|
|
|
@ -1297,6 +1304,14 @@ const details = reactive<any>({
|
|
|
|
|
goodsId: '', |
|
|
|
|
/** 计费方式 */ |
|
|
|
|
chargeType: 1, |
|
|
|
|
/** 系统维护 -- 干线计价方式 */ |
|
|
|
|
systemChargeType: 1, |
|
|
|
|
/** 系统维护 -- 配送计价方式 */ |
|
|
|
|
systemDeliveryChargeType: 1, |
|
|
|
|
/** 系统维护 -- 提货计价方式 */ |
|
|
|
|
systemPickupChargeType: 1, |
|
|
|
|
/** 系统维护 -- 仓库计价方式 */ |
|
|
|
|
systemWarehouseChargeType: 1, |
|
|
|
|
/** 件数 */ |
|
|
|
|
num: 0, |
|
|
|
|
/** 重量(kg) */ |
|
|
|
@ -1305,6 +1320,12 @@ const details = reactive<any>({
|
|
|
|
|
volume: 0, |
|
|
|
|
/** 单价 */ |
|
|
|
|
price: 0, |
|
|
|
|
/** 系统维护 -- 运费单价 */ |
|
|
|
|
freightPrice: 0, |
|
|
|
|
/** 系统维护 -- 配送单价 */ |
|
|
|
|
deliveryPrice: 0, |
|
|
|
|
/** 系统维护 -- 提货单价 */ |
|
|
|
|
pickupPrice: 0, |
|
|
|
|
/** 运费小计 */ |
|
|
|
|
subtotalFreight: 0, |
|
|
|
|
/** 货物名称list */ |
|
|
|
@ -1595,7 +1616,7 @@ const totalCost = computed(() => {
|
|
|
|
|
.next('+', details.query.insuranceFee || 0) |
|
|
|
|
.next('+', details.query.rebate || 0) |
|
|
|
|
.next('+', details.query.installFee || 0) |
|
|
|
|
.next('+', details.query.claimingValue || 0).result; |
|
|
|
|
.next('+', details.query.thirdOperationFee || 0).result; |
|
|
|
|
|
|
|
|
|
handlePayWay(_num); |
|
|
|
|
return _num; |
|
|
|
@ -1752,6 +1773,14 @@ const initPageInfo = async () => {
|
|
|
|
|
goodsId: '', |
|
|
|
|
/** 计费方式 */ |
|
|
|
|
chargeType: 1, |
|
|
|
|
/** 系统维护 -- 干线计价方式 */ |
|
|
|
|
systemChargeType: 1, |
|
|
|
|
/** 系统维护 -- 配送计价方式 */ |
|
|
|
|
systemDeliveryChargeType: 1, |
|
|
|
|
/** 系统维护 -- 提货计价方式 */ |
|
|
|
|
systemPickupChargeType: 1, |
|
|
|
|
/** 系统维护 -- 仓库计价方式 */ |
|
|
|
|
systemWarehouseChargeType: 1, |
|
|
|
|
/** 件数 */ |
|
|
|
|
num: 0, |
|
|
|
|
/** 重量(kg) */ |
|
|
|
@ -1760,6 +1789,12 @@ const initPageInfo = async () => {
|
|
|
|
|
volume: 0, |
|
|
|
|
/** 单价 */ |
|
|
|
|
price: 0, |
|
|
|
|
/** 系统维护 -- 运费单价 */ |
|
|
|
|
freightPrice: 0, |
|
|
|
|
/** 系统维护 -- 配送单价 */ |
|
|
|
|
deliveryPrice: 0, |
|
|
|
|
/** 系统维护 -- 提货单价 */ |
|
|
|
|
pickupPrice: 0, |
|
|
|
|
/** 运费小计 */ |
|
|
|
|
subtotalFreight: 0, |
|
|
|
|
/** 货物名称list */ |
|
|
|
@ -1773,10 +1808,14 @@ const initPageInfo = async () => {
|
|
|
|
|
val.volume = Number(val.volume); |
|
|
|
|
val.weight = Number(val.weight); |
|
|
|
|
val.price = Number(val.price); |
|
|
|
|
val.freightPrice = isNumber(val.freightPrice) ? Number(val.freightPrice) : 0; |
|
|
|
|
val.deliveryPrice = isNumber(val.deliveryPrice) ? Number(val.deliveryPrice) : 0; |
|
|
|
|
val.pickupPrice = isNumber(val.pickupPrice) ? Number(val.pickupPrice) : 0; |
|
|
|
|
val.subtotalFreight = Number(val.subtotalFreight); |
|
|
|
|
|
|
|
|
|
val.goodsName = val.productName; |
|
|
|
|
val.goodsId = val.productId; |
|
|
|
|
val.chargeType = val.chargeType || 1; |
|
|
|
|
|
|
|
|
|
/** 货物名称list */ |
|
|
|
|
val.goodsListOptions = []; |
|
|
|
@ -1858,6 +1897,7 @@ const onLoad = async () => {
|
|
|
|
|
} catch (error) { |
|
|
|
|
console.log('error :>> ', error); |
|
|
|
|
} finally { |
|
|
|
|
console.log('details :>> ', details); |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
@ -1901,6 +1941,14 @@ const handleAdd = () => {
|
|
|
|
|
waybillDetailList: '', |
|
|
|
|
/** 计费方式 */ |
|
|
|
|
chargeType: 1, |
|
|
|
|
/** 系统维护 -- 干线计价方式 */ |
|
|
|
|
systemChargeType: 1, |
|
|
|
|
/** 系统维护 -- 配送计价方式 */ |
|
|
|
|
systemDeliveryChargeType: 1, |
|
|
|
|
/** 系统维护 -- 提货计价方式 */ |
|
|
|
|
systemPickupChargeType: 1, |
|
|
|
|
/** 系统维护 -- 仓库计价方式 */ |
|
|
|
|
systemWarehouseChargeType: 1, |
|
|
|
|
/** 件数 */ |
|
|
|
|
num: 0, |
|
|
|
|
/** 重量(kg) */ |
|
|
|
@ -1909,6 +1957,12 @@ const handleAdd = () => {
|
|
|
|
|
volume: 0, |
|
|
|
|
/** 单价 */ |
|
|
|
|
price: 0, |
|
|
|
|
/** 系统维护 -- 运费单价 */ |
|
|
|
|
freightPrice: 0, |
|
|
|
|
/** 系统维护 -- 配送单价 */ |
|
|
|
|
deliveryPrice: 0, |
|
|
|
|
/** 系统维护 -- 提货单价 */ |
|
|
|
|
pickupPrice: 0, |
|
|
|
|
/** 运费小计 */ |
|
|
|
|
subtotalFreight: 0, |
|
|
|
|
goodsListOptions: [], |
|
|
|
@ -1969,7 +2023,13 @@ const destinationWarehouseNameChange = val => {
|
|
|
|
|
|
|
|
|
|
/** 查询货物 */ |
|
|
|
|
const handleFindGoods = async (goodsName, item, isClearId = 0) => { |
|
|
|
|
if (isClearId) item.goodsId = ''; |
|
|
|
|
if (isClearId){ |
|
|
|
|
item.goodsId = ''; |
|
|
|
|
item.confirmCostCategoryId = ''; |
|
|
|
|
item.confirmCostCategoryName = ''; |
|
|
|
|
item.confirmIncomeCategoryId = ''; |
|
|
|
|
item.confirmIncomeCategoryName = ''; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!goodsName) return (item.goodsListOptions = []); |
|
|
|
|
|
|
|
|
@ -1991,7 +2051,7 @@ const handleFindGoods = async (goodsName, item, isClearId = 0) => {
|
|
|
|
|
* row -- 行数据 |
|
|
|
|
* onlyComputedTrunline -- 是否只计算干线的价格 |
|
|
|
|
*/ |
|
|
|
|
const handleComputed = (row: any, onlyComputedTrunline = false) => { |
|
|
|
|
const handleComputed = debounce((row: any, onlyComputedTrunline = false) => { |
|
|
|
|
const { template, trunkLine } = details.priceTemplate; |
|
|
|
|
|
|
|
|
|
if (Boolean(isDisabled.value && template && trunkLine)) |
|
|
|
@ -2002,8 +2062,8 @@ const handleComputed = (row: any, onlyComputedTrunline = false) => {
|
|
|
|
|
const typeArr = { 1: 'num', 2: 'volume', 3: 'weight' }; |
|
|
|
|
|
|
|
|
|
const _trunklineKey = typeArr[row.chargeType]; |
|
|
|
|
const _pickupKey = typeArr[row.pickupType]; |
|
|
|
|
const _dispatchKey = typeArr[row.dispatchType]; |
|
|
|
|
const _pickupKey = typeArr[row.systemPickupChargeType]; |
|
|
|
|
const _dispatchKey = typeArr[row.systemDeliveryChargeType]; |
|
|
|
|
const _warehouseKey = typeArr[row.warehouseManagementType]; |
|
|
|
|
|
|
|
|
|
// 计算干线价格 -- 行 |
|
|
|
@ -2033,7 +2093,7 @@ const handleComputed = (row: any, onlyComputedTrunline = false) => {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
handlePrice(!onlyComputedTrunline, 'trunkline'); |
|
|
|
|
}; |
|
|
|
|
}, 10); |
|
|
|
|
|
|
|
|
|
/** 查询客户信息 */ |
|
|
|
|
const handleFindClientInfo = async (type, isClearId = 0) => { |
|
|
|
@ -2117,7 +2177,12 @@ const handleChooseConsigner = (column, prop, order) => {
|
|
|
|
|
if (_destination.length > 0) details.query.destination = _destination; |
|
|
|
|
|
|
|
|
|
// 收货单位维护过品牌,自动切换品牌 |
|
|
|
|
column.brandId && (details.query.brandId = column.brandId); |
|
|
|
|
if (column.brandId) { |
|
|
|
|
details.query.brandId = column.brandId; |
|
|
|
|
details.query.brand = details.brandOptions.find( |
|
|
|
|
val => val.brandId === details.query.brandId |
|
|
|
|
).brandName; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
handleFindClientInfo('consignee'); |
|
|
|
|
handleFindClientInfo('consigneeName'); |
|
|
|
@ -2362,7 +2427,7 @@ const handleDispatchPrice = (dispatch, template) => {
|
|
|
|
|
|
|
|
|
|
// 是否存在最低计费 |
|
|
|
|
if ( |
|
|
|
|
(dispatch || template) && |
|
|
|
|
(dispatch && template) && |
|
|
|
|
template.trunklineIsMinCost && |
|
|
|
|
Number(template.dispatchMinCostMode) === 1 |
|
|
|
|
) { |
|
|
|
@ -2441,13 +2506,22 @@ const resetForm = (formEl: FormInstance | undefined) => {
|
|
|
|
|
formEl.resetFields(); |
|
|
|
|
details.goodsList = [ |
|
|
|
|
{ |
|
|
|
|
index: 0, |
|
|
|
|
/** 货物名称 */ |
|
|
|
|
goodsName: '', |
|
|
|
|
/** 品类Id */ |
|
|
|
|
goodsId: '', |
|
|
|
|
/** 货物品类 */ |
|
|
|
|
waybillDetailList: '', |
|
|
|
|
/** 计费方式 */ |
|
|
|
|
chargeType: 1, |
|
|
|
|
/** 系统维护 -- 干线计价方式 */ |
|
|
|
|
systemChargeType: 1, |
|
|
|
|
/** 系统维护 -- 配送计价方式 */ |
|
|
|
|
systemDeliveryChargeType: 1, |
|
|
|
|
/** 系统维护 -- 提货计价方式 */ |
|
|
|
|
systemPickupChargeType: 1, |
|
|
|
|
/** 系统维护 -- 仓库计价方式 */ |
|
|
|
|
systemWarehouseChargeType: 1, |
|
|
|
|
/** 件数 */ |
|
|
|
|
num: 0, |
|
|
|
|
/** 重量(kg) */ |
|
|
|
@ -2456,15 +2530,240 @@ const resetForm = (formEl: FormInstance | undefined) => {
|
|
|
|
|
volume: 0, |
|
|
|
|
/** 单价 */ |
|
|
|
|
price: 0, |
|
|
|
|
/** 系统维护 -- 运费单价 */ |
|
|
|
|
freightPrice: 0, |
|
|
|
|
/** 系统维护 -- 配送单价 */ |
|
|
|
|
deliveryPrice: 0, |
|
|
|
|
/** 系统维护 -- 提货单价 */ |
|
|
|
|
pickupPrice: 0, |
|
|
|
|
/** 运费小计 */ |
|
|
|
|
subtotalFreight: 0, |
|
|
|
|
/** 货物名称list */ |
|
|
|
|
goodsListOptions: [], |
|
|
|
|
}, |
|
|
|
|
]; |
|
|
|
|
initPageInfo(); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** 计算品类单价 -- 系统单价 */ |
|
|
|
|
const handleComputedPlanPrice = submitData => { |
|
|
|
|
const { dispatch, pickup, template, trunkLine } = details.priceTemplate; |
|
|
|
|
|
|
|
|
|
// 总件数 |
|
|
|
|
const _totalCount = details.totalObj.totalCount |
|
|
|
|
|
|
|
|
|
const { addList } = submitData; |
|
|
|
|
const typeArr = { 1: 'num', 2: 'volume', 3: 'weight' }; |
|
|
|
|
|
|
|
|
|
// 计算 运费 & 提货费 & 送货费 & 仓库管理费 基础合计 |
|
|
|
|
let _total = 0; |
|
|
|
|
/** 干线 */ |
|
|
|
|
let _planTrunklineFee = 0; |
|
|
|
|
let _trunklineFee = 0; |
|
|
|
|
/** 提货 */ |
|
|
|
|
let _planSubtotalPickup = 0; |
|
|
|
|
let _subtotalPickup = 0; |
|
|
|
|
/** 送货 */ |
|
|
|
|
let _totalPlanPrce = 0; |
|
|
|
|
let _totalPrce = 0; |
|
|
|
|
|
|
|
|
|
for (let i = 0; i < addList.length; i++) { |
|
|
|
|
const _val = addList[i]; |
|
|
|
|
const _trunklineKey = typeArr[_val.chargeType]; |
|
|
|
|
const _pickupKey = typeArr[_val.systemPickupChargeType]; |
|
|
|
|
const _deliveryKey = typeArr[_val.systemDeliveryChargeType]; |
|
|
|
|
console.log('_trunklineKey :>> ', _trunklineKey); |
|
|
|
|
console.log('_pickupKey :>> ', _pickupKey); |
|
|
|
|
|
|
|
|
|
// 干线费 |
|
|
|
|
_trunklineFee = computeNumber( |
|
|
|
|
_trunklineFee, |
|
|
|
|
'+', |
|
|
|
|
_trunklineKey ? computeNumber(_val.freightPrice || 0, '*', _val[_trunklineKey]).result : 0 |
|
|
|
|
).result; |
|
|
|
|
|
|
|
|
|
// 提货费 |
|
|
|
|
_subtotalPickup = computeNumber( |
|
|
|
|
_subtotalPickup, |
|
|
|
|
'+', |
|
|
|
|
_pickupKey ? computeNumber(_val.pickupPrice || 0, '*', _val[_pickupKey]).result : 0 |
|
|
|
|
).result; |
|
|
|
|
|
|
|
|
|
// 送货费 |
|
|
|
|
_totalPrce = computeNumber( |
|
|
|
|
_totalPrce, |
|
|
|
|
'+', |
|
|
|
|
_deliveryKey ? computeNumber(_val.deliveryPrice || 0, '*', _val[_deliveryKey]).result : 0 |
|
|
|
|
).result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 是否存在最低计费 -- 干线 |
|
|
|
|
if (trunkLine && template && template.trunklineIsMinCost) { |
|
|
|
|
switch (Number(template.trunklineMinCostType)) { |
|
|
|
|
// 价格 |
|
|
|
|
case 1: |
|
|
|
|
_planTrunklineFee = trunkLine.minCost > _trunklineFee ? trunkLine.minCost : _trunklineFee; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
// 件 |
|
|
|
|
case 2: |
|
|
|
|
_planTrunklineFee = |
|
|
|
|
trunkLine.minCost > details.totalObj.totalCount |
|
|
|
|
? _trunklineFee + (trunkLine.additionalCost || 0) |
|
|
|
|
: _trunklineFee; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
// 方 |
|
|
|
|
case 3: |
|
|
|
|
_planTrunklineFee = |
|
|
|
|
trunkLine.minCost > details.totalObj.totalVolume |
|
|
|
|
? _trunklineFee + (trunkLine.additionalCost || 0) |
|
|
|
|
: _trunklineFee; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
// 重量 |
|
|
|
|
case 4: |
|
|
|
|
_planTrunklineFee = |
|
|
|
|
trunkLine.minCost > details.totalObj.totalWeghit |
|
|
|
|
? _trunklineFee + (trunkLine.additionalCost || 0) |
|
|
|
|
: _trunklineFee; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
default: |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 是否存在最低计费 -- 提货 |
|
|
|
|
if (pickup && template && template.pickupIsMinCost) { |
|
|
|
|
switch (Number(template.pickupMinCostType)) { |
|
|
|
|
// 价格 |
|
|
|
|
case 1: |
|
|
|
|
_planSubtotalPickup = pickup.minCost > _subtotalPickup ? pickup.minCost : _subtotalPickup; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
// 件 |
|
|
|
|
case 2: |
|
|
|
|
_planSubtotalPickup = |
|
|
|
|
pickup.minCost > details.totalObj.totalCount |
|
|
|
|
? _subtotalPickup + (pickup.additionalCost || 0) |
|
|
|
|
: _subtotalPickup; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
// 方 |
|
|
|
|
case 3: |
|
|
|
|
_planSubtotalPickup = |
|
|
|
|
pickup.minCost > details.totalObj.totalVolume |
|
|
|
|
? _subtotalPickup + (pickup.additionalCost || 0) |
|
|
|
|
: _subtotalPickup; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
// 重量 |
|
|
|
|
case 4: |
|
|
|
|
_planSubtotalPickup = |
|
|
|
|
pickup.minCost > details.totalObj.totalWeghit |
|
|
|
|
? _subtotalPickup + (pickup.additionalCost || 0) |
|
|
|
|
: _subtotalPickup; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
default: |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 配送 |
|
|
|
|
if (dispatch && template && template.dispatchIsMinCost) { |
|
|
|
|
|
|
|
|
|
switch (Number(template.dispatchMinCostType)) { |
|
|
|
|
// 价格 |
|
|
|
|
case 1: |
|
|
|
|
_totalPlanPrce = |
|
|
|
|
dispatch.minCost > _totalPrce ? dispatch.minCost : _totalPrce; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
// 件 |
|
|
|
|
case 2: |
|
|
|
|
_totalPlanPrce = |
|
|
|
|
dispatch.minCost > details.totalObj.totalCount |
|
|
|
|
? _totalPrce + (dispatch.additionalCost || 0) |
|
|
|
|
: _totalPrce; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
// 方 |
|
|
|
|
case 3: |
|
|
|
|
_totalPlanPrce = |
|
|
|
|
dispatch.minCost > details.totalObj.totalVolume |
|
|
|
|
? _totalPrce + (dispatch.additionalCost || 0) |
|
|
|
|
: _totalPrce; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
// 重量 |
|
|
|
|
case 4: |
|
|
|
|
_totalPlanPrce = |
|
|
|
|
dispatch.minCost > details.totalObj.totalWeghit |
|
|
|
|
? _totalPrce + (dispatch.additionalCost || 0) |
|
|
|
|
: _totalPrce; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
default: |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
console.log('addList :>> ', addList); |
|
|
|
|
|
|
|
|
|
for (let i = 0; i < addList.length; i++) { |
|
|
|
|
const val = addList[i]; |
|
|
|
|
// 干线 |
|
|
|
|
if (trunkLine && template && template.trunklineIsMinCost) { |
|
|
|
|
const differenceValue = computeNumber(_planTrunklineFee, '-', _trunklineFee).next( |
|
|
|
|
'/', |
|
|
|
|
_totalCount |
|
|
|
|
).result; |
|
|
|
|
|
|
|
|
|
val.freightPrice = floorToDecimalPlaces( |
|
|
|
|
computeNumber(differenceValue, '*', val.num) |
|
|
|
|
.next('/', val[typeArr[val.chargeType]]) |
|
|
|
|
.next('+', val.freightPrice).result, |
|
|
|
|
2 |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 提货 |
|
|
|
|
if (pickup && template && template.pickupIsMinCost) { |
|
|
|
|
const differenceValue = computeNumber(_planSubtotalPickup, '-', _subtotalPickup).next( |
|
|
|
|
'/', |
|
|
|
|
_totalCount |
|
|
|
|
).result; |
|
|
|
|
|
|
|
|
|
val.pickupPrice = floorToDecimalPlaces( |
|
|
|
|
computeNumber(differenceValue, '*', val.num) |
|
|
|
|
.next('/', val[typeArr[val.systemPickupChargeType]]) |
|
|
|
|
.next('+', val.pickupPrice).result, |
|
|
|
|
2 |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 配送 |
|
|
|
|
if (dispatch && template && template.dispatchIsMinCost) { |
|
|
|
|
console.log('_totalPlanPrce :>> ', _totalPlanPrce); |
|
|
|
|
console.log('_totalPrce :>> ', _totalPrce); |
|
|
|
|
const differenceValue = computeNumber(_totalPlanPrce , '-', _totalPrce).next( |
|
|
|
|
'/', |
|
|
|
|
_totalCount |
|
|
|
|
).result; |
|
|
|
|
console.log('differenceValue :>> ', differenceValue); |
|
|
|
|
|
|
|
|
|
val.deliveryPrice = floorToDecimalPlaces( |
|
|
|
|
computeNumber(differenceValue, '*', val.num) |
|
|
|
|
.next('/', val[typeArr[val.systemDeliveryChargeType]]) |
|
|
|
|
.next('+', val.deliveryPrice).result, |
|
|
|
|
2 |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** 提交 */ |
|
|
|
|
const handleSubmit = async (formEl: FormInstance | undefined) => { |
|
|
|
|
await nextTick(); |
|
|
|
@ -2570,6 +2869,8 @@ const handleSubmit = async (formEl: FormInstance | undefined) => {
|
|
|
|
|
|
|
|
|
|
// 零担 -- 2 |
|
|
|
|
submitData.waybillType = 2; |
|
|
|
|
handleComputedPlanPrice(submitData) |
|
|
|
|
|
|
|
|
|
console.log('submitData :>> ', submitData); |
|
|
|
|
res = await postOpenOrderOpenZeroWaybill(submitData); |
|
|
|
|
|
|
|
|
@ -2624,6 +2925,7 @@ const handleSubmit = async (formEl: FormInstance | undefined) => {
|
|
|
|
|
submitData.receipt = submitData.receipt.join(','); |
|
|
|
|
console.log('submitData :>> ', submitData); |
|
|
|
|
|
|
|
|
|
handleComputedPlanPrice(submitData) |
|
|
|
|
// 记录提交参数 |
|
|
|
|
details.submitData = submitData; |
|
|
|
|
|
|
|
|
@ -2715,7 +3017,11 @@ const handleAssignmentItemPriceTrunkline = (value, trunkLine, template, chargeTy
|
|
|
|
|
// 是否区分品类 |
|
|
|
|
if (template.trunklineIsByCategory) { |
|
|
|
|
// 品类是否存在id |
|
|
|
|
if (!value.goodsId) value.price = 0; |
|
|
|
|
if (!value.goodsId) { |
|
|
|
|
value.price = 0; |
|
|
|
|
value.freightPrice = 0; |
|
|
|
|
value.systemChargeType = 1; |
|
|
|
|
} |
|
|
|
|
else if (chargeType === undefined) { |
|
|
|
|
let _item: any = {}; |
|
|
|
|
// 件 |
|
|
|
@ -2757,13 +3063,19 @@ const handleAssignmentItemPriceTrunkline = (value, trunkLine, template, chargeTy
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!_item.chargeType) value.price = 0; |
|
|
|
|
else { |
|
|
|
|
if (!_item.chargeType) { |
|
|
|
|
value.price = 0; |
|
|
|
|
value.freightPrice = 0; |
|
|
|
|
value.systemChargeType = 1; |
|
|
|
|
} else { |
|
|
|
|
value.chargeType = _item.chargeType; |
|
|
|
|
value.systemChargeType = _item.chargeType; |
|
|
|
|
value.price = _item.price; |
|
|
|
|
value.freightPrice = _item.price || 0; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
console.log('123 :>> ', 123); |
|
|
|
|
// 定义计价方式 -- 不改变系统值 |
|
|
|
|
|
|
|
|
|
const _arr = _obj[chargeType]; |
|
|
|
|
|
|
|
|
@ -2784,8 +3096,11 @@ const handleAssignmentItemPriceTrunkline = (value, trunkLine, template, chargeTy
|
|
|
|
|
} else { |
|
|
|
|
// 不区分品类 |
|
|
|
|
const _arr = _obj[value.chargeType]; |
|
|
|
|
const _price = getObjType(_arr) === 'array' && _arr.length > 0 ? _arr[0].price || 0 : 0; |
|
|
|
|
|
|
|
|
|
value.price = getObjType(_arr) === 'array' && _arr.length > 0 ? _arr[0].price || 0 : 0; |
|
|
|
|
value.price = _price; |
|
|
|
|
value.freightPrice = _price; |
|
|
|
|
value.systemChargeType = value.chargeType; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -2798,20 +3113,27 @@ const handleSpecialBrandPrice = (value, trunkLine, template) => {
|
|
|
|
|
|
|
|
|
|
if (totalCount < 15 && totalVolume < 0.8 && totalVolume / (totalCount || 1) < 0.11) { |
|
|
|
|
value.chargeType = 1; |
|
|
|
|
value.systemChargeType = 1; |
|
|
|
|
|
|
|
|
|
// value.price = 5; |
|
|
|
|
|
|
|
|
|
if (getObjType(trunkLine) !== 'object' || getObjType(template) !== 'object') |
|
|
|
|
if (getObjType(trunkLine) !== 'object' || getObjType(template) !== 'object'){ |
|
|
|
|
value.freightPrice = 0; |
|
|
|
|
return (value.price = 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const { pieceCategory } = trunkLine; |
|
|
|
|
|
|
|
|
|
value.price = 5; |
|
|
|
|
value.freightPrice = 5; |
|
|
|
|
|
|
|
|
|
// 是否区分品类 |
|
|
|
|
if (template.trunklineIsByCategory) { |
|
|
|
|
// 品类是否存在id |
|
|
|
|
if (!value.goodsId) value.price = 0; |
|
|
|
|
if (!value.goodsId) { |
|
|
|
|
value.freightPrice = 0; |
|
|
|
|
value.price = 0; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
let _item: any = {}; |
|
|
|
|
// 件 |
|
|
|
@ -2827,23 +3149,31 @@ const handleSpecialBrandPrice = (value, trunkLine, template) => {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
value.price = _item.price || 0; |
|
|
|
|
value.freightPrice = _item.price || 0; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// 不区分品类 |
|
|
|
|
value.price = |
|
|
|
|
const _price = |
|
|
|
|
getObjType(pieceCategory) === 'array' && pieceCategory.length > 0 |
|
|
|
|
? pieceCategory[0].price || 0 |
|
|
|
|
: 0; |
|
|
|
|
// 不区分品类 |
|
|
|
|
value.price = _price; |
|
|
|
|
value.freightPrice = _price; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
value.chargeType = 2; |
|
|
|
|
value.systemChargeType = 2; |
|
|
|
|
|
|
|
|
|
const { cubeCategory } = trunkLine; |
|
|
|
|
|
|
|
|
|
// 是否区分品类 |
|
|
|
|
if (template.trunklineIsByCategory) { |
|
|
|
|
// 品类是否存在id |
|
|
|
|
if (!value.goodsId) value.price = 0; |
|
|
|
|
// 品类是否存在id |
|
|
|
|
if (!value.goodsId) { |
|
|
|
|
value.freightPrice = 0; |
|
|
|
|
value.price = 0; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
let _item: any = {}; |
|
|
|
|
|
|
|
|
@ -2859,13 +3189,19 @@ const handleSpecialBrandPrice = (value, trunkLine, template) => {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
value.price = _item.price || 0; |
|
|
|
|
value.freightPrice = _item.price || 0; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// 不区分品类 |
|
|
|
|
value.price = |
|
|
|
|
const _price = |
|
|
|
|
getObjType(cubeCategory) === 'array' && cubeCategory.length > 0 |
|
|
|
|
? cubeCategory[0].price || 0 |
|
|
|
|
: 0; |
|
|
|
|
|
|
|
|
|
// 不区分品类 |
|
|
|
|
value.price = _price; |
|
|
|
|
|
|
|
|
|
value.freightPrice = _price; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -2876,8 +3212,7 @@ const handleSpecialBrandPrice = (value, trunkLine, template) => {
|
|
|
|
|
const handleAssignmentItemPricePickUp = ( |
|
|
|
|
value, |
|
|
|
|
pickup, |
|
|
|
|
template, |
|
|
|
|
chargeType?: number | undefined |
|
|
|
|
template |
|
|
|
|
) => { |
|
|
|
|
const { pieceCategory, cubeCategory, weightCategory } = pickup; |
|
|
|
|
|
|
|
|
@ -2916,7 +3251,7 @@ const handleAssignmentItemPricePickUp = (
|
|
|
|
|
console.log('_item :>> ', _item); |
|
|
|
|
|
|
|
|
|
// 赋值 |
|
|
|
|
value.pickupType = _item.chargeType || 1; |
|
|
|
|
value.systemPickupChargeType = _item.chargeType || 0; |
|
|
|
|
value.pickupPrice = _item.price || 0; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
@ -2925,7 +3260,7 @@ const handleAssignmentItemPricePickUp = (
|
|
|
|
|
|
|
|
|
|
value.pickupPrice = getObjType(_arr) === 'array' && _arr.length > 0 ? _arr[0].price || 0 : 0; |
|
|
|
|
|
|
|
|
|
value.pickupType = 1; |
|
|
|
|
value.systemPickupChargeType = 1; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -2933,8 +3268,7 @@ const handleAssignmentItemPricePickUp = (
|
|
|
|
|
const handleAssignmentItemPriceDispatch = ( |
|
|
|
|
value, |
|
|
|
|
dispatch, |
|
|
|
|
template, |
|
|
|
|
chargeType?: number | undefined |
|
|
|
|
template |
|
|
|
|
) => { |
|
|
|
|
const { pieceCategory, cubeCategory, weightCategory } = dispatch; |
|
|
|
|
|
|
|
|
@ -2971,7 +3305,7 @@ const handleAssignmentItemPriceDispatch = (
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 赋值 |
|
|
|
|
value.dispatchType = _item.chargeType || 1; |
|
|
|
|
value.systemDeliveryChargeType = _item.chargeType || 1; |
|
|
|
|
value.deliveryPrice = _item.price || 0; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
@ -2980,7 +3314,7 @@ const handleAssignmentItemPriceDispatch = (
|
|
|
|
|
|
|
|
|
|
value.deliveryPrice = getObjType(_arr) === 'array' && _arr.length > 0 ? _arr[0].price || 0 : 0; |
|
|
|
|
|
|
|
|
|
value.dispatchType = 1; |
|
|
|
|
value.systemDeliveryChargeType = 1; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -2988,8 +3322,7 @@ const handleAssignmentItemPriceDispatch = (
|
|
|
|
|
const handleAssignmentItemPriceWarehouseManagementPrice = ( |
|
|
|
|
value, |
|
|
|
|
warehouse, |
|
|
|
|
template, |
|
|
|
|
chargeType?: number | undefined |
|
|
|
|
template |
|
|
|
|
) => { |
|
|
|
|
if (!template || !template.warehouseIsAddFee || !template.warehouseIsManageFee) { |
|
|
|
|
value.warehouseManagementPrice = 0; |
|
|
|
@ -3047,17 +3380,20 @@ const handleAssignmentItemPrice = (value, isOnload = false, chargeType?: number
|
|
|
|
|
else handleAssignmentItemPriceTrunkline(value, trunkLine, template, chargeType); |
|
|
|
|
|
|
|
|
|
// 是否为区分品类 |
|
|
|
|
} else value.price = 0; |
|
|
|
|
} else{ |
|
|
|
|
value.freightPrice = 0; |
|
|
|
|
value.price = 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 提货 |
|
|
|
|
if (pickup && template) { |
|
|
|
|
handleAssignmentItemPricePickUp(value, pickup, template, chargeType); |
|
|
|
|
handleAssignmentItemPricePickUp(value, pickup, template); |
|
|
|
|
} else value.pickupPrice = 0; |
|
|
|
|
|
|
|
|
|
// 配送 |
|
|
|
|
if (dispatch && template) |
|
|
|
|
handleAssignmentItemPriceDispatch(value, dispatch, template, chargeType); |
|
|
|
|
handleAssignmentItemPriceDispatch(value, dispatch, template); |
|
|
|
|
else value.deliveryPrice = 0; |
|
|
|
|
|
|
|
|
|
// 仓库 |
|
|
|
@ -3134,6 +3470,10 @@ const handleChooseGoods = (item, val) => {
|
|
|
|
|
|
|
|
|
|
item.goodsName = val.goodsName; |
|
|
|
|
item.goodsId = val.goodsId; |
|
|
|
|
item.confirmCostCategoryId = item.goodsId; |
|
|
|
|
item.confirmCostCategoryName = item.goodsName; |
|
|
|
|
item.confirmIncomeCategoryId = item.goodsId; |
|
|
|
|
item.confirmIncomeCategoryName = item.goodsName; |
|
|
|
|
handleAssignmentItemPrice(item); |
|
|
|
|
handleCloseSelcet(); |
|
|
|
|
}; |
|
|
|
@ -3229,7 +3569,44 @@ watch(
|
|
|
|
|
|
|
|
|
|
if (_id === details.pageId) return; |
|
|
|
|
details.pageId = _id; |
|
|
|
|
initPageInfo(); |
|
|
|
|
details.goodsList = [ |
|
|
|
|
{ |
|
|
|
|
/** 货物名称 */ |
|
|
|
|
goodsName: '', |
|
|
|
|
/** 品类Id */ |
|
|
|
|
goodsId: '', |
|
|
|
|
/** 货物品类 */ |
|
|
|
|
waybillDetailList: '', |
|
|
|
|
/** 计费方式 */ |
|
|
|
|
chargeType: 1, |
|
|
|
|
/** 系统维护 -- 干线计价方式 */ |
|
|
|
|
systemChargeType: 1, |
|
|
|
|
/** 系统维护 -- 配送计价方式 */ |
|
|
|
|
systemDeliveryChargeType: 1, |
|
|
|
|
/** 系统维护 -- 提货计价方式 */ |
|
|
|
|
systemPickupChargeType: 1, |
|
|
|
|
/** 系统维护 -- 仓库计价方式 */ |
|
|
|
|
systemWarehouseChargeType: 1, |
|
|
|
|
/** 件数 */ |
|
|
|
|
num: 0, |
|
|
|
|
/** 重量(kg) */ |
|
|
|
|
weight: 0, |
|
|
|
|
/** 体积(方) */ |
|
|
|
|
volume: 0, |
|
|
|
|
/** 单价 */ |
|
|
|
|
price: 0, |
|
|
|
|
/** 系统维护 -- 运费单价 */ |
|
|
|
|
freightPrice: 0, |
|
|
|
|
/** 系统维护 -- 配送单价 */ |
|
|
|
|
deliveryPrice: 0, |
|
|
|
|
/** 系统维护 -- 提货单价 */ |
|
|
|
|
pickupPrice: 0, |
|
|
|
|
/** 运费小计 */ |
|
|
|
|
subtotalFreight: 0, |
|
|
|
|
goodsListOptions: [], |
|
|
|
|
}, |
|
|
|
|
]; |
|
|
|
|
initPageInfo(); |
|
|
|
|
}, |
|
|
|
|
{ immediate: true } |
|
|
|
|
); |
|
|
|
|