wangfukang 2 weeks ago
parent
commit
fa57b4d951
  1. 29
      package2/shop/orderDetail.vue

29
package2/shop/orderDetail.vue

@ -525,6 +525,18 @@
settlement settlement
}; };
}, },
getMerchantDeliveryResponsibilityAmount(record, order) {
if (!record || !this.isMerchantDeliveryOrder(order)) return 0;
let responsibilityAmount = this.toAmount(this.getMerchantRefundDisplayAmount(record));
let goodsPackageAmount = this.roundAmount(this.toAmount(order.goodsAmount) + this.toAmount(order.packageFee));
let deliveryFee = this.toAmount(order.deliveryFee);
let deliveryResponsibilityAmount = this.roundAmount(responsibilityAmount - goodsPackageAmount);
if (deliveryResponsibilityAmount <= 0) return 0;
if (deliveryFee > 0 && deliveryResponsibilityAmount > deliveryFee) {
return this.roundAmount(deliveryFee);
}
return deliveryResponsibilityAmount;
},
buildMerchantIncomeSummary(order) { buildMerchantIncomeSummary(order) {
if (!order || this.isRunnerOrder(order)) { if (!order || this.isRunnerOrder(order)) {
return { return {
@ -533,12 +545,12 @@
}; };
} }
let baseAmount = this.roundAmount(this.toAmount(order.goodsAmount) + this.toAmount(order.packageFee)); let baseAmount = this.roundAmount(this.toAmount(order.goodsAmount) + this.toAmount(order.packageFee));
let deliveryFee = this.toAmount(order.deliveryFee);
let commissionRate = this.getCommissionRate(order); let commissionRate = this.getCommissionRate(order);
let refundRecords = Array.isArray(order.mallRefundRecord) ? order.mallRefundRecord : []; let refundRecords = Array.isArray(order.mallRefundRecord) ? order.mallRefundRecord : [];
let approvedRefundRecords = refundRecords.filter(item => this.isApprovedRefundRecord(item)); let approvedRefundRecords = refundRecords.filter(item => this.isApprovedRefundRecord(item));
let hasWorkerReasonRefund = approvedRefundRecords.some(item => item.status == 1 && item.refundTypeStatus == 2 && this.isWorkerRefundRecord(item)); let hasWorkerReasonRefund = approvedRefundRecords.some(item => item.status == 1 && item.refundTypeStatus == 2 && this.isWorkerRefundRecord(item));
let hasMerchantReasonRefund = approvedRefundRecords.some(item => item.status == 1 && item.refundTypeStatus == 1 && this.isMerchantResponsibilityRecord(item)); let merchantReasonRefundRecord = approvedRefundRecords.find(item => item.status == 1 && item.refundTypeStatus == 1 && this.isMerchantResponsibilityRecord(item));
let hasMerchantReasonRefund = !!merchantReasonRefundRecord;
let hasBothReasonRefund = approvedRefundRecords.some(item => item.status == 1 && item.refundTypeStatus == 3); let hasBothReasonRefund = approvedRefundRecords.some(item => item.status == 1 && item.refundTypeStatus == 3);
let normalBaseAmount = (order.status == 6 || order.status == 8) ? 0 : baseAmount; let normalBaseAmount = (order.status == 6 || order.status == 8) ? 0 : baseAmount;
if (order.status == 8 && hasWorkerReasonRefund) { if (order.status == 8 && hasWorkerReasonRefund) {
@ -558,9 +570,10 @@
amount: normalNet.settlement amount: normalNet.settlement
}); });
} }
if (order.status == 8 && hasMerchantReasonRefund && this.isMerchantDeliveryOrder(order)) { let refundDeliveryResponsibilityAmount = this.getMerchantDeliveryResponsibilityAmount(merchantReasonRefundRecord, order);
let deliveryDeduction = this.roundAmount(deliveryFee); if (order.status == 8 && hasMerchantReasonRefund && refundDeliveryResponsibilityAmount > 0) {
deductionBaseAmount = this.roundAmount(deductionBaseAmount + deliveryFee); let deliveryDeduction = this.roundAmount(refundDeliveryResponsibilityAmount);
deductionBaseAmount = this.roundAmount(deductionBaseAmount + refundDeliveryResponsibilityAmount);
deductionSettlementAmount = this.roundAmount(deductionSettlementAmount + deliveryDeduction); deductionSettlementAmount = this.roundAmount(deductionSettlementAmount + deliveryDeduction);
lines.push({ lines.push({
name: '商家原因退款承担配送费', name: '商家原因退款承担配送费',
@ -571,8 +584,8 @@
if (!this.isMerchantAfterSaleDeductionRecord(item)) return; if (!this.isMerchantAfterSaleDeductionRecord(item)) return;
let responsibilityAmount = this.toAmount(this.getMerchantRefundDisplayAmount(item)); let responsibilityAmount = this.toAmount(this.getMerchantRefundDisplayAmount(item));
if (responsibilityAmount <= 0) return; if (responsibilityAmount <= 0) return;
let includesDeliveryFee = item.refundType == 3 && item.refundTypeStatus == 1 && this.isMerchantDeliveryOrder(order); let deliveryResponsibilityAmount = this.getMerchantDeliveryResponsibilityAmount(item, order);
let commissionBase = includesDeliveryFee ? Math.max(0, responsibilityAmount - deliveryFee) : responsibilityAmount; let commissionBase = deliveryResponsibilityAmount > 0 ? Math.max(0, responsibilityAmount - deliveryResponsibilityAmount) : responsibilityAmount;
let deductionNet = this.getSettlementNet(responsibilityAmount, commissionBase, commissionRate); let deductionNet = this.getSettlementNet(responsibilityAmount, commissionBase, commissionRate);
deductionBaseAmount = this.roundAmount(deductionBaseAmount + responsibilityAmount); deductionBaseAmount = this.roundAmount(deductionBaseAmount + responsibilityAmount);
deductionCommissionAmount = this.roundAmount(deductionCommissionAmount + deductionNet.commission); deductionCommissionAmount = this.roundAmount(deductionCommissionAmount + deductionNet.commission);
@ -587,7 +600,7 @@
if (order.status == 8 && hasWorkerReasonRefund) { if (order.status == 8 && hasWorkerReasonRefund) {
remark = '配送员原因全额退款,商家餐费仍按正常订单结算'; remark = '配送员原因全额退款,商家餐费仍按正常订单结算';
} else if (order.status == 8 && hasMerchantReasonRefund) { } else if (order.status == 8 && hasMerchantReasonRefund) {
remark = this.isMerchantDeliveryOrder(order) ? '商家原因全额退款,商家不结餐费并承担配送费' : '商家原因全额退款,商家不产生收入'; remark = refundDeliveryResponsibilityAmount > 0 ? '商家原因全额退款,商家不结餐费并承担配送费' : '商家原因全额退款,商家不产生收入';
} else if (order.status == 8 && hasBothReasonRefund) { } else if (order.status == 8 && hasBothReasonRefund) {
remark = '商家/配送员都有原因全额退款,商家不产生收入'; remark = '商家/配送员都有原因全额退款,商家不产生收入';
} }

Loading…
Cancel
Save