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