From 20a54c3bd97255b08e9dfeb845518b0f32727b2a Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Wed, 21 Jan 2026 16:42:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=A7=AF=E5=88=86=E5=95=86?= =?UTF-8?q?=E5=9F=8E=E5=88=86=E4=BA=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/api/order/pointGoods.js | 6 + scoreShop/detail/index.vue | 90 +++++++-- scoreShop/index/components/goods-list.vue | 2 +- scoreShop/index/index.vue | 15 +- scoreShop/success/index.vue | 230 +++++++++++----------- 5 files changed, 209 insertions(+), 134 deletions(-) diff --git a/common/api/order/pointGoods.js b/common/api/order/pointGoods.js index 8dca627..38d3c79 100644 --- a/common/api/order/pointGoods.js +++ b/common/api/order/pointGoods.js @@ -20,6 +20,12 @@ export const pointGoodsPage = (data) => { data: data }) } +export const pointsGoods = (data) => { + return request({ + url: url + '/user/pointGoods/'+data.id, + method: 'get', + }) +} export const exchange = (data) => { diff --git a/scoreShop/detail/index.vue b/scoreShop/detail/index.vue index 3ad9b36..74690f3 100644 --- a/scoreShop/detail/index.vue +++ b/scoreShop/detail/index.vue @@ -8,7 +8,7 @@ @@ -55,10 +55,10 @@ - + {{returnBtmText}} - + {{returnBtmText}} @@ -84,7 +84,7 @@ - + @@ -125,6 +125,11 @@ } from '@/utils/uniapp.js' import modal from "@/scoreShop/components/modal.vue"; import * as pointGoodsApi from "@/common/api/order/pointGoods.js"; + import { + userPoints + } from "@/common/api/market/points.js"; + + import couponIcon from "@/components/coupon-icon/index"; import { pay @@ -135,10 +140,10 @@ const modalData = reactive({ show: false, }); - - function prveImg(url){ + + function prveImg(url) { uni.previewImage({ - urls:[url] + urls: [url] }) } @@ -304,16 +309,63 @@ return `单人兑换已达上限` } }) - onLoad((opt) => { - const exchange_goods = uni.getStorageSync('exchange_goods') - if (exchange_goods.goodsDescription) { - exchange_goods.goodsDescription = JSON.parse(exchange_goods.goodsDescription) + async function getGoods() { + const res = await pointGoodsApi.pointsGoods({ + id: options.id + }) + if (res.goodsDescription) { + res.goodsDescription = JSON.parse(res.goodsDescription) } else { - exchange_goods.goodsDescription = [] + res.goodsDescription = [] } - const pointsUserData = uni.getStorageSync('pointsUser') - Object.assign(item, exchange_goods) - Object.assign(pointsUser, pointsUserData) + res.couponInfo=res.couponInfo||{} + + Object.assign(item, res) + } + async function getPointUser() { + const res = await userPoints({ + shopUserId: uni.cache.get('shopUserInfo').id || '' + }) + Object.assign(pointsUser, res.pointsUser) + } + async function init() { + await getGoods() + await getPointUser() + } + + import { + shareMixin, + handleMixinOnLoad,wxShare,returnQuery + } from '@/utils/share.js' + // defineOptions({ + // mixins: [shareMixin], + // }); + + onShareAppMessage(async(res)=>{ + const query=await returnQuery() + return wxShare({ + ...res, + title:item.goodsName, + path:'/scoreShop/detail/index'+'?'+query, + query, + imageUrl:item.goodsImageUrl||'' + }) + }) + + const options = reactive({}) + onLoad(async (opt) => { + Object.assign(options, opt) + await handleMixinOnLoad(opt) + await init() + // const exchange_goods = uni.getStorageSync('exchange_goods') + // if (exchange_goods.goodsDescription) { + // exchange_goods.goodsDescription = JSON.parse(exchange_goods.goodsDescription) + // } else { + // exchange_goods.goodsDescription = [] + // } + // const pointsUserData = uni.getStorageSync('pointsUser') + // Object.assign(item, exchange_goods) + // Object.assign(pointsUser, pointsUserData) }) @@ -463,11 +515,12 @@ height: 184rpx; border-radius: 16rpx; background: #d9d9d9; - &.bg-fff{ + + &.bg-fff { background-color: #fff; } } - + } .bottom { @@ -487,7 +540,8 @@ font-size: 700; } } - .w-full{ + + .w-full { width: 100%; } \ No newline at end of file diff --git a/scoreShop/index/components/goods-list.vue b/scoreShop/index/components/goods-list.vue index 08c8b13..3ab17f1 100644 --- a/scoreShop/index/components/goods-list.vue +++ b/scoreShop/index/components/goods-list.vue @@ -74,7 +74,7 @@ function toDetail(item) { uni.setStorageSync('exchange_goods', item) uni.navigateTo({ - url: '/scoreShop/detail/index?id=' + item.id, + url: '/scoreShop/detail/index?id=' + item.id+'&shopId='+item.shopId, }) } diff --git a/scoreShop/index/index.vue b/scoreShop/index/index.vue index 62348be..05b132f 100644 --- a/scoreShop/index/index.vue +++ b/scoreShop/index/index.vue @@ -72,9 +72,18 @@ } function back() { - uni.navigateBack({ - delta: 1, - }); + const pages = getCurrentPages(); + if(pages.length<2){ + uni.switchTab({ + url: '/pages/index/index' + }) + }else{ + uni.navigateBack({ + delta: 1, + }); + } + + } // function exchange(item) { diff --git a/scoreShop/success/index.vue b/scoreShop/success/index.vue index 1181482..d167a48 100644 --- a/scoreShop/success/index.vue +++ b/scoreShop/success/index.vue @@ -1,124 +1,130 @@ + .success { + width: 310rpx; + height: 206rpx; + } + } + + .info { + padding-left: 174rpx; + padding-right: 32rpx; + } + } + + .bottom { + gap: 48rpx; + margin-top: 44rpx; + + .btn { + padding: 14rpx 76rpx; + border-radius: 100rpx; + font-size: 32rpx; + border: 1px solid transparent; + + &.back { + border-color: $my-main-color; + color: $my-main-color; + } + + &.look { + background-color: $my-main-color; + border-color: $my-main-color; + color: #fff; + } + } + } + \ No newline at end of file