Compare commits
44 Commits
ac7af51a92
...
prod
| Author | SHA1 | Date | |
|---|---|---|---|
| 8b5d81c6c8 | |||
| 189459845c | |||
| c0e277fd8f | |||
| 37fe706d6a | |||
| 4b1be95bc0 | |||
| 13ae818fd4 | |||
| 93d3f9196c | |||
| ee34d94ca0 | |||
| cb139acf13 | |||
| 4eb9eb27e3 | |||
| 8810c218b3 | |||
| dc3174ef13 | |||
| 94be2739af | |||
| 9037e205a0 | |||
| 2afc2f9fab | |||
| 46105da573 | |||
| 20a54c3bd9 | |||
| a0cc43e118 | |||
| 8f1b21bf00 | |||
| 654ed39854 | |||
| 67ae138033 | |||
| c60a2115ea | |||
| 1ed28e2913 | |||
| a125995808 | |||
| 0444b68cb2 | |||
| 32c60b4f83 | |||
| 373be0527f | |||
| 402f85d61f | |||
| 575e6d22b0 | |||
| dfc67e12c5 | |||
| 42fc09815b | |||
| 3064007137 | |||
| d8c2aef83e | |||
| 7c143efe30 | |||
| 362f3cee96 | |||
| ca53618004 | |||
| cbe27a43de | |||
| 5fcbba0cb4 | |||
| 0944635c69 | |||
| 067025f532 | |||
| 8d917d49ed | |||
| bcc44a0886 | |||
| 811abf935c | |||
| bde30fa70c |
1
App.vue
1
App.vue
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import {
|
||||||
useCartsStore
|
useCartsStore
|
||||||
|
|||||||
@@ -3,12 +3,15 @@ import request from '@/common/api/request.js'
|
|||||||
const url = '/account'
|
const url = '/account'
|
||||||
//根据经纬度获取信息
|
//根据经纬度获取信息
|
||||||
export const APIgeocodelocation = (data) => {
|
export const APIgeocodelocation = (data) => {
|
||||||
return request({
|
return new Promise((resove, reject) => {
|
||||||
url: url + '/user/geo/geocode',
|
resove(null)
|
||||||
method: 'get',
|
|
||||||
data: data,
|
|
||||||
toast: false
|
|
||||||
})
|
})
|
||||||
|
// return request({
|
||||||
|
// url: url + '/user/geo/geocode',
|
||||||
|
// method: 'get',
|
||||||
|
// data: data,
|
||||||
|
// toast: false
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
//登录
|
//登录
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ export const pay = (data) => {
|
|||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
platformType = "WX";
|
platformType = "WX";
|
||||||
platformType = "wechat";
|
platformType = "wechat";
|
||||||
payType = "wechatPay";
|
payType = "WECHAT";
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef MP-ALIPAY
|
// #ifdef MP-ALIPAY
|
||||||
platformType = "alipay";
|
platformType = "alipay";
|
||||||
payType = "aliPay";
|
payType = "ALIPAY";
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
@@ -136,6 +136,15 @@ export const getInviteCode = (data) => {
|
|||||||
data: data,
|
data: data,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
export const autoGetInviteCode = (data) => {
|
||||||
|
return request({
|
||||||
|
url: prveUrl + "/user/distribution/autoGetInviteCode",
|
||||||
|
method: "get",
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 获取配置
|
// 获取配置
|
||||||
export const getConfig = (data) => {
|
export const getConfig = (data) => {
|
||||||
@@ -147,3 +156,20 @@ export const getConfig = (data) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 分销员中心-无感-绑定邀请人
|
||||||
|
export const autoBindInviteUser = (data) => {
|
||||||
|
return request({
|
||||||
|
url: prveUrl + "/user/distribution/autoBindInviteUser",
|
||||||
|
method: "post",
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 全民股东界面-进入过标识
|
||||||
|
export const distributionEditIn = (data) => {
|
||||||
|
return request({
|
||||||
|
url: prveUrl + "/user/distribution/editIn",
|
||||||
|
method: "get",
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
// 引入 request 文件
|
// 引入 request 文件
|
||||||
import request from '@/common/api/request.js'
|
import request from '@/common/api/request.js'
|
||||||
import {prveUrl} from './config.js'
|
import {
|
||||||
|
prveUrl
|
||||||
|
} from './config.js'
|
||||||
|
|
||||||
export const consumeDiscount = (data) => {
|
export const consumeDiscount = (data) => {
|
||||||
return request({
|
return request({
|
||||||
@@ -16,3 +18,11 @@ export const homeData = (data) => {
|
|||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 清除所有分销绑定关系
|
||||||
|
export const distributionClear = (data) => {
|
||||||
|
return request({
|
||||||
|
url: prveUrl + '/user/distribution/clean',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -10,11 +10,11 @@ let platformType = '';
|
|||||||
let payType = '';
|
let payType = '';
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
platformType = 'wechat'
|
platformType = 'wechat'
|
||||||
payType = 'wechatPay'
|
payType = 'WECHAT'
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef MP-ALIPAY
|
// #ifdef MP-ALIPAY
|
||||||
platformType = 'alipay'
|
platformType = 'alipay'
|
||||||
payType = 'aliPay'
|
payType = 'ALIPAY'
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
export const getPackage = (data) => {
|
export const getPackage = (data) => {
|
||||||
|
|||||||
26
common/api/market/share.js
Normal file
26
common/api/market/share.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// 引入 request 文件
|
||||||
|
import request from "@/common/api/request.js";
|
||||||
|
import { prveUrl } from "./config.js";
|
||||||
|
|
||||||
|
export const carousel = (data) => {
|
||||||
|
return request({
|
||||||
|
url: prveUrl + "/user/carousel",
|
||||||
|
method: "get",
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
export const shareClaim = (data) => {
|
||||||
|
return request({
|
||||||
|
url: prveUrl + "/user/shareClaim",
|
||||||
|
method: "POST",
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
export const shareConfig = (data) => {
|
||||||
|
return request({
|
||||||
|
url: prveUrl + "/user/share",
|
||||||
|
method: "get",
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
@@ -6,11 +6,11 @@ let platformType = '';
|
|||||||
let payType='';
|
let payType='';
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
platformType = 'wechat'
|
platformType = 'wechat'
|
||||||
payType='wechatPay'
|
payType='WECHAT'
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef MP-ALIPAY
|
// #ifdef MP-ALIPAY
|
||||||
platformType = 'alipay'
|
platformType = 'alipay'
|
||||||
payType='aliPay'
|
payType='ALIPAY'
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
export const warePage = (data) => {
|
export const warePage = (data) => {
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ let platformType = '';
|
|||||||
let payType='';
|
let payType='';
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
platformType = 'wechat'
|
platformType = 'wechat'
|
||||||
payType='wechatPay'
|
payType='WECHAT'
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef MP-ALIPAY
|
// #ifdef MP-ALIPAY
|
||||||
platformType = 'alipay'
|
platformType = 'alipay'
|
||||||
payType='aliPay'
|
payType='ALIPAY'
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
//订单列表
|
//订单列表
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ let platformType = '';
|
|||||||
let payType='';
|
let payType='';
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
platformType = 'wechat'
|
platformType = 'wechat'
|
||||||
payType='wechatPay'
|
payType='WECHAT'
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef MP-ALIPAY
|
// #ifdef MP-ALIPAY
|
||||||
platformType = 'alipay'
|
platformType = 'alipay'
|
||||||
payType='aliPay'
|
payType='ALIPAY'
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
export const pointGoodsPage = (data) => {
|
export const pointGoodsPage = (data) => {
|
||||||
@@ -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) => {
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ export default async (params) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
uni.cache.set('token', 'b61c8b0f1c9d47ad924e33c48b496ce6')
|
uni.cache.set('token', '1b5e8baf0cc1492a858a208f113d0971')
|
||||||
uni.cache.set('userInfo',{"acQrcodeValidTime":"2025-11-17 17:57:16","alipayOpenId":"","birthDay":"2025-10-17","createTime":"2024-07-06 11:30:16","distributionAmount":0,"headImg":"https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132","id":"36434","idCard":"612401199810058031","isAc":0,"lastLoginTime":"2025-12-25 11:41:15","nickName":"微信用户","password":"","payPwd":"e10adc3949ba59abbe56e057f20f883e","phone":"18049104914","realName":"叶明飞","sex":1,"status":1,"updateTime":"2025-12-25 09:41:58","usePayPwd":0,"wechatAcOpenId":"1111","wechatAcQrcode":"","wechatOpenId":"or1l86yipGvwyfPhrKIAcQuSfAV8"})
|
uni.cache.set('userInfo',{"acQrcodeValidTime":"2026-01-13 13:35:59","alipayOpenId":"","birthDay":"2025-12-25","createTime":"2024-03-13 10:56:40","distributionAmount":0,"headImg":"https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132","id":"36689","idCard":"","isAc":0,"lastLoginTime":"2025-12-26 10:01:12","nickName":"微信用户","password":"","payPwd":"e10adc3949ba59abbe56e057f20f883e","phone":"18049104914","realName":"","sex":1,"status":1,"updateTime":"2025-12-26 09:59:31","usePayPwd":0,"wechatAcOpenId":"","wechatAcQrcode":"http://weixin.qq.com/q/029s5JtP1xfmJ1g_HDxFco","wechatOpenId":"or1l86yipGvwyfPhrKIAcQuSfAV8"})
|
||||||
// #endif
|
// #endif
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const timeoutDuration = params.timeout || 10000; // 可以通过 params 传入超时时间,默认 10 秒
|
const timeoutDuration = params.timeout || 10000; // 可以通过 params 传入超时时间,默认 10 秒
|
||||||
@@ -52,7 +52,7 @@ export default async (params) => {
|
|||||||
//获取成功
|
//获取成功
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
uni.hideToast();
|
// uni.hideToast();
|
||||||
resolve(res.data ? res.data : true);
|
resolve(res.data ? res.data : true);
|
||||||
} else {
|
} else {
|
||||||
switch (res.code) {
|
switch (res.code) {
|
||||||
@@ -135,7 +135,7 @@ export default async (params) => {
|
|||||||
// 不管成功还是失败都会执行
|
// 不管成功还是失败都会执行
|
||||||
setTimeout((res) => {
|
setTimeout((res) => {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
uni.hideToast();
|
// uni.hideToast();
|
||||||
}, 10000);
|
}, 10000);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
// const debug = process.env.NODE_ENV == 'development' ? true : false;
|
// const debug = process.env.NODE_ENV == 'development' ? true : false;
|
||||||
|
// const debug = false; // false线上 true本地
|
||||||
const debug = true; // false线上 true本地
|
const debug = true; // false线上 true本地
|
||||||
let baseUrl = ''
|
let baseUrl = ''
|
||||||
let baseUrlwws = ''
|
let baseUrlwws = ''
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const version = "100";
|
const version = "100";
|
||||||
const autoRemoveCache = {
|
const autoRemoveCache = {
|
||||||
count: 100000,
|
count: 100000,
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ page,
|
|||||||
image {
|
image {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
.relative{
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
.absolute{
|
.absolute{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<block v-if="limitDiscount && limitDiscount.id" class="limit-price">
|
<block v-if="limitDiscount && limitDiscount.id" >
|
||||||
<text>
|
<text class="limit-price">
|
||||||
{{ returnPrice() }}
|
{{ returnPrice() }}
|
||||||
</text>
|
</text>
|
||||||
</block>
|
</block>
|
||||||
@@ -15,7 +15,6 @@
|
|||||||
{{ cart.memberPrice }}
|
{{ cart.memberPrice }}
|
||||||
</text>
|
</text>
|
||||||
</block>
|
</block>
|
||||||
|
|
||||||
<text v-else class="salePrice">{{ cart.salePrice }}</text>
|
<text v-else class="salePrice">{{ cart.salePrice }}</text>
|
||||||
</text>
|
</text>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ const paymentMethodList = ref([
|
|||||||
name: "微信支付",
|
name: "微信支付",
|
||||||
type: 2,
|
type: 2,
|
||||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png",
|
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png",
|
||||||
payType: "wechatPay",
|
payType: "WECHAT",
|
||||||
},
|
},
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef MP-ALIPAY
|
// #ifdef MP-ALIPAY
|
||||||
|
|||||||
141
components/popup-distribution-group-code.vue
Normal file
141
components/popup-distribution-group-code.vue
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
<!-- 私域引流 -->
|
||||||
|
<template>
|
||||||
|
<u-popup :show="show" mode="center" :safeAreaInsetBottom="false">
|
||||||
|
<view class="new_preview">
|
||||||
|
<view class="header">{{ shopInfo.shopName }}</view>
|
||||||
|
<view class="content">
|
||||||
|
<view class="title">{{ group.title }}</view>
|
||||||
|
<view class="img_wrap">
|
||||||
|
<image class="img" :show-menu-by-longpress="true" :src="group.groupUrl" @click=""></image>
|
||||||
|
</view>
|
||||||
|
<view class="intro">
|
||||||
|
{{ group.content }}
|
||||||
|
</view>
|
||||||
|
<view class="foot">
|
||||||
|
如果长按不能识别,可截图或保存二维码图片至相册,通过微信扫码入群。
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="close" @click="closeHandle">
|
||||||
|
<u-icon name="close" color="#fff" size="14"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
import { ref, onMounted } from 'vue';
|
||||||
|
import { centerConfig,distributionEditIn } from '@/common/api/market/distribution.js';
|
||||||
|
import { checkArrayElementsExist } from '@/utils/util.js';
|
||||||
|
|
||||||
|
const shopInfo = ref('');
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
default: 'home' // 调用的位置 home首页 order支付成功后
|
||||||
|
},
|
||||||
|
group:{
|
||||||
|
type:Object,
|
||||||
|
default:()=>{}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const show = defineModel(false) ;
|
||||||
|
function closeHandle() {
|
||||||
|
const shopUserInfo=uni.cache.get('shopUserInfo')
|
||||||
|
distributionEditIn({
|
||||||
|
shopUserId:shopUserInfo.id
|
||||||
|
})
|
||||||
|
show.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
shopInfo.value = uni.cache.get('shopInfo');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.new_preview {
|
||||||
|
--bg: #3f3b37;
|
||||||
|
--color: #f6dfc4;
|
||||||
|
--borderColor: #f6dfc45b;
|
||||||
|
width: 90vw;
|
||||||
|
background-color: var(--bg);
|
||||||
|
border-radius: 4px;
|
||||||
|
position: relative;
|
||||||
|
.close {
|
||||||
|
--size: 70upx;
|
||||||
|
width: var(--size);
|
||||||
|
height: var(--size);
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: var(--bg);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
position: absolute;
|
||||||
|
bottom: calc(var(--size) * -1 - 20upx);
|
||||||
|
left: 50%;
|
||||||
|
margin-left: calc(var(--size) / 2 * -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 16px;
|
||||||
|
color: var(--color);
|
||||||
|
height: 50px;
|
||||||
|
border-bottom: 1px dashed var(--borderColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
padding-bottom: 14px;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 14px;
|
||||||
|
color: var(--color);
|
||||||
|
height: 50px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.img_wrap {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.img {
|
||||||
|
--size: 220px;
|
||||||
|
width: var(--size);
|
||||||
|
height: var(--size);
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.intro {
|
||||||
|
height: 40px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: var(--color);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.foot {
|
||||||
|
height: 40px;
|
||||||
|
color: var(--borderColor);
|
||||||
|
font-size: 14px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0 14px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
224
components/ymf-components/ymf-share-popup.vue
Normal file
224
components/ymf-components/ymf-share-popup.vue
Normal file
@@ -0,0 +1,224 @@
|
|||||||
|
<template>
|
||||||
|
<view class="ynf-share">
|
||||||
|
<up-popup :show="show" mode="center" bg-color="transparent">
|
||||||
|
<view >
|
||||||
|
<view class="bg" v-if="config.sharerCoupon" :style="returnBg('bg')">
|
||||||
|
<view class="title">邀请奖励</view>
|
||||||
|
<view class="desc">邀请1人,即可得超值优惠券{{config.sharerCouponNum}}张</view>
|
||||||
|
<view class="u-flex u-row-center">
|
||||||
|
<view class="coupon" :style="returnBg('coupon')">
|
||||||
|
<template v-if="config.sharerCoupon.couponType==1">
|
||||||
|
<view class="font-bold text-center color">
|
||||||
|
<text class="fuhao">¥</text>
|
||||||
|
<text>{{config.sharerCoupon.fullAmount}}-{{config.sharerCoupon.discountAmount}}</text>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-if="config.sharerCoupon.couponType==2">
|
||||||
|
<view class="font-bold text-center color">
|
||||||
|
<text>{{config.sharerCoupon.discountNum}}件</text>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-if="config.sharerCoupon.couponType==3">
|
||||||
|
<view class="font-bold text-center color">
|
||||||
|
<text>{{config.sharerCoupon.discountRate/10}}折</text>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-if="config.sharerCoupon.couponType==3">
|
||||||
|
<view class="font-bold text-center color">
|
||||||
|
<text>{{config.sharerCoupon.discountRate/10}}折</text>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-if="config.sharerCoupon.couponType==4">
|
||||||
|
<view class="font-bold text-center color">
|
||||||
|
<text>第二件半价</text>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-if="config.sharerCoupon.couponType==6">
|
||||||
|
<view class="font-bold text-center color">
|
||||||
|
<text>买一送一</text>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<view class="font-bold name">{{config.sharerCoupon.title}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-row-center u-m-t-44">
|
||||||
|
<ymf-share>
|
||||||
|
<view class="share-btn" :style="returnBg('btn')"></view>
|
||||||
|
</ymf-share>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-row-center u-m-t-30">
|
||||||
|
<view class="close-box u-flex u-col-center u-row-center" @click="close">
|
||||||
|
<up-icon name="close" size="36rpx" color="#000" :bold="true"></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</up-popup>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
|
||||||
|
import {
|
||||||
|
shareConfig,
|
||||||
|
} from '@/common/api/market/share.js'
|
||||||
|
import {returnPageTags} from '@/utils/share.js'
|
||||||
|
|
||||||
|
import {
|
||||||
|
productStore
|
||||||
|
} from '@/stores/user.js';
|
||||||
|
|
||||||
|
const userStore = productStore();
|
||||||
|
|
||||||
|
|
||||||
|
const show = defineModel(false)
|
||||||
|
const imgs = {
|
||||||
|
btn: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/14ca8d88516b4739b4020b10d95a33c2.png',
|
||||||
|
coupon: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/4ccffb7cf8414cd19f0a10c6cf45b45b.png',
|
||||||
|
bg: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/1ac6490c4efd4290abe7ca7f6d8e6eb2.png'
|
||||||
|
}
|
||||||
|
|
||||||
|
function returnBg(key) {
|
||||||
|
return {
|
||||||
|
backgroundImage: 'url(' + imgs[key] + ')'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// watch(() => show.value, (newval)=>{
|
||||||
|
// if(newval){
|
||||||
|
// getData()
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
show.value = false
|
||||||
|
}
|
||||||
|
const config = reactive({})
|
||||||
|
async function getData(id) {
|
||||||
|
const pages = getCurrentPages();
|
||||||
|
const currentPage = pages[pages.length - 1];
|
||||||
|
const currentPath = currentPage.route;
|
||||||
|
const currentOptions = currentPage.options;
|
||||||
|
const path = `/${currentPath}`;
|
||||||
|
|
||||||
|
const shopId = id||currentOptions.shopId||uni.cache.get('shopId')
|
||||||
|
// console.log('分享组件挂载完毕:shopId',shopId);
|
||||||
|
if (!shopId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
shareConfig({
|
||||||
|
shopId
|
||||||
|
}).then(res => {
|
||||||
|
// console.log('分享组件挂载完毕:shareConfig',res);
|
||||||
|
// console.log('分享组件挂载完毕:currentOptions',currentOptions);
|
||||||
|
if(res){
|
||||||
|
Object.assign(config,res)
|
||||||
|
const rewardSharePages=res.rewardSharePages.split(',')
|
||||||
|
const pTag = returnPageTags(path)
|
||||||
|
if( pTag&&rewardSharePages.includes(pTag)&¤tOptions.fromUserId&&res.isSharedUserPopup){
|
||||||
|
show.value=true
|
||||||
|
}
|
||||||
|
// if(res.sharedUserCouponId&&res.sharedUserCouponNum){
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(()=>userStore.shopInfo.id,(newval)=>{
|
||||||
|
if(newval){
|
||||||
|
// getData()
|
||||||
|
shareConfig({
|
||||||
|
shopId:newval
|
||||||
|
}).then(res => {
|
||||||
|
if(res){
|
||||||
|
Object.assign(config,res)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
onMounted(() => {
|
||||||
|
console.log('分享组件挂载完毕!');
|
||||||
|
getData()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.bg {
|
||||||
|
width: 710rpx;
|
||||||
|
background-size: cover;
|
||||||
|
min-height: 820rpx;
|
||||||
|
padding-top: 260rpx;
|
||||||
|
background-color: transparent;
|
||||||
|
padding-left: 26rpx;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 74rpx;
|
||||||
|
text-align: center;
|
||||||
|
background-image: linear-gradient(to bottom, #FF7E2D, #FF270E);
|
||||||
|
/* 定义渐变色 */
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
/* Webkit 浏览器前缀 */
|
||||||
|
background-clip: text;
|
||||||
|
/* 标准属性 */
|
||||||
|
color: transparent;
|
||||||
|
/* 使文本透明,显示背景渐变 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.desc {
|
||||||
|
margin-top: 20rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
text-align: center;
|
||||||
|
color: #FF280F;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.coupon {
|
||||||
|
margin-top: 30rpx;
|
||||||
|
width: 436rpx;
|
||||||
|
height: 182rpx;
|
||||||
|
background-size: cover;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 54rpx;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
|
||||||
|
.color {
|
||||||
|
background-image: linear-gradient(to bottom, #FFFFFB, #FFEBB0);
|
||||||
|
/* 定义渐变色 */
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
/* Webkit 浏览器前缀 */
|
||||||
|
background-clip: text;
|
||||||
|
/* 标准属性 */
|
||||||
|
color: transparent;
|
||||||
|
/* 使文本透明,显示背景渐变 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.fuhao {
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.name {
|
||||||
|
font-size: 36rpx;
|
||||||
|
color: #FFFFFB;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-box {
|
||||||
|
width: 74rpx;
|
||||||
|
height: 74rpx;
|
||||||
|
opacity: 0.82;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.share-btn {
|
||||||
|
width: 262rpx;
|
||||||
|
height: 72rpx;
|
||||||
|
background-size: cover;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
38
components/ymf-components/ymf-share.vue
Normal file
38
components/ymf-components/ymf-share.vue
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<template>
|
||||||
|
<view class="relative">
|
||||||
|
<slot v-if="$slots.default" name="default"></slot>
|
||||||
|
<up-icon v-else name="share-square" bold :color="color" :size="size"></up-icon>
|
||||||
|
<view class="absolute share-box">
|
||||||
|
<button open-type="share" @click.stop="shareClick">分享</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
const emits = defineEmits(['shareClick'])
|
||||||
|
const props = defineProps({
|
||||||
|
size: {
|
||||||
|
type: String,
|
||||||
|
default: '36rpx'
|
||||||
|
},
|
||||||
|
color:{
|
||||||
|
type: String,
|
||||||
|
default: '#333'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function shareClick() {
|
||||||
|
emits('shareClick')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.share-box {
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
top: 0;
|
||||||
|
opacity: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view
|
<!-- <view
|
||||||
class="u-p-t-16 u-p-b-20 u-flex u-p-l-28 u-p-r-28"
|
class="u-p-t-16 u-p-b-20 u-flex u-p-l-28 u-p-r-28"
|
||||||
style="align-items: baseline; justify-content: flex-end"
|
style="align-items: baseline; justify-content: flex-end"
|
||||||
>
|
>
|
||||||
@@ -53,9 +53,9 @@
|
|||||||
<text class="font-16 color-333 font-700" >
|
<text class="font-16 color-333 font-700" >
|
||||||
{{ totalIncome }}</text
|
{{ totalIncome }}</text
|
||||||
>
|
>
|
||||||
</view>
|
</view> -->
|
||||||
|
|
||||||
<view class="list">
|
<view class="list u-m-t-32">
|
||||||
<view v-for="(item, index) in state.records" :key="index" class="item">
|
<view v-for="(item, index) in state.records" :key="index" class="item">
|
||||||
<view class="u-flex justify-between">
|
<view class="u-flex justify-between">
|
||||||
<view>
|
<view>
|
||||||
|
|||||||
@@ -1,228 +1,260 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class="w-qrcode">
|
<view class="w-qrcode">
|
||||||
<w-qrcode
|
<w-qrcode :options="codeOptions" :opacity="0" ref="wQrcode" @generate="(e) => qrcodeResult(e)"></w-qrcode>
|
||||||
:options="codeOptions"
|
</view>
|
||||||
:opacity="0"
|
<up-popup :show="show" bgColor="transparent" :safeAreaInsetBottom="false" :closeOnClickOverlay="true" @close="close" mode="center">
|
||||||
ref="wQrcode"
|
<view class="box">
|
||||||
@generate="(e) => qrcodeResult(e)"
|
<view class="info">
|
||||||
></w-qrcode>
|
<view class="u-flex justify-center">
|
||||||
</view>
|
<up-avatar size="214rpx" :src="shopUserInfo.headImg"></up-avatar>
|
||||||
|
</view>
|
||||||
<up-popup
|
<view class="u-m-t-48 font-14 font-700 color-333 text-center line-height-54">
|
||||||
:show="show"
|
<view>{{ shopUserInfo.nickName }}</view>
|
||||||
bgColor="transparent"
|
<view>{{ desensitizePhone(shopUserInfo.phone) }}</view>
|
||||||
:safeAreaInsetBottom="false"
|
</view>
|
||||||
:closeOnClickOverlay="true"
|
<view class="u-m-t-16 font-14 line-height-54 text-center">
|
||||||
@close="close"
|
<text class="color-666">邀请码</text>
|
||||||
mode="center"
|
<text class="u-m-l-16 u-m-r-16 color-333 font-16 font-700">{{ inviteCode }}</text>
|
||||||
>
|
<text class="" style="color: #fe6d11" @click="copyCode">复制</text>
|
||||||
<view class="box">
|
</view>
|
||||||
<view class="info">
|
<view class="u-flex justify-center" style="margin-top: 90rpx">
|
||||||
<view class="u-flex justify-center">
|
<!-- <w-qrcode
|
||||||
<up-avatar size="214rpx" :src="shopUserInfo.headImg"></up-avatar>
|
|
||||||
</view>
|
|
||||||
<view
|
|
||||||
class="u-m-t-48 font-14 font-700 color-333 text-center line-height-54"
|
|
||||||
>
|
|
||||||
<view>{{ shopUserInfo.nickName }} </view>
|
|
||||||
<view>{{ desensitizePhone(shopUserInfo.phone) }}</view>
|
|
||||||
</view>
|
|
||||||
<view class="u-m-t-16 font-14 line-height-54 text-center">
|
|
||||||
<text class="color-666">邀请码</text>
|
|
||||||
<text class="u-m-l-16 u-m-r-16 color-333 font-16 font-700">{{
|
|
||||||
inviteCode
|
|
||||||
}}</text>
|
|
||||||
<text class="" style="color: #fe6d11" @click="copyCode">复制</text>
|
|
||||||
</view>
|
|
||||||
<view class="u-flex justify-center" style="margin-top: 90rpx">
|
|
||||||
<!-- <w-qrcode
|
|
||||||
:options="codeOptions"
|
:options="codeOptions"
|
||||||
:opacity="1"
|
:opacity="1"
|
||||||
ref="wQrcode"
|
ref="wQrcode"
|
||||||
@generate="(e) => qrcodeResult(e)"
|
@generate="(e) => qrcodeResult(e)"
|
||||||
></w-qrcode> -->
|
></w-qrcode> -->
|
||||||
<up-image width="322rpx" height="322rpx" :src="code"></up-image>
|
<up-image width="322rpx" height="322rpx" :src="code"></up-image>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
<view class="u-m-t-60 u-flex u-col-center justify-center">
|
<view class="footer-wrap">
|
||||||
<view class="confirm" @click="save">保存图片</view>
|
<view class="confirm line" @click="save">保存图片</view>
|
||||||
</view>
|
<ymf-share><view class="confirm">微信分享</view></ymf-share>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</up-popup>
|
</up-popup>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import wQrcode from "@/uni_modules/wmf-code/components/w-qrcode/w-qrcode.vue";
|
import { shareMixin, handleMixinOnLoad, returnQuery } from '@/utils/share.js';
|
||||||
import {desensitizePhone} from "@/utils/util.js";
|
import ymfShare from '@/components/ymf-components/ymf-share.vue';
|
||||||
import { ref } from "vue";
|
import wQrcode from '@/uni_modules/wmf-code/components/w-qrcode/w-qrcode.vue';
|
||||||
const props = defineProps({
|
import { desensitizePhone } from '@/utils/util.js';
|
||||||
inviteCode: {
|
import { ref, onMounted, nextTick } from 'vue';
|
||||||
type: String,
|
|
||||||
default: "",
|
onMounted(async () => {
|
||||||
},
|
setTimeout(async () => {
|
||||||
shopUserInfo: {
|
await nextTick();
|
||||||
type: Object,
|
const query = await returnQuery();
|
||||||
default: () => {},
|
codeOptions.value.code = `https://cashier.sxczgkj.com/invite?${removeQAndAfter(query)}`;
|
||||||
},
|
console.log('codeOptions.value', codeOptions.value);
|
||||||
|
}, 500);
|
||||||
});
|
});
|
||||||
const codeOptions = ref({
|
|
||||||
size: 200,
|
/**
|
||||||
code: props.inviteCode,
|
* 截取字符串,移除 &q 及后面的所有内容
|
||||||
});
|
* @param {string} str - 原始字符串
|
||||||
function copyCode() {
|
* @returns {string} 处理后的字符串
|
||||||
uni.setClipboardData({
|
*/
|
||||||
data: props.inviteCode,
|
function removeQAndAfter(str) {
|
||||||
success: function () {
|
// 检查是否为空字符串
|
||||||
console.log("success");
|
if (!str || typeof str !== 'string') {
|
||||||
},
|
return str || '';
|
||||||
});
|
}
|
||||||
|
|
||||||
|
// 找到 &q 的起始位置
|
||||||
|
const qIndex = str.indexOf('&q');
|
||||||
|
|
||||||
|
// 如果找到 &q,截取前面的部分;否则返回原字符串
|
||||||
|
return qIndex !== -1 ? str.slice(0, qIndex) : str;
|
||||||
}
|
}
|
||||||
const code = ref("");
|
|
||||||
|
const props = defineProps({
|
||||||
|
inviteCode: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
shopUserInfo: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const codeOptions = ref({
|
||||||
|
padding: 10,
|
||||||
|
size: 200,
|
||||||
|
code: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
function copyCode() {
|
||||||
|
uni.setClipboardData({
|
||||||
|
data: props.inviteCode,
|
||||||
|
success: function () {
|
||||||
|
console.log('success');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const code = ref('');
|
||||||
|
|
||||||
function qrcodeResult(e) {
|
function qrcodeResult(e) {
|
||||||
console.log("qrcodeResult", e);
|
console.log('qrcodeResult', e);
|
||||||
code.value = e.img.tempFilePath;
|
code.value = e.img.tempFilePath;
|
||||||
console.log("code", code.value);
|
console.log('code', code.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const show = defineModel({
|
const show = defineModel({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false
|
||||||
});
|
});
|
||||||
const emits = defineEmits(["cancel", "confirm"]);
|
const emits = defineEmits(['cancel', 'confirm']);
|
||||||
function close() {
|
function close() {
|
||||||
show.value = false;
|
show.value = false;
|
||||||
emits("cancel");
|
emits('cancel');
|
||||||
}
|
}
|
||||||
function save() {
|
function save() {
|
||||||
show.value = false;
|
show.value = false;
|
||||||
|
|
||||||
// 保存图片到相册
|
// 保存图片到相册
|
||||||
uni.saveImageToPhotosAlbum({
|
uni.saveImageToPhotosAlbum({
|
||||||
filePath: code.value,
|
filePath: code.value,
|
||||||
success: function () {
|
success: function () {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "保存成功",
|
title: '保存成功',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fail: function (err) {
|
fail: function (err) {
|
||||||
console.log('保存失败原因:', err);
|
console.log('保存失败原因:', err);
|
||||||
// 判断是否为授权拒绝(微信小程序授权拒绝的特征)
|
// 判断是否为授权拒绝(微信小程序授权拒绝的特征)
|
||||||
if (err.errMsg.includes('auth deny') || err.errMsg.includes('authorize fail')) {
|
if (err.errMsg.includes('auth deny') || err.errMsg.includes('authorize fail')) {
|
||||||
// 弹出提示引导用户去设置页开启授权
|
// 弹出提示引导用户去设置页开启授权
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '授权提示',
|
title: '授权提示',
|
||||||
content: '保存图片需要授权访问相册,请前往设置开启授权',
|
content: '保存图片需要授权访问相册,请前往设置开启授权',
|
||||||
showCancel: true,
|
showCancel: true,
|
||||||
cancelText: '取消',
|
cancelText: '取消',
|
||||||
confirmText: '去设置',
|
confirmText: '去设置',
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
// 跳转到微信小程序的授权设置页
|
// 跳转到微信小程序的授权设置页
|
||||||
uni.openSetting({
|
uni.openSetting({
|
||||||
success: function (settingRes) {
|
success: function (settingRes) {
|
||||||
// 检查用户是否开启了相册授权
|
// 检查用户是否开启了相册授权
|
||||||
if (settingRes.authSetting['scope.writePhotosAlbum']) {
|
if (settingRes.authSetting['scope.writePhotosAlbum']) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '授权成功,可重新保存',
|
title: '授权成功,可重新保存',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '未开启授权,保存失败',
|
title: '未开启授权,保存失败',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: function () {
|
fail: function () {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '打开设置失败',
|
title: '打开设置失败',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// 非授权问题的保存失败(如文件路径错误、系统问题等)
|
// 非授权问题的保存失败(如文件路径错误、系统问题等)
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "保存失败",
|
title: '保存失败',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
emits("confirm", code.value);
|
emits('confirm', code.value);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
:deep(.info .canvas) {
|
:deep(.info .canvas) {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
.border {
|
.border {
|
||||||
border: 2rpx solid #d9d9d9;
|
border: 2rpx solid #d9d9d9;
|
||||||
padding: 18rpx;
|
padding: 18rpx;
|
||||||
border-radius: 4rpx;
|
border-radius: 4rpx;
|
||||||
}
|
}
|
||||||
.box {
|
.box {
|
||||||
width: 638rpx;
|
width: 638rpx;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
overflow: hidden;
|
// overflow: hidden;
|
||||||
.title {
|
position: relative;
|
||||||
color: #000000;
|
.title {
|
||||||
font-size: 32rpx;
|
color: #000000;
|
||||||
font-weight: 700;
|
font-size: 32rpx;
|
||||||
}
|
font-weight: 700;
|
||||||
.top {
|
}
|
||||||
border-bottom: 2rpx solid #ededed;
|
.top {
|
||||||
}
|
border-bottom: 2rpx solid #ededed;
|
||||||
.info {
|
}
|
||||||
padding: 96rpx 40rpx 96rpx 40rpx;
|
.info {
|
||||||
font-size: 28rpx;
|
padding: 96rpx 40rpx 96rpx 40rpx;
|
||||||
}
|
font-size: 28rpx;
|
||||||
.small-title {
|
}
|
||||||
min-width: 84rpx;
|
.small-title {
|
||||||
text-align: right;
|
min-width: 84rpx;
|
||||||
}
|
text-align: right;
|
||||||
|
}
|
||||||
|
.footer-wrap {
|
||||||
|
width: 100%;
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
bottom: -100upx;
|
||||||
|
display: flex;
|
||||||
|
gap: 28upx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.cancel {
|
.cancel {
|
||||||
padding: 14rpx 76rpx;
|
padding: 14rpx 76rpx;
|
||||||
border-radius: 36rpx;
|
border-radius: 36rpx;
|
||||||
border: 2rpx solid #e8ad7b;
|
border: 2rpx solid #e8ad7b;
|
||||||
color: #e8ad7b;
|
color: #e8ad7b;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
line-height: 48rpx;
|
line-height: 48rpx;
|
||||||
}
|
}
|
||||||
.confirm {
|
.confirm {
|
||||||
padding: 14rpx 76rpx;
|
$color: #e8ad7b;
|
||||||
border-radius: 16rpx;
|
flex: 1;
|
||||||
background-color: #e8ad7b;
|
padding: 14rpx 76rpx;
|
||||||
border: 2rpx solid #e8ad7b;
|
border-radius: 16rpx;
|
||||||
color: #fff;
|
background-color: $color;
|
||||||
font-size: 32rpx;
|
border: 2rpx solid $color;
|
||||||
font-weight: 400;
|
color: #fff;
|
||||||
line-height: 48rpx;
|
font-size: 32rpx;
|
||||||
white-space: nowrap;
|
font-weight: 400;
|
||||||
|
white-space: nowrap;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
&.line {
|
||||||
|
background-color: #fff;
|
||||||
|
color: $color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.line-height-54 {
|
.line-height-54 {
|
||||||
line-height: 54rpx;
|
line-height: 54rpx;
|
||||||
}
|
}
|
||||||
.w-qrcode {
|
.w-qrcode {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: -9999px;
|
left: -9999px;
|
||||||
top: -9999px;
|
top: -9999px;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -566,7 +566,7 @@ export function calcSingleGoodsRealPrice(
|
|||||||
>
|
>
|
||||||
) : number {
|
) : number {
|
||||||
const { isMember, memberDiscountRate, limitTimeDiscount: activity } = config;
|
const { isMember, memberDiscountRate, limitTimeDiscount: activity } = config;
|
||||||
|
console.log('isMember',isMember);
|
||||||
//如果是增菜价格为0
|
//如果是增菜价格为0
|
||||||
if (goods.is_gift || goods.isGift) {
|
if (goods.is_gift || goods.isGift) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"pinia": "^2.3.1",
|
"pinia": "^2.3.1",
|
||||||
"pinia-plugin-unistorage": "^0.1.2",
|
"pinia-plugin-unistorage": "^0.1.2",
|
||||||
"ysk-utils": "^1.0.81"
|
"ysk-utils": "^1.0.85"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"unplugin-auto-import": "^0.16.7"
|
"unplugin-auto-import": "^0.16.7"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"easycom": {
|
"easycom": {
|
||||||
"autoscan": true,
|
"autoscan": true,
|
||||||
"custom": {
|
"custom": {
|
||||||
|
"^ymf-(.*)": "@/components/ymf-components/ymf-$1.vue",
|
||||||
"^u--(.*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue",
|
"^u--(.*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue",
|
||||||
"^up-(.*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue",
|
"^up-(.*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue",
|
||||||
"^u-([^-].*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue"
|
"^u-([^-].*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue"
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -29,7 +29,6 @@
|
|||||||
<image :src="imgs.code" class="code"></image>
|
<image :src="imgs.code" class="code"></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="new-menus-box">
|
<view class="new-menus-box">
|
||||||
<view class="new-menus layout2" v-if="allConfig.takeout">
|
<view class="new-menus layout2" v-if="allConfig.takeout">
|
||||||
<view class="diner" @click="scanCodehandle(0)">
|
<view class="diner" @click="scanCodehandle(0)">
|
||||||
@@ -60,7 +59,6 @@
|
|||||||
|
|
||||||
<view class="u-font-28 color-999">一键分享,快速拼单</view>
|
<view class="u-font-28 color-999">一键分享,快速拼单</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="points" @click="toIntegralMall">
|
<view class="points" @click="toIntegralMall">
|
||||||
@@ -92,7 +90,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="item" @click="toFenxiao">
|
<view class="item" @click="toFenxiao">
|
||||||
<image :src="imgs.share" class="img"></image>
|
<image :src="imgs.share" class="img"></image>
|
||||||
<view class="title">股东共享</view>
|
<view class="title">全民股东</view>
|
||||||
<view class="desc">邀请好友,获得佣金</view>
|
<view class="desc">邀请好友,获得佣金</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -118,6 +116,8 @@
|
|||||||
</u-popup>
|
</u-popup>
|
||||||
<!-- 私域引流弹窗 -->
|
<!-- 私域引流弹窗 -->
|
||||||
<attractPopup type="home" ref="attractPopupRef" />
|
<attractPopup type="home" ref="attractPopupRef" />
|
||||||
|
|
||||||
|
<ymf-share-popup ></ymf-share-popup>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@
|
|||||||
function toGroupBuying() {
|
function toGroupBuying() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/groupBuying/index/index'
|
url: '/groupBuying/index/index'
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function toFenxiao() {
|
function toFenxiao() {
|
||||||
@@ -215,7 +215,7 @@
|
|||||||
function toTaocan() {
|
function toTaocan() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/userPackage/index/index'
|
url: '/userPackage/index/index'
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const memberindex = (url) => {
|
const memberindex = (url) => {
|
||||||
@@ -301,7 +301,7 @@
|
|||||||
function getHomeData() {
|
function getHomeData() {
|
||||||
homeData().then((res) => {
|
homeData().then((res) => {
|
||||||
Object.assign(allConfig, res);
|
Object.assign(allConfig, res);
|
||||||
imgs.defaultAvatar = res.userAvatar ? res.userAvatar : imgs.defaultAvatar
|
imgs.defaultAvatar = res.userAvatar ? res.userAvatar : imgs.defaultAvatar;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -316,6 +316,9 @@
|
|||||||
defineExpose({
|
defineExpose({
|
||||||
updateData
|
updateData
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@@ -7,14 +7,21 @@
|
|||||||
<view class="limitDiscount" v-if="showLimitDiscount(item)"
|
<view class="limitDiscount" v-if="showLimitDiscount(item)"
|
||||||
>限时折扣</view
|
>限时折扣</view
|
||||||
>
|
>
|
||||||
|
|
||||||
<up-image
|
<up-image
|
||||||
width="76"
|
width="76"
|
||||||
height="76"
|
height="76"
|
||||||
radius="6"
|
radius="6"
|
||||||
:src="item.productImg"
|
:src="item.productImg"
|
||||||
v-if="item.productId != -999"
|
v-if="item.isTemporary != 1&&item.is_temporary!=1"
|
||||||
></up-image>
|
></up-image>
|
||||||
|
<up-image
|
||||||
|
v-else-if="(item.isTemporary||item.is_temporary) &&(item.product_name=='签子'||item.productName=='签子')"
|
||||||
|
width="76"
|
||||||
|
height="76"
|
||||||
|
radius="6"
|
||||||
|
src="https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/5/b97054debd83486ab7ad8e20ca6a360a.png"
|
||||||
|
mode="heightFix"
|
||||||
|
></up-image>
|
||||||
<up-image
|
<up-image
|
||||||
width="76"
|
width="76"
|
||||||
height="76"
|
height="76"
|
||||||
@@ -25,7 +32,7 @@
|
|||||||
></up-image>
|
></up-image>
|
||||||
</view>
|
</view>
|
||||||
<view class="info">
|
<view class="info">
|
||||||
<text class="productName">{{ item.productName }}</text>
|
<text class="productName">{{ item.productName||item.product_name }}</text>
|
||||||
<text class="productSkuName" v-if="item.skuName">{{
|
<text class="productSkuName" v-if="item.skuName">{{
|
||||||
item.skuName
|
item.skuName
|
||||||
}}</text>
|
}}</text>
|
||||||
@@ -55,18 +62,22 @@
|
|||||||
<view class="price">
|
<view class="price">
|
||||||
<view class="priceAmount">
|
<view class="priceAmount">
|
||||||
¥
|
¥
|
||||||
|
|
||||||
<goodsPrice
|
<goodsPrice
|
||||||
|
v-if="!item.is_temporary&&!item.isTemporary"
|
||||||
:cart="item"
|
:cart="item"
|
||||||
:limitDiscount="limitDiscount"
|
:limitDiscount="limitDiscount"
|
||||||
:shopUserInfo="shopUserInfo"
|
:shopUserInfo="shopUserInfo"
|
||||||
:shopInfo="shopInfo"
|
:shopInfo="shopInfo"
|
||||||
idKey="product_id"
|
idKey="product_id"
|
||||||
></goodsPrice>
|
></goodsPrice>
|
||||||
|
<text v-else>{{item.discount_sale_amount}}</text>
|
||||||
<view class="old-price" v-if="showLimitDiscount(item)"
|
<view class="old-price" v-if="showLimitDiscount(item)"
|
||||||
>¥{{ item.salePrice }}</view
|
>¥{{ item.salePrice }}</view
|
||||||
>
|
>
|
||||||
</view>
|
</view>
|
||||||
<view class="num">x{{ item.num }}</view>
|
<view class="num" v-if="!item.is_temporary&&!item.isTemporary">x{{ item.num }}</view>
|
||||||
|
<view class="num" v-else>x{{ item.number }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
:shopInfo="cartStore.shopInfo" :shopUserInfo="cartStore.shopUserInfo"
|
:shopInfo="cartStore.shopInfo" :shopUserInfo="cartStore.shopUserInfo"
|
||||||
:limitDiscount="cartStore.limitTimeDiscount"></orderItemVue>
|
:limitDiscount="cartStore.limitTimeDiscount"></orderItemVue>
|
||||||
|
|
||||||
<view class="u-flex u-row-center u-m-t-16 u-font-28">
|
<view class="u-flex u-row-center u-m-t-16 u-font-28" v-if="cartStore.allGoods.length>4">
|
||||||
<view class="u-flex u-col-baseline" @click="showAllGoods=!showAllGoods">
|
<view class="u-flex u-col-baseline" @click="showAllGoods=!showAllGoods">
|
||||||
<text>{{showAllGoods?'收起':'展开'}}</text>
|
<text>{{showAllGoods?'收起':'展开'}}</text>
|
||||||
<view class="guodu u-m-l-10 u-m-t-2" :class="{rotate:!showAllGoods}">
|
<view class="guodu u-m-l-10 u-m-t-2" :class="{rotate:!showAllGoods}">
|
||||||
|
|||||||
@@ -70,7 +70,10 @@
|
|||||||
<view class="item" v-for="item in value" :key="item.id">
|
<view class="item" v-for="item in value" :key="item.id">
|
||||||
<view class="cover">
|
<view class="cover">
|
||||||
<up-image width="76" height="76" radius="16" :src="item.productImg"
|
<up-image width="76" height="76" radius="16" :src="item.productImg"
|
||||||
v-if="item.productId!=-999"></up-image>
|
v-if="!item.isTemporary"></up-image>
|
||||||
|
<u-image width="56" height="56" radius="10"
|
||||||
|
v-else-if="item.isTemporary &&item.productName=='签子'"
|
||||||
|
src="https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/5/b97054debd83486ab7ad8e20ca6a360a.png"></u-image>
|
||||||
<up-image width="76" height="76" radius="16"
|
<up-image width="76" height="76" radius="16"
|
||||||
:src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png'"
|
:src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png'"
|
||||||
mode="heightFix" v-else></up-image>
|
mode="heightFix" v-else></up-image>
|
||||||
|
|||||||
@@ -577,7 +577,7 @@
|
|||||||
name: "微信支付",
|
name: "微信支付",
|
||||||
type: 2,
|
type: 2,
|
||||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png",
|
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png",
|
||||||
payType: "wechatPay",
|
payType: "WECHAT",
|
||||||
};
|
};
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef MP-ALIPAY
|
// #ifdef MP-ALIPAY
|
||||||
|
|||||||
@@ -316,7 +316,7 @@
|
|||||||
const paymentmethod = reactive({
|
const paymentmethod = reactive({
|
||||||
radiovalue: 2,
|
radiovalue: 2,
|
||||||
paymentBtnText: "微信支付",
|
paymentBtnText: "微信支付",
|
||||||
payType: 'wechatPay'
|
payType: 'WECHAT'
|
||||||
})
|
})
|
||||||
|
|
||||||
const groupChange = async (e) => {
|
const groupChange = async (e) => {
|
||||||
|
|||||||
@@ -62,9 +62,15 @@
|
|||||||
<view class="shop-info">
|
<view class="shop-info">
|
||||||
<view class="shop-item">
|
<view class="shop-item">
|
||||||
<view class="cover" v-for="(item1,index1) in item.goods" :key="index1">
|
<view class="cover" v-for="(item1,index1) in item.goods" :key="index1">
|
||||||
<u-image width="56" height="56" radius="10" :src='item1.productImg'
|
|
||||||
v-if="item1.productId!=-999"></u-image>
|
<u-image width="56" height="56" radius="10" :src="item1.productImg"
|
||||||
<u-image width="112" height="112" radius="20"
|
v-if="!item1.isTemporary"></u-image>
|
||||||
|
|
||||||
|
<u-image width="56" height="56" radius="10"
|
||||||
|
v-else-if="item1.isTemporary &&item1.productName=='签子'"
|
||||||
|
src="https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/5/b97054debd83486ab7ad8e20ca6a360a.png"
|
||||||
|
></u-image>
|
||||||
|
<u-image width="56" height="56" radius="10"
|
||||||
:src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png'"
|
:src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png'"
|
||||||
mode="heightFix" v-else></u-image>
|
mode="heightFix" v-else></u-image>
|
||||||
<text class="productName"> {{ item1.productName }} </text>
|
<text class="productName"> {{ item1.productName }} </text>
|
||||||
@@ -130,32 +136,37 @@
|
|||||||
import {
|
import {
|
||||||
useNavbarStore
|
useNavbarStore
|
||||||
} from '@/stores/navbarStore';
|
} from '@/stores/navbarStore';
|
||||||
import {APIshopUserInfo} from '@/common/api/member.js'
|
import {
|
||||||
|
APIshopUserInfo
|
||||||
|
} from '@/common/api/member.js'
|
||||||
const store = useNavbarStore();
|
const store = useNavbarStore();
|
||||||
|
|
||||||
async function agignOrder(item){
|
async function agignOrder(item) {
|
||||||
await APIshopUserInfo({
|
await APIshopUserInfo({
|
||||||
shopId:item.shopId
|
shopId: item.shopId
|
||||||
}).then(shopUserInfo=>{
|
}).then(shopUserInfo => {
|
||||||
if(shopUserInfo){
|
if (shopUserInfo) {
|
||||||
uni.cache.set("dinersNum", 1);
|
uni.cache.set("dinersNum", 1);
|
||||||
uni.cache.set("tableCode", shopUserInfo.id);
|
uni.cache.set("tableCode", shopUserInfo.id);
|
||||||
uni.cache.set("shopId", item.shopId);
|
uni.cache.set("shopId", item.shopId);
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/product/index?type=beforehand&order_id="+item.id+'&one_more_order=1',
|
url: "/pages/product/index?type=beforehand&order_id=" + item.id +
|
||||||
|
'&one_more_order=1&shopId='+item.shopId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
function totalGoodsNum(arr){
|
|
||||||
if(!arr){
|
function totalGoodsNum(arr) {
|
||||||
|
if (!arr) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return arr.reduce((prve,cur)=>{
|
return arr.reduce((prve, cur) => {
|
||||||
return prve+cur.num
|
return prve + cur.num
|
||||||
},0)
|
}, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
function isRemoveOrder(item) {
|
function isRemoveOrder(item) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
@@ -578,7 +589,8 @@
|
|||||||
.ml-20 {
|
.ml-20 {
|
||||||
margin-left: 20rpx;
|
margin-left: 20rpx;
|
||||||
}
|
}
|
||||||
.take_food_number{
|
|
||||||
|
.take_food_number {
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
background-color: #F8F8F8;
|
background-color: #F8F8F8;
|
||||||
margin-left: 36rpx;
|
margin-left: 36rpx;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<up-popup :show="visible" :round="20" mode="bottom" @close="close" :close-on-click-overlay="true">
|
<up-popup :show="visible" :round="20" mode="bottom" @close="close" :close-on-click-overlay="true">
|
||||||
<view class="" style="height: calc(100vh - 70px);">
|
<view class="u-flex u-flex-col box" :style="{maxHeight:boxHeight+'px'}">
|
||||||
<view class="shop_sku" >
|
<view class="shop_sku">
|
||||||
|
|
||||||
<scroll-view scroll-y style="height: calc(100vh - 240px); width: 100%">
|
<scroll-view scroll-y class="scroll-view" :style="{maxHeight:boxHeight +'px'}">
|
||||||
<!-- <view class="positionabsolute">
|
<!-- <view class="positionabsolute">
|
||||||
<up-icon name="arrow-down" @click="close" color="#333" size="22"></up-icon>
|
<up-icon name="arrow-down" @click="close" color="#333" size="22"></up-icon>
|
||||||
</view> -->
|
</view> -->
|
||||||
@@ -13,13 +13,16 @@
|
|||||||
<up-swiper :list="goods.images" @change="swiperChange" :current="swiperCurrent" radius="6px"
|
<up-swiper :list="goods.images" @change="swiperChange" :current="swiperCurrent" radius="6px"
|
||||||
height="250" @click="prveImgs(goods.images, goods.images[swiperCurrent])">
|
height="250" @click="prveImgs(goods.images, goods.images[swiperCurrent])">
|
||||||
</up-swiper>
|
</up-swiper>
|
||||||
|
<view class="shop_sku_name u-flex u-row-between">
|
||||||
<view class="shop_sku_name">{{ goods.name }}</view>
|
<view class="u-line-1" style="max-width: 600rpx;">{{ goods.name }}</view>
|
||||||
|
<ymfShare @shareClick="shareClick" />
|
||||||
|
</view>
|
||||||
<view class="shop_sku_description" v-if="isSkuGoods">
|
<view class="shop_sku_description" v-if="isSkuGoods">
|
||||||
{{ goods.shortTitle ? goods.shortTitle : '' }}
|
{{ goods.shortTitle ? goods.shortTitle : '' }}
|
||||||
</view>
|
</view>
|
||||||
<view v-if="goods.type != 'package'">
|
<view v-if="goods.type != 'package'">
|
||||||
<view class="shop_sku_box" v-for="(specOptions, specType) in goods.selectSpecInfo" :key="specType">
|
<view class="shop_sku_box" v-for="(specOptions, specType) in goods.selectSpecInfo"
|
||||||
|
:key="specType">
|
||||||
<view class="shop_sku_box_name">
|
<view class="shop_sku_box_name">
|
||||||
{{ specType }}
|
{{ specType }}
|
||||||
</view>
|
</view>
|
||||||
@@ -45,11 +48,15 @@
|
|||||||
<view v-else>
|
<view v-else>
|
||||||
<view class="shop_sku_box">
|
<view class="shop_sku_box">
|
||||||
<view v-for="(setmenu, setmenuindex) in goods.groupSnap" :key="setmenuindex">
|
<view v-for="(setmenu, setmenuindex) in goods.groupSnap" :key="setmenuindex">
|
||||||
<view class="shop_sku_box_name">{{ setmenu.title }} {{ setmenu.count }}
|
<view class="shop_sku_box_name" v-if="goods.groupType!=0">{{ setmenu.title }}
|
||||||
选{{ setmenu.number }}</view>
|
{{ setmenu.count }}
|
||||||
|
选{{ setmenu.number }}
|
||||||
|
</view>
|
||||||
|
<view class="shop_sku_box_name" v-else>{{ setmenu.title }} {{ setmenu.count }}件商品</view>
|
||||||
<view class="flex-start">
|
<view class="flex-start">
|
||||||
<view class="shop_sku_box_item" v-for="(option, goodsid) in setmenu.goods"
|
<view class="shop_sku_box_item" v-for="(option, goodsid) in setmenu.goods"
|
||||||
:key="goodsid" @click="goodsidClick(setmenuindex, option, goodsid)" :class="{
|
:key="goodsid" @click="goodsidClick(setmenuindex, option, goodsid,setmenu)"
|
||||||
|
:class="{
|
||||||
shop_sku_box_item_selected: isOptionSelected(setmenuindex, option)
|
shop_sku_box_item_selected: isOptionSelected(setmenuindex, option)
|
||||||
}" :disabled="isMaxSelected(setmenuindex) && !isOptionSelected(setmenuindex, option)">
|
}" :disabled="isMaxSelected(setmenuindex) && !isOptionSelected(setmenuindex, option)">
|
||||||
{{ option.proName }}
|
{{ option.proName }}
|
||||||
@@ -120,8 +127,72 @@
|
|||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 占位不用管下面代码也不要删除 -->
|
||||||
|
<view class="shop_bottom" style="opacity: 0;">
|
||||||
|
<view class="flex-between">
|
||||||
|
<view class="price price-sku" v-if="goods.type != 'package' && goods.result">
|
||||||
|
<text class="i">¥</text>
|
||||||
|
<view class="num">
|
||||||
|
<GoodsPrice :limitDiscount="cartStore.limitTimeDiscount" :cart="selSku"
|
||||||
|
:shopUserInfo="shopUserInfo" :shopInfo="shopInfo"></GoodsPrice>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<text class="num" v-if="false">
|
||||||
|
{{
|
||||||
|
shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1
|
||||||
|
? goods.result.memberPrice || goods.result.salePrice
|
||||||
|
: goods.result.salePrice
|
||||||
|
}}
|
||||||
|
</text>
|
||||||
|
<text class="i" v-if="goods.unitName">/{{ goods.unitName }}</text>
|
||||||
|
<text
|
||||||
|
v-if="goods.result.suitNum > 1">「{{ goods.result.suitNum }}{{ goods.result.unitName }}起点」</text>
|
||||||
|
</view>
|
||||||
|
<view class="price price-package" v-else>
|
||||||
|
<text class="i">¥</text>
|
||||||
|
<view class="num">
|
||||||
|
<GoodsPrice :limitDiscount="cartStore.limitTimeDiscount" :cart="goods"
|
||||||
|
:shopUserInfo="shopUserInfo" :shopInfo="shopInfo"></GoodsPrice>
|
||||||
|
</view>
|
||||||
|
<text class="num" v-if="false">
|
||||||
|
{{
|
||||||
|
shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1
|
||||||
|
? goods.memberPrice || goods.salePrice
|
||||||
|
: goods.salePrice
|
||||||
|
}}
|
||||||
|
</text>
|
||||||
|
<text class="i" v-if="goods.unitName">/{{ goods.unitName }}</text>
|
||||||
|
<text v-if="goods.suitNum > 1">「{{ goods.suitNum }}{{ goods.unitName }}起点」</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="operation-wrap" v-if="goods.type != 'package'&&stockNumberIsFull(goods)">
|
||||||
|
<view class="btn">
|
||||||
|
<up-icon name="minus-circle-fill" color="#E9AB7A" size="25"
|
||||||
|
v-if="shopCartNumber > 0"></up-icon>
|
||||||
|
<view class="btnClick"></view>
|
||||||
|
</view>
|
||||||
|
<text class="num">{{ shopCartNumber }}</text>
|
||||||
|
<view class="btn">
|
||||||
|
<up-icon name="plus-circle-fill" color="#E9AB7A" size="25"></up-icon>
|
||||||
|
<view class="btnClick"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="shop_skuselect flex-start" v-if="selectedSpecsStr">
|
||||||
|
<view class="shop_skuselectname">{{ selectedSpecsStr }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="addShopping">
|
||||||
|
库存不足
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- <view style="width: 100%;height: 123px;"></view> -->
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<view class="shop_bottom">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<view class="shop_bottom" style="position: absolute;bottom: 0;z-index:100;">
|
||||||
<view class="flex-between">
|
<view class="flex-between">
|
||||||
<view class="price price-sku" v-if="goods.type != 'package' && goods.result">
|
<view class="price price-sku" v-if="goods.type != 'package' && goods.result">
|
||||||
<text class="i">¥</text>
|
<text class="i">¥</text>
|
||||||
@@ -141,24 +212,52 @@
|
|||||||
<text
|
<text
|
||||||
v-if="goods.result.suitNum > 1">「{{ goods.result.suitNum }}{{ goods.result.unitName }}起点」</text>
|
v-if="goods.result.suitNum > 1">「{{ goods.result.suitNum }}{{ goods.result.unitName }}起点」</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="price price-package" v-else>
|
<view class="price single-and-staticPackage "
|
||||||
|
v-else-if="goods.type=='single'||(goods.type=='package'&&goods.groupType==0)">
|
||||||
|
|
||||||
<text class="i">¥</text>
|
<text class="i">¥</text>
|
||||||
<view class="num">
|
<view class="num">
|
||||||
<GoodsPrice :limitDiscount="cartStore.limitTimeDiscount" :cart="goods"
|
<GoodsPrice :limitDiscount="cartStore.limitTimeDiscount" :cart="goods"
|
||||||
:shopUserInfo="shopUserInfo" :shopInfo="shopInfo"></GoodsPrice>
|
:shopUserInfo="shopUserInfo" :shopInfo="shopInfo"></GoodsPrice>
|
||||||
</view>
|
</view>
|
||||||
<text class="num" v-if="false">
|
|
||||||
{{
|
|
||||||
shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1
|
|
||||||
? goods.memberPrice || goods.salePrice
|
|
||||||
: goods.salePrice
|
|
||||||
}}
|
|
||||||
</text>
|
|
||||||
<text class="i" v-if="goods.unitName">/{{ goods.unitName }}</text>
|
<text class="i" v-if="goods.unitName">/{{ goods.unitName }}</text>
|
||||||
<text v-if="goods.suitNum > 1">「{{ goods.suitNum }}{{ goods.unitName }}起点」</text>
|
<text v-if="selSku&&selSku.suitNum > 1">「{{ selSku.suitNum }}{{ selSku.unitName }}起点」</text>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="price choosePackage "
|
||||||
|
v-else-if="goods.type=='package'&&goods.groupType==1">
|
||||||
|
|
||||||
<view class="operation-wrap" v-if="goods.type != 'package'&&stockNumberIsFull(goods)">
|
<text class="i">¥</text>
|
||||||
|
<view class="num">
|
||||||
|
<GoodsPrice :limitDiscount="cartStore.limitTimeDiscount" :cart="goods"
|
||||||
|
:shopUserInfo="shopUserInfo" :shopInfo="shopInfo"></GoodsPrice>
|
||||||
|
</view>
|
||||||
|
<text class="i" v-if="goods.unitName">/{{ goods.unitName }}</text>
|
||||||
|
<text v-if="selSku&&selSku.suitNum > 1">「{{ selSku.suitNum }}{{ selSku.unitName }}起点」</text>
|
||||||
|
</view>
|
||||||
|
<view class="price sku" v-else-if="goods.type=='sku'">
|
||||||
|
|
||||||
|
<text class="i">¥</text>
|
||||||
|
<view class="num">
|
||||||
|
<GoodsPrice :limitDiscount="cartStore.limitTimeDiscount" :cart="selSku"
|
||||||
|
:shopUserInfo="shopUserInfo" :shopInfo="shopInfo"></GoodsPrice>
|
||||||
|
</view>
|
||||||
|
<text class="i" v-if="goods.unitName">/{{ goods.unitName }}</text>
|
||||||
|
<text v-if="selSku&&selSku.suitNum > 1">「{{ selSku.suitNum }}{{ selSku.unitName }}起点」</text>
|
||||||
|
</view>
|
||||||
|
<view class="price price-package " v-else>
|
||||||
|
|
||||||
|
<text class="i">¥</text>
|
||||||
|
<view class="num">
|
||||||
|
<GoodsPrice :limitDiscount="cartStore.limitTimeDiscount" :cart="selSku"
|
||||||
|
:shopUserInfo="shopUserInfo" :shopInfo="shopInfo"></GoodsPrice>
|
||||||
|
</view>
|
||||||
|
<text class="i" v-if="goods.unitName">/{{ goods.unitName }}</text>
|
||||||
|
<text v-if="selSku&&selSku.suitNum > 1">「{{ selSku.suitNum }}{{ selSku.unitName }}起点」</text>
|
||||||
|
</view>
|
||||||
|
<view v-if="goods.type == 'package'&&goods.groupType==1">
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="operation-wrap" v-else-if="stockNumberIsFull(goods)">
|
||||||
<view class="btn">
|
<view class="btn">
|
||||||
<up-icon name="minus-circle-fill" color="#E9AB7A" size="25"
|
<up-icon name="minus-circle-fill" color="#E9AB7A" size="25"
|
||||||
v-if="shopCartNumber > 0"></up-icon>
|
v-if="shopCartNumber > 0"></up-icon>
|
||||||
@@ -181,11 +280,13 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<template v-if="isSkuGoods">
|
<template v-if="isSkuGoods">
|
||||||
<view v-if="goods.type == 'package'" class="addShopping package"
|
<view v-if="goods.type == 'package' && goods.groupType!=0" class="addShopping package"
|
||||||
:class=" allConditionsSatisfied ? 'active' : ''" @click="submitSelection(goods)">
|
:class=" allConditionsSatisfied ? 'active' : ''" @click="submitSelection(goods)">
|
||||||
添加到购物车
|
添加到购物车
|
||||||
</view>
|
</view>
|
||||||
<view v-else class="sku addShopping" :class="shopCartNumber > 0 && canSubmit ? 'active' : ''"
|
|
||||||
|
<view v-else class="sku addShopping"
|
||||||
|
:class="shopCartNumber > 0 && canSubmit ? 'active' : ''"
|
||||||
@click="submitSelection(goods)">
|
@click="submitSelection(goods)">
|
||||||
添加到购物车
|
添加到购物车
|
||||||
</view>
|
</view>
|
||||||
@@ -197,8 +298,6 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -211,6 +310,7 @@
|
|||||||
import {
|
import {
|
||||||
useNavbarStore
|
useNavbarStore
|
||||||
} from '@/stores/navbarStore';
|
} from '@/stores/navbarStore';
|
||||||
|
import ymfShare from '@/components/ymf-components/ymf-share.vue'
|
||||||
const store = useNavbarStore();
|
const store = useNavbarStore();
|
||||||
const {
|
const {
|
||||||
showBack,
|
showBack,
|
||||||
@@ -236,6 +336,7 @@
|
|||||||
import {
|
import {
|
||||||
computed,
|
computed,
|
||||||
inject,
|
inject,
|
||||||
|
onMounted,
|
||||||
ref,
|
ref,
|
||||||
watch
|
watch
|
||||||
} from "vue";
|
} from "vue";
|
||||||
@@ -266,7 +367,10 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// / 选择规格的方法
|
// / 选择规格的方法
|
||||||
const goodsidClick = (setmenuindex, option, goodsid) => {
|
const goodsidClick = (setmenuindex, option, goodsid, setmenu) => {
|
||||||
|
if (props.goods.groupType == 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
if (!selectedOptions.value[setmenuindex]) {
|
if (!selectedOptions.value[setmenuindex]) {
|
||||||
// 如果 selectedOptions.value[setmenuindex] 不存在,初始化一个空数组
|
// 如果 selectedOptions.value[setmenuindex] 不存在,初始化一个空数组
|
||||||
selectedOptions.value[setmenuindex] = [];
|
selectedOptions.value[setmenuindex] = [];
|
||||||
@@ -278,11 +382,14 @@
|
|||||||
} else if (!isMaxSelected(setmenuindex)) {
|
} else if (!isMaxSelected(setmenuindex)) {
|
||||||
// 如果未达到最大选择数量,添加到选中列表
|
// 如果未达到最大选择数量,添加到选中列表
|
||||||
selectedOptions.value[setmenuindex].push(option);
|
selectedOptions.value[setmenuindex].push(option);
|
||||||
|
} else if (isMaxSelected(setmenuindex) && setmenu.number == 1) {
|
||||||
|
selectedOptions.value[setmenuindex] = [option]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 计算所有选中条件是否都符合
|
// 计算所有选中条件是否都符合
|
||||||
const allConditionsSatisfied = computed(() => {
|
const allConditionsSatisfied = computed(() => {
|
||||||
|
console.log('props.goods', props.goods);
|
||||||
// 检查 specifications.item.groupSnap 是否存在
|
// 检查 specifications.item.groupSnap 是否存在
|
||||||
if (!props.goods?.groupSnap) {
|
if (!props.goods?.groupSnap) {
|
||||||
return false;
|
return false;
|
||||||
@@ -306,6 +413,8 @@
|
|||||||
const selSku = ref(null)
|
const selSku = ref(null)
|
||||||
// 处理规格选择的方法
|
// 处理规格选择的方法
|
||||||
const selectSpec = async (specType, option) => {
|
const selectSpec = async (specType, option) => {
|
||||||
|
console.log('specType', specType)
|
||||||
|
console.log('option', option)
|
||||||
// 规格清零
|
// 规格清零
|
||||||
shopCartNumber.value = 0;
|
shopCartNumber.value = 0;
|
||||||
|
|
||||||
@@ -373,7 +482,12 @@
|
|||||||
const swiperCurrent = ref(0);
|
const swiperCurrent = ref(0);
|
||||||
|
|
||||||
function returnFirstSku(product) {
|
function returnFirstSku(product) {
|
||||||
return product.skuList[0]
|
console.log('returnFirstSku', product);
|
||||||
|
return {
|
||||||
|
...product.skuList[0]||'',
|
||||||
|
sku_id: product.skuList[0].id||'',
|
||||||
|
id: product.id||'',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//返回是否是多规格商品
|
//返回是否是多规格商品
|
||||||
function returnIsSkuGoods(item) {
|
function returnIsSkuGoods(item) {
|
||||||
@@ -392,8 +506,10 @@
|
|||||||
swiperCurrent.value = e.current;
|
swiperCurrent.value = e.current;
|
||||||
}
|
}
|
||||||
|
|
||||||
const emits = defineEmits(['prveImgs', 'websocketsendMessage', 'close', 'modalAdd'])
|
const emits = defineEmits(['prveImgs', 'websocketsendMessage', 'close', 'modalAdd','shareClick'])
|
||||||
|
function shareClick(){
|
||||||
|
emits('shareClick',props.goods)
|
||||||
|
}
|
||||||
function prveImgs(images, currentUrl) {
|
function prveImgs(images, currentUrl) {
|
||||||
emits('prveImgs', images, currentUrl)
|
emits('prveImgs', images, currentUrl)
|
||||||
}
|
}
|
||||||
@@ -407,6 +523,9 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function stockNumberIsFull(item) {
|
function stockNumberIsFull(item) {
|
||||||
if (item.isStock && item.stockNumber < item.suitNum) {
|
if (item.isStock && item.stockNumber < item.suitNum) {
|
||||||
return false
|
return false
|
||||||
@@ -542,13 +661,18 @@
|
|||||||
if (goods.type != 'package' && shopCartNumber.value <= 0) {
|
if (goods.type != 'package' && shopCartNumber.value <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (goods.type == 'package' && !allConditionsSatisfied.value) {
|
if (goods.type == 'package' && goods.groupType != 0 && !allConditionsSatisfied.value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((goods.type == 'package' && allConditionsSatisfied.value) || (goods.type ==
|
if ((goods.type == 'package' && allConditionsSatisfied.value) || (goods.type ==
|
||||||
'sku' && canSubmit.value)) {
|
'sku' && canSubmit.value)) {
|
||||||
let res = cartStore.carts.find(cart => cart.product_id == goods.id && cart.sku_id == selSku.value.id)
|
let res = null;
|
||||||
|
if (goods.type == 'package') {
|
||||||
|
res = null
|
||||||
|
} else {
|
||||||
|
res = cartStore.carts.find(cart => cart.product_id == goods.id && cart.sku_id == selSku.value.id)
|
||||||
|
}
|
||||||
let suitNum = 1;
|
let suitNum = 1;
|
||||||
let sku_id = ''
|
let sku_id = ''
|
||||||
// 是否是套餐 有就传
|
// 是否是套餐 有就传
|
||||||
@@ -649,16 +773,30 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const boxHeight = ref(500)
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
// #ifdef MP-WEIXIN || MP-ALIPAY
|
||||||
|
const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
|
||||||
|
const systemInfo = uni.getSystemInfoSync();
|
||||||
|
const statusBarHeight = systemInfo.statusBarHeight;
|
||||||
|
// 计算标题的垂直偏移量
|
||||||
|
const verticalOffset = menuButtonInfo.top;
|
||||||
|
|
||||||
|
const titleHeight = menuButtonInfo.height;
|
||||||
|
console.log('systemInfo', systemInfo);
|
||||||
|
boxHeight.value = systemInfo.windowHeight - verticalOffset - menuButtonInfo.height - systemInfo
|
||||||
|
.safeAreaInsets.bottom - 4
|
||||||
|
|
||||||
|
// #endif
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.box {
|
.box {
|
||||||
height: 100vh;
|
background: transparent;
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
|
|
||||||
.top {
|
.scroll-view {}
|
||||||
width: 750rpx;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.shop_sku {
|
.shop_sku {
|
||||||
@@ -668,7 +806,11 @@
|
|||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
.positionabsolute {
|
.positionabsolute {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 30rpx;
|
top: 30rpx;
|
||||||
@@ -694,7 +836,7 @@
|
|||||||
padding: 0 28rpx;
|
padding: 0 28rpx;
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 32upx;
|
font-size: 32rpx;
|
||||||
margin-bottom: 16rpx;
|
margin-bottom: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -803,6 +945,7 @@
|
|||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
box-shadow: 0rpx -6rpx 14rpx 2rpx rgba(0, 0, 0, 0.1);
|
box-shadow: 0rpx -6rpx 14rpx 2rpx rgba(0, 0, 0, 0.1);
|
||||||
|
|
||||||
|
|
||||||
.price {
|
.price {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
|
|||||||
@@ -26,17 +26,18 @@
|
|||||||
<view class="limit-discount" v-if="showLimitDiscount(item)">
|
<view class="limit-discount" v-if="showLimitDiscount(item)">
|
||||||
限时折扣
|
限时折扣
|
||||||
</view>
|
</view>
|
||||||
<up-image :src="item.coverImg" width="124rpx" height="124rpx" mode="aspectFill"
|
<up-image v-if="!item.cartListinfo.is_temporary" :src="item.coverImg" width="124rpx" height="124rpx" mode="aspectFill"
|
||||||
|
radius="10"></up-image>
|
||||||
|
<up-image v-else-if="item.cartListinfo.is_temporary&&item.cartListinfo.product_name=='签子'" src="https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/5/b97054debd83486ab7ad8e20ca6a360a.png" width="124rpx" height="124rpx" mode="aspectFill"
|
||||||
|
radius="10"></up-image>
|
||||||
|
<up-image v-else width="124rpx" height="124rpx" mode="aspectFill"
|
||||||
radius="10"></up-image>
|
radius="10"></up-image>
|
||||||
</view>
|
</view>
|
||||||
<view class="info">
|
<view class="info">
|
||||||
<view class="name">
|
<view class="name" v-if=" item.cartListinfo.is_temporary == 1">
|
||||||
{{
|
{{item.cartListinfo.product_name||item.cartListinfo.name|| item.name}}
|
||||||
item.cartListinfo.is_temporary == 1
|
|
||||||
? "临时菜"
|
|
||||||
: item.name
|
|
||||||
}}
|
|
||||||
</view>
|
</view>
|
||||||
|
<view class="name" v-else>{{item.name}}</view>
|
||||||
<view class="select-sku-wrap" v-if="item.type == 'sku'">
|
<view class="select-sku-wrap" v-if="item.type == 'sku'">
|
||||||
<text v-for="i in item.skuList" :key="i.id">
|
<text v-for="i in item.skuList" :key="i.id">
|
||||||
{{ item.cartListinfo.sku_id == i.id ? i.name : "" }}
|
{{ item.cartListinfo.sku_id == i.id ? i.name : "" }}
|
||||||
@@ -206,9 +207,6 @@
|
|||||||
limitDiscount: props.limitDiscount.id ? props.limitDiscount : null,
|
limitDiscount: props.limitDiscount.id ? props.limitDiscount : null,
|
||||||
shopUserInfo: shopUserInfo,
|
shopUserInfo: shopUserInfo,
|
||||||
});
|
});
|
||||||
if (goods.name == "纯生纯生纯生") {
|
|
||||||
console.log("returnRealPrice", price);
|
|
||||||
}
|
|
||||||
return price;
|
return price;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@
|
|||||||
:class="shopInfo.isVip == 0 || shopInfo.isMemberPrice == 0 ? 'lineThrough' : ''">¥</text>
|
:class="shopInfo.isVip == 0 || shopInfo.isMemberPrice == 0 ? 'lineThrough' : ''">¥</text>
|
||||||
<!-- 会员价与价格 -->
|
<!-- 会员价与价格 -->
|
||||||
<text class="price">
|
<text class="price">
|
||||||
{{ shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1 ? item.memberPrice || item.salePrice : item.salePrice }}
|
{{ shopUserInfo.isVip == 1 && shopUserInfo.isMemberPrice == 1 ? item.memberPrice || item.salePrice : item.salePrice }}
|
||||||
</text>
|
</text>
|
||||||
<!-- 单位 -->
|
<!-- 单位 -->
|
||||||
<text class="unit" v-if="item.unitName">/{{ item.unitName }}</text>
|
<text class="unit" v-if="item.unitName">/{{ item.unitName }}</text>
|
||||||
@@ -161,9 +161,8 @@
|
|||||||
@tap.stop="$u.throttle(() => singleclick(item, '-'), 500)"></view> -->
|
@tap.stop="$u.throttle(() => singleclick(item, '-'), 500)"></view> -->
|
||||||
</view>
|
</view>
|
||||||
<!-- <text class="num">{{ ifcartNumber(item) }}</text> -->
|
<!-- <text class="num">{{ ifcartNumber(item) }}</text> -->
|
||||||
|
|
||||||
<text class="dot num"
|
<text class="dot num"
|
||||||
v-if="returnGoodsImCartNum(item1)">{{ returnGoodsImCartNum(item1) < 99 ? returnGoodsImCartNum(item1) : '99+' }}</text>
|
v-if="returnGoodsImCartNum(item)">{{ returnGoodsImCartNum(item) < 99 ? returnGoodsImCartNum(item) : '99+' }}</text>
|
||||||
<view class="btn">
|
<view class="btn">
|
||||||
<up-icon name="plus-circle-fill" color="#E9AB7A" size="25"></up-icon>
|
<up-icon name="plus-circle-fill" color="#E9AB7A" size="25"></up-icon>
|
||||||
<!-- <view class="btnClick"
|
<!-- <view class="btnClick"
|
||||||
@@ -193,6 +192,29 @@
|
|||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
<view class="main">
|
<view class="main">
|
||||||
|
<view class="u-p-r-32">
|
||||||
|
<up-swiper indicator indicatorMode="line" height="188rpx" :list="carouselList"
|
||||||
|
keyName="imageUrl">
|
||||||
|
<template #default="scope">
|
||||||
|
<view class="relative">
|
||||||
|
<image :src="scope.item.imageUrl" mode="aspectFill"
|
||||||
|
style="width:600rpx;height: 188rpx;"></image>
|
||||||
|
<view class="absolute swiper-mask" @click.stop="swiperClick(scope.item)">
|
||||||
|
<view class="share-btn-box" v-if="showShare(scope.item)">
|
||||||
|
<ymf-share
|
||||||
|
@shareClick="shareBtnClick(scope.item)"
|
||||||
|
>
|
||||||
|
<view class="share-btn">分享</view>
|
||||||
|
</ymf-share>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
</up-swiper>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view>
|
<view>
|
||||||
<view class="item main-item" v-for="(item, index) in shopProductList.productInfo" :key="index"
|
<view class="item main-item" v-for="(item, index) in shopProductList.productInfo" :key="index"
|
||||||
:id="'item-' + index">
|
:id="'item-' + index">
|
||||||
@@ -257,7 +279,7 @@
|
|||||||
<view class="money">
|
<view class="money">
|
||||||
<view>¥</view>
|
<view>¥</view>
|
||||||
<text class="money_num" style="margin-right: 10rpx">
|
<text class="money_num" style="margin-right: 10rpx">
|
||||||
{{ shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1 ? item1.memberPrice || item1.salePrice : item1.salePrice }}
|
{{ shopUserInfo.isVip == 1 && shopUserInfo.isMemberPrice == 1 ? item1.memberPrice || item1.salePrice : item1.salePrice }}
|
||||||
</text>
|
</text>
|
||||||
<text v-if="item1.unitName">/{{ item1.unitName }}</text>
|
<text v-if="item1.unitName">/{{ item1.unitName }}</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -491,7 +513,7 @@
|
|||||||
|
|
||||||
<text class="num" v-if="false">
|
<text class="num" v-if="false">
|
||||||
{{
|
{{
|
||||||
shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1
|
shopUserInfo.isVip == 1 && shopUserInfo.isMemberPrice == 1
|
||||||
? specifications.item.result.memberPrice || specifications.item.result.salePrice
|
? specifications.item.result.memberPrice || specifications.item.result.salePrice
|
||||||
: specifications.item.result.salePrice
|
: specifications.item.result.salePrice
|
||||||
}}
|
}}
|
||||||
@@ -509,7 +531,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<text class="num" v-if="false">
|
<text class="num" v-if="false">
|
||||||
{{
|
{{
|
||||||
shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1
|
shopUserInfo.isVip == 1 && shopUserInfo.isMemberPrice == 1
|
||||||
? specifications.item.memberPrice || specifications.item.salePrice
|
? specifications.item.memberPrice || specifications.item.salePrice
|
||||||
: specifications.item.salePrice
|
: specifications.item.salePrice
|
||||||
}}
|
}}
|
||||||
@@ -575,14 +597,10 @@
|
|||||||
<ModalList></ModalList>
|
<ModalList></ModalList>
|
||||||
<recommendGoodsModal v-if="isDataLoaded" @onBuyClick="onBuyClick"></recommendGoodsModal>
|
<recommendGoodsModal v-if="isDataLoaded" @onBuyClick="onBuyClick"></recommendGoodsModal>
|
||||||
|
|
||||||
<view
|
<view v-for="(item,index) in goodsModalList" :key="index">
|
||||||
v-for="(item,index) in goodsModalList" :key="index"
|
<goodsModal :key="index" v-model="item.show" :goods="item.goods" @prveImgs="prveImgs"
|
||||||
>
|
@shareClick="shareClick" @close="goodsModalClose(index)" @websocketsendMessage="websocketsendMessage"
|
||||||
<goodsModal :key="index" v-model="item.show" :goods="item.goods" @prveImgs="prveImgs" @close="goodsModalClose(index)"
|
@modalAdd="modalAdd" :GoodsIDInCartNumMap="GoodsIDInCartNumMap"></goodsModal>
|
||||||
@websocketsendMessage="websocketsendMessage"
|
|
||||||
@modalAdd="modalAdd"
|
|
||||||
:GoodsIDInCartNumMap="GoodsIDInCartNumMap"
|
|
||||||
></goodsModal>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<xbSwiperPreview :visable="showPrveImg" :imgs="prveImgsList" @update:visable="updateShowPrveImg">
|
<xbSwiperPreview :visable="showPrveImg" :imgs="prveImgsList" @update:visable="updateShowPrveImg">
|
||||||
@@ -621,6 +639,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</u-popup>
|
</u-popup>
|
||||||
|
|
||||||
|
<ymf-share-popup ></ymf-share-popup>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -654,6 +674,11 @@
|
|||||||
import {
|
import {
|
||||||
APIproductqueryShop
|
APIproductqueryShop
|
||||||
} from '@/common/api/member.js';
|
} from '@/common/api/member.js';
|
||||||
|
|
||||||
|
|
||||||
|
import {
|
||||||
|
carousel
|
||||||
|
} from '@/common/api/market/share.js'
|
||||||
/**
|
/**
|
||||||
* api合集 end
|
* api合集 end
|
||||||
*/
|
*/
|
||||||
@@ -750,7 +775,9 @@
|
|||||||
useCartStore
|
useCartStore
|
||||||
} from '@/stores/order.js';
|
} from '@/stores/order.js';
|
||||||
import {
|
import {
|
||||||
computed
|
computed,
|
||||||
|
provide,
|
||||||
|
reactive
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
const cartStore = useCartStore();
|
const cartStore = useCartStore();
|
||||||
/**
|
/**
|
||||||
@@ -762,7 +789,6 @@
|
|||||||
proxy
|
proxy
|
||||||
} = getCurrentInstance();
|
} = getCurrentInstance();
|
||||||
|
|
||||||
|
|
||||||
//点单智能推荐
|
//点单智能推荐
|
||||||
function onBuyClick(item) {
|
function onBuyClick(item) {
|
||||||
let index = -1;
|
let index = -1;
|
||||||
@@ -802,7 +828,6 @@
|
|||||||
/**
|
/**
|
||||||
* 通用数据合集 start
|
* 通用数据合集 start
|
||||||
*/
|
*/
|
||||||
const showGoodsModal = ref(false)
|
|
||||||
|
|
||||||
// 门店信息
|
// 门店信息
|
||||||
const shopInfo = reactive({});
|
const shopInfo = reactive({});
|
||||||
@@ -822,11 +847,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 分步取值 + 每层兜底,避免某一环不存在导致 undefined
|
const shopExtend = ref('');
|
||||||
const shopExtendShopTable = uni.cache.get('shopTable') || {}; // 兜底空对象
|
|
||||||
const shopExtendMap = shopExtendShopTable.shopExtendMap || {}; // 兜底空对象
|
|
||||||
// 最终声明:即使 shopinfo_bg 不存在,也兜底为空字符串/默认值
|
|
||||||
const shopExtend = ref(shopExtendMap.shopinfo_bg || '');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用数据合集 end
|
* 通用数据合集 end
|
||||||
@@ -877,11 +898,11 @@
|
|||||||
* 返回购物车对应的商品数量
|
* 返回购物车对应的商品数量
|
||||||
*/
|
*/
|
||||||
function returnGoodsImCartNum(goods) {
|
function returnGoodsImCartNum(goods) {
|
||||||
if(!goods){
|
if (!goods) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
if (GoodsIDInCartNumMap.value.hasOwnProperty(goods.id)) {
|
if (GoodsIDInCartNumMap.value.hasOwnProperty(goods.id)) {
|
||||||
GoodsIDInCartNumMap.value[goods.id]
|
return GoodsIDInCartNumMap.value[goods.id]
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@@ -999,6 +1020,79 @@
|
|||||||
uni.$u.debounce(mainScroll(res), 500);
|
uni.$u.debounce(mainScroll(res), 500);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*商品区域轮播图 start*/
|
||||||
|
|
||||||
|
const shareSwiperItem=ref(null)
|
||||||
|
function swiperClick(item) {
|
||||||
|
console.log('swiperClick',item);
|
||||||
|
shareSwiperItem.value=item
|
||||||
|
const pTag=returnPageTags(item.jumpPagePath)
|
||||||
|
|
||||||
|
if(pTag==='pp-list'){
|
||||||
|
return uni.navigateTo({
|
||||||
|
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if(pTag==='pp-detail'){
|
||||||
|
const url=item.jumpPagePath+'&shopId='+uni.cache.get('shopId')+'&'+item.extendParam
|
||||||
|
return uni.navigateTo({
|
||||||
|
url:url.replace('goodsId','id')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if(pTag==='gb-list'){
|
||||||
|
return uni.navigateTo({
|
||||||
|
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if(pTag==='gb-detail'){
|
||||||
|
const url=item.jumpPagePath+'&shopId='+uni.cache.get('shopId')+'&'+item.extendParam
|
||||||
|
return uni.navigateTo({
|
||||||
|
url:url.replace('goodsId','wareId')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if(pTag==='dis'){
|
||||||
|
return uni.navigateTo({
|
||||||
|
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if(pTag==='index'){
|
||||||
|
return uni.switchTab({
|
||||||
|
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pTag==='eat'){
|
||||||
|
if (item.extendParam) {
|
||||||
|
const id=item.extendParam.split('=')[1]
|
||||||
|
const item = allGoodsArr.value.find(v => v.id == id)
|
||||||
|
if (item) {
|
||||||
|
clickspecifications(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pTag==='point'){
|
||||||
|
return uni.navigateTo({
|
||||||
|
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if(pTag==='point-detail'){
|
||||||
|
const url=item.jumpPagePath+'&shopId='+uni.cache.get('shopId')+'&'+item.extendParam
|
||||||
|
return uni.navigateTo({
|
||||||
|
url:url.replace('goodsId','id')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function showShare(item){
|
||||||
|
if(item.isShareable&&item.isEnabled){
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
/*商品区域轮播图 end*/
|
||||||
// 点击详情
|
// 点击详情
|
||||||
const showShopsku = ref(false);
|
const showShopsku = ref(false);
|
||||||
|
|
||||||
@@ -1373,12 +1467,13 @@
|
|||||||
prveImgs(res.images);
|
prveImgs(res.images);
|
||||||
}
|
}
|
||||||
|
|
||||||
const goodsModalList=ref([])
|
const goodsModalList = ref([])
|
||||||
|
|
||||||
function goodsModalClose(index){
|
function goodsModalClose(index) {
|
||||||
goodsModalList.value.splice(index,1)
|
goodsModalList.value.splice(index, 1)
|
||||||
}
|
}
|
||||||
function modalAdd(item){
|
|
||||||
|
function modalAdd(item) {
|
||||||
clickspecifications(item)
|
clickspecifications(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1398,8 +1493,8 @@
|
|||||||
|
|
||||||
if (item.isSoldStock == 1 || (item.isSaleTime == 0 && !item.isSaleTimeshow)) {
|
if (item.isSoldStock == 1 || (item.isSaleTime == 0 && !item.isSaleTimeshow)) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
title:'商品已下架或不在可售时间内',
|
title: '商品已下架或不在可售时间内',
|
||||||
icon:'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1447,13 +1542,20 @@
|
|||||||
specifications.item.amountcartNumber = 0;
|
specifications.item.amountcartNumber = 0;
|
||||||
// showShopsku.value = true;
|
// showShopsku.value = true;
|
||||||
goodsModalList.value.push({
|
goodsModalList.value.push({
|
||||||
show:true,
|
show: true,
|
||||||
goods:specifications.item
|
goods: {
|
||||||
|
...specifications.item,
|
||||||
|
/*过滤掉只有一个规格且下架的商品或者skuList为空的商品*/
|
||||||
|
relatedRecommendJson: (specifications.item.relatedRecommendJson || []).filter(v => v
|
||||||
|
.skuList && v.skuList.length)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
// showGoodsModal.value=true
|
|
||||||
};
|
};
|
||||||
// 判断商品是否在可售时间内
|
// 判断商品是否在可售时间内
|
||||||
const isProductAvailable = async (sellDaysStr, startTimeStr, endTimeStr) => {
|
const isProductAvailable = async (sellDaysStr, startTimeStr, endTimeStr) => {
|
||||||
|
if(!sellDaysStr){
|
||||||
|
return false
|
||||||
|
}
|
||||||
// 将后端返回的字符串转换为数组
|
// 将后端返回的字符串转换为数组
|
||||||
const sellDays = sellDaysStr.split(',');
|
const sellDays = sellDaysStr.split(',');
|
||||||
const now = dayjs();
|
const now = dayjs();
|
||||||
@@ -1692,12 +1794,13 @@
|
|||||||
const goodsSkuList = goods ? goods.skuList : []
|
const goodsSkuList = goods ? goods.skuList : []
|
||||||
const findSku = goodsSkuList.find(sku => sku.id == v.sku_id)
|
const findSku = goodsSkuList.find(sku => sku.id == v.sku_id)
|
||||||
const memberPrice = findSku ? findSku.memberPrice : 0
|
const memberPrice = findSku ? findSku.memberPrice : 0
|
||||||
|
const is_temporary = v.is_temporary || v.isTemporary
|
||||||
const is_time_discount = limitUtils.canUseLimitTimeDiscount({
|
const is_time_discount = limitUtils.canUseLimitTimeDiscount({
|
||||||
...v,
|
...v,
|
||||||
memberPrice
|
memberPrice
|
||||||
}, cartStore.limitTimeDiscount, shopInfo,
|
}, cartStore.limitTimeDiscount, shopInfo,
|
||||||
shopUserInfo.value, 'product_id');
|
shopUserInfo.value, 'product_id');
|
||||||
if (!goods) {
|
if (!goods && !is_temporary) {
|
||||||
console.log('删除未匹配到的商品', {
|
console.log('删除未匹配到的商品', {
|
||||||
id: v.id,
|
id: v.id,
|
||||||
operate_type: "del",
|
operate_type: "del",
|
||||||
@@ -1764,8 +1867,11 @@
|
|||||||
if (Message.operate_type == 'init') {
|
if (Message.operate_type == 'init') {
|
||||||
// cartStore.limitTimeDiscount = Message.time_dis_info;
|
// cartStore.limitTimeDiscount = Message.time_dis_info;
|
||||||
cartInit(Message.data)
|
cartInit(Message.data)
|
||||||
|
try {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
|
} catch (error) {
|
||||||
|
//TODO handle the exception
|
||||||
|
}
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
|
|
||||||
if (!socketInitFinished) {
|
if (!socketInitFinished) {
|
||||||
@@ -2194,7 +2300,7 @@
|
|||||||
// 列表请求
|
// 列表请求
|
||||||
const productqueryProduct = async () => {
|
const productqueryProduct = async () => {
|
||||||
cartStore.goodsIsloading = false;
|
cartStore.goodsIsloading = false;
|
||||||
allGoodsArr.value=[]
|
allGoodsArr.value = []
|
||||||
try {
|
try {
|
||||||
shopProductList.hots = await productminiApphotsquery();
|
shopProductList.hots = await productminiApphotsquery();
|
||||||
shopProductList.productInfo = await APIgroupquery();
|
shopProductList.productInfo = await APIgroupquery();
|
||||||
@@ -2237,7 +2343,7 @@
|
|||||||
// console.log('allGoodsArr', allGoodsArr);
|
// console.log('allGoodsArr', allGoodsArr);
|
||||||
// console.log('shopProductList', shopProductList);
|
// console.log('shopProductList', shopProductList);
|
||||||
console.log('cartStore.carts', cartStore.carts)
|
console.log('cartStore.carts', cartStore.carts)
|
||||||
cartStore.allGoodsArr=allGoodsArr.value
|
cartStore.allGoodsArr = allGoodsArr.value
|
||||||
if (cartStore.carts.length > 0) {
|
if (cartStore.carts.length > 0) {
|
||||||
cartInit(cartStore.carts);
|
cartInit(cartStore.carts);
|
||||||
}
|
}
|
||||||
@@ -2259,6 +2365,16 @@
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pageOptions.showGoodsId) {
|
||||||
|
const item = allGoodsArr.value.find(v => v.id == pageOptions.showGoodsId)
|
||||||
|
if (item) {
|
||||||
|
clickspecifications(item)
|
||||||
|
}
|
||||||
|
pageOptions.showGoodsId = null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
provide('cartStore', cartStore);
|
provide('cartStore', cartStore);
|
||||||
@@ -2440,28 +2556,130 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
import {
|
||||||
|
shareMixin,
|
||||||
|
handleMixinOnLoad,
|
||||||
|
returnQuery,
|
||||||
|
jsonToUrl,
|
||||||
|
wxShare,returnPageTags,
|
||||||
|
returnCommonQuery
|
||||||
|
} from '@/utils/share.js'
|
||||||
|
// defineOptions({
|
||||||
|
// mixins: [shareMixin],
|
||||||
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
let isGoodsShare = ref(false)
|
||||||
|
|
||||||
|
function shareClick() {
|
||||||
|
isGoodsShare.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPage(pageStr){
|
||||||
|
|
||||||
|
}
|
||||||
|
function shareBtnClick(item){
|
||||||
|
console.log('shareBtnClick',item);
|
||||||
|
shareSwiperItem.value=item
|
||||||
|
}
|
||||||
|
function swiperShare(queryJson){
|
||||||
|
console.log('shareSwiperItem',shareSwiperItem.value);
|
||||||
|
const pTag=returnPageTags(shareSwiperItem.value.jumpPagePath)
|
||||||
|
let query = jsonToUrl(queryJson)
|
||||||
|
query +=('&'+shareSwiperItem.value.extendParam)
|
||||||
|
const shopName = uni.cache.get('shopInfo').shopName || ''
|
||||||
|
const path=shareSwiperItem.value.jumpPagePath?shareSwiperItem.value.jumpPagePath:'/pages/product/index?type=beforehand'
|
||||||
|
console.log('path',path);
|
||||||
|
const json={
|
||||||
|
imageUrl:shareSwiperItem.value.imageUrl,
|
||||||
|
path: path+'&'+query,
|
||||||
|
title:shareSwiperItem.value.name+ (shopName ? `-${shopName}` : ''),
|
||||||
|
}
|
||||||
|
if(pTag==='pp-detail'){
|
||||||
|
json.path=json.path.replace('goodsId','id')
|
||||||
|
}
|
||||||
|
if(pTag==='gb-detail'){
|
||||||
|
json.path=json.path.replace('goodsId','wareId')
|
||||||
|
}
|
||||||
|
if(pTag==='point-detail'){
|
||||||
|
json.path=json.path.replace('goodsId','id')
|
||||||
|
}
|
||||||
|
if(pTag.includes('eat')){
|
||||||
|
if(shareSwiperItem.value.extendParam){
|
||||||
|
json.path=json.path.replace('goodsId','showGoodsId')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return wxShare(json)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async function onShare() {
|
||||||
|
const queryJson = await returnCommonQuery()
|
||||||
|
if(shareSwiperItem.value){
|
||||||
|
return swiperShare(queryJson)
|
||||||
|
}
|
||||||
|
let query = jsonToUrl(queryJson)
|
||||||
|
query += '&type=beforehand'
|
||||||
|
let json = {}
|
||||||
|
const shopName = uni.cache.get('shopInfo').shopName || ''
|
||||||
|
if (goodsModalList.value.length && isGoodsShare.value) {
|
||||||
|
const goods = goodsModalList.value[goodsModalList.value.length - 1].goods
|
||||||
|
query += '&showGoodsId=' + goods.id
|
||||||
|
json.title = goods.name + (shopName ? `-${shopName}` : '')
|
||||||
|
json.imageUrl = goods.coverImg
|
||||||
|
json.showGoodsId = goods.id
|
||||||
|
} else {
|
||||||
|
json.title = shopName
|
||||||
|
json.imageUrl = uni.cache.get('shopInfo').logo || ''
|
||||||
|
}
|
||||||
|
|
||||||
|
return wxShare({
|
||||||
|
query,
|
||||||
|
...json,
|
||||||
|
path: '/pages/product/index' + '?' + query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
onShareAppMessage(onShare)
|
||||||
|
|
||||||
|
onShareTimeline(onShare)
|
||||||
|
|
||||||
|
const pageOptions = reactive({})
|
||||||
|
|
||||||
|
const carouselList = ref([])
|
||||||
onLoad(async (e) => {
|
onLoad(async (e) => {
|
||||||
|
Object.assign(pageOptions, e)
|
||||||
if (e.type) {
|
if (e.type) {
|
||||||
orderType.value = e.type;
|
orderType.value = e.type;
|
||||||
}
|
}
|
||||||
//获取用户信息
|
|
||||||
const userInfo = await APIshopUserInfo({
|
await handleMixinOnLoad({
|
||||||
shopId: uni.cache.get('shopId')
|
...e,
|
||||||
|
shopId: e.shopId || uni.cache.get('shopId')
|
||||||
})
|
})
|
||||||
//获取店铺信息
|
|
||||||
const shopInfoRes = await APIusershopInfodetail({
|
if (userStore.shopUserInfo.shopExtendList) {
|
||||||
shopId: uni.cache.get('shopId')
|
shopExtend.value = userStore.shopUserInfo.shopExtendList.find(v => v.autoKey == 'shopinfo_bg') ||
|
||||||
});
|
''
|
||||||
if (shopInfoRes && shopInfoRes.shopInfo) {
|
|
||||||
Object.assign(shopInfo, shopInfoRes.shopInfo);
|
|
||||||
uni.cache.set('shopInfo', shopInfoRes.shopInfo)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// //获取用户信息
|
||||||
if (userInfo && typeof userInfo === 'object') {
|
// const userInfo = await APIshopUserInfo({
|
||||||
shopUserInfo.value = userInfo
|
// shopId: uni.cache.get('shopId')
|
||||||
uni.cache.set('shopUserInfo', userInfo)
|
// })
|
||||||
|
// //获取店铺信息
|
||||||
|
// const shopInfoRes = await APIusershopInfodetail({
|
||||||
|
// shopId: uni.cache.get('shopId')
|
||||||
|
// });
|
||||||
|
Object.assign(shopInfo, userStore.shopInfo);
|
||||||
|
if (e.type == 'beforehand') {
|
||||||
|
uni.cache.set("tableCode", userStore.shopUserInfo.id);
|
||||||
|
options.initMessage.table_code = userStore.shopUserInfo.id
|
||||||
}
|
}
|
||||||
|
options.initMessage.shop_id = userStore.shopInfo.id
|
||||||
|
shopUserInfo.value = userStore.shopUserInfo
|
||||||
|
|
||||||
await productqueryProduct();
|
await productqueryProduct();
|
||||||
|
|
||||||
const extraInitPar = {}
|
const extraInitPar = {}
|
||||||
@@ -2473,6 +2691,11 @@
|
|||||||
|
|
||||||
const time_dis_info = await getLimitDiscount()
|
const time_dis_info = await getLimitDiscount()
|
||||||
options.initMessage.time_dis_info = time_dis_info
|
options.initMessage.time_dis_info = time_dis_info
|
||||||
|
|
||||||
|
console.log('options.initMessage', {
|
||||||
|
...options.initMessage,
|
||||||
|
...extraInitPar,
|
||||||
|
})
|
||||||
useSocket.connect({
|
useSocket.connect({
|
||||||
...options.initMessage,
|
...options.initMessage,
|
||||||
...extraInitPar,
|
...extraInitPar,
|
||||||
@@ -2489,6 +2712,13 @@
|
|||||||
// 满减活动
|
// 满减活动
|
||||||
getDiscountActivity();
|
getDiscountActivity();
|
||||||
|
|
||||||
|
//分享轮播
|
||||||
|
carousel({
|
||||||
|
shopId: uni.cache.get('shopId')
|
||||||
|
}).then(res => {
|
||||||
|
carouselList.value = res
|
||||||
|
})
|
||||||
|
|
||||||
let res = await APIhistoryOrder({
|
let res = await APIhistoryOrder({
|
||||||
tableCode: uni.cache.get('tableCode')
|
tableCode: uni.cache.get('tableCode')
|
||||||
});
|
});
|
||||||
@@ -2593,6 +2823,8 @@
|
|||||||
useSocket.setOnMessage(() => {});
|
useSocket.setOnMessage(() => {});
|
||||||
}
|
}
|
||||||
onHide(() => {
|
onHide(() => {
|
||||||
|
isGoodsShare.value = false
|
||||||
|
shareSwiperItem.value=null
|
||||||
closeSocket();
|
closeSocket();
|
||||||
});
|
});
|
||||||
onUnload(() => {
|
onUnload(() => {
|
||||||
@@ -3833,4 +4065,26 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.swiper-mask {
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
padding: 32rpx 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.share-btn-box{
|
||||||
|
position: absolute;
|
||||||
|
right: 8rpx;
|
||||||
|
bottom: 14rpx;
|
||||||
|
}
|
||||||
|
.share-btn {
|
||||||
|
|
||||||
|
padding: 10rpx 32rpx;
|
||||||
|
border-radius: 50rpx;
|
||||||
|
background: #E3AD7F;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,461 +1,498 @@
|
|||||||
<!-- 充值中心 -->
|
<!-- 充值中心 -->
|
||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<up-navbar
|
<up-navbar bgColor="transparent" title="充值中心" @leftClick="back"></up-navbar>
|
||||||
bgColor="transparent"
|
<view class="header-wrap">
|
||||||
title="充值中心"
|
<image class="bg" src="/static/czzx_header_bg.png" mode="aspectFill"></image>
|
||||||
@leftClick="back"
|
<view class="select-shop">
|
||||||
></up-navbar>
|
<view class="select-btn">
|
||||||
<view class="header-wrap">
|
<up-icon name="map" color="#333"></up-icon>
|
||||||
<image
|
<text class="t">{{ shopInfo.shopName }}</text>
|
||||||
class="bg"
|
<up-icon name="arrow-right" color="#333"></up-icon>
|
||||||
src="/static/czzx_header_bg.png"
|
</view>
|
||||||
mode="aspectFill"
|
<ymf-share></ymf-share>
|
||||||
></image>
|
</view>
|
||||||
<view class="select-shop">
|
<view class="balance-wrap">
|
||||||
<view class="select-btn">
|
<view class="left">
|
||||||
<up-icon name="map" color="#333"></up-icon>
|
<text class="i t">余额</text>
|
||||||
<text class="t">{{ shopInfo.shopName }}</text>
|
<text class="n t">{{ shopUserInfo.amount || 0 }}</text>
|
||||||
<up-icon name="arrow-right" color="#333"></up-icon>
|
</view>
|
||||||
</view>
|
<view class="right">
|
||||||
</view>
|
<text class="t" @click="toduihuan">兑换码</text>
|
||||||
<view class="balance-wrap">
|
<text class="t" @click="toDetail">明细</text>
|
||||||
<view class="left">
|
<text class="t" @click="toPwd">密码设置</text>
|
||||||
<text class="i t">余额</text>
|
</view>
|
||||||
<text class="n t">{{ shopUserInfo.amount || 0 }}</text>
|
</view>
|
||||||
</view>
|
<view class="btm-wrap">
|
||||||
<view class="right">
|
<view class=""></view>
|
||||||
<text class="t" @click="toduihuan">兑换码</text>
|
</view>
|
||||||
<text class="t" @click="toDetail">明细</text>
|
</view>
|
||||||
<text class="t" @click="toPwd">密码设置</text>
|
<view class="bottom">
|
||||||
</view>
|
<view class="u-flex u-flex-between">
|
||||||
</view>
|
<view class="u-flex">
|
||||||
<view class="btm-wrap">
|
<image src="/static/vip/money.png" style="width: 44rpx; height: 44rpx" mode=""></image>
|
||||||
<view class=""> </view>
|
<text class="u-m-l-24 color-333 font-16 font-700">立即充值</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view class="font-12 color-999">
|
||||||
<view class="bottom">
|
<text>充值代表接受</text>
|
||||||
<view class="u-flex u-flex-between">
|
<text style="color: #ecb592">《用户隐私协议》</text>
|
||||||
<view class="u-flex">
|
</view>
|
||||||
<image
|
</view>
|
||||||
src="/static/vip/money.png"
|
<view class="list u-m-t-40">
|
||||||
style="width: 44rpx; height: 44rpx"
|
<view class="item color1" @click="sel = index" v-for="(item, index) in list" :key="index" :class="{ active: sel == index }">
|
||||||
mode=""
|
<view class="">
|
||||||
></image>
|
<text>¥</text>
|
||||||
<text class="u-m-l-24 color-333 font-16 font-700">立即充值</text>
|
<text class="font-700" style="font-size: 48 u-flex-1rpx" :class="{ color2: sel == index }">{{ item.amount }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="font-12 color-999">
|
<view class="font-12" v-if="item.rewardAmount" :class="{ color2: sel == index }">
|
||||||
<text>充值代表接受</text>
|
<text>赠</text>
|
||||||
<text style="color: #ecb592">《用户隐私协议》</text>
|
<text>¥</text>
|
||||||
</view>
|
<text class="font-14">{{ item.rewardAmount }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="list u-m-t-40">
|
<view class="font-12" v-if="item.rewardPoints" style="color: #5f2e0f">
|
||||||
<view
|
<text>送</text>
|
||||||
class="item color1"
|
<text class="font-14">{{ item.rewardPoints }}</text>
|
||||||
@click="sel = index"
|
<text class="">积分</text>
|
||||||
v-for="(item, index) in list"
|
</view>
|
||||||
:key="index"
|
<view class="font-12 color-666" v-if="item.couponInfoList.length">
|
||||||
:class="{ active: sel == index }"
|
<text>送</text>
|
||||||
>
|
<text>{{ couponNum(item.couponInfoList) }}</text>
|
||||||
<view class="">
|
<text>张券</text>
|
||||||
<text>¥</text>
|
<text class="color2 u-m-l-8" v-if="sel == index" @click="lookCoupon(item)">查看</text>
|
||||||
<text
|
</view>
|
||||||
class="font-700"
|
|
||||||
style="font-size: 48 u-flex-1rpx"
|
|
||||||
:class="{ color2: sel == index }"
|
|
||||||
>{{ item.amount }}</text
|
|
||||||
>
|
|
||||||
</view>
|
|
||||||
<view
|
|
||||||
class="font-12"
|
|
||||||
v-if="item.rewardAmount"
|
|
||||||
:class="{ color2: sel == index }"
|
|
||||||
>
|
|
||||||
<text>赠</text>
|
|
||||||
<text>¥</text>
|
|
||||||
<text class="font-14">{{ item.rewardAmount }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="font-12" v-if="item.rewardPoints" style="color: #5f2e0f">
|
|
||||||
<text>送</text>
|
|
||||||
<text class="font-14">{{ item.rewardPoints }}</text>
|
|
||||||
<text class="">积分</text>
|
|
||||||
</view>
|
|
||||||
<view class="font-12 color-666" v-if="item.couponInfoList.length">
|
|
||||||
<text>送</text>
|
|
||||||
<text>{{ couponNum(item.couponInfoList) }}</text>
|
|
||||||
<text>张券</text>
|
|
||||||
<text
|
|
||||||
class="color2 u-m-l-8"
|
|
||||||
v-if="sel == index"
|
|
||||||
@click="lookCoupon(item)"
|
|
||||||
>查看</text
|
|
||||||
>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="sel u-flex" v-if="sel == index">
|
<view class="sel u-flex" v-if="sel == index">
|
||||||
<image class="image" src="/static/vip/sel.png" mode=""></image>
|
<image class="image" src="/static/vip/sel.png" mode=""></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<template v-if="state.isCustom">
|
<template v-if="state.isCustom">
|
||||||
<view class="u-flex other flex-center">
|
<view class="u-flex other flex-center">
|
||||||
<text class="font-14 color-333 font-700 u-m-r-28">其他金额</text>
|
<text class="font-14 color-333 font-700 u-m-r-28">其他金额</text>
|
||||||
<up-input
|
<up-input v-model="money" type="number" placeholder="请输入充值金额" border="none" placeholder-style="font-size:14px;"></up-input>
|
||||||
v-model="money"
|
</view>
|
||||||
type="number"
|
<view class="color-999 font-12 u-m-t-4">自定义金额充值时,不享受任何优惠赠送</view>
|
||||||
placeholder="请输入充值金额"
|
</template>
|
||||||
border="none"
|
|
||||||
placeholder-style="font-size:14px;"
|
|
||||||
></up-input>
|
|
||||||
</view>
|
|
||||||
<view class="color-999 font-12 u-m-t-4"
|
|
||||||
>自定义金额充值时,不享受任何优惠赠送</view
|
|
||||||
>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<button
|
<button class="buy-btn" @click="buy" :class="{ disabled: !state.isEnable }">
|
||||||
class="buy-btn"
|
<text class="font-16">¥{{ charge_money }}</text>
|
||||||
@click="buy"
|
<text class="font-14 u-m-l-24">立即充值</text>
|
||||||
:class="{ disabled: !state.isEnable }"
|
</button>
|
||||||
>
|
<view class="u-m-t-36 color-999 font-12">
|
||||||
<text class="font-16">¥{{ charge_money }}</text>
|
<view>充值说明</view>
|
||||||
<text class="font-14 u-m-l-24">立即充值</text>
|
<view class="u-m-t-16">
|
||||||
</button>
|
<text>适用门店</text>
|
||||||
<view class="u-m-t-36 color-999 font-12">
|
<text class="color2 u-m-l-28" @click="toShopList">全国门店通用 {{ '>' }}</text>
|
||||||
<view>充值说明</view>
|
</view>
|
||||||
<view class="u-m-t-16">
|
<view class="u-m-t-16">
|
||||||
<text>适用门店</text>
|
<text>有效期限</text>
|
||||||
<text class="color2 u-m-l-28" @click="toShopList"
|
<text class="u-m-l-28">永久有效</text>
|
||||||
>全国门店通用 {{ ">" }}
|
</view>
|
||||||
</text>
|
<view class="u-m-t-16 u-flex u-flex-y-center">
|
||||||
</view>
|
<text class="no-wrap">注意事项</text>
|
||||||
<view class="u-m-t-16">
|
<view class="u-m-l-28">
|
||||||
<text>有效期限</text>
|
<view>1.储值完成后不支持自助退款,可联系商家处理</view>
|
||||||
<text class="u-m-l-28">永久有效 </text>
|
<view>2.余额不支持转赠,不可提现,长期有效</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-m-t-16 u-flex u-flex-y-center">
|
</view>
|
||||||
<text class="no-wrap">注意事项</text>
|
<view class="u-m-t-16 u-flex u-flex-y-center">
|
||||||
<view class="u-m-l-28">
|
<text class="no-wrap">充值说明</text>
|
||||||
<view>1.储值完成后不支持自助退款,可联系商家处理</view>
|
<text class="u-m-l-28" style="word-break: break-all">
|
||||||
<view> 2.余额不支持转赠,不可提现,长期有效</view>
|
{{ state.remark || '' }}
|
||||||
</view>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-m-t-16 u-flex u-flex-y-center">
|
</view>
|
||||||
<text class="no-wrap">充值说明</text>
|
</view>
|
||||||
<text class="u-m-l-28" style="word-break: break-all">
|
<CouponList v-model="couponModel.show" :list="couponModel.couponInfoList"></CouponList>
|
||||||
{{ state.remark || "" }}
|
</view>
|
||||||
</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<CouponList
|
|
||||||
v-model="couponModel.show"
|
|
||||||
:list="couponModel.couponInfoList"
|
|
||||||
></CouponList>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { APIusershopInfodetail, APIshopUserInfo } from "@/common/api/member.js";
|
import ymfShare from '@/components/ymf-components/ymf-share.vue';
|
||||||
import CouponList from "@/components/coupon/list.vue";
|
import { shareMixin, handleMixinOnLoad, returnQuery } from '@/utils/share.js';
|
||||||
import * as rechargeApi from "@/common/api/market/recharge.js";
|
import { APIusershopInfodetail, APIshopUserInfo } from '@/common/api/member.js';
|
||||||
import { recharge } from "@/common/api/order/index.js";
|
import CouponList from '@/components/coupon/list.vue';
|
||||||
import { joinMember } from "@/common/api/order/index.js";
|
import * as rechargeApi from '@/common/api/market/recharge.js';
|
||||||
import { ref, onMounted, computed, reactive, watch } from "vue";
|
import { recharge } from '@/common/api/order/index.js';
|
||||||
import { onLoad, onShow } from "@dcloudio/uni-app";
|
import { joinMember } from '@/common/api/order/index.js';
|
||||||
import { pay } from "@/utils/pay.js";
|
import { ref, onMounted, computed, reactive, watch } from 'vue';
|
||||||
|
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||||
|
import { pay } from '@/utils/pay.js';
|
||||||
|
|
||||||
function toShopList() {
|
function toShopList() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/user/member/czzx-shop-list?shopId=" + option.shopId,
|
url: '/pages/user/member/czzx-shop-list?shopId=' + option.shopId
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function toduihuan() {
|
function toduihuan() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/user/exchange/index",
|
url: '/user/exchange/index'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function couponNum(list) {
|
function couponNum(list) {
|
||||||
return list.reduce((prve, cur) => {
|
return list.reduce((prve, cur) => {
|
||||||
return prve + cur.num;
|
return prve + cur.num;
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
const couponModel = reactive({
|
const couponModel = reactive({
|
||||||
show: false,
|
show: false,
|
||||||
couponInfoList: [],
|
couponInfoList: []
|
||||||
});
|
});
|
||||||
|
|
||||||
function lookCoupon(item) {
|
function lookCoupon(item) {
|
||||||
couponModel.show = true;
|
couponModel.show = true;
|
||||||
couponModel.couponInfoList = item.couponInfoList;
|
couponModel.couponInfoList = item.couponInfoList;
|
||||||
}
|
}
|
||||||
async function buy() {
|
async function buy() {
|
||||||
if (!state.isEnable) {
|
if (!state.isEnable) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
title: "充值未开启,暂不能充值",
|
title: '充值未开启,暂不能充值',
|
||||||
icon: "none",
|
icon: 'none'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!charge_money.value) {
|
if (!charge_money.value) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
title: "请选择或者输入充值金额",
|
title: '请选择或者输入充值金额',
|
||||||
icon: "none",
|
icon: 'none'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const json = {
|
const json = {
|
||||||
shopId: option.shopId,
|
shopId: option.shopId,
|
||||||
shopUserId: shopUserInfo.id,
|
shopUserId: shopUserInfo.id
|
||||||
};
|
};
|
||||||
if (sel.value < 0) {
|
if (sel.value < 0) {
|
||||||
json.amount = `${money.value}`.trim() * 1;
|
json.amount = `${money.value}`.trim() * 1;
|
||||||
} else {
|
} else {
|
||||||
json.rechargeDetailId = list.value[sel.value].id;
|
json.rechargeDetailId = list.value[sel.value].id;
|
||||||
json.amount = list.value[sel.value].amount;
|
json.amount = list.value[sel.value].amount;
|
||||||
}
|
}
|
||||||
const res = await recharge(json);
|
const res = await recharge(json);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
title: "充值失败",
|
title: '充值失败',
|
||||||
icon: "error",
|
icon: 'error'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const payRes = await pay(res);
|
const payRes = await pay(res);
|
||||||
console.log(payRes);
|
console.log(payRes);
|
||||||
if (payRes) {
|
if (payRes) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "充值成功",
|
title: '充值成功',
|
||||||
icon: "none",
|
icon: 'none'
|
||||||
});
|
});
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toDetail() {
|
function toDetail() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/user/member/billDetails?type=1&shopId=" + option.shopId,
|
url: '/pages/user/member/billDetails?type=1&shopId=' + option.shopId
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function toPwd() {
|
function toPwd() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/user/member/setPassword?type=1&shopId=" + option.shopId,
|
url: '/pages/user/member/setPassword?type=1&shopId=' + option.shopId
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function back() {
|
function back() {
|
||||||
uni.navigateBack();
|
safeNavigateBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修复版:安全的页面返回方法
|
||||||
|
* 彻底避免 "cannot navigate back at first page" 报错
|
||||||
|
* @param {Number} delta 返回的页面数,默认1
|
||||||
|
* @param {Function} fallback 失败时的降级处理函数
|
||||||
|
*/
|
||||||
|
function safeNavigateBack(delta = 1, fallback) {
|
||||||
|
// 1. 立即获取页面栈,确保拿到最新状态(关键修复点)
|
||||||
|
const pages = getCurrentPages();
|
||||||
|
// 2. 严谨判断:页面栈长度必须大于 delta 才能返回
|
||||||
|
const canNavigateBack = pages.length > delta;
|
||||||
|
|
||||||
|
console.log('页面栈信息:', {
|
||||||
|
pagesLength: pages.length,
|
||||||
|
delta: delta,
|
||||||
|
canNavigateBack: canNavigateBack
|
||||||
|
});
|
||||||
|
|
||||||
|
// 3. 如果不能返回,直接执行降级逻辑
|
||||||
|
if (!canNavigateBack) {
|
||||||
|
console.warn('当前是首页/页面栈不足,无法返回');
|
||||||
|
handleFallback(fallback);
|
||||||
|
return; // 终止后续执行,彻底避免调用 navigateBack
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 能返回时才执行 navigateBack
|
||||||
|
try {
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: delta,
|
||||||
|
success: () => {
|
||||||
|
console.log('页面返回成功');
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('navigateBack 执行失败:', err);
|
||||||
|
handleFallback(fallback);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('页面返回异常:', error);
|
||||||
|
handleFallback(fallback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统一处理降级逻辑
|
||||||
|
* @param {Function} fallback 自定义降级函数
|
||||||
|
*/
|
||||||
|
function handleFallback(fallback) {
|
||||||
|
if (typeof fallback === 'function') {
|
||||||
|
fallback(); // 执行自定义降级
|
||||||
|
} else {
|
||||||
|
// 默认降级:返回首页(请替换为你的首页路径)
|
||||||
|
uni.showToast({
|
||||||
|
title: '已到首页,无法返回',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
|
||||||
|
// 如果需要强制跳首页,解开下面注释(根据你的业务选择)
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/index/index',
|
||||||
|
fail: () => {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/index/index'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const list = ref([]);
|
const list = ref([]);
|
||||||
const sel = ref(0);
|
const sel = ref(0);
|
||||||
const money = ref(null);
|
const money = ref(null);
|
||||||
const option = reactive({
|
const option = reactive({
|
||||||
shopId: "",
|
shopId: ''
|
||||||
});
|
});
|
||||||
const shopInfo = reactive({});
|
const shopInfo = reactive({});
|
||||||
const shopUserInfo = reactive({});
|
const shopUserInfo = reactive({});
|
||||||
const state = reactive({});
|
const state = reactive({});
|
||||||
async function init() {
|
async function init() {
|
||||||
const shopInfoRes = await APIusershopInfodetail({
|
const shopInfoRes = await APIusershopInfodetail({
|
||||||
shopId: option.shopId,
|
shopId: option.shopId
|
||||||
});
|
});
|
||||||
if (shopInfoRes) {
|
if (shopInfoRes) {
|
||||||
Object.assign(shopInfo, shopInfoRes.shopInfo);
|
Object.assign(shopInfo, shopInfoRes.shopInfo);
|
||||||
}
|
}
|
||||||
const shopUserInfoRes = await APIshopUserInfo({
|
const shopUserInfoRes = await APIshopUserInfo({
|
||||||
shopId: option.shopId,
|
shopId: option.shopId
|
||||||
});
|
});
|
||||||
if (shopUserInfoRes) {
|
if (shopUserInfoRes) {
|
||||||
Object.assign(shopUserInfo, shopUserInfoRes);
|
Object.assign(shopUserInfo, shopUserInfoRes);
|
||||||
}
|
}
|
||||||
const res = await rechargeApi.config({
|
const res = await rechargeApi.config({
|
||||||
shopId: option.shopId,
|
shopId: option.shopId
|
||||||
});
|
});
|
||||||
if (res) {
|
if (res) {
|
||||||
Object.assign(state, res);
|
Object.assign(state, res);
|
||||||
list.value = res.rechargeDetailList;
|
list.value = res.rechargeDetailList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const charge_money = computed(() => {
|
const charge_money = computed(() => {
|
||||||
if (sel.value < 0) {
|
if (sel.value < 0) {
|
||||||
if (money.value > 0) {
|
if (money.value > 0) {
|
||||||
return money.value;
|
return money.value;
|
||||||
}
|
}
|
||||||
return "";
|
return '';
|
||||||
}
|
}
|
||||||
const item = list.value[sel.value];
|
const item = list.value[sel.value];
|
||||||
if (item) {
|
if (item) {
|
||||||
return item.amount;
|
return item.amount;
|
||||||
}
|
}
|
||||||
return "";
|
return '';
|
||||||
});
|
});
|
||||||
onLoad((opt) => {
|
|
||||||
Object.assign(option, opt);
|
onShareAppMessage(async (res) => {
|
||||||
// init();
|
let query = await returnQuery();
|
||||||
|
return {
|
||||||
|
title: `充值-${shopInfo.shopName}`,
|
||||||
|
path: `/pages/user/member/czzx?${query}`,
|
||||||
|
imageUrl: shopInfo.logo,
|
||||||
|
query
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
onLoad(async (opt) => {
|
||||||
|
Object.assign(option, opt);
|
||||||
|
await handleMixinOnLoad(opt);
|
||||||
|
// init();
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => money.value,
|
() => money.value,
|
||||||
(newval) => {
|
(newval) => {
|
||||||
if (newval && newval > 0) {
|
if (newval && newval > 0) {
|
||||||
sel.value = -1;
|
sel.value = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
init();
|
init();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.color1 {
|
.color1 {
|
||||||
color: #5f2e0f;
|
color: #5f2e0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
.color2 {
|
.color2 {
|
||||||
color: #ff6300;
|
color: #ff6300;
|
||||||
}
|
}
|
||||||
|
|
||||||
.buy-btn {
|
.buy-btn {
|
||||||
margin-top: 28rpx;
|
margin-top: 28rpx;
|
||||||
padding: 32rpx 32rpx;
|
padding: 32rpx 32rpx;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
border-radius: 80rpx;
|
border-radius: 80rpx;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
background: linear-gradient(98deg, #fe6d1100 40.64%, #ffd1b4 105.2%),
|
background: linear-gradient(98deg, #fe6d1100 40.64%, #ffd1b4 105.2%), linear-gradient(259deg, #fe6d11 50.14%, #ffd1b4 114.93%);
|
||||||
linear-gradient(259deg, #fe6d11 50.14%, #ffd1b4 114.93%);
|
box-shadow: 0 14rpx 30.4rpx 0 #fe8b435e;
|
||||||
box-shadow: 0 14rpx 30.4rpx 0 #fe8b435e;
|
&.disabled {
|
||||||
&.disabled {
|
background: #eee;
|
||||||
background: #eee;
|
box-shadow: none;
|
||||||
box-shadow: none;
|
border: none;
|
||||||
border: none;
|
color: #999;
|
||||||
color: #999;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.other {
|
.other {
|
||||||
background: #f6f6f6;
|
background: #f6f6f6;
|
||||||
padding: 24rpx 16rpx;
|
padding: 24rpx 16rpx;
|
||||||
margin-top: 40rpx;
|
margin-top: 40rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-wrap {
|
.header-wrap {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 530rpx;
|
height: 530rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: calc(var(--status-bar-height) + 140rpx) 28rpx 28rpx;
|
padding: calc(var(--status-bar-height) + 140rpx) 28rpx 28rpx;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
.bg {
|
.bg {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.select-shop {
|
.select-shop {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
justify-content: space-between;
|
||||||
position: relative;
|
align-items: center;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
.select-btn {
|
.select-btn {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 12upx;
|
gap: 12upx;
|
||||||
|
|
||||||
.t {
|
.t {
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.balance-wrap {
|
.balance-wrap {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-top: 20rpx;
|
padding-top: 20rpx;
|
||||||
|
|
||||||
.left {
|
.left {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.t {
|
.t {
|
||||||
color: #5e3110;
|
color: #5e3110;
|
||||||
|
|
||||||
&.i {
|
&.i {
|
||||||
position: relative;
|
position: relative;
|
||||||
top: 10upx;
|
top: 10upx;
|
||||||
font-size: 28upx;
|
font-size: 28upx;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.n {
|
&.n {
|
||||||
font-size: 64upx;
|
font-size: 64upx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.right {
|
.right {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 12upx;
|
gap: 12upx;
|
||||||
|
|
||||||
.t {
|
.t {
|
||||||
color: #86491d;
|
color: #86491d;
|
||||||
font-size: 28upx;
|
font-size: 28upx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottom {
|
.bottom {
|
||||||
background-color: rgba(255, 255, 255, 0.3);
|
background-color: rgba(255, 255, 255, 0.3);
|
||||||
padding: 40rpx 28rpx 0 28rpx;
|
padding: 40rpx 28rpx 0 28rpx;
|
||||||
transform: translateY(-140rpx);
|
transform: translateY(-140rpx);
|
||||||
border-radius: 74rpx 74rpx 0 0;
|
border-radius: 74rpx 74rpx 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list {
|
.list {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, 1fr);
|
grid-template-columns: repeat(3, 1fr);
|
||||||
column-gap: 20rpx;
|
column-gap: 20rpx;
|
||||||
row-gap: 22rpx;
|
row-gap: 22rpx;
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
padding: 36rpx 22rpx;
|
padding: 36rpx 22rpx;
|
||||||
border-radius: 42rpx;
|
border-radius: 42rpx;
|
||||||
background: linear-gradient(180deg, #f5f5f5 58.54%, #fff 140.47%);
|
background: linear-gradient(180deg, #f5f5f5 58.54%, #fff 140.47%);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
position: relative;
|
position: relative;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border: 6rpx solid transparent;
|
border: 6rpx solid transparent;
|
||||||
transition: all 0.3s ease-in-out;
|
transition: all 0.3s ease-in-out;
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
background: linear-gradient(180deg, #ffc29a -26.17%, #fff 64.06%);
|
background: linear-gradient(180deg, #ffc29a -26.17%, #fff 64.06%);
|
||||||
border: 6rpx solid #fe6c0e;
|
border: 6rpx solid #fe6c0e;
|
||||||
box-shadow: 0 0 31rpx 2rpx #fe8b435e;
|
box-shadow: 0 0 31rpx 2rpx #fe8b435e;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sel {
|
.sel {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
|
|
||||||
transform: translateX(-50%) translateY(21rpx);
|
transform: translateX(-50%) translateY(21rpx);
|
||||||
|
|
||||||
.image {
|
.image {
|
||||||
width: 42rpx;
|
width: 42rpx;
|
||||||
height: 42rpx;
|
height: 42rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
1115
pages/user/user.vue
1115
pages/user/user.vue
File diff suppressed because it is too large
Load Diff
28
pnpm-lock.yaml
generated
28
pnpm-lock.yaml
generated
@@ -30,8 +30,8 @@ importers:
|
|||||||
specifier: ^0.1.2
|
specifier: ^0.1.2
|
||||||
version: 0.1.2
|
version: 0.1.2
|
||||||
ysk-utils:
|
ysk-utils:
|
||||||
specifier: ^1.0.81
|
specifier: ^1.0.85
|
||||||
version: 1.0.81
|
version: 1.0.85
|
||||||
devDependencies:
|
devDependencies:
|
||||||
unplugin-auto-import:
|
unplugin-auto-import:
|
||||||
specifier: ^0.16.7
|
specifier: ^0.16.7
|
||||||
@@ -50,13 +50,13 @@ packages:
|
|||||||
resolution: {integrity: sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==}
|
resolution: {integrity: sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==}
|
||||||
engines: {node: '>=6.9.0'}
|
engines: {node: '>=6.9.0'}
|
||||||
|
|
||||||
'@babel/parser@7.28.5':
|
'@babel/parser@7.28.6':
|
||||||
resolution: {integrity: sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ==}
|
resolution: {integrity: sha512-TeR9zWR18BvbfPmGbLampPMW+uW1NZnJlRuuHso8i87QZNq2JRF9i6RgxRqtEq+wQGsS19NNTWr2duhnE49mfQ==}
|
||||||
engines: {node: '>=6.0.0'}
|
engines: {node: '>=6.0.0'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
'@babel/types@7.28.5':
|
'@babel/types@7.28.6':
|
||||||
resolution: {integrity: sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==}
|
resolution: {integrity: sha512-0ZrskXVEHSWIqZM/sQZ4EV3jZJXRkio/WCxaqKZP1g//CEWEPSfeZFcms4XeKBCHU0ZKnIkdJeU/kF+eRp5lBg==}
|
||||||
engines: {node: '>=6.9.0'}
|
engines: {node: '>=6.9.0'}
|
||||||
|
|
||||||
'@dcloudio/types@3.4.21':
|
'@dcloudio/types@3.4.21':
|
||||||
@@ -357,8 +357,8 @@ packages:
|
|||||||
webpack-virtual-modules@0.6.2:
|
webpack-virtual-modules@0.6.2:
|
||||||
resolution: {integrity: sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==}
|
resolution: {integrity: sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==}
|
||||||
|
|
||||||
ysk-utils@1.0.81:
|
ysk-utils@1.0.85:
|
||||||
resolution: {integrity: sha512-c6SOfOaw43aDDuyXgEv24Vo561EfFoa1gfGbY+p1EfXHoGPOE6tQLekbWW9bn37KAse0Gdef7VCbdv0Dr6ltaw==}
|
resolution: {integrity: sha512-HkbV4Jidi3G6DAuGAN972tClUYtC2zVoxo4crrxexfn0rZa8HjXatUfEbawHOeEzyl6G1CdC+160I2bKfxEBlA==}
|
||||||
|
|
||||||
snapshots:
|
snapshots:
|
||||||
|
|
||||||
@@ -368,11 +368,11 @@ snapshots:
|
|||||||
|
|
||||||
'@babel/helper-validator-identifier@7.28.5': {}
|
'@babel/helper-validator-identifier@7.28.5': {}
|
||||||
|
|
||||||
'@babel/parser@7.28.5':
|
'@babel/parser@7.28.6':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@babel/types': 7.28.5
|
'@babel/types': 7.28.6
|
||||||
|
|
||||||
'@babel/types@7.28.5':
|
'@babel/types@7.28.6':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@babel/helper-string-parser': 7.27.1
|
'@babel/helper-string-parser': 7.27.1
|
||||||
'@babel/helper-validator-identifier': 7.28.5
|
'@babel/helper-validator-identifier': 7.28.5
|
||||||
@@ -408,7 +408,7 @@ snapshots:
|
|||||||
|
|
||||||
'@vue/compiler-core@3.5.22':
|
'@vue/compiler-core@3.5.22':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@babel/parser': 7.28.5
|
'@babel/parser': 7.28.6
|
||||||
'@vue/shared': 3.5.22
|
'@vue/shared': 3.5.22
|
||||||
entities: 4.5.0
|
entities: 4.5.0
|
||||||
estree-walker: 2.0.2
|
estree-walker: 2.0.2
|
||||||
@@ -421,7 +421,7 @@ snapshots:
|
|||||||
|
|
||||||
'@vue/compiler-sfc@3.5.22':
|
'@vue/compiler-sfc@3.5.22':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@babel/parser': 7.28.5
|
'@babel/parser': 7.28.6
|
||||||
'@vue/compiler-core': 3.5.22
|
'@vue/compiler-core': 3.5.22
|
||||||
'@vue/compiler-dom': 3.5.22
|
'@vue/compiler-dom': 3.5.22
|
||||||
'@vue/compiler-ssr': 3.5.22
|
'@vue/compiler-ssr': 3.5.22
|
||||||
@@ -684,7 +684,7 @@ snapshots:
|
|||||||
|
|
||||||
webpack-virtual-modules@0.6.2: {}
|
webpack-virtual-modules@0.6.2: {}
|
||||||
|
|
||||||
ysk-utils@1.0.81:
|
ysk-utils@1.0.85:
|
||||||
dependencies:
|
dependencies:
|
||||||
bignumber.js: 9.3.1
|
bignumber.js: 9.3.1
|
||||||
loadsh: 0.0.4
|
loadsh: 0.0.4
|
||||||
|
|||||||
@@ -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">
|
||||||
@@ -27,7 +27,10 @@
|
|||||||
</view>
|
</view>
|
||||||
<text class="text">剩余:{{item.quantity}}</text>
|
<text class="text">剩余:{{item.quantity}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="goods-name">{{item.goodsName}}</view>
|
<view class="goods-name u-flex u-row-between">
|
||||||
|
<text class="u-m-r-30" style="word-break: break-all;">{{item.goodsName}}</text>
|
||||||
|
<ymfShare color="#333" />
|
||||||
|
</view>
|
||||||
<view class="bg-f7" style="height: 24rpx"></view>
|
<view class="bg-f7" style="height: 24rpx"></view>
|
||||||
<view class="desc">
|
<view class="desc">
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
@@ -55,10 +58,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>
|
||||||
@@ -113,9 +116,12 @@
|
|||||||
</view>
|
</view>
|
||||||
</up-popup>
|
</up-popup>
|
||||||
<!-- 兑换确认弹窗end -->
|
<!-- 兑换确认弹窗end -->
|
||||||
|
|
||||||
|
<ymf-share-popup ></ymf-share-popup>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import ymfShare from '@/components/ymf-components/ymf-share.vue'
|
||||||
import {
|
import {
|
||||||
computed,
|
computed,
|
||||||
reactive
|
reactive
|
||||||
@@ -125,6 +131,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 +147,9 @@
|
|||||||
show: false,
|
show: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
function prveImg(url){
|
function prveImg(url) {
|
||||||
uni.previewImage({
|
uni.previewImage({
|
||||||
urls:[url]
|
urls: [url]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,16 +315,64 @@
|
|||||||
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 ,returnIndexBg,
|
||||||
|
} from '@/utils/share.js'
|
||||||
|
// defineOptions({
|
||||||
|
// mixins: [shareMixin],
|
||||||
|
// });
|
||||||
|
|
||||||
|
onShareAppMessage(async(res)=>{
|
||||||
|
const query=await returnQuery()
|
||||||
|
const shopInfo=uni.cache.get('shopInfo')
|
||||||
|
return wxShare({
|
||||||
|
...res,
|
||||||
|
title:item.goodsName +'-'+shopInfo.shopName,
|
||||||
|
path:'/scoreShop/detail/index'+'?'+query,
|
||||||
|
query,
|
||||||
|
imageUrl:item.goodsImageUrl||returnIndexBg()||''
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
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 +522,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 +547,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,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,9 +31,13 @@
|
|||||||
<view class="tab-item" :class="tabActive === 0 ? 'active' : ''" @click="tabActive = 0">优惠券</view>
|
<view class="tab-item" :class="tabActive === 0 ? 'active' : ''" @click="tabActive = 0">优惠券</view>
|
||||||
<view class="tab-item" :class="tabActive === 1 ? 'active' : ''" @click="tabActive = 1">其它商品</view>
|
<view class="tab-item" :class="tabActive === 1 ? 'active' : ''" @click="tabActive = 1">其它商品</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex" @click="toggleLayout">
|
<view class="u-flex gap-20">
|
||||||
<image :src="layout === 'block' ? imgs.layout_block : imgs.layout" class="layout" />
|
<view @click="toggleLayout">
|
||||||
|
<image :src="layout === 'block' ? imgs.layout_block : imgs.layout" class="layout" />
|
||||||
|
</view>
|
||||||
|
<ymfShare size="40rpx" color="#9C571F"></ymfShare>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<goodsList :pointsUser="pointsUser" :layout="layout" :list="list" @exchange="exchange"></goodsList>
|
<goodsList :pointsUser="pointsUser" :layout="layout" :list="list" @exchange="exchange"></goodsList>
|
||||||
|
|
||||||
@@ -41,9 +45,12 @@
|
|||||||
<up-loadmore :status="isEnd?'nomore':'loadmore'"></up-loadmore>
|
<up-loadmore :status="isEnd?'nomore':'loadmore'"></up-loadmore>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<ymf-share-popup ></ymf-share-popup>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import ymfShare from '@/components/ymf-components/ymf-share.vue'
|
||||||
import * as pointGoodsApi from "@/common/api/order/pointGoods.js";
|
import * as pointGoodsApi from "@/common/api/order/pointGoods.js";
|
||||||
import goodsList from "./components/goods-list.vue";
|
import goodsList from "./components/goods-list.vue";
|
||||||
import {
|
import {
|
||||||
@@ -70,9 +77,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function back() {
|
function back() {
|
||||||
uni.navigateBack({
|
const pages = getCurrentPages();
|
||||||
delta: 1,
|
if (pages.length < 2) {
|
||||||
});
|
uni.switchTab({
|
||||||
|
url: '/pages/index/index'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// function exchange(item) {
|
// function exchange(item) {
|
||||||
@@ -87,12 +103,13 @@
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
function toDetail() {
|
function toDetail() {
|
||||||
if(!pointsUser.value||!pointsUser.value.id){
|
if (!pointsUser.value || !pointsUser.value.id) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/user/member/billDetails?type=2&shopId=' + query.shopId + '&id=' + (pointsUser.value?pointsUser.value.id :
|
url: '/pages/user/member/billDetails?type=2&shopId=' + query.shopId + '&id=' + (pointsUser.value ?
|
||||||
|
pointsUser.value.id :
|
||||||
'')
|
'')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -132,7 +149,41 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
onLoad((opt) => {
|
|
||||||
|
|
||||||
|
import {
|
||||||
|
shareMixin,
|
||||||
|
handleMixinOnLoad,
|
||||||
|
returnQuery,
|
||||||
|
jsonToUrl,
|
||||||
|
wxShare,returnIndexBg ,
|
||||||
|
returnCommonQuery
|
||||||
|
} from '@/utils/share.js'
|
||||||
|
// defineOptions({
|
||||||
|
// mixins: [shareMixin],
|
||||||
|
// });
|
||||||
|
|
||||||
|
async function onShare() {
|
||||||
|
const queryJson = await returnCommonQuery()
|
||||||
|
let query = jsonToUrl(queryJson)
|
||||||
|
let json = {}
|
||||||
|
|
||||||
|
json.title = '积分乐园,好物兑换'
|
||||||
|
json.imageUrl = returnIndexBg()||uni.cache.get('shopInfo').logo || ''
|
||||||
|
return wxShare({
|
||||||
|
query,
|
||||||
|
...json,
|
||||||
|
path: '/scoreShop/index/index' + '?' + query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
onShareAppMessage(onShare)
|
||||||
|
onShareTimeline(onShare)
|
||||||
|
const options = reactive({
|
||||||
|
|
||||||
|
})
|
||||||
|
onLoad(async (opt) => {
|
||||||
|
Object.assign(options, opt)
|
||||||
query.shopId = opt.shopId || ''
|
query.shopId = opt.shopId || ''
|
||||||
})
|
})
|
||||||
watch(() => tabActive.value, (newval, oldval) => {
|
watch(() => tabActive.value, (newval, oldval) => {
|
||||||
@@ -151,8 +202,23 @@
|
|||||||
query.page++
|
query.page++
|
||||||
getList();
|
getList();
|
||||||
})
|
})
|
||||||
onShow(() => {
|
import {
|
||||||
refresh()
|
productStore
|
||||||
|
} from '@/stores/user.js';
|
||||||
|
import {
|
||||||
|
onShareAppMessage
|
||||||
|
} from '@dcloudio/uni-app';
|
||||||
|
import { onShareTimeline } from '@dcloudio/uni-app';
|
||||||
|
const storeuser = productStore();
|
||||||
|
|
||||||
|
|
||||||
|
onShow(async () => {
|
||||||
|
if (!storeuser.isHasLogin) {
|
||||||
|
await handleMixinOnLoad(options)
|
||||||
|
refresh()
|
||||||
|
} else {
|
||||||
|
refresh()
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@@ -164,6 +230,10 @@
|
|||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.gap-20 {
|
||||||
|
gap: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.top {
|
.top {
|
||||||
padding: 138rpx 26rpx 48rpx 42rpx;
|
padding: 138rpx 26rpx 48rpx 42rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -1,124 +1,130 @@
|
|||||||
<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"
|
<view class="content">
|
||||||
leftIconColor="#333"
|
<view class="bg" :style="{ backgroundImage: `url(${imgs.bg})` }">
|
||||||
@leftClick="back()"
|
<image :src="imgs.success" class="success"></image>
|
||||||
titleStyle="color:#333"
|
<view class="u-font-40 font-700">兑换成功</view>
|
||||||
></up-navbar>
|
<view class="u-font-32 font-700">{{item.pointsGoodsName}}</view>
|
||||||
<view class="content">
|
<view class="u-m-t-14" v-if="item.goodsCategory!='优惠券'">需前往店铺自行兑换领取</view>
|
||||||
<view class="bg" :style="{ backgroundImage: `url(${imgs.bg})` }">
|
<view class="u-m-t-14" v-else>优惠券直接到账您的账户中</view>
|
||||||
<image :src="imgs.success" class="success"></image>
|
</view>
|
||||||
<view class="u-font-40 font-700">兑换成功</view>
|
<view class="info u-flex u-flex-col">
|
||||||
<view class="u-font-32 font-700">{{item.pointsGoodsName}}</view>
|
<view class="u-p-22">
|
||||||
<view class="u-m-t-14" v-if="item.goodsCategory!='优惠券'">需前往店铺自行兑换领取</view>
|
<text class="color-666">兑换商品:</text>
|
||||||
<view class="u-m-t-14" v-else>优惠券直接到账您的账户中</view>
|
<text>{{item.pointsGoodsName}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="info u-flex u-flex-col">
|
<view class="u-p-22">
|
||||||
<view class="u-p-22">
|
<text class="color-666">兑换数量:</text>
|
||||||
<text class="color-666">兑换商品:</text>
|
<text>{{item.number}}份</text>
|
||||||
<text>{{item.pointsGoodsName}}</text>
|
</view>
|
||||||
</view>
|
<view class="u-p-22">
|
||||||
<view class="u-p-22">
|
<text class="color-666">消耗积分:</text>
|
||||||
<text class="color-666">兑换数量:</text>
|
<text>{{item.spendPoints}}</text>
|
||||||
<text>{{item.number}}份</text>
|
</view>
|
||||||
</view>
|
<view class="u-p-22" v-if="item.extraPaymentAmount">
|
||||||
<view class="u-p-22">
|
<text class="color-666">支付金额:</text>
|
||||||
<text class="color-666">消耗积分:</text>
|
<text>{{item.extraPaymentAmount}}</text>
|
||||||
<text>{{item.spendPoints}}</text>
|
</view>
|
||||||
</view>
|
<view class="u-p-22">
|
||||||
<view class="u-p-22" v-if="item.extraPaymentAmount">
|
<text class="color-666">下单时间:</text>
|
||||||
<text class="color-666">支付金额:</text>
|
<text>{{item.createTime}}</text>
|
||||||
<text>{{item.extraPaymentAmount}}</text>
|
</view>
|
||||||
|
<view class="u-p-22">
|
||||||
|
<text class="color-666">订单号:</text>
|
||||||
|
<text>:{{item.orderNo}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex bottom u-row-center">
|
||||||
|
<view class="back btn" @click="back">继续兑换</view>
|
||||||
|
<view class="look btn" @click="lookOrder">查看订单</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-p-22">
|
</view>
|
||||||
<text class="color-666">下单时间:</text>
|
|
||||||
<text>{{item.createTime}}</text>
|
|
||||||
</view>
|
|
||||||
<view class="u-p-22">
|
|
||||||
<text class="color-666">订单号:</text>
|
|
||||||
<text>:{{item.orderNo}}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="u-flex bottom u-row-center">
|
|
||||||
<view class="back btn" @click="back">继续兑换</view>
|
|
||||||
<view class="look btn" @click="lookOrder">查看订单</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
const imgs = {
|
||||||
|
bg: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/b625560a5b75418c9e643841f8674a0c.png",
|
||||||
|
success: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/c2f0865efb444de58ff0d8bb3a51d300.png",
|
||||||
|
};
|
||||||
|
|
||||||
|
function back() {
|
||||||
|
const pages = getCurrentPages();
|
||||||
|
if(pages.length<2){
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/scoreShop/index/index?shopId=' + item.shopId
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
uni.navigateBack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const imgs = {
|
function lookOrder() {
|
||||||
bg: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/b625560a5b75418c9e643841f8674a0c.png",
|
uni.redirectTo({
|
||||||
success:
|
url: '/scoreShop/order/index?shopId=' + item.shopId
|
||||||
"https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/c2f0865efb444de58ff0d8bb3a51d300.png",
|
})
|
||||||
};
|
}
|
||||||
function back() {
|
const item = reactive({
|
||||||
uni.navigateBack();
|
|
||||||
}
|
|
||||||
function lookOrder() {
|
|
||||||
uni.redirectTo({
|
|
||||||
url:'/scoreShop/order/index?shopId='+item.shopId
|
|
||||||
})
|
|
||||||
}
|
|
||||||
const item=reactive({
|
|
||||||
|
|
||||||
})
|
})
|
||||||
onLoad(opt=>{
|
onLoad(opt => {
|
||||||
const exchange_goods_success_data=uni.getStorageSync('exchange_goods_success')
|
const exchange_goods_success_data = uni.getStorageSync('exchange_goods_success')
|
||||||
Object.assign(item,exchange_goods_success_data)
|
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 {
|
|
||||||
width: 100%;
|
|
||||||
height: 586rpx;
|
|
||||||
background-size: cover;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: flex-end;
|
|
||||||
align-items: center;
|
|
||||||
padding-bottom: 26rpx;
|
|
||||||
color: $color;
|
|
||||||
|
|
||||||
.success {
|
.bg {
|
||||||
width: 310rpx;
|
width: 100%;
|
||||||
height: 206rpx;
|
height: 586rpx;
|
||||||
}
|
background-size: cover;
|
||||||
}
|
display: flex;
|
||||||
.info {
|
flex-direction: column;
|
||||||
padding-left: 174rpx;
|
justify-content: flex-end;
|
||||||
padding-right: 32rpx;
|
align-items: center;
|
||||||
}
|
padding-bottom: 26rpx;
|
||||||
}
|
color: $color;
|
||||||
.bottom {
|
|
||||||
gap: 48rpx;
|
|
||||||
margin-top: 44rpx;
|
|
||||||
|
|
||||||
.btn {
|
.success {
|
||||||
padding: 14rpx 76rpx;
|
width: 310rpx;
|
||||||
border-radius: 100rpx;
|
height: 206rpx;
|
||||||
font-size: 32rpx;
|
}
|
||||||
border: 1px solid transparent;
|
}
|
||||||
&.back {
|
|
||||||
border-color: $my-main-color;
|
.info {
|
||||||
color: $my-main-color;
|
padding-left: 174rpx;
|
||||||
}
|
padding-right: 32rpx;
|
||||||
&.look {
|
}
|
||||||
background-color: $my-main-color;
|
}
|
||||||
border-color: $my-main-color;
|
|
||||||
color: #fff;
|
.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
1
src/auto-imports.d.ts
vendored
1
src/auto-imports.d.ts
vendored
@@ -39,6 +39,7 @@ declare global {
|
|||||||
const onScopeDispose: typeof import('vue')['onScopeDispose']
|
const onScopeDispose: typeof import('vue')['onScopeDispose']
|
||||||
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
|
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
|
||||||
const onShareAppMessage: typeof import('@dcloudio/uni-app')['onShareAppMessage']
|
const onShareAppMessage: typeof import('@dcloudio/uni-app')['onShareAppMessage']
|
||||||
|
const onShareTimeline: typeof import('@dcloudio/uni-app')['onShareTimeline']
|
||||||
const onShow: typeof import('@dcloudio/uni-app')['onShow']
|
const onShow: typeof import('@dcloudio/uni-app')['onShow']
|
||||||
const onUnload: typeof import('@dcloudio/uni-app')['onUnload']
|
const onUnload: typeof import('@dcloudio/uni-app')['onUnload']
|
||||||
const onUnmounted: typeof import('vue')['onUnmounted']
|
const onUnmounted: typeof import('vue')['onUnmounted']
|
||||||
|
|||||||
@@ -90,11 +90,13 @@ export const useWebSocket = defineStore('socketTask', () => {
|
|||||||
let onMessage = () => {
|
let onMessage = () => {
|
||||||
|
|
||||||
}
|
}
|
||||||
function setOnMessage(onMessageBallBack){
|
|
||||||
onMessage=onMessageBallBack
|
function setOnMessage(onMessageBallBack) {
|
||||||
|
onMessage = onMessageBallBack
|
||||||
}
|
}
|
||||||
function chnageInitMessage(data){
|
|
||||||
initMessage=data
|
function chnageInitMessage(data) {
|
||||||
|
initMessage = data
|
||||||
}
|
}
|
||||||
// 连接 WebSocket
|
// 连接 WebSocket
|
||||||
const connect = async (connectMsg, onMessageBallBack) => {
|
const connect = async (connectMsg, onMessageBallBack) => {
|
||||||
@@ -127,6 +129,8 @@ export const useWebSocket = defineStore('socketTask', () => {
|
|||||||
url: uni.conf.baseUrlwws + '?' + Date.now(),
|
url: uni.conf.baseUrlwws + '?' + Date.now(),
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log('连接成功');
|
console.log('连接成功');
|
||||||
|
console.log('connectMsg', connectMsg);
|
||||||
|
console.log('initMessage', initMessage);
|
||||||
isConnected.value = true;
|
isConnected.value = true;
|
||||||
// 监听初始化成功在开启心跳
|
// 监听初始化成功在开启心跳
|
||||||
startHeartbeat();
|
startHeartbeat();
|
||||||
@@ -233,7 +237,7 @@ export const useWebSocket = defineStore('socketTask', () => {
|
|||||||
|
|
||||||
// 发送消息
|
// 发送消息
|
||||||
const sendMessage = (data) => {
|
const sendMessage = (data) => {
|
||||||
if(!data){
|
if (!data) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (isConnected.value && data) {
|
if (isConnected.value && data) {
|
||||||
@@ -369,6 +373,8 @@ export const useWebSocket = defineStore('socketTask', () => {
|
|||||||
initNetworkListener,
|
initNetworkListener,
|
||||||
connect,
|
connect,
|
||||||
allowReconnect,
|
allowReconnect,
|
||||||
socketTask,setOnMessage,chnageInitMessage
|
socketTask,
|
||||||
|
setOnMessage,
|
||||||
|
chnageInitMessage
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
@@ -329,7 +329,11 @@ export const useCartsStore = defineStore("cart", () => {
|
|||||||
.map((v) => {
|
.map((v) => {
|
||||||
|
|
||||||
const item = getProductDetails(v);
|
const item = getProductDetails(v);
|
||||||
if (!item) {
|
const is_temporary=v.is_temporary||v.isTemporary
|
||||||
|
if(is_temporary){
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
if (!item&&!is_temporary) {
|
||||||
socketSendMsg({
|
socketSendMsg({
|
||||||
id: v.id,
|
id: v.id,
|
||||||
operate_type: "del",
|
operate_type: "del",
|
||||||
@@ -499,10 +503,10 @@ export const useCartsStore = defineStore("cart", () => {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const isUse =
|
const isUse =
|
||||||
shopUserInfo.value.isVip && shopUserInfo.value.isMemberPrice && shopInfo.value
|
shopUserInfo.value.isVip && shopUserInfo.value.isMemberPrice ?
|
||||||
.isMemberPrice == 1 ?
|
|
||||||
true :
|
true :
|
||||||
false;
|
false;
|
||||||
|
console.log('useVipPrice',isUse);
|
||||||
return isUse;
|
return isUse;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export const Memberpay = defineStore('memberpay', {
|
|||||||
let res = await APIpayltPayVip({
|
let res = await APIpayltPayVip({
|
||||||
...data,
|
...data,
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
payType: 'wechatPay',
|
payType: 'WECHAT',
|
||||||
openId: uni.cache.get('userInfo').wechatOpenId,
|
openId: uni.cache.get('userInfo').wechatOpenId,
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef MP-ALIPAY
|
// #ifdef MP-ALIPAY
|
||||||
@@ -113,7 +113,7 @@ export const Memberpay = defineStore('memberpay', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
payType: 'wechatPay',
|
payType: 'WECHAT',
|
||||||
openId: uni.cache.get('userInfo').wechatOpenId,
|
openId: uni.cache.get('userInfo').wechatOpenId,
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef MP-ALIPAY
|
// #ifdef MP-ALIPAY
|
||||||
|
|||||||
114
stores/user.js
114
stores/user.js
@@ -49,7 +49,7 @@ export const Storelogin = defineStore("login", {
|
|||||||
rawData: infoRes.rawData,
|
rawData: infoRes.rawData,
|
||||||
source: "wechat",
|
source: "wechat",
|
||||||
});
|
});
|
||||||
console.log('APIuserlogin',res);
|
console.log('APIuserlogin', res);
|
||||||
if (res) {
|
if (res) {
|
||||||
this.token = res.token;
|
this.token = res.token;
|
||||||
this.miniAppOpenId = res.userInfo
|
this.miniAppOpenId = res.userInfo
|
||||||
@@ -110,12 +110,90 @@ export const productStore = defineStore("product", {
|
|||||||
latitude: "",
|
latitude: "",
|
||||||
longitude: "",
|
longitude: "",
|
||||||
},
|
},
|
||||||
|
token: "",
|
||||||
|
miniAppOpenId: "",
|
||||||
|
userInfo: "",
|
||||||
|
shopId: uni.cache.get('shopId') || '',
|
||||||
shopInfo: {
|
shopInfo: {
|
||||||
shopId: "",
|
shopId: "",
|
||||||
isOrderFence: 0,
|
isOrderFence: 0,
|
||||||
|
id: '',
|
||||||
},
|
},
|
||||||
|
shopUserInfo:{
|
||||||
|
|
||||||
|
},
|
||||||
|
isHasLogin:false
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
|
actionslogin() {
|
||||||
|
return new Promise(async (resolve, reject) => {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
uni.login({
|
||||||
|
provider: "weixin",
|
||||||
|
success: (data) => {
|
||||||
|
// 微信小程序环境
|
||||||
|
uni.getUserInfo({
|
||||||
|
provider: "weixin",
|
||||||
|
success: async (infoRes) => {
|
||||||
|
let res = await APIuserlogin({
|
||||||
|
code: data.code, //临时登录凭证
|
||||||
|
rawData: infoRes.rawData,
|
||||||
|
source: "wechat",
|
||||||
|
});
|
||||||
|
console.log('APIuserlogin', res);
|
||||||
|
if (res) {
|
||||||
|
this.token = res.token;
|
||||||
|
this.isHasLogin=true
|
||||||
|
this.miniAppOpenId = res.userInfo
|
||||||
|
.miniAppOpenId;
|
||||||
|
this.userInfo = res.userInfo;
|
||||||
|
uni.cache.set("token", res.token);
|
||||||
|
uni.cache.set("userInfo", res.userInfo);
|
||||||
|
uni.cache.set("followIndex", res
|
||||||
|
.followIndex || "");
|
||||||
|
}
|
||||||
|
resolve(true);
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
reject(false);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
// #ifdef MP-ALIPAY
|
||||||
|
my.getAuthCode({
|
||||||
|
scopes: "auth_base",
|
||||||
|
success: async (data) => {
|
||||||
|
// 支付宝小程序环境
|
||||||
|
// my.getAuthUserInfo({
|
||||||
|
// success: async (infoRes) => {
|
||||||
|
let res = await APIuserlogin({
|
||||||
|
code: data.authCode, //临时登录凭证
|
||||||
|
// rawData: JSON.stringify(infoRes),
|
||||||
|
source: "alipay",
|
||||||
|
});
|
||||||
|
if (res) {
|
||||||
|
this.isHasLogin=true
|
||||||
|
this.token = res.token;
|
||||||
|
this.miniAppOpenId = res.userInfo.miniAppOpenId;
|
||||||
|
this.userInfo = res.userInfo;
|
||||||
|
uni.cache.set("token", res.token);
|
||||||
|
uni.cache.set("openId", res.userInfo.alipayOpenId);
|
||||||
|
uni.cache.set("userInfo", res.userInfo);
|
||||||
|
resolve(true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
reject(false);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
// #ifdef H5
|
||||||
|
resolve(true)
|
||||||
|
// #endif
|
||||||
|
});
|
||||||
|
},
|
||||||
getLocation() {
|
getLocation() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
console.log("获取经纬度");
|
console.log("获取经纬度");
|
||||||
@@ -185,7 +263,7 @@ export const productStore = defineStore("product", {
|
|||||||
console.log("扫码内容", q);
|
console.log("扫码内容", q);
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:'/pages/product/index'
|
url: '/pages/product/index'
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
// #endif
|
// #endif
|
||||||
@@ -448,19 +526,43 @@ export const productStore = defineStore("product", {
|
|||||||
|
|
||||||
// 通过shopId 获取店铺会员信息
|
// 通过shopId 获取店铺会员信息
|
||||||
actionsproductqueryProduct() {
|
actionsproductqueryProduct() {
|
||||||
|
console.log('actionsproductqueryProduct:token',uni.cache.get('token'));
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
let res = await APIshopUserInfo();
|
let res = await APIshopUserInfo();
|
||||||
uni.cache.set("shopUserInfo", res);
|
if(res&& typeof res === 'object'){
|
||||||
uni.cache.set("orderVIP", res);
|
this.shopUserInfo=res;
|
||||||
uni.cache.set("ordershopUserInfo", res.shopInfo);
|
uni.cache.set("shopUserInfo", res);
|
||||||
resolve(res);
|
uni.cache.set("orderVIP", res);
|
||||||
|
uni.cache.set("ordershopUserInfo", res.shopInfo);
|
||||||
|
resolve(res);
|
||||||
|
}else{
|
||||||
|
reject(false);
|
||||||
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
reject(false);
|
reject(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async pageOnload() {
|
||||||
|
console.log('开始加载必须数据')
|
||||||
|
//登录
|
||||||
|
await this.actionslogin()
|
||||||
|
//获取会员信息
|
||||||
|
await this.actionsproductqueryProduct()
|
||||||
|
//获取店铺信息
|
||||||
|
await this.getShopInfo()
|
||||||
|
console.log('必须数据加载完毕')
|
||||||
|
},
|
||||||
|
async getShopInfo(shopId) {
|
||||||
|
const shopRes = await APIusershopInfodetail({
|
||||||
|
shopId: this.shopId || shopId,
|
||||||
|
});
|
||||||
|
this.shopInfo = shopRes.shopInfo;
|
||||||
|
uni.cache.set("shopInfo", shopRes.shopInfo);
|
||||||
|
},
|
||||||
// 用户信息获取
|
// 用户信息获取
|
||||||
actionsAPIuser() {
|
actionsAPIuser() {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
|
|||||||
@@ -10,30 +10,30 @@
|
|||||||
|
|
||||||
<view class="sku">
|
<view class="sku">
|
||||||
<view class="u-flex u-col-center">
|
<view class="u-flex u-col-center">
|
||||||
<text class="price">¥{{item.price}}</text>
|
<text class="price">¥{{ item.price }}</text>
|
||||||
<text class="old-price">¥{{item.originPrice}}</text>
|
<text class="old-price">¥{{ item.originPrice }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view class="u-m-t-16 text" v-if="item.limitBuyNum"> 限购{{item.limitBuyNum}}份 </view>
|
<view class="u-m-t-16 text" v-if="item.limitBuyNum">限购{{ item.limitBuyNum }}份</view>
|
||||||
<view class="text u-m-t-10">已售:{{item.saleNum||0}}</view>
|
<view class="text u-m-t-10">已售:{{ item.saleNum || 0 }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="goods">
|
<view class="goods">
|
||||||
<view class="goods-name">{{item.packageName}}</view>
|
<view class="goods-name">{{ item.packageName }}</view>
|
||||||
<view class="u-m-t-20 color-666">
|
<view class="u-m-t-20 color-666">
|
||||||
{{item.description}}
|
{{ item.description }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="bg-f7" style="height: 32rpx"></view>
|
<view class="bg-f7" style="height: 32rpx"></view>
|
||||||
<view class="desc">
|
<view class="desc">
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
<view class="color-666 no-wrap" style="min-width: 180rpx;">可核销门店:</view>
|
<view class="color-666 no-wrap" style="min-width: 180rpx">可核销门店:</view>
|
||||||
<view class="">{{item.shopName}}</view>
|
<view class="">{{ item.shopName }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-m-t-16 u-col-baseline">
|
<view class="u-flex u-m-t-16 u-col-baseline">
|
||||||
<view class="color-666 no-wrap" style="min-width: 180rpx;">门店地址:</view>
|
<view class="color-666 no-wrap" style="min-width: 180rpx">门店地址:</view>
|
||||||
<view class="">{{item.shopAddress}}</view>
|
<view class="">{{ item.shopAddress }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -41,76 +41,64 @@
|
|||||||
<view class="bg-f7" style="height: 32rpx"></view>
|
<view class="bg-f7" style="height: 32rpx"></view>
|
||||||
<view class="groups">
|
<view class="groups">
|
||||||
<view class="color-000 u-m-b-28 u-font-32 font-700">立即拼团</view>
|
<view class="color-000 u-m-b-28 u-font-32 font-700">立即拼团</view>
|
||||||
<view class="item u-flex" v-for="(item,index) in item.gbOrderList" :key="index">
|
<view class="item u-flex" v-for="(item, index) in item.gbOrderList" :key="index">
|
||||||
<up-avatar size="76rpx" :src="item.avatar"></up-avatar>
|
<up-avatar size="76rpx" :src="item.avatar"></up-avatar>
|
||||||
<view class="u-flex u-flex-1 u-p-l-22 u-col-center u-row-between">
|
<view class="u-flex u-flex-1 u-p-l-22 u-col-center u-row-between">
|
||||||
<view>
|
<view>
|
||||||
<view class="color-000 u-line-1" style="max-width: 180rpx;">{{item.nickName}}</view>
|
<view class="color-000 u-line-1" style="max-width: 180rpx">{{ item.nickName }}</view>
|
||||||
<view class="main-color u-m-t-2">差{{returnNeedPerpole(item)}}人拼成</view>
|
<view class="main-color u-m-t-2">差{{ returnNeedPerpole(item) }}人拼成</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-m-t-22">
|
<view class="u-m-t-22">
|
||||||
<text class="color-666">剩余:</text>
|
<text class="color-666">剩余:</text>
|
||||||
<text class="main-color">{{getRemainingHMS(item)}}</text>
|
<text class="main-color">{{ getRemainingHMS(item) }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="btn" @click="fastBuy(item)">快速拼成</view>
|
<view class="btn" @click="fastBuy(item)">快速拼成</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<view class="bg-f7" style="height: 24rpx"></view>
|
<view class="bg-f7" style="height: 24rpx"></view>
|
||||||
<view class="goods-group">
|
<view class="goods-group">
|
||||||
<view class="u-flex u-row-between">
|
<view class="u-flex u-row-between">
|
||||||
<view class="name">套餐商品</view>
|
<view class="name">套餐商品</view>
|
||||||
<view class="u-flex color-666" @click="showGroup=!showGroup" style="align-items: baseline;">
|
<view class="u-flex color-666" @click="showGroup = !showGroup" style="align-items: baseline">
|
||||||
<text class="u-m-r-18">{{showGroup?'收起':'展开'}}</text>
|
<text class="u-m-r-18">{{ showGroup ? '收起' : '展开' }}</text>
|
||||||
<view class="guodu" :class="{rotate:!showGroup}">
|
<view class="guodu" :class="{ rotate: !showGroup }">
|
||||||
<up-icon name="arrow-down" bold></up-icon>
|
<up-icon name="arrow-down" bold></up-icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="" v-if="showGroup">
|
<view class="" v-if="showGroup">
|
||||||
<view class="u-m-t-48" v-for="(item,index) in item.packageContent" :key="index">
|
<view class="u-m-t-48" v-for="(item, index) in item.packageContent" :key="index">
|
||||||
<view class="font-bold">
|
<view class="font-bold">
|
||||||
<text class="">{{item.name}}</text>
|
<text class="">{{ item.name }}</text>
|
||||||
<text class="u-m-l-30">{{item.packageProducts.length}}选{{item.num}}</text>
|
<text class="u-m-l-30">{{ item.packageProducts.length }}选{{ item.num }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class="u-flex u-m-t-24 u-row-between" v-for="(goods,goodsIndex) in item.packageProducts"
|
<view class="u-flex u-m-t-24 u-row-between" v-for="(goods, goodsIndex) in item.packageProducts"
|
||||||
:key="goodsIndex">
|
:key="goodsIndex">
|
||||||
<text>{{goods.name}}</text>
|
<text>{{ goods.name }}</text>
|
||||||
<view class="u-flex text-right">
|
<view class="u-flex text-right">
|
||||||
<text class="color-666 u-m-r-42">x{{goods.num}}</text>
|
<text class="color-666 u-m-r-42">x{{ goods.num }}</text>
|
||||||
<view style="min-width: 110rpx;">¥{{goods.price}}</view>
|
<view style="min-width: 110rpx">¥{{ goods.price }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<view class="desc" v-if="item.tieredDiscount && item.tieredDiscount.length > 0">
|
||||||
<view class="desc" v-if="item.tieredDiscount&&item.tieredDiscount.length>0">
|
|
||||||
<view class="u-flex u-row-between">
|
<view class="u-flex u-row-between">
|
||||||
<view class="name">分享说明</view>
|
<view class="name">分享说明</view>
|
||||||
<view class="u-flex color-666" @click="showDesc=!showDesc" style="align-items: baseline;">
|
<view class="u-flex color-666" @click="showDesc = !showDesc" style="align-items: baseline">
|
||||||
<text class="u-m-r-18">{{showDesc?'收起':'展开'}}</text>
|
<text class="u-m-r-18">{{ showDesc ? '收起' : '展开' }}</text>
|
||||||
<view class="guodu" :class="{rotate:!showDesc}">
|
<view class="guodu" :class="{ rotate: !showDesc }">
|
||||||
<up-icon name="arrow-down" bold></up-icon>
|
<up-icon name="arrow-down" bold></up-icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<template v-if="showDesc">
|
<template v-if="showDesc">
|
||||||
<view class="u-m-t-26 text-center table">
|
<view class="u-m-t-26 text-center table">
|
||||||
@@ -118,90 +106,60 @@
|
|||||||
<view class="u-flex-1 u-p-t-32 u-p-b-32">分享人数</view>
|
<view class="u-flex-1 u-p-t-32 u-p-b-32">分享人数</view>
|
||||||
<view class="u-flex-1 u-p-t-32 u-p-b-32">购买价格(元)</view>
|
<view class="u-flex-1 u-p-t-32 u-p-b-32">购买价格(元)</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex row" v-for="(step,index) in item.tieredDiscount" :key="index">
|
<view class="u-flex row" v-for="(step, index) in item.tieredDiscount" :key="index">
|
||||||
<view class="u-flex-1 u-p-t-32 u-p-b-32">{{step.peopleNum}}</view>
|
<view class="u-flex-1 u-p-t-32 u-p-b-32">{{ step.peopleNum }}</view>
|
||||||
<view class="u-flex-1 u-p-t-32 u-p-b-32">¥{{step.price}}</view>
|
<view class="u-flex-1 u-p-t-32 u-p-b-32">¥{{ step.price }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="u-m-t-26" >
|
<view class="u-m-t-26">
|
||||||
<view>
|
<view>分享期限(小时):{{ item.expireHours }}</view>
|
||||||
分享期限(小时):{{item.expireHours}}
|
<view class="u-m-t-10">规定期限内的助力才会被计入</view>
|
||||||
</view>
|
<view class="u-m-t-40">如何才是分享成功?被分享人只需要点击《助力》,提示助力成功后即可</view>
|
||||||
<view class="u-m-t-10">
|
|
||||||
规定期限内的助力才会被计入
|
|
||||||
</view>
|
|
||||||
<view class="u-m-t-40">
|
|
||||||
如何才是分享成功?被分享人只需要点击《助力》,提示助力成功后即可
|
|
||||||
|
|
||||||
|
|
||||||
</view>
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<view class="desc">
|
<view class="desc">
|
||||||
<view class="u-flex u-row-between">
|
<view class="u-flex u-row-between">
|
||||||
<view class="name">使用说明</view>
|
<view class="name">使用说明</view>
|
||||||
<view class="u-flex color-666" @click="useDescShow=!useDescShow" style="align-items: baseline;">
|
<view class="u-flex color-666" @click="useDescShow = !useDescShow" style="align-items: baseline">
|
||||||
<text class="u-m-r-18">{{useDescShow?'收起':'展开'}}</text>
|
<text class="u-m-r-18">{{ useDescShow ? '收起' : '展开' }}</text>
|
||||||
<view class="guodu" :class="{rotate:!useDescShow}">
|
<view class="guodu" :class="{ rotate: !useDescShow }">
|
||||||
<up-icon name="arrow-down" bold></up-icon>
|
<up-icon name="arrow-down" bold></up-icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<template v-if="useDescShow">
|
<template v-if="useDescShow">
|
||||||
<view class="u-m-t-16 color-666">
|
<view class="u-m-t-16 color-666">
|
||||||
<view>
|
<view>1、可用时间段:{{ canuseTime }}</view>
|
||||||
1、可用时间段:{{canuseTime}}
|
<view v-if="item.otherDesc">2、其他使用说明:{{ item.otherDesc }}</view>
|
||||||
</view>
|
|
||||||
<view v-if="item.otherDesc">
|
|
||||||
2、其他使用说明:{{item.otherDesc}}
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<view class="goods-detail" v-if="item.goodsCategory != '优惠券'">
|
||||||
<view class="goods-detail" v-if="item.goodsCategory!='优惠券'">
|
|
||||||
<view class="u-flex u-row-center">
|
<view class="u-flex u-row-center">
|
||||||
<view class="title">商品详情</view>
|
<view class="title">商品详情</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-m-t-32">
|
<view class="u-m-t-32">
|
||||||
<image class="w-full" v-for="(item,index) in item.detailImages" :key="index" mode="widthFix" :src="item">
|
<image class="w-full" v-for="(item, index) in item.detailImages" :key="index" mode="widthFix"
|
||||||
</image>
|
:src="item"></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view style="height: 140px"></view>
|
<view style="height: 140px"></view>
|
||||||
<view class="fixed-bottom ">
|
<view class="fixed-bottom">
|
||||||
<!-- <view v-if="isCanExchange" class="btn" @click="exchangeClick">
|
<!-- <view v-if="isCanExchange" class="btn" @click="exchangeClick">
|
||||||
{{returnBtmText}}
|
{{returnBtmText}}
|
||||||
</view> -->
|
</view> -->
|
||||||
<view v-if="isCanExchange" class="btn" @click="payExchange">
|
<view v-if="isCanExchange" class="btn" @click="payExchange">
|
||||||
{{returnBtmText}}
|
{{ returnBtmText }}
|
||||||
</view>
|
</view>
|
||||||
<view class="btn gray u-m-t-32" @click="createOrder" v-if="item.tieredDiscount&&item.tieredDiscount.length>0">
|
<view class="btn gray u-m-t-32" @click="createOrder"
|
||||||
发起助力
|
v-if="item.tieredDiscount && item.tieredDiscount.length > 0">发起助力</view>
|
||||||
</view>
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 需要支付的弹窗 -->
|
<!-- 需要支付的弹窗 -->
|
||||||
<up-popup :show="popupData.show" mode="bottom" closeOnClickOverlay @close="popupData.show = false">
|
<up-popup :show="popupData.show" mode="bottom" closeOnClickOverlay @close="popupData.show = false">
|
||||||
<view class="popup-content">
|
<view class="popup-content">
|
||||||
@@ -213,31 +171,29 @@
|
|||||||
<image class="cover" :src="coverImgs[0]"></image>
|
<image class="cover" :src="coverImgs[0]"></image>
|
||||||
<view class="u-flex u-flex-1 u-row-between u-p-l-16 u-col-center">
|
<view class="u-flex u-flex-1 u-row-between u-p-l-16 u-col-center">
|
||||||
<view>
|
<view>
|
||||||
<view class="u-font-32 font-bold">{{item.packageName}}</view>
|
<view class="u-font-32 font-bold">{{ item.packageName }}</view>
|
||||||
|
|
||||||
<view class="u-m-t-12 color-666 u-line-2">{{item.otherDesc}}</view>
|
<view class="u-m-t-12 color-666 u-line-2">{{ item.otherDesc }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view class="price">¥{{item.price}}</view>
|
<view class="price">¥{{ item.price }}</view>
|
||||||
<view class="old-price">¥{{item.originPrice}}</view>
|
<view class="old-price">¥{{ item.originPrice }}</view>
|
||||||
<view class="limitBuyNum" v-if="item.limitBuyNum"> 限购{{item.limitBuyNum}} </view>
|
<view class="limitBuyNum" v-if="item.limitBuyNum">限购{{ item.limitBuyNum }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="bottom u-flex u-row-between u-col-center">
|
<view class="bottom u-flex u-row-between u-col-center">
|
||||||
<view class="u-flex u-col-baseline">
|
<view class="u-flex u-col-baseline">
|
||||||
<text class="color-666">合计:</text>
|
<text class="color-666">合计:</text>
|
||||||
<text class=" price">{{totalPrice}}</text>
|
<text class="price">{{ totalPrice }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
<up-icon name="minus-circle" size="20" color="#666" @click="changeNumber('-')"></up-icon>
|
<up-icon name="minus-circle" size="20" color="#666" @click="changeNumber('-')"></up-icon>
|
||||||
<text class="u-m-l-20 u-m-r-20">{{number}}</text>
|
<text class="u-m-l-20 u-m-r-20">{{ number }}</text>
|
||||||
<up-icon name="plus-circle-fill" size="20" color="#ED5A2E" @click="changeNumber('+')"></up-icon>
|
<up-icon name="plus-circle-fill" size="20" color="#ED5A2E" @click="changeNumber('+')"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="u-m-t-42 u-flex u-row-center">
|
<view class="u-m-t-42 u-flex u-row-center">
|
||||||
@@ -245,10 +201,17 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</up-popup>
|
</up-popup>
|
||||||
|
|
||||||
|
<ymf-share-popup ></ymf-share-popup>
|
||||||
<!-- 兑换确认弹窗end -->
|
<!-- 兑换确认弹窗end -->
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import {
|
||||||
|
shareMixin,
|
||||||
|
handleMixinOnLoad,
|
||||||
|
returnQuery
|
||||||
|
} from '@/utils/share.js';
|
||||||
import {
|
import {
|
||||||
Storelogin
|
Storelogin
|
||||||
} from '@/stores/user.js';
|
} from '@/stores/user.js';
|
||||||
@@ -257,71 +220,71 @@
|
|||||||
computed,
|
computed,
|
||||||
reactive,
|
reactive,
|
||||||
watch
|
watch
|
||||||
} from "vue";
|
} from 'vue';
|
||||||
import dayjs from "dayjs";
|
import dayjs from 'dayjs';
|
||||||
import {
|
import {
|
||||||
wxShare
|
wxShare
|
||||||
} from '@/utils/share.js'
|
} from '@/utils/share.js';
|
||||||
import {
|
import {
|
||||||
getOpenId
|
getOpenId
|
||||||
} from '@/utils/uniapp.js'
|
} from '@/utils/uniapp.js';
|
||||||
import modal from "@/groupBuying/components/modal.vue";
|
import modal from '@/groupBuying/components/modal.vue';
|
||||||
import * as Api from '@/common/api/market/package.js'
|
import * as Api from '@/common/api/market/package.js';
|
||||||
import {
|
import {
|
||||||
pay
|
pay
|
||||||
} from '@/utils/pay.js'
|
} from '@/utils/pay.js';
|
||||||
const imgs = {
|
const imgs = {
|
||||||
bg: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/9fd6a3ad2b384f6cb4e88ed6b77bd334.png",
|
bg: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/9fd6a3ad2b384f6cb4e88ed6b77bd334.png'
|
||||||
};
|
};
|
||||||
const number = ref(1)
|
const number = ref(1);
|
||||||
|
|
||||||
const showGroup = ref(true)
|
const showGroup = ref(true);
|
||||||
const showDesc = ref(true)
|
const showDesc = ref(true);
|
||||||
const useDescShow=ref(true)
|
const useDescShow = ref(true);
|
||||||
|
|
||||||
import {
|
import {
|
||||||
BigNumber
|
BigNumber
|
||||||
} from "bignumber.js";
|
} from 'bignumber.js';
|
||||||
const totalPrice = computed(() => {
|
const totalPrice = computed(() => {
|
||||||
if (!item.price) {
|
if (!item.price) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return BigNumber(number.value).times(item.price).toNumber()
|
return BigNumber(number.value).times(item.price).toNumber();
|
||||||
})
|
});
|
||||||
|
|
||||||
function changeNumber(step) {
|
function changeNumber(step) {
|
||||||
if (step === '-') {
|
if (step === '-') {
|
||||||
if (number.value == 1) {
|
if (number.value == 1) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
number.value--
|
number.value--;
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
if (step === '+') {
|
if (step === '+') {
|
||||||
if (item.limitBuyNum == -10086) {
|
if (item.limitBuyNum == -10086) {
|
||||||
number.value++
|
number.value++;
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
if (number.value >= item.limitBuyNum) {
|
if (number.value >= item.limitBuyNum) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
title: '最多可购买' + item.limitBuyNum + '份',
|
title: '最多可购买' + item.limitBuyNum + '份',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
number.value++
|
number.value++;
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const modalData = reactive({
|
const modalData = reactive({
|
||||||
show: false,
|
show: false
|
||||||
});
|
});
|
||||||
|
|
||||||
function prveImg(index) {
|
function prveImg(index) {
|
||||||
uni.previewImage({
|
uni.previewImage({
|
||||||
urls: coverImgs.value,
|
urls: coverImgs.value,
|
||||||
current: index
|
current: index
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const popupData = reactive({
|
const popupData = reactive({
|
||||||
@@ -330,20 +293,21 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
function exchangeClick() {
|
function exchangeClick() {
|
||||||
popupData.show = true
|
popupData.show = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function fastBuy(item) {
|
function fastBuy(item) {
|
||||||
popupData.item = item;
|
popupData.item = item;
|
||||||
popupData.show = true
|
popupData.show = true;
|
||||||
}
|
}
|
||||||
watch(() => popupData.show, (newval) => {
|
watch(
|
||||||
if (!newval) {
|
() => popupData.show,
|
||||||
popupData.item = null
|
(newval) => {
|
||||||
|
if (!newval) {
|
||||||
|
popupData.item = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
);
|
||||||
|
|
||||||
|
|
||||||
function dingyue() {
|
function dingyue() {
|
||||||
return new Promise((revlove, reject) => {
|
return new Promise((revlove, reject) => {
|
||||||
@@ -353,46 +317,45 @@
|
|||||||
],
|
],
|
||||||
success(res) {},
|
success(res) {},
|
||||||
complete() {
|
complete() {
|
||||||
revlove()
|
revlove();
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createOrder(){
|
async function createOrder() {
|
||||||
Api.createOrder({
|
Api.createOrder({
|
||||||
packageId:item.id,
|
packageId: item.id,
|
||||||
shopId: item.shopId,
|
shopId: item.shopId
|
||||||
}).then(res=>{
|
}).then((res) => {
|
||||||
if(res){
|
if (res) {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url:'/userPackage/order/detail?orderId='+res
|
url: '/userPackage/order/detail?orderId=' + res
|
||||||
})
|
});
|
||||||
}else{
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title:'发起助力失败',
|
title: '发起助力失败',
|
||||||
icon:'none'
|
icon: 'none'
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function payExchange() {
|
async function payExchange() {
|
||||||
uni.setStorageSync('group_buying_order', {
|
uni.setStorageSync('group_buying_order', {
|
||||||
...item,
|
...item,
|
||||||
number: number.value,
|
number: number.value
|
||||||
})
|
});
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/userPackage/confirm-order/confirm-order'
|
url: '/userPackage/confirm-order/confirm-order'
|
||||||
})
|
});
|
||||||
return
|
return;
|
||||||
await dingyue();
|
await dingyue();
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '支付中……'
|
title: '支付中……'
|
||||||
})
|
});
|
||||||
const openId = await getOpenId()
|
const openId = await getOpenId();
|
||||||
uni.hideLoading()
|
uni.hideLoading();
|
||||||
if (openId) {
|
if (openId) {
|
||||||
Api.exchange({
|
Api.exchange({
|
||||||
paramId: item.id,
|
paramId: item.id,
|
||||||
@@ -400,74 +363,67 @@
|
|||||||
number: number.value,
|
number: number.value,
|
||||||
groupOrderNo: popupData.item ? popupData.item.groupOrderNo : '',
|
groupOrderNo: popupData.item ? popupData.item.groupOrderNo : '',
|
||||||
openId
|
openId
|
||||||
}).then(orderRes => {
|
}).then((orderRes) => {
|
||||||
popupData.show = false;
|
popupData.show = false;
|
||||||
pay(orderRes.payInfo).then(res => {
|
pay(orderRes.payInfo).then((res) => {
|
||||||
console.log(res)
|
console.log(res);
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '/groupBuying/success/index?detailId=' + orderRes.record
|
url: '/groupBuying/success/index?detailId=' + orderRes.record.id
|
||||||
.id
|
});
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '开团失败',
|
title: '开团失败',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '鉴权失败,兑换失败',
|
title: '鉴权失败,兑换失败',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const item = reactive({
|
const item = reactive({
|
||||||
goodsDescription: []
|
goodsDescription: []
|
||||||
})
|
});
|
||||||
|
|
||||||
const isCanExchange = computed(() => {
|
const isCanExchange = computed(() => {
|
||||||
|
|
||||||
if (item.quantity <= 0) {
|
if (item.quantity <= 0) {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (item.limitQuota && item.boughtCount >= item.limitQuota) {
|
if (item.limitQuota && item.boughtCount >= item.limitQuota) {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
return true
|
return true;
|
||||||
})
|
});
|
||||||
|
|
||||||
const returnBtmText = computed(() => {
|
const returnBtmText = computed(() => {
|
||||||
if (isCanExchange.value) {
|
if (isCanExchange.value) {
|
||||||
return '立即购买'
|
return '立即购买';
|
||||||
}
|
}
|
||||||
if (pointsUser.pointBalance < item.requiredPoints) {
|
if (pointsUser.pointBalance < item.requiredPoints) {
|
||||||
const num = item.requiredPoints - pointsUser.pointBalance
|
const num = item.requiredPoints - pointsUser.pointBalance;
|
||||||
return `积分不足,还差${num}积分`
|
return `积分不足,还差${num}积分`;
|
||||||
}
|
}
|
||||||
if (item.quantity <= 0) {
|
if (item.quantity <= 0) {
|
||||||
return `库存不足`
|
return `库存不足`;
|
||||||
}
|
}
|
||||||
if (item.limitQuota && item.boughtCount >= item.limitQuota) {
|
if (item.limitQuota && item.boughtCount >= item.limitQuota) {
|
||||||
return `单人兑换已达上限`
|
return `单人兑换已达上限`;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
|
|
||||||
const query = reactive({
|
const query = reactive({
|
||||||
shopId: '',
|
shopId: '',
|
||||||
id: '',
|
id: ''
|
||||||
})
|
});
|
||||||
|
|
||||||
|
const coverImgs = ref([]);
|
||||||
const coverImgs = ref([])
|
|
||||||
|
|
||||||
async function init(opt) {
|
async function init(opt) {
|
||||||
// 获取小程序进入场景和参数
|
// 获取小程序进入场景和参数
|
||||||
@@ -476,24 +432,23 @@
|
|||||||
// 获取链接上的参数
|
// 获取链接上的参数
|
||||||
const launchOptionsQuery = launchOptions.query;
|
const launchOptionsQuery = launchOptions.query;
|
||||||
console.log('launchOptionsQuery', launchOptionsQuery);
|
console.log('launchOptionsQuery', launchOptionsQuery);
|
||||||
Object.assign(query, launchOptionsQuery)
|
Object.assign(query, launchOptionsQuery);
|
||||||
console.log(opt)
|
console.log(opt);
|
||||||
Object.assign(query, opt)
|
Object.assign(query, opt);
|
||||||
console.log(query)
|
console.log(query);
|
||||||
await storelogin.actionslogin()
|
await storelogin.actionslogin();
|
||||||
getDetail()
|
getDetail();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDetail() {
|
function getDetail() {
|
||||||
Api.getPackageDetail(query).then(res => {
|
Api.getPackageDetail(query).then((res) => {
|
||||||
Object.assign(item, res)
|
Object.assign(item, res);
|
||||||
console.log(item)
|
console.log(item);
|
||||||
coverImgs.value = res.images
|
coverImgs.value = res.images;
|
||||||
uni.cache.set('shopId', item.shopId)
|
uni.cache.set('shopId', item.shopId);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算剩余时间差(毫秒)
|
* 计算剩余时间差(毫秒)
|
||||||
* @param {Object} item - 包含groupEndTime的订单/拼团对象
|
* @param {Object} item - 包含groupEndTime的订单/拼团对象
|
||||||
@@ -531,43 +486,47 @@
|
|||||||
return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
|
return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let timer = null;
|
||||||
let timer = null
|
let nowTime = ref(Date.now());
|
||||||
let nowTime = ref(Date.now())
|
|
||||||
timer = setInterval(() => {
|
timer = setInterval(() => {
|
||||||
nowTime.value = Date.now()
|
nowTime.value = Date.now();
|
||||||
}, 1000)
|
}, 1000);
|
||||||
|
|
||||||
// 组合使用:获取格式化后的剩余时间
|
// 组合使用:获取格式化后的剩余时间
|
||||||
function getRemainingHMS(item) {
|
function getRemainingHMS(item) {
|
||||||
nowTime.value
|
nowTime.value;
|
||||||
const ms = returnRemainingTime(item);
|
const ms = returnRemainingTime(item);
|
||||||
return formatTimeToHMS(ms);
|
return formatTimeToHMS(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function returnNeedPerpole(data) {
|
function returnNeedPerpole(data) {
|
||||||
return data.groupPeopleNum - data.currentPeopleNum
|
return data.groupPeopleNum - data.currentPeopleNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onLoad(async (opt) => {
|
||||||
|
await handleMixinOnLoad(opt);
|
||||||
|
init(opt);
|
||||||
|
});
|
||||||
|
|
||||||
onLoad(init)
|
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
uni.showShareMenu()
|
uni.showShareMenu();
|
||||||
// #endif
|
// #endif
|
||||||
onShareAppMessage(() => {
|
|
||||||
const query = `id=${item.id}&shopId=${item.shopId}`
|
onShareAppMessage(async () => {
|
||||||
return wxShare({
|
let query = await returnQuery();
|
||||||
title: item.wareName,
|
const options = {
|
||||||
|
title: item.packageName,
|
||||||
imageUrl: coverImgs.value[0],
|
imageUrl: coverImgs.value[0],
|
||||||
path: '/userPackage/goodsDetail/goodsDetail' + '?' + query,
|
path: '/userPackage/goodsDetail/goodsDetail' + '?' + query,
|
||||||
query,
|
query
|
||||||
})
|
};
|
||||||
})
|
console.log('onShareAppMessage===', options);
|
||||||
|
return wxShare(options);
|
||||||
|
});
|
||||||
|
|
||||||
const canuseTime=computed(()=>{
|
const canuseTime = computed(() => {
|
||||||
return item.useWeeks.join('、')+' '+item.useTimes
|
return item.useWeeks.join('、') + ' ' + item.useTimes;
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@@ -615,8 +574,8 @@
|
|||||||
|
|
||||||
.old-price {
|
.old-price {
|
||||||
margin-left: 16rpx;
|
margin-left: 16rpx;
|
||||||
color: #E7E7E7;
|
color: #e7e7e7;
|
||||||
opacity: .85;
|
opacity: 0.85;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
}
|
}
|
||||||
@@ -638,8 +597,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.desc {
|
.desc {
|
||||||
padding: 32rpx 28rpx;
|
padding: 32rpx 28rpx;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
@@ -653,7 +610,7 @@
|
|||||||
padding: 0 22rpx;
|
padding: 0 22rpx;
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
content: "";
|
content: '';
|
||||||
display: block;
|
display: block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 100%;
|
right: 100%;
|
||||||
@@ -666,7 +623,7 @@
|
|||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
left: 100%;
|
left: 100%;
|
||||||
content: "";
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
@@ -694,13 +651,13 @@
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
width: 556rpx;
|
width: 556rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
background-color: #E8AD7B;
|
background-color: #e8ad7b;
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
|
|
||||||
&.gray {
|
&.gray {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
color: #E8AD7B;
|
color: #e8ad7b;
|
||||||
border-color: #E8AD7B;
|
border-color: #e8ad7b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -753,7 +710,6 @@
|
|||||||
color: #666;
|
color: #666;
|
||||||
line-height: 42rpx;
|
line-height: 42rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottom {
|
.bottom {
|
||||||
@@ -790,7 +746,7 @@
|
|||||||
|
|
||||||
.item {
|
.item {
|
||||||
padding: 28rpx 0;
|
padding: 28rpx 0;
|
||||||
border-bottom: 2rpx solid #EDEDED;
|
border-bottom: 2rpx solid #ededed;
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
@@ -803,7 +759,7 @@
|
|||||||
.btn {
|
.btn {
|
||||||
padding: 8rpx 26rpx;
|
padding: 8rpx 26rpx;
|
||||||
border-radius: 36rpx;
|
border-radius: 36rpx;
|
||||||
background: #E8AD7B;
|
background: #e8ad7b;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
@@ -818,7 +774,7 @@
|
|||||||
border-radius: 0 0 0 24rpx;
|
border-radius: 0 0 0 24rpx;
|
||||||
color: #ed5a2e;
|
color: #ed5a2e;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
background: #FFF;
|
background: #fff;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
.share {
|
.share {
|
||||||
@@ -856,7 +812,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.table {
|
.table {
|
||||||
border: 2rpx solid #EDEDED;
|
border: 2rpx solid #ededed;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
margin: 0 52rpx;
|
margin: 0 52rpx;
|
||||||
|
|
||||||
@@ -865,7 +821,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.row {
|
.row {
|
||||||
border-top: 2rpx solid #EDEDED;
|
border-top: 2rpx solid #ededed;
|
||||||
|
|
||||||
&:first-child {
|
&:first-child {
|
||||||
border-top: none;
|
border-top: none;
|
||||||
@@ -879,6 +835,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.guodu {
|
.guodu {
|
||||||
transition: all .3s;
|
transition: all 0.3s;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -167,6 +167,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<LookQrcode v-model="modalData.show" :qrcode="qrcode"></LookQrcode>
|
<LookQrcode v-model="modalData.show" :qrcode="qrcode"></LookQrcode>
|
||||||
|
<ymf-share-popup ></ymf-share-popup>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -513,9 +514,9 @@
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad((opt) => {
|
||||||
APIusershopInfodetail({
|
APIusershopInfodetail({
|
||||||
shopId: uni.cache.get('shopId')
|
shopId: uni.cache.get('shopId')||opt.shopId
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
shopInfo.value = res.shopInfo
|
shopInfo.value = res.shopInfo
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
329
utils/share.js
329
utils/share.js
@@ -1,5 +1,30 @@
|
|||||||
|
import {
|
||||||
|
autoBindInviteUser,
|
||||||
|
autoGetInviteCode
|
||||||
|
} from '@/common/api/market/distribution.js'
|
||||||
|
|
||||||
|
import {
|
||||||
|
shareClaim
|
||||||
|
} from '@/common/api/market/share.js'
|
||||||
|
import {
|
||||||
|
APIshopUserInfo,
|
||||||
|
APIusershopInfodetail
|
||||||
|
} from '@/common/api/member.js'
|
||||||
|
import {
|
||||||
|
productStore
|
||||||
|
} from '@/stores/user.js';
|
||||||
|
const accountStore = productStore();
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
const accountInfo = wx.getAccountInfoSync();
|
const accountInfo = wx.getAccountInfoSync();
|
||||||
export const envVersion = accountInfo.miniProgram.envVersion;
|
export const envVersion = accountInfo.miniProgram.envVersion;
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef H5
|
||||||
|
const accountInfo = {};
|
||||||
|
export const envVersion = 'release'
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
let type = 3;
|
let type = 3;
|
||||||
if (envVersion === 'trial') {
|
if (envVersion === 'trial') {
|
||||||
console.log('当前环境是体验版');
|
console.log('当前环境是体验版');
|
||||||
@@ -12,10 +37,314 @@ if (envVersion === 'trial') {
|
|||||||
console.log('当前环境是开发版或其他');
|
console.log('当前环境是开发版或其他');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const pageTags = {
|
||||||
|
'/userPackage/index/index': 'pp-list', //套餐推广列表页
|
||||||
|
'/userPackage/goodsDetail/goodsDetail': 'pp-detail', //套餐推广商品详情页
|
||||||
|
'/groupBuying/index/index': 'gb-list', //商品拼团列表页
|
||||||
|
'/groupBuying/goodsDetail/goodsDetail': 'gb-detail', //商品拼团详情页
|
||||||
|
'/distribution/shop-detail/index': 'dis', //全民股东页面
|
||||||
|
'/pages/index/index': 'index', //店铺首页
|
||||||
|
'/pages/product/index': 'eat', //点餐页
|
||||||
|
'/pages/product/index?pTag=eat-detail': 'eat-detail', //点餐商品详情弹窗页
|
||||||
|
'/scoreShop/index/index':'point' ,//积分商品
|
||||||
|
'/scoreShop/detail/index':'point-detail' ,//积分商品详情
|
||||||
|
}
|
||||||
|
|
||||||
|
export function returnPageTags(page) {
|
||||||
|
for (let key in pageTags) {
|
||||||
|
if (page.includes(key)) {
|
||||||
|
if (page.includes('/pages/product/index')) {
|
||||||
|
if (page.includes('showGoodsId=')||page.includes('goodsId=')) {
|
||||||
|
return 'eat-detail'
|
||||||
|
} else {
|
||||||
|
return 'eat'
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return pageTags[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 绑定用户邀请关系(核心函数)
|
||||||
|
* 功能说明:校验邀请码有效性,有效则调用自动绑定接口完成邀请关系绑定
|
||||||
|
* @param {Object} args - 绑定邀请关系的入参对象
|
||||||
|
* @param {number} args.fromUserId - 需要绑定邀请人的用户ID(integer <int64>,必填)
|
||||||
|
* @param {number} args.shopId - 店铺ID(integer <int64>,必填)
|
||||||
|
* @param {string} args.pTag - 来源页面类型
|
||||||
|
* @returns {void} 无返回值
|
||||||
|
*/
|
||||||
|
export async function bindInvite(args) {
|
||||||
|
// 解构入参对象,获取需要的核心参数
|
||||||
|
const {
|
||||||
|
fromUserId,
|
||||||
|
shopId,
|
||||||
|
pTag,
|
||||||
|
} = args;
|
||||||
|
console.log('bindInvite',args);
|
||||||
|
if (!fromUserId || !shopId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const shopUserInfo = uni.cache.get('shopUserInfo')
|
||||||
|
// 邀请码有效,调用自动绑定邀请人接口,传递绑定所需参数
|
||||||
|
return await shareClaim({
|
||||||
|
tagType: pTag || '',
|
||||||
|
shopId,
|
||||||
|
fromUserId: fromUserId,
|
||||||
|
toUserId: shopUserInfo.id
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export function wxShare(par) {
|
export function wxShare(par) {
|
||||||
|
const path = par.path
|
||||||
|
const pTag = returnPageTags(path)
|
||||||
|
if (pTag) {
|
||||||
|
par.path += '&pTag=' + pTag
|
||||||
|
par.query += '&pTag=' + pTag
|
||||||
|
}
|
||||||
|
console.log('pTag', pTag);
|
||||||
|
console.log('wxShare', {
|
||||||
|
...par,
|
||||||
|
type
|
||||||
|
});
|
||||||
return {
|
return {
|
||||||
...par,
|
...par,
|
||||||
type
|
type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function returnCommonQuery() {
|
||||||
|
const shopId = uni.cache.get('shopId')
|
||||||
|
const shopUserInfo = uni.cache.get('shopUserInfo')
|
||||||
|
const shopInfo = uni.cache.get('shopInfo')
|
||||||
|
// const inviteCode = await autoGetInviteCode({
|
||||||
|
// shopId: shopId,
|
||||||
|
// fromUserId: shopUserInfo.id
|
||||||
|
// })
|
||||||
|
|
||||||
|
const queryJson = {
|
||||||
|
// inviteCode: (inviteCode && inviteCode !== true) ? inviteCode : null,
|
||||||
|
shopId,
|
||||||
|
fromUserId: shopUserInfo.id,
|
||||||
|
}
|
||||||
|
return Promise.resolve(queryJson)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function jsonToUrl(json) {
|
||||||
|
let result = ''
|
||||||
|
for (let key in json) {
|
||||||
|
if (json[key]) {
|
||||||
|
if (result === '') {
|
||||||
|
result += `${key}=${json[key]}`
|
||||||
|
} else {
|
||||||
|
result += `&${key}=${json[key]}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Object} query 参数对象
|
||||||
|
* @param {Array} showkeys 需要显示的key不包括公共参数
|
||||||
|
*/
|
||||||
|
export async function returnQuery(query, showkeys) {
|
||||||
|
|
||||||
|
|
||||||
|
const shopId = uni.cache.get('shopId')
|
||||||
|
const shopUserInfo = uni.cache.get('shopUserInfo')
|
||||||
|
const shopInfo = uni.cache.get('shopInfo')
|
||||||
|
// const inviteCode = await autoGetInviteCode({
|
||||||
|
// shopId: shopId,
|
||||||
|
// fromUserId: shopUserInfo.id
|
||||||
|
// })
|
||||||
|
|
||||||
|
const pages = getCurrentPages();
|
||||||
|
const currentPage = pages[pages.length - 1];
|
||||||
|
const currentPath = currentPage.route;
|
||||||
|
const currentOptions = currentPage.options;
|
||||||
|
|
||||||
|
|
||||||
|
let sharePath = `/${currentPath}`;
|
||||||
|
const queryJson = {
|
||||||
|
// inviteCode: (inviteCode && inviteCode !== true) ? inviteCode : null,
|
||||||
|
shopId,
|
||||||
|
fromUserId: shopUserInfo.id,
|
||||||
|
...query
|
||||||
|
}
|
||||||
|
for (const key in currentOptions) {
|
||||||
|
if (currentOptions.hasOwnProperty(key)) {
|
||||||
|
if (showkeys && Array.isArray(showkeys) && showkeys.includes(key)) {
|
||||||
|
queryJson[key] = encodeURIComponent(currentOptions[key])
|
||||||
|
} else {
|
||||||
|
queryJson[key] = encodeURIComponent(currentOptions[key])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
queryJson.shopId = shopId
|
||||||
|
// queryJson.inviteCode = (inviteCode && inviteCode !== true) ? inviteCode : null
|
||||||
|
queryJson.fromUserId = shopUserInfo.id
|
||||||
|
|
||||||
|
let result = ''
|
||||||
|
for (let key in queryJson) {
|
||||||
|
if (queryJson[key]) {
|
||||||
|
if (result === '') {
|
||||||
|
result += `${key}=${queryJson[key]}`
|
||||||
|
} else {
|
||||||
|
result += `&${key}=${queryJson[key]}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Promise.resolve(result)
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseQueryString(queryString) {
|
||||||
|
const queryParams = queryString.split("&").map((param) => param.split("="));
|
||||||
|
const params = {};
|
||||||
|
for (const [key, value] of queryParams) {
|
||||||
|
params[key] = value;
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 混入的 onLoad 核心逻辑(抽成独立函数)
|
||||||
|
* @param {Object} opt - 页面 onLoad 接收的参数
|
||||||
|
* @param {Object} vm - 组件实例(this)
|
||||||
|
*/
|
||||||
|
export async function handleMixinOnLoad(opt, vm) {
|
||||||
|
console.log('onLoad');
|
||||||
|
const options = {}
|
||||||
|
if (opt.q) {
|
||||||
|
const q = decodeURIComponent(opt.q);
|
||||||
|
const params = parseQueryString(q.split("?")[1]);
|
||||||
|
Object.assign(options, params);
|
||||||
|
} else {
|
||||||
|
Object.assign(options, opt);
|
||||||
|
}
|
||||||
|
console.log('options', options);
|
||||||
|
if (options.shopId) {
|
||||||
|
uni.cache.set('shopId', options.shopId)
|
||||||
|
accountStore.shopId = options.shopId
|
||||||
|
await accountStore.pageOnload()
|
||||||
|
}
|
||||||
|
uni.setStorageSync('loadFinsh', true)
|
||||||
|
|
||||||
|
if (options.shopId) {
|
||||||
|
return await bindInvite(options)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
import {
|
||||||
|
isJsonArrayString
|
||||||
|
} from '@/utils/util.js';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回店铺首页图片
|
||||||
|
*/
|
||||||
|
export function returnIndexBg() {
|
||||||
|
try {
|
||||||
|
const orderVIP = uni.cache.get('orderVIP')
|
||||||
|
if (!orderVIP || !orderVIP.shopExtendList) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
if (!isJsonArrayString(orderVIP.shopExtendList[0].value)) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
return JSON.parse(orderVIP.shopExtendList[0].value)[0]
|
||||||
|
} catch (error) {
|
||||||
|
console.error('orderVIP.shopExtendList[0].value 格式不正确')
|
||||||
|
return ''
|
||||||
|
//TODO handle the exception
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// utils/share.js
|
||||||
|
export const shareMixin = {
|
||||||
|
|
||||||
|
|
||||||
|
async onShareAppMessage(res) {
|
||||||
|
|
||||||
|
const shopInfo = uni.cache.get('shopInfo')
|
||||||
|
const pages = getCurrentPages();
|
||||||
|
const currentPage = pages[pages.length - 1];
|
||||||
|
const currentPath = currentPage.route;
|
||||||
|
const currentOptions = currentPage.options;
|
||||||
|
|
||||||
|
let sharePath = `/${currentPath}`;
|
||||||
|
|
||||||
|
|
||||||
|
let query = await returnQuery()
|
||||||
|
const indexBg = returnIndexBg()
|
||||||
|
console.log('indexBg', indexBg);
|
||||||
|
const imageUrl = indexBg || shopInfo.logo
|
||||||
|
|
||||||
|
// 全局默认配置(可被页面覆盖)
|
||||||
|
const defaultShareConfig = {
|
||||||
|
title: shopInfo.shopName,
|
||||||
|
path: sharePath + '?' + query,
|
||||||
|
imageUrl: imageUrl,
|
||||||
|
query,
|
||||||
|
// desc: '描述',
|
||||||
|
success: (res) => {
|
||||||
|
console.log('分享好友成功', res);
|
||||||
|
// 可加埋点等统一逻辑
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('分享好友失败', err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 页面自定义配置覆盖全局
|
||||||
|
const pageShareConfig = this.$options.shareConfig || {};
|
||||||
|
console.log('mixIn onShareAppMessage', {
|
||||||
|
...defaultShareConfig,
|
||||||
|
...pageShareConfig
|
||||||
|
})
|
||||||
|
return wxShare({
|
||||||
|
...defaultShareConfig,
|
||||||
|
...pageShareConfig
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
async onShareTimeline() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const shopInfo = uni.cache.get('shopInfo')
|
||||||
|
|
||||||
|
const pages = getCurrentPages();
|
||||||
|
const currentPage = pages[pages.length - 1];
|
||||||
|
const currentPath = currentPage.route;
|
||||||
|
const currentOptions = currentPage.options;
|
||||||
|
|
||||||
|
|
||||||
|
let sharePath = `/${currentPath}`;
|
||||||
|
|
||||||
|
|
||||||
|
let query = await returnQuery()
|
||||||
|
const indexBg = returnIndexBg()
|
||||||
|
const imageUrl = indexBg || shopInfo.logo
|
||||||
|
|
||||||
|
|
||||||
|
const defaultTimelineConfig = {
|
||||||
|
title: shopInfo.shopName,
|
||||||
|
path: sharePath + '?' + query,
|
||||||
|
imageUrl: imageUrl,
|
||||||
|
query,
|
||||||
|
};
|
||||||
|
|
||||||
|
const pageTimelineConfig = this.$options.shareTimelineConfig || {};
|
||||||
|
return wxShare({
|
||||||
|
...defaultTimelineConfig,
|
||||||
|
...pageTimelineConfig
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -15,6 +15,7 @@ module.exports = defineConfig({
|
|||||||
{
|
{
|
||||||
"@dcloudio/uni-app": [
|
"@dcloudio/uni-app": [
|
||||||
"onShareAppMessage",
|
"onShareAppMessage",
|
||||||
|
"onShareTimeline",
|
||||||
"onLoad",
|
"onLoad",
|
||||||
"onShow",
|
"onShow",
|
||||||
"onHide",
|
"onHide",
|
||||||
|
|||||||
Reference in New Issue
Block a user