点餐页增加轮播图点击图片进入具体页面,点击分享正常分享,在对应的页面增加分享弹窗组件
This commit is contained in:
@@ -164,3 +164,12 @@ export const autoBindInviteUser = (data) => {
|
||||
data: data,
|
||||
});
|
||||
};
|
||||
|
||||
// 全民股东界面-进入过标识
|
||||
export const distributionEditIn = (data) => {
|
||||
return request({
|
||||
url: prveUrl + "/user/distribution/editIn",
|
||||
method: "get",
|
||||
data: data,
|
||||
});
|
||||
};
|
||||
26
common/api/market/share.js
Normal file
26
common/api/market/share.js
Normal file
@@ -0,0 +1,26 @@
|
||||
// 引入 request 文件
|
||||
import request from "@/common/api/request.js";
|
||||
import { prveUrl } from "./config.js";
|
||||
|
||||
export const carousel = (data) => {
|
||||
return request({
|
||||
url: prveUrl + "/user/carousel",
|
||||
method: "get",
|
||||
data: data,
|
||||
});
|
||||
};
|
||||
export const shareClaim = (data) => {
|
||||
return request({
|
||||
url: prveUrl + "/user/shareClaim",
|
||||
method: "POST",
|
||||
data: data,
|
||||
});
|
||||
};
|
||||
export const shareConfig = (data) => {
|
||||
return request({
|
||||
url: prveUrl + "/user/share",
|
||||
method: "get",
|
||||
data: data,
|
||||
});
|
||||
};
|
||||
|
||||
141
components/popup-distribution-group-code.vue
Normal file
141
components/popup-distribution-group-code.vue
Normal file
@@ -0,0 +1,141 @@
|
||||
<!-- 私域引流 -->
|
||||
<template>
|
||||
<u-popup :show="show" mode="center" :safeAreaInsetBottom="false">
|
||||
<view class="new_preview">
|
||||
<view class="header">{{ shopInfo.shopName }}</view>
|
||||
<view class="content">
|
||||
<view class="title">{{ group.title }}</view>
|
||||
<view class="img_wrap">
|
||||
<image class="img" :show-menu-by-longpress="true" :src="group.groupUrl" @click=""></image>
|
||||
</view>
|
||||
<view class="intro">
|
||||
{{ group.content }}
|
||||
</view>
|
||||
<view class="foot">
|
||||
如果长按不能识别,可截图或保存二维码图片至相册,通过微信扫码入群。
|
||||
</view>
|
||||
</view>
|
||||
<view class="close" @click="closeHandle">
|
||||
<u-icon name="close" color="#fff" size="14"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import dayjs from 'dayjs';
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { centerConfig,distributionEditIn } from '@/common/api/market/distribution.js';
|
||||
import { checkArrayElementsExist } from '@/utils/util.js';
|
||||
|
||||
const shopInfo = ref('');
|
||||
|
||||
const props = defineProps({
|
||||
type: {
|
||||
type: String,
|
||||
default: 'home' // 调用的位置 home首页 order支付成功后
|
||||
},
|
||||
group:{
|
||||
type:Object,
|
||||
default:()=>{}
|
||||
}
|
||||
});
|
||||
|
||||
const show = defineModel(false) ;
|
||||
function closeHandle() {
|
||||
const shopUserInfo=uni.cache.get('shopUserInfo')
|
||||
distributionEditIn({
|
||||
shopUserId:shopUserInfo.id
|
||||
})
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
shopInfo.value = uni.cache.get('shopInfo');
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.new_preview {
|
||||
--bg: #3f3b37;
|
||||
--color: #f6dfc4;
|
||||
--borderColor: #f6dfc45b;
|
||||
width: 90vw;
|
||||
background-color: var(--bg);
|
||||
border-radius: 4px;
|
||||
position: relative;
|
||||
.close {
|
||||
--size: 70upx;
|
||||
width: var(--size);
|
||||
height: var(--size);
|
||||
border-radius: 50%;
|
||||
background-color: var(--bg);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
bottom: calc(var(--size) * -1 - 20upx);
|
||||
left: 50%;
|
||||
margin-left: calc(var(--size) / 2 * -1);
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 16px;
|
||||
color: var(--color);
|
||||
height: 50px;
|
||||
border-bottom: 1px dashed var(--borderColor);
|
||||
}
|
||||
|
||||
.content {
|
||||
padding-bottom: 14px;
|
||||
|
||||
.title {
|
||||
font-size: 14px;
|
||||
color: var(--color);
|
||||
height: 50px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.img_wrap {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
.img {
|
||||
--size: 220px;
|
||||
width: var(--size);
|
||||
height: var(--size);
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.intro {
|
||||
height: 40px;
|
||||
font-size: 14px;
|
||||
color: var(--color);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 14px;
|
||||
}
|
||||
|
||||
.foot {
|
||||
height: 40px;
|
||||
color: var(--borderColor);
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 14px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
220
components/ymf-components/ymf-share-popup.vue
Normal file
220
components/ymf-components/ymf-share-popup.vue
Normal file
@@ -0,0 +1,220 @@
|
||||
<template>
|
||||
<view class="ynf-share">
|
||||
<up-popup :show="show" mode="center" bg-color="transparent">
|
||||
<view >
|
||||
<view class="bg" v-if="config.sharerCoupon" :style="returnBg('bg')">
|
||||
<view class="title">邀请奖励</view>
|
||||
<view class="desc">邀请1人,即可得超值优惠券{{config.sharerCouponNum}}张</view>
|
||||
<view class="u-flex u-row-center">
|
||||
<view class="coupon" :style="returnBg('coupon')">
|
||||
<template v-if="config.sharerCoupon.couponType==1">
|
||||
<view class="font-bold text-center color">
|
||||
<text class="fuhao">¥</text>
|
||||
<text>{{config.sharerCoupon.fullAmount}}-{{config.sharerCoupon.discountAmount}}</text>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="config.sharerCoupon.couponType==2">
|
||||
<view class="font-bold text-center color">
|
||||
<text>{{config.sharerCoupon.discountNum}}件</text>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="config.sharerCoupon.couponType==3">
|
||||
<view class="font-bold text-center color">
|
||||
<text>{{config.sharerCoupon.discountRate/10}}折</text>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="config.sharerCoupon.couponType==3">
|
||||
<view class="font-bold text-center color">
|
||||
<text>{{config.sharerCoupon.discountRate/10}}折</text>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="config.sharerCoupon.couponType==4">
|
||||
<view class="font-bold text-center color">
|
||||
<text>第二件半价</text>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="config.sharerCoupon.couponType==6">
|
||||
<view class="font-bold text-center color">
|
||||
<text>买一送一</text>
|
||||
</view>
|
||||
</template>
|
||||
<view class="font-bold name">{{config.sharerCoupon.title}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-center u-m-t-44">
|
||||
<ymf-share>
|
||||
<view class="share-btn" :style="returnBg('btn')"></view>
|
||||
</ymf-share>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-center u-m-t-30">
|
||||
<view class="close-box u-flex u-col-center u-row-center" @click="close">
|
||||
<up-icon name="close" size="36rpx" color="#000" :bold="true"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
import {
|
||||
shareConfig,
|
||||
} from '@/common/api/market/share.js'
|
||||
import {returnPageTags} from '@/utils/share.js'
|
||||
|
||||
import {
|
||||
productStore
|
||||
} from '@/stores/user.js';
|
||||
|
||||
const userStore = productStore();
|
||||
|
||||
|
||||
const show = defineModel(false)
|
||||
const imgs = {
|
||||
btn: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/14ca8d88516b4739b4020b10d95a33c2.png',
|
||||
coupon: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/4ccffb7cf8414cd19f0a10c6cf45b45b.png',
|
||||
bg: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/1ac6490c4efd4290abe7ca7f6d8e6eb2.png'
|
||||
}
|
||||
|
||||
function returnBg(key) {
|
||||
return {
|
||||
backgroundImage: 'url(' + imgs[key] + ')'
|
||||
}
|
||||
}
|
||||
// watch(() => show.value, (newval)=>{
|
||||
// if(newval){
|
||||
// getData()
|
||||
// }
|
||||
// })
|
||||
|
||||
function close() {
|
||||
show.value = false
|
||||
}
|
||||
const config = reactive({})
|
||||
async function getData(id) {
|
||||
const shopId = id||uni.cache.get('shopId')
|
||||
if (!shopId) {
|
||||
return
|
||||
}
|
||||
shareConfig({
|
||||
shopId
|
||||
}).then(res => {
|
||||
if(res){
|
||||
Object.assign(config,res)
|
||||
if(res.sharedUserCouponId&&res.sharedUserCouponNum&&res.isSharedUserPopup){
|
||||
const pages = getCurrentPages();
|
||||
const currentPage = pages[pages.length - 1];
|
||||
const currentPath = currentPage.route;
|
||||
const currentOptions = currentPage.options;
|
||||
const path = `/${currentPath}`;
|
||||
|
||||
const pTag = returnPageTags(path)
|
||||
if(pTag&¤tOptions.fromUserId){
|
||||
show.value=true
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
watch(()=>userStore.shopInfo.id,(newval)=>{
|
||||
if(newval){
|
||||
shareConfig({
|
||||
shopId:newval
|
||||
}).then(res => {
|
||||
if(res){
|
||||
Object.assign(config,res)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
onMounted(() => {
|
||||
console.log('分享组件挂载完毕!');
|
||||
getData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.bg {
|
||||
width: 710rpx;
|
||||
background-size: cover;
|
||||
min-height: 820rpx;
|
||||
padding-top: 260rpx;
|
||||
background-color: transparent;
|
||||
padding-left: 26rpx;
|
||||
|
||||
.title {
|
||||
font-weight: 700;
|
||||
font-size: 74rpx;
|
||||
text-align: center;
|
||||
background-image: linear-gradient(to bottom, #FF7E2D, #FF270E);
|
||||
/* 定义渐变色 */
|
||||
-webkit-background-clip: text;
|
||||
/* Webkit 浏览器前缀 */
|
||||
background-clip: text;
|
||||
/* 标准属性 */
|
||||
color: transparent;
|
||||
/* 使文本透明,显示背景渐变 */
|
||||
}
|
||||
|
||||
.desc {
|
||||
margin-top: 20rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
text-align: center;
|
||||
color: #FF280F;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.coupon {
|
||||
margin-top: 30rpx;
|
||||
width: 436rpx;
|
||||
height: 182rpx;
|
||||
background-size: cover;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 54rpx;
|
||||
text-align: center;
|
||||
|
||||
|
||||
.color {
|
||||
background-image: linear-gradient(to bottom, #FFFFFB, #FFEBB0);
|
||||
/* 定义渐变色 */
|
||||
-webkit-background-clip: text;
|
||||
/* Webkit 浏览器前缀 */
|
||||
background-clip: text;
|
||||
/* 标准属性 */
|
||||
color: transparent;
|
||||
/* 使文本透明,显示背景渐变 */
|
||||
}
|
||||
|
||||
.fuhao {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.name {
|
||||
font-size: 36rpx;
|
||||
color: #FFFFFB;
|
||||
}
|
||||
}
|
||||
|
||||
.close-box {
|
||||
width: 74rpx;
|
||||
height: 74rpx;
|
||||
opacity: 0.82;
|
||||
border-radius: 50%;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.share-btn {
|
||||
width: 262rpx;
|
||||
height: 72rpx;
|
||||
background-size: cover;
|
||||
}
|
||||
</style>
|
||||
@@ -3,7 +3,7 @@
|
||||
<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>
|
||||
<button open-type="share" @click.stop="shareClick">分享</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -123,6 +123,9 @@
|
||||
</view>
|
||||
</up-popup>
|
||||
<!-- 兑换确认弹窗end -->
|
||||
|
||||
|
||||
<ymf-share-popup ></ymf-share-popup>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
@@ -408,7 +411,7 @@ onShareAppMessage(async () => {
|
||||
query
|
||||
};
|
||||
console.log('onShareAppMessage===', options);
|
||||
return options;
|
||||
return wxShare(options);
|
||||
});
|
||||
|
||||
onLoad(async (opt) => {
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
</view>
|
||||
|
||||
<LookQrcode v-model="modalData.show" :qrcode="qrcode"></LookQrcode>
|
||||
<ymf-share-popup ></ymf-share-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"easycom": {
|
||||
"autoscan": true,
|
||||
"custom": {
|
||||
"^my-(.*)": "@/components/ymf-components/ymf-$1.vue",
|
||||
"^ymf-(.*)": "@/components/ymf-components/ymf-$1.vue",
|
||||
"^u--(.*)": "@/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"
|
||||
|
||||
@@ -130,6 +130,7 @@
|
||||
<!-- <CouponModal></CouponModal> -->
|
||||
<!-- 页面加载动画 -->
|
||||
<pageLoading v-if="showPageLoading" />
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
</view>
|
||||
<view class="item" @click="toFenxiao">
|
||||
<image :src="imgs.share" class="img"></image>
|
||||
<view class="title">股东共享</view>
|
||||
<view class="title">全民股东</view>
|
||||
<view class="desc">邀请好友,获得佣金</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -116,6 +116,8 @@
|
||||
</u-popup>
|
||||
<!-- 私域引流弹窗 -->
|
||||
<attractPopup type="home" ref="attractPopupRef" />
|
||||
|
||||
<ymf-share-popup ></ymf-share-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -192,6 +192,29 @@
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="main">
|
||||
<view class="u-p-r-32">
|
||||
<up-swiper indicator indicatorMode="line" height="188rpx" :list="carouselList"
|
||||
keyName="imageUrl">
|
||||
<template #default="scope">
|
||||
<view class="relative">
|
||||
<image :src="scope.item.imageUrl" mode="aspectFill"
|
||||
style="width:600rpx;height: 188rpx;"></image>
|
||||
<view class="absolute swiper-mask" @click.stop="swiperClick(scope.item)">
|
||||
<view class="share-btn-box" v-if="showShare(scope.item)">
|
||||
<ymf-share
|
||||
@shareClick="shareBtnClick(scope.item)"
|
||||
>
|
||||
<view class="share-btn">分享</view>
|
||||
</ymf-share>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
</up-swiper>
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<view class="item main-item" v-for="(item, index) in shopProductList.productInfo" :key="index"
|
||||
:id="'item-' + index">
|
||||
@@ -616,6 +639,8 @@
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
|
||||
<ymf-share-popup ></ymf-share-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -649,6 +674,11 @@
|
||||
import {
|
||||
APIproductqueryShop
|
||||
} from '@/common/api/member.js';
|
||||
|
||||
|
||||
import {
|
||||
carousel
|
||||
} from '@/common/api/market/share.js'
|
||||
/**
|
||||
* api合集 end
|
||||
*/
|
||||
@@ -990,6 +1020,79 @@
|
||||
uni.$u.debounce(mainScroll(res), 500);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
/*商品区域轮播图 start*/
|
||||
|
||||
const shareSwiperItem=ref(null)
|
||||
function swiperClick(item) {
|
||||
console.log('swiperClick',item);
|
||||
shareSwiperItem.value=item
|
||||
const pTag=returnPageTags(item.jumpPagePath)
|
||||
|
||||
if(pTag==='pp-list'){
|
||||
return uni.navigateTo({
|
||||
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
|
||||
})
|
||||
}
|
||||
if(pTag==='pp-detail'){
|
||||
const url=item.jumpPagePath+'&shopId='+uni.cache.get('shopId')+'&'+item.extendParam
|
||||
return uni.navigateTo({
|
||||
url:url.replace('goodsId','id')
|
||||
})
|
||||
}
|
||||
if(pTag==='gb-list'){
|
||||
return uni.navigateTo({
|
||||
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
|
||||
})
|
||||
}
|
||||
if(pTag==='gb-detail'){
|
||||
const url=item.jumpPagePath+'&shopId='+uni.cache.get('shopId')+'&'+item.extendParam
|
||||
return uni.navigateTo({
|
||||
url:url.replace('goodsId','wareId')
|
||||
})
|
||||
}
|
||||
if(pTag==='dis'){
|
||||
return uni.navigateTo({
|
||||
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
|
||||
})
|
||||
}
|
||||
if(pTag==='index'){
|
||||
return uni.switchTab({
|
||||
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
|
||||
})
|
||||
}
|
||||
|
||||
if(pTag==='eat'){
|
||||
if (item.extendParam) {
|
||||
const id=item.extendParam.split('=')[1]
|
||||
const item = allGoodsArr.value.find(v => v.id == id)
|
||||
if (item) {
|
||||
clickspecifications(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(pTag==='point'){
|
||||
return uni.navigateTo({
|
||||
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
|
||||
})
|
||||
}
|
||||
if(pTag==='point-detail'){
|
||||
const url=item.jumpPagePath+'&shopId='+uni.cache.get('shopId')+'&'+item.extendParam
|
||||
return uni.navigateTo({
|
||||
url:url.replace('goodsId','id')
|
||||
})
|
||||
}
|
||||
}
|
||||
function showShare(item){
|
||||
if(item.isShareable&&item.isEnabled){
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
/*商品区域轮播图 end*/
|
||||
// 点击详情
|
||||
const showShopsku = ref(false);
|
||||
|
||||
@@ -1450,6 +1553,9 @@
|
||||
};
|
||||
// 判断商品是否在可售时间内
|
||||
const isProductAvailable = async (sellDaysStr, startTimeStr, endTimeStr) => {
|
||||
if(!sellDaysStr){
|
||||
return false
|
||||
}
|
||||
// 将后端返回的字符串转换为数组
|
||||
const sellDays = sellDaysStr.split(',');
|
||||
const now = dayjs();
|
||||
@@ -2456,7 +2562,7 @@
|
||||
handleMixinOnLoad,
|
||||
returnQuery,
|
||||
jsonToUrl,
|
||||
wxShare,
|
||||
wxShare,returnPageTags,
|
||||
returnCommonQuery
|
||||
} from '@/utils/share.js'
|
||||
// defineOptions({
|
||||
@@ -2470,8 +2576,46 @@
|
||||
isGoodsShare.value = true
|
||||
}
|
||||
|
||||
function getPage(pageStr){
|
||||
|
||||
}
|
||||
function shareBtnClick(item){
|
||||
console.log('shareBtnClick',item);
|
||||
shareSwiperItem.value=item
|
||||
}
|
||||
function swiperShare(queryJson){
|
||||
console.log('shareSwiperItem',shareSwiperItem.value);
|
||||
const pTag=returnPageTags(shareSwiperItem.value.jumpPagePath)
|
||||
let query = jsonToUrl(queryJson)
|
||||
query +=('&'+shareSwiperItem.value.extendParam)
|
||||
const json={
|
||||
imageUrl:shareSwiperItem.value.imageUrl,
|
||||
path: shareSwiperItem.value.jumpPagePath+'&'+query,
|
||||
title:shareSwiperItem.value.name,
|
||||
}
|
||||
if(pTag==='pp-detail'){
|
||||
json.path=json.path.replace('goodsId','id')
|
||||
}
|
||||
if(pTag==='gb-detail'){
|
||||
json.path=json.path.replace('goodsId','wareId')
|
||||
}
|
||||
if(pTag==='point-detail'){
|
||||
json.path=json.path.replace('goodsId','id')
|
||||
}
|
||||
if(pTag.includes('eat')){
|
||||
if(shareSwiperItem.value.extendParam){
|
||||
json.path=json.path.replace('goodsId','showGoodsId')
|
||||
}
|
||||
}
|
||||
return wxShare(json)
|
||||
}
|
||||
|
||||
|
||||
async function onShare() {
|
||||
const queryJson = await returnCommonQuery()
|
||||
if(shareSwiperItem.value){
|
||||
return swiperShare(queryJson)
|
||||
}
|
||||
let query = jsonToUrl(queryJson)
|
||||
query += '&type=beforehand'
|
||||
let json = {}
|
||||
@@ -2486,11 +2630,7 @@
|
||||
json.title = shopName
|
||||
json.imageUrl = uni.cache.get('shopInfo').logo || ''
|
||||
}
|
||||
console.log('onShareAppMessage', {
|
||||
query,
|
||||
...json,
|
||||
path: '/pages/product/index' + '?' + query
|
||||
});
|
||||
|
||||
return wxShare({
|
||||
query,
|
||||
...json,
|
||||
@@ -2503,6 +2643,8 @@
|
||||
onShareTimeline(onShare)
|
||||
|
||||
const pageOptions = reactive({})
|
||||
|
||||
const carouselList = ref([])
|
||||
onLoad(async (e) => {
|
||||
Object.assign(pageOptions, e)
|
||||
if (e.type) {
|
||||
@@ -2514,8 +2656,9 @@
|
||||
shopId: e.shopId || uni.cache.get('shopId')
|
||||
})
|
||||
|
||||
if(userStore.shopUserInfo.shopExtendList){
|
||||
shopExtend.value=userStore.shopUserInfo.shopExtendList.find(v=>v.autoKey=='shopinfo_bg')||''
|
||||
if (userStore.shopUserInfo.shopExtendList) {
|
||||
shopExtend.value = userStore.shopUserInfo.shopExtendList.find(v => v.autoKey == 'shopinfo_bg') ||
|
||||
''
|
||||
}
|
||||
|
||||
// //获取用户信息
|
||||
@@ -2566,6 +2709,13 @@
|
||||
// 满减活动
|
||||
getDiscountActivity();
|
||||
|
||||
//分享轮播
|
||||
carousel({
|
||||
shopId: uni.cache.get('shopId')
|
||||
}).then(res => {
|
||||
carouselList.value = res
|
||||
})
|
||||
|
||||
let res = await APIhistoryOrder({
|
||||
tableCode: uni.cache.get('tableCode')
|
||||
});
|
||||
@@ -2671,6 +2821,7 @@
|
||||
}
|
||||
onHide(() => {
|
||||
isGoodsShare.value = false
|
||||
shareSwiperItem.value=null
|
||||
closeSocket();
|
||||
});
|
||||
onUnload(() => {
|
||||
@@ -3911,4 +4062,26 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.swiper-mask {
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
padding: 32rpx 28rpx;
|
||||
}
|
||||
|
||||
.share-btn-box{
|
||||
position: absolute;
|
||||
right: 8rpx;
|
||||
bottom: 14rpx;
|
||||
}
|
||||
.share-btn {
|
||||
|
||||
padding: 10rpx 32rpx;
|
||||
border-radius: 50rpx;
|
||||
background: #E3AD7F;
|
||||
font-size: 24rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
@@ -116,6 +116,8 @@
|
||||
</view>
|
||||
</up-popup>
|
||||
<!-- 兑换确认弹窗end -->
|
||||
|
||||
<ymf-share-popup ></ymf-share-popup>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
|
||||
@@ -45,6 +45,8 @@
|
||||
<up-loadmore :status="isEnd?'nomore':'loadmore'"></up-loadmore>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<ymf-share-popup ></ymf-share-popup>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -167,6 +167,7 @@
|
||||
|
||||
|
||||
<LookQrcode v-model="modalData.show" :qrcode="qrcode"></LookQrcode>
|
||||
<ymf-share-popup ></ymf-share-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -513,9 +514,9 @@
|
||||
})
|
||||
})
|
||||
|
||||
onLoad(() => {
|
||||
onLoad((opt) => {
|
||||
APIusershopInfodetail({
|
||||
shopId: uni.cache.get('shopId')
|
||||
shopId: uni.cache.get('shopId')||opt.shopId
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
shopInfo.value = res.shopInfo
|
||||
|
||||
@@ -538,7 +538,7 @@ onShareAppMessage(async () => {
|
||||
query
|
||||
};
|
||||
console.log('onShareAppMessage===', options);
|
||||
return options;
|
||||
return wxShare(options);
|
||||
});
|
||||
|
||||
onLoad(async (opt) => {
|
||||
|
||||
148
utils/share.js
148
utils/share.js
@@ -2,6 +2,10 @@ import {
|
||||
autoBindInviteUser,
|
||||
autoGetInviteCode
|
||||
} from '@/common/api/market/distribution.js'
|
||||
|
||||
import {
|
||||
shareClaim
|
||||
} from '@/common/api/market/share.js'
|
||||
import {
|
||||
APIshopUserInfo,
|
||||
APIusershopInfodetail
|
||||
@@ -10,8 +14,17 @@ import {
|
||||
productStore
|
||||
} from '@/stores/user.js';
|
||||
const accountStore = productStore();
|
||||
// #ifdef MP-WEIXIN
|
||||
const accountInfo = wx.getAccountInfoSync();
|
||||
export const envVersion = accountInfo.miniProgram.envVersion;
|
||||
// #endif
|
||||
|
||||
// #ifdef H5
|
||||
const accountInfo = {};
|
||||
export const envVersion = 'release'
|
||||
// #endif
|
||||
|
||||
|
||||
let type = 3;
|
||||
if (envVersion === 'trial') {
|
||||
console.log('当前环境是体验版');
|
||||
@@ -24,39 +37,78 @@ if (envVersion === 'trial') {
|
||||
console.log('当前环境是开发版或其他');
|
||||
}
|
||||
|
||||
export const pageTags = {
|
||||
'/userPackage/index/index': 'pp-list', //套餐推广列表页
|
||||
'/userPackage/goodsDetail/goodsDetail': 'pp-detail', //套餐推广商品详情页
|
||||
'/groupBuying/index/index': 'gb-list', //商品拼团列表页
|
||||
'/groupBuying/goodsDetail/goodsDetail': 'gb-detail', //商品拼团详情页
|
||||
'/distribution/shop-detail/index': 'dis', //全民股东页面
|
||||
'/pages/index/index': 'index', //店铺首页
|
||||
'/pages/product/index': 'eat', //点餐页
|
||||
'/pages/product/index?pTag=eat-detail': 'eat-detail', //点餐商品详情弹窗页
|
||||
'/scoreShop/index/index':'point' ,//积分商品
|
||||
'/scoreShop/detail/index':'point-detail' ,//积分商品详情
|
||||
}
|
||||
|
||||
export function returnPageTags(page) {
|
||||
for (let key in pageTags) {
|
||||
if (page.includes(key)) {
|
||||
if (page.includes('/pages/product/index')) {
|
||||
if (page.includes('showGoodsId=')||page.includes('goodsId=')) {
|
||||
return 'eat-detail'
|
||||
} else {
|
||||
return 'eat'
|
||||
}
|
||||
} else {
|
||||
return pageTags[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
return ''
|
||||
}
|
||||
/**
|
||||
* 绑定用户邀请关系(核心函数)
|
||||
* 功能说明:校验邀请码有效性,有效则调用自动绑定接口完成邀请关系绑定
|
||||
* @param {Object} args - 绑定邀请关系的入参对象
|
||||
* @param {number} [args.shopUserId] - 需要绑定邀请人的用户ID(integer <int64>,可选)
|
||||
* @param {number} [args.shopId] - 店铺ID(integer <int64>,可选)
|
||||
* @param {string} args.inviteCode - 邀请人的邀请码(必填,非空校验通过后才会执行绑定逻辑)
|
||||
* @param {number} args.fromUserId - 需要绑定邀请人的用户ID(integer <int64>,必填)
|
||||
* @param {number} args.shopId - 店铺ID(integer <int64>,必填)
|
||||
* @param {string} args.pTag - 来源页面类型
|
||||
* @returns {void} 无返回值
|
||||
*/
|
||||
export async function bindInvite(args) {
|
||||
// 解构入参对象,获取需要的核心参数
|
||||
const {
|
||||
shopUserId,
|
||||
fromUserId,
|
||||
shopId,
|
||||
inviteCode
|
||||
pTag,
|
||||
} = args;
|
||||
|
||||
// 校验邀请码有效性:若邀请码为空、null、undefined,则直接返回,不执行后续绑定逻辑
|
||||
if (!inviteCode || inviteCode === null || inviteCode === undefined) {
|
||||
console.log('bindInvite',args);
|
||||
if (!fromUserId || !shopId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const shopUserInfo = uni.cache.get('shopUserInfo')
|
||||
// 邀请码有效,调用自动绑定邀请人接口,传递绑定所需参数
|
||||
return await autoBindInviteUser({
|
||||
id: shopUserInfo.id,
|
||||
return await shareClaim({
|
||||
tagType: pTag || '',
|
||||
shopId,
|
||||
inviteCode
|
||||
fromUserId: fromUserId,
|
||||
toUserId: shopUserInfo.id
|
||||
});
|
||||
}
|
||||
|
||||
export function wxShare(par) {
|
||||
const path = par.path
|
||||
const pTag = returnPageTags(path)
|
||||
if (pTag) {
|
||||
par.path += '&pTag=' + pTag
|
||||
par.query += '&pTag=' + pTag
|
||||
}
|
||||
console.log('pTag', pTag);
|
||||
console.log('wxShare', {
|
||||
...par,
|
||||
type
|
||||
});
|
||||
return {
|
||||
...par,
|
||||
type
|
||||
@@ -67,15 +119,15 @@ 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 inviteCode = await autoGetInviteCode({
|
||||
// shopId: shopId,
|
||||
// fromUserId: shopUserInfo.id
|
||||
// })
|
||||
|
||||
const queryJson = {
|
||||
inviteCode: (inviteCode && inviteCode !== true) ? inviteCode : null,
|
||||
// inviteCode: (inviteCode && inviteCode !== true) ? inviteCode : null,
|
||||
shopId,
|
||||
shopUserId: shopUserInfo.id,
|
||||
fromUserId: shopUserInfo.id,
|
||||
}
|
||||
return Promise.resolve(queryJson)
|
||||
}
|
||||
@@ -104,10 +156,10 @@ 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 inviteCode = await autoGetInviteCode({
|
||||
// shopId: shopId,
|
||||
// fromUserId: shopUserInfo.id
|
||||
// })
|
||||
|
||||
const pages = getCurrentPages();
|
||||
const currentPage = pages[pages.length - 1];
|
||||
@@ -117,9 +169,9 @@ export async function returnQuery(query, showkeys) {
|
||||
|
||||
let sharePath = `/${currentPath}`;
|
||||
const queryJson = {
|
||||
inviteCode: (inviteCode && inviteCode !== true) ? inviteCode : null,
|
||||
// inviteCode: (inviteCode && inviteCode !== true) ? inviteCode : null,
|
||||
shopId,
|
||||
shopUserId: shopUserInfo.id,
|
||||
fromUserId: shopUserInfo.id,
|
||||
...query
|
||||
}
|
||||
for (const key in currentOptions) {
|
||||
@@ -132,8 +184,8 @@ export async function returnQuery(query, showkeys) {
|
||||
}
|
||||
}
|
||||
queryJson.shopId = shopId
|
||||
queryJson.inviteCode = (inviteCode && inviteCode !== true) ? inviteCode : null
|
||||
queryJson.shopUserId = shopUserInfo.id
|
||||
// queryJson.inviteCode = (inviteCode && inviteCode !== true) ? inviteCode : null
|
||||
queryJson.fromUserId = shopUserInfo.id
|
||||
|
||||
let result = ''
|
||||
for (let key in queryJson) {
|
||||
@@ -178,14 +230,8 @@ export async function handleMixinOnLoad(opt, vm) {
|
||||
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) {
|
||||
|
||||
if (options.shopId) {
|
||||
return await bindInvite(options)
|
||||
}
|
||||
}
|
||||
@@ -220,36 +266,7 @@ export function returnIndexBg() {
|
||||
// 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 shopInfo = uni.cache.get('shopInfo')
|
||||
@@ -261,10 +278,11 @@ export const shareMixin = {
|
||||
let sharePath = `/${currentPath}`;
|
||||
|
||||
|
||||
const query = await returnQuery()
|
||||
let query = await returnQuery()
|
||||
const indexBg = returnIndexBg()
|
||||
console.log('indexBg', indexBg);
|
||||
const imageUrl = indexBg || shopInfo.logo
|
||||
|
||||
// 全局默认配置(可被页面覆盖)
|
||||
const defaultShareConfig = {
|
||||
title: shopInfo.shopName,
|
||||
@@ -311,9 +329,11 @@ export const shareMixin = {
|
||||
let sharePath = `/${currentPath}`;
|
||||
|
||||
|
||||
const query = await returnQuery()
|
||||
let query = await returnQuery()
|
||||
const indexBg = returnIndexBg()
|
||||
const imageUrl = indexBg || shopInfo.logo
|
||||
|
||||
|
||||
const defaultTimelineConfig = {
|
||||
title: shopInfo.shopName,
|
||||
path: sharePath + '?' + query,
|
||||
|
||||
Reference in New Issue
Block a user