增加积分商城分享

This commit is contained in:
2026-01-21 16:42:18 +08:00
parent 8f1b21bf00
commit 20a54c3bd9
5 changed files with 209 additions and 134 deletions

View File

@@ -8,7 +8,7 @@
</template>
<template v-else>
<view @click="prveImg(item.goodsImageUrl)">
<image class="top-img" :src="item.goodsImageUrl" mode="aspectFill" ></image>
<image class="top-img" :src="item.goodsImageUrl" mode="aspectFill"></image>
</view>
</template>
<view class="sku">
@@ -55,10 +55,10 @@
<view style="height: 140px"></view>
<view class="fixed-bottom u-flex u-row-center">
<view v-if="isCanExchange" class="btn" @click="exchangeClick" >
<view v-if="isCanExchange" class="btn" @click="exchangeClick">
{{returnBtmText}}
</view>
<view class="btn gray" v-else >
<view class="btn gray" v-else>
{{returnBtmText}}
</view>
</view>
@@ -84,7 +84,7 @@
</view>
<view class="goods-info">
<view class="u-flex">
<image class="cover" v-if="item.goodsCategory!='优惠券'" :src="item.goodsImageUrl"></image>
<view v-else class="cover bg-fff">
<couponIcon :item="item.couponInfo" typeKey="couponType" />
@@ -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)
})
</script>
@@ -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%;
}
</style>