|
@@ -1,128 +1,9 @@
|
|
|
<template>
|
|
|
<div class="order-detail-card-container">
|
|
|
<InfoCard title="基本信息">
|
|
|
- <div class="order-detail-card-content">
|
|
|
- <div class="order-detail-card-item" v-for="(item, index) in basicInfoItems" :key="index">
|
|
|
- {{ item.label }}:{{ getFilteredValue(orderData[item.key], item.filter) || '-' }}
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </InfoCard>
|
|
|
- <InfoCard title="产品信息">
|
|
|
- <div class="order-detail-card-content">
|
|
|
- <div class="order-detail-card-item" v-for="(item, index) in productInfoTotalItems" :key="index">
|
|
|
- <div v-if="item.key === 'pure_amount'">
|
|
|
- {{ item.label }}:¥{{ formatNumber(orderData[item.key]) || '-' }}
|
|
|
- <span class="red-chong" v-if="setRedPunchDisplay('合同金额')">(红冲过)</span>
|
|
|
- </div>
|
|
|
- <div v-else-if="item.key === 'final_price_total'">
|
|
|
- {{ item.label }}:¥{{ orderData[item.key] || '-' }}
|
|
|
- <span class="red-chong" v-if="setRedPunchDisplay('合同金额')">(红冲过)</span>
|
|
|
- </div>
|
|
|
- <div v-else-if="item.key === 'commission'">
|
|
|
- {{ item.label }}:¥{{ formatNumber(orderData[item.key]) || '0.00' }}
|
|
|
- <span class="red-chong" v-if="setRedPunchDisplay('销售费用')">(红冲过)</span>
|
|
|
- </div>
|
|
|
- <div v-else-if="item.key === 'rate_total'">
|
|
|
- {{ item.label }}:<span :class="{'red-chong': orderData[item.key] === '无法计算'}">{{ orderData[item.key] || '-' }}</span>
|
|
|
- <span class="red-chong" v-if="setRedPunchDisplay('折扣率')">(红冲过)</span>
|
|
|
- </div>
|
|
|
- <div v-else-if="item.key === 'zero_type'">
|
|
|
- <span v-if="shouldRenderItem(item)">
|
|
|
- {{ item.label }}:{{ getFilteredValue(orderData[item.key], item.filter) || '-' }}
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- <div v-else>{{ item.label }}:{{ getFilteredValue(orderData[item.key], item.filter ) || '-' }}</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="order-detail-product-list">
|
|
|
- <ProductCard
|
|
|
- v-for="(product, index) in productData"
|
|
|
- :key="product.id"
|
|
|
- :title="setProductTitle(product, index)"
|
|
|
- :subtitle="product.auto !== 1 ? '该产品暂不支持系统自动开通权限,请联系运维开通': ''"
|
|
|
- >
|
|
|
- <template #actions>
|
|
|
- <button @click="openPermissionActivation(product)" class="order-detail-product-actions-btn" v-if="isShowPermission(product)">权限开通</button>
|
|
|
- </template>
|
|
|
- <div class="order-detail-product-content">
|
|
|
- <div class="grouped-items">
|
|
|
- <div
|
|
|
- v-for="(item, index) in productInfoItems"
|
|
|
- :key="index"
|
|
|
- :class="`item-span-${item.span}`"
|
|
|
- >
|
|
|
- <div
|
|
|
- class="order-detail-card-item"
|
|
|
- v-if="shouldRenderItem(item, product)"
|
|
|
- >
|
|
|
- <div v-if="item.key === 'linkedOrder'" class="linkedOrder">
|
|
|
- {{ item.label }}:
|
|
|
- <TableCard :span-method="objectSpanMethod" v-if="product[item.key].length" :table-data="product[item.key]" :columns="linkOrderColumns">
|
|
|
- </TableCard>
|
|
|
- <span v-else>-</span>
|
|
|
- </div>
|
|
|
- <div v-else-if="item.key === 'subAccountCount'">
|
|
|
- <span v-html="getValidityPeriodHtml(product, item)"></span>
|
|
|
- </div>
|
|
|
- <div v-else-if="item.key === 'mainAccountCount'">
|
|
|
- <span v-html="getValidityPeriodHtml(product, item)"></span>
|
|
|
- </div>
|
|
|
- <div v-else-if="item.key ==='rate'">
|
|
|
- {{ item.label }}:
|
|
|
- <span :class="{'no_open_root': product.original_price === '0.00'}">{{ getFilteredValue(product[item.key], item.filter) || '-' }}</span>
|
|
|
- <span class="red-chong" v-if="setRedPunchDisplay('折扣率')">(红冲过)</span>
|
|
|
- </div>
|
|
|
- <div v-else-if="item.key === 'final_price' || item.key === 'original_price'">
|
|
|
- {{ item.label }}:¥{{ getFilteredValue(product[item.key], item.filter) || '-' }}
|
|
|
- <span class="red-chong" v-if="setRedPunchDisplay('合同金额') && item.key === 'final_price'">(红冲过)</span>
|
|
|
- </div>
|
|
|
- <div v-else-if="item.key === 'validity_period'">
|
|
|
- <span v-html="getValidityPeriodHtml(product, item)"></span>
|
|
|
- </div>
|
|
|
- <div v-else-if="item.key === 'supServicelds'">
|
|
|
- {{ item.label }}:{{ getFilteredValue(product[item.key], item.filter) || '-' }}
|
|
|
- </div>
|
|
|
- <div v-else-if="item.key === 'service_starttime'">
|
|
|
- {{ item.label }}:
|
|
|
- <span :class="{'no_open_root':!product.is_service_open}" >{{ product.is_service_open? (product.service_starttime || '-') : '暂未开通' }}</span>
|
|
|
- </div>
|
|
|
- <div v-else-if="item.key === 'service_endtime'">
|
|
|
- {{ item.label }}:
|
|
|
- <span :class="{'no_open_root': !product.is_service_open}" >{{ product.is_service_open ? (product.service_endtime || '-') : '暂未开通' }}</span>
|
|
|
- </div>
|
|
|
- <div v-else-if="item.key ==='phone'">
|
|
|
- {{ item.label }}:{{ orderData.user_phone || '-' }}
|
|
|
- </div>
|
|
|
- <div v-else>{{ item.label }}:{{ getFilteredValue(product[item.key], item.filter) || '-' }}</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <template #activity>
|
|
|
- <div v-if="product.activity_code" class="order-detail-product-activity">
|
|
|
- <div class="order-detail-product-activity-title">
|
|
|
- <span>活动商品:</span>
|
|
|
- <span>{{ product.activity_code || '买2年大会员送:1年大会员+人脉管理+阳光直采+1000条数据流量包高级字段包+腾讯视频年卡' }}</span>
|
|
|
- </div>
|
|
|
- <div class="order-detail-product-activity-item">
|
|
|
- <div class="order-detail-product-activity-item-title">
|
|
|
- <span>合同金额合计:</span>
|
|
|
- <span>¥{{ product.final_price }}</span>
|
|
|
- </div>
|
|
|
- <div class="order-detail-product-activity-item-title">
|
|
|
- <span>标准售价合计:</span>
|
|
|
- <span>¥{{ product.original_price }}</span>
|
|
|
- </div>
|
|
|
- <div class="order-detail-product-activity-item-title">
|
|
|
- <span>折扣率:</span>
|
|
|
- <span>{{ product.rate }}</span>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </ProductCard>
|
|
|
- </div>
|
|
|
+ <OrderDetailCardBase></OrderDetailCardBase>
|
|
|
</InfoCard>
|
|
|
+ <OrderDetailCardProduct></OrderDetailCardProduct>
|
|
|
<InfoCard title="其他信息">
|
|
|
<div class="order-detail-card-content">
|
|
|
<div class="order-detail-card-item" v-for="(item, index) in otherInfoItems" :key="index">
|
|
@@ -130,116 +11,32 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</InfoCard>
|
|
|
- <newDetailModel ref="newDetailModel" :data="orderDetail"></newDetailModel>
|
|
|
- <ServiceList v-show="false" ref="serviceListRef"></ServiceList>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import InfoCard from '../../ui/InfoCard.vue';
|
|
|
-import ProductCard from '../../ui/ProductCard.vue';
|
|
|
-import { paymentTypeOptions } from '../../data/options.js';
|
|
|
-import { div, calcDiscountRate, roundToTwoDecimals } from '@/utils/number/';
|
|
|
-import TableCard from '../../ui/TableCard.vue';
|
|
|
-import newDetailModel from '@/views/order/components/new-detailModel.vue';
|
|
|
-import ServiceList from '../product-info-submodule/ServiceList.vue';
|
|
|
+import { roundToTwoDecimals } from '@/utils/number/';
|
|
|
+import OrderDetailCardBase from './OrderDetailCardBase.vue';
|
|
|
+import OrderDetailCardProduct from './OrderDetailCardProduct.vue';
|
|
|
+import { mapState } from 'vuex';
|
|
|
export default {
|
|
|
name: 'OrderDetailCard',
|
|
|
components: {
|
|
|
InfoCard,
|
|
|
- ProductCard,
|
|
|
- TableCard,
|
|
|
- newDetailModel,
|
|
|
- ServiceList
|
|
|
- },
|
|
|
- props: {
|
|
|
- orderDetail: {
|
|
|
- type: Object,
|
|
|
- default: () => {}
|
|
|
- }
|
|
|
+ OrderDetailCardBase,
|
|
|
+ OrderDetailCardProduct
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
orderDetailInfo: {},
|
|
|
- basicInfoItems: [
|
|
|
- { label: '创建人', key: 'create_person' },
|
|
|
- { label: '创建时间', key: 'create_time' },
|
|
|
- { label: '最近更新人', key: 'last_update_person' },
|
|
|
- { label: '最近更新时间', key: 'autoUpdate' },
|
|
|
- { label: '订单审核状态', key: 'audit_status', filter: 'orderCoursed' },
|
|
|
- { label: '订单状态', key: 'order_status', filter: 'orderStatus' }
|
|
|
- ],
|
|
|
otherInfoItems: [
|
|
|
{ label: '约定支付方式', key: 'pay_way' },
|
|
|
{ label: '下单渠道', key: 'order_channel_new' },
|
|
|
{ label: '付款户名', key: 'payment_user'},
|
|
|
{ label: '订单备注', key: 'remark' },
|
|
|
],
|
|
|
- productInfoTotalItems: [
|
|
|
- { label: '合同金额合计', key: 'final_price_total' },
|
|
|
- { label: '标准售价合计', key: 'original_price_total'},
|
|
|
- { label: '折扣率', key: 'rate_total' },
|
|
|
- { label: '销售费用', key: 'commission'},
|
|
|
- { label: '净合同金额合计', key: 'pure_amount'},
|
|
|
- { label: '0元订单类型', key: 'zero_type', condition: () => this.orderData.final_price_total === '0.00' },
|
|
|
- ],
|
|
|
- productInfoItems: [
|
|
|
- { 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.supServicelds },
|
|
|
- { label: '产品规格', key: 'productName', span: 3},
|
|
|
- { label: '服务列表', key: 'bigServiceNames', span: 1, condition: (product) => product.productName && 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: () => this.parsedFilter.buyAccountCount && this.parsedFilter.giftAccountCount },
|
|
|
- { label: '主账号数量', key: 'mainAccountCount', span: 1, condition: (product) => product.product_type === 'VIP订阅' },
|
|
|
- { label: '关联订单', key: 'linkedOrder', span: 1},
|
|
|
- { label: '开通权益手机号', key: 'phone', span: 3},
|
|
|
- { label: '服务开始时间', key: 'service_starttime', span: 3},
|
|
|
- { label: '服务结束时间', key: 'service_endtime', span: 3}
|
|
|
- ],
|
|
|
orderData: {},
|
|
|
- productData: [],
|
|
|
- linkOrderColumns: [
|
|
|
- {
|
|
|
- prop: 'name',
|
|
|
- label: '产品类型及规格',
|
|
|
- width: 154
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'empowerCount',
|
|
|
- label: '账号数量',
|
|
|
- width: 80
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'serviceEndTime',
|
|
|
- label: '到期时间',
|
|
|
- width: 102
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'buySubject',
|
|
|
- label: '购买主体',
|
|
|
- width: 80
|
|
|
- },
|
|
|
- {
|
|
|
- prop:'order_code',
|
|
|
- label: '订单编号',
|
|
|
- width: 154
|
|
|
- },
|
|
|
- {
|
|
|
- prop:'service_type',
|
|
|
- label: '付费类型',
|
|
|
- width: 80
|
|
|
- },
|
|
|
- {
|
|
|
- prop:'create_time',
|
|
|
- label: '创建时间',
|
|
|
- width: 102
|
|
|
- }
|
|
|
- ],
|
|
|
- parsedFilter: {}
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -252,259 +49,14 @@ export default {
|
|
|
immediate: true
|
|
|
}
|
|
|
},
|
|
|
- // async mounted() {
|
|
|
- // this.orderDetailInfo = await this.orderDetail || {}
|
|
|
- // this.init()
|
|
|
- // },
|
|
|
computed: {
|
|
|
- isUpEntRed() {
|
|
|
- return this.orderDetailInfo?.redPunchData?.isUpEnt || false
|
|
|
- }
|
|
|
+ ...mapState({
|
|
|
+ orderDetail: state => state.order.orderDetail,
|
|
|
+ })
|
|
|
},
|
|
|
methods: {
|
|
|
async init() {
|
|
|
this.orderData = this.orderDetailInfo?.orderData || {};
|
|
|
- let productData = this.orderDetailInfo?.productData || [];
|
|
|
-
|
|
|
- if (productData.length > 0) {
|
|
|
- // 使用 Promise.all 来并行处理每个 product 的异步操作
|
|
|
- productData = await Promise.all(
|
|
|
- productData.map(async (product) => {
|
|
|
- try {
|
|
|
- const parsedFilter = this.parseProductFilter(product);
|
|
|
- const serviceIds = parsedFilter.serviceIds || [];
|
|
|
-
|
|
|
- // 等待异步方法完成
|
|
|
- const bigServiceNames = await this.buildBigServiceNames(serviceIds);
|
|
|
- const rate = this.calculateDiscountRate(product);
|
|
|
- const validityPeriod = this.calculateValidityPeriod(
|
|
|
- parsedFilter.buy_cycle,
|
|
|
- parsedFilter.buy_type,
|
|
|
- parsedFilter.give_cycle,
|
|
|
- parsedFilter.give_type,
|
|
|
- product
|
|
|
- );
|
|
|
- const subAccountCount = this.buildSubAccountCount(product, parsedFilter);
|
|
|
- const mainAccountCount = this.buildMainAccountCount(product);
|
|
|
- const linkedOrder = this.processLinkedOrder(product);
|
|
|
- const finalPrice = this.formatNumber(product.final_price);
|
|
|
- const originalPrice = this.formatNumber(product.original_price);
|
|
|
-
|
|
|
- return {
|
|
|
- ...product,
|
|
|
- filter: parsedFilter,
|
|
|
- rate,
|
|
|
- validity_period: validityPeriod,
|
|
|
- subAccountCount,
|
|
|
- mainAccountCount,
|
|
|
- linkedOrder,
|
|
|
- bigServiceNames,
|
|
|
- final_price: finalPrice,
|
|
|
- original_price: originalPrice
|
|
|
- };
|
|
|
- } catch (error) {
|
|
|
- console.error('产品信息初始化失败:', error);
|
|
|
- return product;
|
|
|
- }
|
|
|
- })
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- this.setTotalAmounts(productData);
|
|
|
- this.productData = productData;
|
|
|
- },
|
|
|
- // 权限开通
|
|
|
- openPermissionActivation() {
|
|
|
- this.$refs.newDetailModel.permissionActivationShow = true;
|
|
|
- },
|
|
|
- isShowPermission (product) {
|
|
|
- const { auto, attribute } = product
|
|
|
- const { return_status } = this.orderData?.return_status || 0
|
|
|
- // 仅当该产品类型支持系统自动开通权限,且产品属性为会员服务或资源包,且“回款状态”为“全额回款”才展示,否则不展示;
|
|
|
- return auto === 1 && (attribute === 1 || attribute === 2) && return_status === 1
|
|
|
- },
|
|
|
- // 设置红冲标识显示字段
|
|
|
- setRedPunchDisplay(product) {
|
|
|
- const { isUpCommission, isUpEnt, isUpCash } = this.orderDetailInfo?.redPunchData || {};
|
|
|
- const RETURN_BOOL = {
|
|
|
- '合同金额': isUpCash,
|
|
|
- '销售费用': isUpCommission,
|
|
|
- '签约主体': isUpEnt,
|
|
|
- '折扣率': isUpCash
|
|
|
- }
|
|
|
- return RETURN_BOOL[product] || false;
|
|
|
- },
|
|
|
- buildBigServiceNames(serviceIds) {
|
|
|
- return new Promise((resolve) => {
|
|
|
- if (!serviceIds || serviceIds.length === 0) {
|
|
|
- resolve('');
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- // 避免修改原始数组,创建新的整型数组
|
|
|
- const numericServiceIds = serviceIds.map(id => parseInt(id));
|
|
|
-
|
|
|
- this.$nextTick(() => {
|
|
|
- try {
|
|
|
- const serviceListRef = this.$refs.serviceListRef;
|
|
|
- if (!serviceListRef || typeof serviceListRef.calcAlreadyBuyServiceNamesArr !== 'function') {
|
|
|
- resolve('');
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- const res = serviceListRef.calcAlreadyBuyServiceNamesArr(numericServiceIds);
|
|
|
- const serviceData = Array.isArray(res) ? res.join('、') : '';
|
|
|
- resolve(serviceData);
|
|
|
- } catch (error) {
|
|
|
- console.error('Error calculating service names:', error);
|
|
|
- resolve('');
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
- parseProductFilter(product) {
|
|
|
- let parsedFilter = {};
|
|
|
- if (typeof product.filter === 'string') {
|
|
|
- try {
|
|
|
- parsedFilter = JSON.parse(product.filter || '{}');
|
|
|
- } catch {
|
|
|
- parsedFilter = {};
|
|
|
- }
|
|
|
- } else {
|
|
|
- parsedFilter = product.filter || {};
|
|
|
- }
|
|
|
- return parsedFilter;
|
|
|
- },
|
|
|
-
|
|
|
- // 计算折扣率
|
|
|
- calculateDiscountRate(product) {
|
|
|
- let rate = '无法计算';
|
|
|
- if (product.original_price && Number(product.original_price) >= 0) {
|
|
|
- rate = (calcDiscountRate(product.final_price, product.original_price)) + '%';
|
|
|
- }
|
|
|
- return rate;
|
|
|
- },
|
|
|
-
|
|
|
- // 构造子账号数量字符串。
|
|
|
- buildSubAccountCount(product, filter) {
|
|
|
-
|
|
|
- if (product.product_type === 'VIP订阅' || product.product_type === '大会员') {
|
|
|
- const buyCount = Number(filter?.buyAccountCount) || 0;
|
|
|
- const giftCount = Number(filter?.giftAccountCount) || 0;
|
|
|
- const countTotal = buyCount + giftCount;
|
|
|
- return `付费${buyCount}个,赠送${giftCount}个,合计:<span class="color_main">${countTotal}</span>个`;
|
|
|
- }
|
|
|
- return '';
|
|
|
- },
|
|
|
-
|
|
|
- // 构造主账号数量字符串。
|
|
|
- buildMainAccountCount(product) {
|
|
|
- if (product.product_type === 'VIP订阅') {
|
|
|
- return `付费1个,合计<span class="color_main">1</span>个`;
|
|
|
- }
|
|
|
- return '';
|
|
|
- },
|
|
|
-
|
|
|
- // 处理关联订单数据。
|
|
|
- processLinkedOrder(product) {
|
|
|
- if (product.linkedOrder && Object.keys(product.linkedOrder).length > 0) {
|
|
|
- const orderList = [product.linkedOrder];
|
|
|
- return this.flattenLinkOrderList(orderList);
|
|
|
- }
|
|
|
- return [];
|
|
|
- },
|
|
|
-
|
|
|
- // 设置合同金额合计和标准售价合计,以及计算折扣率总和。
|
|
|
- setTotalAmounts(productData) {
|
|
|
- const totalFinalPrice = productData.reduce((acc, cur) => acc + Number(cur.final_price), 0).toFixed(2);
|
|
|
- const totalOriginalPrice = productData.reduce((acc, cur) => acc + Number(cur.original_price), 0).toFixed(2);
|
|
|
- const rateTotal = div(totalFinalPrice, totalOriginalPrice) ? (div(totalFinalPrice, totalOriginalPrice) * 100).toFixed(2) + '%' : '无法计算';
|
|
|
-
|
|
|
- this.orderData.final_price_total = totalFinalPrice;
|
|
|
- this.orderData.original_price_total = '¥' + totalOriginalPrice;
|
|
|
- this.orderData.rate_total = Number(totalOriginalPrice) ? rateTotal : '无法计算';
|
|
|
- },
|
|
|
-
|
|
|
- flattenLinkOrderList(linkOrderList) {
|
|
|
- const result = [];
|
|
|
- if (!linkOrderList || linkOrderList.length === 0) return result;
|
|
|
- linkOrderList.forEach(item => {
|
|
|
- const { orderArr, ...rest } = item; // 拆分 orderArr 和其他字段
|
|
|
- if (!orderArr || orderArr.length === 0) return;
|
|
|
- orderArr.forEach(order => {
|
|
|
- result.push({
|
|
|
- ...rest, // 非 orderArr 的字段(如 name, empowerCount 等)
|
|
|
- ...order // orderArr 中的字段(如 order_code, service_type 等)
|
|
|
- });
|
|
|
- });
|
|
|
- });
|
|
|
- return result;
|
|
|
- },
|
|
|
-
|
|
|
- shouldRenderItem(item, product) {
|
|
|
- if (item.condition && typeof item.condition === 'function') {
|
|
|
- const conditionResult = item.condition(product)
|
|
|
- if(!conditionResult) {
|
|
|
- // item.span = 0
|
|
|
- }
|
|
|
- return conditionResult
|
|
|
- }
|
|
|
- return true;
|
|
|
- },
|
|
|
-
|
|
|
- calculateValidityPeriod(buyCycle, buyType, giveCycle, giveType, product) {
|
|
|
- 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;
|
|
|
- const returned_open = product.returned_open === '1' ? '(全额回款当日开通)' : '';
|
|
|
- if(totalMonths === 0) return '-'
|
|
|
- return `付费${buyText},赠送${giveText},合计<span class="color_main">${totalMonths.toFixed(0)}</span>个月${returned_open}`;
|
|
|
- },
|
|
|
-
|
|
|
- getValidityPeriodHtml(product, item) {
|
|
|
- const label = item.label;
|
|
|
- const value = product[item.key] || '-';
|
|
|
- return `${label}:${value}`;
|
|
|
},
|
|
|
|
|
|
// 替代过滤器的通用方法
|
|
@@ -512,67 +64,11 @@ export default {
|
|
|
if (!filterName) return value || '-';
|
|
|
return this[filterName](value);
|
|
|
},
|
|
|
- setProductTitle(product, index) {
|
|
|
- const tactics = product.tactics === '2' ? '【赠送】' : '【售卖】';
|
|
|
- if(product.product_type === 'VIP订阅') {
|
|
|
- return `${index + 1}.${tactics}超级订阅`;
|
|
|
- }
|
|
|
- return `${index + 1}.${tactics}${product.product_type}`;
|
|
|
- },
|
|
|
// 格式化数字,保留两位小数
|
|
|
formatNumber(num, x = 2) {
|
|
|
if(!num) return 0.00
|
|
|
const newnum = Number(num) / 100;
|
|
|
return roundToTwoDecimals(newnum, x)
|
|
|
- },
|
|
|
- orderCoursed(val) {
|
|
|
- if (val == 0) {
|
|
|
- return '待提交'
|
|
|
- } else if (val == 1) {
|
|
|
- return '待一审'
|
|
|
- } else if (val == 2) {
|
|
|
- return '待二审'
|
|
|
- } else if (val == 4) {
|
|
|
- return '待三审'
|
|
|
- } else if (val == 3) {
|
|
|
- return '已通过'
|
|
|
- } else if (val == -2 || val == -3 || val == -4) {
|
|
|
- return '已退回'
|
|
|
- }
|
|
|
- },
|
|
|
- orderServiceType(val) {
|
|
|
- const matchedOption = paymentTypeOptions.find(option => option.value === val);
|
|
|
- return matchedOption ? matchedOption.label : val; // 如果未找到匹配项,返回原始值
|
|
|
- },
|
|
|
- orderStatus(val) {
|
|
|
- if (!val || val == 0) {
|
|
|
- return '未完成'
|
|
|
- } else if (val == 1) {
|
|
|
- return '已完成'
|
|
|
- } else if (val == -1) {
|
|
|
- return '逻辑删除'
|
|
|
- } else if (val == -2) {
|
|
|
- return '已取消'
|
|
|
- } else if (val == -3) {
|
|
|
- return '已退款'
|
|
|
- } else if (val == -3) {
|
|
|
- return '已退款'
|
|
|
- }
|
|
|
- },
|
|
|
- objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
|
- if (columnIndex <= 3) {
|
|
|
- if (rowIndex % 2 === 0) {
|
|
|
- return {
|
|
|
- rowspan: 2,
|
|
|
- colspan: 1
|
|
|
- };
|
|
|
- } else {
|
|
|
- return {
|
|
|
- rowspan: 0,
|
|
|
- colspan: 0
|
|
|
- };
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -592,35 +88,6 @@ export default {
|
|
|
align-items: center;
|
|
|
margin-bottom: 6px;
|
|
|
}
|
|
|
- .order-detail-product-actions-btn {
|
|
|
- padding: 4px 17px;
|
|
|
- background: $color_main;
|
|
|
- font-size: 14px;
|
|
|
- line-height: 22px;
|
|
|
- color: $white;
|
|
|
- border-radius: 4px;
|
|
|
- border: none;
|
|
|
- cursor: pointer;
|
|
|
- }
|
|
|
- .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;
|
|
|
margin-right: 32px;
|
|
@@ -633,43 +100,5 @@ export default {
|
|
|
align-items: flex-start;
|
|
|
}
|
|
|
}
|
|
|
- .red-chong {
|
|
|
- color: $red_light;
|
|
|
- }
|
|
|
- .no_open_root {
|
|
|
- color: $red_light;
|
|
|
- }
|
|
|
- ::v-deep {
|
|
|
- .color_main {
|
|
|
- color: #2ABED1;
|
|
|
- }
|
|
|
- }
|
|
|
- .order-detail-product-activity {
|
|
|
- padding: 14px 20px;
|
|
|
- border: 1px solid $color_main;
|
|
|
- background: rgba(42, 190, 209, 0.08);
|
|
|
- border-radius: 8px;
|
|
|
- &-title {
|
|
|
- font-size: 14px;
|
|
|
- line-height: 22px;
|
|
|
- color: $color_main;
|
|
|
- }
|
|
|
- &-item {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- margin-top: 8px;
|
|
|
- }
|
|
|
- &-item-title {
|
|
|
- margin-right: 24px;
|
|
|
- &>span {
|
|
|
- font-size: 14px;
|
|
|
- line-height: 22px;
|
|
|
- color: #686868;
|
|
|
- }
|
|
|
- &>span:last-child {
|
|
|
- color: #1D1D1D;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
</style>
|