diff --git a/common/api/market/distribution.js b/common/api/market/distribution.js
index 89f453f..85f66e0 100644
--- a/common/api/market/distribution.js
+++ b/common/api/market/distribution.js
@@ -136,6 +136,15 @@ export const getInviteCode = (data) => {
data: data,
});
};
+export const autoGetInviteCode = (data) => {
+ return request({
+ url: prveUrl + "/user/distribution/autoGetInviteCode",
+ method: "get",
+ data: data,
+ });
+};
+
+
// 获取配置
export const getConfig = (data) => {
@@ -147,3 +156,11 @@ export const getConfig = (data) => {
};
+// 分销员中心-无感-绑定邀请人
+export const autoBindInviteUser = (data) => {
+ return request({
+ url: prveUrl + "/user/distribution/autoBindInviteUser",
+ method: "post",
+ data: data,
+ });
+};
\ No newline at end of file
diff --git a/common/api/market/index.js b/common/api/market/index.js
index 4f69fdb..94afe52 100644
--- a/common/api/market/index.js
+++ b/common/api/market/index.js
@@ -1,6 +1,8 @@
// 引入 request 文件
import request from '@/common/api/request.js'
-import {prveUrl} from './config.js'
+import {
+ prveUrl
+} from './config.js'
export const consumeDiscount = (data) => {
return request({
@@ -16,3 +18,11 @@ export const homeData = (data) => {
data: data
})
}
+
+// 清除所有分销绑定关系
+export const distributionClear = (data) => {
+ return request({
+ url: prveUrl + '/user/distribution/clean',
+ method: 'get'
+ })
+}
\ No newline at end of file
diff --git a/common/api/order/pointGoods.js b/common/api/order/pointGoods.js
index 8dca627..38d3c79 100644
--- a/common/api/order/pointGoods.js
+++ b/common/api/order/pointGoods.js
@@ -20,6 +20,12 @@ export const pointGoodsPage = (data) => {
data: data
})
}
+export const pointsGoods = (data) => {
+ return request({
+ url: url + '/user/pointGoods/'+data.id,
+ method: 'get',
+ })
+}
export const exchange = (data) => {
diff --git a/common/api/request.js b/common/api/request.js
index c6a2e1b..8e7f50f 100644
--- a/common/api/request.js
+++ b/common/api/request.js
@@ -52,7 +52,7 @@ export default async (params) => {
//获取成功
if (res.code == 200) {
uni.hideLoading();
- uni.hideToast();
+ // uni.hideToast();
resolve(res.data ? res.data : true);
} else {
switch (res.code) {
@@ -135,7 +135,7 @@ export default async (params) => {
// 不管成功还是失败都会执行
setTimeout((res) => {
uni.hideLoading();
- uni.hideToast();
+ // uni.hideToast();
}, 10000);
},
});
diff --git a/common/config.js b/common/config.js
index 91fe54d..1273981 100644
--- a/common/config.js
+++ b/common/config.js
@@ -1,12 +1,9 @@
// const debug = process.env.NODE_ENV == 'development' ? true : false;
// const debug = false; // false线上 true本地
-const debug = false; // false线上 true本地
+const debug = true; // false线上 true本地
let baseUrl = ''
let baseUrlwws = ''
-
-
-
const version = "100";
const autoRemoveCache = {
count: 100000,
diff --git a/common/css/common.scss b/common/css/common.scss
index 425b73c..0957cdb 100644
--- a/common/css/common.scss
+++ b/common/css/common.scss
@@ -44,6 +44,9 @@ page,
image {
display: block;
}
+ .relative{
+ position: relative;
+ }
.absolute{
position: absolute;
}
diff --git a/components/ymf-components/ymf-share.vue b/components/ymf-components/ymf-share.vue
new file mode 100644
index 0000000..62b7bf2
--- /dev/null
+++ b/components/ymf-components/ymf-share.vue
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/distribution/shop-detail/components/share-popup.vue b/distribution/shop-detail/components/share-popup.vue
index f8fc284..c828f94 100644
--- a/distribution/shop-detail/components/share-popup.vue
+++ b/distribution/shop-detail/components/share-popup.vue
@@ -1,228 +1,260 @@
-
-
- qrcodeResult(e)"
- >
-
-
-
-
-
-
-
-
-
- {{ shopUserInfo.nickName }}
- {{ desensitizePhone(shopUserInfo.phone) }}
-
-
- 邀请码
- {{
- inviteCode
- }}
- 复制
-
-
-
-
-
-
-
- 保存图片
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
\ No newline at end of file
diff --git a/distribution/shop-detail/index.vue b/distribution/shop-detail/index.vue
index 9fb1639..3da5184 100644
--- a/distribution/shop-detail/index.vue
+++ b/distribution/shop-detail/index.vue
@@ -1,908 +1,867 @@
-
-
-
-
-
-
-
-
- {{
- state.shopName
- }}
-
-
-
-
- 上级:{{ state.parentName }}{{ state.parentPhone }}
-
-
-
-
- 绑定上级
-
-
-
-
+
+
+
+
+
+
+
+
+ {{ state.shopName }}
+
+
+
+ 上级:{{ state.parentName }}{{ state.parentPhone }}
+
+
+ 绑定上级
+
+
+
-
-
-
- 我的分销等级:
- {{ state.distributionUser.level }}级
- {{ state.distributionUser.levelName }}
-
-
-
- 距离下一级还差:
- {{ juNextLvMoney }}
-
- {{ config.upgradeType == "cost" ? "元" : "人" }}
-
-
-
-
-
-
- 总收益
-
-
- {{ state.distributionUser.totalIncome }}
-
-
-
- 待入账
-
-
- {{ state.distributionUser.pendingIncome }}
-
-
-
-
-
-
-
- 如何成为分销员
-
- 需要邀请人数:{{ config.inviteCount }}人
- 是否需要邀请人数下单:{{
- config.inviteConsume ? "是" : "否"
- }}
-
- 每人可获得的分销奖励次数:{{
- config.rewardCount == -1
- ? "永久"
- : config.rewardCount + "次"
- }}
-
-
-
-
-
- 如何成为分销员
-
-
- 只需付费{{ config.payAmount || "" }}元,即可成为分销员
-
-
-
-
- 如何成为分销员
-
-
- 请联系商家咨询详情
-
-
-
-
-
-
+
+
+
+
+ 总收益
+
+
+
+ {{ state.distributionUser.totalIncome }}
+
+
+
+
+ 待入账
+
+
+ {{ state.distributionUser.pendingIncome }}
+
+
+
+
+
+
+
+ 如何成为分销员
+
+ 需要邀请人数:{{ config.inviteCount }}人
+ 是否需要邀请人数下单:{{ config.inviteConsume ? '是' : '否' }}
+ 每人可获得的分销奖励次数:{{ config.rewardCount == -1 ? '永久' : config.rewardCount + '次' }}
+
+
+
+ 如何成为分销员
+
+ 只需付费{{ config.payAmount || '' }}元,即可成为分销员
+
+
+
+ 如何成为分销员
+
+ 请联系商家咨询详情
+
+
+
+
+
+
-
-
-
- 我的邀请({{ inviteUserRes.totalRow }})
-
-
-
- 分成比例{{ state.distributionUser.levelOneCommission || 0 }}%
-
-
-
+
+
+
+ 我的邀请({{ inviteUserRes.totalRow }})
+
+
+
+ 分成比例{{ state.distributionUser.levelOneCommission || 0 }}%
+
+
+
-
- 分销员
- 邀请人
-
+
+ 分销员
+ 邀请人
+
-
-
- 用户
- 获得利益(元)
- 邀请时间
-
-
-
-
-
-
- {{ item.shopUserName }}
-
-
-
- ( {{ item.levelName }})
-
+
+
+ 用户
+ 获得利益(元)
+ 邀请时间
+
+
+
+
+
+
+ {{ item.shopUserName }}
+
+
+
+ ( {{ item.levelName }})
+
- {{ desensitizePhone(item.shopUserPhone) }}
-
-
- {{ item.oneIncome }}
- ({{ item.distributionLevelName }})
-
-
- {{
- item.inviteTime.split(" ")[0]
- }}
- {{ "yyyy-MM-dd" }}
-
-
-
-
-
-
-
-
- 规则说明
-
-
-
-
- 我的收益什么时候可以到账?
- 分销的结算时长为{{ config.settlementDay || 0 }}天
-
-
-
- 怎么样才能升级分销员等级?
+ {{ desensitizePhone(item.shopUserPhone) }}
+
+
+ {{ item.oneIncome }}
+ ({{ item.distributionLevelName }})
+
+
+ {{ item.inviteTime.split(' ')[0] }}
+ {{ 'yyyy-MM-dd' }}
+
+
+
+
+
+
+
+
+ 规则说明
+
+
+
+
+ 我的收益什么时候可以到账?
+ 分销的结算时长为{{ config.settlementDay || 0 }}天
+
+
+
+ 怎么样才能升级分销员等级?
-
- 邀请的有效人数达到{{ nextLvMoney }}人即可升级
- 什么是有效邀请人数?
- 被邀请人在店铺消费过,即有一笔订单完成才算有效
-
-
- 消费金额总计达到{{ nextLvMoney }}元即可升级
-
+
+ 邀请的有效人数达到{{ nextLvMoney }}人即可升级
+ 什么是有效邀请人数?
+ 被邀请人在店铺消费过,即有一笔订单完成才算有效
+
+
+ 消费金额总计达到{{ nextLvMoney }}元即可升级
+
-
- 请联系商家
-
-
-
+
+ 请联系商家
+
+
+
-
- 消费金额如何计算?
- 消费金额是计算您和您邀请的人在店铺消费的总金额,但退款订单不计入
-
-
-
-
-
-
-
-
-
+
+ 消费金额如何计算?
+ 消费金额是计算您和您邀请的人在店铺消费的总金额,但退款订单不计入
+
+
+
+
+
+
+
+
+
- 您的分销员身份已取消,不再获得分成有疑问可联系商家
+ 您的分销员身份已取消,不再获得分成有疑问可联系商家
-
-
- 复制邀请码
- {{ inviteCode }}
-
-
- 分享邀请
-
-
+
+
+ 复制邀请码
+ {{ inviteCode }}
+
+
+ 分享邀请
+
+
-
- 付费{{ config.payAmount }}元开通
-
+ 付费{{ config.payAmount }}元开通
-
-
+
+
-
-
-
-
+
+
+
+
-
+
-
+
\ No newline at end of file
+
diff --git a/groupBuying/goodsDetail/goodsDetail.vue b/groupBuying/goodsDetail/goodsDetail.vue
index d40fa20..91839cb 100644
--- a/groupBuying/goodsDetail/goodsDetail.vue
+++ b/groupBuying/goodsDetail/goodsDetail.vue
@@ -10,30 +10,30 @@
- ¥{{item.groupPrice}}
- ¥{{item.originalPrice}}
+ ¥{{ item.groupPrice }}
+ ¥{{ item.originalPrice }}
- 限购{{item.limitBuyNum}}份
- 已团:{{item.groupedNum||0}}
+ 限购{{ item.limitBuyNum }}份
+ 已团:{{ item.groupedNum || 0 }}
- {{item.wareName}}
+ {{ item.wareName }}
- {{item.wareDetail}}
+ {{ item.wareDetail }}
- 可核销门店:
- {{item.shopName}}
+ 可核销门店:
+ {{ item.shopName }}
- 门店地址:
- {{item.shopAddress}}
+ 门店地址:
+ {{ item.shopAddress }}
@@ -41,55 +41,46 @@
立即拼团
-
+
- 立即购买购
- {{item.nickName}}
- 差{{returnNeedPerpole(item)}}人拼成
+
+ 立即购买购
+ {{ item.nickName }}
+ 差{{ returnNeedPerpole(item) }}人拼成
剩余:
- {{getRemainingHMS(item)}}
+ {{ getRemainingHMS(item) }}
快速拼成
-
-
-
-
-
-
-
+
商品详情
-
-
+
- {{returnBtmText}}
+ {{ returnBtmText }}
- {{returnBtmText}}
+ {{ returnBtmText }}
-
-
-
-
+
合计:
- {{totalPrice}}
+ {{ totalPrice }}
- {{number}}
+ {{ number }}
-
@@ -137,574 +126,562 @@
\ No newline at end of file
+}
+
diff --git a/groupBuying/index/index.vue b/groupBuying/index/index.vue
index b748001..f9c2549 100644
--- a/groupBuying/index/index.vue
+++ b/groupBuying/index/index.vue
@@ -2,71 +2,63 @@
-
+
- {{shopInfo.shopName||''}}
+ {{ shopInfo.shopName || '' }}
-
- {{index+1}}
- {{item}}
-
+
+ {{ index + 1 }}
+ {{ item }}
+
- {{'>'}}
+ {{ '>' }}
- {{'>'}}
+ {{ '>' }}
-
+
- {{item}}
+ {{ item }}
-
-
+
+
-
-
- {{item.name}}
+
+
+ {{ item.name }}
-
-
-
-
-
-
+
+
- {{item.groupPeopleNum}}人团
- {{item.wareName}}
+ {{ item.groupPeopleNum }}人团
+ {{ item.wareName }}
- 已团:{{item.groupedNum}}
+ 已团:{{ item.groupedNum }}
拼团到手
- ¥{{item.groupPrice}}
+ ¥{{ item.groupPrice }}
-
+
原价
- ¥{{item.originalPrice}}
+ ¥{{ item.originalPrice }}
@@ -77,614 +69,590 @@
-
-
+
+
- {{item.groupPeopleNum}}人团
+ {{ item.groupPeopleNum }}人团
- {{item.wareJson.wareName}}
- ¥{{item.payAmount}}
+ {{ item.wareJson.wareName }}
+ ¥{{ item.payAmount }}
- x{{item.num}}
+ x{{ item.num }}
-
-
可核销门店:
- {{item.shopName}}
+ {{ item.shopName }}
- 门店地址:
- {{item.shopAddress}}
+ 门店地址:
+ {{ item.shopAddress }}
-
+
成团时间:
- {{item.groupEndTime}}
+ {{ item.groupEndTime }}
剩余成团时间:
- {{returnTime(item)}}
+ {{ returnTime(item) }}
-
- 查看券码
+
+ 查看券码
-
- 查看券码
+
+ 查看券码
取消退款
- 申请退款
-
+ 申请退款
+
-
-
-
-
\ No newline at end of file
+.copy {
+ width: 28rpx;
+ height: 28rpx;
+}
+
diff --git a/groupBuying/success/index.vue b/groupBuying/success/index.vue
index fe6a867..930cd6f 100644
--- a/groupBuying/success/index.vue
+++ b/groupBuying/success/index.vue
@@ -1,10 +1,8 @@
-
-
+
-
+
@@ -12,69 +10,62 @@
拼团成功
-
+
- 可核销门店:
- {{item.shopName}}
+ 可核销门店:
+ {{ item.shopName }}
- 门店地址:
- {{item.shopAddress}}
+ 门店地址:
+ {{ item.shopAddress }}
-
-
+
- {{item.groupPeopleNum}}人团
+ {{ item.groupPeopleNum }}人团
-
- {{item.wareJson
- .wareName}}
-
+
+ {{ item.wareJson.wareName }}
+
¥
- {{item.wareGroupPrice}}
+ {{ item.wareGroupPrice }}
¥
- {{item.wareOriginalPrice}}
+ {{ item.wareOriginalPrice }}
-
- 数量:{{item.num}}
-
+ 数量:{{ item.num }}
-
-
+
-
+
- 团长
+ 团长
-
- {{user.userName}}
+ {{ user.userName }}
-
-
+
@@ -83,22 +74,17 @@
等待参团
-
-
-
-
-
订单信息
-
- {{showOrder?'收起':'展开'}}
-
+
+ {{ showOrder ? '收起' : '展开' }}
+
@@ -107,116 +93,114 @@
商品总额
- ¥{{item.payAmount}}
+ ¥{{ item.payAmount }}
实付金额
- ¥{{item.payAmount}}
+ ¥{{ item.payAmount }}
订单号
- {{item.orderNo}}
+ {{ item.orderNo }}
支付时间
- {{item.payTime}}
+ {{ item.payTime }}
-
-
-
+
继续拼团
-
+
-
-
-
+
+
-
+
剩余成团时间:
- {{returnNum(0)}}
+ {{ returnNum(0) }}
:
- {{returnNum(1)}}
+ {{ returnNum(1) }}
:
- {{returnNum(2)}}
+ {{ returnNum(2) }}
-
+
- {{item.groupPeopleNum}}人团
+ {{ item.groupPeopleNum }}人团
-
-
- {{item.wareJson
- .wareName}}
-
+
+ {{ item.wareJson.wareName }}
+
¥
- {{item.wareGroupPrice}}
+ {{ item.wareGroupPrice }}
¥
- {{item.wareOriginalPrice}}
+ {{ item.wareOriginalPrice }}
-
- 数量:{{item.num}}
-
+ 数量:{{ item.num }}
-
+
- 可核销门店:
- {{item.shopName}}
+ 可核销门店:
+ {{ item.shopName }}
- 门店地址:
- {{item.shopAddress}}
+ 门店地址:
+ {{ item.shopAddress }}
-
+
-
+
- 团长
+ 团长
-
- {{user.userName}}
+ {{ user.userName }}
-
-
+
@@ -226,10 +210,10 @@
-
- 邀请好友参团
+
+
+ 邀请好友参团
-
@@ -238,9 +222,9 @@
订单信息
-
- {{showOrder?'收起':'展开'}}
-
+
+ {{ showOrder ? '收起' : '展开' }}
+
@@ -249,101 +233,99 @@
商品总额
- ¥{{item.payAmount}}
+ ¥{{ item.payAmount }}
实付金额
- ¥{{item.payAmount}}
+ ¥{{ item.payAmount }}
订单号
- {{item.orderNo}}
+ {{ item.orderNo }}
支付时间
- {{item.payTime}}
+ {{ item.payTime }}
-
-
-
+
-
-
-
+
+
-
+
剩余成团时间:
- {{returnNum(0)}}
+ {{ returnNum(0) }}
:
- {{returnNum(1)}}
+ {{ returnNum(1) }}
:
- {{returnNum(2)}}
+ {{ returnNum(2) }}
-
+
-
+
- {{item.groupPeopleNum}}人团
+ {{ item.groupPeopleNum }}人团
-
-
- {{item.wareJson
- .wareName}}
-
+
+ {{ item.wareJson.wareName }}
+
¥
- {{item.wareGroupPrice}}
+ {{ item.wareGroupPrice }}
¥
- {{item.wareOriginalPrice}}
+ {{ item.wareOriginalPrice }}
-
- 数量:{{item.num}}
-
+ 数量:{{ item.num }}
-
+
- 可核销门店:
- {{item.shopName}}
+ 可核销门店:
+ {{ item.shopName }}
- 门店地址:
- {{item.shopAddress}}
+ 门店地址:
+ {{ item.shopAddress }}
-
-
订单信息
-
- {{showOrder?'收起':'展开'}}
-
+
+ {{ showOrder ? '收起' : '展开' }}
+
@@ -352,583 +334,573 @@
商品总额
- ¥{{item.payAmount}}
+ ¥{{ item.payAmount }}
实付金额
- ¥{{item.payAmount}}
+ ¥{{ item.payAmount }}
订单号
- {{item.orderNo}}
+ {{ item.orderNo }}
支付时间
- {{item.payTime}}
+ {{ item.payTime }}
-
-
-
-
-
\ No newline at end of file
+}
+
diff --git a/pages.json b/pages.json
index 3189a1a..0e89a0e 100644
--- a/pages.json
+++ b/pages.json
@@ -2,6 +2,7 @@
"easycom": {
"autoscan": true,
"custom": {
+ "^my-(.*)": "@/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"
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 379cecf..e462d78 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -5,7 +5,8 @@
-
+
+
@@ -133,424 +134,438 @@
+
\ No newline at end of file
diff --git a/pages/index/indexs.vue b/pages/index/indexs.vue
index 0cfbdc8..77794c3 100644
--- a/pages/index/indexs.vue
+++ b/pages/index/indexs.vue
@@ -2,9 +2,11 @@
-
+
-
+
@@ -118,516 +120,535 @@
+
\ No newline at end of file
diff --git a/pages/order/index.vue b/pages/order/index.vue
index daef0bf..967ee12 100644
--- a/pages/order/index.vue
+++ b/pages/order/index.vue
@@ -70,7 +70,7 @@
v-else-if="item1.isTemporary &&item1.productName=='签子'"
src="https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/5/b97054debd83486ab7ad8e20ca6a360a.png"
>
-
{{ item1.productName }}
@@ -151,7 +151,7 @@
uni.cache.set("shopId", item.shopId);
uni.navigateTo({
url: "/pages/product/index?type=beforehand&order_id=" + item.id +
- '&one_more_order=1',
+ '&one_more_order=1&shopId='+item.shopId,
});
}
})
diff --git a/pages/product/components/goods-modal.vue b/pages/product/components/goods-modal.vue
index 2b1ba2a..e5304cc 100644
--- a/pages/product/components/goods-modal.vue
+++ b/pages/product/components/goods-modal.vue
@@ -13,8 +13,10 @@
-
- {{ goods.name }}
+
+ {{ goods.name }}
+
+
{{ goods.shortTitle ? goods.shortTitle : '' }}
@@ -190,7 +192,7 @@
-
+
¥
@@ -308,6 +310,7 @@
import {
useNavbarStore
} from '@/stores/navbarStore';
+ import ymfShare from '@/components/ymf-components/ymf-share.vue'
const store = useNavbarStore();
const {
showBack,
@@ -479,11 +482,11 @@
const swiperCurrent = ref(0);
function returnFirstSku(product) {
- console.log('returnFirstSku', product.skuList[0]);
+ console.log('returnFirstSku', product);
return {
- ...product.skuList[0],
- sku_id: product.skuList[0].id,
- id: product.id,
+ ...product.skuList[0]||'',
+ sku_id: product.skuList[0].id||'',
+ id: product.id||'',
}
}
//返回是否是多规格商品
@@ -503,8 +506,10 @@
swiperCurrent.value = e.current;
}
- const emits = defineEmits(['prveImgs', 'websocketsendMessage', 'close', 'modalAdd'])
-
+ const emits = defineEmits(['prveImgs', 'websocketsendMessage', 'close', 'modalAdd','shareClick'])
+ function shareClick(){
+ emits('shareClick',props.goods)
+ }
function prveImgs(images, currentUrl) {
emits('prveImgs', images, currentUrl)
}
@@ -831,7 +836,7 @@
padding: 0 28rpx;
margin-top: 20rpx;
font-weight: bold;
- font-size: 32upx;
+ font-size: 32rpx;
margin-bottom: 16rpx;
}
diff --git a/pages/product/index.vue b/pages/product/index.vue
index 65902cc..02219c9 100644
--- a/pages/product/index.vue
+++ b/pages/product/index.vue
@@ -573,17 +573,13 @@
-
-
-
+
+
+
-
+
@@ -749,7 +745,9 @@
useCartStore
} from '@/stores/order.js';
import {
- computed, provide
+ computed,
+ provide,
+ reactive
} from 'vue';
const cartStore = useCartStore();
/**
@@ -819,11 +817,7 @@
- // 分步取值 + 每层兜底,避免某一环不存在导致 undefined
- const shopExtendShopTable = uni.cache.get('shopTable') || {}; // 兜底空对象
- const shopExtendMap = shopExtendShopTable.shopExtendMap || {}; // 兜底空对象
- // 最终声明:即使 shopinfo_bg 不存在,也兜底为空字符串/默认值
- const shopExtend = ref(shopExtendMap.shopinfo_bg || '');
+ const shopExtend = ref('');
/**
* 通用数据合集 end
@@ -874,11 +868,11 @@
* 返回购物车对应的商品数量
*/
function returnGoodsImCartNum(goods) {
- if(!goods){
+ if (!goods) {
return 0
}
if (GoodsIDInCartNumMap.value.hasOwnProperty(goods.id)) {
- return GoodsIDInCartNumMap.value[goods.id]
+ return GoodsIDInCartNumMap.value[goods.id]
}
return 0
}
@@ -1369,13 +1363,14 @@
let res = await APIminiAppinfo(item.id);
prveImgs(res.images);
}
-
- const goodsModalList=ref([])
-
- function goodsModalClose(index){
- goodsModalList.value.splice(index,1)
+
+ const goodsModalList = ref([])
+
+ function goodsModalClose(index) {
+ goodsModalList.value.splice(index, 1)
}
- function modalAdd(item){
+
+ function modalAdd(item) {
clickspecifications(item)
}
@@ -1395,8 +1390,8 @@
if (item.isSoldStock == 1 || (item.isSaleTime == 0 && !item.isSaleTimeshow)) {
return uni.showToast({
- title:'商品已下架或不在可售时间内',
- icon:'none'
+ title: '商品已下架或不在可售时间内',
+ icon: 'none'
});
}
@@ -1444,8 +1439,13 @@
specifications.item.amountcartNumber = 0;
// showShopsku.value = true;
goodsModalList.value.push({
- show:true,
- goods:specifications.item
+ show: true,
+ goods: {
+ ...specifications.item,
+ /*过滤掉只有一个规格且下架的商品或者skuList为空的商品*/
+ relatedRecommendJson: (specifications.item.relatedRecommendJson || []).filter(v => v
+ .skuList && v.skuList.length)
+ }
})
};
// 判断商品是否在可售时间内
@@ -1681,20 +1681,20 @@
// 返回商品对应sku数据
function cartInit(arr) {
-
+
const result = []
cartStore.carts = arr.map(v => {
const goods = cartStore.allGoodsArr.find(g => g.id == v.product_id)
const goodsSkuList = goods ? goods.skuList : []
const findSku = goodsSkuList.find(sku => sku.id == v.sku_id)
const memberPrice = findSku ? findSku.memberPrice : 0
- const is_temporary=v.is_temporary||v.isTemporary
+ const is_temporary = v.is_temporary || v.isTemporary
const is_time_discount = limitUtils.canUseLimitTimeDiscount({
...v,
memberPrice
}, cartStore.limitTimeDiscount, shopInfo,
shopUserInfo.value, 'product_id');
- if (!goods&&!is_temporary) {
+ if (!goods && !is_temporary) {
console.log('删除未匹配到的商品', {
id: v.id,
operate_type: "del",
@@ -1761,8 +1761,11 @@
if (Message.operate_type == 'init') {
// cartStore.limitTimeDiscount = Message.time_dis_info;
cartInit(Message.data)
-
- uni.hideLoading();
+ try {
+ uni.hideLoading();
+ } catch (error) {
+ //TODO handle the exception
+ }
isLoading.value = false;
if (!socketInitFinished) {
@@ -2191,7 +2194,7 @@
// 列表请求
const productqueryProduct = async () => {
cartStore.goodsIsloading = false;
- allGoodsArr.value=[]
+ allGoodsArr.value = []
try {
shopProductList.hots = await productminiApphotsquery();
shopProductList.productInfo = await APIgroupquery();
@@ -2234,7 +2237,7 @@
// console.log('allGoodsArr', allGoodsArr);
// console.log('shopProductList', shopProductList);
console.log('cartStore.carts', cartStore.carts)
- cartStore.allGoodsArr=allGoodsArr.value
+ cartStore.allGoodsArr = allGoodsArr.value
if (cartStore.carts.length > 0) {
cartInit(cartStore.carts);
}
@@ -2256,6 +2259,16 @@
}, 1000);
return false;
}
+
+ if (pageOptions.showGoodsId) {
+ const item = allGoodsArr.value.find(v => v.id == pageOptions.showGoodsId)
+ if (item) {
+ clickspecifications(item)
+ }
+ pageOptions.showGoodsId = null
+ }
+
+
};
provide('cartStore', cartStore);
@@ -2437,28 +2450,90 @@
});
}
+
+ import {
+ shareMixin,
+ handleMixinOnLoad,
+ returnQuery,
+ jsonToUrl,
+ wxShare,
+ returnCommonQuery
+ } from '@/utils/share.js'
+ // defineOptions({
+ // mixins: [shareMixin],
+ // });
+
+
+ let isGoodsShare = ref(false)
+
+ function shareClick() {
+ isGoodsShare.value = true
+ }
+
+ async function onShare() {
+ const queryJson = await returnCommonQuery()
+ let query = jsonToUrl(queryJson)
+ query += '&type=beforehand'
+ let json = {}
+ const shopName = uni.cache.get('shopInfo').shopName || ''
+ if (goodsModalList.value.length && isGoodsShare.value) {
+ const goods = goodsModalList.value[goodsModalList.value.length - 1].goods
+ query += '&showGoodsId=' + goods.id
+ json.title = goods.name + (shopName ? `-${shopName}` : '')
+ json.imageUrl = goods.coverImg
+ json.showGoodsId = goods.id
+ } else {
+ json.title = shopName
+ json.imageUrl = uni.cache.get('shopInfo').logo || ''
+ }
+ console.log('onShareAppMessage', {
+ query,
+ ...json,
+ path: '/pages/product/index' + '?' + query
+ });
+ return wxShare({
+ query,
+ ...json,
+ path: '/pages/product/index' + '?' + query
+ })
+ }
+
+ onShareAppMessage(onShare)
+
+ onShareTimeline(onShare)
+
+ const pageOptions = reactive({})
onLoad(async (e) => {
+ Object.assign(pageOptions, e)
if (e.type) {
orderType.value = e.type;
}
- //获取用户信息
- const userInfo = await APIshopUserInfo({
- shopId: uni.cache.get('shopId')
+
+ await handleMixinOnLoad({
+ ...e,
+ shopId: e.shopId || uni.cache.get('shopId')
})
- //获取店铺信息
- const shopInfoRes = await APIusershopInfodetail({
- shopId: uni.cache.get('shopId')
- });
- if (shopInfoRes && shopInfoRes.shopInfo) {
- Object.assign(shopInfo, shopInfoRes.shopInfo);
- uni.cache.set('shopInfo', shopInfoRes.shopInfo)
+
+ if(userStore.shopUserInfo.shopExtendList){
+ shopExtend.value=userStore.shopUserInfo.shopExtendList.find(v=>v.autoKey=='shopinfo_bg')||''
}
-
- if (userInfo && typeof userInfo === 'object') {
- shopUserInfo.value = userInfo
- uni.cache.set('shopUserInfo', userInfo)
+ // //获取用户信息
+ // const userInfo = await APIshopUserInfo({
+ // shopId: uni.cache.get('shopId')
+ // })
+ // //获取店铺信息
+ // const shopInfoRes = await APIusershopInfodetail({
+ // shopId: uni.cache.get('shopId')
+ // });
+ Object.assign(shopInfo, userStore.shopInfo);
+ if (e.type == 'beforehand') {
+ uni.cache.set("tableCode", userStore.shopUserInfo.id);
+ options.initMessage.table_code = userStore.shopUserInfo.id
}
+ options.initMessage.shop_id = userStore.shopInfo.id
+ shopUserInfo.value = userStore.shopUserInfo
+
await productqueryProduct();
const extraInitPar = {}
@@ -2470,6 +2545,11 @@
const time_dis_info = await getLimitDiscount()
options.initMessage.time_dis_info = time_dis_info
+
+ console.log('options.initMessage', {
+ ...options.initMessage,
+ ...extraInitPar,
+ })
useSocket.connect({
...options.initMessage,
...extraInitPar,
@@ -2590,6 +2670,7 @@
useSocket.setOnMessage(() => {});
}
onHide(() => {
+ isGoodsShare.value = false
closeSocket();
});
onUnload(() => {
diff --git a/pages/user/member/czzx.vue b/pages/user/member/czzx.vue
index cf2712b..598a095 100644
--- a/pages/user/member/czzx.vue
+++ b/pages/user/member/czzx.vue
@@ -1,461 +1,498 @@
-
-
-
-
-
-
-
- 立即充值
-
-
- 充值代表接受
- 《用户隐私协议》
-
-
-
-
-
- ¥
- {{ item.amount }}
-
-
- 赠
- ¥
- {{ item.rewardAmount }}
-
-
- 送
- {{ item.rewardPoints }}
- 积分
-
-
- 送
- {{ couponNum(item.couponInfoList) }}
- 张券
- 查看
-
+
+
+
+
+
+
+
+ 立即充值
+
+
+ 充值代表接受
+ 《用户隐私协议》
+
+
+
+
+
+ ¥
+ {{ item.amount }}
+
+
+ 赠
+ ¥
+ {{ item.rewardAmount }}
+
+
+ 送
+ {{ item.rewardPoints }}
+ 积分
+
+
+ 送
+ {{ couponNum(item.couponInfoList) }}
+ 张券
+ 查看
+
-
-
-
-
-
-
-
- 其他金额
-
-
- 自定义金额充值时,不享受任何优惠赠送
-
+
+
+
+
+
+
+
+ 其他金额
+
+
+ 自定义金额充值时,不享受任何优惠赠送
+
-
-
- 充值说明
-
- 适用门店
- 全国门店通用 {{ ">" }}
-
-
-
- 有效期限
- 永久有效
-
-
- 注意事项
-
- 1.储值完成后不支持自助退款,可联系商家处理
- 2.余额不支持转赠,不可提现,长期有效
-
-
-
- 充值说明
-
- {{ state.remark || "" }}
-
-
-
-
-
-
+
+
+ 充值说明
+
+ 适用门店
+ 全国门店通用 {{ '>' }}
+
+
+ 有效期限
+ 永久有效
+
+
+ 注意事项
+
+ 1.储值完成后不支持自助退款,可联系商家处理
+ 2.余额不支持转赠,不可提现,长期有效
+
+
+
+ 充值说明
+
+ {{ state.remark || '' }}
+
+
+
+
+
+
\ No newline at end of file
+
diff --git a/scoreShop/detail/index.vue b/scoreShop/detail/index.vue
index 3ad9b36..66606d0 100644
--- a/scoreShop/detail/index.vue
+++ b/scoreShop/detail/index.vue
@@ -8,7 +8,7 @@
-
+
@@ -27,7 +27,10 @@
剩余:{{item.quantity}}
- {{item.goodsName}}
+
+ {{item.goodsName}}
+
+
@@ -55,10 +58,10 @@
-
+
{{returnBtmText}}
-
+
{{returnBtmText}}
@@ -84,7 +87,7 @@
-
+
@@ -116,6 +119,7 @@
@@ -463,11 +520,12 @@
height: 184rpx;
border-radius: 16rpx;
background: #d9d9d9;
- &.bg-fff{
+
+ &.bg-fff {
background-color: #fff;
}
}
-
+
}
.bottom {
@@ -487,7 +545,8 @@
font-size: 700;
}
}
- .w-full{
+
+ .w-full {
width: 100%;
}
\ No newline at end of file
diff --git a/scoreShop/index/components/goods-list.vue b/scoreShop/index/components/goods-list.vue
index 08c8b13..3ab17f1 100644
--- a/scoreShop/index/components/goods-list.vue
+++ b/scoreShop/index/components/goods-list.vue
@@ -74,7 +74,7 @@
function toDetail(item) {
uni.setStorageSync('exchange_goods', item)
uni.navigateTo({
- url: '/scoreShop/detail/index?id=' + item.id,
+ url: '/scoreShop/detail/index?id=' + item.id+'&shopId='+item.shopId,
})
}
diff --git a/scoreShop/index/index.vue b/scoreShop/index/index.vue
index 268e5c9..0ed234b 100644
--- a/scoreShop/index/index.vue
+++ b/scoreShop/index/index.vue
@@ -31,9 +31,13 @@
优惠券
其它商品
-
-
+
+
+
+
+
+
@@ -44,6 +48,7 @@
+ .success {
+ width: 310rpx;
+ height: 206rpx;
+ }
+ }
+
+ .info {
+ padding-left: 174rpx;
+ padding-right: 32rpx;
+ }
+ }
+
+ .bottom {
+ gap: 48rpx;
+ margin-top: 44rpx;
+
+ .btn {
+ padding: 14rpx 76rpx;
+ border-radius: 100rpx;
+ font-size: 32rpx;
+ border: 1px solid transparent;
+
+ &.back {
+ border-color: $my-main-color;
+ color: $my-main-color;
+ }
+
+ &.look {
+ background-color: $my-main-color;
+ border-color: $my-main-color;
+ color: #fff;
+ }
+ }
+ }
+
\ No newline at end of file
diff --git a/src/auto-imports.d.ts b/src/auto-imports.d.ts
index e69ecf0..a974851 100644
--- a/src/auto-imports.d.ts
+++ b/src/auto-imports.d.ts
@@ -39,6 +39,7 @@ declare global {
const onScopeDispose: typeof import('vue')['onScopeDispose']
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
const onShareAppMessage: typeof import('@dcloudio/uni-app')['onShareAppMessage']
+ const onShareTimeline: typeof import('@dcloudio/uni-app')['onShareTimeline']
const onShow: typeof import('@dcloudio/uni-app')['onShow']
const onUnload: typeof import('@dcloudio/uni-app')['onUnload']
const onUnmounted: typeof import('vue')['onUnmounted']
diff --git a/stores/carts-websocket.js b/stores/carts-websocket.js
index c79e699..95c6fc2 100644
--- a/stores/carts-websocket.js
+++ b/stores/carts-websocket.js
@@ -90,11 +90,13 @@ export const useWebSocket = defineStore('socketTask', () => {
let onMessage = () => {
}
- function setOnMessage(onMessageBallBack){
- onMessage=onMessageBallBack
+
+ function setOnMessage(onMessageBallBack) {
+ onMessage = onMessageBallBack
}
- function chnageInitMessage(data){
- initMessage=data
+
+ function chnageInitMessage(data) {
+ initMessage = data
}
// 连接 WebSocket
const connect = async (connectMsg, onMessageBallBack) => {
@@ -127,6 +129,8 @@ export const useWebSocket = defineStore('socketTask', () => {
url: uni.conf.baseUrlwws + '?' + Date.now(),
success: (res) => {
console.log('连接成功');
+ console.log('connectMsg', connectMsg);
+ console.log('initMessage', initMessage);
isConnected.value = true;
// 监听初始化成功在开启心跳
startHeartbeat();
@@ -233,7 +237,7 @@ export const useWebSocket = defineStore('socketTask', () => {
// 发送消息
const sendMessage = (data) => {
- if(!data){
+ if (!data) {
return
}
if (isConnected.value && data) {
@@ -369,6 +373,8 @@ export const useWebSocket = defineStore('socketTask', () => {
initNetworkListener,
connect,
allowReconnect,
- socketTask,setOnMessage,chnageInitMessage
+ socketTask,
+ setOnMessage,
+ chnageInitMessage
};
})
\ No newline at end of file
diff --git a/stores/user.js b/stores/user.js
index f271a91..ebba0a2 100644
--- a/stores/user.js
+++ b/stores/user.js
@@ -49,7 +49,7 @@ export const Storelogin = defineStore("login", {
rawData: infoRes.rawData,
source: "wechat",
});
- console.log('APIuserlogin',res);
+ console.log('APIuserlogin', res);
if (res) {
this.token = res.token;
this.miniAppOpenId = res.userInfo
@@ -110,12 +110,90 @@ export const productStore = defineStore("product", {
latitude: "",
longitude: "",
},
+ token: "",
+ miniAppOpenId: "",
+ userInfo: "",
+ shopId: uni.cache.get('shopId') || '',
shopInfo: {
shopId: "",
isOrderFence: 0,
+ id: '',
},
+ shopUserInfo:{
+
+ },
+ isHasLogin:false
}),
actions: {
+ actionslogin() {
+ return new Promise(async (resolve, reject) => {
+ // #ifdef MP-WEIXIN
+ uni.login({
+ provider: "weixin",
+ success: (data) => {
+ // 微信小程序环境
+ uni.getUserInfo({
+ provider: "weixin",
+ success: async (infoRes) => {
+ let res = await APIuserlogin({
+ code: data.code, //临时登录凭证
+ rawData: infoRes.rawData,
+ source: "wechat",
+ });
+ console.log('APIuserlogin', res);
+ if (res) {
+ this.token = res.token;
+ this.isHasLogin=true
+ this.miniAppOpenId = res.userInfo
+ .miniAppOpenId;
+ this.userInfo = res.userInfo;
+ uni.cache.set("token", res.token);
+ uni.cache.set("userInfo", res.userInfo);
+ uni.cache.set("followIndex", res
+ .followIndex || "");
+ }
+ resolve(true);
+ },
+ fail: (err) => {
+ reject(false);
+ },
+ });
+ },
+ });
+ // #endif
+ // #ifdef MP-ALIPAY
+ my.getAuthCode({
+ scopes: "auth_base",
+ success: async (data) => {
+ // 支付宝小程序环境
+ // my.getAuthUserInfo({
+ // success: async (infoRes) => {
+ let res = await APIuserlogin({
+ code: data.authCode, //临时登录凭证
+ // rawData: JSON.stringify(infoRes),
+ source: "alipay",
+ });
+ if (res) {
+ this.isHasLogin=true
+ this.token = res.token;
+ this.miniAppOpenId = res.userInfo.miniAppOpenId;
+ this.userInfo = res.userInfo;
+ uni.cache.set("token", res.token);
+ uni.cache.set("openId", res.userInfo.alipayOpenId);
+ uni.cache.set("userInfo", res.userInfo);
+ resolve(true);
+ }
+ },
+ fail: () => {
+ reject(false);
+ },
+ });
+ // #endif
+ // #ifdef H5
+ resolve(true)
+ // #endif
+ });
+ },
getLocation() {
return new Promise((resolve, reject) => {
console.log("获取经纬度");
@@ -185,11 +263,11 @@ export const productStore = defineStore("product", {
console.log("扫码内容", q);
// #ifdef H5
uni.navigateTo({
- url:'/pages/product/index'
+ url: '/pages/product/index'
})
- return
+ return
// #endif
-
+
return new Promise(async (resolve, reject) => {
if (q) {
console.log(q);
@@ -448,19 +526,43 @@ export const productStore = defineStore("product", {
// 通过shopId 获取店铺会员信息
actionsproductqueryProduct() {
+ console.log('actionsproductqueryProduct:token',uni.cache.get('token'));
return new Promise(async (resolve, reject) => {
try {
let res = await APIshopUserInfo();
- uni.cache.set("shopUserInfo", res);
- uni.cache.set("orderVIP", res);
- uni.cache.set("ordershopUserInfo", res.shopInfo);
- resolve(res);
+ if(res&& typeof res === 'object'){
+ this.shopUserInfo=res;
+ uni.cache.set("shopUserInfo", res);
+ uni.cache.set("orderVIP", res);
+ uni.cache.set("ordershopUserInfo", res.shopInfo);
+ resolve(res);
+ }else{
+ reject(false);
+ }
+
} catch (e) {
reject(false);
}
});
},
+ async pageOnload() {
+ console.log('开始加载必须数据')
+ //登录
+ await this.actionslogin()
+ //获取会员信息
+ await this.actionsproductqueryProduct()
+ //获取店铺信息
+ await this.getShopInfo()
+ console.log('必须数据加载完毕')
+ },
+ async getShopInfo(shopId) {
+ const shopRes = await APIusershopInfodetail({
+ shopId: this.shopId || shopId,
+ });
+ this.shopInfo = shopRes.shopInfo;
+ uni.cache.set("shopInfo", shopRes.shopInfo);
+ },
// 用户信息获取
actionsAPIuser() {
return new Promise(async (resolve, reject) => {
diff --git a/userPackage/goodsDetail/goodsDetail.vue b/userPackage/goodsDetail/goodsDetail.vue
index a35cbb7..6ee61b6 100644
--- a/userPackage/goodsDetail/goodsDetail.vue
+++ b/userPackage/goodsDetail/goodsDetail.vue
@@ -10,30 +10,30 @@
- ¥{{item.price}}
- ¥{{item.originPrice}}
+ ¥{{ item.price }}
+ ¥{{ item.originPrice }}
- 限购{{item.limitBuyNum}}份
- 已售:{{item.saleNum||0}}
+ 限购{{ item.limitBuyNum }}份
+ 已售:{{ item.saleNum || 0 }}
- {{item.packageName}}
+ {{ item.packageName }}
- {{item.description}}
+ {{ item.description }}
- 可核销门店:
- {{item.shopName}}
+ 可核销门店:
+ {{ item.shopName }}
- 门店地址:
- {{item.shopAddress}}
+ 门店地址:
+ {{ item.shopAddress }}
@@ -41,76 +41,63 @@
立即拼团
-
+
- {{item.nickName}}
- 差{{returnNeedPerpole(item)}}人拼成
+ {{ item.nickName }}
+ 差{{ returnNeedPerpole(item) }}人拼成
剩余:
- {{getRemainingHMS(item)}}
+ {{ getRemainingHMS(item) }}
快速拼成
-
-
-
-
套餐商品
-
- {{showGroup?'收起':'展开'}}
-
+
+ {{ showGroup ? '收起' : '展开' }}
+
-
-
+
- {{item.name}}
- {{item.packageProducts.length}}选{{item.num}}
+ {{ item.name }}
+ {{ item.packageProducts.length }}选{{ item.num }}
-
- {{goods.name}}
+
+ {{ goods.name }}
- x{{goods.num}}
- ¥{{goods.price}}
+ x{{ goods.num }}
+ ¥{{ goods.price }}
-
-
-
-
-
-
-
+
分享说明
-
- {{showDesc?'收起':'展开'}}
-
+
+ {{ showDesc ? '收起' : '展开' }}
+
-
@@ -118,90 +105,58 @@
分享人数
购买价格(元)
-
- {{step.peopleNum}}
- ¥{{step.price}}
+
+ {{ step.peopleNum }}
+ ¥{{ step.price }}
-
-
- 分享期限(小时):{{item.expireHours}}
-
-
- 规定期限内的助力才会被计入
-
-
- 如何才是分享成功?被分享人只需要点击《助力》,提示助力成功后即可
-
-
-
-
+
+ 分享期限(小时):{{ item.expireHours }}
+ 规定期限内的助力才会被计入
+ 如何才是分享成功?被分享人只需要点击《助力》,提示助力成功后即可
-
-
-
-
-
-
+
使用说明
-
- {{useDescShow?'收起':'展开'}}
-
+
+ {{ useDescShow ? '收起' : '展开' }}
+
-
-
- 1、可用时间段:{{canuseTime}}
-
-
- 2、其他使用说明:{{item.otherDesc}}
-
+ 1、可用时间段:{{ canuseTime }}
+ 2、其他使用说明:{{ item.otherDesc }}
-
-
-
-
-
-
-
-
+
商品详情
-
-
+
-
+
- {{returnBtmText}}
+ {{ returnBtmText }}
-
- 发起助力
-
-
+ 发起助力
-
-
-
-
+
合计:
- {{totalPrice}}
+ {{ totalPrice }}
- {{number}}
+ {{ number }}
-
@@ -249,636 +202,614 @@
\ No newline at end of file
+}
+
+.guodu {
+ transition: all 0.3s;
+}
+
diff --git a/userPackage/order/detail.vue b/userPackage/order/detail.vue
index a73ae05..c5023bc 100644
--- a/userPackage/order/detail.vue
+++ b/userPackage/order/detail.vue
@@ -1,171 +1,169 @@
-
-
-
+
+
-
+
剩余助力时间:
- {{returnNum(0)}}
+ {{ returnNum(0) }}
:
- {{returnNum(1)}}
+ {{ returnNum(1) }}
:
- {{returnNum(2)}}
+ {{ returnNum(2) }}
-
- 阶梯优惠
+ 阶梯优惠
-
-
- {{item.packageInfo
-.packageName}}
-
- {{item.packageInfo.description}}
+
+
+ {{ item.packageInfo.packageName }}
+ {{ item.packageInfo.description }}
-
+
-
+
-
-
-
- 当前到手
-
-
- ¥
- {{nowPrice}}
-
-
- ¥{{item.packageInfo.originPrice}}
+
+ 当前到手
+
+ ¥
+ {{ nowPrice }}
+ ¥{{ item.packageInfo.originPrice }}
-
- ¥
- {{item.finalPrice}}
-
-
- ¥{{item.packageInfo.originPrice}}
+
+ ¥
+ {{ item.finalPrice }}
+ ¥{{ item.packageInfo.originPrice }}
-
- ¥
- {{item.packageInfo.price}}
-
-
- ¥{{item.packageInfo.originPrice}}
+
+ ¥
+ {{ item.packageInfo.price }}
+ ¥{{ item.packageInfo.originPrice }}
-
-
- ¥
- {{item.finalPrice}}
-
-
- ¥{{item.packageInfo.originPrice}}
+
+ ¥
+ {{ item.finalPrice }}
+ ¥{{ item.packageInfo.originPrice }}
-
-
- 已申请退款,需等待商家审核
- 当前订单已失效
- 当前订单已失效
+ 已申请退款,需等待商家审核
+ 当前订单已失效
+ 当前订单已失效
-
+
- {{item.verifyCode}}
-
-
+ {{ item.verifyCode }}
+
-
+
- 可核销门店:
- {{item.shopName}}
+ 可核销门店:
+ {{ item.shopName }}
- 门店地址:
- {{item.shopAddress}}
+ 门店地址:
+ {{ item.shopAddress }}
- 已成功分享{{item.shareNum||0}}人
+ 已成功分享{{ item.shareNum || 0 }}人
-
-
- 查看全部
-
-
-
-
-
- 已成功分享{{item.shareNum||0}}人
-
-
+
查看全部
+
+ 已成功分享{{ item.shareNum || 0 }}人
-
+
+ 查看全部
+
+
+
+
+
-
+
- 已分享{{item.shareNum||0}}人
-
- 分享{{maxNum}}人,
- {{minPrice}}元
+ 已分享{{ item.shareNum || 0 }}人
+
+ 分享{{ maxNum }}人,
+ {{ minPrice }}元
即可购买
分享说明
-
- {{showDesc?'收起':'展开'}}
-
+
+ {{ showDesc ? '收起' : '展开' }}
+
-
@@ -174,24 +172,16 @@
分享人数
购买价格(元)
-
- {{step.peopleNum}}
- ¥{{step.price}}
+
+ {{ step.peopleNum }}
+ ¥{{ step.price }}
-
- 分享期限(小时):{{item.packageInfo.expireHours}}
-
-
- 规定期限内的助力才会被计入
-
-
- 如何才是分享成功?被分享人只需要点击《助力》,提示助力成功后即可
-
-
+ 分享期限(小时):{{ item.packageInfo.expireHours }}
+ 规定期限内的助力才会被计入
+ 如何才是分享成功?被分享人只需要点击《助力》,提示助力成功后即可
@@ -199,13 +189,12 @@
分享说明
-
- {{showDesc?'收起':'展开'}}
-
+
+ {{ showDesc ? '收起' : '展开' }}
+
-
@@ -214,146 +203,123 @@
分享人数
购买价格(元)
-
- {{step.peopleNum}}
- ¥{{step.price}}
+
+ {{ step.peopleNum }}
+ ¥{{ step.price }}
-
- 分享期限(小时):{{item.packageInfo.expireHours}}
-
-
- 规定期限内的助力才会被计入
-
-
- 如何才是分享成功?被分享人只需要点击《助力》,提示助力成功后即可
-
-
+ 分享期限(小时):{{ item.packageInfo.expireHours }}
+ 规定期限内的助力才会被计入
+ 如何才是分享成功?被分享人只需要点击《助力》,提示助力成功后即可
-
-
-
+
订单信息
-
- {{showOrder?'收起':'展开'}}
-
+
+ {{ showOrder ? '收起' : '展开' }}
+
-
实付金额
- ¥{{item.finalPrice}}
+ ¥{{ item.finalPrice }}
订单号
- {{item.orderNo}}
+ {{ item.orderNo }}
支付时间
- {{item.payTime}}
+ {{ item.payTime }}
核销时间
- {{item.verifyTime}}
+ {{ item.verifyTime }}
-
-
-
-
-
+
-
+
-
+
取消活动
立即购买
-
-
+
取消活动
立即购买
-
- 申请退款
+
+ 申请退款
-
+
-
-
-
-
+
+
- 已经助力过了
-
+ 已经助力过了
-
-
\ No newline at end of file
+.share-text {
+ color: #ed5a2e;
+}
+
diff --git a/utils/share.js b/utils/share.js
index c98a91b..8666384 100644
--- a/utils/share.js
+++ b/utils/share.js
@@ -1,3 +1,15 @@
+import {
+ autoBindInviteUser,
+ autoGetInviteCode
+} from '@/common/api/market/distribution.js'
+import {
+ APIshopUserInfo,
+ APIusershopInfodetail
+} from '@/common/api/member.js'
+import {
+ productStore
+} from '@/stores/user.js';
+const accountStore = productStore();
const accountInfo = wx.getAccountInfoSync();
export const envVersion = accountInfo.miniProgram.envVersion;
let type = 3;
@@ -13,9 +25,306 @@ if (envVersion === 'trial') {
}
+/**
+ * 绑定用户邀请关系(核心函数)
+ * 功能说明:校验邀请码有效性,有效则调用自动绑定接口完成邀请关系绑定
+ * @param {Object} args - 绑定邀请关系的入参对象
+ * @param {number} [args.shopUserId] - 需要绑定邀请人的用户ID(integer ,可选)
+ * @param {number} [args.shopId] - 店铺ID(integer ,可选)
+ * @param {string} args.inviteCode - 邀请人的邀请码(必填,非空校验通过后才会执行绑定逻辑)
+ * @returns {void} 无返回值
+ */
+export async function bindInvite(args) {
+ // 解构入参对象,获取需要的核心参数
+ const {
+ shopUserId,
+ shopId,
+ inviteCode
+ } = args;
+
+ // 校验邀请码有效性:若邀请码为空、null、undefined,则直接返回,不执行后续绑定逻辑
+ if (!inviteCode || inviteCode === null || inviteCode === undefined) {
+ return;
+ }
+
+ const shopUserInfo = uni.cache.get('shopUserInfo')
+ // 邀请码有效,调用自动绑定邀请人接口,传递绑定所需参数
+ return await autoBindInviteUser({
+ id: shopUserInfo.id,
+ shopId,
+ inviteCode
+ });
+}
+
export function wxShare(par) {
return {
...par,
type
}
-}
\ No newline at end of file
+}
+
+export async function returnCommonQuery() {
+ const shopId = uni.cache.get('shopId')
+ const shopUserInfo = uni.cache.get('shopUserInfo')
+ const shopInfo = uni.cache.get('shopInfo')
+ const inviteCode = await autoGetInviteCode({
+ shopId: shopId,
+ shopUserId: shopUserInfo.id
+ })
+
+ const queryJson = {
+ inviteCode: (inviteCode && inviteCode !== true) ? inviteCode : null,
+ shopId,
+ shopUserId: shopUserInfo.id,
+ }
+ return Promise.resolve(queryJson)
+}
+
+export function jsonToUrl(json) {
+ let result = ''
+ for (let key in json) {
+ if (json[key]) {
+ if (result === '') {
+ result += `${key}=${json[key]}`
+ } else {
+ result += `&${key}=${json[key]}`
+ }
+ }
+ }
+ return result
+}
+
+/**
+ * @param {Object} query 参数对象
+ * @param {Array} showkeys 需要显示的key不包括公共参数
+ */
+export async function returnQuery(query, showkeys) {
+
+
+ const shopId = uni.cache.get('shopId')
+ const shopUserInfo = uni.cache.get('shopUserInfo')
+ const shopInfo = uni.cache.get('shopInfo')
+ const inviteCode = await autoGetInviteCode({
+ shopId: shopId,
+ shopUserId: shopUserInfo.id
+ })
+
+ const pages = getCurrentPages();
+ const currentPage = pages[pages.length - 1];
+ const currentPath = currentPage.route;
+ const currentOptions = currentPage.options;
+
+
+ let sharePath = `/${currentPath}`;
+ const queryJson = {
+ inviteCode: (inviteCode && inviteCode !== true) ? inviteCode : null,
+ shopId,
+ shopUserId: shopUserInfo.id,
+ ...query
+ }
+ for (const key in currentOptions) {
+ if (currentOptions.hasOwnProperty(key)) {
+ if (showkeys && Array.isArray(showkeys) && showkeys.includes(key)) {
+ queryJson[key] = encodeURIComponent(currentOptions[key])
+ } else {
+ queryJson[key] = encodeURIComponent(currentOptions[key])
+ }
+ }
+ }
+ queryJson.shopId = shopId
+ queryJson.inviteCode = (inviteCode && inviteCode !== true) ? inviteCode : null
+ queryJson.shopUserId = shopUserInfo.id
+
+ let result = ''
+ for (let key in queryJson) {
+ if (queryJson[key]) {
+ if (result === '') {
+ result += `${key}=${queryJson[key]}`
+ } else {
+ result += `&${key}=${queryJson[key]}`
+ }
+ }
+ }
+ return Promise.resolve(result)
+}
+
+function parseQueryString(queryString) {
+ const queryParams = queryString.split("&").map((param) => param.split("="));
+ const params = {};
+ for (const [key, value] of queryParams) {
+ params[key] = value;
+ }
+ return params;
+}
+/**
+ * 混入的 onLoad 核心逻辑(抽成独立函数)
+ * @param {Object} opt - 页面 onLoad 接收的参数
+ * @param {Object} vm - 组件实例(this)
+ */
+export async function handleMixinOnLoad(opt, vm) {
+ console.log('onLoad');
+ const options = {}
+ if (opt.q) {
+ const q = decodeURIComponent(opt.q);
+ const params = parseQueryString(q.split("?")[1]);
+ Object.assign(options, params);
+ } else {
+ Object.assign(options, opt);
+ }
+ console.log('options', options);
+ if (options.shopId) {
+ uni.cache.set('shopId', options.shopId)
+ accountStore.shopId = options.shopId
+ await accountStore.pageOnload()
+ }
+ uni.setStorageSync('loadFinsh', true)
+ // const shopId = uni.cache.get('shopId')
+ // const shopUserInfo = uni.cache.get('shopUserInfo')
+ // const shopInfo = uni.cache.get('shopInfo')
+ // const inviteCode = await autoGetInviteCode({
+ // shopId: shopId,
+ // shopUserId: shopUserInfo.id
+ // })
+ if (options.inviteCode) {
+ return await bindInvite(options)
+ }
+}
+
+import {
+ isJsonArrayString
+} from '@/utils/util.js';
+
+
+/**
+ * 返回店铺首页图片
+ */
+export function returnIndexBg() {
+ try {
+ const orderVIP = uni.cache.get('orderVIP')
+ if (!orderVIP || !orderVIP.shopExtendList) {
+ return ''
+ }
+ if (!isJsonArrayString(orderVIP.shopExtendList[0].value)) {
+ return ''
+ }
+ return JSON.parse(orderVIP.shopExtendList[0].value)[0]
+ } catch (error) {
+ console.error('orderVIP.shopExtendList[0].value 格式不正确')
+ return ''
+ //TODO handle the exception
+ }
+
+
+}
+
+// utils/share.js
+export const shareMixin = {
+
+ // async 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')
+ const pages = getCurrentPages();
+ const currentPage = pages[pages.length - 1];
+ const currentPath = currentPage.route;
+ const currentOptions = currentPage.options;
+
+ let sharePath = `/${currentPath}`;
+
+
+ const query = await returnQuery()
+ const indexBg = returnIndexBg()
+ console.log('indexBg', indexBg);
+ const imageUrl = indexBg || shopInfo.logo
+ // 全局默认配置(可被页面覆盖)
+ const defaultShareConfig = {
+ title: shopInfo.shopName,
+ path: sharePath + '?' + query,
+ imageUrl: imageUrl,
+ query,
+ // desc: '描述',
+ success: (res) => {
+ console.log('分享好友成功', res);
+ // 可加埋点等统一逻辑
+ },
+ fail: (err) => {
+ console.error('分享好友失败', err);
+ }
+ };
+
+
+ // 页面自定义配置覆盖全局
+ const pageShareConfig = this.$options.shareConfig || {};
+ console.log('mixIn onShareAppMessage', {
+ ...defaultShareConfig,
+ ...pageShareConfig
+ })
+ return wxShare({
+ ...defaultShareConfig,
+ ...pageShareConfig
+ });
+ },
+
+
+
+ async onShareTimeline() {
+
+
+
+ const shopInfo = uni.cache.get('shopInfo')
+
+ const pages = getCurrentPages();
+ const currentPage = pages[pages.length - 1];
+ const currentPath = currentPage.route;
+ const currentOptions = currentPage.options;
+
+
+ let sharePath = `/${currentPath}`;
+
+
+ const query = await returnQuery()
+ const indexBg = returnIndexBg()
+ const imageUrl = indexBg || shopInfo.logo
+ const defaultTimelineConfig = {
+ title: shopInfo.shopName,
+ path: sharePath + '?' + query,
+ imageUrl: imageUrl,
+ query,
+ };
+
+ const pageTimelineConfig = this.$options.shareTimelineConfig || {};
+ return wxShare({
+ ...defaultTimelineConfig,
+ ...pageTimelineConfig
+ });
+ }
+};
\ No newline at end of file
diff --git a/vite.config.js b/vite.config.js
index b43d49c..540a99f 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -15,6 +15,7 @@ module.exports = defineConfig({
{
"@dcloudio/uni-app": [
"onShareAppMessage",
+ "onShareTimeline",
"onLoad",
"onShow",
"onHide",