master
xy 1 year ago
parent a7b7a72d4f
commit 52ccc7db6a

@ -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() {

@ -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

@ -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

@ -14,7 +14,10 @@
></image>
<view class="container">
<view class="step">
<view v-if="form.pay_status === 2" class="refund-text">
订单已退款
</view>
<view class="step" v-if="form.pay_status !== 2">
<view
class="step-item"
v-for="(i, index) in stepList"
@ -32,13 +35,7 @@
<view class="step-item__text">{{ i.name }}</view>
</view>
</view>
<view
v-if="
form.pay_status === 0 ||
form.pay_status === 1 ||
form.pay_status === 3
"
>
<view>
<view class="switch-service">
<view class="switch-service__icon">
<u-icon
@ -328,9 +325,9 @@
:custom-style="payBtnStyle"
:throttle-time="2000"
@click="pay"
>立即下单</u-button
>立即{{ form.pay_status === 0 ? '下单' : '支付' }}</u-button
>
<view v-if="orderId" class="more" @click="isShowMoreAction = true"></view>
<view v-if="orderId && form.pay_status === 1 && form.status !== 4" class="more" @click="isShowMoreAction = true"></view>
</view>
<!-- 服务列表 -->
<u-popup
@ -736,6 +733,8 @@ export default {
}
}
this.form['created_at'] = res['created_at']
this.form['status'] = res['status']
this.form['nurse_id'] = res['nurse_id']
this.fileList = res.files.map(i => ({
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;

@ -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
}
}
}
</script>

@ -5,13 +5,34 @@
<view class="top">
<image class="avatar" mode="aspectFit" :src="vuex_user.headimgurl || vuex_default_icon"></image>
<view class="info">
<view class="info-name">{{ vuex_user.nickname || '微信用户' }}</view>
<view class="info-mobile">手机号{{ vuex_user.mobile || '' }}</view>
<view v-if="token" class="info" @click="isShowMyInfo = true">
<view class="info-name">
{{ vuex_user.nickname || '微信用户' }}
</view>
<view class="info-mobile">手机号
<text v-if="vuex_user.mobile">
{{ vuex_user.mobile || '' }}
</text>
<!-- <u-button shape="circle"-->
<!-- size="mini"-->
<!-- type="primary"-->
<!-- ripple>获取手机号</u-button>-->
</view>
</view>
<view v-else class="info">
<view class="info-name">未登录</view>
<u-button shape="circle"
size="mini"
type="primary"
ripple
@click="$u.route({
url: '/pages/login/login',
type: 'redirect'
})">点击登录</u-button>
</view>
</view>
<view class="panel panel1">
<view v-if="token" class="panel panel1">
<view class="tab"
@click="$u.route({
url: '/package_sub/pages/OrderList/OrderList',
@ -44,6 +65,7 @@
@click="$u.route({
url: '/package_sub/pages/OrderList/OrderList',
params: {
pay_status: 2
}
})">
<image class="tab__icon" mode="aspectFit" src="~@/static/index/jiuyifuwu.png"></image>
@ -51,43 +73,128 @@
</view>
</view>
<view class="panel panel2">
<view class="row" @click="isShowShare = true">
<button class="row" open-type="share">
<u-icon class="row__icon" name="share"></u-icon>
<view>我要分享</view>
</view>
</button>
<view class="row">
<u-icon class="row__icon" name="man-add"></u-icon>
<view>加入我们</view>
</view>
<view class="row">
<u-icon class="row__icon" name="heart"></u-icon>
<view>关注</view>
</view>
<view class="row">
<u-icon class="row__icon" name="kefu-ermai"></u-icon>
<view>联系我们</view>
</view>
<!-- <view class="row" v-if="token" @click="logout">-->
<!-- <u-icon class="row__icon" name="backspace"></u-icon>-->
<!-- <view>退出</view>-->
<!-- </view>-->
</view>
<tabbar />
<share v-model="isShowShare" />
<!-- 设置头像 -->
<view class="myinfo">
<u-popup v-model="isShowMyInfo" mode="bottom" :border-radius="30" safe-area-inset-bottom>
<view class="form-wrapper">
<u-form :model="form" ref="uForm" label-width="140rpx">
<u-form-item label="头像">
<button class="btn-normal" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<image :src="form.headimgurl || vuex_default_icon" mode="aspectFit"></image>
</button>
</u-form-item>
<u-form-item label="性别">
<u-radio-group v-model="form.sex">
<u-radio name="男"></u-radio>
<u-radio name="女"></u-radio>
<u-radio name="保密">保密</u-radio>
</u-radio-group>
</u-form-item>
<!-- <u-form-item label="手机号">-->
<!-- <button class="btn-normal" open-type="getPhoneNumber" @getphonenumber="onPhoneNumber">-->
<!-- <view>{{ vuex_user.mobile || '点击授权' }}</view>-->
<!-- </button>-->
<!-- </u-form-item>-->
</u-form>
</view>
<!-- 操作按钮 -->
<view class="footer">
<view class="btn-wrapper">
<u-button type="primary" shape="circle" ripple :custom-style="{ 'width': '90%', 'margin': 'auto' }" @click="submit"></u-button>
</view>
</view>
</u-popup>
</view>
</view>
</template>
<script>
import { ROOTPATH } from '@/common/config'
import { WXBizDataCrypt } from '@/libs/WXBizDataCrypt'
import Tabbar from "@/component/Tabbar/Tabbar.vue";
import Share from "@/component/Share/Share.vue";
export default {
components: {
Tabbar,
Share
Tabbar
},
data() {
return {
isShowShare: false
isShowMyInfo: false,
form: {
headimgurl: '',
mobile: '',
sex: ''
},
};
},
methods: {
onChooseAvatar(e) {
uni.uploadFile({
url: ROOTPATH + "/api/mobile/upload-file",
filePath: e.detail.avatarUrl,
name: 'file',
header: {
['Authorization']: `Bearer ${this.token}`
},
success: (res) => {
uni.showToast({
title: '上传成功',
duration: 1000,
icon: 'none'
})
let data = JSON.parse(res.data)
this.form.headimgurl = data.url
}
})
},
submit() {
this.$u.api.updateUser(this.form).then(async (_) => {
const { user } = await this.$u.api.getUserInfo()
this.$u.vuex('vuex_user', user)
this.$u.toast('保存成功')
this.isShowMyInfo = false
})
},
logout() {
uni.showModal({
title: '提示',
content: '确认退出?',
success: status => {
if (status.confirm) {
this.$u.vuex('vuex_token', '')
this.$u.vuex('vuex_user', {})
uni.setStorageSync('lifeData', {})
this.$u.route({
url: '/pages/index/index',
type: 'tab'
})
}
}
})
}
},
computed: {
token() {
return this.vuex_token || uni.getStorageSync('lifeData')?.vuex_token
}
},
onLoad() {
},
@ -160,6 +267,16 @@ export default {
}
}
.panel2 {
button {
border: none;
background-color: transparent;
line-height: 1.5;
font-size: 28rpx;
color: #333;
&::after {
border: none;
}
}
.row {
display: flex;
padding: 20rpx 10rpx;
@ -173,4 +290,40 @@ export default {
}
}
}
.form-wrapper {
margin: 20rpx auto 20rpx auto;
padding: 0 40rpx;
width: 94%;
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
border-radius: 16rpx;
background: #fff;
.btn-normal {
display: block;
margin: 0;
padding: 0;
line-height: normal;
background: none;
border-radius: 0;
box-shadow: none;
border: none;
font-size: unset;
text-align: unset;
overflow: visible;
color: inherit;
image {
width: 120rpx;
height: 120rpx;
border-radius: 100%;
border: 2px solid #fff;
margin-right: 30rpx;
}
}
.btn-normal::after {
border: none
}
}
</style>

