点餐页增加轮播图点击图片进入具体页面,点击分享正常分享,在对应的页面增加分享弹窗组件

This commit is contained in:
2026-01-28 18:09:47 +08:00
parent 93d3f9196c
commit 37fe706d6a
19 changed files with 1913 additions and 1227 deletions

View File

@@ -1,3 +1,4 @@
<script setup> <script setup>
import { import {
useCartsStore useCartsStore

View File

@@ -164,3 +164,12 @@ export const autoBindInviteUser = (data) => {
data: data, data: data,
}); });
}; };
// 全民股东界面-进入过标识
export const distributionEditIn = (data) => {
return request({
url: prveUrl + "/user/distribution/editIn",
method: "get",
data: data,
});
};

View 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,
});
};

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

View 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&&currentOptions.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>

View File

@@ -3,7 +3,7 @@
<slot v-if="$slots.default" name="default"></slot> <slot v-if="$slots.default" name="default"></slot>
<up-icon v-else name="share-square" bold :color="color" :size="size"></up-icon> <up-icon v-else name="share-square" bold :color="color" :size="size"></up-icon>
<view class="absolute share-box"> <view class="absolute share-box">
<button open-type="share" @click="shareClick">分享</button> <button open-type="share" @click.stop="shareClick">分享</button>
</view> </view>
</view> </view>
</template> </template>

View File

