37 Commits

Author SHA1 Message Date
2afc2f9fab 修改点餐页分享 2026-01-21 17:19:04 +08:00
46105da573 Merge branch 'test' of https://newgitea.sxczgkj.cn/czg_team/cashier_wx into test 2026-01-21 16:42:23 +08:00
20a54c3bd9 增加积分商城分享 2026-01-21 16:42:18 +08:00
gyq
a0cc43e118 优化套餐、拼团、分销、积分分享功能 2026-01-21 16:41:49 +08:00
8f1b21bf00 调整分享部分方法,修改点餐页分享 2026-01-21 15:11:01 +08:00
654ed39854 增加公共分享组件 2026-01-21 10:26:20 +08:00
67ae138033 Merge branch 'test' of https://newgitea.sxczgkj.cn/czg_team/cashier_wx into test 2026-01-21 09:40:41 +08:00
c60a2115ea 封装分享功能 2026-01-21 09:40:31 +08:00
gyq
1ed28e2913 更改为本地请求连接 2026-01-20 15:03:14 +08:00
a125995808 增加分销员中心-无感-绑定邀请人统一封装处理 2026-01-20 10:16:35 +08:00
0444b68cb2 Merge branch 'prod' of https://newgitea.sxczgkj.cn/czg_team/cashier_wx into test 2026-01-20 10:08:51 +08:00
32c60b4f83 修改payType值wechatPay改为WECHAT,aliPay改为ALIPAY 2026-01-20 10:07:58 +08:00
373be0527f 注释和地图相关接口 2026-01-13 16:51:55 +08:00
402f85d61f 修复招牌菜数量回显问题 2026-01-09 11:13:33 +08:00
575e6d22b0 修复商品弹窗价格回显问题 2026-01-08 10:09:19 +08:00
dfc67e12c5 修复可选套餐价格不显示问题 2026-01-08 10:02:38 +08:00
42fc09815b 修复单规格弹窗价格不显示问题,修复关联商品价格显示问题 2026-01-08 09:47:37 +08:00
3064007137 修复商品弹窗选择不同规格价格未变的回显问题 2026-01-05 16:07:28 +08:00
d8c2aef83e 正式先隐藏联系商家功能 2025-12-29 15:43:27 +08:00
7c143efe30 修复样式层级问题 2025-12-29 15:40:00 +08:00
362f3cee96 修复我的页面积分列表换行问题 2025-12-29 15:30:17 +08:00
gyq
ca53618004 Merge branch 'test' of https://newgitea.sxczgkj.cn/czg_team/cashier_wx into test 2025-12-29 13:54:55 +08:00
gyq
cbe27a43de 新增跳转企业微信客服功能 2025-12-29 13:54:53 +08:00
5fcbba0cb4 修复确认订单页面收起按钮消失问题,修复套餐商品添加第二次失效问题 2025-12-29 13:48:37 +08:00
0944635c69 Merge branch 'test' of https://newgitea.sxczgkj.cn/czg_team/cashier_wx into test 2025-12-29 10:11:47 +08:00
067025f532 修复订单列表页面签子问题 2025-12-29 10:11:42 +08:00
gyq
8d917d49ed Merge branch 'test' of https://newgitea.sxczgkj.cn/czg_team/cashier_wx into test 2025-12-26 17:23:21 +08:00
gyq
bcc44a0886 增加跳转企业微信客服示例 2025-12-26 17:23:19 +08:00
811abf935c 修复会员判断问题 2025-12-26 17:22:39 +08:00
bde30fa70c 修复临时菜和数签子显示问题,修复下单页面商品弹窗问题 2025-12-26 16:14:42 +08:00
ac7af51a92 代合合并 2025-12-26 09:48:12 +08:00
9b78ee0f48 修复样式问题,修复拼团进度显示问题 2025-12-25 19:40:13 +08:00
113193b142 修复余额显示问题,增加未开启智慧充值禁用余额支付,修复自动删除未找到对应购物车问题 2025-12-25 11:35:04 +08:00
edd10edf9f 修复商品更新剔除下架商品问题 2025-12-24 18:47:41 +08:00
e645aa5516 修复确认订单页面没有台桌信息温柔 2025-12-24 17:59:55 +08:00
158a025ba1 修复加菜跳转问题 2025-12-24 17:31:09 +08:00
4d7c388f74 修复分销明细详情总数显示问题 2025-12-24 15:56:03 +08:00
49 changed files with 6498 additions and 7593 deletions

View File

@@ -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
// })
} }
//登录 //登录

View File

@@ -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,11 @@ export const getConfig = (data) => {
}; };
// 分销员中心-无感-绑定邀请人
export const autoBindInviteUser = (data) => {
return request({
url: prveUrl + "/user/distribution/autoBindInviteUser",
method: "post",
data: data,
});
};

View File