@ -1,6 +1,6 @@
<template>
<view>
<view class="wrap safe-area-inset-bottom">
<view class="wrap safe-area-inset-bottom" v-if="token">
<view class="u-tabs-box">
<u-tabs-swiper
:height="76"
@ -82,16 +82,17 @@
</view>
<view class="bottom">
<view class="time">
<text>下单时间 </text>
<text>{{ i.created_at ? $moment(i.created_at).format('YYYY年MM月DD日 HH:mm') : '' }}</text>
</view>
<view class="row1">
<view class="time">
<text>下单时间 </text>
<text>{{ i.created_at ? $moment(i.created_at).format('YYYY年MM月DD日 HH:mm') : '' }}</text>
</view>
<u-button ripple
shape="circle"
:custom-style="payBtnStyle"
:throttle-time="2000"
@click="$u.route({
<u-button ripple
shape="circle"
:custom-style="payBtnStyle"
:throttle-time="2000"
@click="$u.route({
url: '/package_sub/pages/AddOrder/AddOrder',
params: {
order_id: i.id,
@ -100,7 +101,8 @@
}
})"
>{{ i.pay_status === 0 ? '立即支付' : '查看订单' }}</u-button
>
>
</view>
</view>
</view>
<u-loadmore
@ -112,6 +114,19 @@
</swiper-item>
</swiper>
</view>
<view v-if="!token">
<u-empty :margin-top="360" text="未登录" mode="order">
<u-button shape="circle"
slot="bottom"
type="primary"
ripple
@click="$u.route({
url: '/pages/login/login',
type: 'redirect'
})">点击登录</u-button>
</u-empty>
</view>
<Tabbar />
</view>
</template>
@ -180,7 +195,9 @@ export default {
};
},
onShow() {
this.getOrder(true);
if (this.token) {
this.getOrder(true);
}
},
created() {
for (let i = 0; i < this.tabs.length; i++) {
@ -194,6 +211,9 @@ export default {
return function (status) {
return this.vuex_order_status.find(i => i.value === status)?.name
}
},
token() {
return this.vuex_token || uni.getStorageSync('lifeData')?.vuex_token
}
},
methods: {
@ -371,14 +391,16 @@ page {
.bottom {
padding: 6rpx 28rpx 35rpx 43rpx;
display: flex;
align-items: center;
justify-content: space-between;
.row1 {
display: flex;
align-items: center;
justify-content: space-between;
.time {
font-size: 24rpx;
color: #999999;
font-weight: 500;
.time {
font-size: 24rpx;
color: #999999;
font-weight: 500;
}
}
}
}

@ -63,13 +63,9 @@ const store = new Vuex.Store({
value: 1,
},
{
name: "服务中",
name: "已退款",
value: 2,
},
{
name: "已完成",
value: 3,
},
}
// {
// name: '已取消'
// }

Loading…
Cancel
Save