|
@@ -14,7 +14,7 @@
|
|
{{ item.label }}:¥{{ formatNumber(orderData[item.key]) || '-' }}
|
|
{{ item.label }}:¥{{ formatNumber(orderData[item.key]) || '-' }}
|
|
</div>
|
|
</div>
|
|
<div v-else-if="item.key === 'commission'">
|
|
<div v-else-if="item.key === 'commission'">
|
|
- {{ item.label }}:¥{{ formatNumber(orderData[item.key]) || '-' }}
|
|
|
|
|
|
+ {{ item.label }}:¥{{ formatNumber(orderData[item.key]) || '0.00' }}
|
|
</div>
|
|
</div>
|
|
<div v-else-if="item.key === 'zero_type'">
|
|
<div v-else-if="item.key === 'zero_type'">
|
|
<span v-if="shouldRenderItem(item)">
|
|
<span v-if="shouldRenderItem(item)">
|
|
@@ -96,7 +96,7 @@
|
|
import InfoCard from '../../ui/InfoCard.vue';
|
|
import InfoCard from '../../ui/InfoCard.vue';
|
|
import ProductCard from '../../ui/ProductCard.vue';
|
|
import ProductCard from '../../ui/ProductCard.vue';
|
|
import { paymentTypeOptions } from '../../data/options.js';
|
|
import { paymentTypeOptions } from '../../data/options.js';
|
|
-import { div } from '@/utils/number/';
|
|
|
|
|
|
+import { div, calcDiscountRate, roundToTwoDecimals } from '@/utils/number/';
|
|
import TableCard from '../../ui/TableCard.vue';
|
|
import TableCard from '../../ui/TableCard.vue';
|
|
export default {
|
|
export default {
|
|
name: 'OrderDetailCard',
|
|
name: 'OrderDetailCard',
|
|
@@ -261,7 +261,7 @@ export default {
|
|
calculateDiscountRate(product) {
|
|
calculateDiscountRate(product) {
|
|
let rate = '无法计算';
|
|
let rate = '无法计算';
|
|
if (product.original_price && Number(product.original_price) !== 0) {
|
|
if (product.original_price && Number(product.original_price) !== 0) {
|
|
- rate = (div(product.final_price, product.original_price) * 100).toFixed(2) + '%';
|
|
|
|
|
|
+ rate = (calcDiscountRate(product.final_price, product.original_price)) + '%';
|
|
}
|
|
}
|
|
return rate;
|
|
return rate;
|
|
},
|
|
},
|
|
@@ -307,8 +307,10 @@ export default {
|
|
|
|
|
|
flattenLinkOrderList(linkOrderList) {
|
|
flattenLinkOrderList(linkOrderList) {
|
|
const result = [];
|
|
const result = [];
|
|
|
|
+ if (!linkOrderList || linkOrderList.length === 0) return result;
|
|
linkOrderList.forEach(item => {
|
|
linkOrderList.forEach(item => {
|
|
const { orderArr, ...rest } = item; // 拆分 orderArr 和其他字段
|
|
const { orderArr, ...rest } = item; // 拆分 orderArr 和其他字段
|
|
|
|
+ if (!orderArr || orderArr.length === 0) return;
|
|
orderArr.forEach(order => {
|
|
orderArr.forEach(order => {
|
|
result.push({
|
|
result.push({
|
|
...rest, // 非 orderArr 的字段(如 name, empowerCount 等)
|
|
...rest, // 非 orderArr 的字段(如 name, empowerCount 等)
|
|
@@ -393,9 +395,10 @@ export default {
|
|
const tactics = product.tactics === '2' ? '【赠送】' : '【售卖】';
|
|
const tactics = product.tactics === '2' ? '【赠送】' : '【售卖】';
|
|
return `${index + 1}.${tactics}${product.product_type}`;
|
|
return `${index + 1}.${tactics}${product.product_type}`;
|
|
},
|
|
},
|
|
|
|
+ // 格式化数字,保留两位小数
|
|
formatNumber(num, x = 2) {
|
|
formatNumber(num, x = 2) {
|
|
- num = Number(num) || 0
|
|
|
|
- return (num / 100).toFixed(x)
|
|
|
|
|
|
+ if(!num) return 0.00
|
|
|
|
+ return roundToTwoDecimals(num, x)
|
|
},
|
|
},
|
|
orderCoursed(val) {
|
|
orderCoursed(val) {
|
|
if (val == 0) {
|
|
if (val == 0) {
|