增加积分商城分享
This commit is contained in:
@@ -20,6 +20,12 @@ export const pointGoodsPage = (data) => {
|
|||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export const pointsGoods = (data) => {
|
||||||
|
return request({
|
||||||
|
url: url + '/user/pointGoods/'+data.id,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export const exchange = (data) => {
|
export const exchange = (data) => {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<view @click="prveImg(item.goodsImageUrl)">
|
<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>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<view class="sku">
|
<view class="sku">
|
||||||
@@ -55,10 +55,10 @@
|
|||||||
|
|
||||||
<view style="height: 140px"></view>
|
<view style="height: 140px"></view>
|
||||||
<view class="fixed-bottom u-flex u-row-center">
|
<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}}
|
{{returnBtmText}}
|
||||||
</view>
|
</view>
|
||||||
<view class="btn gray" v-else >
|
<view class="btn gray" v-else>
|
||||||
{{returnBtmText}}
|
{{returnBtmText}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -125,6 +125,11 @@
|
|||||||
} from '@/utils/uniapp.js'
|
} from '@/utils/uniapp.js'
|
||||||
import modal from "@/scoreShop/components/modal.vue";
|
import modal from "@/scoreShop/components/modal.vue";
|
||||||
import * as pointGoodsApi from "@/common/api/order/pointGoods.js";
|
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 couponIcon from "@/components/coupon-icon/index";
|
||||||
import {
|
import {
|
||||||
pay
|
pay
|
||||||
@@ -136,9 +141,9 @@
|
|||||||
show: false,
|
show: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
function prveImg(url){
|
function prveImg(url) {
|
||||||
uni.previewImage({
|
uni.previewImage({
|
||||||
urls:[url]
|
urls: [url]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,16 +309,63 @@
|
|||||||
return `单人兑换已达上限`
|
return `单人兑换已达上限`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
onLoad((opt) => {
|
async function getGoods() {
|
||||||
const exchange_goods = uni.getStorageSync('exchange_goods')
|
const res = await pointGoodsApi.pointsGoods({
|
||||||
if (exchange_goods.goodsDescription) {
|
id: options.id
|
||||||
exchange_goods.goodsDescription = JSON.parse(exchange_goods.goodsDescription)
|
})
|
||||||
|
if (res.goodsDescription) {
|
||||||
|
res.goodsDescription = JSON.parse(res.goodsDescription)
|
||||||
} else {
|
} else {
|
||||||
exchange_goods.goodsDescription = []
|
res.goodsDescription = []
|
||||||
}
|
}
|
||||||
const pointsUserData = uni.getStorageSync('pointsUser')
|
res.couponInfo=res.couponInfo||{}
|
||||||
Object.assign(item, exchange_goods)
|
|
||||||
Object.assign(pointsUser, pointsUserData)
|
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>
|
</script>
|
||||||
|
|
||||||
@@ -463,7 +515,8 @@
|
|||||||
height: 184rpx;
|
height: 184rpx;
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
background: #d9d9d9;
|
background: #d9d9d9;
|
||||||
&.bg-fff{
|
|
||||||
|
&.bg-fff {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -487,7 +540,8 @@
|
|||||||
font-size: 700;
|
font-size: 700;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.w-full{
|
|
||||||
|
.w-full {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
function toDetail(item) {
|
function toDetail(item) {
|
||||||
uni.setStorageSync('exchange_goods', item)
|
uni.setStorageSync('exchange_goods', item)
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/scoreShop/detail/index?id=' + item.id,
|
url: '/scoreShop/detail/index?id=' + item.id+'&shopId='+item.shopId,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,11 +72,20 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function back() {
|
function back() {
|
||||||
|
const pages = getCurrentPages();
|
||||||
|
if(pages.length<2){
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/index/index'
|
||||||
|
})
|
||||||
|
}else{
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
delta: 1,
|
delta: 1,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// function exchange(item) {
|
// function exchange(item) {
|
||||||
// pointGoodsApi.exchange({
|
// pointGoodsApi.exchange({
|
||||||
// pointsGoodsId: item.id,
|
// pointsGoodsId: item.id,
|
||||||
|
|||||||
@@ -1,12 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="min-page bg-f7 u-font-28 color-333">
|
<view class="min-page bg-f7 u-font-28 color-333">
|
||||||
<up-navbar
|
<up-navbar title="兑换成功" bgColor="transparent" leftIconColor="#333" @leftClick="back()"
|
||||||
title="兑换成功"
|
titleStyle="color:#333"></up-navbar>
|
||||||
bgColor="transparent"
|
|
||||||
leftIconColor="#333"
|
|
||||||
@leftClick="back()"
|
|
||||||
titleStyle="color:#333"
|
|
||||||
></up-navbar>
|
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="bg" :style="{ backgroundImage: `url(${imgs.bg})` }">
|
<view class="bg" :style="{ backgroundImage: `url(${imgs.bg})` }">
|
||||||
<image :src="imgs.success" class="success"></image>
|
<image :src="imgs.success" class="success"></image>
|
||||||
@@ -50,36 +45,43 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
const imgs = {
|
||||||
|
|
||||||
const imgs = {
|
|
||||||
bg: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/b625560a5b75418c9e643841f8674a0c.png",
|
bg: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/b625560a5b75418c9e643841f8674a0c.png",
|
||||||
success:
|
success: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/c2f0865efb444de58ff0d8bb3a51d300.png",
|
||||||
"https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/c2f0865efb444de58ff0d8bb3a51d300.png",
|
};
|
||||||
};
|
|
||||||
function back() {
|
function back() {
|
||||||
uni.navigateBack();
|
const pages = getCurrentPages();
|
||||||
}
|
if(pages.length<2){
|
||||||
function lookOrder() {
|
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url:'/scoreShop/order/index?shopId='+item.shopId
|
url: '/scoreShop/index/index?shopId=' + item.shopId
|
||||||
})
|
})
|
||||||
}
|
}else{
|
||||||
const item=reactive({
|
uni.navigateBack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
})
|
function lookOrder() {
|
||||||
onLoad(opt=>{
|
uni.redirectTo({
|
||||||
const exchange_goods_success_data=uni.getStorageSync('exchange_goods_success')
|
url: '/scoreShop/order/index?shopId=' + item.shopId
|
||||||
Object.assign(item,exchange_goods_success_data)
|
})
|
||||||
|
}
|
||||||
|
const item = reactive({
|
||||||
|
|
||||||
})
|
})
|
||||||
|
onLoad(opt => {
|
||||||
|
const exchange_goods_success_data = uni.getStorageSync('exchange_goods_success')
|
||||||
|
Object.assign(item, exchange_goods_success_data)
|
||||||
|
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.content {
|
.content {
|
||||||
background: linear-gradient(180deg, #f5cd82 0%, rgba(247, 219, 165, 0) 100%);
|
background: linear-gradient(180deg, #f5cd82 0%, rgba(247, 219, 165, 0) 100%);
|
||||||
height: 670rpx;
|
height: 670rpx;
|
||||||
$color: #9c571f;
|
$color: #9c571f;
|
||||||
|
|
||||||
.bg {
|
.bg {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 586rpx;
|
height: 586rpx;
|
||||||
@@ -96,12 +98,14 @@ onLoad(opt=>{
|
|||||||
height: 206rpx;
|
height: 206rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.info {
|
.info {
|
||||||
padding-left: 174rpx;
|
padding-left: 174rpx;
|
||||||
padding-right: 32rpx;
|
padding-right: 32rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.bottom {
|
|
||||||
|
.bottom {
|
||||||
gap: 48rpx;
|
gap: 48rpx;
|
||||||
margin-top: 44rpx;
|
margin-top: 44rpx;
|
||||||
|
|
||||||
@@ -110,15 +114,17 @@ onLoad(opt=>{
|
|||||||
border-radius: 100rpx;
|
border-radius: 100rpx;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
|
|
||||||
&.back {
|
&.back {
|
||||||
border-color: $my-main-color;
|
border-color: $my-main-color;
|
||||||
color: $my-main-color;
|
color: $my-main-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.look {
|
&.look {
|
||||||
background-color: $my-main-color;
|
background-color: $my-main-color;
|
||||||
border-color: $my-main-color;
|
border-color: $my-main-color;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
Reference in New Issue
Block a user