Commit 3fc02de3 authored by spc's avatar spc

fixed

parent d44b2d2f
No preview for this file type
assets/reservation-images/briefcase.png

566 Bytes | W: | H:

assets/reservation-images/briefcase.png

337 Bytes | W: | H:

assets/reservation-images/briefcase.png
assets/reservation-images/briefcase.png
assets/reservation-images/briefcase.png
assets/reservation-images/briefcase.png
  • 2-up
  • Swipe
  • Onion skin
assets/reservation-images/briefcase_new.png

517 Bytes | W: | H:

assets/reservation-images/briefcase_new.png

480 Bytes | W: | H:

assets/reservation-images/briefcase_new.png
assets/reservation-images/briefcase_new.png
assets/reservation-images/briefcase_new.png
assets/reservation-images/briefcase_new.png
  • 2-up
  • Swipe
  • Onion skin
assets/reservation-images/calendar-gray.png

657 Bytes | W: | H:

assets/reservation-images/calendar-gray.png

344 Bytes | W: | H:

assets/reservation-images/calendar-gray.png
assets/reservation-images/calendar-gray.png
assets/reservation-images/calendar-gray.png
assets/reservation-images/calendar-gray.png
  • 2-up
  • Swipe
  • Onion skin
assets/reservation-images/calendar.png

556 Bytes | W: | H:

assets/reservation-images/calendar.png

348 Bytes | W: | H:

assets/reservation-images/calendar.png
assets/reservation-images/calendar.png
assets/reservation-images/calendar.png
assets/reservation-images/calendar.png
  • 2-up
  • Swipe
  • Onion skin
assets/reservation-images/calendar_new.png

831 Bytes | W: | H:

assets/reservation-images/calendar_new.png

719 Bytes | W: | H:

assets/reservation-images/calendar_new.png
assets/reservation-images/calendar_new.png
assets/reservation-images/calendar_new.png
assets/reservation-images/calendar_new.png
  • 2-up
  • Swipe
  • Onion skin
assets/reservation-images/close.png

5.11 KB | W: | H:

assets/reservation-images/close.png

1.41 KB | W: | H:

assets/reservation-images/close.png
assets/reservation-images/close.png
assets/reservation-images/close.png
assets/reservation-images/close.png
  • 2-up
  • Swipe
  • Onion skin
assets/reservation-images/icon-list.png

1.45 KB | W: | H:

assets/reservation-images/icon-list.png

587 Bytes | W: | H:

assets/reservation-images/icon-list.png
assets/reservation-images/icon-list.png
assets/reservation-images/icon-list.png
assets/reservation-images/icon-list.png
  • 2-up
  • Swipe
  • Onion skin
assets/reservation-images/s-1.png

210 KB | W: | H:

assets/reservation-images/s-1.png

70.8 KB | W: | H:

assets/reservation-images/s-1.png
assets/reservation-images/s-1.png
assets/reservation-images/s-1.png
assets/reservation-images/s-1.png
  • 2-up
  • Swipe
  • Onion skin
assets/reservation-images/s-2.png

343 KB | W: | H:

assets/reservation-images/s-2.png

95.7 KB | W: | H:

assets/reservation-images/s-2.png
assets/reservation-images/s-2.png
assets/reservation-images/s-2.png
assets/reservation-images/s-2.png
  • 2-up
  • Swipe
  • Onion skin
assets/reservation-images/sign.png

163 KB | W: | H:

assets/reservation-images/sign.png

58.7 KB | W: | H:

assets/reservation-images/sign.png
assets/reservation-images/sign.png
assets/reservation-images/sign.png
assets/reservation-images/sign.png
  • 2-up
  • Swipe
  • Onion skin
assets/reservation-images/success.png

98.7 KB | W: | H:

assets/reservation-images/success.png

33.3 KB | W: | H:

assets/reservation-images/success.png
assets/reservation-images/success.png
assets/reservation-images/success.png
assets/reservation-images/success.png
  • 2-up
  • Swipe
  • Onion skin
assets/reservation-images/twitter.png

1.18 KB | W: | H:

assets/reservation-images/twitter.png

704 Bytes | W: | H:

