商品团购分享处理

This commit is contained in:
2024-06-07 14:10:43 +08:00
parent 613c0df738
commit 4b4ee44242
10 changed files with 53 additions and 26 deletions

View File

@@ -144,7 +144,7 @@ import SkuDialog from '@/components/sku-dialog.vue';
import CouponItem from './components/coupon-item.vue';
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 { useUserStore } from '@/store';
import { GroupBuyBean, RecordBean } from '@/api/groupbuy/types';
@@ -173,7 +173,13 @@ const currentPageNum = ref(1);
onLoad(async (e: any) => {
if(isLogin()) {
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');
// groupBuyBean.value = await getGroupBuyDetail('1740922051118063618');
if(groupBuyBean.value) {

View File

@@ -3,6 +3,8 @@
</template>
<script lang='ts' setup>
import { getQueryParam } from '@/utils';
onLoad((options) => {
getApp().logger?.info('ticketsBuy options: ', options);
let couponId = options?.couponsId;
@@ -17,11 +19,7 @@ onLoad((options) => {
}, 300);
});
function getQueryParam(queryParams: string, key: string) {
let regex = new RegExp('(?:[?&]|^)' + key + '=([^&]+)'),
match = queryParams.match(regex);
return match && match[1];
}
</script>
<style lang='scss' scoped>

View File

@@ -86,6 +86,7 @@ const submenuList = [
title: '注册有礼',
icon: assetsUrl('ic_register_gift2.png'),
path: '/pages/common/register/reward'
// path: '/pages/common/groupbuy/detail?shareId=1797548579864748033'
// path: '/pages/coupons/ticketsBuy/ticketsBuy?couponsId=1797773484774432769'
},
{

View File

@@ -3,10 +3,30 @@
</template>
<script lang='ts' setup>
onMounted(() => {
uni.reLaunch({
url: '/pages/home/index'
});
import { getQueryParam } from '@/utils';
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>

View File

@@ -80,7 +80,7 @@ const params = ref<{
nickName: userInfo.value.nickName,
telephone: userInfo.value.telephone,
gender: userInfo.value.gender,
birthday: userInfo.value.birthday|| dayjs().format('YYYY-MM-DD')
birthday: userInfo.value.birthday || dayjs().format('YYYY-MM-DD')
});
onLoad(() => {
@@ -135,7 +135,7 @@ const save = async () => {
const result = await updateProfile({
...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
});