Commit a29a091c authored by spc's avatar spc

fixed

parent 4774146c
......@@ -123,7 +123,8 @@
<script>
import { getOrderDetail } from '@/api/user.js';
import { useHomeStore } from '@/stores/home';
import { jump, JumpType } from '../../utils';
import { jump, JumpType } from '@/utils/index';
import { storeToRefs } from 'pinia';
export default {
data() {
......@@ -183,17 +184,11 @@ export default {
errMsg: '',
virtualConfig: {}
},
isLoading: true,
// 商店信息
homeStore: null
isLoading: true
}
},
onLoad(options) {
console.log('订单详情页面参数:', options);
// 初始化homeStore
this.homeStore = useHomeStore();
if (options.orderId) {
this.loadOrderDetail(options.orderId);
} else {
......@@ -399,153 +394,161 @@ export default {
}
},
// 处理客服按钮点击
handleServiceClick() {
const { memberId, mobile, openId, unionId } = this.homeStore.homeInfo || {};
const customerUrl = `https://intelcc-user.icsoc.net/?channelKey=45839e0505554f8c8aea3c7b6259b049&init=1&crmld=${memberId || ''}&mobile=${mobile || ''}&openId=${openId || ''}&unionId=${unionId || ''}`;
jump({
type: JumpType.H5,
url: customerUrl
});
}
},
// 映射订单状态
mapFlowStateToStatus(flowState) {
const statusMap = {
// 处理中状态
0: { code: 'processing', text: '处理中' },
11: { code: 'processing', text: '处理中' },
12: { code: 'pending_payment', text: '待付款' },
25: { code: 'processing', text: '处理中' },
// 支付相关状态
20: { code: 'pending_payment', text: '待付款' },
21: { code: 'processing', text: '处理中' },
22: { code: 'payment_failed', text: '支付失败' },
23: { code: 'audit_waiting', text: '待审核' },
// 物流相关状态
30: { code: 'waiting_ship', text: '待发货' },
31: { code: 'shipped', text: '已发货' },
32: { code: 'completed', text: '已完成' },
// 使用相关状态
40: { code: 'pending_use', text: '待使用' },
41: { code: 'used', text: '已使用' },
// 活动相关状态
13: { code: 'pending_take', text: '待领取' },
14: { code: 'taken', text: '已领取' },
// 售后相关状态
95: { code: 'refund_processing', text: '售后处理中' },
96: { code: 'refund_success', text: '售后完成' },
// 订单结束状态
97: { code: 'failed', text: '交易失败' },
98: { code: 'cancelled', text: '已取消' },
99: { code: 'completed', text: '已完成' }
};
return statusMap[flowState] || { code: 'completed', text: '已完成' };
},
// 映射订单状态
mapFlowStateToStatus(flowState) {
const statusMap = {
// 处理中状态
0: { code: 'processing', text: '处理中' },
11: { code: 'processing', text: '处理中' },
12: { code: 'pending_payment', text: '待付款' },
25: { code: 'processing', text: '处理中' },
// 支付相关状态
20: { code: 'pending_payment', text: '待付款' },
21: { code: 'processing', text: '处理中' },
22: { code: 'payment_failed', text: '支付失败' },
23: { code: 'audit_waiting', text: '待审核' },
// 物流相关状态
30: { code: 'waiting_ship', text: '待发货' },
31: { code: 'shipped', text: '已发货' },
32: { code: 'completed', text: '已完成' },
// 使用相关状态
40: { code: 'pending_use', text: '待使用' },
41: { code: 'used', text: '已使用' },
// 活动相关状态
13: { code: 'pending_take', text: '待领取' },
14: { code: 'taken', text: '已领取' },
// 售后相关状态
95: { code: 'refund_processing', text: '售后处理中' },
96: { code: 'refund_success', text: '售后完成' },
// 订单结束状态
97: { code: 'failed', text: '交易失败' },
98: { code: 'cancelled', text: '已取消' },
99: { code: 'completed', text: '已完成' }
};
return statusMap[flowState] || { code: 'completed', text: '已完成' };
},
// 格式化时间
formatTime(timestamp) {
if (!timestamp) return '';
const date = new Date(timestamp);
return date.toLocaleString('zh-CN', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
}).replace(/\//g, '.');
},
// 格式化时间
formatTime(timestamp) {
if (!timestamp) return '';
const date = new Date(timestamp);
return date.toLocaleString('zh-CN', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
}).replace(/\//g, '.');
},
// 获取完整地址
getFullAddress() {
if (!this.orderData.address || Object.keys(this.orderData.address).length === 0) {
return '';
}
// 获取完整地址
getFullAddress() {
if (!this.orderData.address || Object.keys(this.orderData.address).length === 0) {
return '';
}
const address = this.orderData.address;
const parts = [];
const address = this.orderData.address;
const parts = [];
if (address.province) parts.push(address.province);
if (address.city) parts.push(address.city);
if (address.area) parts.push(address.area);
if (address.town) parts.push(address.town);
if (address.detail) parts.push(address.detail);
if (address.floorNo) parts.push(address.floorNo);
if (address.province) parts.push(address.province);
if (address.city) parts.push(address.city);
if (address.area) parts.push(address.area);
if (address.town) parts.push(address.town);
if (address.detail) parts.push(address.detail);
if (address.floorNo) parts.push(address.floorNo);
return parts.join('');
},
return parts.join('');
},
// 复制订单编号
copyOrderNumber() {
uni.setClipboardData({
data: this.orderData.orderNumber,
success: () => {
uni.showToast({
title: '订单编号已复制',
icon: 'success'
});
}
});
},
// 复制物流单号
copyTrackingNumber() {
uni.setClipboardData({
data: this.orderData.trackingNumber,
success: () => {
uni.showToast({
title: '物流单号已复制',
icon: 'success'
});
}
});
},
// 查看物流详情
viewLogistics() {
uni.showToast({
title: '查看物流详情',
icon: 'none'
});
},
// 复制订单编号
copyOrderNumber() {
uni.setClipboardData({
data: this.orderData.orderNumber,
success: () => {
// 处理操作按钮点击
handleAction() {
if (this.orderData.productType === 'physical' && this.orderData.statusCode === 'waiting_ship') {
uni.showToast({
title: '订单编号已复制',
icon: 'success'
title: '申请退货',
icon: 'none'
});
}
});
},
// 复制物流单号
copyTrackingNumber() {
uni.setClipboardData({
data: this.orderData.trackingNumber,
success: () => {
if (this.orderData.productType === 'virtual' && this.orderData.statusCode === 'success') {
uni.showToast({
title: '物流单号已复制',
icon: 'success'
title: '去使用',
icon: 'none'
});
}
});
},
},
// 查看物流详情
viewLogistics() {
uni.showToast({
title: '查看物流详情',
icon: 'none'
});
},
// 设置订单状态 - 供外部调用
setOrderStatus(productType, statusCode, statusText, failureReason = '') {
this.orderData.productType = productType;
this.orderData.statusCode = statusCode;
this.orderData.status = statusText;
this.orderData.failureReason = failureReason;
// 根据商品类型调整数据
if (productType === 'virtual') {
this.orderData.price = '¥0.00';
this.orderData.totalPrice = '0积分';
this.orderData.actualPayment = '免费';
}
},
// 处理操作按钮点击
handleAction() {
if (this.orderData.productType === 'physical' && this.orderData.statusCode === 'waiting_ship') {
uni.showToast({
title: '申请退货',
icon: 'none'
});
}
if (this.orderData.productType === 'virtual' && this.orderData.statusCode === 'success') {
uni.showToast({
title: '去使用',
icon: 'none'
// 处理客服按钮点击
handleServiceClick() {
console.log('客服点击');
const homeStore = useHomeStore();
const {
memberId,
mobile,
openId,
unionId
} = homeStore.homeInfo;
const customerUrl =
`https://intelcc-user.icsoc.net/?channelKey=45839e0505554f8c8aea3c7b6259b049&init=1&crmld=${memberId}&mobile=${mobile}&openId=${openId}&unionId=${unionId}`;
jump({
type: JumpType.H5,
url: customerUrl
});
}
},
// 设置订单状态 - 供外部调用
setOrderStatus(productType, statusCode, statusText, failureReason = '') {
this.orderData.productType = productType;
this.orderData.statusCode = statusCode;
this.orderData.status = statusText;
this.orderData.failureReason = failureReason;
// 根据商品类型调整数据
if (productType === 'virtual') {
this.orderData.price = '¥0.00';
this.orderData.totalPrice = '0积分';
this.orderData.actualPayment = '免费';
}
}
}
</script>
......
......@@ -8,21 +8,21 @@
<view class="result-icon" :class="resultIconClass">
<text class="icon-text">{{ resultIcon }}</text>
</view>
<!-- 状态文字 -->
<text class="result-text">{{ resultText }}</text>
<!-- 成功状态显示积分信息 -->
<view v-if="isSuccess" class="points-info">
<text class="points-value">{{ pointsValue }}</text>
<text class="points-unit">{{ resultData.creditsTypeName || '积分' }}</text>
</view>
<!-- 失败状态显示失败原因 -->
<view v-if="!isSuccess" class="failure-info">
<text class="failure-reason">{{ failureReason }}</text>
</view>
<!-- 支付方式信息 - 仅成功状态显示 -->
<view v-if="isSuccess" class="payment-info">
<view class="payment-row">
......@@ -45,7 +45,8 @@
<!-- 客服按钮 -->
<view class="service-btn" @click="handleServiceClick">
<image class="service-icon" :src="$baseUrl + 'homepage/Q3Res/settlementCenter_serviceBtn.png'" mode="aspectFit"></image>
<image class="service-icon" :src="$baseUrl + 'homepage/Q3Res/settlementCenter_serviceBtn.png'"
mode="aspectFit"></image>
</view>
</view>
</template>
......@@ -83,32 +84,32 @@ export default {
isSuccess() {
return this.resultData.isSuccess;
},
// 结果图标
resultIcon() {
return this.isSuccess ? '✓' : '✕';
},
// 结果图标样式类
resultIconClass() {
return this.isSuccess ? 'icon-success' : 'icon-failure';
},
// 结果文字
resultText() {
return this.isSuccess ? '兑换成功' : '兑换失败';
},
// 积分值
pointsValue() {
return this.resultData.pointsValue;
},
// 失败原因
failureReason() {
return this.resultData.failureReason;
},
// 操作按钮文字
actionButtonText() {
return this.isSuccess ? '查看订单' : '返回首页';
......@@ -116,10 +117,10 @@ export default {
},
onLoad(options) {
console.log('支付结果页面接收到的参数:', options);
// 初始化homeStore
this.homeStore = useHomeStore();
// 处理页面参数
if (options.isSuccess !== undefined) {
this.resultData.isSuccess = options.isSuccess === 'true';
......@@ -134,7 +135,7 @@ export default {
this.resultData.orderId = options.orderId;
console.log('接收到的订单ID:', options.orderId);
}
// 保存其他参数供后续使用
this.resultData.goodsName = options.goodsName || '';
this.resultData.goodsImage = options.goodsImage || '';
......@@ -145,7 +146,7 @@ export default {
this.resultData.gid = options.gid || '';
this.resultData.skuld = options.skuld || '';
this.resultData.buy_num = parseInt(options.buy_num) || 1;
console.log('支付结果数据:', this.resultData);
},
methods: {
......@@ -172,25 +173,33 @@ export default {
});
}
},
// 设置支付结果 - 供外部调用
setPaymentResult(isSuccess, pointsValue = '', failureReason = '', orderId = '') {
this.resultData.isSuccess = isSuccess;
this.resultData.pointsValue = pointsValue;
this.resultData.failureReason = failureReason;
this.resultData.orderId = orderId;
},
// 处理客服按钮点击
handleServiceClick() {
const { memberId, mobile, openId, unionId } = this.homeStore.homeInfo || {};
const customerUrl = `https://intelcc-user.icsoc.net/?channelKey=45839e0505554f8c8aea3c7b6259b049&init=1&crmld=${memberId || ''}&mobile=${mobile || ''}&openId=${openId || ''}&unionId=${unionId || ''}`;
jump({
type: JumpType.H5,
url: customerUrl
});
}
setPaymentResult(isSuccess, pointsValue = '', failureReason = '', orderId = '') {
this.resultData.isSuccess = isSuccess;
this.resultData.pointsValue = pointsValue;
this.resultData.failureReason = failureReason;
this.resultData.orderId = orderId;
},
// 处理客服按钮点击
handleServiceClick() {
console.log('客服点击');
const homeStore = useHomeStore();
const {
memberId,
mobile,
openId,
unionId
} = homeStore.homeInfo;
const customerUrl =
`https://intelcc-user.icsoc.net/?channelKey=45839e0505554f8c8aea3c7b6259b049&init=1&crmld=${memberId}&mobile=${mobile}&openId=${openId}&unionId=${unionId}`;
jump({
type: JumpType.H5,
url: customerUrl
});
}
}
}
</script>
......
......@@ -377,8 +377,16 @@ export default {
// 处理客服按钮点击
handleServiceClick() {
const { memberId, mobile, openId, unionId } = this.homeStore.homeInfo || {};
const customerUrl = `https://intelcc-user.icsoc.net/?channelKey=45839e0505554f8c8aea3c7b6259b049&init=1&crmld=${memberId || ''}&mobile=${mobile || ''}&openId=${openId || ''}&unionId=${unionId || ''}`;
console.log('客服点击');
const homeStore = useHomeStore();
const {
memberId,
mobile,
openId,
unionId
} = homeStore.homeInfo;
const customerUrl =
`https://intelcc-user.icsoc.net/?channelKey=45839e0505554f8c8aea3c7b6259b049&init=1&crmld=${memberId}&mobile=${mobile}&openId=${openId}&unionId=${unionId}`;
jump({
type: JumpType.H5,
url: customerUrl
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment