Browse Source

修复价格带出问题

dev-xx
qb 11 months ago
parent
commit
62776dc439
  1. 4
      src/components/WaybillPrintTemplate/WaybillPrintTemplate.vue
  2. 13
      src/views/Pricesystem/Price/PriceBill.vue
  3. 13
      src/views/Pricesystem/Price/PriceTrunkLine.vue
  4. 156
      src/views/waybill/CreateZeroOrder.vue
  5. 60
      src/views/waybill/WaybillOrderList.vue

4
src/components/WaybillPrintTemplate/WaybillPrintTemplate.vue

@ -20,7 +20,7 @@
</el-button>
<el-form-item label="是否显示运费" style="margin: 0px 0px 0px 10px">
<el-checkbox></el-checkbox>
<el-checkbox v-model="isShowFreight"></el-checkbox>
</el-form-item>
</div>
</el-dialog>
@ -62,6 +62,8 @@ const props = defineProps({
},
});
const isShowFreight = ref(true);
const $emit = defineEmits(['update:modelValue']);
const visible = computed({

13
src/views/Pricesystem/Price/PriceBill.vue

@ -215,7 +215,13 @@
<div class="flex-c-sb">
<el-divider content-position="left">提货路径</el-divider>
<el-button icon="CirclePlus" class="ml10" type="primary" @click="handleAdd" v-if="!$route.query.Viewdetails">
<el-button
icon="CirclePlus"
class="ml10"
type="primary"
@click="handleAdd"
v-if="!$route.query.Viewdetails"
>
</el-button>
</div>
@ -1191,6 +1197,11 @@ const initAssignmentForm = (data, isLine = true) => {
data.weightCategory;
if (!Arr || Arr.length === 0) break;
if (Arr.length === 1 && !Arr[0].categoryId) {
value.categories[0].price = Arr[0].price;
continue;
}
for (let index = 0; index < Arr.length; index++) {
const val = Arr[index];
if (val.categoryId !== item.categoryId) continue;

13
src/views/Pricesystem/Price/PriceTrunkLine.vue

@ -221,7 +221,13 @@
<div class="flex-c-sb">
<el-divider content-position="left">干线路径</el-divider>
<el-button icon="CirclePlus" class="ml10" type="primary" @click="handleAdd" v-if="!$route.query.Viewdetails">
<el-button
icon="CirclePlus"
class="ml10"
type="primary"
@click="handleAdd"
v-if="!$route.query.Viewdetails"
>
</el-button>
</div>
@ -1169,6 +1175,11 @@ const initAssignmentForm = (data, isLine = true) => {
data.weightCategory;
if (!Arr || Arr.length === 0) break;
if (Arr.length === 1 && !Arr[0].categoryId) {
value.categories[0].price = Arr[0].price;
continue;
}
for (let index = 0; index < Arr.length; index++) {
const val = Arr[index];
if (val.categoryId !== item.categoryId) continue;

156
src/views/waybill/CreateZeroOrder.vue

@ -1977,16 +1977,38 @@ const handleComputed = (row: any) => {
handleSpecialBrandPrice(row, trunkLine, template);
details.query.goodsCode = '-' + details.totalObj.totalCount;
if (row.chargeType === 1) row.subtotalFreight = computeNumber(row.num, '*', row.price).result;
else if (row.chargeType === 2)
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;
const typeArr = { 1: 'num', 2: 'volume', 3: 'weight' };
const _trunklineKey = typeArr[row.chargeType];
const _dispatchKey = typeArr[row.dispatchType];
// 线 --
if (_trunklineKey)
row.subtotalFreight = _trunklineKey
? computeNumber(row.price, '*', row[_trunklineKey]).result
: 0;
console.log('_dispatchKey :>> ', _dispatchKey);
console.log('_trunklineKey :>> ', _trunklineKey);
console.log('row :>> ', row);
// --
if (_dispatchKey)
row.subtotalDispatch = _dispatchKey
? computeNumber(row.dispatchPrice, '*', row[_dispatchKey]).result
: 0;
// if (row.chargeType === 1) row.subtotalFreight = computeNumber(row.num, '*', row.price).result;
// else if (row.chargeType === 2)
// 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;
handlePrice();
};
@ -2187,35 +2209,37 @@ const handleTrunkLinePrice = (trunkLine, template) => {
if (value.subtotalFreight) _total += computeNumber(_total, '+', value.subtotalFreight).result;
}
console.log('trunkLine :>> ', trunkLine);
//
if ((trunkLine || template) && template.trunklineIsMinCost) {
if (trunkLine && template && template.trunklineIsMinCost) {
switch (Number(template.trunklineMinCostType)) {
//
case 1:
details.query.totalFreight = template.minCost > _total ? template.minCost : _total;
details.query.totalFreight = trunkLine.minCost > _total ? trunkLine.minCost : _total;
break;
//
case 2:
details.query.totalFreight =
template.minCost > details.totalObj.totalCount
? _total + (template.additionalCost || 0)
trunkLine.minCost > details.totalObj.totalCount
? _total + (trunkLine.additionalCost || 0)
: _total;
break;
//
case 3:
details.query.totalFreight =
template.minCost > details.totalObj.totalVolume
? _total + (template.additionalCost || 0)
trunkLine.minCost > details.totalObj.totalVolume
? _total + (trunkLine.additionalCost || 0)
: _total;
break;
//
case 4:
details.query.totalFreight =
template.minCost > details.totalObj.totalFreight
? _total + (template.additionalCost || 0)
trunkLine.minCost > details.totalObj.totalFreight
? _total + (trunkLine.additionalCost || 0)
: _total;
break;
@ -2230,6 +2254,53 @@ const handleTrunkLinePrice = (trunkLine, template) => {
const handleDispatchPrice = (dispatch, template) => {
//
if (!dispatch || !template) return;
console.log('dispatch :>> ', dispatch);
//
let _total = 0;
for (let i = 0; i < details.goodsList.length; i++) {
const value = details.goodsList[i];
if (value.subtotalDispatch) _total += computeNumber(_total, '+', value.subtotalDispatch).result;
}
//
if ((dispatch || template) && template.trunklineIsMinCost) {
switch (Number(template.dispatchMinCostType)) {
//
case 1:
details.query.deliveryFee = dispatch.minCost > _total ? dispatch.minCost : _total;
break;
//
case 2:
details.query.deliveryFee =
dispatch.minCost > details.totalObj.totalCount
? _total + (dispatch.additionalCost || 0)
: _total;
break;
//
case 3:
details.query.deliveryFee =
dispatch.minCost > details.totalObj.totalVolume
? _total + (dispatch.additionalCost || 0)
: _total;
break;
//
case 4:
details.query.deliveryFee =
dispatch.minCost > details.totalObj.deliveryFee
? _total + (dispatch.additionalCost || 0)
: _total;
break;
default:
break;
}
} else details.query.deliveryFee = _total;
};
/** 处理模板费用 */
@ -2576,7 +2647,7 @@ const handleAssignmentItemPriceTrunkline = (value, trunkLine, template, chargeTy
const _priceArr = _arr[chargeType];
let _item;
let _item: any = {};
if (getObjType(_priceArr) === 'array' && !_item.chargeType) {
for (let j = 0; j < _priceArr.length; j++) {
@ -2707,14 +2778,44 @@ const handleSpecialBrandPrice = (value, trunkLine, template) => {
};
/** 配送价格赋值 */
const handleAssignmentItemPriceDispatch = (value, dispatch, template) => {
const handleAssignmentItemPriceDispatch = (
value,
dispatch,
template,
chargeType?: number | undefined
) => {
const { pieceCategory, cubeCategory, weightCategory } = dispatch;
//
if (template.dispatchIsByCategory) {
// id
if (!value.goodsId) value.dispatchPrice = 0;
else {
else if (getObjType(chargeType) === 'number') {
const _arr = {
1: pieceCategory,
2: cubeCategory,
3: weightCategory,
};
const _priceArr = _arr[chargeType];
let _item: any = {};
if (getObjType(_priceArr) === 'array' && !_item.chargeType) {
for (let j = 0; j < _priceArr.length; j++) {
const item = _priceArr[j];
if (item.categoryId !== value.goodsId) continue;
_item = item;
break;
}
}
console.log('_item :>> ', _item);
value.dispatchPrice = _item ? _item.price || 0 : 0;
value.dispatchType = chargeType;
} else {
let _item: any = {};
//
if (getObjType(pieceCategory) === 'array') {
@ -2724,7 +2825,7 @@ const handleAssignmentItemPriceDispatch = (value, dispatch, template) => {
if (item.categoryId !== value.goodsId) continue;
_item = item;
// _item.chargeType = 1;
_item.chargeType = 1;
break;
}
}
@ -2737,7 +2838,7 @@ const handleAssignmentItemPriceDispatch = (value, dispatch, template) => {
if (item.categoryId !== value.goodsId) continue;
_item = item;
// _item.chargeType = 2;
_item.chargeType = 2;
break;
}
}
@ -2750,15 +2851,17 @@ const handleAssignmentItemPriceDispatch = (value, dispatch, template) => {
if (item.categoryId !== value.goodsId) continue;
_item = item;
// _item.chargeType = 3;
_item.chargeType = 3;
break;
}
}
if (!_item) value.dispatchPrice = 0;
else {
// value.chargeType = _item.chargeType;
value.dispatchPrice = _item.price;
if (!_item) {
value.dispatchType = 1;
value.dispatchPrice = 0;
} else {
value.dispatchType = _item.chargeType;
value.dispatchPrice = _item.price || 0;
}
console.log('_item', _item);
@ -2793,6 +2896,8 @@ const handleAssignmentItemPriceDispatch = (value, dispatch, template) => {
default:
break;
}
value.dispatchType = value.chargeType;
}
};
@ -2847,7 +2952,8 @@ const handleAssignmentItemPrice = (value, isOnload = false, chargeType?: number
} else value.pickupPrice = 0;
//
if (dispatch && template) handleAssignmentItemPriceDispatch(value, dispatch, template);
if (dispatch && template)
handleAssignmentItemPriceDispatch(value, dispatch, template, chargeType);
else value.dispatchPrice = 0;
console.log('value :>> ', value);

60
src/views/waybill/WaybillOrderList.vue

@ -206,45 +206,6 @@
</el-dialog>
<!-- 打印 -->
<!-- <el-dialog
title="运单打印"
width="780px"
:show-close="false"
:fullscreen="details.fullscreenObj.WaybillPrintTemplate"
:align-center="true"
v-model="details.popUpShow.WaybillPrintTemplate"
>
<template #header="{ close, titleId, titleClass }">
<div class="my-header flex-c-sb">
<div :id="titleId" :class="titleClass">运单打印</div>
<div class="flex-c-c">
<el-button type="text" v-if="!details.fullscreenObj.WaybillPrintTemplate">
<el-icon class="" @click="handleFullScrean('open', 'WaybillPrintTemplate')"
><FullScreen
/></el-icon>
</el-button>
<el-button type="text" v-else>
<el-icon class="" @click="handleFullScrean('close', 'WaybillPrintTemplate')"
><CopyDocument
/></el-icon>
</el-button>
<el-button type="text">
<el-icon class="" @click="close"><Close /></el-icon>
</el-button>
</div>
</div>
</template>
<div class="mt10 el-dialog-QRCode-container">
<WaybillPrintTemplate
v-for="item in details.selectionList"
:key="item.id"
:waybillInfo="item"
/>
</div>
</el-dialog> -->
<WaybillPrintTemplate
v-model="details.popUpShow.WaybillPrintTemplate"
:html="details.html"
@ -373,7 +334,6 @@ const details = reactive<any>({
fullscreenObj: {
/** 查看 */
view: false,
WaybillPrintTemplate: false,
},
/** 预览图片地址 */
dialogImageUrl: '',
@ -630,10 +590,24 @@ const batchPrint = async () => {
let _html = '';
for (let i = 0; i < data.length; i++) {
const value = data[i];
if (getObjType(data) !== 'object') return;
for (const key in data) {
const element = data[key];
for (let i = 0; i < element.length; i++) {
const value = element[i];
_html += JSON.parse(JSON.stringify(value.templateHtml));
let template = value.templateHtml;
console.log('value.templateHtml :>> ', value.templateHtml);
template = template.replace('第n页', `${i + 1}`);
template = template.replace('共n页', `${element.length}`);
template = template.replaceAll('0.00', ``);
_html += JSON.parse(JSON.stringify(template));
}
}
console.log('res :>> ', res);

Loading…
Cancel
Save