assets/reservation-images/twitter.png
assets/reservation-images/twitter.png
assets/reservation-images/twitter.png
assets/reservation-images/twitter.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -215,83 +215,14 @@ export default {
return true; // 未登录时按钮仍然可点击,会跳转到登录页
}
// 已登录用户需要检查各种条件
// 1. 商品库存不足
if (this.goodsData.exchangeCount <= 0) {
return false;
}
// 2. 用户积分不足
if (this.userStore && this.userStore.userInfo) {
const userCredits = this.userStore.userInfo.credits || 0;
if (userCredits < this.goodsData.points) {
return false;
}
}
// 3. 用户等级不足(检查vipLimit数组)
if (this.goodsData.vipLimit && this.goodsData.vipLimit.length > 0 && this.userStore && this.userStore.userInfo) {
const userLevel = this.userStore.userInfo.grade || 1;
const userLevelName = this.getUserLevelName(userLevel);
// 检查用户等级是否在vipLimit中
if (!this.goodsData.vipLimit.includes(userLevelName)) {
return false;
}
}
// 4. 用户达到兑换上限(使用goodsLimit)
if (this.goodsData.goodsLimit && this.userBuyLimit) {
return false;
}
// 5. 商品状态检查
if (this.goodsData.goodsState !== 1) {
return false;
}
return true;
// 已登录用户:只有state=1时才能兑换
return this.goodsData.goodsState === 1;
},
// 兑换状态
// 兑换状态(已废弃,改用state直接判断)
exchangeStatus() {
// 未登录状态
if (!this.cfgStatus.isRegister) {
return 'notLoggedIn';
}
// 1. 商品库存不足
if (this.goodsData.exchangeCount <= 0) {
return 'soldOut';
}
// 2. 用户积分不足
if (this.userStore && this.userStore.userInfo) {
const userCredits = this.userStore.userInfo.credits || 0;
if (userCredits < this.goodsData.points) {
return 'insufficientCredits';
}
}
// 3. 用户等级不足(检查vipLimit数组)
if (this.goodsData.vipLimit && this.goodsData.vipLimit.length > 0 && this.userStore && this.userStore.userInfo) {
const userLevel = this.userStore.userInfo.grade || 1;
const userLevelName = this.getUserLevelName(userLevel);
// 检查用户等级是否在vipLimit中
if (!this.goodsData.vipLimit.includes(userLevelName)) {
return 'insufficientLevel';
}
}
// 4. 用户达到兑换上限(使用goodsLimit)
if (this.goodsData.goodsLimit && this.userBuyLimit) {
return 'exchangeLimit';
}
// 5. 商品状态检查
if (this.goodsData.goodsState !== 1) {
return 'disabled';
}
// 这个方法现在不再使用,保留只是为了兼容
// 实际判断使用 goodsData.goodsState
return 'canExchange';
}
},
......@@ -681,26 +612,29 @@ export default {
return classes;
}
// 根据兑换状态添加对应样式
switch (this.exchangeStatus) {
case 'soldOut':
classes['sold-out'] = true;
// 根据state值添加对应样式
switch (this.goodsData.goodsState) {
case 1:
// 立即兑换:金色背景
break;
case 'insufficientCredits':
case 2:
// 积分不足:灰色背景
classes['insufficient-points'] = true;
break;
case 'insufficientLevel':
case 7:
// 等级不足:灰色背景
classes['insufficient-level'] = true;
break;
case 'exchangeLimit':
case 6:
// 已达兑换上限:灰色背景
classes['exchange-limit'] = true;
break;
case 'disabled':
classes['disabled'] = true;
case 4:
// 已抢完:灰色背景
classes['sold-out'] = true;
break;
case 'canExchange':
default:
// 正常状态,不添加额外样式
// 默认状态:金色背景
break;
}
......@@ -714,19 +648,18 @@ export default {
return '立即兑换';
}
// 根据兑换状态返回对应文本
switch (this.exchangeStatus) {
case 'soldOut':
return '已抢完';
case 'insufficientCredits':
// 根据state值直接判断
switch (this.goodsData.goodsState) {
case 1:
return '立即兑换';
case 2:
return '积分不足';
case 'insufficientLevel':
case 7:
return '等级不足';
case 'exchangeLimit':
case 6:
return '已达兑换上限';
case 'disabled':
return this.goodsData.buttonText || '无法兑换';
case 'canExchange':
case 4:
return '已抢完';
default:
return '立即兑换';
}
......@@ -1056,7 +989,7 @@ export default {
const resultParams = {
// 基础结果参数
isSuccess: isSuccess,
orderId: orderData ? orderData.orderId : '',
orderId: orderData ? (orderData.orderId || orderData.orderNo || orderData.id) : '',
// 积分信息
pointsValue: `${this.goodsData.points}${this.goodsData.creditsTypeName || '积分'}`,
......
......@@ -24,6 +24,7 @@
</view>
</view>
</view>
<text class="address-arrow">{{ ">" }}</text>
</view>
<!-- 商品详情 -->
......@@ -32,6 +33,8 @@
<view class="product-image">
<image v-if="orderData.goodsImage && orderData.goodsImage.length > 0"
:src="orderData.goodsImage[0]" mode="aspectFill" class="product-img" />
<image v-else-if="orderData.productType === 'virtual' && orderData.coupon && orderData.coupon.qrImage"
:src="orderData.coupon.qrImage" mode="aspectFill" class="product-img" />
<text v-else class="image-placeholder">{{ orderData.productType === 'virtual' ? '优惠券' : '商品'
}}</text>
</view>
......@@ -41,8 +44,9 @@
orderData.skuDesc }}</text>
<text v-if="orderData.productType === 'virtual' && orderData.expireTime"
class="product-spec">过期时间 {{ orderData.expireTime }}</text>
<text v-if="orderData.productType === 'virtual' && orderData.goodsContent"
class="product-spec">使用说明 {{ orderData.goodsContent }}</text>
<view v-if="orderData.productType === 'virtual' && orderData.goodsContent" class="product-content">
<rich-text :nodes="orderData.goodsContent" class="content-text"></rich-text>
</view>
<view class="price-quantity-row">
<text class="product-price">{{ orderData.price }}</text>
<text class="product-quantity">x{{ orderData.quantity }}</text>
......@@ -117,9 +121,9 @@
<script>
import { getOrderDetail } from '@/api/user.js';
export default {
data() {
return {
export default {
data() {
return {
// 订单数据
orderData: {
productType: '', // 'physical' | 'virtual'
......@@ -336,11 +340,11 @@ export default {
this.orderData.virtualConfig = apiData.virtualConfig || {};
// 根据商品类型和状态设置显示信息
this.setProductTypeAndStatus();
this.setProductTypeAndStatus(apiData);
},
// 设置商品类型和状态
setProductTypeAndStatus() {
setProductTypeAndStatus(apiData = null) {
// 根据goodsType判断商品类型
// Object("实物") - 实物商品,需要展示物流状态
// Card("卡密"), Charge("直冲"), Link("链接"), Virtual("虚拟") - 非实物商品,不需要展示物流状态
......@@ -353,15 +357,13 @@ export default {
this.orderData.failureReason = this.orderData.errMsg || '';
// 设置价格显示
if (this.orderData.productType === 'virtual') {
this.orderData.price = '0积分';
this.orderData.totalPrice = '0积分';
this.orderData.actualPayment = '免费';
} else {
this.orderData.price = `${this.orderData.credits}${this.orderData.creditsTypeName}`;
this.orderData.totalPrice = `${this.orderData.totalCredits}${this.orderData.creditsTypeName}`;
this.orderData.actualPayment = `${this.orderData.totalCredits}${this.orderData.creditsTypeName}`;
}
// 统一处理价格显示,优先使用credits字段
const creditsValue = this.orderData.credits || '0';
const creditsType = this.orderData.creditsTypeName || '积分';
this.orderData.price = `${creditsValue}${creditsType}`;
this.orderData.totalPrice = `${creditsValue}${creditsType}`;
this.orderData.actualPayment = `${creditsValue}${creditsType}`;
// 设置物流信息(仅实物商品)
if (this.orderData.productType === 'physical' && this.orderData.express && Object.keys(this.orderData.express).length > 0) {
......@@ -370,8 +372,20 @@ export default {
}
// 设置有效期(非实物商品)
if (this.orderData.productType === 'virtual' && this.orderData.coupon.expireTime) {
this.orderData.expireTime = this.formatTime(this.orderData.coupon.expireTime);
if (this.orderData.productType === 'virtual') {
// 优先使用 coupon.date,然后使用 coupon.expireTime,最后使用 API 的 expireTime
let expireTime = null;
if (this.orderData.coupon && this.orderData.coupon.date) {
expireTime = this.orderData.coupon.date;
} else if (this.orderData.coupon && this.orderData.coupon.expireTime) {
expireTime = this.orderData.coupon.expireTime;
} else if (apiData && apiData.expireTime) {
expireTime = apiData.expireTime;
}
if (expireTime) {
this.orderData.expireTime = this.formatTime(expireTime);
}
}
},
......@@ -512,8 +526,8 @@ export default {
this.orderData.actualPayment = '免费';
}
}
}
}
}
</script>
<style scoped>
......@@ -666,6 +680,12 @@ export default {
color: #666;
}
.address-arrow {
font-size: 32rpx;
color: #999;
margin-left: 20rpx;
}
/* 商品详情 */
.product-section {
background-color: #fff;
......@@ -680,8 +700,8 @@ export default {
}
.product-image {
width: 120rpx;
height: 120rpx;
width: 100rpx;
height: 100rpx;
background-color: #f0e6d2;
border-radius: 10rpx;
display: flex;
......@@ -722,16 +742,28 @@ export default {
display: block;
}
.product-content {
margin-bottom: 12rpx;
}
.content-text {
font-size: 24rpx;
color: #666;
line-height: 1.4;
max-height: 200rpx;
overflow-y: auto;
}
.price-quantity-row {
display: flex;
align-items: center;
justify-content: space-between;
}
.product-price {
font-size: 32rpx;
color: #d3a458;
font-weight: bold;
margin-right: 20rpx;
}
.product-quantity {
......
......@@ -15,7 +15,7 @@
<!-- 成功状态显示积分信息 -->
<view v-if="isSuccess" class="points-info">
<text class="points-value">{{ pointsValue }}</text>
<text class="points-unit">积分</text>
<text class="points-unit">{{ resultData.creditsTypeName || '积分' }}</text>
</view>
<!-- 失败状态显示失败原因 -->
......@@ -117,13 +117,14 @@ export default {
this.resultData.isSuccess = options.isSuccess === 'true';
}
if (options.pointsValue) {
this.resultData.pointsValue = options.pointsValue;
this.resultData.pointsValue = decodeURIComponent(options.pointsValue);
}
if (options.failureReason) {
this.resultData.failureReason = decodeURIComponent(options.failureReason);
}
if (options.orderId) {
this.resultData.orderId = options.orderId;
console.log('接收到的订单ID:', options.orderId);
}
// 保存其他参数供后续使用
......@@ -131,7 +132,7 @@ export default {
this.resultData.goodsImage = options.goodsImage || '';
this.resultData.goodsSpec = options.goodsSpec || '';
this.resultData.quantity = parseInt(options.quantity) || 1;
this.resultData.creditsTypeName = options.creditsTypeName || '积分';
this.resultData.creditsTypeName = decodeURIComponent(options.creditsTypeName || '积分');
this.resultData.priceData = options.priceData || '';
this.resultData.gid = options.gid || '';
this.resultData.skuld = options.skuld || '';
......@@ -145,10 +146,12 @@ export default {
if (this.isSuccess) {
// 查看订单 - 跳转到订单详情页面
if (this.resultData.orderId) {
console.log('跳转到订单详情页,订单ID:', this.resultData.orderId);
uni.navigateTo({
url: `/v3/orderDetail/orderDetail?orderId=${this.resultData.orderId}`
});
} else {
console.log('没有订单ID,跳转到订单列表页');
// 如果没有订单ID,跳转到订单列表页面
uni.navigateTo({
url: '/v3/orderList/orderList'
......
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