|
|
@@ -1,27 +1,27 @@
|
|
|
-import C from 'highlight.js/lib/languages/1c';
|
|
|
import Vue from 'vue';
|
|
|
|
|
|
//改变数量
|
|
|
export function changeCount(row, countObj, noDiscountSingle, weightType) {
|
|
|
// console.log('changeCount~~', row, countObj, noDiscountSingle);
|
|
|
- let total = row[countObj.countKey] || 0;
|
|
|
- let data = row;
|
|
|
+ let data = JSON.parse(JSON.stringify(row));
|
|
|
+ let total = data[countObj.countKey] || 0;
|
|
|
+
|
|
|
let _endIndex = 0; //计算单重需要
|
|
|
- if (row.packageDispositionList) {
|
|
|
- let endIndex = row.packageDispositionList.findIndex(
|
|
|
- (ite) => row[countObj.unitIdKey] == ite.id
|
|
|
+ if (data.packageDispositionList) {
|
|
|
+ let endIndex = data.packageDispositionList.findIndex(
|
|
|
+ (ite) => data[countObj.unitIdKey] == ite.id
|
|
|
);
|
|
|
_endIndex = endIndex;
|
|
|
- let packageData = row.packageDispositionList.find(
|
|
|
- (ite) => row[countObj.unitIdKey] == ite.id
|
|
|
+ let packageData = data.packageDispositionList.find(
|
|
|
+ (ite) => data[countObj.unitIdKey] == ite.id
|
|
|
);
|
|
|
- row[countObj.unitKey] = packageData.conversionUnit;
|
|
|
- if (row.weightUnit == row.measuringUnit && row.singleWeight) {
|
|
|
- row.packageDispositionList[1].packageCell = row.singleWeight;
|
|
|
+ data[countObj.unitKey] = packageData.conversionUnit;
|
|
|
+ if (data.weightUnit == data.measuringUnit && data.singleWeight) {
|
|
|
+ data.packageDispositionList[1].packageCell = data.singleWeight;
|
|
|
}
|
|
|
for (; 0 < endIndex; endIndex--) {
|
|
|
total = Vue.prototype.$math.format(
|
|
|
- row.packageDispositionList[endIndex].packageCell * total,
|
|
|
+ data.packageDispositionList[endIndex].packageCell * total,
|
|
|
14
|
|
|
);
|
|
|
}
|
|
|
@@ -41,14 +41,13 @@ export function changeCount(row, countObj, noDiscountSingle, weightType) {
|
|
|
|
|
|
data['totalPrice'] = 0;
|
|
|
data['discountTotalPrice'] = 0;
|
|
|
- if (row.pricingWay == 2 || row.pricingWay == 3) {
|
|
|
- let weightKey = countObj.weightKey || 'totalWeight';
|
|
|
- if (row[weightKey] && row.singlePrice) {
|
|
|
- data['totalPrice'] = (row[weightKey] * row.singlePrice).toFixed(2);
|
|
|
+ if (data.pricingWay == 2 || data.pricingWay == 3) {
|
|
|
+ if (data.totalWeight && data.singlePrice) {
|
|
|
+ data['totalPrice'] = (data.totalWeight * data.singlePrice).toFixed(2);
|
|
|
}
|
|
|
} else {
|
|
|
- if (row[countObj.countKey] && row.singlePrice) {
|
|
|
- data['totalPrice'] = (row[countObj.countKey] * row.singlePrice).toFixed(
|
|
|
+ if (data[countObj.countKey] && data.singlePrice) {
|
|
|
+ data['totalPrice'] = (data[countObj.countKey] * data.singlePrice).toFixed(
|
|
|
2
|
|
|
);
|
|
|
}
|
|
|
@@ -58,13 +57,13 @@ export function changeCount(row, countObj, noDiscountSingle, weightType) {
|
|
|
: data.discountTotalPrice;
|
|
|
return data;
|
|
|
}
|
|
|
-
|
|
|
// 计算总重
|
|
|
function setWeight(row, countObj) {
|
|
|
+ // return
|
|
|
if (row.weightUnit == row.measuringUnit) {
|
|
|
row['totalWeight'] = row.totalCount;
|
|
|
- } else if (row.totalCount&& row.singleWeight) {
|
|
|
- row['totalWeight'] = (row.totalCount * row.singleWeight).toFixed(2);
|
|
|
+ } else if (row.totalCount && row.singleWeight) {
|
|
|
+ row['totalWeight'] = Number((row.totalCount * row.singleWeight).toFixed(2));
|
|
|
} else {
|
|
|
row['totalWeight'] = 0;
|
|
|
}
|
|
|
@@ -99,9 +98,11 @@ function setSingleWeight(row, countObj, endIndex) {
|
|
|
);
|
|
|
}
|
|
|
// console.log(totalWeight, 'totalWeight');
|
|
|
- row['singleWeight'] = Number(totalWeight/row[countObj.countKey]).toFixed(2);
|
|
|
+ row['singleWeight'] = Number(totalWeight / row[countObj.countKey]).toFixed(
|
|
|
+ 2
|
|
|
+ );
|
|
|
} else if (row.totalWeight && row.totalCount) {
|
|
|
- row['singleWeight'] = (row.totalWeight / row.totalCount).toFixed(2);
|
|
|
+ row['singleWeight'] = Number((row.totalWeight / row.totalCount).toFixed(2));
|
|
|
} else {
|
|
|
row['singleWeight'] = 0;
|
|
|
}
|