|
@@ -14,14 +14,19 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="order-detail-product-list">
|
|
|
- <ProductCard v-for="(product, index) in productData" :key="product.id" :title="setProductTitle(product, index)" subtitle="该产品暂不支持系统自动开通权限,请联系运维开通">
|
|
|
+ <ProductCard v-for="(product, index) in productData" :key="product.id" :title="setProductTitle(product, index)" :subtitle="product.auto !== 1 ? '该产品暂不支持系统自动开通权限,请联系运维开通': ''">
|
|
|
<div class="order-detail-product-content">
|
|
|
- <div class="order-detail-card-item" v-for="(item, index) in productInfoItems" :key="index">
|
|
|
- <div v-if="item.key === 'linkedOrder'" class="linkedOrder">
|
|
|
- {{ item.label }}
|
|
|
- <TableCard :columns="linkOrderColumns"></TableCard>
|
|
|
+ <div class="grouped-items">
|
|
|
+ <div class="order-detail-card-item" :class="`item-span-${item.span}`" v-for="(item, index) in productInfoItems" :key="index">
|
|
|
+ <div v-if="item.key === 'linkedOrder'" class="linkedOrder">
|
|
|
+ {{ item.label }}:
|
|
|
+ <TableCard :columns="linkOrderColumns"></TableCard>
|
|
|
+ </div>
|
|
|
+ <div v-else-if="item.key === 'validity_period'">
|
|
|
+ <span v-html="getValidityPeriodHtml(product, item)"></span>
|
|
|
+ </div>
|
|
|
+ <div v-else>{{ item.label }}:{{ getFilteredValue(product[item.key], item.filter) || '-' }}</div>
|
|
|
</div>
|
|
|
- <div v-else>{{ item.label }}:{{ getFilteredValue(product[item.key], item.filter) || '-' }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</ProductCard>
|
|
@@ -68,21 +73,21 @@ export default {
|
|
|
{ label: '0元订单类型', key: 'product_type'}
|
|
|
],
|
|
|
productInfoItems: [
|
|
|
- { label: '活动产品', key: 'activity_code' },
|
|
|
- { label: '付费类型', key: 'service_type', filter: 'orderServiceType' },
|
|
|
- { label: '升级内容', key: 'supServicelds' },
|
|
|
- { label: '产品规格', key: 'combold'},
|
|
|
- { label: '服务列表', key: 'product_type'},
|
|
|
- { label: '有效周期', key: 'product_type'},
|
|
|
- { label: '合同金额', key: 'final_price'},
|
|
|
- { label: '标准售价', key: 'original_price'},
|
|
|
- { label: '折扣率', key: 'rate'},
|
|
|
- { label: '子账号数量', key: 'product_type'},
|
|
|
- { label: '主账号数量', key: 'product_type'},
|
|
|
- { label: '关联订单', key: 'linkedOrder'},
|
|
|
- { label: '开通权益手机号', key: 'product_type'},
|
|
|
- { label: '服务开始时间', key: 'product_type'},
|
|
|
- { label: '服务结束时间', key: 'product_type'}
|
|
|
+ { label: '活动产品', key: 'activity_code', span: 1 },
|
|
|
+ { label: '付费类型', key: 'service_type', filter: 'orderServiceType', span: 3},
|
|
|
+ { label: '升级内容', key: 'supServicelds', span: 3 },
|
|
|
+ { label: '产品规格', key: 'productName', span: 3},
|
|
|
+ { label: '服务列表', key: 'bigServiceNames', span: 1},
|
|
|
+ { 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: 'product_type', span: 1},
|
|
|
+ { label: '主账号数量', key: 'product_type', span: 1},
|
|
|
+ { label: '关联订单', key: 'linkedOrder', span: 1},
|
|
|
+ { label: '开通权益手机号', key: 'phone', span: 3},
|
|
|
+ { label: '服务开始时间', key: 'service_starttime', span: 3},
|
|
|
+ { label: '服务结束时间', key: 'service_endtime', span: 3}
|
|
|
],
|
|
|
orderData: {},
|
|
|
productData: [],
|
|
@@ -108,48 +113,115 @@ export default {
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
- prop: 'buySubject',
|
|
|
- label: '购买主体',
|
|
|
- width: 80
|
|
|
+ prop: 'order_code',
|
|
|
+ label: '订单编号',
|
|
|
+ width: 154
|
|
|
},
|
|
|
{
|
|
|
- prop: 'buySubject',
|
|
|
- label: '购买主体',
|
|
|
+ prop: 'service_type',
|
|
|
+ label: '付费类型',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
- prop: 'buySubject',
|
|
|
- label: '购买主体',
|
|
|
- width: 80
|
|
|
+ prop: 'create_time',
|
|
|
+ label: '创建时间',
|
|
|
+ width: 102
|
|
|
},
|
|
|
- ]
|
|
|
+ ]
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.orderData = this.orderDetail?.orderData || {}
|
|
|
- if(this.orderDetail?.productData && this.orderDetail.productData.length > 0) {
|
|
|
- this.productData = this.orderDetail.productData.map(product => {
|
|
|
- try {
|
|
|
- const parsedFilter = JSON.parse(product.filter || '{}')
|
|
|
- const rate = (div(product.final_price, product.original_price) * 100).toFixed(2) + '%'
|
|
|
- return Object.assign(product, { filter: parsedFilter, rate});
|
|
|
- } catch (error) {
|
|
|
- console.error('JSON 解析失败:', error);
|
|
|
- return product;
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- this.productData = this.orderDetail?.productData || []
|
|
|
+ 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 => {
|
|
|
+ try {
|
|
|
+ const parsedFilter = JSON.parse(product.filter || '{}')
|
|
|
+ // 计算折扣率
|
|
|
+ const rate = (div(product.final_price, product.original_price) * 100).toFixed(2) + '%'
|
|
|
+ // 设置有效周期
|
|
|
+ product.validity_period = this.calculateValidityPeriod(
|
|
|
+ parsedFilter.buy_cycle,
|
|
|
+ parsedFilter.buy_type,
|
|
|
+ parsedFilter.give_cycle,
|
|
|
+ parsedFilter.give_type
|
|
|
+ );
|
|
|
+ // 设置合同金额和标准售价
|
|
|
+ product.final_price = '¥' + (product.final_price / 100).toFixed(2)
|
|
|
+ product.original_price = '¥' + (product.original_price / 100).toFixed(2)
|
|
|
+ return Object.assign(product, { filter: parsedFilter, rate});
|
|
|
+ } catch (error) {
|
|
|
+ console.error('JSON 解析失败:', error);
|
|
|
+ return product;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.productData = this.orderDetail?.productData || []
|
|
|
+ },
|
|
|
+ calculateValidityPeriod(buyCycle, buyType, giveCycle, giveType) {
|
|
|
+ let totalMonths = 0;
|
|
|
+ let buyText = '';
|
|
|
+ let giveText = '';
|
|
|
+ const TIME_MAP = {
|
|
|
+ '1': '天',
|
|
|
+ '2': '月',
|
|
|
+ '3': '年',
|
|
|
+ '4': '季度'
|
|
|
+ }
|
|
|
+ // 安全地将字符串转为整数,默认为 0
|
|
|
+ const parseCycle = (cycle) => {
|
|
|
+ const num = parseInt(cycle);
|
|
|
+ return isNaN(num) ? 0 : num;
|
|
|
+ };
|
|
|
+ // 计算周期并返回文本和月份数
|
|
|
+ const processCycle = (cycle, type) => {
|
|
|
+ const textValue = TIME_MAP[type] || '';
|
|
|
+ const value = parseCycle(cycle);
|
|
|
+
|
|
|
+ let months = 0;
|
|
|
+ let text = '';
|
|
|
+
|
|
|
+ if (textValue.includes('月')) {
|
|
|
+ months += value;
|
|
|
+ text = `${value}个月`;
|
|
|
+ } else if (textValue.includes('年')) {
|
|
|
+ months += value * 12;
|
|
|
+ text = `${value}年`;
|
|
|
+ } else if (textValue.includes('季度')) {
|
|
|
+ months += value * 3;
|
|
|
+ text = `${value}季度`;
|
|
|
+ } else if (textValue.includes('天')) {
|
|
|
+ months += value / 30; // 注意:此处为近似值
|
|
|
+ text = `${value}天`;
|
|
|
+ }
|
|
|
+
|
|
|
+ return { months, text };
|
|
|
+ };
|
|
|
+ const buyResult = processCycle(buyCycle, buyType);
|
|
|
+ const giveResult = processCycle(giveCycle, giveType);
|
|
|
+ totalMonths = buyResult.months + giveResult.months;
|
|
|
+ buyText = buyResult.text;
|
|
|
+ giveText = giveResult.text;
|
|
|
+
|
|
|
+ return `付费${buyText},赠送${giveText},合计<span>${totalMonths.toFixed(0)}</span>个月(全额回款当日开通)`;
|
|
|
+ },
|
|
|
+ getValidityPeriodHtml(product, item) {
|
|
|
+ const label = item.label;
|
|
|
+ const value = product[item.key] || '-';
|
|
|
+ return `${label}:${value}`;
|
|
|
+ },
|
|
|
// 替代过滤器的通用方法
|
|
|
getFilteredValue(value, filterName) {
|
|
|
if (!filterName || !value) return value || '-';
|
|
|
return this[filterName](value);
|
|
|
},
|
|
|
setProductTitle(product, index) {
|
|
|
- return `${index + 1}.【售卖】${product.product_type}`;
|
|
|
+ const tactics = product.tactics === '2' ? '赠送' : '【购买】';
|
|
|
+ return `${index + 1}.${tactics}${product.product_type}`;
|
|
|
},
|
|
|
orderCoursed(val) {
|
|
|
if (val == 0) {
|
|
@@ -204,11 +276,24 @@ export default {
|
|
|
align-items: center;
|
|
|
margin-bottom: 6px;
|
|
|
}
|
|
|
+ .grouped-items {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ .item-span-1 {
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+
|
|
|
+ .item-span-3 {
|
|
|
+ min-width: 255px;
|
|
|
+ }
|
|
|
+ }
|
|
|
.order-detail-product-content {
|
|
|
display: flex;
|
|
|
flex-wrap: wrap;
|
|
|
align-items: center;
|
|
|
margin-bottom: 6px;
|
|
|
+ padding: 0 24px;
|
|
|
}
|
|
|
.order-detail-card-item {
|
|
|
min-width: 255px;
|
|
@@ -217,6 +302,10 @@ export default {
|
|
|
font-size: 14px;
|
|
|
line-height: 22px;
|
|
|
color: $gray_10;
|
|
|
+ .linkedOrder {
|
|
|
+ display: flex;
|
|
|
+ align-items: flex-start;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</style>
|