diff --git a/src/App.vue b/src/App.vue index d88856f..e60baa2 100644 --- a/src/App.vue +++ b/src/App.vue @@ -19,7 +19,16 @@ onLaunch((options) => { if(options.query.storeId) { setRegisterStoreId(options.query.storeId); } + + if(options?.query.scene) { + //保存注册门店id + const params = decodeURIComponent(options?.query.scene); + if(params.split('=')[0] === 'storeId') { + setRegisterStoreId(params.split('=')[1]); + } + } } + // #ifdef MP mpUpdate(); // #endif diff --git a/src/api/groupbuy/index.ts b/src/api/groupbuy/index.ts index 48b817d..f391a24 100644 --- a/src/api/groupbuy/index.ts +++ b/src/api/groupbuy/index.ts @@ -6,7 +6,7 @@ export const getGroupBuyList = (data: { pageNum: number, pageSize: number, obj: { - status: number, + timeStatus: number, } }) => post({ url: '/group/coupons/wx_query', data }); diff --git a/src/api/user/index.ts b/src/api/user/index.ts index 7f85a4b..13fed78 100644 --- a/src/api/user/index.ts +++ b/src/api/user/index.ts @@ -30,7 +30,8 @@ enum URL { couponList = '/wechat/coupons/coupons/pageList', integralList = '/ext/member/integral_query', tradeList = '/memberIncoming/wx_balance_records', - terminal = 'wechat/coupons/terminal?companyId=' + terminal = 'wechat/coupons/terminal?companyId=', + cardLink = '/wc/wechat/get_card_url' } export const getUserProfile = () => get({ url: URL.profile }); @@ -67,3 +68,5 @@ export const getIntegralList = (data: any) => get({ url: URL.integralList, data export const getTerminal = (companyId: string) => get({ url: URL.terminal + companyId }); export const getTradeList = (data: any) => post({ url: URL.tradeList, data }); + +export const getCardLink = () => get({ url: URL.cardLink }); diff --git a/src/components/payment-button.vue b/src/components/payment-button.vue index 2c45ae6..c6a94e8 100644 --- a/src/components/payment-button.vue +++ b/src/components/payment-button.vue @@ -66,7 +66,7 @@ const buildSignParams = computed(() => { return sortASCII({ client_sn: props.payParams.client_sn || '', return_url: props.payParams.return_url, - total_amount: (props.payParams.total_amount * 100).toString(), + total_amount: Number((props.payParams.total_amount * 100).toFixed(2)), terminal_sn: props.payParams.terminal_sn, subject: props.payParams.subject, subject_img: props.payParams.subject_img, diff --git a/src/components/sku-dialog.vue b/src/components/sku-dialog.vue index a92d786..f53b33b 100644 --- a/src/components/sku-dialog.vue +++ b/src/components/sku-dialog.vue @@ -5,7 +5,8 @@ {{ goodsDetailBean?.name || '未知' }} - {{ flashPrice > 0 ? `${flashPrice}` : `${goodsDetailBean?.consumePrice || 0}` || 0 + + {{ flashPrice > 0 ? `${flashPrice}` : `${goodsDetailBean?.consumePrice || 0}` || 0 }} diff --git a/src/pages/common/groupbuy/index.vue b/src/pages/common/groupbuy/index.vue index 90b66b9..e506372 100644 --- a/src/pages/common/groupbuy/index.vue +++ b/src/pages/common/groupbuy/index.vue @@ -19,7 +19,7 @@ 直降¥{{ (item.price - item.payPrice).toFixed(2) }} - {{ tabIndex == 0 ? '即将恢复' : '即将开始'}} + {{ tabIndex == 0 ? '即将恢复' : '即将开始' }} {{ item.payPrice }} @@ -62,7 +62,7 @@ const fetchData = async (refresh: boolean = true) => { pageNum: currentPageNum.value, pageSize: 100, obj: { - status: tabIndex.value + timeStatus: tabIndex.value + 1 } }); groupbuyList.value = list; diff --git a/src/pages/common/groupbuy/order-confirm.vue b/src/pages/common/groupbuy/order-confirm.vue index 08c7c4d..17e3205 100644 --- a/src/pages/common/groupbuy/order-confirm.vue +++ b/src/pages/common/groupbuy/order-confirm.vue @@ -65,7 +65,7 @@ const buildSqbParams = computed(() => { const params = sortASCII({ client_sn: orderBean.value?.id || '', return_url: '/pages/common/payresult/index', - total_amount: ((orderBean.value?.totalPrice || 0) * 100).toString(), + total_amount: Number(((orderBean.value?.totalPrice || 0) * 100).toFixed(2)), terminal_sn: terminalInfo.value.terminalSn, subject: '商品团购券', subject_img: orderBean?.value?.orderGoods[0].images || '', diff --git a/src/pages/common/webview/index.vue b/src/pages/common/webview/index.vue index b294322..9f4a964 100644 --- a/src/pages/common/webview/index.vue +++ b/src/pages/common/webview/index.vue @@ -1,12 +1,12 @@ - diff --git a/src/pages/home/index.vue b/src/pages/home/index.vue index 6dbe9b7..40ac0db 100644 --- a/src/pages/home/index.vue +++ b/src/pages/home/index.vue @@ -122,9 +122,7 @@ onShow(async () => { if(isLogin()) { // userStore.getProfile(); if(userInfo.value.maOpenId) { - if(getCompanyId() === '') { - switchCompany(); - } + fetchCompanyList(); } else { await userStore.getProfile(); } @@ -134,18 +132,52 @@ onShow(async () => { }); const switchCompany = () => { - getCompanyList(userInfo.value.maOpenId).then(res => { - const companyList = res.map((res: { company: any }) => res.company); - const userList = res.map((res: { user: any }) => res.user); + // getCompanyList(userInfo.value.maOpenId).then(res => { + // const companyList = res.map((res: { company: any }) => res.company); + // const userList = res.map((res: { user: any }) => res.user); + // uni.showActionSheet({ + // itemList: companyList.map((res: { companyName: string }) => res.companyName), + // success: (res) => { + // userStore.setUserInfo(userList[res.tapIndex]); + // userStore.setCompanyInfo(companyList[res.tapIndex]); + // } + // }); + // }); + fetchCompanyList((companyList: any[], userList: any[]) => { uni.showActionSheet({ itemList: companyList.map((res: { companyName: string }) => res.companyName), success: (res) => { userStore.setUserInfo(userList[res.tapIndex]); + userStore.setCompanyInfo(companyList[res.tapIndex]); } }); }); }; +const fetchCompanyList = (fn: any = undefined) => { + getCompanyList(userInfo.value.maOpenId).then(res => { + const companyList = res.map((res: { company: any }) => res.company); + const userList = res.map((res: { user: any }) => res.user); + if(fn != undefined && fn instanceof Function) { + fn(companyList, userList); + } else { + let index = companyList.findIndex((res: { id: string }) => res.id === getCompanyId()); + if(index < 0) { + index = 0; + } + userStore.setUserInfo(userList[index]); + userStore.setCompanyInfo(companyList[index]); + } + // uni.showActionSheet({ + // itemList: companyList.map((res: { companyName: string }) => res.companyName), + // success: (res) => { + // userStore.setUserInfo(userList[res.tapIndex]); + // userStore.setCompanyInfo(companyList[res.tapIndex]); + // } + // }); + }); +}; + const swiperChange = (e: any) => { currentBannerIndex.value = e.detail.current; }; diff --git a/src/pages/mall/subs/goods/detail.vue b/src/pages/mall/subs/goods/detail.vue index 5375afe..70a90ba 100644 --- a/src/pages/mall/subs/goods/detail.vue +++ b/src/pages/mall/subs/goods/detail.vue @@ -21,7 +21,7 @@ ¥{{ goodsBean?.price || 0 }} - 销量{{ goodsBean?.send_num || 0 }} + 销量{{ goodsBean?.salesCount || 0 }} diff --git a/src/pages/mall/subs/order/order-confirm.vue b/src/pages/mall/subs/order/order-confirm.vue index 255ffe5..e5d4a2f 100644 --- a/src/pages/mall/subs/order/order-confirm.vue +++ b/src/pages/mall/subs/order/order-confirm.vue @@ -159,7 +159,7 @@ const buildSqbParams = computed(() => { const params = sortASCII({ client_sn: orderBean.value?.id || '', return_url: '/pages/common/payresult/index', - total_amount: ((orderBean.value?.totalPrice || 0) * 100).toString(), + total_amount: Number(((orderBean.value?.totalPrice || 0) * 100).toFixed(2)), terminal_sn: terminalInfo.value.terminalSn, subject: orderBean?.value?.orderGoods[0].name, subject_img: orderBean?.value?.orderGoods[0].images || '', diff --git a/src/pages/mine/index.vue b/src/pages/mine/index.vue index abf7730..c881d38 100644 --- a/src/pages/mine/index.vue +++ b/src/pages/mine/index.vue @@ -34,7 +34,7 @@ 将会员卡放入微信卡包,及时了解积分变动 - 去添加 + 去添加 @@ -68,6 +68,7 @@ import { assetsUrl, defaultAvatar } from '@/utils/assets'; import { goLogin, goPath, isLogin } from '@/utils'; import { isPending } from '@/utils/order'; +import { getCardLink } from '@/api/user'; import { getOrderList } from '@/api/order'; import OfficialAccountDialog from '@/components/official-account-dialog.vue'; import { useUserStore } from '@/store'; @@ -111,7 +112,7 @@ const serviceList = [ }, { title: '联系商家', icon: assetsUrl('ic_member_service_contact.png'), - path: '' + path: 'call' } // ,{ // title: '推广中心', @@ -120,14 +121,13 @@ const serviceList = [ // } ]; -const title = ref(); -title.value = import.meta.env.VITE_APP_TITLE; - const store = useUserStore(); -const { userInfo, companyConfigInfo } = storeToRefs(store); +const { userInfo, companyInfo, companyConfigInfo } = storeToRefs(store); +const cardLink = ref(''); const unPaidOrderCount = ref(0); + onLoad(() => { if(!isLogin()) { goLogin(); @@ -142,8 +142,29 @@ onShow(async () => { obj: { payStatus: 1 } }); unPaidOrderCount.value = list.filter((item: any) => isPending(item))?.length || 0; + const { cardurl } = await getCardLink(); + cardLink.value = cardurl; }); +const openCard = () => { + // const url = 'https://mp.weixin.qq.com/bizmall/activatemembercard?action=preshow&&encrypt_card_id=LI%2FNyDp0x3z8XXorvvrHzSR4VUPa2vlioBg2xkDT3HqybiAFNsNgjH7pBpyKGrSA&outer_str=1702887425732870145&biz=MzU2MTg5MjgxMg%3D%3D#wechat_redirect'; + goPath(`/pages/common/webview/index?url=${encodeURIComponent(cardLink.value)}`); + // uni.openCard({ + // cardList: [{ + // cardId: 'pzCtO1PD40kHdvcAU8kTfVILoebE', + // code: '261422541418' + // } + // // { + // // cardId: '', + // // code: '' + // // } + // ], + // success(res) { + // + // } + // }); +}; + const gotoPath = (path: string) => { if(path === 'follow_official_account') { showOfficialAccountDialog(); @@ -151,6 +172,10 @@ const gotoPath = (path: string) => { uni.switchTab({ url: '/pages/qrcode/index' }); + } else if(path === 'call') { + uni.makePhoneCall({ + phoneNumber: companyInfo.value.telphone + }); } else { goPath(path); } diff --git a/src/pages/mine/subs/order/components/order-item.vue b/src/pages/mine/subs/order/components/order-item.vue index 5b0a254..1f5647e 100644 --- a/src/pages/mine/subs/order/components/order-item.vue +++ b/src/pages/mine/subs/order/components/order-item.vue @@ -4,7 +4,7 @@ - {{ item?.orderGoods[0].goodsName||'未知' }} + {{ item?.orderGoods[0].goodsName || '未知' }} 已支付 待支付 @@ -33,7 +33,8 @@ 加入购物车 - 立即支付 + 立即支付 @@ -155,13 +156,14 @@ const pay = (orderId: string | undefined) => { } .add-shoppingcart { - border: 1rpx solid #ACACAC; + border: 2rpx solid #ACACAC; } .payment { - border: 1rpx solid #F32B2B; + border: 2rpx solid #F32B2B; margin-left: 20rpx; + box-sizing: border-box; } } } diff --git a/src/pages/mine/subs/order/detail.vue b/src/pages/mine/subs/order/detail.vue index d02dc54..38ed4ef 100644 --- a/src/pages/mine/subs/order/detail.vue +++ b/src/pages/mine/subs/order/detail.vue @@ -164,7 +164,7 @@ const buildSqbParams = computed(() => { const params = sortASCII({ client_sn: orderBean.value?.order?.id || '', return_url: '/pages/common/payresult/index', - total_amount: ((orderBean.value?.order?.totalPrice || 0) * 100).toString(), + total_amount: Number(((orderBean.value?.order?.totalPrice || 0) * 100).toFixed(2)), terminal_sn: terminalInfo.value.terminalSn, subject: '商品支付', merchant_name: terminalInfo.value.companyName, @@ -441,11 +441,12 @@ const payment = () => { sqb-pay button { padding: 0 45rpx; border-radius: 50rpx; - border: 1rpx solid #F32B2B; + border: 2rpx solid #F32B2B; font-weight: bold; background: #FFFFFF; font-size: 30rpx; color: #F32B2B; + box-sizing: border-box; } } diff --git a/src/pages/mine/subs/recharge/index.vue b/src/pages/mine/subs/recharge/index.vue index e12c06c..0f313ef 100644 --- a/src/pages/mine/subs/recharge/index.vue +++ b/src/pages/mine/subs/recharge/index.vue @@ -83,7 +83,7 @@ const buildSqbParams = computed(() => { const params = sortASCII({ client_sn: preRechargeOrderId.value, return_url: '/pages/common/payresult/index', - total_amount: ((rechargeItems.value[currentIndex.value]?.rechargeamount || 0) * 100).toString(), + total_amount: Number(((rechargeItems.value[currentIndex.value]?.rechargeamount || 0) * 100).toFixed(2)), terminal_sn: terminalInfo.value.terminalSn, subject: '充值', merchant_name: terminalInfo.value.companyName, diff --git a/src/store/modules/user/index.ts b/src/store/modules/user/index.ts index 6700c15..dea942e 100644 --- a/src/store/modules/user/index.ts +++ b/src/store/modules/user/index.ts @@ -9,6 +9,7 @@ const useUserStore = defineStore('user', { state: () => ({ userInfo: {} as UserBean, terminalInfo: {} as TerminalBean, + companyInfo: {} as any, companyConfigInfo: { bannerhot: [] as any[], bannerinx: [] as any[], @@ -58,6 +59,10 @@ const useUserStore = defineStore('user', { await this.fetchCompanyInfo(); }, + setCompanyInfo(partial: Partial) { + this.companyInfo = partial as any; + }, + setDeliveryAddress(partial: Partial) { this.deliveryAddress = partial as any; },