From bb2830730df1b10f92030bd24bb16db3df296860 Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Thu, 11 Dec 2025 11:34:06 +0800
Subject: [PATCH] =?UTF-8?q?=E7=A7=AF=E5=88=86=E5=95=86=E5=9F=8E=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
common/api/order/pointGoods.js | 8 +
scoreShop/detail/index.vue | 92 ++++-
scoreShop/index/components/goods-list.vue | 6 +-
scoreShop/order/components/order-list.vue | 17 +-
scoreShop/order/detail.vue | 417 ++++++++++++++--------
scoreShop/order/index.vue | 2 +-
6 files changed, 372 insertions(+), 170 deletions(-)
diff --git a/common/api/order/pointGoods.js b/common/api/order/pointGoods.js
index d480e46..f5d9a5e 100644
--- a/common/api/order/pointGoods.js
+++ b/common/api/order/pointGoods.js
@@ -55,4 +55,12 @@ export const recordPage = (data) => {
method: 'get',
data: data
})
+}
+
+export const recordOne = (data) => {
+ return request({
+ url: url + '/user/pointGoods/record/one',
+ method: 'get',
+ data: data
+ })
}
\ No newline at end of file
diff --git a/scoreShop/detail/index.vue b/scoreShop/detail/index.vue
index 3d680a4..5c95d37 100644
--- a/scoreShop/detail/index.vue
+++ b/scoreShop/detail/index.vue
@@ -46,14 +46,17 @@
商品详情
-
+
- 立即兑换
+
+ {{returnBtmText}}
+
@@ -76,27 +79,27 @@
-
+
- 这里是商品名称
- 8000积分+9.99元
+ {{item.goodsName}}
+ {{item.requiredPoints}}积分+{{item.extraPrice}}元
X1
-
+
优惠券为虚拟发放,一旦兑换不支持退款,请悉知
- 合计 8000积分 + ¥9.99
+ 合计 {{item.requiredPoints}}积分 + ¥{{item.extraPrice}}
- 确认兑换
+ 确认兑换
@@ -113,6 +116,9 @@
} from '@/utils/uniapp.js'
import modal from "@/scoreShop/components/modal.vue";
import * as pointGoodsApi from "@/common/api/order/pointGoods.js";
+ import {
+ pay
+ } from '@/utils/pay.js'
const imgs = {
bg: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/9fd6a3ad2b384f6cb4e88ed6b77bd334.png",
};
@@ -125,6 +131,10 @@
});
function exchangeClick() {
+ if (item.extraPrice > 0) {
+ popupData.show = true
+ return
+ }
modalData.show = true;
}
@@ -132,7 +142,45 @@
// modalData.show = false;
exchange()
}
+ async function payExchange() {
+ uni.showLoading({
+ title: '兑换中……'
+ })
+ const openId = await getOpenId()
+ uni.hideLoading()
+ if (openId) {
+ pointGoodsApi.exchange({
+ pointsGoodsId: item.id,
+ shopId: item.shopId,
+ number: 1,
+ price: item.extraPrice,
+ openId
+ }).then(orderRes => {
+ popupData.show = false;
+ pay(orderRes.payInfo).then(res => {
+ console.log(res)
+ if (res) {
+ uni.setStorageSync('exchange_goods_success', orderRes.goodsRecord)
+ uni.redirectTo({
+ url: '/scoreShop/success/index'
+ })
+ } else {
+ uni.showToast({
+ title: '兑换失败',
+ icon: 'none'
+ })
+ }
+ })
+
+ })
+ } else {
+ uni.showToast({
+ title: '鉴权失败,兑换失败',
+ icon: 'none'
+ })
+ }
+ }
async function exchange() {
uni.showLoading({
title: '兑换中……'
@@ -148,12 +196,12 @@
openId
}).then(res => {
modalData.show = false;
- if(res){
- uni.setStorageSync('exchange_goods_success',res)
+ if (res) {
+ uni.setStorageSync('exchange_goods_success', res)
uni.redirectTo({
- url:'/scoreShop/success/index'
+ url: '/scoreShop/success/index'
})
- }else{
+ } else {
uni.showToast({
title: '兑换失败',
icon: 'none'
@@ -219,11 +267,27 @@
if (item.quantity <= 0) {
return false
}
- if(item.limitQuota&&item.boughtCount>=item.limitQuota){
+ if (item.limitQuota && item.boughtCount >= item.limitQuota) {
return false
}
return true
})
+
+ const returnBtmText = computed(() => {
+ if (isCanExchange.value) {
+ return '立即兑换'
+ }
+ if (pointsUser.pointBalance < item.requiredPoints) {
+ const num = item.requiredPoints - pointsUser.pointBalance
+ return `积分不足,还差${num}积分`
+ }
+ if (item.quantity <= 0) {
+ return `库存不足`
+ }
+ if (item.limitQuota && item.boughtCount >= item.limitQuota) {
+ return `单人兑换已达上限`
+ }
+ })
onLoad((opt) => {
const exchange_goods = uni.getStorageSync('exchange_goods')
if (exchange_goods.goodsDescription) {
@@ -342,7 +406,7 @@
background-color: #fff;
bottom: 0;
z-index: 10;
-
+
.btn {
padding: 16rpx 62rpx;
diff --git a/scoreShop/index/components/goods-list.vue b/scoreShop/index/components/goods-list.vue
index d85b8c7..660a54e 100644
--- a/scoreShop/index/components/goods-list.vue
+++ b/scoreShop/index/components/goods-list.vue
@@ -25,7 +25,7 @@
-
+
@@ -37,7 +37,7 @@
限购{{item.limitQuota}}份
- 兑换
+ 兑换
已兑完
@@ -65,7 +65,7 @@
});
function toDetail(item) {
- if (!canExchange(item)) {
+ if (item.quantity<=0) {
return
}
uni.setStorageSync('exchange_goods', item)
diff --git a/scoreShop/order/components/order-list.vue b/scoreShop/order/components/order-list.vue
index 94cefbc..15b28fc 100644
--- a/scoreShop/order/components/order-list.vue
+++ b/scoreShop/order/components/order-list.vue
@@ -1,6 +1,6 @@
-
+
{{item.createTime}}
{{item.status}}
@@ -16,9 +16,9 @@
- 查看券码
- 申请退款
- 取消退款
+ 查看券码
+ 申请退款
+ 取消退款
@@ -39,12 +39,19 @@
emits("lookCode", item);
};
- function tuikuan(item) {
+ function refund(item) {
emits("refund", item);
}
function cancelRefund(item) {
emits("cancelRefund", item);
}
+
+ function toDetail(item){
+ uni.setStorageSync('points_order_detail',item)
+ uni.navigateTo({
+ url:'/scoreShop/order/detail'
+ })
+ }
function returnStatusClass(item) {
if (item.status == '已完成' || item.status == '已退款') {
diff --git a/scoreShop/order/detail.vue b/scoreShop/order/detail.vue
index a9ca390..aac4b50 100644
--- a/scoreShop/order/detail.vue
+++ b/scoreShop/order/detail.vue
@@ -1,156 +1,279 @@
-
-
-
-
-
- 这里是商品名称
-
- 8000积分
- 已完成
-
- X1
-
-
-
-
-
-
-
-
- {{ qrcode }}
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+ {{item.pointsGoodsName}}
+
+ {{item.spendPoints}}积分
+ {{item.status}}
+
+ X{{item.number}}
+
+
+
+
+
+
+
+
+ {{ qrcode }}
+
+
+
+
+
+
-
- 领取方式
- 需前往店铺自行兑换领取
-
-
+
+ 领取方式
+ 需前往店铺自行兑换领取
+ 系统发放
+
+
-
-
- 兑换商品:
- 这里是商品名称
-
-
- 兑换数量:
- 1份
-
-
- 消耗积分:
- 800
-
-
- 支付金额:
- 9.99元
-
-
- 下单时间:
- 2025-12-3 17:19:32
-
-
- 核销时间:
- 2025-12-04 01:13:14
-
-
- 订单号:
- DH202511300001
-
-
+
+
+ 兑换商品:
+ {{item.pointsGoodsName}}
+
+
+ 兑换数量:
+ {{item.number}}份
+
+
+ 消耗积分:
+ {{item.spendPoints}}
+
+
+ 支付金额:
+ {{item.extraPaymentAmount}}元
+
+
+ 下单时间:
+ {{item.createTime}}
+
+
+ 核销时间:
+ {{item.checkoutTime||''}}
+
+
+ 订单号:
+ {{item.orderNo}}
+
+
-
- 申请退款
- 取消退款
-
-
+
+ 申请退款
+ 取消退款
+
+
+ .min-page {
+ padding: 28rpx;
+ }
+
+ .top {
+ padding: 32rpx 24rpx;
+ background: #fff;
+
+ .color1 {
+ color: #9c571f;
+ }
+
+ .status {
+ padding: 8rpx 18rpx;
+ border-radius: 8rpx;
+ border: 2rpx solid transparent;
+
+ &.success {
+ background: rgba(123, 209, 54, 0.12);
+ border-color: #7bd136;
+ color: #7bd136;
+ }
+
+ &.gray {
+ background: #9999991f;
+ border-color: #999;
+ color: #999;
+ }
+
+ &.error {
+ background: #ff1c1c2e;
+ border-color: #ff1c1c;
+ color: #ff1c1c;
+ }
+ }
+ }
+
+ .copy {
+ width: 28rpx;
+ height: 28rpx;
+ }
+
+ .bottom {
+ background: #fff;
+ border-radius: 32rpx;
+ padding: 16rpx 28rpx;
+ margin-top: 48rpx;
+
+ .item {
+ padding: 16rpx 0;
+ }
+ }
+
+ .btns {
+ margin-top: 66rpx;
+ display: flex;
+ justify-content: center;
+ gap: 48rpx;
+
+ .btn {
+ border: 2rpx solid transparent;
+ border-radius: 100rpx;
+ background: #fff;
+ padding: 14rpx 76rpx;
+ font-size: 32rpx;
+
+ &.success {
+ background-color: #e8ad7b;
+ border-color: #e8ad7b;
+ color: #fff;
+ }
+
+ &.cancel {
+ border-color: #e8ad7b;
+ color: #e8ad7b;
+ }
+ }
+ }
+
\ No newline at end of file
diff --git a/scoreShop/order/index.vue b/scoreShop/order/index.vue
index 54737df..1598c57 100644
--- a/scoreShop/order/index.vue
+++ b/scoreShop/order/index.vue
@@ -171,7 +171,7 @@
function getList() {
const status = tabs.list.find(v => v.value == tabs.sel)
pointGoodsApi.recordPage({
- ...query,
+ ...query,status:tabs.sel?status.name:''
}).then(res => {
const newList = res.records
if (query.page == 1) {