@@ -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) => {

View File

@@ -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) => {

View File

@@ -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
//订单列表 //订单列表

View File

@@ -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) => {

View File

@@ -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 秒

View File

@@ -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,

View File

@@ -44,6 +44,9 @@ page,
image { image {
display: block; display: block;
} }
.relative{
position: relative;
}
.absolute{ .absolute{
position: absolute; position: absolute;
} }

View File

@@ -55,7 +55,7 @@
</template> </template>
</view> </view>
<!-- 优惠券名称与领取按钮 --> <!-- 优惠券名称与领取按钮 -->
<view class="u-flex u-row-between u-m-t-16"> <view class="u-flex u-row-between u-m-t-16 u-col-center">
<view> <view>
<text class="title">{{ item.couponInfo.title }}</text> <text class="title">{{ item.couponInfo.title }}</text>
<text class="num">x{{ item.num }}</text> <text class="num">x{{ item.num }}</text>
@@ -507,6 +507,7 @@ function close() {
outline: none; outline: none;
margin: 0; margin: 0;
cursor: pointer; cursor: pointer;
white-space: nowrap;
&:active { &:active {
background: #f07080; // 点击深色反馈 background: #f07080; // 点击深色反馈
} }

View File

@@ -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>

View File

@@ -1,260 +0,0 @@
<template>
<!-- 支付方式 -->
<view class="paymentMethod">
<view class="paymentMethod_content">
<view class="paymentMethod_title">支付方式</view>
<up-radio-group v-model="radiovalue" iconPlacement="right" @change="groupChanges" :size="28"
placement="column">
<block v-for="(item,index) in paymentMethodList" :key="index">
<view class="method_list" @click="groupChanges(item.type)" :class="{disabled:returnDisabled(item)}"
v-if="(index+1) == radiovalue?!changeFreeenable:true">
<view class="method_list_top">
<view class="method_list_top_left">
<image class="icon" :src="item.url" mode="aspectFill" />
<view class="method_list_top_cen">
<view class="name"> {{ item.name }} </view>
<view class="method_list_bom" v-if="item.type == 1">
<text class="balance">
当前余额{{orderVIP?(orderVIP.amount||0):0}}</text>
<text class="topUpNow" @click="goRecharge">去充值</text>
</view>
</view>
</view>
<up-radio :disabled="returnDisabled(item)" activeColor="#E8AD7B" icon-size="18" size="18" :name="item.type">
</up-radio>
</view>
</view>
</block>
</up-radio-group>
</view>
</view>
</template>
<script setup>
import {
ref,
reactive,
defineProps,
computed,
defineEmits,
watch,
watchEffect,
defineExpose
} from 'vue'
const props = defineProps({
rechargeFreeChecked: {
type: Boolean,
default: false
},
payAmount: {
type: Number,
default: 0
},
freeCheck: {
type: Boolean,
default: false
},
changeFreeenable: {
type: Boolean,
default: false
},
disablePayType: {
type: Array,
default: () => {
return []
}
}
});
function returnDisabled(item) {
if (props.disablePayType.includes(item.name)) {
return true
}else{
return false
}
}
const orderVIP = ref(null)
const emits = defineEmits(['customevent', 'groupChange']);
watchEffect(() => {
orderVIP.value = uni.cache.get('orderVIP')
})
const orderVIPfun = (data) => {
orderVIP.value = data
}
const paymentMethodList = ref([
// #ifdef MP-WEIXIN
{
name: "微信支付",
type: 2,
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png",
payType: 'wechatPay'
},
// #endif
// #ifdef MP-ALIPAY
{
name: "支付宝支付",
type: 3,
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/alipay.png",
payType: 'aliPay'
},
// #endif
{
name: "余额支付",
type: 1,
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png",
payType: 'accountPay'
}
])
const paymentMethodName = ref([{
name: "余额支付",
type: 1,
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png",
payType: 'accountPay'
},
{
name: "微信支付",
type: 2,
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png",
payType: 'wechatPay'
},
{
name: "支付宝支付",
type: 3,
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/alipay.png",
payType: 'aliPay'
},
])
const radiovalue = ref(2) // 支付方式
const ispws = ref(false) // 输入支付密码
const storeInfo = ref({})
// * 监听支付方式切换
const groupChanges = (type) => {
if (props.freeCheck && type == 1) {
return;
}
const item=paymentMethodList.value.find(v=>v.type==type)
if(item&&returnDisabled(item)){
uni.showToast({
title:"当前支付方式不可用",
icon:'none'
})
return
}
// if (props.payAmount <= 0 && type != 1) {
// return;
// }
radiovalue.value = type;
let name = paymentMethodName.value[type - 1].name;
emits("groupChange", paymentMethodName.value[type - 1])
}
// 去充值
const goRecharge = () => {
if (orderVIP.value.isVip) {
uni.navigateTo({
url: '/pages/user/member/czzx?shopId=' + orderVIP.value.shopId
})
return
}
uni.navigateTo({
url: '/user/vip/buy-vip?shopId=' + orderVIP.value.shopId
})
// uni.pro.navigateTo('user/member/index', {
// shopId: orderVIP.value.shopId
// })
}
// 将方法暴露给父组件
defineExpose({
groupChanges,
orderVIPfun
});
</script>
<style lang="scss">
.paymentMethod {
box-sizing: border-box;
margin-top: 30rpx;
border-radius: 18rpx;
.paymentMethod_content {
background-color: #fff;
border-radius: 22rpx;
padding: 30rpx 30rpx 0 30rpx;
box-sizing: border-box;
.paymentMethod_title {
font-weight: 500;
font-size: 32rpx;
color: #333333;
box-sizing: border-box;
}
.method_list {
padding: 40rpx 0;
box-sizing: border-box;
&.disabled{
opacity: .6;
}
.method_list_top {
display: flex;
justify-content: space-between;
.method_list_top_left {
display: flex;
align-items: center;
.icon {
width: 54.67rpx !important;
height: 48rpx !important;
margin-right: 22rpx;
}
.name {
font-size: 32rpx;
font-weight: 500;
color: #333;
}
.method_list_top_cen {
display: flex;
flex-direction: column;
}
}
}
.method_list_bom {
display: flex;
align-items: center;
.balance {
margin-right: 20rpx;
font-size: 24rpx;
}
.topUpNow {
color: #FF803D;
font-size: 28rpx;
}
}
}
.method_list:nth-child(odd) {
border-bottom: 2rpx solid #e5e5e5;
}
}
}
</style>

View File

@@ -15,7 +15,7 @@
<view class="name"> {{ item.name }} </view> <view class="name"> {{ item.name }} </view>
<view class="method_list_bom" v-if="item.name == '余额支付'"> <view class="method_list_bom" v-if="item.name == '余额支付'">
<text class="balance"> <text class="balance">
当前余额{{ orderVIP ? orderVIP.amount || 0 : 0 }}</text> 当前余额{{ shopUserInfo ? shopUserInfo.amount || 0 : 0 }}</text>
<text class="topUpNow" @click="goRecharge">去充值</text> <text class="topUpNow" @click="goRecharge">去充值</text>
</view> </view>
</view> </view>
@@ -66,6 +66,14 @@ const props = defineProps({
type: Array, type: Array,
default: () => [], default: () => [],
}, },
shopUserInfo:{
type: Object,
default: () => {
return{
amount:0
}
},
}
}); });
// 工具函数 - 深拷贝对象(切断引用) // 工具函数 - 深拷贝对象(切断引用)
@@ -77,15 +85,10 @@ function returnDisabled(item) {
return props.disablePayType.includes(item.name); return props.disablePayType.includes(item.name);
} }
const orderVIP = ref(null);
const emits = defineEmits(["customevent", "groupChange"]); const emits = defineEmits(["customevent", "groupChange"]);
watchEffect(() => {
orderVIP.value = uni.cache.get("orderVIP");
});
const orderVIPfun = (data) => {
orderVIP.value = data;
};
// 支付方式列表(保持不变) // 支付方式列表(保持不变)
const paymentMethodList = ref([ const paymentMethodList = ref([
@@ -94,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
@@ -207,13 +210,12 @@ const goRecharge = () => {
return; return;
} }
uni.navigateTo({ uni.navigateTo({
url: `/pages/user/member/czzx?shopId=${orderVIP.value?.shopId || ''}`, url: `/pages/user/member/czzx?shopId=${props.shopUserInfo?.shopId || ''}`,
}); });
}; };
defineExpose({ defineExpose({
groupChanges, groupChanges,
orderVIPfun,
}); });
</script> </script>

View 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="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>

View File

@@ -45,17 +45,17 @@
</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"
> >
<text class="color-666 font-12"> 总计</text> <text class="color-666 font-12"> 总计</text>
<text class="font-16 color-333 font-700" v-if="centerUserInfo"> <text class="font-16 color-333 font-700" >
{{ centerUserInfo.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>
@@ -113,6 +113,7 @@
<scroll-view <scroll-view
class="popup-list" class="popup-list"
direction="vertical" direction="vertical"
:scroll-y="true"
@scrollend="scrollBottom" @scrollend="scrollBottom"
> >
<view <view
@@ -301,6 +302,7 @@ async function centerUser() {
} }
onShow(() => {}); onShow(() => {});
onLoad(async (opt) => { onLoad(async (opt) => {
await getCouponShopsAjax(); await getCouponShopsAjax();
@@ -314,13 +316,24 @@ onLoad(async (opt) => {
} }
if (opt.shopId) { if (opt.shopId) {
querForm.value.shopId = opt.shopId; querForm.value.shopId = opt.shopId;
const findItem = couponShops.value.find((item) => item.id == opt.shopId); const findItem = shopList.value.find((item) => item.shopId == opt.shopId);
querForm.value.shopName = findItem.shopName || ""; querForm.value.shopName = findItem.shopName || "";
} }
centerUser(); centerUser();
getIncomeDetailsAjax(); getIncomeDetailsAjax();
}); });
const totalIncome=computed(()=>{
if(!querForm.value.shopId){
return centerUserInfo.value?(centerUserInfo.value.totalIncome||0):0;
}
const findItem = shopList.value.find((item) => item.shopId == querForm.value.shopId );
if(findItem){
return findItem.income||0
}
return 0
})
watch( watch(
() => querForm.value.status, () => querForm.value.status,
(newVal, oldVal) => { (newVal, oldVal) => {

View File

@@ -1,38 +1,21 @@
<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"
:opacity="0"
ref="wQrcode"
@generate="(e) => qrcodeResult(e)"
></w-qrcode>
</view> </view>
<up-popup :show="show" bgColor="transparent" :safeAreaInsetBottom="false" :closeOnClickOverlay="true" @close="close" mode="center">
<up-popup
:show="show"
bgColor="transparent"
:safeAreaInsetBottom="false"
:closeOnClickOverlay="true"
@close="close"
mode="center"
>
<view class="box"> <view class="box">
<view class="info"> <view class="info">
<view class="u-flex justify-center"> <view class="u-flex justify-center">
<up-avatar size="214rpx" :src="shopUserInfo.headImg"></up-avatar> <up-avatar size="214rpx" :src="shopUserInfo.headImg"></up-avatar>
</view> </view>
<view <view class="u-m-t-48 font-14 font-700 color-333 text-center line-height-54">
class="u-m-t-48 font-14 font-700 color-333 text-center line-height-54"
>
<view>{{ shopUserInfo.nickName }}</view> <view>{{ shopUserInfo.nickName }}</view>
<view>{{ desensitizePhone(shopUserInfo.phone) }}</view> <view>{{ desensitizePhone(shopUserInfo.phone) }}</view>
</view> </view>
<view class="u-m-t-16 font-14 line-height-54 text-center"> <view class="u-m-t-16 font-14 line-height-54 text-center">
<text class="color-666">邀请码</text> <text class="color-666">邀请码</text>
<text class="u-m-l-16 u-m-r-16 color-333 font-16 font-700">{{ <text class="u-m-l-16 u-m-r-16 color-333 font-16 font-700">{{ inviteCode }}</text>
inviteCode
}}</text>
<text class="" style="color: #fe6d11" @click="copyCode">复制</text> <text class="" style="color: #fe6d11" @click="copyCode">复制</text>
</view> </view>
<view class="u-flex justify-center" style="margin-top: 90rpx"> <view class="u-flex justify-center" style="margin-top: 90rpx">
@@ -44,10 +27,10 @@
></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 class="u-m-t-60 u-flex u-col-center justify-center">
<view class="confirm" @click="save">保存图片</view>
</view> </view>
<view class="footer-wrap">
<view class="confirm line" @click="save">保存图片</view>
<ymf-share><view class="confirm">微信分享</view></ymf-share>
</view> </view>
</view> </view>
</up-popup> </up-popup>
@@ -55,47 +38,48 @@
</template> </template>
<script setup> <script setup>
import wQrcode from "@/uni_modules/wmf-code/components/w-qrcode/w-qrcode.vue"; import ymfShare from '@/components/ymf-components/ymf-share.vue';
import {desensitizePhone} from "@/utils/util.js"; import wQrcode from '@/uni_modules/wmf-code/components/w-qrcode/w-qrcode.vue';
import { ref } from "vue"; import { desensitizePhone } from '@/utils/util.js';
import { ref } from 'vue';
const props = defineProps({ const props = defineProps({
inviteCode: { inviteCode: {
type: String, type: String,
default: "", default: ''
}, },
shopUserInfo: { shopUserInfo: {
type: Object, type: Object,
default: () => {}, default: () => {}
}, }
}); });
const codeOptions = ref({ const codeOptions = ref({
size: 200, size: 200,
code: props.inviteCode, code: props.inviteCode
}); });
function copyCode() { function copyCode() {
uni.setClipboardData({ uni.setClipboardData({
data: props.inviteCode, data: props.inviteCode,
success: function () { success: function () {
console.log("success"); console.log('success');
}, }
}); });
} }
const code = ref(""); 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;
@@ -105,7 +89,7 @@ function save() {
filePath: code.value, filePath: code.value,
success: function () { success: function () {
uni.showToast({ uni.showToast({
title: "保存成功", title: '保存成功',
icon: 'none' icon: 'none'
}); });
}, },
@@ -151,14 +135,14 @@ function save() {
} else { } else {
// 非授权问题的保存失败(如文件路径错误、系统问题等) // 非授权问题的保存失败(如文件路径错误、系统问题等)
uni.showToast({ uni.showToast({
title: "保存失败", title: '保存失败',
icon: 'none' icon: 'none'
}); });
} }
}, }
}); });
emits("confirm", code.value); emits('confirm', code.value);
} }
</script> </script>
@@ -175,7 +159,8 @@ function save() {
width: 638rpx; width: 638rpx;
background-color: #fff; background-color: #fff;
border-radius: 16rpx; border-radius: 16rpx;
overflow: hidden; // overflow: hidden;
position: relative;
.title { .title {
color: #000000; color: #000000;
font-size: 32rpx; font-size: 32rpx;
@@ -192,6 +177,14 @@ function save() {
min-width: 84rpx; min-width: 84rpx;
text-align: right; text-align: right;
} }
.footer-wrap {
width: 100%;
position: absolute;
left: 0;
bottom: -100upx;
display: flex;
gap: 28upx;
}
} }
.cancel { .cancel {
@@ -205,15 +198,23 @@ function save() {
line-height: 48rpx; line-height: 48rpx;
} }
.confirm { .confirm {
$color: #e8ad7b;
flex: 1;
padding: 14rpx 76rpx; padding: 14rpx 76rpx;
border-radius: 16rpx; border-radius: 16rpx;
background-color: #e8ad7b; background-color: $color;
border: 2rpx solid #e8ad7b; border: 2rpx solid $color;
color: #fff; color: #fff;
font-size: 32rpx; font-size: 32rpx;
font-weight: 400; font-weight: 400;
line-height: 48rpx;
white-space: nowrap; 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;
@@ -225,4 +226,3 @@ function save() {
z-index: -1; z-index: -1;
} }
</style> </style>

View File

@@ -1,74 +1,37 @@
<template> <template>
<view class="min-h-100vh bg-gray"> <view class="min-h-100vh bg-gray">
<up-navbar <up-navbar bg-color="transparent" title="分销中心" @leftClick="back" :fixed="true"></up-navbar>
bg-color="transparent"
title="分销中心"
@leftClick="back"
:fixed="true"
></up-navbar>
<view class="top"> <view class="top">
<image <image class="top_bg" src="/distribution/static/top_bg.png" :style="imageStyle"></image>
class="top_bg"
src="/distribution/static/top_bg.png"
:style="imageStyle"
></image>
<view class="box" :class="{ type1: isActivated }"> <view class="box" :class="{ type1: isActivated }">
<view class="u-flex align-center justify-between"> <view class="u-flex align-center justify-between">
<view class="u-flex align-center"> <view class="u-flex align-center">
<!-- <up-avatar size="62rpx" /> --> <!-- <up-avatar size="62rpx" /> -->
<text class="u-m-l-14 font-14 color-333 font-700">{{ <text class="u-m-l-14 font-14 color-333 font-700">{{ state.shopName }}</text>
state.shopName
}}</text>
</view> </view>
<view> <view>
<template v-if="state.parentPhone"> <template v-if="state.parentPhone">
<view class="font-12 color-666"> <view class="font-12 color-666">上级{{ state.parentName }}{{ state.parentPhone }}</view>
上级{{ state.parentName }}{{ state.parentPhone }}
</view>
</template> </template>
<template v-if="!state.parentPhone"> <template v-if="!state.parentPhone">
<view class="bind" @click="showBindShangji = true"> <view class="bind" @click="showBindShangji = true">绑定上级</view>
绑定上级
</view>
</template> </template>
</view> </view>
</view> </view>
<view <view class="top_content type1 u-m-t-32" v-if="state.distributionUser && state.distributionUser.level">
class="top_content type1 u-m-t-32"
v-if="state.distributionUser && state.distributionUser.level"
>
<view class="font-14"> <view class="font-14">
<view class="u-flex align-center"> <view class="u-flex align-center">
<text class="color-666">我的分销等级</text> <text class="color-666">我的分销等级</text>
<text <text class="color-333 font-700 u-m-r-6" v-if="state.distributionUser">
class="color-333 font-700 u-m-r-6" {{ state.distributionUser.level }} {{ state.distributionUser.levelName }}
v-if="state.distributionUser" </text>
>{{ state.distributionUser.level }} <up-icon name="question-circle" size="24rpx" color="#666" @click="questionClick('等级升级条件')" />
{{ state.distributionUser.levelName }}</text
>
<up-icon
name="question-circle"
size="24rpx"
color="#666"
@click="questionClick('等级升级条件')"
/>
</view> </view>
<view <view class="u-m-t-28 u-flex align-center" v-if="juNextLvMoney && state.distributionUser && state.distributionUser.isAssignLevel == 0">
class="u-m-t-28 u-flex align-center"
v-if="
juNextLvMoney &&
state.distributionUser &&
state.distributionUser.isAssignLevel == 0
"
>
<text class="color-666">距离下一级还差</text> <text class="color-666">距离下一级还差</text>
<text class="color-333 font-700 u-m-r-18" <text class="color-333 font-700 u-m-r-18">{{ juNextLvMoney }}</text>
>{{ juNextLvMoney }} <text class="color-333 font-700 u-m-r-18">{{ config.upgradeType == 'cost' ? '元' : '人' }}</text>
</text>
<text class="color-333 font-700 u-m-r-18"
>{{ config.upgradeType == "cost" ? "元" : "人" }}
</text>
<!-- <up-icon <!-- <up-icon
name="question-circle" name="question-circle"
size="24rpx" size="24rpx"
@@ -79,45 +42,17 @@
<view class="u-flex u-m-t-28"> <view class="u-flex u-m-t-28">
<view class="u-flex-1"> <view class="u-flex-1">
<view class="u-flex align-center"> <view class="u-flex align-center">
<text <text class="u-m-r-10 font-12 color-666" @click="toShouyiDetail('')">总收益</text>
class="u-m-r-10 font-12 color-666" <up-icon name="question-circle" size="24rpx" color="#666" @click="questionClick('总收益')" />
@click="toShouyiDetail('')"
>总收益</text
>
<up-icon
name="question-circle"
size="24rpx"
color="#666"
@click="questionClick('总收益')"
/>
</view> </view>
<view <view class="u-m-t-16 price" @click="toShouyiDetail('')" v-if="state.distributionUser">{{ state.distributionUser.totalIncome }}</view>
class="u-m-t-16 price"
@click="toShouyiDetail('')"
v-if="state.distributionUser"
>{{ state.distributionUser.totalIncome }}</view
>
</view> </view>
<view class="u-flex-1"> <view class="u-flex-1">
<view class="u-flex align-center"> <view class="u-flex align-center">
<text <text class="u-m-r-10 font-12 color-666" @click="toShouyiDetail('待入账')">待入账</text>
class="u-m-r-10 font-12 color-666" <up-icon name="question-circle" size="24rpx" color="#666" @click="questionClick('待入账')" />
@click="toShouyiDetail('待入账')"
>待入账</text
>
<up-icon
name="question-circle"
size="24rpx"
color="#666"
@click="questionClick('待入账')"
/>
</view> </view>
<view <view class="u-m-t-16 price" @click="toShouyiDetail('待入账')" v-if="state.distributionUser">{{ state.distributionUser.pendingIncome }}</view>
class="u-m-t-16 price"
@click="toShouyiDetail('待入账')"
v-if="state.distributionUser"
>{{ state.distributionUser.pendingIncome }}</view
>
</view> </view>
</view> </view>
</view> </view>
@@ -128,34 +63,18 @@
<view class="color-333 font-16 font-700">如何成为分销员</view> <view class="color-333 font-16 font-700">如何成为分销员</view>
<view class="u-m-t-16 color-666 font-14"> <view class="u-m-t-16 color-666 font-14">
<view>需要邀请人数{{ config.inviteCount }}</view> <view>需要邀请人数{{ config.inviteCount }}</view>
<view <view>是否需要邀请人数下单{{ config.inviteConsume ? '是' : '否' }}</view>
>是否需要邀请人数下单:{{ <view>每人可获得的分销奖励次数{{ config.rewardCount == -1 ? '永久' : config.rewardCount + '次' }}</view>
config.inviteConsume ? "是" : "否"
}}
</view>
<view
>每人可获得的分销奖励次数:{{
config.rewardCount == -1
? "永久"
: config.rewardCount + "次"
}}
</view>
</view> </view>
</template> </template>
<template v-if="config.openType == 'pay'"> <template v-if="config.openType == 'pay'">
<view class="color-333 font-16 font-700 text-center"> <view class="color-333 font-16 font-700 text-center">如何成为分销员</view>
如何成为分销员
</view>
<view class="u-m-t-16 color-666 font-14 text-center"> <view class="u-m-t-16 color-666 font-14 text-center">
<view <view>只需付费{{ config.payAmount || '' }}即可成为分销员</view>
>只需付费{{ config.payAmount || "" }}元,即可成为分销员</view
>
</view> </view>
</template> </template>
<template v-if="config.openType == 'manual'"> <template v-if="config.openType == 'manual'">
<view class="color-333 font-16 font-700 text-center"> <view class="color-333 font-16 font-700 text-center">如何成为分销员</view>
如何成为分销员
</view>
<view class="u-m-t-16 color-666 font-14 text-center"> <view class="u-m-t-16 color-666 font-14 text-center">
<view>请联系商家咨询详情</view> <view>请联系商家咨询详情</view>
</view> </view>
@@ -168,42 +87,18 @@
<view class="bottom type1" v-if="isActivated"> <view class="bottom type1" v-if="isActivated">
<view class="u-flex justify-between align-center"> <view class="u-flex justify-between align-center">
<view class="u-flex align-center"> <view class="u-flex align-center">
<view class="color-333 font-16 u-m-r-6" <view class="color-333 font-16 u-m-r-6">我的邀请{{ inviteUserRes.totalRow }}</view>
>我的邀请({{ inviteUserRes.totalRow }}</view <up-icon name="question-circle" size="24rpx" @click="showRule = true" color="#666" />
>
<up-icon
name="question-circle"
size="24rpx"
@click="showRule = true"
color="#666"
/>
</view> </view>
<view class="font-10 color-999 u-flex align-center"> <view class="font-10 color-999 u-flex align-center">
<text <text>分成比例{{ state.distributionUser.levelOneCommission || 0 }}%</text>
>分成比例{{ state.distributionUser.levelOneCommission || 0 }}%</text <up-icon name="question-circle" size="24rpx" color="#666" @click="questionClick('等级分成比例')" />
>
<up-icon
name="question-circle"
size="24rpx"
color="#666"
@click="questionClick('等级分成比例')"
/>
</view> </view>
</view> </view>
<view class="tabs" v-if="false"> <view class="tabs" v-if="false">
<view <view class="tabs-item" :class="{ active: activeTab == 'distributor' }" @click="activeTab = 'distributor'">分销员</view>
class="tabs-item" <view class="tabs-item" :class="{ active: activeTab == 'inviter' }" @click="activeTab = 'inviter'">邀请人</view>
:class="{ active: activeTab == 'distributor' }"
@click="activeTab = 'distributor'"
>分销员</view
>
<view
class="tabs-item"
:class="{ active: activeTab == 'inviter' }"
@click="activeTab = 'inviter'"
>邀请人</view
>
</view> </view>
<view class="u-m-t-48 font-14"> <view class="u-m-t-48 font-14">
@@ -213,11 +108,7 @@
<view>邀请时间</view> <view>邀请时间</view>
</view> </view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<view <view v-for="(item, index) in userList" :key="index" class="u-flex justify-between align-center recoder-item color-666 font-12">
v-for="(item, index) in userList"
:key="index"
class="u-flex justify-between align-center recoder-item color-666 font-12"
>
<view class=""> <view class="">
<view class="u-line-1" style="max-width: 160rpx"> <view class="u-line-1" style="max-width: 160rpx">
<text> <text>
@@ -232,15 +123,11 @@
</view> </view>
<view> <view>
<text>{{ item.oneIncome }}</text> <text>{{ item.oneIncome }}</text>
<text v-if="item.distributionLevelName" <text v-if="item.distributionLevelName">{{ item.distributionLevelName }}</text>
>{{ item.distributionLevelName }}</text
>
</view> </view>
<view> <view>
<text v-if="item.inviteTime">{{ <text v-if="item.inviteTime">{{ item.inviteTime.split(' ')[0] }}</text>
item.inviteTime.split(" ")[0] <text style="color: #fff" v-else>{{ 'yyyy-MM-dd' }}</text>
}}</text>
<text style="color: #fff" v-else>{{ "yyyy-MM-dd" }}</text>
</view> </view>
</view> </view>
</view> </view>
@@ -257,13 +144,7 @@
<view>我的收益什么时候可以到账</view> <view>我的收益什么时候可以到账</view>
<view>分销的结算时长为{{ config.settlementDay || 0 }}</view> <view>分销的结算时长为{{ config.settlementDay || 0 }}</view>
</view> </view>
<template <template v-if="config.upgradeType != 'not_upgrade' && config.levelConfigList && config.levelConfigList.length >= 2">
v-if="
config.upgradeType != 'not_upgrade' &&
config.levelConfigList &&
config.levelConfigList.length >= 2
"
>
<view class="u-m-t-40"> <view class="u-m-t-40">
<view>怎么样才能升级分销员等级</view> <view>怎么样才能升级分销员等级</view>
@@ -284,9 +165,7 @@
<view class="u-m-t-40" v-if="config.upgradeType == 'cost'"> <view class="u-m-t-40" v-if="config.upgradeType == 'cost'">
<view>消费金额如何计算</view> <view>消费金额如何计算</view>
<view <view>消费金额是计算您和您邀请的人在店铺消费的总金额但退款订单不计入</view>
>消费金额是计算您和您邀请的人在店铺消费的总金额,但退款订单不计入</view
>
</view> </view>
</view> </view>
</view> </view>
@@ -297,11 +176,7 @@
<view style="height: 240rpx"></view> <view style="height: 240rpx"></view>
</template> </template>
<view <view class="tips u-m-t-32" v-if="state.distributionUser && state.distributionUser.status">您的分销员身份已取消不再获得分成有疑问可联系商家</view>
class="tips u-m-t-32"
v-if="state.distributionUser && state.distributionUser.status"
>您的分销员身份已取消,不再获得分成有疑问可联系商家</view
>
<view class="u-flex justify-center bottom-btn" v-if="showInviteCode"> <view class="u-flex justify-center bottom-btn" v-if="showInviteCode">
<view class="copy" @click="copyCode"> <view class="copy" @click="copyCode">
@@ -313,98 +188,72 @@
</view> </view>
</view> </view>
<view <view class="buy" v-if="config.openType == 'pay' && config.payAmount && !isActivated" @click="buy">付费{{ config.payAmount }}元开通</view>
class="buy"
v-if="config.openType == 'pay' && config.payAmount && !isActivated"
@click="buy"
>
付费{{ config.payAmount }}元开通
</view>
<bindShangji <bindShangji v-model="showBindShangji" @confirm="confirmBindShangji"></bindShangji>
v-model="showBindShangji"
@confirm="confirmBindShangji"
></bindShangji>
<sharePopup <sharePopup
v-model="showSharePopup" v-model="showSharePopup"
v-if=" v-if="(state.distributionUser && state.distributionUser.inviteCode) || inviteCode"
(state.distributionUser && state.distributionUser.inviteCode) || :inviteCode="state.distributionUser ? state.distributionUser.inviteCode : inviteCode"
inviteCode
"
:inviteCode="
state.distributionUser ? state.distributionUser.inviteCode : inviteCode
"
:shopUserInfo="shopUserInfo" :shopUserInfo="shopUserInfo"
></sharePopup> ></sharePopup>
<TipsPopup v-model="showPopup" :tips-type="tipsType"></TipsPopup> <TipsPopup v-model="showPopup" :tips-type="tipsType"></TipsPopup>
<commissionPopup <commissionPopup :tipsType="commissionTipsType" v-model="showCommission" :config="config" :levelConfigList="config.levelConfigList || []"></commissionPopup>
:tipsType="commissionTipsType" <rulePopup v-model="showRule" :config="config" :distributionUser="state.distributionUser"></rulePopup>
v-model="showCommission"
:config="config"
:levelConfigList="config.levelConfigList || []"
></commissionPopup>
<rulePopup
v-model="showRule"
:config="config"
:distributionUser="state.distributionUser"
></rulePopup>
</view> </view>
</template> </template>
<script setup> <script setup>
import bindShangji from "./components/bind-shangji.vue"; import { shareMixin, handleMixinOnLoad, returnQuery } from '@/utils/share.js';
import sharePopup from "./components/share-popup.vue"; import bindShangji from './components/bind-shangji.vue';
import TipsPopup from "../components/tips-popup.vue"; import sharePopup from './components/share-popup.vue';
import commissionPopup from "../components/commission.vue"; import TipsPopup from '../components/tips-popup.vue';
import rulePopup from "../components/rule.vue"; import commissionPopup from '../components/commission.vue';
import { desensitizePhone } from "@/utils/util.js"; import rulePopup from '../components/rule.vue';
import BigNumber from "bignumber.js"; import { desensitizePhone } from '@/utils/util.js';
import * as distributionApi from "@/common/api/market/distribution.js"; import BigNumber from 'bignumber.js';
import { distributionLtPayOrder } from "@/common/api/order/index.js"; import * as distributionApi from '@/common/api/market/distribution.js';
import { APIshopUserInfo } from "@/common/api/member.js"; import { distributionLtPayOrder } from '@/common/api/order/index.js';
import { pay } from "@/utils/pay.js"; import { APIshopUserInfo } from '@/common/api/member.js';
import { onLoad, onReachBottom } from "@dcloudio/uni-app"; import { pay } from '@/utils/pay.js';
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
const showBindShangji = ref(false); const showBindShangji = ref(false);
const showSharePopup = ref(false); const showSharePopup = ref(false);
import { ref, reactive, computed, watch } from "vue"; import { ref, reactive, computed, watch } from 'vue';
const content = ref(""); const content = ref('');
const showPopup = ref(false); const showPopup = ref(false);
const showRule = ref(false); const showRule = ref(false);
const showCommission = ref(false); const showCommission = ref(false);
const tipsType = ref(""); const tipsType = ref('');
const commissionTipsType = ref(""); const commissionTipsType = ref('');
function toShouyiDetail(name) { function toShouyiDetail(name) {
uni.navigateTo({ uni.navigateTo({
url: url: '/distribution/income-details/index?name=' + name + '&shopId=' + options.shopId
"/distribution/income-details/index?name=" +
name +
"&shopId=" +
options.shopId,
}); });
} }
function questionClick(title) { function questionClick(title) {
if (title == "总收益") { if (title == '总收益') {
tipsType.value = "总收益"; tipsType.value = '总收益';
showPopup.value = true; showPopup.value = true;
} }
if (title == "待入账") { if (title == '待入账') {
tipsType.value = "待入账"; tipsType.value = '待入账';
showPopup.value = true; showPopup.value = true;
} }
if (title == "等级分成比例") { if (title == '等级分成比例') {
commissionTipsType.value = "等级分成比例"; commissionTipsType.value = '等级分成比例';
showCommission.value = true; showCommission.value = true;
} }
if (title == "等级升级条件") { if (title == '等级升级条件') {
commissionTipsType.value = "等级升级条件"; commissionTipsType.value = '等级升级条件';
showCommission.value = true; showCommission.value = true;
} }
} }
function back() { function back() {
uni.navigateBack({ uni.navigateBack({
delta: 1, delta: 1
}); });
} }
@@ -412,12 +261,12 @@ async function confirmBindShangji(code) {
const res = await distributionApi.bindInviteUser({ const res = await distributionApi.bindInviteUser({
shopId: options.shopId, shopId: options.shopId,
inviteCode: code, inviteCode: code,
id: shopUserInfo.value.id, id: shopUserInfo.value.id
}); });
if (res) { if (res) {
uni.showToast({ uni.showToast({
title: "绑定成功", title: '绑定成功',
icon: "none", icon: 'none'
}); });
setTimeout(() => { setTimeout(() => {
init(); init();
@@ -434,32 +283,32 @@ function copyCode() {
uni.setClipboardData({ uni.setClipboardData({
data: inviteCode.value, data: inviteCode.value,
success: function () { success: function () {
console.log("success"); console.log('success');
}, }
}); });
} }
const shopUserInfo = ref(); const shopUserInfo = ref();
const config = reactive({}); const config = reactive({});
//邀请码 //邀请码
const inviteCode = ref(""); const inviteCode = ref('');
async function init() { async function init() {
const shopUserRes = await APIshopUserInfo({ const shopUserRes = await APIshopUserInfo({
shopId: options.shopId, shopId: options.shopId
}); });
const configRes = await distributionApi.getConfig({ const configRes = await distributionApi.getConfig({
shopId: options.shopId, shopId: options.shopId
}); });
Object.assign(config, configRes); Object.assign(config, configRes);
if (shopUserRes) { if (shopUserRes) {
shopUserInfo.value = shopUserRes; shopUserInfo.value = shopUserRes;
} }
if (configRes && configRes.openType == "auto") { if (configRes && configRes.openType == 'auto') {
const codeRes = await distributionApi.getInviteCode({ const codeRes = await distributionApi.getInviteCode({
shopId: options.shopId, shopId: options.shopId,
shopUserId: shopUserRes.id, shopUserId: shopUserRes.id
}); });
if (codeRes) { if (codeRes) {
inviteCode.value = codeRes; inviteCode.value = codeRes;
@@ -467,41 +316,41 @@ async function init() {
} }
const res = await distributionApi.centerConfig({ const res = await distributionApi.centerConfig({
shopId: options.shopId, shopId: options.shopId
}); });
if (res) { if (res) {
if (res.distributionId) { if (res.distributionId) {
options.type = "activates"; options.type = 'activates';
} }
Object.assign(state, res); Object.assign(state, res);
if (res.distributionUser) { if (res.distributionUser) {
inviteCode.value = res.distributionUser.inviteCode; inviteCode.value = res.distributionUser.inviteCode;
} }
content.value = res.config ? res.config.notActivatedPage : ""; content.value = res.config ? res.config.notActivatedPage : '';
} }
} }
const options = reactive({ type: "" }); const options = reactive({ type: '' });
const imageStyle = computed(() => { const imageStyle = computed(() => {
return { return {
height: isActivated.value ? "580rpx" : "580rpx", height: isActivated.value ? '580rpx' : '580rpx'
}; };
}); });
async function buy() { async function buy() {
const res = await distributionLtPayOrder({ const res = await distributionLtPayOrder({
shopId: options.shopId, shopId: options.shopId,
userId: uni.cache.get("userInfo") ? uni.cache.get("userInfo").id : "", userId: uni.cache.get('userInfo') ? uni.cache.get('userInfo').id : '',
returnUrl: "", returnUrl: '',
buyerRemark: "", buyerRemark: '',
amount: "", amount: '',
remark: "", remark: '',
code: "", code: ''
}); });
const payRes = await pay(res); const payRes = await pay(res);
if (payRes) { if (payRes) {
uni.showToast({ uni.showToast({
title: "购买成功", title: '购买成功',
icon: "none", icon: 'none'
}); });
setTimeout(() => { setTimeout(() => {
init(); init();
@@ -511,39 +360,36 @@ async function buy() {
} }
const state = reactive({ const state = reactive({
parentPhone: "", parentPhone: '',
parentName: "", parentName: '',
shopName: "", shopName: ''
}); });
const query = reactive({ const query = reactive({
page: 1, page: 1,
size: 10, size: 10
}); });
const isEnd = ref(false); const isEnd = ref(false);
const activeTab = ref("inviter"); const activeTab = ref('inviter');
const userList = ref([]); const userList = ref([]);
const inviteUserRes = reactive({ const inviteUserRes = reactive({
records: [], records: [],
totalRow: 0, totalRow: 0,
totalPage: 0, totalPage: 0
}); });
async function getRecoders() { async function getRecoders() {
if (state.config) return; if (state.config) return;
const ajaxQuery = { const ajaxQuery = {
...query, ...query,
shopId: options.shopId, shopId: options.shopId
}; };
if (activeTab.value == "distributor") { if (activeTab.value == 'distributor') {
ajaxQuery.parentId = state.distributionUser.distributionId; ajaxQuery.parentId = state.distributionUser.distributionId;
} else { } else {
ajaxQuery.id = state.distributionUser.distributionId; ajaxQuery.id = state.distributionUser.distributionId;
} }
const res = const res = activeTab.value == 'distributor' ? await distributionApi.childUser(ajaxQuery) : await distributionApi.inviteUser(ajaxQuery);
activeTab.value == "distributor"
? await distributionApi.childUser(ajaxQuery)
: await distributionApi.inviteUser(ajaxQuery);
if (res) { if (res) {
Object.assign(inviteUserRes, res); Object.assign(inviteUserRes, res);
if (query.page == 1) { if (query.page == 1) {
@@ -558,11 +404,9 @@ const nextLvMoney = computed(() => {
let nextLv = undefined; let nextLv = undefined;
if (!config.levelConfigList || !config.levelConfigList.length) { if (!config.levelConfigList || !config.levelConfigList.length) {
return ""; return '';
} }
const nowLevel = state.distributionUser const nowLevel = state.distributionUser ? state.distributionUser.level || 1 : 1;
? state.distributionUser.level || 1
: 1;
if (!nowLevel) { if (!nowLevel) {
nextLv = config.levelConfigList[0]; nextLv = config.levelConfigList[0];
} else { } else {
@@ -570,25 +414,25 @@ const nextLvMoney = computed(() => {
} }
if (nextLv) { if (nextLv) {
if (config.upgradeType == "cost") { if (config.upgradeType == 'cost') {
return nextLv.costAmount; return nextLv.costAmount;
} }
if (config.upgradeType == "invite") { if (config.upgradeType == 'invite') {
return nextLv.inviteCount; return nextLv.inviteCount;
} }
} }
return ""; return '';
}); });
const juNextLvMoney = computed(() => { const juNextLvMoney = computed(() => {
if (!nextLvMoney.value) { if (!nextLvMoney.value) {
return ""; return '';
} }
let total = 0; let total = 0;
if (config.upgradeType == "cost" && state.distributionUser) { if (config.upgradeType == 'cost' && state.distributionUser) {
total = new BigNumber(nextLvMoney.value).minus(state.distributionUser.consumeAmount || 0).toNumber(); total = new BigNumber(nextLvMoney.value).minus(state.distributionUser.consumeAmount || 0).toNumber();
} }
if (config.upgradeType == "invite" && state.distributionUser) { if (config.upgradeType == 'invite' && state.distributionUser) {
total = new BigNumber(nextLvMoney.value).minus(config.inviteCount || 0).toNumber(); total = new BigNumber(nextLvMoney.value).minus(config.inviteCount || 0).toNumber();
} }
return Math.max(total, 0); return Math.max(total, 0);
@@ -596,26 +440,19 @@ const juNextLvMoney = computed(() => {
//是否显示邀请码 //是否显示邀请码
const showInviteCode = computed(() => { const showInviteCode = computed(() => {
if (config.upgradeType == "invite") { if (config.upgradeType == 'invite') {
return true; return true;
} }
if ( if (config.openType == 'manual' && (!state.distributionUser || !state.distributionUser.level)) {
config.openType == "manual" &&
(!state.distributionUser || !state.distributionUser.level)
) {
return false; return false;
} }
if ( if (state.distributionUser && state.distributionUser.level && inviteCode.value) {
state.distributionUser &&
state.distributionUser.level &&
inviteCode.value
) {
return true; return true;
} }
if( config.openType == "auto" ){ if (config.openType == 'auto') {
return true; return true;
} }
if (!state.distributionUser && config.openType == "manual") { if (!state.distributionUser && config.openType == 'manual') {
return true; return true;
} }
return false; return false;
@@ -637,17 +474,33 @@ watch(
); );
function parseQueryString(queryString) { function parseQueryString(queryString) {
const queryParams = queryString.split("&").map((param) => param.split("=")); const queryParams = queryString.split('&').map((param) => param.split('='));
const params = {}; const params = {};
for (const [key, value] of queryParams) { for (const [key, value] of queryParams) {
params[key] = value; params[key] = value;
} }
return params; return params;
} }
// defineOptions({
// mixins: [shareMixin]
// });
onShareAppMessage(async (res) => {
let query = await returnQuery();
return {
title: `股东共享-${state.shopName}`,
path: `/distribution/shop-detail/index?${query}`,
imageUrl: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/ec402c96a183489788f9e43430962d04.png',
query
};
});
onLoad(async (opt) => { onLoad(async (opt) => {
await handleMixinOnLoad(opt);
if (opt.q) { if (opt.q) {
const q = decodeURIComponent(opt.q); const q = decodeURIComponent(opt.q);
const params = parseQueryString(q.split("?")[1]); const params = parseQueryString(q.split('?')[1]);
Object.assign(options, params); Object.assign(options, params);
} else { } else {
Object.assign(options, opt); Object.assign(options, opt);
@@ -872,8 +725,7 @@ onReachBottom(async () => {
.buy { .buy {
padding: 32rpx 224rpx; padding: 32rpx 224rpx;
border-radius: 40rpx; border-radius: 40rpx;
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;
font-size: 32rpx; font-size: 32rpx;
color: #fff; color: #fff;

View File

@@ -28,11 +28,11 @@
<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>
@@ -44,8 +44,9 @@
<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">
@@ -54,17 +55,11 @@
</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-detail" v-if="item.goodsCategory != '优惠券'"> <view class="goods-detail" v-if="item.goodsCategory != '优惠券'">
@@ -72,9 +67,7 @@
<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.wareCommentImgs" :key="index" mode="widthFix" <image class="w-full" v-for="(item, index) in item.wareCommentImgs" :key="index" mode="widthFix" :src="item"></image>
:src="item">
</image>
</view> </view>
</view> </view>
@@ -88,8 +81,6 @@
</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">
@@ -112,7 +103,6 @@
</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">
@@ -125,7 +115,6 @@
<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">
@@ -137,74 +126,63 @@
</view> </view>
</template> </template>
<script setup> <script setup>
import { import { shareMixin, handleMixinOnLoad, returnQuery } from '@/utils/share.js';
computed, import { computed, reactive, watch } from 'vue';
reactive, import dayjs from 'dayjs';
watch import { wxShare } from '@/utils/share.js';
} from "vue"; import { getOpenId } from '@/utils/uniapp.js';
import dayjs from "dayjs"; import modal from '@/groupBuying/components/modal.vue';
import {wxShare} from '@/utils/share.js' import * as Api from '@/common/api/order/gbOrder.js';
import { import { pay } from '@/utils/pay.js';
getOpenId import { Storelogin } from '@/stores/user.js';
} from '@/utils/uniapp.js'
import modal from "@/groupBuying/components/modal.vue";
import * as Api from '@/common/api/order/gbOrder.js'
import {
pay
} from '@/utils/pay.js'
import {
Storelogin
} from '@/stores/user.js';
const storelogin = Storelogin(); const storelogin = Storelogin();
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);
import { import { BigNumber } from 'bignumber.js';
BigNumber
} from "bignumber.js";
const totalPrice = computed(() => { const totalPrice = computed(() => {
if (!item.groupPrice) { if (!item.groupPrice) {
return 0; return 0;
} }
return BigNumber(number.value).times(item.groupPrice).toNumber() return BigNumber(number.value).times(item.groupPrice).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({
@@ -213,52 +191,50 @@
}); });
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(
() => popupData.show,
(newval) => {
if (!newval) { if (!newval) {
popupData.item = null popupData.item = null;
} }
}) }
);
function dingyue() { function dingyue() {
return new Promise((revlove, reject) => { return new Promise((revlove, reject) => {
uni.requestSubscribeMessage({ uni.requestSubscribeMessage({
tmplIds: ['JGPAGmqcPEgWB6mvAl0SC5cMqr5H5Qjcim8JCpHAZd0', tmplIds: ['JGPAGmqcPEgWB6mvAl0SC5cMqr5H5Qjcim8JCpHAZd0', 'F4OyUhe_ZQ9BR731jlkaN2QXAUaA3HBZuUeVPfraSz0'],
'F4OyUhe_ZQ9BR731jlkaN2QXAUaA3HBZuUeVPfraSz0'
],
success(res) {}, success(res) {},
complete() { complete() {
revlove() revlove();
} }
}) });
}) });
} }
async function payExchange() { async function payExchange() {
uni.setStorageSync('group_buying_order', { uni.setStorageSync('group_buying_order', {
...item, ...item,
number: number.value, number: number.value,
groupOrderNo: popupData.item ? popupData.item.groupOrderNo : '', groupOrderNo: popupData.item ? popupData.item.groupOrderNo : ''
}) });
uni.navigateTo({ uni.navigateTo({
url: '/groupBuying/confirm-order/confirm-order' url: '/groupBuying/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,
@@ -266,75 +242,68 @@
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: '',
wareId: '', wareId: '',
groupOrderNo: '' groupOrderNo: ''
}) });
const coverImgs = ref([]);
const coverImgs = ref([])
async function init(opt) { async function init(opt) {
// 获取小程序进入场景和参数 // 获取小程序进入场景和参数
@@ -343,17 +312,17 @@
// 获取链接上的参数 // 获取链接上的参数
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.wareDetail(query).then(res => { Api.wareDetail(query).then((res) => {
console.log('res',res) console.log('res', res);
if (!res) { if (!res) {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
@@ -362,20 +331,19 @@
success() { success() {
uni.redirectTo({ uni.redirectTo({
url: '/groupBuying/index/index' url: '/groupBuying/index/index'
}) });
} }
}) });
} }
res.wareCommentImgs = res.wareCommentImgs.split(',').filter(v => v) res.wareCommentImgs = res.wareCommentImgs.split(',').filter((v) => v);
Object.assign(item, res) Object.assign(item, res);
console.log(item) console.log(item);
coverImgs.value = res.wareImgs.split(',') coverImgs.value = res.wareImgs.split(',');
uni.cache.set('shopId',item.shopId) uni.cache.set('shopId', item.shopId);
}) });
} }
/** /**
* 计算剩余时间差(毫秒) * 计算剩余时间差(毫秒)
* @param {Object} item - 包含groupEndTime的订单/拼团对象 * @param {Object} item - 包含groupEndTime的订单/拼团对象
@@ -413,40 +381,52 @@
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;
} }
onShareAppMessage(async () => {
onLoad(init) let query = await returnQuery();
// #ifdef MP-WEIXIN // query += `&wareId=${item.id}&shopId=${item.shopId}`;
uni.showShareMenu() const options = {
// #endif
onShareAppMessage(() => {
const query = `wareId=${item.id}&shopId=${item.shopId}`
return wxShare({
title: item.wareName, title: item.wareName,
imageUrl: coverImgs.value[0], imageUrl: coverImgs.value[0],
path: '/groupBuying/goodsDetail/goodsDetail' + '?' + query, path: '/groupBuying/goodsDetail/goodsDetail' + '?' + decodeURIComponent(query),
query, query
}) };
}) console.log('onShareAppMessage===', options);
return options;
});
onLoad(async (opt) => {
await handleMixinOnLoad(opt);
init(opt);
});
// #ifdef MP-WEIXIN
uni.showShareMenu();
// #endif
// onShareAppMessage(() => {
// const query = `wareId=${item.id}&shopId=${item.shopId}`;
// return wxShare({
// title: item.wareName,
// imageUrl: coverImgs.value[0],
// path: '/groupBuying/goodsDetail/goodsDetail' + '?' + query,
// query
// });
// });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -494,8 +474,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;
} }
@@ -517,8 +497,6 @@
} }
} }
.desc { .desc {
padding: 32rpx 28rpx; padding: 32rpx 28rpx;
background-color: #fff; background-color: #fff;
@@ -532,7 +510,7 @@
padding: 0 22rpx; padding: 0 22rpx;
&::before { &::before {
content: ""; content: '';
display: block; display: block;
position: absolute; position: absolute;
right: 100%; right: 100%;
@@ -545,7 +523,7 @@
&::after { &::after {
left: 100%; left: 100%;
content: ""; content: '';
position: absolute; position: absolute;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
@@ -568,7 +546,6 @@
bottom: 0; bottom: 0;
z-index: 10; z-index: 10;
.btn { .btn {
padding: 22rpx; padding: 22rpx;
border-radius: 200rpx; border-radius: 200rpx;
@@ -576,7 +553,7 @@
color: #fff; color: #fff;
width: 556rpx; width: 556rpx;
text-align: center; text-align: center;
background-color: #E8AD7B; background-color: #e8ad7b;
&.gray { &.gray {
background: #9999992b; background: #9999992b;
@@ -633,7 +610,6 @@
color: #666; color: #666;
line-height: 42rpx; line-height: 42rpx;
} }
} }
.bottom { .bottom {
@@ -670,7 +646,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;
@@ -683,7 +659,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;
} }
@@ -695,8 +671,9 @@
right: 0; right: 0;
padding: 4rpx 30rpx; padding: 4rpx 30rpx;
border-radius: 0 0 0 24rpx; border-radius: 0 0 0 24rpx;
color: #ed5a2e; font-weight: 700; color: #ed5a2e;
background: #FFF; font-weight: 700;
background: #fff;
overflow: hidden; overflow: hidden;
.share { .share {
position: absolute; position: absolute;

View File

@@ -2,8 +2,7 @@
<view class="min-page bg-f7 u-font-28"> <view class="min-page bg-f7 u-font-28">
<up-sticky :offsetTop="0" :customNavHeight="0"> <up-sticky :offsetTop="0" :customNavHeight="0">
<view class="top" :style="topStyle"> <view class="top" :style="topStyle">
<up-navbar bg-color="transparent" :fixed="false" :placeholder="false" title="拼团特惠" @leftClick="back()" <up-navbar bg-color="transparent" :fixed="false" :placeholder="false" title="拼团特惠" @leftClick="back()" left-icon-color="#fff" title-color="#fff"></up-navbar>
left-icon-color="#fff" title-color="#fff"></up-navbar>
<view class="u-flex info u-col-center"> <view class="u-flex info u-col-center">
<image :src="imgs.map" class="map"></image> <image :src="imgs.map" class="map"></image>
<view class="u-line-1 u-m-l-20">{{ shopInfo.shopName || '' }}</view> <view class="u-line-1 u-m-l-20">{{ shopInfo.shopName || '' }}</view>
@@ -26,31 +25,24 @@
</view> </view>
<view class="filters"> <view class="filters">
<view class="u-flex tabs"> <view class="u-flex tabs">
<view class="tab" v-for="(item,index) in tabs.list" :class="{'active':tabs.sel==index}" <view class="tab" v-for="(item, index) in tabs.list" :class="{ active: tabs.sel == index }" @click="tabs.sel = index">{{ item }}</view>
@click="tabs.sel=index">{{item}}</view>
</view> </view>
<view class="u-flex u-col-center" v-if="tabs.sel == 0"> <view class="u-flex u-col-center" v-if="tabs.sel == 0">
<up-search v-model="query.wareName" @search="refresh" @clear="refresh" <up-search v-model="query.wareName" @search="refresh" @clear="refresh" @custom="refresh"></up-search>
@custom="refresh"></up-search>
<!-- <perpoleNumber v-model="query.groupPeopleNum"></perpoleNumber> --> <!-- <perpoleNumber v-model="query.groupPeopleNum"></perpoleNumber> -->
</view> </view>
<view class="u-flex orderStatus" v-if="tabs.sel == 1"> <view class="u-flex orderStatus" v-if="tabs.sel == 1">
<view class="orderState" :class="{'active':orders.sel==index}" <view class="orderState" :class="{ active: orders.sel == index }" v-for="(item, index) in orders.list" :key="index" @click="orders.sel = index">
v-for="(item,index) in orders.list" :key="index" @click="orders.sel=index">
{{ item.name }} {{ item.name }}
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</up-sticky> </up-sticky>
<view class="lists" v-if="tabs.sel == 0"> <view class="lists" v-if="tabs.sel == 0">
<view class="item" v-for="(item, index) in list" :key="index" @click="toDetail(item)"> <view class="item" v-for="(item, index) in list" :key="index" @click="toDetail(item)">
<up-image width="218rpx" radius="16rpx" height="218rpx" :src="returnCoverImg(item)"></up-image> <up-image width="218rpx" radius="16rpx" height="218rpx" :src="returnCoverImg(item)"></up-image>
<view class="u-flex-1 u-p-l-16"> <view class="u-flex-1 u-p-l-16">
<view class="u-flex u-col-center"> <view class="u-flex u-col-center">
@@ -64,7 +56,7 @@
<text class="u-font-24">拼团到手</text> <text class="u-font-24">拼团到手</text>
<text class="u-font-32 font-bold">¥{{ item.groupPrice }}</text> <text class="u-font-32 font-bold">¥{{ item.groupPrice }}</text>
</view> </view>
<view style="opacity: 0.84;"> <view style="opacity: 0.84">
<text class="u-font-24">原价</text> <text class="u-font-24">原价</text>
<text class="">¥{{ item.originalPrice }}</text> <text class="">¥{{ item.originalPrice }}</text>
</view> </view>
@@ -87,13 +79,11 @@
<up-image width="154rpx" height="154rpx" :src="item.goodsImg"></up-image> <up-image width="154rpx" height="154rpx" :src="item.goodsImg"></up-image>
<view class="u-flex-1 u-flex u-p-l-30 u-col-center u-row-between"> <view class="u-flex-1 u-flex u-p-l-30 u-col-center u-row-between">
<view> <view>
<view class="">{{item.wareJson.wareName}}</view> <view class="" v-if="item.wareJson">{{ item.wareJson.wareName }}</view>
<view class="u-m-t-34 price">¥{{ item.payAmount }}</view> <view class="u-m-t-34 price">¥{{ item.payAmount }}</view>
</view> </view>
<text class="u-font-40 font-bold">x{{ item.num }}</text> <text class="u-font-40 font-bold">x{{ item.num }}</text>
</view> </view>
</view> </view>
<view class="u-m-t-32 info"> <view class="u-m-t-32 info">
<view class="u-flex u-col-center"> <view class="u-flex u-col-center">
@@ -124,62 +114,43 @@
</template> </template>
<template v-else> <template v-else>
<view class="btn" @click.stop="refund(item)" v-if="canRefund(item)">申请退款</view> <view class="btn" @click.stop="refund(item)" v-if="canRefund(item)">申请退款</view>
<button open-type="share" class="btn black" @click.stop="share(item)" <button open-type="share" class="btn black" @click.stop="share(item)" v-if="showShare(item)">邀请好友</button>
v-if="showShare(item)">邀请好友</button>
</template> </template>
</view> </view>
</view> </view>
</view> </view>
<LookQrcode v-model="modalData.show" :qrcode="qrcode"></LookQrcode> <LookQrcode v-model="modalData.show" :qrcode="qrcode"></LookQrcode>
</view> </view>
</template> </template>
<script setup> <script setup>
import { import { APIusershopInfodetail } from '@/common/api/member.js';
APIusershopInfodetail import { back } from '@/utils/uniapp.js';
} from '@/common/api/member.js' import LookQrcode from '@/components/look-qrcode/look-qrcode.vue';
import { import { wxShare } from '@/utils/share.js';
back import { getRemainingHMS } from '@/utils/countdown.js';
} from '@/utils/uniapp.js' import { onShow } from '@dcloudio/uni-app';
import LookQrcode from "@/components/look-qrcode/look-qrcode.vue"; import * as Api from '@/common/api/order/gbOrder.js';
import { import perpoleNumber from './components/perpole-number.vue';
wxShare import statusVue from '@/groupBuying/components/status.vue';
} from '@/utils/share.js' import { computed, reactive, watch } from 'vue';
import {
getRemainingHMS
} from '@/utils/countdown.js'
import {
onShow
} from '@dcloudio/uni-app'
import * as Api from '@/common/api/order/gbOrder.js'
import perpoleNumber from './components/perpole-number.vue'
import statusVue from '@/groupBuying/components/status.vue'
import {
computed,
reactive,
watch
} from 'vue'
const canRefundStatus = ['待成团', '待核销'] const canRefundStatus = ['待成团', '待核销'];
function canRefund(item) { function canRefund(item) {
if (canRefundStatus.includes(item.status)) { if (canRefundStatus.includes(item.status)) {
return true return true;
} }
return false return false;
} }
const modalData = reactive({ const modalData = reactive({
show: false, show: false
}); });
const qrcode = ref(""); const qrcode = ref('');
function lookCode(item) { function lookCode(item) {
qrcode.value = item.verifyCode qrcode.value = item.verifyCode;
modalData.show = true; modalData.show = true;
} }
@@ -188,21 +159,22 @@
bg1: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/1/604c3f917daa41af9239145196c6d3f3.png', bg1: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/1/604c3f917daa41af9239145196c6d3f3.png',
map: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/1/0a293f6e1a6a4e7b956379a5b6701104.png', map: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/1/0a293f6e1a6a4e7b956379a5b6701104.png',
pin: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/4bcce5bdfa074f2a838a0209fac24241.png' pin: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/4bcce5bdfa074f2a838a0209fac24241.png'
} };
const shopInfo = ref({}) const shopInfo = ref({});
const steps = ['发起拼团', '邀请好友', '成团优惠'] const steps = ['发起拼团', '邀请好友', '成团优惠'];
const topStyle = { const topStyle = {
backgroundImage: 'url(' + imgs.bg + ')' backgroundImage: 'url(' + imgs.bg + ')'
} };
const tabs = reactive({ const tabs = reactive({
list: ['活动列表', '我的拼团'], list: ['活动列表', '我的拼团'],
sel: 0 sel: 0
}) });
const orders = reactive({ const orders = reactive({
list: [{ list: [
{
name: '全部', name: '全部',
value: '' value: ''
}, },
@@ -221,102 +193,100 @@
{ {
name: '退款', name: '退款',
value: '退款' value: '退款'
}, }
], ],
sel: 0 sel: 0
}) });
const query = reactive({ const query = reactive({
page: 1, page: 1,
size: 10, size: 10,
wareName: '', wareName: '',
groupPeopleNum: '', groupPeopleNum: '',
shopId: uni.cache.get('shopId'), shopId: uni.cache.get('shopId')
}) });
const list = ref([]) const list = ref([]);
const isEnd = ref(false) const isEnd = ref(false);
const status = computed(() => { const status = computed(() => {
return orders.list[orders.sel].value return orders.list[orders.sel].value;
}) });
watch(() => status.value, () => { watch(
refresh() () => status.value,
}) () => {
refresh();
}
);
function getData() { function getData() {
if (tabs.sel == 0) { if (tabs.sel == 0) {
Api.warePage(query).then(res => { Api.warePage(query).then((res) => {
const newArr = res.records || [] const newArr = res.records || [];
if (query.page == 1) { if (query.page == 1) {
list.value = newArr list.value = newArr;
} else { } else {
list.value.push(...newArr) list.value.push(...newArr);
} }
isEnd.value = query.page >= res.totalPage * 1 ? true : false isEnd.value = query.page >= res.totalPage * 1 ? true : false;
}) });
return return;
} }
if (tabs.sel == 1) { if (tabs.sel == 1) {
const { const { page, size, shopId } = query;
page,
size,
shopId
} = query
Api.record({ Api.record({
page, page,
size, size,
shopId, shopId,
status: status.value, status: status.value
}).then(res => { }).then((res) => {
const newArr = (res.records || []).map(v => { const newArr = (res.records || []).map((v) => {
const wareJson = JSON.parse(v.wareJson) const wareJson = JSON.parse(v.wareJson);
wareJson.wareImgs = wareJson.wareImgs.split(',').filter(v => v) wareJson.wareImgs = wareJson.wareImgs.split(',').filter((v) => v);
return { return {
...v, ...v,
goodsImg: wareJson.wareImgs[0], goodsImg: wareJson.wareImgs[0],
wareJson, wareJson
} };
}) });
if (query.page == 1) { if (query.page == 1) {
list.value = newArr list.value = newArr;
} else { } else {
list.value.push(...newArr) list.value.push(...newArr);
} }
console.log(list.value) console.log(list.value);
isEnd.value = query.page >= res.totalPage * 1 ? true : false isEnd.value = query.page >= res.totalPage * 1 ? true : false;
}) });
return return;
} }
} }
function toDetail(item) { function toDetail(item) {
uni.navigateTo({ uni.navigateTo({
url: '/groupBuying/goodsDetail/goodsDetail?wareId=' + item.id + '&shopId=' + item.shopId url: '/groupBuying/goodsDetail/goodsDetail?wareId=' + item.id + '&shopId=' + item.shopId
}) });
} }
function toOrderDetail(item) { function toOrderDetail(item) {
uni.navigateTo({ uni.navigateTo({
url: '/groupBuying/detail/index?detailId=' + item.id + '&shopId=' + item.shopId url: '/groupBuying/detail/index?detailId=' + item.id + '&shopId=' + item.shopId
}) });
} }
function returnCoverImg(item) { function returnCoverImg(item) {
if (!item.wareImgs) { if (!item.wareImgs) {
return '' return '';
} }
const arr = item.wareImgs.split(',') const arr = item.wareImgs.split(',');
return arr[0] return arr[0];
} }
function refresh() { function refresh() {
query.page = 1 query.page = 1;
isEnd.value = false isEnd.value = false;
getData() getData();
} }
function refund(item) { function refund(item) {
@@ -328,20 +298,20 @@
if (res.confirm) { if (res.confirm) {
Api.applyRefund({ Api.applyRefund({
recordId: item.id, recordId: item.id,
orderNo: item.orderNo, orderNo: item.orderNo
}).then(res => { }).then((res) => {
if (res) { if (res) {
uni.showToast({ uni.showToast({
title: '申请成功' title: '申请成功'
}) });
setTimeout(() => { setTimeout(() => {
refresh() refresh();
}, 1000) }, 1000);
} }
}) });
} }
} }
}) });
} }
function cancelRefund(item) { function cancelRefund(item) {
@@ -353,90 +323,92 @@
if (res.confirm) { if (res.confirm) {
Api.cancelRefund({ Api.cancelRefund({
recordId: item.id, recordId: item.id,
orderNo: item.orderNo, orderNo: item.orderNo
}).then(res => { }).then((res) => {
if (res) { if (res) {
uni.showToast({ uni.showToast({
title: '取消成功' title: '取消成功'
}) });
setTimeout(() => { setTimeout(() => {
refresh() refresh();
}, 1000) }, 1000);
} }
}) });
} }
} }
}) });
} }
watch(() => tabs.sel, (newval) => { watch(
orders.sel = 0 () => tabs.sel,
refresh() (newval) => {
}) orders.sel = 0;
refresh();
}
);
function showBtns(item) { function showBtns(item) {
if (item.status == '已退款') { if (item.status == '已退款') {
return false return false;
} }
return true return true;
} }
function showShare(item) { function showShare(item) {
if (item.status == '待成团') { if (item.status == '待成团') {
return true return true;
} }
return false return false;
} }
function showTime(item) { function showTime(item) {
if (item.status == '待成团') { if (item.status == '待成团') {
return true return true;
} }
return false return false;
} }
let shareItem = null;
let shareItem = null
function share(item) { function share(item) {
shareItem = item shareItem = item;
} }
onShareAppMessage(() => { onShareAppMessage(() => {
console.log('onShareAppMessage') console.log('onShareAppMessage');
console.log(shareItem) console.log(shareItem);
const query = `groupOrderNo=${shareItem.groupOrderNo}&shopId=${shareItem.shopId}` const query = `groupOrderNo=${shareItem.groupOrderNo}&shopId=${shareItem.shopId}`;
return wxShare({ return wxShare({
title: shareItem.wareJson.wareName, title: shareItem.wareJson.wareName,
imageUrl: shareItem.goodsImg, imageUrl: shareItem.goodsImg,
path: '/groupBuying/detail/index' + '?' + query, path: '/groupBuying/detail/index' + '?' + query,
query, query
}) });
}) });
onShow(getData) onShow(getData);
onLoad((opt) => { onLoad((opt) => {
const shopId=opt.shopId||uni.cache.get('shopId') const shopId = opt.shopId || uni.cache.get('shopId');
query.shopId=shopId query.shopId = shopId;
uni.cache.set('shopId',query.shopId) uni.cache.set('shopId', query.shopId);
console.log('opt', opt); console.log('opt', opt);
APIusershopInfodetail({ APIusershopInfodetail({
shopId: shopId shopId: shopId
}).then(res => { }).then((res) => {
console.log(res); console.log(res);
shopInfo.value = res.shopInfo shopInfo.value = res.shopInfo;
uni.cache.set('shopInfo', res.shopInfo) uni.cache.set('shopInfo', res.shopInfo);
uni.cache.set('shopId', res.shopInfo.id) uni.cache.set('shopId', res.shopInfo.id);
}) });
}) });
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 returnTime(item) { function returnTime(item) {
nowTime.value nowTime.value;
return getRemainingHMS(item) return getRemainingHMS(item);
} }
</script> </script>
@@ -463,7 +435,7 @@
padding: 20rpx 20rpx; padding: 20rpx 20rpx;
gap: 20rpx; gap: 20rpx;
border-radius: 14rpx 14rpx 0 0; border-radius: 14rpx 14rpx 0 0;
background: linear-gradient(90deg, #FFF5E6 0%, #FFD2CA 100%); background: linear-gradient(90deg, #fff5e6 0%, #ffd2ca 100%);
align-items: center; align-items: center;
.step { .step {
@@ -478,11 +450,11 @@
height: 44rpx; height: 44rpx;
line-height: 44rpx; line-height: 44rpx;
text-align: center; text-align: center;
background: #E55626; background: #e55626;
} }
.text { .text {
color: #5A352F; color: #5a352f;
margin-left: 10rpx; margin-left: 10rpx;
margin-right: 22rpx; margin-right: 22rpx;
white-space: nowrap; white-space: nowrap;
@@ -493,7 +465,7 @@
} }
.icon1 { .icon1 {
color: #5A352F; color: #5a352f;
} }
} }
@@ -504,15 +476,15 @@
display: flex; display: flex;
padding: 32rpx 16rpx; padding: 32rpx 16rpx;
border-radius: 32rpx; border-radius: 32rpx;
background: #FFF; background: #fff;
margin-bottom: 14rpx; margin-bottom: 14rpx;
.numbers { .numbers {
background: #4C2828; background: #4c2828;
padding: 8rpx 18rpx; padding: 8rpx 18rpx;
border-radius: 10rpx; border-radius: 10rpx;
font-weight: 700; font-weight: 700;
color: #FAEAC6; color: #faeac6;
white-space: nowrap; white-space: nowrap;
} }
@@ -522,13 +494,13 @@
.members { .members {
margin-top: 26rpx; margin-top: 26rpx;
background: #FDF1CB; background: #fdf1cb;
padding: 4rpx 18rpx; padding: 4rpx 18rpx;
border-radius: 10rpx 10rpx 10rpx 0; border-radius: 10rpx 10rpx 10rpx 0;
width: fit-content; width: fit-content;
font-size: 24rpx; font-size: 24rpx;
font-weight: 700; font-weight: 700;
color: #ED5A2E; color: #ed5a2e;
} }
.info { .info {
@@ -561,7 +533,7 @@
.filters { .filters {
padding: 16rpx 28rpx; padding: 16rpx 28rpx;
border-radius: 6rpx 6rpx 16rpx 16rpx; border-radius: 6rpx 6rpx 16rpx 16rpx;
background: #FFF; background: #fff;
} }
.tabs { .tabs {
@@ -572,11 +544,11 @@
padding: 32rpx 88rpx; padding: 32rpx 88rpx;
.tabs { .tabs {
transition: all .3s linear; transition: all 0.3s linear;
} }
.active { .active {
color: #ED5A2E; color: #ed5a2e;
font-size: 32rpx; font-size: 32rpx;
font-weight: 700; font-weight: 700;
font-weight: 700; font-weight: 700;
@@ -594,7 +566,7 @@
.orderState { .orderState {
color: #999; color: #999;
transition: all .3s linear; transition: all 0.3s linear;
&.active { &.active {
color: #000; color: #000;
@@ -610,11 +582,11 @@
.item { .item {
padding: 32rpx 24rpx; padding: 32rpx 24rpx;
border-radius: 16rpx; border-radius: 16rpx;
background: #FFF; background: #fff;
margin-bottom: 32rpx; margin-bottom: 32rpx;
.numbers { .numbers {
background-color: #ED5A2E; background-color: #ed5a2e;
padding: 16rpx 30rpx; padding: 16rpx 30rpx;
border-radius: 12rpx; border-radius: 12rpx;
font-size: 32rpx; font-size: 32rpx;
@@ -623,10 +595,8 @@
line-height: 36rpx; line-height: 36rpx;
} }
.price { .price {
color: #ED5A2E; color: #ed5a2e;
font-weight: 700; font-weight: 700;
line-height: 36rpx; line-height: 36rpx;
font-size: 40rpx; font-size: 40rpx;
@@ -637,7 +607,7 @@
flex-direction: column; flex-direction: column;
align-items: flex-start; align-items: flex-start;
border-radius: 8rpx; border-radius: 8rpx;
background: #F8F8F8; background: #f8f8f8;
.title { .title {
min-width: 208rpx; min-width: 208rpx;
@@ -654,7 +624,6 @@
font-weight: 700; font-weight: 700;
} }
} }
} }
.btns { .btns {
@@ -668,8 +637,8 @@
margin: 0; margin: 0;
padding: 12rpx 14rpx; padding: 12rpx 14rpx;
border-radius: 10rpx; border-radius: 10rpx;
border: 2rpx solid #D9D9D9; border: 2rpx solid #d9d9d9;
background: #FFF; background: #fff;
font-size: 28rpx; font-size: 28rpx;
&.black { &.black {
@@ -682,7 +651,6 @@
} }
} }
.copy { .copy {
width: 28rpx; width: 28rpx;
height: 28rpx; height: 28rpx;

View File

@@ -1,10 +1,8 @@
<template> <template>
<view> <view>
<template v-if="item.status == '待核销'"> <template v-if="item.status == '待核销'">
<view class="min-page bg-f7 color-333 u-font-28 relative"> <view class="min-page bg-f7 color-333 u-font-28 relative">
<up-navbar bg-color="#F8F8F8" :fixed="true" :placeholder="true" title="支付成功" <up-navbar bg-color="#F8F8F8" :fixed="true" :placeholder="true" title="支付成功" @leftClick="uni.navigateBack()"></up-navbar>
@leftClick="uni.navigateBack()"></up-navbar>
<view class="bottom"> <view class="bottom">
<view class="u-p-32 u-flex u-row-center u-col-center u-flex-col bg-fff"> <view class="u-p-32 u-flex u-row-center u-col-center u-flex-col bg-fff">
@@ -14,16 +12,15 @@
<view class="shop"> <view class="shop">
<view class="u-flex"> <view class="u-flex">
<text style="min-width: 180rpx;" class="color-666">可核销门店</text> <text style="min-width: 180rpx" class="color-666">可核销门店</text>
<text>{{ item.shopName }}</text> <text>{{ item.shopName }}</text>
</view> </view>
<view class="u-m-t-32 u-flex"> <view class="u-m-t-32 u-flex">
<text style="min-width: 180rpx;" class="color-666">门店地址</text> <text style="min-width: 180rpx" class="color-666">门店地址</text>
<text>{{ item.shopAddress }}</text> <text>{{ item.shopAddress }}</text>
</view> </view>
</view> </view>
<view class="goods u-flex u-col-center"> <view class="goods u-flex u-col-center">
<up-image width="158rpx" height="158rpx" radius="14rpx" :src="item.goodsImg"></up-image> <up-image width="158rpx" height="158rpx" radius="14rpx" :src="item.goodsImg"></up-image>
<view class="u-flex-1 u-p-l-16"> <view class="u-flex-1 u-p-l-16">
@@ -34,9 +31,8 @@
</view> </view>
</view> </view>
<view class="u-m-t-16 u-flex u-col-center"> <view class="u-m-t-16 u-flex u-col-center">
<view style="width: 356rpx;"> <view style="width: 356rpx">
<view class="font-bold" v-if="item.wareJson">{{item.wareJson <view class="font-bold" v-if="item.wareJson">{{ item.wareJson.wareName }}</view>
.wareName}}</view>
<view class="u-flex u-m-t-10 u-col-center"> <view class="u-flex u-m-t-10 u-col-center">
<view class="price"> <view class="price">
<text class="u-font-30">¥</text> <text class="u-font-30">¥</text>
@@ -48,13 +44,10 @@
</view> </view>
</view> </view>
</view> </view>
<view class="u-p-l-16 color-333"> <view class="u-p-l-16 color-333">数量{{ item.num }}</view>
数量{{item.num}}
</view> </view>
</view> </view>
</view> </view>
</view>
<view class="members"> <view class="members">
<view class="list"> <view class="list">
@@ -65,11 +58,9 @@
<view class="u-flex u-row-center absolute"> <view class="u-flex u-row-center absolute">
<text class="tuanzhang" v-if="index == 0">团长</text> <text class="tuanzhang" v-if="index == 0">团长</text>
</view> </view>
</view> </view>
<view class="u-line-1 u-m-t-16 color-000 text-center">{{ user.userName }}</view> <view class="u-line-1 u-m-t-16 color-000 text-center">{{ user.userName }}</view>
</view> </view>
</view> </view>
<view class="item" v-if="false"> <view class="item" v-if="false">
@@ -83,20 +74,15 @@
<view class="u-line-1 u-m-t-16 color-000 text-center">等待参团</view> <view class="u-line-1 u-m-t-16 color-000 text-center">等待参团</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="order"> <view class="order">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="font-bold u-font-32">订单信息</view> <view class="font-bold u-font-32">订单信息</view>
<view class="u-flex color-666" @click="showOrder=!showOrder" style="align-items: baseline;"> <view class="u-flex color-666" @click="showOrder = !showOrder" style="align-items: baseline">
<text class="u-m-r-18">{{ showOrder ? '收起' : '展开' }}</text> <text class="u-m-r-18">{{ showOrder ? '收起' : '展开' }}</text>
<view class="guodu" :class="{ rotate: !showOrder }"> <view class="guodu" :class="{ rotate: !showOrder }">
<up-icon name="arrow-down" bold></up-icon> <up-icon name="arrow-down" bold></up-icon>
@@ -122,11 +108,9 @@
<view class="">{{ item.payTime }}</view> <view class="">{{ item.payTime }}</view>
</view> </view>
</view> </view>
</view> </view>
<view style="height: 100px"></view>
<view style="height: 100px;"></view>
<view class="btns"> <view class="btns">
<view class="btn" @click="toPinIndex">继续拼团</view> <view class="btn" @click="toPinIndex">继续拼团</view>
<button class="btn main" @click="toOrderDetail(item)">查看订单</button> <button class="btn main" @click="toOrderDetail(item)">查看订单</button>
@@ -136,10 +120,16 @@
<template v-if="item.status == '待成团'"> <template v-if="item.status == '待成团'">
<view class="min-page bg-f7 color-333 u-font-28 relative"> <view class="min-page bg-f7 color-333 u-font-28 relative">
<view class="top" :style="topStyle"> <view class="top" :style="topStyle">
<up-navbar bg-color="transparent" :fixed="false" :placeholder="false" title="支付成功" <up-navbar
left-icon-color="#fff" @leftClick="uni.navigateBack()" title-color="#fff"></up-navbar> bg-color="transparent"
<view class="u-flex info u-col-center"> :fixed="false"
</view> :placeholder="false"
title="支付成功"
left-icon-color="#fff"
@leftClick="uni.navigateBack()"
title-color="#fff"
></up-navbar>
<view class="u-flex info u-col-center"></view>
</view> </view>
<view class="bottom bottom1"> <view class="bottom bottom1">
<view class="time" v-if="item.status == '待成团'"> <view class="time" v-if="item.status == '待成团'">
@@ -161,12 +151,10 @@
<text class="">{{ item.groupPeopleNum }}人团</text> <text class="">{{ item.groupPeopleNum }}人团</text>
</view> </view>
<statusVue :status="item.status"></statusVue> <statusVue :status="item.status"></statusVue>
</view> </view>
<view class="u-m-t-16 u-flex u-col-center u-row-between"> <view class="u-m-t-16 u-flex u-col-center u-row-between">
<view style="max-width: 356rpx;"> <view style="max-width: 356rpx">
<view class="font-bold u-line-1" v-if="item.wareJson">{{item.wareJson <view class="font-bold u-line-1" v-if="item.wareJson">{{ item.wareJson.wareName }}</view>
.wareName}}</view>
<view class="u-flex u-m-t-10 u-col-center"> <view class="u-flex u-m-t-10 u-col-center">
<view class="price"> <view class="price">
<text class="u-font-30">¥</text> <text class="u-font-30">¥</text>
@@ -178,9 +166,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="u-p-l-16 color-333 no-wrap"> <view class="u-p-l-16 color-333 no-wrap">数量{{ item.num }}</view>
数量{{item.num}}
</view>
</view> </view>
</view> </view>
</view> </view>
@@ -188,11 +174,11 @@
<view class="shop-box"> <view class="shop-box">
<view class="shop"> <view class="shop">
<view class="u-flex"> <view class="u-flex">
<text style="min-width: 180rpx;" class="color-666">可核销门店</text> <text style="min-width: 180rpx" class="color-666">可核销门店</text>
<text>{{ item.shopName }}</text> <text>{{ item.shopName }}</text>
</view> </view>
<view class="u-m-t-32 u-flex"> <view class="u-m-t-32 u-flex">
<text style="min-width: 180rpx;" class="color-666">门店地址</text> <text style="min-width: 180rpx" class="color-666">门店地址</text>
<text>{{ item.shopAddress }}</text> <text>{{ item.shopAddress }}</text>
</view> </view>
</view> </view>
@@ -207,11 +193,9 @@
<view class="u-flex u-row-center absolute"> <view class="u-flex u-row-center absolute">
<text class="tuanzhang" v-if="index == 0">团长</text> <text class="tuanzhang" v-if="index == 0">团长</text>
</view> </view>
</view> </view>
<view class="u-line-1 u-m-t-16 color-000 text-center">{{ user.userName }}</view> <view class="u-line-1 u-m-t-16 color-000 text-center">{{ user.userName }}</view>
</view> </view>
</view> </view>
<view class="item"> <view class="item">
@@ -227,9 +211,9 @@
</view> </view>
</view> </view>
<view class="u-flex u-row-center" v-if="item.status == '待成团'"> <view class="u-flex u-row-center" v-if="item.status == '待成团'">
<view class="pin-btn">邀请好友参团 <view class="pin-btn">
邀请好友参团
<button open-type="share" class="share">邀请好友参团</button> <button open-type="share" class="share">邀请好友参团</button>
</view> </view>
</view> </view>
</view> </view>
@@ -238,7 +222,7 @@
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="font-bold u-font-32">订单信息</view> <view class="font-bold u-font-32">订单信息</view>
<view class="u-flex color-666" @click="showOrder=!showOrder" style="align-items: baseline;"> <view class="u-flex color-666" @click="showOrder = !showOrder" style="align-items: baseline">
<text class="u-m-r-18">{{ showOrder ? '收起' : '展开' }}</text> <text class="u-m-r-18">{{ showOrder ? '收起' : '展开' }}</text>
<view class="guodu" :class="{ rotate: !showOrder }"> <view class="guodu" :class="{ rotate: !showOrder }">
<up-icon name="arrow-down" bold></up-icon> <up-icon name="arrow-down" bold></up-icon>
@@ -264,19 +248,23 @@
<view class="">{{ item.payTime }}</view> <view class="">{{ item.payTime }}</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<template v-if="item.status == '已退款'"> <template v-if="item.status == '已退款'">
<view class="min-page bg-f7 color-333 u-font-28 relative"> <view class="min-page bg-f7 color-333 u-font-28 relative">
<view class="top" :style="topStyle"> <view class="top" :style="topStyle">
<up-navbar bg-color="transparent" :fixed="false" :placeholder="false" title="订单详情" <up-navbar
left-icon-color="#fff" @leftClick="uni.navigateBack()" title-color="#fff"></up-navbar> bg-color="transparent"
<view class="u-flex info u-col-center"> :fixed="false"
</view> :placeholder="false"
title="订单详情"
left-icon-color="#fff"
@leftClick="uni.navigateBack()"
title-color="#fff"
></up-navbar>
<view class="u-flex info u-col-center"></view>
</view> </view>
<view class="bottom bottom1"> <view class="bottom bottom1">
<view class="time" v-if="item.status == '待成团'"> <view class="time" v-if="item.status == '待成团'">
@@ -289,7 +277,7 @@
<text class="number">{{ returnNum(2) }}</text> <text class="number">{{ returnNum(2) }}</text>
</view> </view>
</view> </view>
<view class="goods u-flex u-col-center" style="border-radius: 16rpx;"> <view class="goods u-flex u-col-center" style="border-radius: 16rpx">
<up-image width="158rpx" height="158rpx" radius="14rpx" :src="item.goodsImg"></up-image> <up-image width="158rpx" height="158rpx" radius="14rpx" :src="item.goodsImg"></up-image>
<view class="u-flex-1 u-p-l-16"> <view class="u-flex-1 u-p-l-16">
<view class="u-flex u-col-center u-row-between"> <view class="u-flex u-col-center u-row-between">
@@ -298,12 +286,10 @@
<text class="">{{ item.groupPeopleNum }}人团</text> <text class="">{{ item.groupPeopleNum }}人团</text>
</view> </view>
<statusVue :status="item.status"></statusVue> <statusVue :status="item.status"></statusVue>
</view> </view>
<view class="u-m-t-16 u-flex u-col-center u-row-between"> <view class="u-m-t-16 u-flex u-col-center u-row-between">
<view style="max-width: 356rpx;"> <view style="max-width: 356rpx">
<view class="font-bold u-line-1" v-if="item.wareJson">{{item.wareJson <view class="font-bold u-line-1" v-if="item.wareJson">{{ item.wareJson.wareName }}</view>
.wareName}}</view>
<view class="u-flex u-m-t-10 u-col-center"> <view class="u-flex u-m-t-10 u-col-center">
<view class="price"> <view class="price">
<text class="u-font-30">¥</text> <text class="u-font-30">¥</text>
@@ -315,9 +301,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="u-p-l-16 color-333 no-wrap"> <view class="u-p-l-16 color-333 no-wrap">数量{{ item.num }}</view>
数量{{item.num}}
</view>
</view> </view>
</view> </view>
</view> </view>
@@ -325,23 +309,21 @@
<view class="shop-box"> <view class="shop-box">
<view class="shop"> <view class="shop">
<view class="u-flex"> <view class="u-flex">
<text style="min-width: 180rpx;" class="color-666">可核销门店</text> <text style="min-width: 180rpx" class="color-666">可核销门店</text>
<text>{{ item.shopName }}</text> <text>{{ item.shopName }}</text>
</view> </view>
<view class="u-m-t-32 u-flex"> <view class="u-m-t-32 u-flex">
<text style="min-width: 180rpx;" class="color-666">门店地址</text> <text style="min-width: 180rpx" class="color-666">门店地址</text>
<text>{{ item.shopAddress }}</text> <text>{{ item.shopAddress }}</text>
</view> </view>
</view> </view>
</view> </view>
<view class="order"> <view class="order">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="font-bold u-font-32">订单信息</view> <view class="font-bold u-font-32">订单信息</view>
<view class="u-flex color-666" @click="showOrder=!showOrder" style="align-items: baseline;"> <view class="u-flex color-666" @click="showOrder = !showOrder" style="align-items: baseline">
<text class="u-m-r-18">{{ showOrder ? '收起' : '展开' }}</text> <text class="u-m-r-18">{{ showOrder ? '收起' : '展开' }}</text>
<view class="guodu" :class="{ rotate: !showOrder }"> <view class="guodu" :class="{ rotate: !showOrder }">
<up-icon name="arrow-down" bold></up-icon> <up-icon name="arrow-down" bold></up-icon>
@@ -367,70 +349,58 @@
<view class="">{{ item.payTime }}</view> <view class="">{{ item.payTime }}</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
</view> </view>
</template> </template>
<script setup> <script setup>
import statusVue from '@/groupBuying/components/status.vue' import { shareMixin, handleMixinOnLoad, returnQuery } from '@/utils/share.js';
import * as Api from '@/common/api/order/gbOrder.js' import statusVue from '@/groupBuying/components/status.vue';
import { import * as Api from '@/common/api/order/gbOrder.js';
wxShare import { wxShare } from '@/utils/share.js';
} from '@/utils/share.js' import { computed, reactive } from 'vue';
import { import { getRemainingHMS } from '@/utils/countdown.js';
computed,
reactive
} from 'vue'
import {
getRemainingHMS
} from '@/utils/countdown.js'
function toPinIndex() { function toPinIndex() {
uni.redirectTo({ uni.redirectTo({
url: '/groupBuying/index/index' url: '/groupBuying/index/index'
}) });
} }
const imgs = { const imgs = {
bg: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/1/d21f2dfd7bec44618f2d5e4b88372b08.png', bg: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/1/d21f2dfd7bec44618f2d5e4b88372b08.png',
pin: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/3947892924dd481782331513aff00eb3.png', pin: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/3947892924dd481782331513aff00eb3.png',
success: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/6a75acd0c0db4bfe9937854b2b2df3f0.png' success: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/6a75acd0c0db4bfe9937854b2b2df3f0.png'
} };
const topStyle = { const topStyle = {
backgroundImage: 'url(' + imgs.bg + ')' backgroundImage: 'url(' + imgs.bg + ')'
} };
const showOrder = ref(true) const showOrder = ref(true);
function copyText(text) { function copyText(text) {
uni.setClipboardData({ uni.setClipboardData({
data: text, data: text,
success() {} success() {}
}) });
} }
const query = reactive({ const query = reactive({
shopId: '', shopId: '',
detailId: '', detailId: ''
}) });
function init(opt) { function init(opt) {
console.log(opt) console.log(opt);
Object.assign(query, opt) Object.assign(query, opt);
getDetail() getDetail();
} }
const item = reactive({}) const item = reactive({});
function getDetail() { function getDetail() {
try { try {
Api.recordDetail(query).then(res => { Api.recordDetail(query).then((res) => {
if (!res) { if (!res) {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
@@ -439,45 +409,43 @@
success(res) { success(res) {
uni.redirectTo({ uni.redirectTo({
url: '/groupBuying/index/index' url: '/groupBuying/index/index'
}) });
} }
});
}) return;
return
} }
console.log(res, 'res') console.log(res, 'res');
const wareJson = JSON.parse(res.wareJson) const wareJson = JSON.parse(res.wareJson);
wareJson.wareImgs = wareJson.wareImgs.split(',').filter(v => v) wareJson.wareImgs = wareJson.wareImgs.split(',').filter((v) => v);
res.wareJson = wareJson; res.wareJson = wareJson;
res.goodsImg = wareJson.wareImgs[0]; res.goodsImg = wareJson.wareImgs[0];
Object.assign(item, res) Object.assign(item, res);
console.log('item', item) console.log('item', item);
}) });
} catch (err) { } catch (err) {
console.log('err', err) console.log('err', err);
} }
} }
onLoad(init) onLoad(async (opt) => {
await handleMixinOnLoad(opt);
init(opt);
});
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);
const returnTime = computed(() => { const returnTime = computed(() => {
nowTime.value nowTime.value;
return getRemainingHMS(item) return getRemainingHMS(item);
}) });
function returnNum(index) { function returnNum(index) {
return returnTime.value.split(':')[index] return returnTime.value.split(':')[index];
} }
function refund(item) { function refund(item) {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
@@ -487,39 +455,48 @@
if (res.confirm) { if (res.confirm) {
Api.applyRefund({ Api.applyRefund({
recordId: item.id, recordId: item.id,
orderNo: item.orderNo, orderNo: item.orderNo
}).then(res => { }).then((res) => {
if (res) { if (res) {
uni.showToast({ uni.showToast({
title: '申请成功' title: '申请成功'
}) });
setTimeout(() => { setTimeout(() => {
getDetail() getDetail();
}, 1000) }, 1000);
} }
}) });
} }
} }
}) });
} }
onShareAppMessage(() => { onShareAppMessage(async (res) => {
console.log('onShareAppMessage') let query = await returnQuery();
console.log(item) return {
const query = `groupOrderNo=${item.groupOrderNo}&shopId=${item.shopId}`
return wxShare({
title: item.wareJson.wareName, title: item.wareJson.wareName,
imageUrl: item.goodsImg, imageUrl: item.goodsImg,
path: '/groupBuying/detail/index' + '?' + query, path: '/groupBuying/detail/index' + '?' + query,
query, query
}) };
}) });
// onShareAppMessage(() => {
// console.log('onShareAppMessage');
// console.log(item);
// const query = `groupOrderNo=${item.groupOrderNo}&shopId=${item.shopId}`;
// return wxShare({
// title: item.wareJson.wareName,
// imageUrl: item.goodsImg,
// path: '/groupBuying/detail/index' + '?' + query,
// query
// });
// });
function toOrderDetail(item) { function toOrderDetail(item) {
uni.navigateTo({ uni.navigateTo({
url: '/groupBuying/detail/index?detailId=' + item.id + '&shopId=' + item.shopId url: '/groupBuying/detail/index?detailId=' + item.id + '&shopId=' + item.shopId
}) });
} }
</script> </script>
@@ -534,8 +511,6 @@
font-size: 32rpx; font-size: 32rpx;
font-weight: 700; font-weight: 700;
} }
} }
.bottom { .bottom {
@@ -544,7 +519,7 @@
.time { .time {
padding: 18rpx 24rpx; padding: 18rpx 24rpx;
background: #FFF4E2; background: #fff4e2;
display: flex; display: flex;
align-items: center; align-items: center;
border-radius: 16rpx 16rpx 0 0; border-radius: 16rpx 16rpx 0 0;
@@ -552,7 +527,7 @@
.number { .number {
padding: 6rpx; padding: 6rpx;
border-radius: 16rpx; border-radius: 16rpx;
background: #ED5A2E; background: #ed5a2e;
color: #fff; color: #fff;
font-size: 32rpx; font-size: 32rpx;
margin-left: 18rpx; margin-left: 18rpx;
@@ -578,7 +553,7 @@
.tuan-members { .tuan-members {
padding: 0 16rpx 0 0; padding: 0 16rpx 0 0;
border-radius: 0 6rpx 6rpx 0; border-radius: 0 6rpx 6rpx 0;
background: #4C2828; background: #4c2828;
color: #f5d9ad; color: #f5d9ad;
font-weight: 700; font-weight: 700;
} }
@@ -611,7 +586,7 @@
.shop { .shop {
border-radius: 8rpx; border-radius: 8rpx;
background: #F8F8F8; background: #f8f8f8;
padding: 16rpx 34rpx; padding: 16rpx 34rpx;
} }
@@ -637,7 +612,7 @@
.add-box { .add-box {
width: 140rpx; width: 140rpx;
height: 140rpx; height: 140rpx;
border: 2rpx dashed #D9D9D9; border: 2rpx dashed #d9d9d9;
border-radius: 50%; border-radius: 50%;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
@@ -676,14 +651,12 @@
.tuanzhang { .tuanzhang {
padding: 8rpx 18rpx; padding: 8rpx 18rpx;
border-radius: 20rpx; border-radius: 20rpx;
background: #ED5A2E; background: #ed5a2e;
color: #fff; color: #fff;
bottom: 0; bottom: 0;
} }
} }
} }
} }
.btns { .btns {
@@ -704,19 +677,19 @@
line-height: 1; line-height: 1;
margin: 0; margin: 0;
justify-content: center; justify-content: center;
border: 2rpx solid #E8AD7B; border: 2rpx solid #e8ad7b;
background: #FFF; background: #fff;
color: #E8AD7B; color: #e8ad7b;
&.main { &.main {
background-color: #E8AD7B; background-color: #e8ad7b;
color: #fff; color: #fff;
} }
} }
} }
.guodu { .guodu {
transition: all .3s; transition: all 0.3s;
} }
.pin-btn { .pin-btn {
@@ -725,8 +698,8 @@
text-align: center; text-align: center;
font-size: 32rpx; font-size: 32rpx;
justify-content: center; justify-content: center;
border: 2rpx solid #E8AD7B; border: 2rpx solid #e8ad7b;
background: #E8AD7B; background: #e8ad7b;
color: #fff; color: #fff;
position: relative; position: relative;
@@ -758,7 +731,7 @@
.refund { .refund {
padding: 18rpx 164rpx; padding: 18rpx 164rpx;
border-radius: 0 0 16rpx 16rpx; border-radius: 0 0 16rpx 16rpx;
background: #FFF4E2; background: #fff4e2;
font-weight: 700; font-weight: 700;
margin-bottom: 32rpx; margin-bottom: 32rpx;
} }
@@ -780,7 +753,7 @@
.time { .time {
padding: 18rpx 24rpx; padding: 18rpx 24rpx;
background: #FFF4E2; background: #fff4e2;
display: flex; display: flex;
align-items: center; align-items: center;
border-radius: 16rpx 16rpx 0 0; border-radius: 16rpx 16rpx 0 0;
@@ -788,7 +761,7 @@
.number { .number {
padding: 6rpx; padding: 6rpx;
border-radius: 16rpx; border-radius: 16rpx;
background: #ED5A2E; background: #ed5a2e;
color: #fff; color: #fff;
font-size: 32rpx; font-size: 32rpx;
margin-left: 18rpx; margin-left: 18rpx;
@@ -814,7 +787,7 @@
.tuan-members { .tuan-members {
padding: 0 16rpx 0 0; padding: 0 16rpx 0 0;
border-radius: 0 6rpx 6rpx 0; border-radius: 0 6rpx 6rpx 0;
background: #4C2828; background: #4c2828;
color: #f5d9ad; color: #f5d9ad;
font-weight: 700; font-weight: 700;
} }
@@ -846,7 +819,7 @@
.shop { .shop {
border-radius: 8rpx; border-radius: 8rpx;
background: #F8F8F8; background: #f8f8f8;
padding: 16rpx 34rpx; padding: 16rpx 34rpx;
} }
@@ -869,11 +842,10 @@
width: calc(100% / 3); width: calc(100% / 3);
display: flex; display: flex;
.add-box { .add-box {
width: 140rpx; width: 140rpx;
height: 140rpx; height: 140rpx;
border: 2rpx dashed #D9D9D9; border: 2rpx dashed #d9d9d9;
border-radius: 50%; border-radius: 50%;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
@@ -912,7 +884,7 @@
.tuanzhang { .tuanzhang {
padding: 8rpx 18rpx; padding: 8rpx 18rpx;
border-radius: 20rpx; border-radius: 20rpx;
background: #ED5A2E; background: #ed5a2e;
color: #fff; color: #fff;
bottom: 0; bottom: 0;
} }

View File

@@ -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;

View File

@@ -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.83"
}, },
"devDependencies": { "devDependencies": {
"unplugin-auto-import": "^0.16.7" "unplugin-auto-import": "^0.16.7"

View File

@@ -2,6 +2,7 @@
"easycom": { "easycom": {
"autoscan": true, "autoscan": true,
"custom": { "custom": {
"^my-(.*)": "@/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"

View File

@@ -5,7 +5,8 @@
<!-- 轮播图 --> <!-- 轮播图 -->
<swipers :carousel="hometoplist.bannerList"></swipers> <swipers :carousel="hometoplist.bannerList"></swipers>
<!-- 广告 --> <!-- 广告 -->
<advertisement :bannervo="hometoplist.freeBannerList" :itemStyle="advertisementStyle" ref="refbannervo"></advertisement> <advertisement :bannervo="hometoplist.freeBannerList" :itemStyle="advertisementStyle" ref="refbannervo">
</advertisement>
<!-- 金刚区 --> <!-- 金刚区 -->
<diamond :district="hometoplist.district"></diamond> <diamond :district="hometoplist.district"></diamond>
<!-- 今日上线 --> <!-- 今日上线 -->
@@ -134,10 +135,27 @@
<script setup> <script setup>
import CouponModal from '@/components/coupon-modal.vue'; import CouponModal from '@/components/coupon-modal.vue';
import { ref, computed, onMounted, reactive, onBeforeUnmount, watch, getCurrentInstance, nextTick } from 'vue'; import {
import { onLoad, onReady, onShow, onReachBottom, onPageScroll } from '@dcloudio/uni-app'; ref,
computed,
onMounted,
reactive,
onBeforeUnmount,
watch,
getCurrentInstance,
nextTick
} from 'vue';
import {
onLoad,
onReady,
onShow,
onReachBottom,
onPageScroll
} from '@dcloudio/uni-app';
// 获取全局属性 // 获取全局属性
const { proxy } = getCurrentInstance(); const {
proxy
} = getCurrentInstance();
import pageLoading from './components/pageLoading.vue'; import pageLoading from './components/pageLoading.vue';
import swipers from './components/swiper.vue'; //引入轮播 import swipers from './components/swiper.vue'; //引入轮播
import advertisement from './components/advertisement.vue'; //广告 import advertisement from './components/advertisement.vue'; //广告
@@ -147,11 +165,22 @@ import indexs from './indexs.vue';
import AreaSelect from './components/AreaSelect.vue'; //城市联动 import AreaSelect from './components/AreaSelect.vue'; //城市联动
import grouping from './components/grouping.vue'; //其他 import grouping from './components/grouping.vue'; //其他
import Nav from '@/components/indexnav.vue'; //导航栏 import Nav from '@/components/indexnav.vue'; //导航栏
import { APIhomehomePageUp, APIhome } from '@/common/api/index/index.js'; import {
import { APIgeocodelocation } from '@/common/api/api.js'; APIhomehomePageUp,
import { useNavbarStore } from '@/stores/navbarStore'; APIhome
import { productStore } from '@/stores/user.js'; } from '@/common/api/index/index.js';
import { getUnReadCountReq } from '../../common/api/account/message'; import {
APIgeocodelocation
} from '@/common/api/api.js';
import {
useNavbarStore
} from '@/stores/navbarStore';
import {
productStore
} from '@/stores/user.js';
import {
getUnReadCountReq
} from '../../common/api/account/message';
const store = useNavbarStore(); const store = useNavbarStore();
const storeuser = productStore(); const storeuser = productStore();
store.updateNavbarConfig({ store.updateNavbarConfig({
@@ -316,7 +345,8 @@ const viewHistory = async (item, index) => {
} }
// 是否有弹出层 // 是否有弹出层
if (item.isChild) { if (item.isChild) {
showproductlist.value = showproductlist.value ? (viewHistoryindex.value == index ? false : true) : !showproductlist.value; showproductlist.value = showproductlist.value ? (viewHistoryindex.value == index ? false : true) : !
showproductlist.value;
} }
viewHistoryindex.value = index; viewHistoryindex.value = index;
}; };
@@ -327,18 +357,35 @@ onPageScroll((res) => {
}); });
const indexsRef = ref(null); const indexsRef = ref(null);
const shopId = ref(null)
const shopInfo = ref(null)
onShow(async () => { onShow(async () => {
if (!storeuser.isHasLogin) {
await handleMixinOnLoad(options)
console.log('shopInfo', uni.cache.get('shopInfo'));
console.log('【页面】开始处理自身业务逻辑');
onPageShow()
} else {
onPageShow()
}
setTimeout(() => {
showPageLoading.value = false;
getUnReadMsgCount();
}, 800);
});
async function onPageShow() {
try { try {
await storeuser.getLocation(); await storeuser.getLocation();
proxy.$isResolve(); proxy.$isResolve();
const shopId = uni.cache.get('shopId'); shopId.value = uni.cache.get('shopId');
if (shopId) { if (shopId.value) {
indexsRef.value.updateData(); indexsRef.value.updateData();
} }
} catch (error) {} } catch (error) {}
await proxy.$onLaunched; await proxy.$onLaunched;
if (uni.cache.get('shopId')) { if (shopId.value) {
showindex.value = 'shopIndex'; showindex.value = 'shopIndex';
await storeuser.actionsproductqueryProduct(); await storeuser.actionsproductqueryProduct();
await nextTick(); await nextTick();
@@ -349,7 +396,9 @@ onShow(async () => {
init_fn(); init_fn();
// 获取初始定位高度 // 获取初始定位高度
} }
});
shopInfo.value = uni.cache.get('shopInfo');
}
const showPageLoading = ref(true); const showPageLoading = ref(true);
@@ -369,18 +418,52 @@ const getUnReadMsgCount = async () => {
} }
} }
onMounted(async () => {
setTimeout(() => {
showPageLoading.value = false;
getUnReadMsgCount();
}, 800);
});
onReachBottom(() => { onReachBottom(() => {
onLoadhome(); onLoadhome();
}); });
import {
shareMixin,
handleMixinOnLoad
} from '@/utils/share.js'
watch(() => shopId.value, (newval) => {
if (newval) {
uni.showShareMenu({
withShareTicket: true, // 可选:是否返回分享票据
menus: ['shareAppMessage', 'shareTimeline'] // 显示「分享好友」和「分享朋友圈」
});
} else {
uni.hideShareMenu();
}
}, {
immediate: true
})
defineOptions({
mixins: [shareMixin],
});
const options = reactive({})
onLoad(async (opt) => {
Object.assign(options, opt)
// await handleMixinOnLoad(options)
// console.log('shopInfo', uni.cache.get('shopInfo'));
// console.log('【页面】开始处理自身业务逻辑');
// setTimeout(() => {
// showPageLoading.value = false;
// getUnReadMsgCount();
// }, 800);
})
// 页面离开时清除定时器 // 页面离开时清除定时器
// onBeforeUnmount(() => { // onBeforeUnmount(() => {
// if (refbannervo.value) { // if (refbannervo.value) {

View File

@@ -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">
@@ -167,7 +165,7 @@
function toGroupBuying() { function toGroupBuying() {
uni.navigateTo({ uni.navigateTo({
url: '/groupBuying/index/index' url: '/groupBuying/index/index'
}) });
} }
function toFenxiao() { function toFenxiao() {
@@ -215,7 +213,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 +299,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 +314,9 @@
defineExpose({ defineExpose({
updateData updateData
}); });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@@ -7,13 +7,20 @@
<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
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 <up-image
width="76" width="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>

View File

@@ -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}">

View File

@@ -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>

File diff suppressed because it is too large Load Diff

View File

@@ -67,7 +67,7 @@
</rechargeFree> </rechargeFree>
<!-- 支付方式 --> <!-- 支付方式 -->
<paymentMethodes ref="paymentMethodref" :orderVIP="orderVIP" @groupChange="groupChange" <paymentMethodes ref="paymentMethodref" :shopUserInfo="orderVIP" @groupChange="groupChange"
:disablePayType="disablePayType" :changeFreeenable="isBwc" v-model="paymentmethod" :disablePayType="disablePayType" :changeFreeenable="isBwc" v-model="paymentmethod"
v-if="listinfo.status == 'unpaid' || !listinfo.id"> v-if="listinfo.status == 'unpaid' || !listinfo.id">
<template #bottom> <template #bottom>
@@ -203,6 +203,7 @@
useWebSocket useWebSocket
} from "@/stores/carts-websocket.js"; } from "@/stores/carts-websocket.js";
import * as chatApi from "@/http/php/chat"; import * as chatApi from "@/http/php/chat";
import * as rechargeApi from '@/common/api/market/recharge.js'
import MsgListItem from '@/components/msg-list-item/msg-list-item.vue' import MsgListItem from '@/components/msg-list-item/msg-list-item.vue'
@@ -576,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
@@ -858,8 +859,6 @@
icon: "none", icon: "none",
}); });
const shopUserInfo = uni.cache.get("shopUserInfo"); const shopUserInfo = uni.cache.get("shopUserInfo");
console.log("shopUserInfo", shopUserInfo);
console.log("listinfo", listinfo);
if (shopUserInfo) { if (shopUserInfo) {
if (shopUserInfo.userId == listinfo.userId) { if (shopUserInfo.userId == listinfo.userId) {
pay_unlock(); pay_unlock();
@@ -1011,7 +1010,6 @@
// 更新数据 // 更新数据
if (orderVIP.value) { if (orderVIP.value) {
orderVIP.value = uni.cache.get("orderVIP"); orderVIP.value = uni.cache.get("orderVIP");
paymentMethodref.value.orderVIPfun(uni.cache.get("orderVIP"));
if (listinfo.id && ordershopUserInfo.value.registerType != "before") { if (listinfo.id && ordershopUserInfo.value.registerType != "before") {
orderorderInfo(); orderorderInfo();
} }
@@ -1034,7 +1032,7 @@
console.log("跳转到加菜页面"); console.log("跳转到加菜页面");
const arr= getCurrentPages() const arr= getCurrentPages()
console.log(arr); console.log(arr);
if(arr[arr.length-1]&&arr[arr.length-1].route=='pages/product/index'){ if(arr.length>=2&&arr[arr.length-2]&&arr[arr.length-2].route=='pages/product/index'){
back(); back();
}else{ }else{
uni.cache.set('tableCode',listinfo.tableCode) uni.cache.set('tableCode',listinfo.tableCode)
@@ -1113,10 +1111,11 @@
} }
const limitTimeDiscountRes = ref(null) const limitTimeDiscountRes = ref(null)
const rechargeConfig=ref(null)
async function init(opt) { async function init(opt) {
await storeuser.actionsproductqueryProduct(); const res1= await storeuser.actionsproductqueryProduct();
orderVIP.value=res1
console.log("init"); console.log('orderVIP',orderVIP.value)
cartStore.clearOrderConfig(); cartStore.clearOrderConfig();
Object.assign(options, opt); Object.assign(options, opt);
listinfo.id = options.orderId; listinfo.id = options.orderId;
@@ -1146,10 +1145,23 @@
} }
} }
//获取台桌信息
let tableRes = await getTableInfo({
tableCode: options.tableCode || "",
});
console.log("tableRes", tableRes);
listinfo.tableName = tableRes?tableRes.name:'';
//获取店铺信息 //获取店铺信息
const shopInfoRes = await APIusershopInfodetail({ const shopInfoRes = await APIusershopInfodetail({
shopId: options.shopId, shopId: options.shopId,
}); });
//智慧充值
const rechargeConfigRes=await rechargeApi.config({shopId: options.shopId})
if(rechargeConfigRes&&typeof rechargeConfigRes ==='object'){
rechargeConfig.value=rechargeConfigRes
}
//获取积分配置 //获取积分配置
pointsApi.pointsConfig().then(res => { pointsApi.pointsConfig().then(res => {
cartStore.setPointDeductionRule(res); cartStore.setPointDeductionRule(res);
@@ -1274,6 +1286,9 @@
if (!isCanUseCharge.value) { if (!isCanUseCharge.value) {
arr.add("余额支付"); arr.add("余额支付");
} }
if(rechargeConfig.value&&!rechargeConfig.value.isEnable){
arr.add("余额支付");
}
return Array.from(arr); return Array.from(arr);
}); });

View File

@@ -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) => {
@@ -583,7 +583,6 @@
console.log(uni.cache.get('orderVIP')) console.log(uni.cache.get('orderVIP'))
orderVIP.value = uni.cache.get('orderVIP') orderVIP.value = uni.cache.get('orderVIP')
ordershopUserInfo.value = orderVIP.value.shopInfo ordershopUserInfo.value = orderVIP.value.shopInfo
paymentMethodref.value.orderVIPfun(uni.cache.get('orderVIP'))
if (orderId.value) { if (orderId.value) {
orderorderInfo() orderorderInfo()
} }

View File

@@ -62,8 +62,14 @@
<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"
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="112" height="112" radius="20" <u-image width="112" height="112" radius="20"
: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>
@@ -130,7 +136,9 @@
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) {
@@ -142,12 +150,14 @@
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',
}); });
} }
}) })
} }
function totalGoodsNum(arr) { function totalGoodsNum(arr) {
if (!arr) { if (!arr) {
return 0 return 0
@@ -156,6 +166,7 @@
return prve + cur.num return prve + cur.num
}, 0) }, 0)
} }
function isRemoveOrder(item) { function isRemoveOrder(item) {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
@@ -578,6 +589,7 @@
.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;

View File

@@ -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,9 @@
</view> </view>
</scroll-view>
<view class="shop_bottom"> <!-- 占位不用管下面代码也不要删除 -->
<view class="shop_bottom" style="opacity: 0;">
<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>
@@ -159,6 +167,97 @@
</view> </view>
<view class="operation-wrap" v-if="goods.type != 'package'&&stockNumberIsFull(goods)"> <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>
<view class="shop_bottom" style="position: absolute;bottom: 0;z-index:100;">
<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 single-and-staticPackage "
v-else-if="goods.type=='single'||(goods.type=='package'&&goods.groupType==0)">
<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 choosePackage "
v-else-if="goods.type=='package'&&goods.groupType==1">
<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;

View File

@@ -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;
} }

View File

@@ -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"
@@ -257,7 +256,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 +490,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 +508,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 +574,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">
@@ -750,7 +745,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 +759,6 @@
proxy proxy
} = getCurrentInstance(); } = getCurrentInstance();
//点单智能推荐 //点单智能推荐
function onBuyClick(item) { function onBuyClick(item) {
let index = -1; let index = -1;
@@ -802,7 +798,6 @@
/** /**
* 通用数据合集 start * 通用数据合集 start
*/ */
const showGoodsModal = ref(false)
// 门店信息 // 门店信息
const shopInfo = reactive({}); const shopInfo = reactive({});
@@ -881,7 +876,7 @@
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
} }
@@ -1378,6 +1373,7 @@
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)
} }
@@ -1448,9 +1444,13 @@
// 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) => {
@@ -1685,20 +1685,27 @@
// 返回商品对应sku数据 // 返回商品对应sku数据
function cartInit(arr) { function cartInit(arr) {
const result = [] const result = []
console.log('cartInitArr', arr);
console.log('allGoodsArr', allGoodsArr);
cartStore.carts = arr.map(v => { cartStore.carts = arr.map(v => {
const goods = allGoodsArr.find(g => g.id == v.product_id) const goods = cartStore.allGoodsArr.find(g => g.id == v.product_id)
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('删除未匹配到的商品', {
id: v.id,
operate_type: "del",
table_code: uni.cache.get('tableCode'),
shop_id: uni.cache.get('shopId'),
type: "shopping",
})
useSocket.sendMessage({ useSocket.sendMessage({
id: v.id, id: v.id,
operate_type: "del", operate_type: "del",
@@ -1747,7 +1754,7 @@
isLoading.value = false; isLoading.value = false;
return false; return false;
} }
console.log('product index 收到消息', Message);
// 检查消息是否已经处理过 // 检查消息是否已经处理过
if (processedMessageIds.has(Message.msg_id)) { if (processedMessageIds.has(Message.msg_id)) {
return; return;
@@ -2184,11 +2191,11 @@
} }
return currentTime >= startTime && currentTime <= endTime; return currentTime >= startTime && currentTime <= endTime;
}); });
let allGoodsArr = [] const allGoodsArr = ref([])
// 列表请求 // 列表请求
const productqueryProduct = async () => { const productqueryProduct = async () => {
cartStore.goodsIsloading = false; cartStore.goodsIsloading = false;
allGoodsArr = [] allGoodsArr.value = []
try { try {
shopProductList.hots = await productminiApphotsquery(); shopProductList.hots = await productminiApphotsquery();
shopProductList.productInfo = await APIgroupquery(); shopProductList.productInfo = await APIgroupquery();
@@ -2200,38 +2207,46 @@
setTimeout(() => { setTimeout(() => {
uni.pro.switchTab('index/index'); uni.pro.switchTab('index/index');
}, 1000); }, 1000);
return; // 出错直接返回,避免后续逻辑
} }
if (shopProductList.productInfo.length > 0 || shopProductList.hots.length > 0) { if (shopProductList.productInfo.length > 0 || shopProductList.hots.length > 0) {
//TODO handle the exception // 第一步处理productInfo替换forEach为for...of支持await
//第一步:将所有商品的 cartNumber 初始化为 0 for (const group of shopProductList.productInfo) {
shopProductList.productInfo.forEach((group) => { for (const product of group.productList) {
group.productList.forEach(async (product) => { product.cartNumber = 0;
product.isSaleTimeshow = await isProductAvailable(product.days, product // 等待异步函数执行完成后再push
.startTime, product.endTime); product.isSaleTimeshow = await isProductAvailable(
product.days,
allGoodsArr.push(product) product.startTime,
product.endTime
);
allGoodsArr.value.push(product);
cartStore.setGoodsMap(product.id, product); cartStore.setGoodsMap(product.id, product);
}); }
}); }
shopProductList.hots.forEach(async (i) => {
i.isSaleTimeshow = await isProductAvailable(i.days, i.startTime, i.endTime);
allGoodsArr.push(i)
cartStore.setGoodsMap(i.id, i);
});
console.log('shopProductList', shopProductList);
// 第二步处理hots同理替换forEach为for...of
for (const i of shopProductList.hots) {
i.cartNumber = 0;
i.isSaleTimeshow = await isProductAvailable(i.days, i.startTime, i.endTime);
allGoodsArr.value.push(i);
cartStore.setGoodsMap(i.id, i);
}
// 此时所有异步操作完成allGoodsArr已有数据
// console.log('allGoodsArr', allGoodsArr);
// console.log('shopProductList', shopProductList);
console.log('cartStore.carts', cartStore.carts)
cartStore.allGoodsArr = allGoodsArr.value
if (cartStore.carts.length > 0) { if (cartStore.carts.length > 0) {
cartInit(cartStore.carts) cartInit(cartStore.carts);
} }
cartStore.goodsIsloading = true; cartStore.goodsIsloading = true;
scrollTopSize.value = 0; scrollTopSize.value = 0;
topArr.value = []; topArr.value = [];
// userStore.actionsAPIuser()
// 数据可以更新
isDataLoaded.value = true; isDataLoaded.value = true;
// 历史订单
Historicalorders(); Historicalorders();
updateProductQuantities(); updateProductQuantities();
} else { } else {
@@ -2245,6 +2260,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);
@@ -2426,27 +2451,84 @@
}); });
} }
import {
shareMixin,
handleMixinOnLoad,
returnQuery,
jsonToUrl,wxShare,
returnCommonQuery
} from '@/utils/share.js'
import { onShareTimeline } from '@dcloudio/uni-app';
// defineOptions({
// mixins: [shareMixin],
// });
let isGoodsShare = ref(false)
function shareClick() {
isGoodsShare.value = true
}
async function onShare(){
const queryJson = await returnCommonQuery()
let query = jsonToUrl(queryJson)
query += '&type=beforehand'
let json={}
if (goodsModalList.value.length && isGoodsShare.value) {
const goods = goodsModalList.value[goodsModalList.value.length - 1].goods
query += '&showGoodsId=' + goods.id
json.title = goods.name
json.imageUrl = goods.coverImg
json.showGoodsId = goods.id
}else{
json.title=uni.cache.get('shopInfo').shopName||''
json.imageUrl=uni.cache.get('shopInfo').logo||''
}
console.log('onShareAppMessage', {
query,
...json,
path: '/pages/product/index' + '?' + query
});
return wxShare({
query,
...json,
path: '/pages/product/index' + '?' + query
})
}
onShareAppMessage(onShare)
onShareTimeline(onShare)
const pageOptions = reactive({})
onLoad(async (e) => { onLoad(async (e) => {
Object.assign(pageOptions, e)
if (e.type) { if (e.type) {
orderType.value = e.type; orderType.value = e.type;
} }
//获取用户信息 await handleMixinOnLoad({
const userInfo = await APIshopUserInfo({ ...e,
shopId: uni.cache.get('shopId') shopId: e.shopId || uni.cache.get('shopId')
}) })
//获取店铺信息 const userInfo = userStore.userInfo
const shopInfoRes = await APIusershopInfodetail({ const shopInfoRes = userStore.shopInfo
shopId: uni.cache.get('shopId') // //获取用户信息
}); // const userInfo = await APIshopUserInfo({
// shopId: uni.cache.get('shopId')
// })
// //获取店铺信息
// const shopInfoRes = await APIusershopInfodetail({
// shopId: uni.cache.get('shopId')
// });
if (shopInfoRes && shopInfoRes.shopInfo) { if (shopInfoRes && shopInfoRes.shopInfo) {
Object.assign(shopInfo, shopInfoRes.shopInfo); Object.assign(shopInfo, shopInfoRes.shopInfo);
uni.cache.set('shopInfo', shopInfoRes.shopInfo)
} }
if (userInfo && typeof userInfo === 'object') { if (userInfo && typeof userInfo === 'object') {
shopUserInfo.value = userInfo shopUserInfo.value = userInfo
uni.cache.set('shopUserInfo', userInfo)
} }
await productqueryProduct(); await productqueryProduct();
@@ -2579,6 +2661,7 @@
useSocket.setOnMessage(() => {}); useSocket.setOnMessage(() => {});
} }
onHide(() => { onHide(() => {
isGoodsShare.value=false
closeSocket(); closeSocket();
}); });
onUnload(() => { onUnload(() => {

View File

@@ -60,6 +60,9 @@
<text v-if="item.bizCode == 'cashback'"> <text v-if="item.bizCode == 'cashback'">
消费返现 消费返现
</text> </text>
<text v-if="item.bizCode == 'cashback_refund'">
消费返现扣减
</text>
<text v-if="item.bizCode == 'freeIn'"> <text v-if="item.bizCode == 'freeIn'">
霸王餐充值 霸王餐充值
</text> </text>

View File

@@ -1,23 +1,16 @@
<!-- 充值中心 --> <!-- 充值中心 -->
<template> <template>
<view class="container"> <view class="container">
<up-navbar <up-navbar bgColor="transparent" title="充值中心" @leftClick="back"></up-navbar>
bgColor="transparent"
title="充值中心"
@leftClick="back"
></up-navbar>
<view class="header-wrap"> <view class="header-wrap">
<image <image class="bg" src="/static/czzx_header_bg.png" mode="aspectFill"></image>
class="bg"
src="/static/czzx_header_bg.png"
mode="aspectFill"
></image>
<view class="select-shop"> <view class="select-shop">
<view class="select-btn"> <view class="select-btn">
<up-icon name="map" color="#333"></up-icon> <up-icon name="map" color="#333"></up-icon>
<text class="t">{{ shopInfo.shopName }}</text> <text class="t">{{ shopInfo.shopName }}</text>
<up-icon name="arrow-right" color="#333"></up-icon> <up-icon name="arrow-right" color="#333"></up-icon>
</view> </view>
<ymf-share></ymf-share>
</view> </view>
<view class="balance-wrap"> <view class="balance-wrap">
<view class="left"> <view class="left">
@@ -37,11 +30,7 @@
<view class="bottom"> <view class="bottom">
<view class="u-flex u-flex-between"> <view class="u-flex u-flex-between">
<view class="u-flex"> <view class="u-flex">
<image <image src="/static/vip/money.png" style="width: 44rpx; height: 44rpx" mode=""></image>
src="/static/vip/money.png"
style="width: 44rpx; height: 44rpx"
mode=""
></image>
<text class="u-m-l-24 color-333 font-16 font-700">立即充值</text> <text class="u-m-l-24 color-333 font-16 font-700">立即充值</text>
</view> </view>
<view class="font-12 color-999"> <view class="font-12 color-999">
@@ -50,27 +39,12 @@
</view> </view>
</view> </view>
<view class="list u-m-t-40"> <view class="list u-m-t-40">
<view <view class="item color1" @click="sel = index" v-for="(item, index) in list" :key="index" :class="{ active: sel == index }">
class="item color1"
@click="sel = index"
v-for="(item, index) in list"
:key="index"
:class="{ active: sel == index }"
>
<view class=""> <view class="">
<text></text> <text></text>
<text <text class="font-700" style="font-size: 48 u-flex-1rpx" :class="{ color2: sel == index }">{{ item.amount }}</text>
class="font-700"
style="font-size: 48 u-flex-1rpx"
:class="{ color2: sel == index }"
>{{ item.amount }}</text
>
</view> </view>
<view <view class="font-12" v-if="item.rewardAmount" :class="{ color2: sel == index }">
class="font-12"
v-if="item.rewardAmount"
:class="{ color2: sel == index }"
>
<text></text> <text></text>
<text></text> <text></text>
<text class="font-14">{{ item.rewardAmount }}</text> <text class="font-14">{{ item.rewardAmount }}</text>
@@ -84,12 +58,7 @@
<text></text> <text></text>
<text>{{ couponNum(item.couponInfoList) }}</text> <text>{{ couponNum(item.couponInfoList) }}</text>
<text>张券</text> <text>张券</text>
<text <text class="color2 u-m-l-8" v-if="sel == index" @click="lookCoupon(item)">查看</text>
class="color2 u-m-l-8"
v-if="sel == index"
@click="lookCoupon(item)"
>查看</text
>
</view> </view>
<view class="sel u-flex" v-if="sel == index"> <view class="sel u-flex" v-if="sel == index">
@@ -100,24 +69,12 @@
<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"
type="number"
placeholder="请输入充值金额"
border="none"
placeholder-style="font-size:14px;"
></up-input>
</view> </view>
<view class="color-999 font-12 u-m-t-4" <view class="color-999 font-12 u-m-t-4">自定义金额充值时不享受任何优惠赠送</view>
>自定义金额充值时不享受任何优惠赠送</view
>
</template> </template>
<button <button class="buy-btn" @click="buy" :class="{ disabled: !state.isEnable }">
class="buy-btn"
@click="buy"
:class="{ disabled: !state.isEnable }"
>
<text class="font-16">{{ charge_money }}</text> <text class="font-16">{{ charge_money }}</text>
<text class="font-14 u-m-l-24">立即充值</text> <text class="font-14 u-m-l-24">立即充值</text>
</button> </button>
@@ -125,9 +82,7 @@
<view>充值说明</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="color2 u-m-l-28" @click="toShopList">全国门店通用 {{ '>' }}</text>
>全国门店通用 {{ ">" }}
</text>
</view> </view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<text>有效期限</text> <text>有效期限</text>
@@ -143,37 +98,36 @@
<view class="u-m-t-16 u-flex u-flex-y-center"> <view class="u-m-t-16 u-flex u-flex-y-center">
<text class="no-wrap">充值说明</text> <text class="no-wrap">充值说明</text>
<text class="u-m-l-28" style="word-break: break-all"> <text class="u-m-l-28" style="word-break: break-all">
{{ state.remark || "" }} {{ state.remark || '' }}
</text> </text>
</view> </view>
</view> </view>
</view> </view>
<CouponList <CouponList v-model="couponModel.show" :list="couponModel.couponInfoList"></CouponList>
v-model="couponModel.show"
:list="couponModel.couponInfoList"
></CouponList>
</view> </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'
}); });
} }
@@ -184,7 +138,7 @@ function couponNum(list) {
} }
const couponModel = reactive({ const couponModel = reactive({
show: false, show: false,
couponInfoList: [], couponInfoList: []
}); });
function lookCoupon(item) { function lookCoupon(item) {
@@ -194,19 +148,19 @@ function lookCoupon(item) {
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;
@@ -217,16 +171,16 @@ async function buy() {
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();
} }
@@ -234,13 +188,13 @@ async function buy() {
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
}); });
} }
@@ -251,26 +205,26 @@ 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);
@@ -282,16 +236,28 @@ const charge_money = computed(() => {
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) => {
onShareAppMessage(async (res) => {
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); Object.assign(option, opt);
await handleMixinOnLoad(opt);
// init(); // init();
}); });
@@ -325,8 +291,7 @@ onShow(() => {
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;
@@ -359,6 +324,7 @@ onShow(() => {
.select-shop { .select-shop {
display: flex; display: flex;
justify-content: space-between;
align-items: center; align-items: center;
position: relative; position: relative;

View File

@@ -1,12 +1,16 @@
<template> <template>
<view class="container"> <view class="container">
<image class="topBack" :src=" <image
class="topBack"
:src="
userInfo.shopExtendList userInfo.shopExtendList
? userInfo.shopExtendList[1].value ? userInfo.shopExtendList[1].value
? userInfo.shopExtendList[1].value ? userInfo.shopExtendList[1].value
: 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/myTopBack.png' : 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/myTopBack.png'
: 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/myTopBack.png' : 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/myTopBack.png'
" mode="aspectFill"></image> "
mode="aspectFill"
></image>
<view class="myContent"> <view class="myContent">
<view class="my_info flex-between"> <view class="my_info flex-between">
<view class="my_info_left"> <view class="my_info_left">
@@ -15,8 +19,7 @@
<image class="my_info_left_head" :src="userInfo.headImg" mode="aspectFill"></image> <image class="my_info_left_head" :src="userInfo.headImg" mode="aspectFill"></image>
</button> </button>
<!-- <view class="name">{{ userInfo.nickName }}</view> --> <!-- <view class="name">{{ userInfo.nickName }}</view> -->
<input type="nickname" class="name" v-model="userInfo.nickName" placeholder="输入昵称" <input type="nickname" class="name" v-model="userInfo.nickName" placeholder="输入昵称" @blur="onNicknameInput" />
@blur="onNicknameInput" />
<!-- #endif --> <!-- #endif -->
<!-- #ifndef MP-WEIXIN --> <!-- #ifndef MP-WEIXIN -->
<image class="my_info_left_head" :src="userInfo.headImg" mode="aspectFill"></image> <image class="my_info_left_head" :src="userInfo.headImg" mode="aspectFill"></image>
@@ -27,8 +30,7 @@
<image class="my_info_right_qr" src="/static/icon/code.png" mode="aspectFill"></image> <image class="my_info_right_qr" src="/static/icon/code.png" mode="aspectFill"></image>
<view class="msg-view" @click="viewUserMsgList"> <view class="msg-view" @click="viewUserMsgList">
<view class="msg-icon-wrapper"> <view class="msg-icon-wrapper">
<image v-if="unreadMsgCount > 0" class="my-msg-icon" src="/static/mine/msg_select.png" <image v-if="unreadMsgCount > 0" class="my-msg-icon" src="/static/mine/msg_select.png" mode="aspectFill"></image>
mode="aspectFill"></image>
<image v-else class="my-msg-icon" src="/static/mine/msg.png" mode="aspectFill"></image> <image v-else class="my-msg-icon" src="/static/mine/msg.png" mode="aspectFill"></image>
<!-- 角标 --> <!-- 角标 -->
@@ -39,7 +41,6 @@
</view> </view>
</view> </view>
<!-- <image class="my_info_right_qr" @click="clickEvent" v-if="userInfo.isVip == 1 && ShopId" <!-- <image class="my_info_right_qr" @click="clickEvent" v-if="userInfo.isVip == 1 && ShopId"
:src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/my_qRcode.png'" mode="aspectFill"> :src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/my_qRcode.png'" mode="aspectFill">
</image> </image>
@@ -55,9 +56,7 @@
<view class="amount"> <view class="amount">
<view class="u-flex u-flex-between u-m-t-20"> <view class="u-flex u-flex-between u-m-t-20">
<view class="u-flex"> <view class="u-flex">
<image style="width: 50rpx; height: 37rpx" <image style="width: 50rpx; height: 37rpx" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/storedValue.png" mode="aspectFill"></image>
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/storedValue.png"
mode="aspectFill"></image>
<text class="color-333 font-14 u-m-l-20">储值</text> <text class="color-333 font-14 u-m-l-20">储值</text>
</view> </view>
<view class="u-flex color-666" @click="toChargeList"> <view class="u-flex color-666" @click="toChargeList">
@@ -67,23 +66,17 @@
</view> </view>
<view class="card-list"> <view class="card-list">
<view class="card-list-item" v-for="(item, index) in rechargeList" :key="index" <view class="card-list-item" v-for="(item, index) in rechargeList" :key="index" @click="toCharge(item)">
@click="toCharge(item)">
<up-image radius="20rpx" width="182rpx" height="182rpx" :src="item.logo"></up-image> <up-image radius="20rpx" width="182rpx" height="182rpx" :src="item.logo"></up-image>
<view class="info text-center"> <view class="info text-center">
<view class="color-333 u-m-t-14"> <view class="color-333 u-m-t-14">
<text class="font-10">¥</text> <text class="font-10">¥</text>
<text class="font-16 font-700">{{ <text class="font-16 font-700">{{ item.amount || '0.00' }}</text>
item.amount || "0.00"
}}</text>
</view> </view>
<view class="font-12 color-666 u-line-1">{{ <view class="font-12 color-666 u-line-1">{{ item.shopName }}</view>
item.shopName
}}</view>
</view> </view>
</view> </view>
<view class="u-flex u-flex-column u-flex-center" style="width: 12px" v-if="rechargeList.length" <view class="u-flex u-flex-column u-flex-center" style="width: 12px" v-if="rechargeList.length" @click="toChargeList">
@click="toChargeList">
<view class="text-center color-333 font-12">查看全部</view> <view class="text-center color-333 font-12">查看全部</view>
</view> </view>
</view> </view>
@@ -91,8 +84,7 @@
<view class="vip u-m-t-40"> <view class="vip u-m-t-40">
<view class="u-flex u-flex-between u-m-t-20"> <view class="u-flex u-flex-between u-m-t-20">
<view class="u-flex"> <view class="u-flex">
<image style="width: 50rpx; height: 40rpx" src="/static/icon/vip.png" mode="aspectFill"> <image style="width: 50rpx; height: 40rpx" src="/static/icon/vip.png" mode="aspectFill"></image>
</image>
<text class="color-333 font-14 u-m-l-20">会员</text> <text class="color-333 font-14 u-m-l-20">会员</text>
</view> </view>
<view class="u-flex color-666" @click="tomemberList"> <view class="u-flex color-666" @click="tomemberList">
@@ -102,13 +94,10 @@
</view> </view>
<view class="card-list"> <view class="card-list">
<view class="card-list-item" v-for="(item, index) in memberList" :key="index" <view class="card-list-item" v-for="(item, index) in memberList" :key="index" @click="tomember(item)">
@click="tomember(item)">
<up-image radius="20rpx" width="182rpx" height="182rpx" :src="item.logo"></up-image> <up-image radius="20rpx" width="182rpx" height="182rpx" :src="item.logo"></up-image>
<view class="info text-center"> <view class="info text-center">
<view class="font-12 color-666 u-m-t-14 u-line-1">{{ <view class="font-12 color-666 u-m-t-14 u-line-1">{{ item.shopName }}</view>
item.shopName
}}</view>
</view> </view>
</view> </view>
<view class="u-flex u-flex-column u-flex-center" style="width: 12px" v-if="memberList.length"> <view class="u-flex u-flex-column u-flex-center" style="width: 12px" v-if="memberList.length">
@@ -119,9 +108,7 @@
<view class="amount"> <view class="amount">
<view class="u-flex u-flex-between u-m-t-20"> <view class="u-flex u-flex-between u-m-t-20">
<view class="u-flex"> <view class="u-flex">
<image style="width: 50rpx; height: 44rpx" <image style="width: 50rpx; height: 44rpx" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/points.png" mode="aspectFill"></image>
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/points.png" mode="aspectFill">
</image>
<text class="color-333 font-14 u-m-l-20">积分</text> <text class="color-333 font-14 u-m-l-20">积分</text>
</view> </view>
<view class="u-flex color-666" @click="toCoin()"> <view class="u-flex color-666" @click="toCoin()">
@@ -131,22 +118,16 @@
</view> </view>
<view class="card-list"> <view class="card-list">
<view class="card-list-item" v-for="(item, index) in coinList" :key="index" <view class="card-list-item" v-for="(item, index) in coinList" :key="index" @click="toCoin(item)">
@click="toCoin(item)">
<up-image radius="20rpx" width="182rpx" height="182rpx" :src="item.logo"></up-image> <up-image radius="20rpx" width="182rpx" height="182rpx" :src="item.logo"></up-image>
<view class="info text-center"> <view class="info text-center">
<view class="color-333 u-m-t-14"> <view class="color-333 u-m-t-14">
<text class="font-16 font-700">{{ <text class="font-16 font-700">{{ item.pointBalance || '0' }}</text>
item.pointBalance || "0"
}}</text>
</view> </view>
<view class="font-12 color-666 u-line-1">{{ <view class="font-12 color-666 u-line-1">{{ item.shopName }}</view>
item.shopName
}}</view>
</view> </view>
</view> </view>
<view class="u-flex u-flex-column u-flex-center" style="width: 12px" v-if="coinList.length" <view class="u-flex u-flex-column u-flex-center" style="width: 12px" v-if="coinList.length" @click="toCoin()">
@click="toCoin()">
<view class="text-center color-333 font-12">查看全部</view> <view class="text-center color-333 font-12">查看全部</view>
</view> </view>
</view> </view>
@@ -154,16 +135,13 @@
</view> </view>
<view class="my_item my_fun u-m-t-30"> <view class="my_item my_fun u-m-t-30">
<view class="my_fun_list"> <view class="my_fun_list">
<view class="my_list_item" v-for="(item, index) in myFunList" :key="index" <view class="my_list_item" v-for="(item, index) in myFunList" :key="index" @click="clickTo(item, index)">
@click="clickTo(item, index)">
<view class="my_list_item_left"> <view class="my_list_item_left">
<image class="my_list_item_icon" :src="item.icon" mode="aspectFill"></image> <image class="my_list_item_icon" :src="item.icon" mode="aspectFill"></image>
<view class="my_list_item_name">{{ item.name }}</view> <view class="my_list_item_name">{{ item.name }}</view>
</view> </view>
<view class="my_list_item_right u-flex"> <view class="my_list_item_right u-flex">
<text v-if="item.type == 'score'" class="font-12">{{ <text v-if="item.type == 'score'" class="font-12">{{ userInfo.pointBalance || 0 }}</text>
userInfo.pointBalance || 0
}}</text>
<!-- <text v-else-if="item.type=='my_coupon'" class="font-12 ">{{userInfo.couponNum || 0}}</text> --> <!-- <text v-else-if="item.type=='my_coupon'" class="font-12 ">{{userInfo.couponNum || 0}}</text> -->
<text class="font-12 color-999" v-else>查看</text> <text class="font-12 color-999" v-else>查看</text>
<u-icon class="u-m-t-2" name="arrow-right" color="#999999" size="12"></u-icon> <u-icon class="u-m-t-2" name="arrow-right" color="#999999" size="12"></u-icon>
@@ -190,40 +168,51 @@
</template> </template>
<script setup> <script setup>
import weQrcode from "@/components/wechat-ac-qrcode.vue"; import weQrcode from '@/components/wechat-ac-qrcode.vue';
import devetools from "@/components/devetools.vue"; import devetools from '@/components/devetools.vue';
import {
ref,
computed,
onMounted,
reactive,
watch
} from "vue";
import {
onLoad,
onReady,
onShow
} from "@dcloudio/uni-app";
import {
productStore
} from "@/stores/user.js";
import * as vipApi from "@/common/api/account/vip.js";
import * as rechargeApi from "@/common/api/market/recharge.js";
import {
pointsShopList
} from '@/common/api/market/points.js'
import {
getUnReadCountReq
} from "../../common/api/account/message";
import {
updateUserInfoReq
} from "../../common/api/api";
import {
uploadFile
} from '@/common/api/upload.js';
import { ref, computed, onMounted, reactive, watch } from 'vue';
import { onLoad, onReady, onShow } from '@dcloudio/uni-app';
import { productStore, Storelogin } from '@/stores/user.js';
import * as vipApi from '@/common/api/account/vip.js';
import * as rechargeApi from '@/common/api/market/recharge.js';
import { pointsShopList } from '@/common/api/market/points.js';
import { getUnReadCountReq } from '../../common/api/account/message';
import { updateUserInfoReq } from '../../common/api/api';
import { uploadFile } from '@/common/api/upload.js';
// 打开企业微信客服
const userStore = Storelogin();
function openContact() {
const shopInfo = uni.cache.get('ordershopUserInfo');
if (shopInfo.weworkId && shopInfo.weworkUrl) {
wx.openCustomerServiceChat({
// corpId: 'wwc76ab19fa6df267f',
corpId: shopInfo.weworkId,
extInfo: {
// url: 'https://work.weixin.qq.com/kfid/kfc40ac2dc5e20c2e8e'
url: shopInfo.weworkUrl
},
// 成功回调
success: (res) => {
console.log('跳转企业微信客服成功', res);
},
// 失败回调
fail: (err) => {
console.error('跳转企业微信客服失败', err);
uni.showToast({
title: '跳转客服失败,请稍后重试',
icon: 'none'
});
}
});
} else {
uni.showToast({
title: '未开放',
icon: 'none'
});
}
}
function qrcodeResult(res) { function qrcodeResult(res) {
qrcode.value = res; qrcode.value = res;
@@ -238,14 +227,14 @@
// url: '/user/score/list' // url: '/user/score/list'
// }, // },
{ {
name: "优惠券", name: '优惠券',
type: "my_coupon", type: 'my_coupon',
icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/my_coupon.png", icon: 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/my_coupon.png'
}, },
{ {
name: "分销", name: '分销',
type: "fenxiao", type: 'fenxiao',
icon: "/static/icon/fenxiao.svg", icon: '/static/icon/fenxiao.svg'
}, },
// { // {
// name: "商家推送", // name: "商家推送",
@@ -269,22 +258,23 @@
// icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/my_member.png" // icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/my_member.png"
// }, // },
// { name: "关于", type: "", icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/inRegard.png"}, // { name: "关于", type: "", icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/inRegard.png"},
// { name: '联系商家', type: 'contact', icon: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/1/2b0480c32c1844dbae2c09f6a729c6e8.png' }
]); ]);
const userInfo = reactive({}); const userInfo = reactive({});
const ShopId = ref(uni.cache.get("shopId")); const ShopId = ref(uni.cache.get('shopId'));
console.log("ShopId", uni.cache.get("shopId")); console.log('ShopId', uni.cache.get('shopId'));
function tomemberList() { function tomemberList() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/user/member/list", url: '/pages/user/member/list'
}); });
} }
function tomember(item) { function tomember(item) {
uni.navigateTo({ uni.navigateTo({
url: "/user/vip/vip?shopId=" + item.shopId, url: '/user/vip/vip?shopId=' + item.shopId
}); });
} }
@@ -292,11 +282,11 @@
if (ShopId.value) { if (ShopId.value) {
if (!userInfo.isVip) { if (!userInfo.isVip) {
uni.navigateTo({ uni.navigateTo({
url: "/user/vip/buy-vip?shopId=" + ShopId.value, url: '/user/vip/buy-vip?shopId=' + ShopId.value
}); });
} else { } else {
uni.navigateTo({ uni.navigateTo({
url: "/user/vip/vip?shopId=" + ShopId.value, url: '/user/vip/vip?shopId=' + ShopId.value
}); });
} }
@@ -312,104 +302,107 @@
// }) // })
// } // }
} else { } else {
uni.pro.navigateTo("member/list", { uni.pro.navigateTo('member/list', {
type: "user_payCode", type: 'user_payCode'
}); });
} }
}; };
// 我的资产 // 我的资产
const Myassets = () => { const Myassets = () => {
if (uni.cache.get("shopId")) { if (uni.cache.get('shopId')) {
uni.pro.navigateTo("user/member/memberdetails", { uni.pro.navigateTo('user/member/memberdetails', {
shopId: uni.cache.get("shopId"), shopId: uni.cache.get('shopId'),
type: "index", type: 'index'
}); });
} else { } else {
uni.pro.navigateTo("user/member/list", { uni.pro.navigateTo('user/member/list', {
shopId: uni.cache.get("shopId"), shopId: uni.cache.get('shopId'),
type: "index", type: 'index'
}); });
} }
}; };
function toCharge(item) { function toCharge(item) {
uni.navigateTo({ uni.navigateTo({
url: "/pages/user/member/czzx?shopId=" + item.shopId, url: '/pages/user/member/czzx?shopId=' + item.shopId
}); });
} }
function toChargeList() { function toChargeList() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/user/member/amount-list", url: '/pages/user/member/amount-list'
}); });
} }
const clickTo = (item, index) => { const clickTo = (item, index) => {
if (item.url) { if (item.url) {
uni.navigateTo({ uni.navigateTo({
url: item.url, url: item.url
}); });
return; return;
} }
let shopId = null; let shopId = null;
switch (item.type) { switch (item.type) {
case "msg": case 'msg':
uni.navigateTo({ uni.navigateTo({
url: "/pageChat/index" url: '/pageChat/index'
}); });
break; break;
case "my_order": case 'my_order':
uni.pro.switchTab("order/index"); uni.pro.switchTab('order/index');
break; break;
case "my_member": case 'my_member':
uni.pro.navigateTo("user/member/list"); uni.pro.navigateTo('user/member/list');
break; break;
case "recharge": case 'recharge':
if (uni.cache.get("shopId") && uni.cache.get("token")) { if (uni.cache.get('shopId') && uni.cache.get('token')) {
uni.pro.navigateTo("member/index", { uni.pro.navigateTo('member/index', {
shopId: uni.cache.get("shopId"), shopId: uni.cache.get('shopId'),
type: "index", type: 'index'
}); });
} else { } else {
uni.pro.navigateTo("member/list", { uni.pro.navigateTo('member/list', {
type: "user_recharge", type: 'user_recharge'
}); });
} }
break; break;
case "points": //积分 case 'points': //积分
if (uni.cache.get("shopId") && uni.cache.get("token")) { if (uni.cache.get('shopId') && uni.cache.get('token')) {
uni.pro.navigateTo("/pagesPoints/index/index", { uni.pro.navigateTo('/pagesPoints/index/index', {
shopId: uni.cache.get("shopId"), shopId: uni.cache.get('shopId'),
type: "user", type: 'user'
}); });
} else { } else {
uni.pro.navigateTo("member/list", { uni.pro.navigateTo('member/list', {
type: "user_points", type: 'user_points'
}); });
} }
break; break;
case "my_coupon": //优惠券 case 'my_coupon': //优惠券
uni.pro.navigateTo("user/coupon", { uni.pro.navigateTo('user/coupon', {
shopId: uni.cache.get("shopId") || "", shopId: uni.cache.get('shopId') || ''
}); });
break; break;
case "fenxiao": //优惠券 case 'fenxiao': //优惠券
uni.navigateTo({ uni.navigateTo({
url: "/distribution/index", url: '/distribution/index'
}); });
break; break;
case "myself": //内部页面 case 'myself': //内部页面
uni.pro.navigateTo("user/myself"); uni.pro.navigateTo('user/myself');
break; break;
case "scan_applet": case 'scan_applet':
uni.navigateToMiniProgram(JSON.parse(item.value)); uni.navigateToMiniProgram(JSON.parse(item.value));
break; break;
case "absolute": //外链url case 'absolute': //外链url
uni.navigateTo({ uni.navigateTo({
url: `/pages/webview/webview?url=${item.menuUrl}`, url: `/pages/webview/webview?url=${item.menuUrl}`
}); });
break; break;
case 'contact': // 联系商家
openContact();
break;
} }
}; };
@@ -430,93 +423,93 @@
const res3 = await pointsShopList(); const res3 = await pointsShopList();
coinTotal.value = res3.length; coinTotal.value = res3.length;
coinList.value = res3; coinList.value = res3.slice(0, 3);
} }
function toCoin(item) { function toCoin(item) {
if (item) { if (item) {
uni.navigateTo({ uni.navigateTo({
url: "/pages/user/member/billDetails?type=2&shopId="+item.shopId+"&id="+(item.id||''), url: '/pages/user/member/billDetails?type=2&shopId=' + item.shopId + '&id=' + (item.id || '')
}); });
return return;
} }
uni.navigateTo({ uni.navigateTo({
url: "/user/score/list", url: '/user/score/list'
}); });
} }
const unreadMsgCount = ref(0); const unreadMsgCount = ref(0);
const getUnReadMsgCount = async () => { const getUnReadMsgCount = async () => {
let res = await getUnReadCountReq() let res = await getUnReadCountReq();
let badge = Number(res) let badge = Number(res);
if (badge > 0) { if (badge > 0) {
uni.setTabBarBadge({ uni.setTabBarBadge({
index: 2, index: 2,
text: badge.toString() text: badge.toString()
}) });
} else { } else {
uni.removeTabBarBadge({ uni.removeTabBarBadge({
index: 2 index: 2
}) });
} }
unreadMsgCount.value = badge unreadMsgCount.value = badge;
} };
const viewUserMsgList = () => { const viewUserMsgList = () => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/user/message/index" url: '/pages/user/message/index'
}) });
} };
onShow(() => { onShow(() => {
loadUserInfo() loadUserInfo();
console.log("userInfo", userInfo); console.log('userInfo', userInfo);
getData(); getData();
getUnReadMsgCount() getUnReadMsgCount();
}); });
const loadUserInfo = async () => { const loadUserInfo = async () => {
await store.actionsAPIuser(); await store.actionsAPIuser();
if (uni.cache.get("shopId")) { if (uni.cache.get('shopId')) {
Object.assign(userInfo, uni.cache.get("orderVIP")); Object.assign(userInfo, uni.cache.get('orderVIP'));
} else { } else {
Object.assign(userInfo, { Object.assign(userInfo, {
...uni.cache.get("userInfo"), ...uni.cache.get('userInfo'),
...uni.cache.get("userInfo").assetsSummary, ...uni.cache.get('userInfo').assetsSummary
}); });
} }
} };
const qrcode = ref(""); const qrcode = ref('');
const showQrcode = computed(() => { const showQrcode = computed(() => {
const followIndex = uni.cache.get("followIndex"); const followIndex = uni.cache.get('followIndex');
if (followIndex == "mine" && qrcode.value) { if (followIndex == 'mine' && qrcode.value) {
return true; return true;
} }
}); });
const onChooseAvatar = async (e) => { const onChooseAvatar = async (e) => {
const fileRes = await uploadFile(e.detail.avatarUrl) const fileRes = await uploadFile(e.detail.avatarUrl);
updateUserInfo({ updateUserInfo({
"headImg": fileRes headImg: fileRes
}) });
} };
const onNicknameInput = (e) => { const onNicknameInput = (e) => {
updateUserInfo({ updateUserInfo({
"nickName": e.detail.value nickName: e.detail.value
}) });
} };
const updateUserInfo = async (param) => { const updateUserInfo = async (param) => {
await updateUserInfoReq(param) await updateUserInfoReq(param);
loadUserInfo() loadUserInfo();
} };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

10
pnpm-lock.yaml generated
View File

@@ -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.83
version: 1.0.81 version: 1.0.83
devDependencies: devDependencies:
unplugin-auto-import: unplugin-auto-import:
specifier: ^0.16.7 specifier: ^0.16.7
@@ -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.83:
resolution: {integrity: sha512-c6SOfOaw43aDDuyXgEv24Vo561EfFoa1gfGbY+p1EfXHoGPOE6tQLekbWW9bn37KAse0Gdef7VCbdv0Dr6ltaw==} resolution: {integrity: sha512-48KLQJXQtF8nLaaFHR1hAFx/QGS848fg7n37BpZEtwliD+D5ZHQFPOCZNaM68jiwDTWhNg41rHpZzhAUQXe+/Q==}
snapshots: snapshots:
@@ -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.83:
dependencies: dependencies:
bignumber.js: 9.3.1 bignumber.js: 9.3.1
loadsh: 0.0.4 loadsh: 0.0.4

View File

@@ -125,6 +125,11 @@
} from '@/utils/uniapp.js' } from '@/utils/uniapp.js'
import modal from "@/scoreShop/components/modal.vue"; import modal from "@/scoreShop/components/modal.vue";
import * as pointGoodsApi from "@/common/api/order/pointGoods.js"; import * as pointGoodsApi from "@/common/api/order/pointGoods.js";
import {
userPoints
} from "@/common/api/market/points.js";
import couponIcon from "@/components/coupon-icon/index"; import couponIcon from "@/components/coupon-icon/index";
import { import {
pay pay
@@ -304,16 +309,63 @@
return `单人兑换已达上限` return `单人兑换已达上限`
} }
}) })
onLoad((opt) => { async function getGoods() {
const exchange_goods = uni.getStorageSync('exchange_goods') const res = await pointGoodsApi.pointsGoods({
if (exchange_goods.goodsDescription) { id: options.id
exchange_goods.goodsDescription = JSON.parse(exchange_goods.goodsDescription) })
if (res.goodsDescription) {
res.goodsDescription = JSON.parse(res.goodsDescription)
} else { } else {
exchange_goods.goodsDescription = [] res.goodsDescription = []
} }
const pointsUserData = uni.getStorageSync('pointsUser') res.couponInfo=res.couponInfo||{}
Object.assign(item, exchange_goods)
Object.assign(pointsUser, pointsUserData) Object.assign(item, res)
}
async function getPointUser() {
const res = await userPoints({
shopUserId: uni.cache.get('shopUserInfo').id || ''
})
Object.assign(pointsUser, res.pointsUser)
}
async function init() {
await getGoods()
await getPointUser()
}
import {
shareMixin,
handleMixinOnLoad,wxShare,returnQuery
} from '@/utils/share.js'
// defineOptions({
// mixins: [shareMixin],
// });
onShareAppMessage(async(res)=>{
const query=await returnQuery()
return wxShare({
...res,
title:item.goodsName,
path:'/scoreShop/detail/index'+'?'+query,
query,
imageUrl:item.goodsImageUrl||''
})
})
const options = reactive({})
onLoad(async (opt) => {
Object.assign(options, opt)
await handleMixinOnLoad(opt)
await init()
// const exchange_goods = uni.getStorageSync('exchange_goods')
// if (exchange_goods.goodsDescription) {
// exchange_goods.goodsDescription = JSON.parse(exchange_goods.goodsDescription)
// } else {
// exchange_goods.goodsDescription = []
// }
// const pointsUserData = uni.getStorageSync('pointsUser')
// Object.assign(item, exchange_goods)
// Object.assign(pointsUser, pointsUserData)
}) })
</script> </script>
@@ -463,6 +515,7 @@
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,6 +540,7 @@
font-size: 700; font-size: 700;
} }
} }
.w-full { .w-full {
width: 100%; width: 100%;
} }

View File

@@ -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,
}) })
} }

