|
@@ -10,7 +10,13 @@
|
|
|
<InfoCard title="产品信息">
|
|
|
<div class="order-detail-card-content">
|
|
|
<div class="order-detail-card-item" v-for="(item, index) in productInfoTotalItems" :key="index">
|
|
|
- {{ item.label }}:{{ getFilteredValue(orderData[item.key], item.filter ) || '-' }}
|
|
|
+ <div v-if="item.key === 'pure_amount'">
|
|
|
+ {{ item.label }}:¥{{ formatNumber(orderData[item.key]) || '-' }}
|
|
|
+ </div>
|
|
|
+ <div v-else-if="item.key === 'commission'">
|
|
|
+ {{ item.label }}:¥{{ formatNumber(orderData[item.key]) || '-' }}
|
|
|
+ </div>
|
|
|
+ <div v-else>{{ item.label }}:{{ getFilteredValue(orderData[item.key], item.filter ) || '-' }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="order-detail-product-list">
|
|
@@ -32,7 +38,24 @@
|
|
|
>
|
|
|
<div v-if="item.key === 'linkedOrder'" class="linkedOrder">
|
|
|
{{ item.label }}:
|
|
|
- <TableCard :span-method="objectSpanMethod" :table-data="product[item.key]" :columns="linkOrderColumns"></TableCard>
|
|
|
+ <TableCard v-if="product[item.key].length" :table-data="product[item.key]" :columns="linkOrderColumns">
|
|
|
+ <template v-slot:orderArr="{ row }">
|
|
|
+ <el-table
|
|
|
+ :data="row.orderArr"
|
|
|
+ border
|
|
|
+ style="width: 100%">
|
|
|
+ <el-table-column
|
|
|
+ v-for="(smallItem, i) in orderColumns"
|
|
|
+ :key="i"
|
|
|
+ :prop="smallItem.prop"
|
|
|
+ :label="smallItem.label"
|
|
|
+ :width="smallItem.width"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </template>
|
|
|
+ </TableCard>
|
|
|
+ <span v-else>-</span>
|
|
|
</div>
|
|
|
<div v-else-if="item.key === 'final_price' || item.key === 'original_price'">
|
|
|
{{ item.label }}:¥{{ getFilteredValue(product[item.key], item.filter) || '-' }}
|
|
@@ -82,11 +105,12 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ orderDetailInfo: {},
|
|
|
basicInfoItems: [
|
|
|
{ label: '创建人', key: 'create_person' },
|
|
|
{ label: '创建时间', key: 'create_time' },
|
|
|
{ label: '最近更新人', key: 'last_update_person' },
|
|
|
- { label: '最近更新时间', key: 'last_update_time' },
|
|
|
+ { label: '最近更新时间', key: 'autoUpdate' },
|
|
|
{ label: '订单审核状态', key: 'audit_status', filter: 'orderCoursed' },
|
|
|
{ label: '订单状态', key: 'order_status', filter: 'orderStatus' }
|
|
|
],
|
|
@@ -105,19 +129,18 @@ export default {
|
|
|
{ label: '0元订单类型', key: 'zero_type'}
|
|
|
],
|
|
|
productInfoItems: [
|
|
|
- { label: '活动产品', key: 'activity_code', span: 1 },
|
|
|
+ { label: '活动产品', key: 'activity_code', span: 1, condition: (product) => product.activity_code },
|
|
|
{ label: '付费类型', key: 'service_type', filter: 'orderServiceType', span: 3},
|
|
|
- { label: '升级内容', key: 'supServicelds', span: 3, condition: (product) => product.product_type === '大会员' },
|
|
|
+ { label: '升级内容', key: 'supServicelds', span: 3, condition: (product) => product.supServicelds },
|
|
|
{ label: '产品规格', key: 'productName', span: 3},
|
|
|
- { label: '服务列表', key: 'bigServiceNames', span: 1},
|
|
|
+ { label: '服务列表', key: 'bigServiceNames', span: 1, condition: (product) => product.productName.includes('自定义') && product.product_code === 'dyh001'},
|
|
|
{ label: '有效周期', key: 'validity_period', span: 1},
|
|
|
{ label: '合同金额', key: 'final_price', span: 3},
|
|
|
{ label: '标准售价', key: 'original_price', span: 3},
|
|
|
{ label: '折扣率', key: 'rate', span: 3},
|
|
|
{ label: '子账号数量', key: 'subAccountCount', span: 1, condition: (product) => product.product_type === 'VIP订阅' && product.buyAccountCount && product.giftAccountCount },
|
|
|
{ label: '主账号数量', key: 'mainAccountCount', span: 1, condition: (product) => product.product_type === 'VIP订阅' },
|
|
|
- { label: '关联订单', key: 'linkedOrder', span: 1, condition: (product) => product.linkedOrder && product.linkedOrder.length > 0},
|
|
|
-
|
|
|
+ { label: '关联订单', key: 'linkedOrder', span: 1},
|
|
|
{ label: '开通权益手机号', key: 'phone', span: 3},
|
|
|
{ label: '服务开始时间', key: 'service_starttime', span: 3},
|
|
|
{ label: '服务结束时间', key: 'service_endtime', span: 3}
|
|
@@ -146,80 +169,82 @@ export default {
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
- prop: 'order_code',
|
|
|
- label: '订单编号',
|
|
|
- width: 154
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'service_type',
|
|
|
- label: '付费类型',
|
|
|
- width: 80
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'create_time',
|
|
|
- label: '创建时间',
|
|
|
- width: 102
|
|
|
- },
|
|
|
+ prop: 'orderArr',
|
|
|
+ label: '订单详情',
|
|
|
+ width: 336
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ orderColumns: [
|
|
|
+ { prop:'order_code', label: '订单编号', width: 154 },
|
|
|
+ { prop:'service_type', label: '付费类型', width: 80 },
|
|
|
+ { prop:'create_time', label: '创建时间', width: 102 }
|
|
|
],
|
|
|
linkOrderList: [
|
|
|
- {
|
|
|
- name: 'VIP会员',
|
|
|
- empowerCount: 1,
|
|
|
- serviceEndTime: '2023-05-01 00:00:00',
|
|
|
- buySubject: '个人',
|
|
|
- order_code: '2023050',
|
|
|
- service_type: '包年包月',
|
|
|
- create_time: '2023-05-01 00:00:00'
|
|
|
- },
|
|
|
- {
|
|
|
- name: 'VIP会员',
|
|
|
- empowerCount: 1,
|
|
|
- serviceEndTime: '2023-05-01 00:00:00',
|
|
|
- buySubject: '个人',
|
|
|
- order_code: '2023050',
|
|
|
- service_type: '包年包月',
|
|
|
- create_time: '2023-05-01 00:00:00'
|
|
|
- },
|
|
|
- {
|
|
|
- name: 'VIP会员2',
|
|
|
- empowerCount: 1,
|
|
|
- serviceEndTime: '2023-05-01 00:00:00',
|
|
|
- buySubject: '个人',
|
|
|
- order_code: '2023050',
|
|
|
- service_type: '包年包月',
|
|
|
- create_time: '2023-05-01 00:00:00'
|
|
|
- },{
|
|
|
- name: 'VIP会员3',
|
|
|
- empowerCount: 1,
|
|
|
- serviceEndTime: '2023-05-01 00:00:00',
|
|
|
- buySubject: '个人',
|
|
|
- order_code: '2023050',
|
|
|
- service_type: '包年包月',
|
|
|
- create_time: '2023-05-01 00:00:00'
|
|
|
- }
|
|
|
+ // {
|
|
|
+ // name: 'VIP会员1',
|
|
|
+ // empowerCount: 1,
|
|
|
+ // serviceEndTime: '2023-05-01 00:00:00',
|
|
|
+ // buySubject: '个人',
|
|
|
+ // orderArr: [
|
|
|
+ // {
|
|
|
+ // order_code: '2023050',
|
|
|
+ // service_type: '包年包月',
|
|
|
+ // create_time: '2023-05-01 00:00:00'
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // order_code: '2023051',
|
|
|
+ // service_type: '包年包月',
|
|
|
+ // create_time: '2023-05-01 00:00:00'
|
|
|
+ // }
|
|
|
+ // ]
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // name: 'VIP会员2',
|
|
|
+ // empowerCount: 1,
|
|
|
+ // serviceEndTime: '2023-05-01 00:00:00',
|
|
|
+ // buySubject: '个人',
|
|
|
+ // orderArr: [
|
|
|
+ // {
|
|
|
+ // order_code: '2023052',
|
|
|
+ // service_type: '包年包月',
|
|
|
+ // create_time: '2023-05-01 00:00:00'
|
|
|
+ // }
|
|
|
+ // ]
|
|
|
+ // }
|
|
|
],
|
|
|
-
|
|
|
+ spanMap: {}, // 存储每个 product.linkedOrder 中每个 orderArr 的起始 index 和 length
|
|
|
+ spanMapBuilt: false // 标记 spanMap 是否已经构建
|
|
|
}
|
|
|
},
|
|
|
- mounted() {
|
|
|
+ async mounted() {
|
|
|
+ this.orderDetailInfo = await this.orderDetail || {}
|
|
|
this.init()
|
|
|
},
|
|
|
computed: {},
|
|
|
methods: {
|
|
|
init() {
|
|
|
- this.orderData = this.orderDetail?.orderData || {}
|
|
|
- if(this.orderDetail?.productData && this.orderDetail.productData.length > 0) {
|
|
|
- this.productData = this.orderDetail.productData.map(product => {
|
|
|
+ this.orderData = this.orderDetailInfo?.orderData || {}
|
|
|
+ if(this.orderDetailInfo?.productData && this.orderDetailInfo.productData.length > 0) {
|
|
|
+ this.productData = this.orderDetailInfo.productData.map(product => {
|
|
|
try {
|
|
|
- const parsedFilter = JSON.parse(product.filter || '{}')
|
|
|
+ let parsedFilter = {}
|
|
|
+ if(typeof product.filter === 'string' && product.filter !== '') {
|
|
|
+ parsedFilter = JSON.parse(product?.filter || '{}')
|
|
|
+ }
|
|
|
// 计算折扣率
|
|
|
- const rate = (div(product.final_price, product.original_price) * 100).toFixed(2) + '%'
|
|
|
+ let rate = 0
|
|
|
+ if(product.original_price) {
|
|
|
+ rate = (div(product.final_price, product.original_price) * 100).toFixed(2) + '%'
|
|
|
+ } else {
|
|
|
+ rate = '无法计算'
|
|
|
+ }
|
|
|
// 设置有效周期
|
|
|
product.validity_period = this.calculateValidityPeriod(
|
|
|
parsedFilter.buy_cycle,
|
|
|
parsedFilter.buy_type,
|
|
|
parsedFilter.give_cycle,
|
|
|
- parsedFilter.give_type
|
|
|
+ parsedFilter.give_type,
|
|
|
+ product
|
|
|
);
|
|
|
// 设置子账号数量
|
|
|
if (product.product_type === 'VIP订阅') {
|
|
@@ -230,7 +255,7 @@ export default {
|
|
|
// 设置合同金额和标准售价
|
|
|
product.final_price = (product.final_price / 100).toFixed(2)
|
|
|
product.original_price = (product.original_price / 100).toFixed(2)
|
|
|
- // product.linkedOrder = this.linkOrderList
|
|
|
+ product.linkedOrder = this.linkOrderList
|
|
|
return Object.assign(product, { filter: parsedFilter, rate});
|
|
|
} catch (error) {
|
|
|
console.error('JSON 解析失败:', error);
|
|
@@ -243,13 +268,10 @@ export default {
|
|
|
const totalOriginalPrice = (this.productData.reduce((acc, cur) => acc + Number(cur.original_price), 0)).toFixed(2)
|
|
|
this.orderData.final_price_total = '¥' + totalFinalPrice
|
|
|
this.orderData.original_price_total = '¥' + totalOriginalPrice
|
|
|
- // 设置净合同金额合计
|
|
|
- this.orderData.pure_amount = '¥' + (this.orderData.pure_amount / 100).toFixed(2)
|
|
|
- // 设置渠道佣金
|
|
|
- this.orderData.commission = '¥' + (this.orderData.commission / 100).toFixed(2)
|
|
|
// 计算折扣率总和
|
|
|
this.orderData.rate_total = (div(totalFinalPrice, totalOriginalPrice) * 100).toFixed(2) + '%'
|
|
|
- this.productData = this.orderDetail?.productData || []
|
|
|
+ this.productData = this.orderDetailInfo?.productData || []
|
|
|
+ this.buildSpanMap()
|
|
|
},
|
|
|
shouldRenderItem(item, product) {
|
|
|
if (item.condition && typeof item.condition === 'function') {
|
|
@@ -261,7 +283,7 @@ export default {
|
|
|
}
|
|
|
return true;
|
|
|
},
|
|
|
- calculateValidityPeriod(buyCycle, buyType, giveCycle, giveType) {
|
|
|
+ calculateValidityPeriod(buyCycle, buyType, giveCycle, giveType, product) {
|
|
|
let totalMonths = 0;
|
|
|
let buyText = '';
|
|
|
let giveText = '';
|
|
@@ -305,8 +327,8 @@ export default {
|
|
|
totalMonths = buyResult.months + giveResult.months;
|
|
|
buyText = buyResult.text;
|
|
|
giveText = giveResult.text;
|
|
|
-
|
|
|
- return `付费${buyText},赠送${giveText},合计<span>${totalMonths.toFixed(0)}</span>个月(全额回款当日开通)`;
|
|
|
+ const returned_open = product.returned_open === '1' ? '(全额回款当日开通)' : '';
|
|
|
+ return `付费${buyText},赠送${giveText},合计<span>${totalMonths.toFixed(0)}</span>个月${returned_open}`;
|
|
|
},
|
|
|
getValidityPeriodHtml(product, item) {
|
|
|
const label = item.label;
|
|
@@ -315,14 +337,20 @@ export default {
|
|
|
},
|
|
|
// 替代过滤器的通用方法
|
|
|
getFilteredValue(value, filterName) {
|
|
|
- if (!filterName || !value) return value || '-';
|
|
|
+ if (!filterName) return value || '-';
|
|
|
return this[filterName](value);
|
|
|
},
|
|
|
setProductTitle(product, index) {
|
|
|
- const tactics = product.tactics === '2' ? '赠送' : '【购买】';
|
|
|
+ const tactics = product.tactics === '2' ? '【赠送】' : '【售卖】';
|
|
|
return `${index + 1}.${tactics}${product.product_type}`;
|
|
|
},
|
|
|
+ formatNumber(num, x = 2) {
|
|
|
+ num = Number(num) || 0
|
|
|
+ return (num / 100).toFixed(x)
|
|
|
+ },
|
|
|
orderCoursed(val) {
|
|
|
+ console.log(val, 'val')
|
|
|
+
|
|
|
if (val == 0) {
|
|
|
return '待提交'
|
|
|
} else if (val == 1) {
|
|
@@ -342,7 +370,9 @@ export default {
|
|
|
return matchedOption ? matchedOption.label : val; // 如果未找到匹配项,返回原始值
|
|
|
},
|
|
|
orderStatus(val) {
|
|
|
- if (val == 0) {
|
|
|
+ console.log(val, 'val111')
|
|
|
+
|
|
|
+ if (!val || val == 0) {
|
|
|
return '未完成'
|
|
|
} else if (val == 1) {
|
|
|
return '已完成'
|
|
@@ -356,20 +386,54 @@ export default {
|
|
|
return '已退款'
|
|
|
}
|
|
|
},
|
|
|
+ buildSpanMap() {
|
|
|
+ const { productData } = this;
|
|
|
+ const spanMap = {};
|
|
|
+ let currentIndex = 0;
|
|
|
+
|
|
|
+ productData.forEach((product) => {
|
|
|
+ const linkedOrder = product.linkedOrder || [];
|
|
|
+ linkedOrder.forEach((item) => {
|
|
|
+ const orderArr = item.orderArr || [];
|
|
|
+ const len = orderArr.length;
|
|
|
+
|
|
|
+ if (len > 0) {
|
|
|
+ spanMap[currentIndex] = len; // 当前主行对应子行数
|
|
|
+ }
|
|
|
+
|
|
|
+ currentIndex += len;
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ this.spanMap = spanMap;
|
|
|
+ },
|
|
|
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
|
- if (columnIndex === 0) {
|
|
|
- if (rowIndex % 2 === 0) {
|
|
|
- return {
|
|
|
- rowspan: 2,
|
|
|
- colspan: 1
|
|
|
- };
|
|
|
- } else {
|
|
|
- return {
|
|
|
- rowspan: 0,
|
|
|
- colspan: 0
|
|
|
- };
|
|
|
- }
|
|
|
+ if (columnIndex >= 4) return { rowspan: 1, colspan: 1 };
|
|
|
+
|
|
|
+ // 构建或获取已缓存的 spanMap
|
|
|
+ if (!this.spanMapBuilt) {
|
|
|
+ this.buildSpanMap();
|
|
|
+ this.spanMapBuilt = true;
|
|
|
}
|
|
|
+
|
|
|
+ const spanInfo = this.spanMap[rowIndex];
|
|
|
+
|
|
|
+ if (spanInfo && spanInfo > 0) {
|
|
|
+ return {
|
|
|
+ rowspan: spanInfo,
|
|
|
+ colspan: 1
|
|
|
+ };
|
|
|
+ } else if (spanInfo === 0) {
|
|
|
+ return {
|
|
|
+ rowspan: 0,
|
|
|
+ colspan: 0
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ rowspan: 1,
|
|
|
+ colspan: 1
|
|
|
+ };
|
|
|
}
|
|
|
}
|
|
|
}
|