From f15573e557b713df45a573acc7008a869ce92201 Mon Sep 17 00:00:00 2001 From: zmj <1493694146@qq.com> Date: Fri, 5 Jul 2024 18:18:02 +0800 Subject: [PATCH] add --- api/user.js | 4 + pageQuota/balanceDetail/index.vue | 2 +- pageQuota/vipUser/activePage.vue | 11 ++ pageQuota/vipUser/index.vue | 185 +++++++++++++++++++++--------- pages.json | 7 ++ pages/index/index.vue | 8 +- 6 files changed, 158 insertions(+), 59 deletions(-) create mode 100644 pageQuota/vipUser/activePage.vue diff --git a/api/user.js b/api/user.js index c84bb05..6af8132 100644 --- a/api/user.js +++ b/api/user.js @@ -161,4 +161,8 @@ export const checkInventoryApi = (data) => { export const isUserShipApi = (data) => { return request.post('/user_ship/UserShip/is_user_ship', data); +} + +export const getRechargeListApi = (data) => { + return request.get('/user/UserRecharge/recharge_list', data); } \ No newline at end of file diff --git a/pageQuota/balanceDetail/index.vue b/pageQuota/balanceDetail/index.vue index d94418a..fc1d53b 100644 --- a/pageQuota/balanceDetail/index.vue +++ b/pageQuota/balanceDetail/index.vue @@ -32,7 +32,7 @@ - {{item.order_sn}} + {{item.title}} {{ !item.status?'+':'-' }}{{item.number}} diff --git a/pageQuota/vipUser/activePage.vue b/pageQuota/vipUser/activePage.vue new file mode 100644 index 0000000..d3f000f --- /dev/null +++ b/pageQuota/vipUser/activePage.vue @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/pageQuota/vipUser/index.vue b/pageQuota/vipUser/index.vue index 38645ee..d83a407 100644 --- a/pageQuota/vipUser/index.vue +++ b/pageQuota/vipUser/index.vue @@ -31,8 +31,10 @@ - 行业会员开通报备 - + 购买采购包 + + + 报备人:{{ STORE_INFO.name }} @@ -82,23 +84,20 @@ - - 报备人:{{ STORE_INFO.name }} + + 点击查看礼品包内容 - - - - + + + + {{item.money}}元采购包 + + + 送{{item.send}}{{item.send_string}} + - - {{formData.label_name}}角色最低金额不能低于{{formData.label_limit}}元且最高金额不能超过10000.00元 - - - {{formData2.label_name}}会员最低金额不能低于{{formData2.label_limit}}元 - + 可单次多笔累计操作 @@ -180,6 +179,8 @@ + + @@ -311,8 +312,6 @@ - - @@ -337,6 +336,7 @@ } from "@/api/address.js" import { vipRechargeApi, + getRechargeListApi, isUserShipApi, rechargeCountApi, reVipRechargeApi, @@ -443,6 +443,7 @@ // 手机保留一天结束 // 验证码 + const vipList = reactive([1, 2, 3, 5, 6, 7, 8]) const cutDown = ref(0) const flag = ref(true) const code = ref('') @@ -579,10 +580,10 @@ } = await getVipInfoByPhone({ mobile: formData2.mobile }) - // if (data.user_ship != 4) { - // uni.hideLoading() - // return uni.$u.toast('查询失败'); - // } + if (!vipList.includes(data.user_ship)) { + uni.hideLoading() + return uni.$u.toast('查询失败'); + } if (formData.mobile) { formData2.mobile = formData.mobile } @@ -597,14 +598,9 @@ } - const tofixedPrice = (type = 1) => { - if (type == 2) return formData2.price = (+formData2.price).toFixed(2) - formData.price = (+formData.price).toFixed(2) - } - const resetFormData = () => { for (let key in formData) { - formData[key] = '' + (key != 'price') && (formData[key] = '') } for (let key in formData2) { formData2[key] = '' @@ -621,8 +617,6 @@ const conformRole = (e) => { formData.label_name = e.value[0].title formData.label_id = e.value[0].id - formData.price = (+e.value[0].limit).toFixed(2) - formData.label_limit = e.value[0].limit showPop1.value = false } @@ -724,6 +718,7 @@ ]); let timerInvol = null + let paySuccess; // 开起一个scoket监听用户知否支付成功 const userInfo = useUserStore().userInfo; const connection = new Push({ @@ -733,13 +728,34 @@ const user_channel = connection.subscribe(`wechat_mmp_${userInfo.id}`); user_channel.on('message', function(data) { try { - uni.hideLoading({}); + paySuccess = true + uni.hideLoading(); clearTimeout(timerInvol); paySuccessToTabs2() } catch (error) {} }); // 结束 + const navgo = (url) => { + uni.navigateTo({ + url + }) + } + + // 选择采购包 + const giftIndex = ref(0) + const rechargeList = ref([]) + const getRechargeList = async () => { + let res = await getRechargeListApi() + rechargeList.value = res.data + formData.price = rechargeList.value[0].money + } + + const choseGift = (index) => { + giftIndex.value = index + formData.price = rechargeList.value[index].money + } + // 提交 const submit = async (type = 1) => { @@ -787,10 +803,12 @@ formData2.recharge_type = 'INDUSTRYMEMBERS' formData2.user_ship = formData2.label_id vipRechargeApi(formData2).then(res => { + paySuccess = false; timerInvol = setTimeout(() => { uni.hideLoading(); - if (currentTab.value == 2) return; - uni.$u.toast('支付超时'); + if (!paySuccess) { + uni.$u.toast('支付超时'); + } }, 30000) }) } @@ -801,9 +819,9 @@ if (!formData.code) return uni.$u.toast('请输入短信验证码'); if (!formData.address) return uni.$u.toast('请选择地址'); if (!formData.label_id) return uni.$u.toast('请选择用户身份'); - if (Number(formData.price) < Number(formData.label_limit)) return uni.$u.toast( - `${formData.label_name}角色最低金额不能低于${formData.label_limit}元`); formData.store_id = STORE_INFO.id + formData.user_ship = formData.label_id + formData.recharge_type = 'INDUSTRYMEMBERS' if (Role.value == 1) { // formData.recharge_type = 'INDUSTRYMEMBERS' // formData.user_ship = formData.label_id @@ -830,14 +848,14 @@ uni.showLoading({ title: '支付中...' }); - formData.user_ship = formData.label_id formData.auth_code = res.result - formData.recharge_type = 'INDUSTRYMEMBERS' vipRechargeApi(formData).then(res => { + paySuccess = false; timerInvol = setTimeout(() => { uni.hideLoading(); - if (currentTab.value == 2) return; - uni.$u.toast('支付超时'); + if (!paySuccess) { + uni.$u.toast('支付超时'); + } }, 30000) }) } @@ -859,13 +877,19 @@ }).then(res => { timerInvol = setTimeout(() => { uni.hideLoading(); - uni.$u.toast('支付超时'); + if (!paySuccess) { + uni.$u.toast('支付超时'); + } }, 30000) }) } }); } + const tofixedPrice = (type = 1) => { + if (type == 2) return formData2.price = (+formData2.price).toFixed(2) + } + // 支付成功后清除formData并且切换tabs2 const paySuccessToTabs2 = () => { uni.hideLoading() @@ -936,19 +960,12 @@ } onLoad(() => { - // getUserShip().then(res => { - // range.value = res.data.lists.map(item => { - // return { - // value: item.id, - // text: item.title - // } - // })f - // }) getUserShip().then(res => { columns.value = [res.data.lists] }) getPhoneOneDay() getCityList() + getRechargeList() }) onPullDownRefresh(() => { @@ -1028,20 +1045,20 @@ } .card1 { - padding: 52rpx 30rpx; + padding: 30rpx; .card1-tit { font-size: 32rpx; color: #444444; text-align: center; - margin-bottom: 90rpx; + margin-bottom: 20rpx; } .store-info { font-size: 28rpx; color: #20B128; text-align: center; - margin-top: 30rpx; + margin-top: 20rpx; } } @@ -1087,7 +1104,7 @@ .address-content { padding: 20rpx; - height: 50vh; + height: 60vh; overflow-y: auto; .address-li { @@ -1123,5 +1140,65 @@ .btn-text { color: #20B128; + } + + .link { + padding-left: 20rpx; + color: #2F6BF2; + font-size: 28rpx; + margin-bottom: 30rpx; + position: relative; + text-decoration: underline; + text-underline-offset: 10rpx; + cursor: pointer; + } + + .link::after { + content: ''; + width: 12rpx; + height: 12rpx; + background-color: #2F6BF2; + position: absolute; + top: 50%; + transform: translateY(-50%); + border-radius: 12rpx; + left: 0; + } + + .gift-pack { + display: flex; + justify-content: space-between; + flex-wrap: wrap; + + .gift-pack-li { + padding: 20rpx 40rpx; + border: #20B128 1px solid; + border-radius: 24rpx 24rpx 24rpx 24rpx; + background-color: #F6F6F6; + margin-bottom: 20rpx; + font-size: 26rpx; + color: #777777; + width: 310rpx; + box-sizing: border-box; + text-align: center; + + .gift-pack-li-top { + margin-bottom: 10rpx; + color: #20B128; + } + + .act-gift-top { + color: white; + } + } + + .act-gift { + background-color: #38BE41; + color: white; + } + + + + } \ No newline at end of file diff --git a/pages.json b/pages.json index 3ced8f0..cc70251 100644 --- a/pages.json +++ b/pages.json @@ -235,6 +235,13 @@ "enablePullDownRefresh": true } }, + { + "path": "vipUser/activePage", + "style": { + "navigationBarTitleText": "采购礼包", + "enablePullDownRefresh": false + } + }, { "path": "asset/index", "style": { diff --git a/pages/index/index.vue b/pages/index/index.vue index 2ac93bd..e0ccf7d 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -162,8 +162,8 @@ {{ item.store_name }} - - 活动价 + + 售价 {{item[priceKey.price]}}/{{ item.unit_name }} @@ -173,10 +173,10 @@ 赠10%品牌礼品券 - + 售价