@@ -26,12 +26,15 @@
<text class="color-333 font-700 u-m-r-6" v-if="state.distributionUser"> <text class="color-333 font-700 u-m-r-6" v-if="state.distributionUser">
{{ state.distributionUser.level }} {{ state.distributionUser.levelName }} {{ state.distributionUser.level }} {{ state.distributionUser.levelName }}
</text> </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 class="u-m-t-28 u-flex align-center" v-if="juNextLvMoney && state.distributionUser && state.distributionUser.isAssignLevel == 0"> <view 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">{{ juNextLvMoney }}</text> <text class="color-333 font-700 u-m-r-18">{{ juNextLvMoney }}</text>
<text class="color-333 font-700 u-m-r-18">{{ config.upgradeType == 'cost' ? '元' : '人' }}</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"
@@ -43,7 +46,8 @@
<view class="u-flex-1"> <view class="u-flex-1">
<view class="u-flex align-center"> <view class="u-flex align-center">
<text class="u-m-r-10 font-12 color-666" @click="toShouyiDetail('')">总收益</text> <text class="u-m-r-10 font-12 color-666" @click="toShouyiDetail('')">总收益</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 class="u-m-t-16 price" @click="toShouyiDetail('')" v-if="state.distributionUser"> <view class="u-m-t-16 price" @click="toShouyiDetail('')" v-if="state.distributionUser">
{{ state.distributionUser.totalIncome }} {{ state.distributionUser.totalIncome }}
@@ -52,9 +56,11 @@
<view class="u-flex-1"> <view class="u-flex-1">
<view class="u-flex align-center"> <view class="u-flex align-center">
<text class="u-m-r-10 font-12 color-666" @click="toShouyiDetail('待入账')">待入账</text> <text class="u-m-r-10 font-12 color-666" @click="toShouyiDetail('待入账')">待入账</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 class="u-m-t-16 price" @click="toShouyiDetail('待入账')" v-if="state.distributionUser">{{ state.distributionUser.pendingIncome }}</view> <view class="u-m-t-16 price" @click="toShouyiDetail('待入账')"
v-if="state.distributionUser">{{ state.distributionUser.pendingIncome }}</view>
</view> </view>
</view> </view>
</view> </view>
@@ -66,7 +72,8 @@
<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>是否需要邀请人数下单{{ config.inviteConsume ? '是' : '否' }}</view> <view>是否需要邀请人数下单{{ config.inviteConsume ? '是' : '否' }}</view>
<view>每人可获得的分销奖励次数{{ config.rewardCount == -1 ? '永久' : config.rewardCount + '次' }}</view> <view>每人可获得的分销奖励次数{{ config.rewardCount == -1 ? '永久' : config.rewardCount + '次' }}
</view>
</view> </view>
</template> </template>
<template v-if="config.openType == 'pay'"> <template v-if="config.openType == 'pay'">
@@ -99,8 +106,10 @@
</view> </view>
<view class="tabs" v-if="false"> <view class="tabs" v-if="false">
<view class="tabs-item" :class="{ active: activeTab == 'distributor' }" @click="activeTab = 'distributor'">分销员</view> <view class="tabs-item" :class="{ active: activeTab == 'distributor' }"
<view class="tabs-item" :class="{ active: activeTab == 'inviter' }" @click="activeTab = 'inviter'">邀请人</view> @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">
@@ -110,7 +119,8 @@
<view>邀请时间</view> <view>邀请时间</view>
</view> </view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<view v-for="(item, index) in userList" :key="index" class="u-flex justify-between align-center recoder-item color-666 font-12"> <view 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>
@@ -146,7 +156,8 @@
<view>我的收益什么时候可以到账</view> <view>我的收益什么时候可以到账</view>
<view>分销的结算时长为{{ config.settlementDay || 0 }}</view> <view>分销的结算时长为{{ config.settlementDay || 0 }}</view>
</view> </view>
<template v-if="config.upgradeType != 'not_upgrade' && config.levelConfigList && config.levelConfigList.length >= 2"> <template
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>
@@ -178,9 +189,11 @@
<view style="height: 240rpx"></view> <view style="height: 240rpx"></view>
</template> </template>
<view class="tips u-m-t-32" v-if="state.distributionUser && state.distributionUser.status">您的分销员身份已取消不再获得分成有疑问可联系商家</view> <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="bottom-btn" v-if="showInviteCode">
<view class="u-flex justify-center " style="gap: 54rpx;">
<view class="copy" @click="copyCode"> <view class="copy" @click="copyCode">
<view>复制邀请码</view> <view>复制邀请码</view>
<view v-if="inviteCode">{{ inviteCode }}</view> <view v-if="inviteCode">{{ inviteCode }}</view>
@@ -190,53 +203,88 @@
</view> </view>
</view> </view>
<view class="buy" v-if="config.openType == 'pay' && config.payAmount && !isActivated" @click="buy">付费{{ config.payAmount }}元开通</view> <view class="u-m-t-32 join-text u-font-28" @click="showGroup=true" >
加入股东群优惠活动多多{{'>>'}}
</view>
</view>
<view class="buy" v-if="config.openType == 'pay' && config.payAmount && !isActivated" @click="buy">
付费{{ config.payAmount }}元开通</view>
<bindShangji v-model="showBindShangji" @confirm="confirmBindShangji"></bindShangji> <bindShangji v-model="showBindShangji" @confirm="confirmBindShangji"></bindShangji>
<sharePopup <sharePopup v-model="showSharePopup"
v-model="showSharePopup"
v-if="(state.distributionUser && state.distributionUser.inviteCode) || inviteCode" v-if="(state.distributionUser && state.distributionUser.inviteCode) || inviteCode"
:inviteCode="state.distributionUser ? state.distributionUser.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 :tipsType="commissionTipsType" v-model="showCommission" :config="config" :levelConfigList="config.levelConfigList || []"></commissionPopup> <commissionPopup :tipsType="commissionTipsType" v-model="showCommission" :config="config"
:levelConfigList="config.levelConfigList || []"></commissionPopup>
<rulePopup v-model="showRule" :config="config" :distributionUser="state.distributionUser"></rulePopup> <rulePopup v-model="showRule" :config="config" :distributionUser="state.distributionUser"></rulePopup>
<popupDistributionGroupCode :group="state.group" v-model="showGroup"></popupDistributionGroupCode>
<ymf-share-popup ></ymf-share-popup>
</view> </view>
</template> </template>
<script setup> <script setup>
import { distributionClear } from '@/common/api/market'; import popupDistributionGroupCode from '@/components/popup-distribution-group-code.vue';
import { shareMixin, handleMixinOnLoad, returnQuery } from '@/utils/share.js'; const showGroup=ref(false)
import bindShangji from './components/bind-shangji.vue';
import sharePopup from './components/share-popup.vue';
import TipsPopup from '../components/tips-popup.vue';
import commissionPopup from '../components/commission.vue';
import rulePopup from '../components/rule.vue';
import { desensitizePhone } from '@/utils/util.js';
import BigNumber from 'bignumber.js';
import * as distributionApi from '@/common/api/market/distribution.js';
import { distributionLtPayOrder } from '@/common/api/order/index.js';
import { APIshopUserInfo } from '@/common/api/member.js';
import { pay } from '@/utils/pay.js';
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
const showBindShangji = ref(false);
const showSharePopup = ref(false);
import { ref, reactive, computed, watch } from 'vue';
const content = ref('');
const showPopup = ref(false);
const showRule = ref(false);
const showCommission = ref(false);
const tipsType = ref('');
const commissionTipsType = ref('');
function toShouyiDetail(name) {
import {
distributionClear
} from '@/common/api/market';
import {
shareMixin,
handleMixinOnLoad,wxShare,
returnQuery
} from '@/utils/share.js';
import bindShangji from './components/bind-shangji.vue';
import sharePopup from './components/share-popup.vue';
import TipsPopup from '../components/tips-popup.vue';
import commissionPopup from '../components/commission.vue';
import rulePopup from '../components/rule.vue';
import {
desensitizePhone
} from '@/utils/util.js';
import BigNumber from 'bignumber.js';
import * as distributionApi from '@/common/api/market/distribution.js';
import {
distributionLtPayOrder
} from '@/common/api/order/index.js';
import {
APIshopUserInfo
} from '@/common/api/member.js';
import {
pay
} from '@/utils/pay.js';
import {
onLoad,
onReachBottom
} from '@dcloudio/uni-app';
const showBindShangji = ref(false);
const showSharePopup = ref(false);
import {
ref,
reactive,
computed,
watch
} from 'vue';
const content = ref('');
const showPopup = ref(false);
const showRule = ref(false);
const showCommission = ref(false);
const tipsType = ref('');
const commissionTipsType = ref('');
function toShouyiDetail(name) {
uni.navigateTo({ uni.navigateTo({
url: '/distribution/income-details/index?name=' + name + '&shopId=' + options.shopId url: '/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;
@@ -253,21 +301,22 @@ function questionClick(title) {
commissionTipsType.value = '等级升级条件'; commissionTipsType.value = '等级升级条件';
showCommission.value = true; showCommission.value = true;
} }
} }
function back() {
function back() {
// uni.navigateBack({ // uni.navigateBack({
// delta: 1 // delta: 1
// }); // });
safeNavigateBack(); safeNavigateBack();
} }
/** /**
* 修复版:安全的页面返回方法 * 修复版:安全的页面返回方法
* 彻底避免 "cannot navigate back at first page" 报错 * 彻底避免 "cannot navigate back at first page" 报错
* @param {Number} delta 返回的页面数默认1 * @param {Number} delta 返回的页面数默认1
* @param {Function} fallback 失败时的降级处理函数 * @param {Function} fallback 失败时的降级处理函数
*/ */
function safeNavigateBack(delta = 1) { function safeNavigateBack(delta = 1) {
// 1. 立即获取页面栈,确保拿到最新状态(关键修复点) // 1. 立即获取页面栈,确保拿到最新状态(关键修复点)
const pages = getCurrentPages(); const pages = getCurrentPages();
// 2. 严谨判断:页面栈长度必须大于 delta 才能返回 // 2. 严谨判断:页面栈长度必须大于 delta 才能返回
@@ -302,13 +351,13 @@ function safeNavigateBack(delta = 1) {
console.error('页面返回异常:', error); console.error('页面返回异常:', error);
handleFallback(); handleFallback();
} }
} }
/** /**
* 统一处理降级逻辑 * 统一处理降级逻辑
* @param {Function} fallback 自定义降级函数 * @param {Function} fallback 自定义降级函数
*/ */
function handleFallback() { function handleFallback() {
uni.switchTab({ uni.switchTab({
url: '/pages/index/index', url: '/pages/index/index',
fail: () => { fail: () => {
@@ -317,9 +366,9 @@ function handleFallback() {
}); });
} }
}); });
} }
async function confirmBindShangji(code) { async function confirmBindShangji(code) {
const res = await distributionApi.bindInviteUser({ const res = await distributionApi.bindInviteUser({
shopId: options.shopId, shopId: options.shopId,
inviteCode: code, inviteCode: code,
@@ -340,21 +389,22 @@ async function confirmBindShangji(code) {
// icon: "none", // icon: "none",
// }); // });
// } // }
} }
function copyCode() {
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
}); });
@@ -384,6 +434,9 @@ async function init() {
if (res.distributionId) { if (res.distributionId) {
options.type = 'activates'; options.type = 'activates';
} }
if(res.distributionUser&&!res.distributionUser.firstIn){
showGroup.value=true
}
Object.assign(state, res); Object.assign(state, res);
if (res.distributionUser) { if (res.distributionUser) {
inviteCode.value = res.distributionUser.inviteCode; inviteCode.value = res.distributionUser.inviteCode;
@@ -392,15 +445,17 @@ async function init() {
} }
return res; return res;
} }
const options = reactive({ type: '' }); const options = reactive({
const imageStyle = computed(() => { type: ''
});
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 : '',
@@ -421,28 +476,29 @@ async function buy() {
getRecoders(); getRecoders();
}, 1500); }, 1500);
} }
} }
const state = reactive({ const state = reactive({
parentPhone: '', parentPhone: '',
parentName: '', parentName: '',
shopName: '' shopName: '',
}); group:{}
});
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,
@@ -453,7 +509,8 @@ async function getRecoders() {
} else { } else {
ajaxQuery.id = state.distributionUser.distributionId; ajaxQuery.id = state.distributionUser.distributionId;
} }
const res = activeTab.value == 'distributor' ? await distributionApi.childUser(ajaxQuery) : await distributionApi.inviteUser(ajaxQuery); const res = 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) {
@@ -463,8 +520,8 @@ async function getRecoders() {
} }
isEnd.value = query.page >= res.totalPage * 1; isEnd.value = query.page >= res.totalPage * 1;
} }
} }
const nextLvMoney = computed(() => { const nextLvMoney = computed(() => {
let nextLv = undefined; let nextLv = undefined;
if (!config.levelConfigList || !config.levelConfigList.length) { if (!config.levelConfigList || !config.levelConfigList.length) {
@@ -486,9 +543,9 @@ const nextLvMoney = computed(() => {
} }
} }
return ''; return '';
}); });
const juNextLvMoney = computed(() => { const juNextLvMoney = computed(() => {
if (!nextLvMoney.value) { if (!nextLvMoney.value) {
return ''; return '';
} }
@@ -500,10 +557,10 @@ const juNextLvMoney = computed(() => {
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);
}); });
//是否显示邀请码 //是否显示邀请码
const showInviteCode = computed(() => { const showInviteCode = computed(() => {
if (config.upgradeType == 'invite') { if (config.upgradeType == 'invite') {
return true; return true;
} }
@@ -520,13 +577,13 @@ const showInviteCode = computed(() => {
return true; return true;
} }
return false; return false;
}); });
//是否已成为分销员 //是否已成为分销员
const isActivated = computed(() => { const isActivated = computed(() => {
return state.distributionUser && state.distributionUser.level; return state.distributionUser && state.distributionUser.level;
}); });
watch( watch(
() => activeTab.value, () => activeTab.value,
(newVal, oldVal) => { (newVal, oldVal) => {
query.page = 1; query.page = 1;
@@ -535,32 +592,32 @@ watch(
getRecoders(); getRecoders();
} }
} }
); );
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({ // defineOptions({
// mixins: [shareMixin] // mixins: [shareMixin]
// }); // });
onShareAppMessage(async (res) => { onShareAppMessage(async (res) => {
let query = await returnQuery(); let query = await returnQuery();
return { return wxShare({
title: `股东共享-${state.shopName}`, title: `全民股东-${state.shopName}`,
path: `/distribution/shop-detail/index?${query}`, path: `/distribution/shop-detail/index?${query}`,
imageUrl: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/ec402c96a183489788f9e43430962d04.png', imageUrl: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/ec402c96a183489788f9e43430962d04.png',
query query
}; });
}); });
onLoad(async (opt) => { onLoad(async (opt) => {
try { try {
await handleMixinOnLoad(opt); await handleMixinOnLoad(opt);
if (opt.q) { if (opt.q) {
@@ -576,18 +633,18 @@ onLoad(async (opt) => {
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
}); });
onReachBottom(async () => { onReachBottom(async () => {
if (!isEnd.value) { if (!isEnd.value) {
query.page++; query.page++;
await getRecoders(); await getRecoders();
} }
}); });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.input-number-box { .input-number-box {
width: 428rpx; width: 428rpx;
padding-bottom: 10rpx; padding-bottom: 10rpx;
border-bottom: 1px solid #999; border-bottom: 1px solid #999;
@@ -612,9 +669,9 @@ onReachBottom(async () => {
font-size: 28rpx; font-size: 28rpx;
color: #fe7e00; color: #fe7e00;
} }
} }
.list { .list {
.shop-item { .shop-item {
padding: 32rpx 28rpx; padding: 32rpx 28rpx;
border-bottom: 2rpx solid #ededed; border-bottom: 2rpx solid #ededed;
@@ -644,8 +701,7 @@ onReachBottom(async () => {
font-weight: 700; font-weight: 700;
} }
.shouxufei { .shouxufei {}
}
.shouyi { .shouyi {
font-size: 24rpx; font-size: 24rpx;
@@ -653,9 +709,9 @@ onReachBottom(async () => {
text-align: center; text-align: center;
} }
} }
} }
.status { .status {
font-size: 28rpx; font-size: 28rpx;
font-weight: 700; font-weight: 700;
text-align: right; text-align: right;
@@ -664,23 +720,23 @@ onReachBottom(async () => {
&.fail { &.fail {
color: #ff1c1c; color: #ff1c1c;
} }
} }
.lingqu { .lingqu {
font-size: 28rpx; font-size: 28rpx;
border-radius: 8rpx; border-radius: 8rpx;
background: #fe6d11; background: #fe6d11;
padding: 8rpx 16rpx; padding: 8rpx 16rpx;
color: #ffffff; color: #ffffff;
} }
.price { .price {
font-weight: 700; font-weight: 700;
font-size: 40rpx; font-size: 40rpx;
color: #333; color: #333;
} }
.top { .top {
position: relative; position: relative;
.box { .box {
@@ -714,9 +770,9 @@ onReachBottom(async () => {
padding: 32rpx 36rpx; padding: 32rpx 36rpx;
} }
} }
} }
.btn-group { .btn-group {
position: absolute; position: absolute;
right: 28rpx; right: 28rpx;
top: 50%; top: 50%;
@@ -737,31 +793,31 @@ onReachBottom(async () => {
background-color: #fe6d11; background-color: #fe6d11;
} }
} }
} }
.tips { .tips {
padding: 16rpx 18rpx; padding: 16rpx 18rpx;
background: #ffe2e2; background: #ffe2e2;
padding: 16rpx 18rpx; padding: 16rpx 18rpx;
font-size: 28rpx; font-size: 28rpx;
line-height: 48rpx; line-height: 48rpx;
color: #ff1c1c; color: #ff1c1c;
} }
.bind { .bind {
padding: 8rpx 32rpx; padding: 8rpx 32rpx;
border-radius: 8rpx; border-radius: 8rpx;
font-size: 24rpx; font-size: 24rpx;
border: 2rpx solid #fe6d11; border: 2rpx solid #fe6d11;
color: #fff; color: #fff;
background-color: #fe6d11; background-color: #fe6d11;
} }
.top_bg { .top_bg {
width: 100%; width: 100%;
} }
.bottom { .bottom {
margin: 0 28rpx; margin: 0 28rpx;
border-radius: 36rpx; border-radius: 36rpx;
background-color: #fff; background-color: #fff;
@@ -773,40 +829,40 @@ onReachBottom(async () => {
margin: 0; margin: 0;
padding-bottom: 42rpx; padding-bottom: 42rpx;
} }
} }
.title { .title {
font-size: 32rpx; font-size: 32rpx;
font-weight: 700; font-weight: 700;
color: #333; color: #333;
} }
.small-title { .small-title {
font-size: 28rpx; font-size: 28rpx;
font-weight: 700; font-weight: 700;
color: #333; color: #333;
} }
.parse-html { .parse-html {
margin: 32rpx 28rpx; margin: 32rpx 28rpx;
font-size: 28rpx; font-size: 28rpx;
} }
.recoder-item { .recoder-item {
padding: 16rpx 0; padding: 16rpx 0;
border-bottom: 2rpx solid #ededed; border-bottom: 2rpx solid #ededed;
} }
.share { .share {
border-radius: 16rpx; border-radius: 16rpx;
background: #e8ad7b; background: #e8ad7b;
padding: 14rpx 76rpx; padding: 14rpx 76rpx;
font-size: 32rpx; font-size: 32rpx;
line-height: 48rpx; line-height: 48rpx;
color: #fff; color: #fff;
} }
.copy { .copy {
padding: 4rpx 30rpx; padding: 4rpx 30rpx;
border-radius: 18rpx; border-radius: 18rpx;
border: 2rpx solid #e8ad7b; border: 2rpx solid #e8ad7b;
@@ -815,18 +871,17 @@ onReachBottom(async () => {
color: #e8ad7b; color: #e8ad7b;
line-height: 48rpx; line-height: 48rpx;
text-align: center; text-align: center;
} }
.bottom-btn { .bottom-btn {
position: fixed; position: fixed;
left: 84rpx; left: 84rpx;
right: 84rpx; right: 84rpx;
bottom: 100rpx; bottom: 100rpx;
white-space: nowrap; white-space: nowrap;
gap: 54rpx; }
}
.buy { .buy {
padding: 32rpx 224rpx; padding: 32rpx 224rpx;
border-radius: 40rpx; border-radius: 40rpx;
background: linear-gradient(98deg, #fe6d1100 40.64%, #ffd1b4 105.2%), linear-gradient(259deg, #fe6d11 50.14%, #ffd1b4 114.93%); background: linear-gradient(98deg, #fe6d1100 40.64%, #ffd1b4 105.2%), linear-gradient(259deg, #fe6d11 50.14%, #ffd1b4 114.93%);
@@ -839,9 +894,9 @@ onReachBottom(async () => {
right: 28rpx; right: 28rpx;
bottom: 62rpx; bottom: 62rpx;
white-space: nowrap; white-space: nowrap;
} }
.tabs { .tabs {
display: flex; display: flex;
margin: 20rpx 0; margin: 20rpx 0;
gap: 30rpx; gap: 30rpx;
@@ -863,5 +918,9 @@ onReachBottom(async () => {
color: #fff; color: #fff;
} }
} }
} }
.join-text{
color: #02bbf3;
text-align: center;
}
</style> </style>

View File

@@ -123,6 +123,9 @@
</view> </view>
</up-popup> </up-popup>
<!-- 兑换确认弹窗end --> <!-- 兑换确认弹窗end -->
<ymf-share-popup ></ymf-share-popup>
</view> </view>
</template> </template>
<script setup> <script setup>
@@ -408,7 +411,7 @@ onShareAppMessage(async () => {
query query
}; };
console.log('onShareAppMessage===', options); console.log('onShareAppMessage===', options);
return options; return wxShare(options);
}); });
onLoad(async (opt) => { onLoad(async (opt) => {

View File

@@ -121,6 +121,7 @@
</view> </view>
<LookQrcode v-model="modalData.show" :qrcode="qrcode"></LookQrcode> <LookQrcode v-model="modalData.show" :qrcode="qrcode"></LookQrcode>
<ymf-share-popup ></ymf-share-popup>
</view> </view>
</template> </template>

View File

@@ -2,7 +2,7 @@
"easycom": { "easycom": {
"autoscan": true, "autoscan": true,
"custom": { "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", "^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

@@ -130,6 +130,7 @@
<!-- <CouponModal></CouponModal> --> <!-- <CouponModal></CouponModal> -->
<!-- 页面加载动画 --> <!-- 页面加载动画 -->
<pageLoading v-if="showPageLoading" /> <pageLoading v-if="showPageLoading" />
</view> </view>
</template> </template>

View File

@@ -90,7 +90,7 @@
</view> </view>
<view class="item" @click="toFenxiao"> <view class="item" @click="toFenxiao">
<image :src="imgs.share" class="img"></image> <image :src="imgs.share" class="img"></image>
<view class="title">股东共享</view> <view class="title">全民股东</view>
<view class="desc">邀请好友获得佣金</view> <view class="desc">邀请好友获得佣金</view>
</view> </view>
</view> </view>
@@ -116,6 +116,8 @@
</u-popup> </u-popup>
<!-- 私域引流弹窗 --> <!-- 私域引流弹窗 -->
<attractPopup type="home" ref="attractPopupRef" /> <attractPopup type="home" ref="attractPopupRef" />
<ymf-share-popup ></ymf-share-popup>
</view> </view>
</template> </template>

View File

@@ -192,6 +192,29 @@
</scroll-view> </scroll-view>
</view> </view>
<view class="main"> <view class="main">
<view class="u-p-r-32">
<up-swiper indicator indicatorMode="line" height="188rpx" :list="carouselList"
keyName="imageUrl">
<template #default="scope">
<view class="relative">
<image :src="scope.item.imageUrl" mode="aspectFill"
style="width:600rpx;height: 188rpx;"></image>
<view class="absolute swiper-mask" @click.stop="swiperClick(scope.item)">
<view class="share-btn-box" v-if="showShare(scope.item)">
<ymf-share
@shareClick="shareBtnClick(scope.item)"
>
<view class="share-btn">分享</view>
</ymf-share>
</view>
</view>
</view>
</template>
</up-swiper>
</view>
<view> <view>
<view class="item main-item" v-for="(item, index) in shopProductList.productInfo" :key="index" <view class="item main-item" v-for="(item, index) in shopProductList.productInfo" :key="index"
:id="'item-' + index"> :id="'item-' + index">
@@ -616,6 +639,8 @@
</view> </view>
</view> </view>
</u-popup> </u-popup>
<ymf-share-popup ></ymf-share-popup>
</view> </view>
</template> </template>
@@ -649,6 +674,11 @@
import { import {
APIproductqueryShop APIproductqueryShop
} from '@/common/api/member.js'; } from '@/common/api/member.js';
import {
carousel
} from '@/common/api/market/share.js'
/** /**
* api合集 end * api合集 end
*/ */
@@ -990,6 +1020,79 @@
uni.$u.debounce(mainScroll(res), 500); uni.$u.debounce(mainScroll(res), 500);
}); });
/*商品区域轮播图 start*/
const shareSwiperItem=ref(null)
function swiperClick(item) {
console.log('swiperClick',item);
shareSwiperItem.value=item
const pTag=returnPageTags(item.jumpPagePath)
if(pTag==='pp-list'){
return uni.navigateTo({
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
})
}
if(pTag==='pp-detail'){
const url=item.jumpPagePath+'&shopId='+uni.cache.get('shopId')+'&'+item.extendParam
return uni.navigateTo({
url:url.replace('goodsId','id')
})
}
if(pTag==='gb-list'){
return uni.navigateTo({
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
})
}
if(pTag==='gb-detail'){
const url=item.jumpPagePath+'&shopId='+uni.cache.get('shopId')+'&'+item.extendParam
return uni.navigateTo({
url:url.replace('goodsId','wareId')
})
}
if(pTag==='dis'){
return uni.navigateTo({
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
})
}
if(pTag==='index'){
return uni.switchTab({
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
})
}
if(pTag==='eat'){
if (item.extendParam) {
const id=item.extendParam.split('=')[1]
const item = allGoodsArr.value.find(v => v.id == id)
if (item) {
clickspecifications(item)
}
}
}
if(pTag==='point'){
return uni.navigateTo({
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
})
}
if(pTag==='point-detail'){
const url=item.jumpPagePath+'&shopId='+uni.cache.get('shopId')+'&'+item.extendParam
return uni.navigateTo({
url:url.replace('goodsId','id')
})
}
}
function showShare(item){
if(item.isShareable&&item.isEnabled){
return true
}
return false
}
/*商品区域轮播图 end*/
// 点击详情 // 点击详情
const showShopsku = ref(false); const showShopsku = ref(false);
@@ -1450,6 +1553,9 @@
}; };
// 判断商品是否在可售时间内 // 判断商品是否在可售时间内
const isProductAvailable = async (sellDaysStr, startTimeStr, endTimeStr) => { const isProductAvailable = async (sellDaysStr, startTimeStr, endTimeStr) => {
if(!sellDaysStr){
return false
}
// 将后端返回的字符串转换为数组 // 将后端返回的字符串转换为数组
const sellDays = sellDaysStr.split(','); const sellDays = sellDaysStr.split(',');
const now = dayjs(); const now = dayjs();
@@ -2456,7 +2562,7 @@
handleMixinOnLoad, handleMixinOnLoad,
returnQuery, returnQuery,
jsonToUrl, jsonToUrl,
wxShare, wxShare,returnPageTags,
returnCommonQuery returnCommonQuery
} from '@/utils/share.js' } from '@/utils/share.js'
// defineOptions({ // defineOptions({
@@ -2470,8 +2576,46 @@
isGoodsShare.value = true 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() { async function onShare() {
const queryJson = await returnCommonQuery() const queryJson = await returnCommonQuery()
if(shareSwiperItem.value){
return swiperShare(queryJson)
}
let query = jsonToUrl(queryJson) let query = jsonToUrl(queryJson)
query += '&type=beforehand' query += '&type=beforehand'
let json = {} let json = {}
@@ -2486,11 +2630,7 @@
json.title = shopName json.title = shopName
json.imageUrl = uni.cache.get('shopInfo').logo || '' json.imageUrl = uni.cache.get('shopInfo').logo || ''
} }
console.log('onShareAppMessage', {
query,
...json,
path: '/pages/product/index' + '?' + query
});
return wxShare({ return wxShare({
query, query,
...json, ...json,
@@ -2503,6 +2643,8 @@
onShareTimeline(onShare) onShareTimeline(onShare)
const pageOptions = reactive({}) const pageOptions = reactive({})
const carouselList = ref([])
onLoad(async (e) => { onLoad(async (e) => {
Object.assign(pageOptions, e) Object.assign(pageOptions, e)
if (e.type) { if (e.type) {
@@ -2514,8 +2656,9 @@
shopId: e.shopId || uni.cache.get('shopId') shopId: e.shopId || uni.cache.get('shopId')
}) })
if(userStore.shopUserInfo.shopExtendList){ if (userStore.shopUserInfo.shopExtendList) {
shopExtend.value=userStore.shopUserInfo.shopExtendList.find(v=>v.autoKey=='shopinfo_bg')||'' shopExtend.value = userStore.shopUserInfo.shopExtendList.find(v => v.autoKey == 'shopinfo_bg') ||
''
} }
// //获取用户信息 // //获取用户信息
@@ -2566,6 +2709,13 @@
// 满减活动 // 满减活动
getDiscountActivity(); getDiscountActivity();
//分享轮播
carousel({
shopId: uni.cache.get('shopId')
}).then(res => {
carouselList.value = res
})
let res = await APIhistoryOrder({ let res = await APIhistoryOrder({
tableCode: uni.cache.get('tableCode') tableCode: uni.cache.get('tableCode')
}); });
@@ -2671,6 +2821,7 @@
} }
onHide(() => { onHide(() => {
isGoodsShare.value = false isGoodsShare.value = false
shareSwiperItem.value=null
closeSocket(); closeSocket();
}); });
onUnload(() => { 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> </style>

View File

@@ -116,6 +116,8 @@
</view> </view>
</up-popup> </up-popup>
<!-- 兑换确认弹窗end --> <!-- 兑换确认弹窗end -->
<ymf-share-popup ></ymf-share-popup>
</view> </view>
</template> </template>
<script setup> <script setup>

View File

@@ -45,6 +45,8 @@
<up-loadmore :status="isEnd?'nomore':'loadmore'"></up-loadmore> <up-loadmore :status="isEnd?'nomore':'loadmore'"></up-loadmore>
</view> </view>
</view> </view>
<ymf-share-popup ></ymf-share-popup>
</view> </view>
</template> </template>
<script setup> <script setup>

View File

@@ -77,7 +77,8 @@
<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" :key="goodsIndex"> <view class="u-flex u-m-t-24 u-row-between" v-for="(goods, goodsIndex) in item.packageProducts"
: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>
@@ -142,7 +143,8 @@
<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> <image class="w-full" v-for="(item, index) in item.detailImages" :key="index" mode="widthFix"
:src="item"></image>
</view> </view>
</view> </view>
@@ -154,7 +156,8 @@
<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> <view class="btn gray u-m-t-32" @click="createOrder"
v-if="item.tieredDiscount && item.tieredDiscount.length > 0">发起助力</view>
</view> </view>
<!-- 需要支付的弹窗 --> <!-- 需要支付的弹窗 -->
@@ -198,39 +201,59 @@
</view> </view>
</view> </view>
</up-popup> </up-popup>
<ymf-share-popup ></ymf-share-popup>
<!-- 兑换确认弹窗end --> <!-- 兑换确认弹窗end -->
</view> </view>
</template> </template>
<script setup> <script setup>
import { shareMixin, handleMixinOnLoad, returnQuery } from '@/utils/share.js'; import {
import { Storelogin } from '@/stores/user.js'; shareMixin,
const storelogin = Storelogin(); handleMixinOnLoad,
import { computed, reactive, watch } from 'vue'; returnQuery
import dayjs from 'dayjs'; } from '@/utils/share.js';
import { wxShare } from '@/utils/share.js'; import {
import { getOpenId } from '@/utils/uniapp.js'; Storelogin
import modal from '@/groupBuying/components/modal.vue'; } from '@/stores/user.js';
import * as Api from '@/common/api/market/package.js'; const storelogin = Storelogin();
import { pay } from '@/utils/pay.js'; import {
const imgs = { computed,
reactive,
watch
} from 'vue';
import dayjs from 'dayjs';
import {
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 = {
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 { BigNumber } from 'bignumber.js'; import {
const totalPrice = computed(() => { BigNumber
} from 'bignumber.js';
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;
@@ -252,53 +275,55 @@ function changeNumber(step) {
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({
show: false, show: false,
item: null item: null
}); });
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( watch(
() => popupData.show, () => popupData.show,
(newval) => { (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', 'F4OyUhe_ZQ9BR731jlkaN2QXAUaA3HBZuUeVPfraSz0'], tmplIds: ['JGPAGmqcPEgWB6mvAl0SC5cMqr5H5Qjcim8JCpHAZd0',
'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
@@ -314,9 +339,9 @@ async function createOrder() {
}); });
} }
}); });
} }
async function payExchange() { async function payExchange() {
uni.setStorageSync('group_buying_order', { uni.setStorageSync('group_buying_order', {
...item, ...item,
number: number.value number: number.value
@@ -361,13 +386,13 @@ async function payExchange() {
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;
} }
@@ -375,9 +400,9 @@ const isCanExchange = computed(() => {
return false; return false;
} }
return true; return true;
}); });
const returnBtmText = computed(() => { const returnBtmText = computed(() => {
if (isCanExchange.value) { if (isCanExchange.value) {
return '立即购买'; return '立即购买';
} }
@@ -391,16 +416,16 @@ const returnBtmText = computed(() => {
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) {
// 获取小程序进入场景和参数 // 获取小程序进入场景和参数
const launchOptions = uni.getLaunchOptionsSync(); const launchOptions = uni.getLaunchOptionsSync();
console.log(launchOptions); console.log(launchOptions);
@@ -413,33 +438,33 @@ async function init(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的订单/拼团对象
* @returns {number} 剩余时间(毫秒) * @returns {number} 剩余时间(毫秒)
*/ */
function returnRemainingTime(item) { function returnRemainingTime(item) {
if (!item?.groupEndTime) return 0; // 容错无结束时间则返回0 if (!item?.groupEndTime) return 0; // 容错无结束时间则返回0
return dayjs(item.groupEndTime).valueOf() - dayjs().valueOf(); return dayjs(item.groupEndTime).valueOf() - dayjs().valueOf();
} }
/** /**
* 将毫秒差格式化为 HH:MM:SS最多72小时 * 将毫秒差格式化为 HH:MM:SS最多72小时
* @param {number} ms - 时间差(毫秒) * @param {number} ms - 时间差(毫秒)
* @returns {string} 格式化后的时分秒(如 09:09:09、72:00:00、00:00:00 * @returns {string} 格式化后的时分秒(如 09:09:09、72:00:00、00:00:00
*/ */
function formatTimeToHMS(ms) { function formatTimeToHMS(ms) {
// 边界1已过期/无剩余时间 → 显示00:00:00 // 边界1已过期/无剩余时间 → 显示00:00:00
if (ms <= 0) return '00:00:00'; if (ms <= 0) return '00:00:00';
@@ -459,35 +484,35 @@ function formatTimeToHMS(ms) {
// 补零(确保两位数,如 9 → 09 // 补零(确保两位数,如 9 → 09
const pad = (num) => String(num).padStart(2, '0'); const pad = (num) => String(num).padStart(2, '0');
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) => { onLoad(async (opt) => {
await handleMixinOnLoad(opt); await handleMixinOnLoad(opt);
init(opt); init(opt);
}); });
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
uni.showShareMenu(); uni.showShareMenu();
// #endif // #endif
onShareAppMessage(async () => { onShareAppMessage(async () => {
let query = await returnQuery(); let query = await returnQuery();
const options = { const options = {
title: item.packageName, title: item.packageName,
@@ -496,23 +521,23 @@ onShareAppMessage(async () => {
query query
}; };
console.log('onShareAppMessage===', options); console.log('onShareAppMessage===', options);
return options; return wxShare(options);
}); });
const canuseTime = computed(() => { const canuseTime = computed(() => {
return item.useWeeks.join('、') + ' ' + item.useTimes; return item.useWeeks.join('、') + ' ' + item.useTimes;
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
$topHeight: 350rpx; $topHeight: 350rpx;
.top-img { .top-img {
width: 750rpx; width: 750rpx;
height: $topHeight; height: $topHeight;
} }
.top { .top {
margin: 14rpx 18rpx; margin: 14rpx 18rpx;
background-size: cover; background-size: cover;
height: $topHeight; height: $topHeight;
@@ -532,9 +557,9 @@ $topHeight: 350rpx;
font-weight: 700; font-weight: 700;
margin-top: 62rpx; margin-top: 62rpx;
} }
} }
.sku { .sku {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 20rpx 36rpx; padding: 20rpx 36rpx;
@@ -559,9 +584,9 @@ $topHeight: 350rpx;
color: #fff; color: #fff;
font-size: 28rpx; font-size: 28rpx;
} }
} }
.goods { .goods {
padding: 20rpx 28rpx; padding: 20rpx 28rpx;
background: #fff; background: #fff;
@@ -570,14 +595,14 @@ $topHeight: 350rpx;
font-weight: 700; font-weight: 700;
color: #333; color: #333;
} }
} }
.desc { .desc {
padding: 32rpx 28rpx; padding: 32rpx 28rpx;
background-color: #fff; background-color: #fff;
} }
.goods-detail { .goods-detail {
padding: 32rpx; padding: 32rpx;
.title { .title {
@@ -608,9 +633,9 @@ $topHeight: 350rpx;
background: linear-gradient(90deg, #c9cbcc 0%, #f7f8f9 100%); background: linear-gradient(90deg, #c9cbcc 0%, #f7f8f9 100%);
} }
} }
} }
.fixed-bottom { .fixed-bottom {
position: fixed; position: fixed;
left: 98rpx; left: 98rpx;
right: 98rpx; right: 98rpx;
@@ -635,15 +660,15 @@ $topHeight: 350rpx;
border-color: #e8ad7b; border-color: #e8ad7b;
} }
} }
} }
.waring { .waring {
background-color: rgba(255, 204, 0, 0.09); background-color: rgba(255, 204, 0, 0.09);
padding: 32rpx 24rpx; padding: 32rpx 24rpx;
color: #ff8d28; color: #ff8d28;
} }
.popup-content { .popup-content {
font-size: 28rpx; font-size: 28rpx;
min-height: 300px; min-height: 300px;
@@ -709,13 +734,13 @@ $topHeight: 350rpx;
color: #fff; color: #fff;
font-size: 700; font-size: 700;
} }
} }
.w-full { .w-full {
width: 100%; width: 100%;
} }
.groups { .groups {
padding: 28rpx 22rpx; padding: 28rpx 22rpx;
background-color: #fff; background-color: #fff;
@@ -739,9 +764,9 @@ $topHeight: 350rpx;
color: #fff; color: #fff;
} }
} }
} }
.share-box { .share-box {
top: 0; top: 0;
position: absolute; position: absolute;
right: 0; right: 0;
@@ -760,9 +785,9 @@ $topHeight: 350rpx;
bottom: 0; bottom: 0;
opacity: 0; opacity: 0;
} }
} }
.goods-group { .goods-group {
padding: 32rpx 46rpx; padding: 32rpx 46rpx;
background-color: #fff; background-color: #fff;
@@ -774,9 +799,9 @@ $topHeight: 350rpx;
.rotate { .rotate {
transform: rotate(-90deg); transform: rotate(-90deg);
} }
} }
.desc { .desc {
padding: 32rpx 46rpx; padding: 32rpx 46rpx;
background-color: #fff; background-color: #fff;
margin-top: 32rpx; margin-top: 32rpx;
@@ -807,9 +832,9 @@ $topHeight: 350rpx;
.rotate { .rotate {
transform: rotate(-90deg); transform: rotate(-90deg);
} }
} }
.guodu { .guodu {
transition: all 0.3s; transition: all 0.3s;
} }
</style> </style>

View File

@@ -167,6 +167,7 @@
<LookQrcode v-model="modalData.show" :qrcode="qrcode"></LookQrcode> <LookQrcode v-model="modalData.show" :qrcode="qrcode"></LookQrcode>
<ymf-share-popup ></ymf-share-popup>
</view> </view>
</template> </template>
@@ -513,9 +514,9 @@
}) })
}) })
onLoad(() => { onLoad((opt) => {
APIusershopInfodetail({ APIusershopInfodetail({
shopId: uni.cache.get('shopId') shopId: uni.cache.get('shopId')||opt.shopId
}).then(res => { }).then(res => {
console.log(res); console.log(res);
shopInfo.value = res.shopInfo shopInfo.value = res.shopInfo

View File

@@ -538,7 +538,7 @@ onShareAppMessage(async () => {
query query
}; };
console.log('onShareAppMessage===', options); console.log('onShareAppMessage===', options);
return options; return wxShare(options);
}); });
onLoad(async (opt) => { onLoad(async (opt) => {

View File

@@ -2,6 +2,10 @@ import {
autoBindInviteUser, autoBindInviteUser,
autoGetInviteCode autoGetInviteCode
} from '@/common/api/market/distribution.js' } from '@/common/api/market/distribution.js'
import {
shareClaim
} from '@/common/api/market/share.js'
import { import {
APIshopUserInfo, APIshopUserInfo,
APIusershopInfodetail APIusershopInfodetail
@@ -10,8 +14,17 @@ import {
productStore productStore
} from '@/stores/user.js'; } from '@/stores/user.js';
const accountStore = productStore(); const accountStore = productStore();
// #ifdef MP-WEIXIN
const accountInfo = wx.getAccountInfoSync(); const accountInfo = wx.getAccountInfoSync();
export const envVersion = accountInfo.miniProgram.envVersion; export const envVersion = accountInfo.miniProgram.envVersion;
// #endif
// #ifdef H5
const accountInfo = {};
export const envVersion = 'release'
// #endif
let type = 3; let type = 3;
if (envVersion === 'trial') { if (envVersion === 'trial') {
console.log('当前环境是体验版'); console.log('当前环境是体验版');
@@ -24,39 +37,78 @@ if (envVersion === 'trial') {
console.log('当前环境是开发版或其他'); console.log('当前环境是开发版或其他');
} }
export const pageTags = {
'/userPackage/index/index': 'pp-list', //套餐推广列表页
'/userPackage/goodsDetail/goodsDetail': 'pp-detail', //套餐推广商品详情页
'/groupBuying/index/index': 'gb-list', //商品拼团列表页
'/groupBuying/goodsDetail/goodsDetail': 'gb-detail', //商品拼团详情页
'/distribution/shop-detail/index': 'dis', //全民股东页面
'/pages/index/index': 'index', //店铺首页
'/pages/product/index': 'eat', //点餐页
'/pages/product/index?pTag=eat-detail': 'eat-detail', //点餐商品详情弹窗页
'/scoreShop/index/index':'point' ,//积分商品
'/scoreShop/detail/index':'point-detail' ,//积分商品详情
}
export function returnPageTags(page) {
for (let key in pageTags) {
if (page.includes(key)) {
if (page.includes('/pages/product/index')) {
if (page.includes('showGoodsId=')||page.includes('goodsId=')) {
return 'eat-detail'
} else {
return 'eat'
}
} else {
return pageTags[key]
}
}
}
return ''
}
/** /**
* 绑定用户邀请关系(核心函数) * 绑定用户邀请关系(核心函数)
* 功能说明:校验邀请码有效性,有效则调用自动绑定接口完成邀请关系绑定 * 功能说明:校验邀请码有效性,有效则调用自动绑定接口完成邀请关系绑定
* @param {Object} args - 绑定邀请关系的入参对象 * @param {Object} args - 绑定邀请关系的入参对象
* @param {number} [args.shopUserId] - 需要绑定邀请人的用户IDinteger <int64>可选 * @param {number} args.fromUserId - 需要绑定邀请人的用户IDinteger <int64>必填
* @param {number} [args.shopId] - 店铺IDinteger <int64>可选 * @param {number} args.shopId - 店铺IDinteger <int64>必填
* @param {string} args.inviteCode - 邀请人的邀请码(必填,非空校验通过后才会执行绑定逻辑) * @param {string} args.pTag - 来源页面类型
* @returns {void} 无返回值 * @returns {void} 无返回值
*/ */
export async function bindInvite(args) { export async function bindInvite(args) {
// 解构入参对象,获取需要的核心参数 // 解构入参对象,获取需要的核心参数
const { const {
shopUserId, fromUserId,
shopId, shopId,
inviteCode pTag,
} = args; } = args;
console.log('bindInvite',args);
// 校验邀请码有效性若邀请码为空、null、undefined则直接返回不执行后续绑定逻辑 if (!fromUserId || !shopId) {
if (!inviteCode || inviteCode === null || inviteCode === undefined) {
return; return;
} }
const shopUserInfo = uni.cache.get('shopUserInfo') const shopUserInfo = uni.cache.get('shopUserInfo')
// 邀请码有效,调用自动绑定邀请人接口,传递绑定所需参数 // 邀请码有效,调用自动绑定邀请人接口,传递绑定所需参数
return await autoBindInviteUser({ return await shareClaim({
id: shopUserInfo.id, tagType: pTag || '',
shopId, shopId,
inviteCode fromUserId: fromUserId,
toUserId: shopUserInfo.id
}); });
} }
export function wxShare(par) { export function wxShare(par) {
const path = par.path
const pTag = returnPageTags(path)
if (pTag) {
par.path += '&pTag=' + pTag
par.query += '&pTag=' + pTag
}
console.log('pTag', pTag);
console.log('wxShare', {
...par,
type
});
return { return {
...par, ...par,
type type
@@ -67,15 +119,15 @@ export async function returnCommonQuery() {
const shopId = uni.cache.get('shopId') const shopId = uni.cache.get('shopId')
const shopUserInfo = uni.cache.get('shopUserInfo') const shopUserInfo = uni.cache.get('shopUserInfo')
const shopInfo = uni.cache.get('shopInfo') const shopInfo = uni.cache.get('shopInfo')
const inviteCode = await autoGetInviteCode({ // const inviteCode = await autoGetInviteCode({
shopId: shopId, // shopId: shopId,
shopUserId: shopUserInfo.id // fromUserId: shopUserInfo.id
}) // })
const queryJson = { const queryJson = {
inviteCode: (inviteCode && inviteCode !== true) ? inviteCode : null, // inviteCode: (inviteCode && inviteCode !== true) ? inviteCode : null,
shopId, shopId,
shopUserId: shopUserInfo.id, fromUserId: shopUserInfo.id,
} }
return Promise.resolve(queryJson) return Promise.resolve(queryJson)
} }
@@ -104,10 +156,10 @@ export async function returnQuery(query, showkeys) {
const shopId = uni.cache.get('shopId') const shopId = uni.cache.get('shopId')
const shopUserInfo = uni.cache.get('shopUserInfo') const shopUserInfo = uni.cache.get('shopUserInfo')
const shopInfo = uni.cache.get('shopInfo') const shopInfo = uni.cache.get('shopInfo')
const inviteCode = await autoGetInviteCode({ // const inviteCode = await autoGetInviteCode({
shopId: shopId, // shopId: shopId,
shopUserId: shopUserInfo.id // fromUserId: shopUserInfo.id
}) // })
const pages = getCurrentPages(); const pages = getCurrentPages();
const currentPage = pages[pages.length - 1]; const currentPage = pages[pages.length - 1];
@@ -117,9 +169,9 @@ export async function returnQuery(query, showkeys) {
let sharePath = `/${currentPath}`; let sharePath = `/${currentPath}`;
const queryJson = { const queryJson = {
inviteCode: (inviteCode && inviteCode !== true) ? inviteCode : null, // inviteCode: (inviteCode && inviteCode !== true) ? inviteCode : null,
shopId, shopId,
shopUserId: shopUserInfo.id, fromUserId: shopUserInfo.id,
...query ...query
} }
for (const key in currentOptions) { for (const key in currentOptions) {
@@ -132,8 +184,8 @@ export async function returnQuery(query, showkeys) {
} }
} }
queryJson.shopId = shopId queryJson.shopId = shopId
queryJson.inviteCode = (inviteCode && inviteCode !== true) ? inviteCode : null // queryJson.inviteCode = (inviteCode && inviteCode !== true) ? inviteCode : null
queryJson.shopUserId = shopUserInfo.id queryJson.fromUserId = shopUserInfo.id
let result = '' let result = ''
for (let key in queryJson) { for (let key in queryJson) {
@@ -178,14 +230,8 @@ export async function handleMixinOnLoad(opt, vm) {
await accountStore.pageOnload() await accountStore.pageOnload()
} }
uni.setStorageSync('loadFinsh', true) uni.setStorageSync('loadFinsh', true)
// const shopId = uni.cache.get('shopId')
// const shopUserInfo = uni.cache.get('shopUserInfo') if (options.shopId) {
// const shopInfo = uni.cache.get('shopInfo')
// const inviteCode = await autoGetInviteCode({
// shopId: shopId,
// shopUserId: shopUserInfo.id
// })
if (options.inviteCode) {
return await bindInvite(options) return await bindInvite(options)
} }
} }
@@ -220,36 +266,7 @@ export function returnIndexBg() {
// utils/share.js // utils/share.js
export const shareMixin = { 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) { async onShareAppMessage(res) {
const shopInfo = uni.cache.get('shopInfo') const shopInfo = uni.cache.get('shopInfo')
@@ -261,10 +278,11 @@ export const shareMixin = {
let sharePath = `/${currentPath}`; let sharePath = `/${currentPath}`;
const query = await returnQuery() let query = await returnQuery()
const indexBg = returnIndexBg() const indexBg = returnIndexBg()
console.log('indexBg', indexBg); console.log('indexBg', indexBg);
const imageUrl = indexBg || shopInfo.logo const imageUrl = indexBg || shopInfo.logo
// 全局默认配置(可被页面覆盖) // 全局默认配置(可被页面覆盖)
const defaultShareConfig = { const defaultShareConfig = {
title: shopInfo.shopName, title: shopInfo.shopName,
@@ -311,9 +329,11 @@ export const shareMixin = {
let sharePath = `/${currentPath}`; let sharePath = `/${currentPath}`;
const query = await returnQuery() let query = await returnQuery()
const indexBg = returnIndexBg() const indexBg = returnIndexBg()
const imageUrl = indexBg || shopInfo.logo const imageUrl = indexBg || shopInfo.logo
const defaultTimelineConfig = { const defaultTimelineConfig = {
title: shopInfo.shopName, title: shopInfo.shopName,
path: sharePath + '?' + query, path: sharePath + '?' + query,