diff --git a/pages/index/index.vue b/pages/index/index.vue index 4f08c34..8892cd7 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -56,7 +56,7 @@ - + 热销 @@ -79,7 +79,7 @@ {{ item.name }} - {{ item.description.details }} + {{ item.description.sub_title }} @@ -251,6 +251,7 @@ export default { item.description = parseDescription(item.description) return item }) + console.log(this.shopList ) }) }, async userIsLogin() { diff --git a/pages/order/create.vue b/pages/order/create.vue index 9a85582..6551b62 100644 --- a/pages/order/create.vue +++ b/pages/order/create.vue @@ -29,12 +29,8 @@ × - + {{ item.receiver_name }} {{ item.phone }} @@ -63,7 +59,7 @@ - + {{ item.product_name || item.name }} @@ -83,13 +79,8 @@ 订单备注 - + @@ -130,7 +121,7 @@ import request from '@/api/request.js'; import { fetchAddressList } from '@/api/address.js'; export default { - data() { + data() { return { orderItems: [], // 订单商品列表 selectedAddress: null, // 选中的收货地址 @@ -293,7 +284,7 @@ export default { // 调用创建订单接口 const result = await request('xcx/order', 'POST', orderData); - + uni.showToast({ title: '订单提交成功', icon: 'success', @@ -301,24 +292,35 @@ export default { }); // 发起微信支付 wx.requestPayment({ - timeStamp: result.timeStamp, - nonceStr: result.nonceStr, + timeStamp: result.time_stamp, + nonceStr: result.nonce_str, package: result.package, - signType: result.signType, - paySign: result.paySign, + signType: result.sign_type, + paySign: result.pay_sign, success: () => { - console.log('支付成功'); + // console.log('支付成功'); + // // 跳转到订单详情或订单列表页面 + // setTimeout(() => { + // // 根据实际路由调整 + // uni.redirectTo({ + // url: `/pages/order/detail?id=${result.order_id || result.id}` + // }); + // }, 2000); + }, + complete: () => { + console.log('支付xxx'); // 跳转到订单详情或订单列表页面 - setTimeout(() => { + // setTimeout(() => { // 根据实际路由调整 uni.redirectTo({ url: `/pages/order/detail?id=${result.order_id || result.id}` }); - }, 2000); - } + // }, 2000); + } + }); - + } catch (error) { console.error('提交订单失败:', error); @@ -655,6 +657,7 @@ export default { from { transform: translateY(100%); } + to { transform: translateY(0); } diff --git a/pages/order/detail.vue b/pages/order/detail.vue index 1d7e208..4691f47 100644 --- a/pages/order/detail.vue +++ b/pages/order/detail.vue @@ -1,16 +1,375 @@ @@ -19,17 +378,261 @@ export default { .order-detail-page { min-height: 100vh; background-color: #f5f5f5; - display: flex; - align-items: center; - justify-content: center; + padding: 32rpx; + box-sizing: border-box; } .detail-content { - padding: 40rpx; + display: flex; + flex-direction: column; + gap: 24rpx; } -.placeholder-text { +.card { + background-color: #fff; + border-radius: 16rpx; + padding: 32rpx; + box-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.06); +} + +.section-title { + display: flex; + align-items: center; + justify-content: space-between; + font-size: 30rpx; + font-weight: 600; + margin-bottom: 24rpx; +} + +.sub-info { + font-size: 24rpx; + color: #888; + font-weight: 400; +} + +.status-tag { + padding: 6rpx 20rpx; + border-radius: 999rpx; + font-size: 24rpx; +} + +.status-pending { + background-color: #fff5e5; + color: #f57c00; +} + +.status-failed { + background-color: #ffe5e5; + color: #d32f2f; +} + +.status-delivering, +.status-receiving { + background-color: #e8f4ff; + color: #1976d2; +} + +.status-success { + background-color: #e5f9f0; + color: #22a46d; +} + +.status-cancel { + background-color: #f0f0f0; + color: #777; +} + +.status-refund { + background-color: #f0e8ff; + color: #7b1fa2; +} + +.status-default { + background-color: #ececec; + color: #666; +} + +.row { + display: flex; + align-items: center; + margin-bottom: 16rpx; +} + +.label { + width: 160rpx; + font-size: 26rpx; + color: #666; +} + +.value { + flex: 1; font-size: 28rpx; + color: #111; + text-align: right; +} + +.amount-row { + margin-top: 12rpx; +} + +.amount { + font-size: 40rpx; + font-weight: 600; + color: #d81e06; +} + +.total-row .amount { + font-size: 44rpx; +} + +.warning-card { + background: linear-gradient(135deg, #fff6e6, #ffe8d1); +} + +.warning-title { + display: flex; + align-items: center; + justify-content: space-between; + font-size: 28rpx; + font-weight: 600; + margin-bottom: 16rpx; + color: #b34700; +} + +.countdown { + font-size: 26rpx; + color: #d81e06; +} + +.warning-text { + font-size: 26rpx; + color: #8c4a00; + line-height: 1.6; +} + +.address { + text-align: right; + word-break: break-all; +} + +.product-list { + display: flex; + flex-direction: column; + gap: 24rpx; +} + +.product-item { + display: flex; + gap: 24rpx; +} + +.product-img { + width: 140rpx; + height: 140rpx; + border-radius: 12rpx; + background-color: #f6f6f6; +} + +.product-info { + flex: 1; + display: flex; + flex-direction: column; + gap: 8rpx; +} + +.product-name-row { + display: flex; + align-items: center; + flex-wrap: wrap; + gap: 12rpx; +} + +.product-name { + font-size: 30rpx; + color: #111; + font-weight: 600; +} + +.product-tag { + font-size: 20rpx; + color: #f57c00; + background-color: #fff4e0; + padding: 2rpx 12rpx; + border-radius: 999rpx; +} + +.product-tag.limited { + color: #c2185b; + background-color: #ffe1ec; +} + +.product-sku { + font-size: 24rpx; + color: #666; +} + +.product-desc { + font-size: 24rpx; color: #999; } + +.product-meta { + display: flex; + justify-content: space-between; + align-items: center; + margin-top: 8rpx; +} + +.product-price { + font-size: 30rpx; + color: #d81e06; + font-weight: 600; +} + +.product-qty { + font-size: 26rpx; + color: #555; +} + +.empty-tip { + padding: 40rpx 0; + text-align: center; + color: #999; + font-size: 28rpx; +} + +.empty-block { + min-height: 400rpx; + display: flex; + align-items: center; + justify-content: center; + color: #999; + font-size: 28rpx; +} + +.action-bar { + position: sticky; + bottom: 0; + left: 0; + right: 0; + padding: 24rpx 32rpx 48rpx; + background: linear-gradient(180deg, rgba(245, 245, 245, 0), #f5f5f5 40%, #f5f5f5); + display: flex; + justify-content: center; +} + +.pay-btn { + width: 100%; + border: none; + border-radius: 999rpx; + background-image: linear-gradient(120deg, #ff8a00, #ff4d4f); + color: #fff; + font-size: 32rpx; + font-weight: 600; + box-shadow: 0 12rpx 20rpx rgba(255, 77, 79, 0.25); +} + +.pay-btn:disabled { + opacity: 0.6; +} diff --git a/pages/shopDetail/index.vue b/pages/shopDetail/index.vue index 1d7ae71..be0e040 100644 --- a/pages/shopDetail/index.vue +++ b/pages/shopDetail/index.vue @@ -30,7 +30,7 @@ {{ productInfo.name || '玫瑰香水盲盒' }} - {{ productInfo.description.sub_title || '玫瑰香水盲盒' }} + @@ -51,9 +51,8 @@ - - + {{ productInfo.description.sub_title || + '经典玫瑰香调,优雅女神范,持久留香8小时。采用法国进口玫瑰精油,层次丰富,前调清新,中调浓郁,后调温暖。适合日常使用,也是送礼的绝佳选择。' }} @@ -139,6 +138,9 @@ + + + 香调层次 @@ -393,6 +395,7 @@ export default { this.productInfo.scent_level = JSON.parse(productInfo.scent_level); this.productInfo.attr = JSON.parse(productInfo.attr); this.productInfo.description = parseDescription(productInfo.description); + console.log(this.productInfo.description) // 处理SKU列表 if (productInfo.skus && Array.isArray(productInfo.skus) && productInfo.skus.length > 0) { this.skuList = productInfo.skus; diff --git a/pages/shoppingCart/index.vue b/pages/shoppingCart/index.vue index 8b2e7c9..2363765 100644 --- a/pages/shoppingCart/index.vue +++ b/pages/shoppingCart/index.vue @@ -9,7 +9,7 @@ - + {{ item.product_name || item.name }} @@ -252,7 +252,8 @@ export default { product_id: item.product_id, sku_id: item.sku_id, quantity: item.quantity || item.count, - price: item.price || item.sku_price + price: item.price || item.sku_price, + product_image_url: item.product_image_url })); // 跳转到订单页面,根据实际路由调整 diff --git a/tools/format.js b/tools/format.js index b6ba4ca..6b07fde 100644 --- a/tools/format.js +++ b/tools/format.js @@ -19,11 +19,11 @@ export function parseDescription(value) { try { const parsed = JSON.parse(value) if (typeof parsed === 'string') { - return { details: parsed, sub_title: '' } + return { details: parsed, sub_title: parsed } } return { ...fallback, ...(parsed || {}) } } catch (error) { - return { details: value, sub_title: '' } + return { details: value, sub_title: value } } } return { ...fallback, ...value }