View File

@@ -31,8 +31,9 @@
<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" @click="toggleLayout">
<image :src="layout === 'block' ? imgs.layout_block : imgs.layout" class="layout" /> <image :src="layout === 'block' ? imgs.layout_block : imgs.layout" class="layout" />
<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>
@@ -44,6 +45,7 @@
</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,11 +72,20 @@
} }
function back() { function back() {
const pages = getCurrentPages();
if(pages.length<2){
uni.switchTab({
url: '/pages/index/index'
})
}else{
uni.navigateBack({ uni.navigateBack({
delta: 1, delta: 1,
}); });
} }
}
// function exchange(item) { // function exchange(item) {
// pointGoodsApi.exchange({ // pointGoodsApi.exchange({
// pointsGoodsId: item.id, // pointsGoodsId: item.id,
@@ -92,7 +103,8 @@
} }
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 +144,21 @@
} }
}) })
} }
onLoad((opt) => {
import {
shareMixin,
handleMixinOnLoad
} from '@/utils/share.js'
defineOptions({
mixins: [shareMixin],
});
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 +177,19 @@
query.page++ query.page++
getList(); getList();
}) })
onShow(() => { import {
productStore
} from '@/stores/user.js';
const storeuser = productStore();
onShow(async () => {
if (!storeuser.isHasLogin) {
await handleMixinOnLoad(options)
refresh() refresh()
} else {
refresh()
}
}); });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@@ -163,7 +200,9 @@
flex-direction: column; flex-direction: column;
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;

