From 6605fe557170f7a3b0e90a94817c4b143c1878e3 Mon Sep 17 00:00:00 2001 From: zmj <1493694146@qq.com> Date: Mon, 24 Jun 2024 18:40:03 +0800 Subject: [PATCH] add --- api/user.js | 4 + config/app.js | 5 + pageQuota/balanceDetail/index.vue | 13 +- pageQuota/vipUser/index.vue | 133 ++- pages.json | 2 +- pages/my/my.vue | 8 +- utils/push.js | 1436 ++++++++++++++++------------- 7 files changed, 905 insertions(+), 696 deletions(-) diff --git a/api/user.js b/api/user.js index 7f85bac..4e9c57d 100644 --- a/api/user.js +++ b/api/user.js @@ -99,6 +99,10 @@ export const vipRechargeApi = (data) => { return request.post('/store/store/recharge', data); } +export const reVipRechargeApi = (data) => { + return request.post('/store/store/again_recharge', data); +} + export const rechargeCountApi = (data) => { return request.get('/store/store/recharge_count', data); } diff --git a/config/app.js b/config/app.js index ab2ac5f..e71ad8f 100644 --- a/config/app.js +++ b/config/app.js @@ -1,4 +1,5 @@ let BASE_URL +let WSS_URL import store from "@/store/user.js" // 环境 let env = "dev" @@ -8,12 +9,15 @@ let env = "dev" switch (env) { case 'dev': BASE_URL = 'https://test-multi-store.lihaink.cn'; + WSS_URL = 'wss://test-multi-store.lihaink.cn/pull' break; case 'liu': BASE_URL = 'http://192.168.1.201:8545'; + WSS_URL = 'wss://test-multi-store.lihaink.cn/pull' break; default: BASE_URL = 'https://multi-store.lihaink.cn'; + WSS_URL = 'wss://test-multi-store.lihaink.cn/pull' } let HTTP_REQUEST_URL @@ -21,6 +25,7 @@ let HEADER let config = { HTTP_REQUEST_URL: BASE_URL, + WSS_URL: WSS_URL, HEADER: { 'content-type': 'application/json', //#ifdef MP diff --git a/pageQuota/balanceDetail/index.vue b/pageQuota/balanceDetail/index.vue index a38036c..8296aaa 100644 --- a/pageQuota/balanceDetail/index.vue +++ b/pageQuota/balanceDetail/index.vue @@ -21,8 +21,8 @@ {{item.title}} - {{ item.financial_pm?'+':'-' }}{{item.number}} + {{ !item.financial_pm?'+':'-' }}{{item.number}} {{item.create_time}} @@ -33,8 +33,8 @@ {{item.order_sn}} - {{ item.status?'+':'-' }}{{item.number}} + {{ !item.status?'+':'-' }}{{item.number}} {{item.create_time}} @@ -68,10 +68,10 @@ name: '全部' }, { - name: '支出' + name: '收入' }, { - name: '收入' + name: '支出' }, ]); @@ -81,7 +81,6 @@ getLists() } - const lists = ref([]) let type = ref('') const getLists = async (isPullDown = false) => { diff --git a/pageQuota/vipUser/index.vue b/pageQuota/vipUser/index.vue index c97133d..224f94f 100644 --- a/pageQuota/vipUser/index.vue +++ b/pageQuota/vipUser/index.vue @@ -28,19 +28,19 @@ {{Role==1?'行业会员':'商户'}}开通报备 - + - + - + + {{item.label_name}} 已开通 - 未开通,查询 + + + 未开通,查询 + + + 重新支付 + + - - + @@ -169,6 +175,7 @@ reactive, ref } from 'vue'; + import useUserStore from "@/store/user"; import { provinceListApi, cityListApi, @@ -180,6 +187,7 @@ import { vipRechargeApi, rechargeCountApi, + reVipRechargeApi, rechargeListsApi, updataOrderApi, getStoreByPhone, @@ -187,11 +195,59 @@ getUserShip, getCreateLists } from "@/api/user.js" - + import Push from "@/utils/push.js" import { onPullDownRefresh, onLoad } from "@dcloudio/uni-app" + import { + config + } from "@/config/app.js" + + + // scoket + let timer = null + const userInfo = useUserStore().userInfo; + const connection = new Push({ + url: config.WSS_URL, // websocket地址 + app_key: '2ce3ce22329517213caa7dad261f5695', + }); + + // 浏览器监听user-1 + const user_channel = connection.subscribe(`wechat_mmp_${userInfo.id}}`); + + user_channel.on('message', function(data) { + console.log("收到消息--", data); + try { + if (timer) clearTimeout(timer); + uni.hideLoading() + currentTab.value = 2 + formData.real_name = '' + formData.mobile = '' + formData.address = '' + formData.label_name = '' + formData.city = '' + formData.area = '' + formData.street = '' + formData.village = '' + formData.brigade = '' + currentAddressIndex.value = 0 + tabsList.forEach(item => { + item.name = '请选择' + }) + getLists() + getCount() + + } catch (error) { + + } + }); + // 断线事件 + user_channel.on('close', function() { + + }); + // scoket结束 + const showPop1 = ref(false) const Role = ref('') @@ -377,22 +433,28 @@ formData.recharge_type = 'INDUSTRYMEMBERS' formData.user_ship = 1 vipRechargeApi(formData).then(res => { - uni.$u.toast('操作成功'); - currentTab.value = 2 - formData.real_name = '' - formData.mobile = '' - formData.address = '' - formData.label_name = '' - formData.city = '' - formData.area = '' - formData.street = '' - formData.village = '' - formData.brigade = '' - currentAddressIndex.value = 0 + uni.showLoading({ + title: '支付中...' + }); + timer = setTimeout(() => { + uni.hideLoading(); + uni.$u.toast('支付超时'); + // formData.real_name = '' + // formData.mobile = '' + // formData.address = '' + // formData.label_name = '' + // formData.city = '' + // formData.area = '' + // formData.street = '' + // formData.village = '' + // formData.brigade = '' + // currentAddressIndex.value = 0 + // tabsList.forEach(item => { + // item.name = '请选择' + // }) + }, 30000) - tabsList.forEach(item => { - item.name = '请选择' - }) + // uni.$u.toast('操作成功'); }) getCount() @@ -426,6 +488,24 @@ } + + const rePay = (item) => { + uni.scanCode({ + success: function(res) { + reVipRechargeApi({ + id: item.id, + auth_code: res.result + }).then(res => { + uni.$u.toast('操作成功'); + getCount() + getLists() + }) + } + }); + + } + + // 邀请用户数 const count = ref(0) const getCount = async () => { @@ -451,7 +531,6 @@ }) lists.value = res.data.lists count.value = res.data.count - } } @@ -464,13 +543,15 @@ updataOrderApi({ order_no: item.order_id, recharge: 1 + }).then(res => { + getCount() + getLists() + }) } onLoad(() => { getUserShip().then(res => { - console.log(res) - range.value = res.data.lists.map(item => { return { value: item.id, diff --git a/pages.json b/pages.json index 513c6a4..0a14628 100644 --- a/pages.json +++ b/pages.json @@ -53,7 +53,7 @@ "style": { "navigationBarTitleText": "个人中心", "enablePullDownRefresh": true, - "navigationStyle": "custom" + "navigationBarBackgroundColor": "#D3FDCA" } }, { "path": "pages/charge/charge_record", diff --git a/pages/my/my.vue b/pages/my/my.vue index 8242580..4b41dca 100644 --- a/pages/my/my.vue +++ b/pages/my/my.vue @@ -23,8 +23,8 @@