商品团购分享处理
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<script lang='ts'>
|
<script lang='ts'>
|
||||||
import {
|
import {
|
||||||
getCompanyId,
|
getCompanyId, getQueryParam,
|
||||||
getRegisterStoreId,
|
getRegisterStoreId,
|
||||||
mpUpdate,
|
mpUpdate,
|
||||||
setCompanyId,
|
setCompanyId,
|
||||||
@@ -85,12 +85,6 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(options?.query.scene) {
|
if(options?.query.scene) {
|
||||||
function getQueryParam(queryParams: string, key: string) {
|
|
||||||
let regex = new RegExp('(?:[?&]|^)' + key + '=([^&]+)'),
|
|
||||||
match = queryParams.match(regex);
|
|
||||||
return match && match[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
//保存注册门店id
|
//保存注册门店id
|
||||||
const params = decodeURIComponent(options?.query.scene);
|
const params = decodeURIComponent(options?.query.scene);
|
||||||
if(params.includes('companyId')) {
|
if(params.includes('companyId')) {
|
||||||
|
@@ -1,14 +1,16 @@
|
|||||||
import { get } from '@/utils';
|
import { get, post } from '@/utils';
|
||||||
import { CategoryBean, GoodsBean } from '@/api/goods/types';
|
import { CategoryBean, GoodsBean } from '@/api/goods/types';
|
||||||
|
|
||||||
enum URL {
|
enum URL {
|
||||||
categoryList = '/ext/goods/category_list',
|
categoryList = '/ext/goods/category_list',
|
||||||
goodsList = '/ext/goods/query',
|
goodsList = '/ext/goods/query',
|
||||||
goodsDetail = '/ext/goods/info'
|
goodsDetail = '/ext/goods/info',
|
||||||
|
shareGoodsDetail = '/wechat/coupons/group/qrcode'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getCategoryList = () => get<CategoryBean[]>({ url: URL.categoryList });
|
export const getCategoryList = () => get<CategoryBean[]>({ url: URL.categoryList });
|
||||||
|
|
||||||
export const getGoodsList = (params: any) => get<GoodsBean[]>({ url: URL.goodsList, data: params });
|
export const getGoodsList = (params: any) => get<GoodsBean[]>({ url: URL.goodsList, data: params });
|
||||||
|
|
||||||
export const getGoodsDetail = (goodsId: string) => get<GoodsBean>({ url: URL.goodsDetail + `?goodsId=${goodsId}` });
|
export const getGoodsDetail = (goodsId: string) => get<GoodsBean>({ url: URL.goodsDetail + `?goodsId=${goodsId}` });
|
||||||
|
|
||||||
|
export const getShareGoodsDetail = (shareId: string) => post<GoodsBean>({ url: URL.shareGoodsDetail + `/${shareId}` });
|
||||||
|
@@ -2,8 +2,8 @@
|
|||||||
"name": "SUKE-MP",
|
"name": "SUKE-MP",
|
||||||
"appid": "",
|
"appid": "",
|
||||||
"description": "",
|
"description": "",
|
||||||
"versionName": "3.0.2",
|
"versionName": "3.0.3",
|
||||||
"versionCode": "302",
|
"versionCode": "303",
|
||||||
"transformPx": false,
|
"transformPx": false,
|
||||||
"app-plus": {
|
"app-plus": {
|
||||||
"usingComponents": true,
|
"usingComponents": true,
|
||||||
|
@@ -144,7 +144,7 @@ import SkuDialog from '@/components/sku-dialog.vue';
|
|||||||
import CouponItem from './components/coupon-item.vue';
|
import CouponItem from './components/coupon-item.vue';
|
||||||
|
|
||||||
import { getGroupBuyDetail, getGroupBuyRecordList, preOrder } from '@/api/groupbuy';
|
import { getGroupBuyDetail, getGroupBuyRecordList, preOrder } from '@/api/groupbuy';
|
||||||
import { getGoodsList } from '@/api/goods';
|
import { getGoodsList, getShareGoodsDetail } from '@/api/goods';
|
||||||
import { GoodsBean } from '@/api/goods/types';
|
import { GoodsBean } from '@/api/goods/types';
|
||||||
import { useUserStore } from '@/store';
|
import { useUserStore } from '@/store';
|
||||||
import { GroupBuyBean, RecordBean } from '@/api/groupbuy/types';
|
import { GroupBuyBean, RecordBean } from '@/api/groupbuy/types';
|
||||||
@@ -173,7 +173,13 @@ const currentPageNum = ref(1);
|
|||||||
onLoad(async (e: any) => {
|
onLoad(async (e: any) => {
|
||||||
if(isLogin()) {
|
if(isLogin()) {
|
||||||
await uni.showLoading();
|
await uni.showLoading();
|
||||||
groupBuyBean.value = await getGroupBuyDetail(e.id);
|
if(e.id != undefined) {
|
||||||
|
groupBuyBean.value = await getGroupBuyDetail(e.id);
|
||||||
|
}
|
||||||
|
if(e.shareId != undefined) {
|
||||||
|
const { group, share } = await getShareGoodsDetail(e.shareId);
|
||||||
|
groupBuyBean.value = group;
|
||||||
|
}
|
||||||
// setCompanyId('1512403904150138881');
|
// setCompanyId('1512403904150138881');
|
||||||
// groupBuyBean.value = await getGroupBuyDetail('1740922051118063618');
|
// groupBuyBean.value = await getGroupBuyDetail('1740922051118063618');
|
||||||
if(groupBuyBean.value) {
|
if(groupBuyBean.value) {
|
||||||
|
@@ -3,6 +3,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
|
import { getQueryParam } from '@/utils';
|
||||||
|
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
getApp().logger?.info('ticketsBuy options: ', options);
|
getApp().logger?.info('ticketsBuy options: ', options);
|
||||||
let couponId = options?.couponsId;
|
let couponId = options?.couponsId;
|
||||||
@@ -17,11 +19,7 @@ onLoad((options) => {
|
|||||||
}, 300);
|
}, 300);
|
||||||
});
|
});
|
||||||
|
|
||||||
function getQueryParam(queryParams: string, key: string) {
|
|
||||||
let regex = new RegExp('(?:[?&]|^)' + key + '=([^&]+)'),
|
|
||||||
match = queryParams.match(regex);
|
|
||||||
return match && match[1];
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
|
@@ -86,6 +86,7 @@ const submenuList = [
|
|||||||
title: '注册有礼',
|
title: '注册有礼',
|
||||||
icon: assetsUrl('ic_register_gift2.png'),
|
icon: assetsUrl('ic_register_gift2.png'),
|
||||||
path: '/pages/common/register/reward'
|
path: '/pages/common/register/reward'
|
||||||
|
// path: '/pages/common/groupbuy/detail?shareId=1797548579864748033'
|
||||||
// path: '/pages/coupons/ticketsBuy/ticketsBuy?couponsId=1797773484774432769'
|
// path: '/pages/coupons/ticketsBuy/ticketsBuy?couponsId=1797773484774432769'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@@ -3,10 +3,30 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
onMounted(() => {
|
import { getQueryParam } from '@/utils';
|
||||||
uni.reLaunch({
|
|
||||||
url: '/pages/home/index'
|
onLoad((options) => {
|
||||||
});
|
if(options?.query) {
|
||||||
|
getApp().logger?.info('app goods share options: ', options);
|
||||||
|
const params = decodeURIComponent(options?.query);
|
||||||
|
const shareId = getQueryParam(params, 'shareId');
|
||||||
|
getApp().logger?.info('app goods share options: ', params, shareId);
|
||||||
|
if(shareId != undefined) {
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: `/pages/common/groupbuy/detail?shareId=${shareId}`
|
||||||
|
});
|
||||||
|
}, 300);
|
||||||
|
} else {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/home/index'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/home/index'
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@@ -80,7 +80,7 @@ const params = ref<{
|
|||||||
nickName: userInfo.value.nickName,
|
nickName: userInfo.value.nickName,
|
||||||
telephone: userInfo.value.telephone,
|
telephone: userInfo.value.telephone,
|
||||||
gender: userInfo.value.gender,
|
gender: userInfo.value.gender,
|
||||||
birthday: userInfo.value.birthday|| dayjs().format('YYYY-MM-DD')
|
birthday: userInfo.value.birthday || dayjs().format('YYYY-MM-DD')
|
||||||
});
|
});
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
@@ -135,7 +135,7 @@ const save = async () => {
|
|||||||
|
|
||||||
const result = await updateProfile({
|
const result = await updateProfile({
|
||||||
...params.value,
|
...params.value,
|
||||||
birthday: dayjs(birthday.value).isValid() ? dayjs(birthday.value).format('YYYY-MM-DD HH:mm:ss') : dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
birthday: dayjs(params.value.birthday).isValid() ? dayjs(params.value.birthday).format('YYYY-MM-DD HH:mm:ss') : dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||||
birthdayType: 0
|
birthdayType: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -132,3 +132,9 @@ export function copy(content: string) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getQueryParam(queryParams: string, key: string) {
|
||||||
|
let regex = new RegExp('(?:[?&]|^)' + key + '=([^&]+)'),
|
||||||
|
match = queryParams.match(regex);
|
||||||
|
return match && match[1];
|
||||||
|
}
|
||||||
|
@@ -61,7 +61,7 @@ function responseInterceptors() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 登录状态失效,重新登录
|
// 登录状态失效,重新登录
|
||||||
if(data.code === 4011 || data?.retcode === 4011) {
|
if(data?.code === 401 || data?.code === 4011 || data?.retcode === 4011) {
|
||||||
// 是否在获取token中,防止重复获取
|
// 是否在获取token中,防止重复获取
|
||||||
if(!isRefreshing) {
|
if(!isRefreshing) {
|
||||||
// 修改登录状态为true
|
// 修改登录状态为true
|
||||||
|
Reference in New Issue
Block a user