View File

@@ -1,12 +1,7 @@
<template> <template>
<view class="min-page bg-f7 u-font-28 color-333"> <view class="min-page bg-f7 u-font-28 color-333">
<up-navbar <up-navbar title="兑换成功" bgColor="transparent" leftIconColor="#333" @leftClick="back()"
title="兑换成功" titleStyle="color:#333"></up-navbar>
bgColor="transparent"
leftIconColor="#333"
@leftClick="back()"
titleStyle="color:#333"
></up-navbar>
<view class="content"> <view class="content">
<view class="bg" :style="{ backgroundImage: `url(${imgs.bg})` }"> <view class="bg" :style="{ backgroundImage: `url(${imgs.bg})` }">
<image :src="imgs.success" class="success"></image> <image :src="imgs.success" class="success"></image>
@@ -50,16 +45,22 @@
</template> </template>
<script setup> <script setup>
const imgs = { const imgs = {
bg: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/b625560a5b75418c9e643841f8674a0c.png", bg: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/b625560a5b75418c9e643841f8674a0c.png",
success: success: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/c2f0865efb444de58ff0d8bb3a51d300.png",
"https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/c2f0865efb444de58ff0d8bb3a51d300.png",
}; };
function back() { function back() {
const pages = getCurrentPages();
if(pages.length<2){
uni.redirectTo({
url: '/scoreShop/index/index?shopId=' + item.shopId
})
}else{
uni.navigateBack(); uni.navigateBack();
} }
}
function lookOrder() { function lookOrder() {
uni.redirectTo({ uni.redirectTo({
url: '/scoreShop/order/index?shopId=' + item.shopId url: '/scoreShop/order/index?shopId=' + item.shopId
@@ -80,6 +81,7 @@ onLoad(opt=>{
background: linear-gradient(180deg, #f5cd82 0%, rgba(247, 219, 165, 0) 100%); background: linear-gradient(180deg, #f5cd82 0%, rgba(247, 219, 165, 0) 100%);
height: 670rpx; height: 670rpx;
$color: #9c571f; $color: #9c571f;
.bg { .bg {
width: 100%; width: 100%;
height: 586rpx; height: 586rpx;
@@ -96,11 +98,13 @@ onLoad(opt=>{
height: 206rpx; height: 206rpx;
} }
} }
.info { .info {
padding-left: 174rpx; padding-left: 174rpx;
padding-right: 32rpx; padding-right: 32rpx;
} }
} }
.bottom { .bottom {
gap: 48rpx; gap: 48rpx;
margin-top: 44rpx; margin-top: 44rpx;
@@ -110,10 +114,12 @@ onLoad(opt=>{
border-radius: 100rpx; border-radius: 100rpx;
font-size: 32rpx; font-size: 32rpx;
border: 1px solid transparent; border: 1px solid transparent;
&.back { &.back {
border-color: $my-main-color; border-color: $my-main-color;
color: $my-main-color; color: $my-main-color;
} }
&.look { &.look {
background-color: $my-main-color; background-color: $my-main-color;
border-color: $my-main-color; border-color: $my-main-color;

View File

@@ -40,6 +40,9 @@ export const useCartsStore = defineStore("cart", () => {
//用户信息 //用户信息
const shopUserInfo = ref(uni.cache.get("shopUserInfo") || {}); const shopUserInfo = ref(uni.cache.get("shopUserInfo") || {});
//全部的商品列表
const allGoodsArr=ref([])
const consumeDiscount = ref({}); const consumeDiscount = ref({});
// 适配工具库 BaseCartItem 接口的商品数据转换函数 // 适配工具库 BaseCartItem 接口的商品数据转换函数
@@ -326,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",
@@ -496,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;
}); });
@@ -754,6 +761,6 @@ export const useCartsStore = defineStore("cart", () => {
//限时折扣 //限时折扣
limitTimeDiscount, limitTimeDiscount,
shopUserInfo, shopUserInfo,
socketSendMsg, socketSendMsg,allGoodsArr
}; };
}); });

View File

@@ -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

View File

@@ -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("获取经纬度");
@@ -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();
if(res&& typeof res === 'object'){
this.shopUserInfo=res;
uni.cache.set("shopUserInfo", res); uni.cache.set("shopUserInfo", res);
uni.cache.set("orderVIP", res); uni.cache.set("orderVIP", res);
uni.cache.set("ordershopUserInfo", res.shopInfo); uni.cache.set("ordershopUserInfo", res.shopInfo);
resolve(res); 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) => {

View File

@@ -28,11 +28,11 @@
<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>
@@ -45,7 +45,7 @@
<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">
@@ -54,26 +54,21 @@
</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">
@@ -82,35 +77,27 @@
<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">
@@ -125,64 +112,37 @@
</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>
<view v-if="item.otherDesc">
2其他使用说明{{item.otherDesc}}
</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" :src="item"></image>
</image>
</view> </view>
</view> </view>
@@ -194,14 +154,9 @@
<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">
@@ -224,7 +179,6 @@
</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">
@@ -237,7 +191,6 @@
<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">
@@ -249,79 +202,66 @@
</view> </view>
</template> </template>
<script setup> <script setup>
import { import { shareMixin, handleMixinOnLoad, returnQuery } from '@/utils/share.js';
Storelogin import { Storelogin } from '@/stores/user.js';
} from '@/stores/user.js';
const storelogin = Storelogin(); const storelogin = Storelogin();
import { import { computed, reactive, watch } from 'vue';
computed, import dayjs from 'dayjs';
reactive, import { wxShare } from '@/utils/share.js';
watch import { getOpenId } from '@/utils/uniapp.js';
} from "vue"; import modal from '@/groupBuying/components/modal.vue';
import dayjs from "dayjs"; import * as Api from '@/common/api/market/package.js';
import { import { pay } from '@/utils/pay.js';
wxShare
} from '@/utils/share.js'
import {
getOpenId
} from '@/utils/uniapp.js'
import modal from "@/groupBuying/components/modal.vue";
import * as Api from '@/common/api/market/package.js'
import {
pay
} 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 } from 'bignumber.js';
BigNumber
} 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,69 +270,67 @@
}); });
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(
() => popupData.show,
(newval) => {
if (!newval) { if (!newval) {
popupData.item = null popupData.item = null;
} }
}) }
);
function dingyue() { function dingyue() {
return new Promise((revlove, reject) => { return new Promise((revlove, reject) => {
uni.requestSubscribeMessage({ uni.requestSubscribeMessage({
tmplIds: ['JGPAGmqcPEgWB6mvAl0SC5cMqr5H5Qjcim8JCpHAZd0', tmplIds: ['JGPAGmqcPEgWB6mvAl0SC5cMqr5H5Qjcim8JCpHAZd0', 'F4OyUhe_ZQ9BR731jlkaN2QXAUaA3HBZuUeVPfraSz0'],
'F4OyUhe_ZQ9BR731jlkaN2QXAUaA3HBZuUeVPfraSz0'
],
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 +338,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 +407,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 +461,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 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 +549,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 +572,6 @@
} }
} }
.desc { .desc {
padding: 32rpx 28rpx; padding: 32rpx 28rpx;
background-color: #fff; background-color: #fff;
@@ -653,7 +585,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 +598,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 +626,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 +685,6 @@
color: #666; color: #666;
line-height: 42rpx; line-height: 42rpx;
} }
} }
.bottom { .bottom {
@@ -790,7 +721,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 +734,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 +749,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 +787,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 +796,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 +810,6 @@
} }
.guodu { .guodu {
transition: all .3s; transition: all 0.3s;
} }
</style> </style>

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,15 @@
import {
autoBindInviteUser,
autoGetInviteCode
} from '@/common/api/market/distribution.js'
import {
APIshopUserInfo,
APIusershopInfodetail
} from '@/common/api/member.js'
import {
productStore
} from '@/stores/user.js';
const accountStore = productStore();
const accountInfo = wx.getAccountInfoSync(); const accountInfo = wx.getAccountInfoSync();
export const envVersion = accountInfo.miniProgram.envVersion; export const envVersion = accountInfo.miniProgram.envVersion;
let type = 3; let type = 3;
@@ -13,9 +25,312 @@ if (envVersion === 'trial') {
} }
/**
* 绑定用户邀请关系(核心函数)
* 功能说明:校验邀请码有效性,有效则调用自动绑定接口完成邀请关系绑定
* @param {Object} args - 绑定邀请关系的入参对象
* @param {number} [args.shopUserId] - 需要绑定邀请人的用户IDinteger <int64>,可选)
* @param {number} [args.shopId] - 店铺IDinteger <int64>,可选)
* @param {string} args.inviteCode - 邀请人的邀请码(必填,非空校验通过后才会执行绑定逻辑)
* @returns {void} 无返回值
*/
export function bindInvite(args) {
// 解构入参对象,获取需要的核心参数
const {
shopUserId,
shopId,
inviteCode
} = args;
// 校验邀请码有效性若邀请码为空、null、undefined则直接返回不执行后续绑定逻辑
if (!inviteCode || inviteCode === null || inviteCode === undefined) {
return;
}
// 邀请码有效,调用自动绑定邀请人接口,传递绑定所需参数
autoBindInviteUser({
id: shopUserId,
shopId,
inviteCode
});
}
export function wxShare(par) { export function wxShare(par) {
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,
shopUserId: shopUserInfo.id
})
const queryJson = {
inviteCode: (inviteCode && inviteCode !== true) ? inviteCode : null,
shopId,
shopUserId: 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,
shopUserId: 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,
shopUserId: 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.shopUserId = 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)
// const shopId = uni.cache.get('shopId')
// const shopUserInfo = uni.cache.get('shopUserInfo')
// const shopInfo = uni.cache.get('shopInfo')
// const inviteCode = await autoGetInviteCode({
// shopId: shopId,
// shopUserId: shopUserInfo.id
// })
if (options.inviteCode) {
bindInvite(options)
}
}
// utils/share.js
export const shareMixin = {
// async onLoad(opt) {
// 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)
// }
// const shopId = uni.cache.get('shopId')
// const shopUserInfo = uni.cache.get('shopUserInfo')
// const shopInfo = uni.cache.get('shopInfo')
// const inviteCode = await autoGetInviteCode({
// shopId: shopId,
// shopUserId: shopUserInfo.id
// })
// uni.setStorageSync('loadFinsh',true)
// if (options.inviteCode) {
// bindInvite(options)
// }
// },
async onShareAppMessage(res) {
// const shopId = uni.cache.get('shopId')
// const shopUserInfo = uni.cache.get('shopUserInfo')
const shopInfo = uni.cache.get('shopInfo')
// const inviteCode = await autoGetInviteCode({
// shopId: shopId,
// shopUserId: 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,
// shopUserId: shopUserInfo.id,
// }
// for (const key in currentOptions) {
// if (currentOptions.hasOwnProperty(key)) {
// queryJson[key] = encodeURIComponent(currentOptions[key])
// }
// }
// queryJson.shopId = shopId
// queryJson.inviteCode = (inviteCode && inviteCode !== true) ? inviteCode : null
// queryJson.shopUserId = shopUserInfo.id
const query =await returnQuery()
// 全局默认配置(可被页面覆盖)
const defaultShareConfig = {
title: shopInfo.shopName,
path: sharePath + '?' + query,
imageUrl: shopInfo.logo,
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 shopId = uni.cache.get('shopId')
// const shopUserInfo = uni.cache.get('shopUserInfo')
const shopInfo = uni.cache.get('shopInfo')
// const inviteCode = await autoGetInviteCode({
// shopId: shopId,
// shopUserId: 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,
// shopUserId: shopUserInfo.id,
// }
// for (const key in currentOptions) {
// if (currentOptions.hasOwnProperty(key)) {
// queryJson[key] = encodeURIComponent(currentOptions[key])
// }
// }
// queryJson.shopId = shopId
// queryJson.inviteCode = (inviteCode && inviteCode !== true) ? inviteCode : null
// queryJson.shopUserId = shopUserInfo.id
const query = await returnQuery()
const defaultTimelineConfig = {
title: shopInfo.shopName,
path: sharePath + '?' + query,
imageUrl: shopInfo.logo,
query,
};
const pageTimelineConfig = this.$options.shareTimelineConfig || {};
return wxShare({
...defaultTimelineConfig,
...pageTimelineConfig
});
}
};