From 52ccc7db6a79fd04ed15647d1e8ec2e3f6256d89 Mon Sep 17 00:00:00 2001 From: xy <271556543@qq.com> Date: Tue, 21 Jan 2025 17:35:06 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 13 +- common/http.api.js | 4 +- libs/WXBizDataCrypt.js | 35 ++++ package_sub/pages/AddOrder/AddOrder.vue | 44 +++-- package_sub/pages/ServiceList/ServiceList.vue | 33 +++- pages/me/me.vue | 183 ++++++++++++++++-- pages/order/order.vue | 60 ++++-- store/$u.mixin.js | 4 +- store/index.js | 8 +- 9 files changed, 320 insertions(+), 64 deletions(-) create mode 100644 libs/WXBizDataCrypt.js diff --git a/App.vue b/App.vue index 1d20fc6..00fa609 100644 --- a/App.vue +++ b/App.vue @@ -7,11 +7,14 @@ console.log('App Launch') this.globalData.navbarHeight = uni.getSystemInfoSync().safeArea.top - try { - const { user } = await this.$u.api.getUserInfo() - this.$u.vuex('vuex_user', user) - } catch (err) { - console.error(err) + const token = this.vuex_token ? this.vuex_token : uni.getStorageSync('lifeData')?.vuex_token; + if (token) { + try { + const { user } = await this.$u.api.getUserInfo() + this.$u.vuex('vuex_user', user) + } catch (err) { + console.error(err) + } } }, onShow: function() { diff --git a/common/http.api.js b/common/http.api.js index d2da6f8..3c6dc2c 100644 --- a/common/http.api.js +++ b/common/http.api.js @@ -15,6 +15,7 @@ let apiApp = { accompanyProductDetail: '/api/mobile/hospital/accompany-product-detail', accompanyProductOrder: '/api/mobile/hospital/accompany-order', accompanyPay: '/api/mobile/hospital/accompany-pay', + orderRefund: '/api/mobile/user/accompany-order-refund', // 服务对象 userArchive: '/api/mobile/user-archive/index', userArchiveShow: '/api/mobile/user-archive/show', @@ -67,6 +68,7 @@ const install = (Vue, vm) => { const accompanyProductDetail = (params = {}) => vm.$u.get(apiApp.accompanyProductDetail, params) const accompanyProductOrder = (params = {}) => vm.$u.post(apiApp.accompanyProductOrder, params) const accompanyPay = (params = {}) => vm.$u.post(apiApp.accompanyPay, params) + const orderRefund = (params = {}) => vm.$u.get(apiApp.orderRefund, params) // 服务对象 const userArchive = (params = {}) => vm.$u.get(apiApp.userArchive, params) const userArchiveShow = (params = {}) => vm.$u.get(apiApp.userArchiveShow, params) @@ -109,7 +111,7 @@ const install = (Vue, vm) => { //用户订单 accompanyOrders,accompanyOrdersDetail, // 医院 陪护下单 - listHospital,detailHospital,accompanyProduct,accompanyProductDetail,accompanyProductOrder,accompanyPay, + listHospital,detailHospital,accompanyProduct,accompanyProductDetail,accompanyProductOrder,accompanyPay,orderRefund, // 服务对象 userArchive,userArchiveShow,userArchiveSave,userArchiveDestroy, // other diff --git a/libs/WXBizDataCrypt.js b/libs/WXBizDataCrypt.js new file mode 100644 index 0000000..6727256 --- /dev/null +++ b/libs/WXBizDataCrypt.js @@ -0,0 +1,35 @@ +var crypto = require('crypto') + +function WXBizDataCrypt(appId, sessionKey) { + this.appId = appId + this.sessionKey = sessionKey +} + +WXBizDataCrypt.prototype.decryptData = function (encryptedData, iv) { + // base64 decode + var sessionKey = new Buffer(this.sessionKey, 'base64') + encryptedData = new Buffer(encryptedData, 'base64') + iv = new Buffer(iv, 'base64') + + try { + // 解密 + var decipher = crypto.createDecipheriv('aes-128-cbc', sessionKey, iv) + // 设置自动 padding 为 true,删除填充补位 + decipher.setAutoPadding(true) + var decoded = decipher.update(encryptedData, 'binary', 'utf8') + decoded += decipher.final('utf8') + + decoded = JSON.parse(decoded) + + } catch (err) { + throw new Error('Illegal Buffer') + } + + if (decoded.watermark.appid !== this.appId) { + throw new Error('Illegal Buffer') + } + + return decoded +} + +module.exports = WXBizDataCrypt diff --git a/package_sub/pages/AddOrder/AddOrder.vue b/package_sub/pages/AddOrder/AddOrder.vue index 0cb3553..78116e1 100644 --- a/package_sub/pages/AddOrder/AddOrder.vue +++ b/package_sub/pages/AddOrder/AddOrder.vue @@ -14,7 +14,10 @@ > - + + 订单已退款 + + {{ i.name }} - + 立即下单立即{{ form.pay_status === 0 ? '下单' : '支付' }} - 更多 + 更多 ({ url: i.url })) @@ -889,6 +888,19 @@ export default { }) break; case 'chargeback': + fn = () => this.$u.api.orderRefund({ + id: this.orderId + }).then(_ => { + this.getDetail().then(_ => { + if (this.form.status) { + uni.showModal({ + title: "已成功提交退款申请", + content: "当前订单已分配护工,需等待客服处理", + showCancel: false + }) + } + }) + }) break; } uni.showModal({ @@ -916,12 +928,13 @@ export default { if (this.form.pay_status === 1) { return 2; } - if (this.form.pay_status === 2) { + if (this.form.pay_status === 1 && this.form.status) { return 3; } - if (this.form.pay_status === 3) { + if (this.form.pay_status === 3 && this.form.status === 4) { return 4; } + return 0; }, sex() { return function (val) { @@ -1172,6 +1185,13 @@ export default { env(safe-area-inset-bottom) + 27rpx * 2 + 80rpx + 20rpx ); + .refund-text { + font-size: 44rpx; + font-weight: 600; + color: #c20d12; + letter-spacing: 4rpx; + padding: 64rpx 37rpx 0; + } .step { display: flex; justify-content: space-evenly; diff --git a/package_sub/pages/ServiceList/ServiceList.vue b/package_sub/pages/ServiceList/ServiceList.vue index 43ae40d..0519269 100644 --- a/package_sub/pages/ServiceList/ServiceList.vue +++ b/package_sub/pages/ServiceList/ServiceList.vue @@ -86,9 +86,9 @@ }; }, mounted() { - if (this.$store.state.vuex_location !== 2) { - this.$store.dispatch('getLocation') - } + // if (this.$store.state.vuex_location !== 2) { + // this.$store.dispatch('getLocation') + // } }, onLoad(options) { this.select.type = options.type ? options.type : '' @@ -126,6 +126,26 @@ this.getList() }, toOrder(item) { + if (!this.token) { + uni.showModal({ + title: "提示", + content: "请先登录再下单", + confirmText: "登录", + success: (status) => { + if (status.confirm) { + this.$u.route({ + url: '/pages/login/login', + type: 'redirect' + }) + } else { + + } + }, + fail: () => { + }, + }); + return + } this.$u.route({ url: '/package_sub/pages/AddOrder/AddOrder', params: { @@ -141,7 +161,12 @@ url: '/package_sub/pages/ServiceDetail/ServiceDetail?id=' + item.id }) } - } + }, + computed: { + token() { + return this.vuex_token || uni.getStorageSync('lifeData')?.vuex_token + } + } } diff --git a/pages/me/me.vue b/pages/me/me.vue index b35b0f0..d7bc03d 100644 --- a/pages/me/me.vue +++ b/pages/me/me.vue @@ -5,13 +5,34 @@ - - {{ vuex_user.nickname || '微信用户' }} - 手机号:{{ vuex_user.mobile || '' }} + + + {{ vuex_user.nickname || '微信用户' }} + + 手机号: + + {{ vuex_user.mobile || '' }} + + + + + + + + + 未登录 + 点击登录 - + @@ -51,43 +73,128 @@ - + 加入我们 - - - 关注 - 联系我们 + + + + - + + + + + + + + + + + + + 保密 + + + + + + + + + + + + + 保存 + + + +