This commit is contained in:
闫晓茹 2023-10-31 15:49:29 +08:00
parent e7be819cf3
commit 7528aeba63
7 changed files with 229 additions and 92 deletions

View File

@ -8,4 +8,27 @@ export function getListByDoctor(doctorId) {
Authorization: 'Bearer' + ' ' + uni.getStorageSync('token') Authorization: 'Bearer' + ' ' + uni.getStorageSync('token')
}, },
}) })
}
//提交
export function addHealthConsultationOrder(data) {
return request({
url: `/nurseApp/healthConsultation/addHealthConsultationOrder`,
method: 'POST',
data,
header: {
Authorization: 'Bearer' + ' ' + uni.getStorageSync('token')
},
})
}
//小程序购买商品订单支付接口
export function appletGoodsOrderPay(data) {
return request({
url: `/nurseApp/weChatPayment/appletGoodsOrderPay`,
method: 'post',
data,
header: {
Authorization: 'Bearer' + ' ' + uni.getStorageSync('token')
},
})
} }

View File

@ -11,8 +11,8 @@
placeholder-class="placeholder"> placeholder-class="placeholder">
</view> </view>
</u-navbar> </u-navbar>
<!-- <u-tabs :list="tabslist" :is-scroll="false" :current="tabscurrent" @change="tabschange" :show-bar='false' <u-tabs :list="tabslist" :is-scroll="false" :current="tabscurrent" @change="tabschange" :show-bar='false'
active-color='#26A888'></u-tabs> --> active-color='#26A888'></u-tabs>
<view class="" v-if="total>0" style="margin-top: 80rpx;padding: 3%;"> <view class="" v-if="total>0" style="margin-top: 80rpx;padding: 3%;">
<view class="Apayment" v-for='(item,index) in orderlist' :key="index"> <view class="Apayment" v-for='(item,index) in orderlist' :key="index">
<view class="names">店铺名称 <view class="names">店铺名称
@ -130,28 +130,30 @@
data() { data() {
return { return {
tabslist: [ tabslist: [
// { {
// name: '', name: '全部',
// orderStatus: '', orderStatus: '',
// }, },
// { {
// name: '', name: '待付款',
// orderStatus: 'WAIT_PAY', orderStatus: 'WAIT_PAY',
// }, { },
// name: '', {
// orderStatus: 'WAIT_RECEIVED_GOODS', name: '待接单',
// }, { orderStatus: 'WAIT_RECEIVED_GOODS',
// name: '', },
// orderStatus: 'RECEIVED_GOODS', {
// }, name: '待服务',
// { orderStatus: 'RECEIVED_GOODS',
// name: '', },{
// orderStatus: 'EVALUATED', name: '待评价',
// }, orderStatus: 'RECEIVED_GOODS',
// { },
// name: '', {
// orderStatus: 'RECEIVED_GOODS', name: '已完成',
// } orderStatus: 'EVALUATED',
},
], ],
tabscurrent: 0, tabscurrent: 0,
background: { background: {
@ -161,7 +163,7 @@
orderTypeList: { orderTypeList: {
patientId: '', patientId: '',
orderType: 'HEALTH_CONSULTATION', orderType: 'HEALTH_CONSULTATION',
orderStatus: 'RECEIVED_GOODS', orderStatus: '',
// goodsOrderId: '', // // goodsOrderId: '', //
pageSize: 15, // pageSize: 15, //
pageNum: 1, // pageNum: 1, //
@ -179,15 +181,15 @@
}, },
methods: { methods: {
//tabs //tabs
// tabschange(index) { tabschange(index) {
// console.log(this.tabslist) console.log(this.tabslist)
// this.tabscurrent = index; this.tabscurrent = index;
// this.orderTypeList.orderStatus = this.tabslist[index].orderStatus this.orderTypeList.orderStatus = this.tabslist[index].orderStatus
// console.log(this.orderTypeList.orderStatus, '999') console.log(this.orderTypeList.orderStatus, '999')
// console.log(this.orderTypeList.orderType, '99') console.log(this.orderTypeList.orderType, '99')
// this.goodsOrderinfo(); this.goodsOrderinfo();
// }, },
// //
goprevious() { goprevious() {
uni.navigateBack({ uni.navigateBack({

View File

@ -1,6 +1,53 @@
.app { .app {
padding: 0 0 124rpx; padding: 0 0 124rpx;
width: 100%; width: 100%;
// 弹框支付
.payment {
width: 100%;
height: 130rpx;
font-size: 42rpx;
color: #000000;
line-height: 130rpx;
text-align: center;
border-bottom: 1rpx solid #D8D4D4;
}
.chat {
position: relative;
height: 200rpx;
span {
position: absolute;
top: 50rpx;
left: 180rpx;
line-height: 70rpx;
font-size: 42rpx;
color: #000000;
}
image {
position: absolute;
top: 50rpx;
left: 70rpx;
width: 80rpx;
height: 70rpx;
}
}
.submits {
background: #26A888;
width: 501rpx;
height: 71rpx;
line-height: 71rpx;
border-radius: 36rpx;
font-size: 34rpx;
color: #FFFFFF;
text-align: center;
position: fixed;
bottom: 50rpx;
left: 50%;
transform: translateX(-50%);
}
.btns { .btns {
width: 100%; width: 100%;
height: 124rpx; height: 124rpx;

View File

@ -142,6 +142,19 @@
@funcValue="getpickerParentValue" pickerSize="4"> @funcValue="getpickerParentValue" pickerSize="4">
</m-city> </m-city>
</view> </view>
<!-- 弹框 -->
<u-popup v-model="buyshow" mode="bottom" length="45%" border-radius="30" :closeable='true'>
<view class="payment">
请选择支付方式
</view>
<view class="chat">
<image src="/static/chat.png" mode=""></image>
<span>微信支付</span>
</view>
<view class="submits" @tap='buy'>
确认支付{{formdata.price}}
</view>
</u-popup>
<u-toast ref="uToast" /> <u-toast ref="uToast" />
</view> </view>
</template> </template>
@ -156,7 +169,9 @@
consultationInfo consultationInfo
} from '@/api/pagesB/createnewconsultation/createnewconsultation.js' } from '@/api/pagesB/createnewconsultation/createnewconsultation.js'
import { import {
getListByDoctor getListByDoctor,
addHealthConsultationOrder,
appletGoodsOrderPay
} from '@/api/pagesB/confirmation/index.js' } from '@/api/pagesB/confirmation/index.js'
import tabs from '@/components/utabs/u-tabs.vue' import tabs from '@/components/utabs/u-tabs.vue'
export default { export default {
@ -166,6 +181,7 @@
}, },
data() { data() {
return { return {
buyshow: false,
uoloadaction: '', // uoloadaction: '', //
list: [], list: [],
addresslength: null, addresslength: null,
@ -195,7 +211,25 @@
appointmentStartTime: null, appointmentStartTime: null,
appointmentEndTime: null, appointmentEndTime: null,
orderChannel: "WECHAT_APPLET", orderChannel: "WECHAT_APPLET",
} },
updatalist: {
consultationInfoId: '',
totalPrice: null,
receiver: null,
hospitalPersonId: null,
hospitalPersonName: '',
orderChannel: "WECHAT_APPLET",
patientId: null,
phone: null,
healthAppointDate: null,
appointmentStartTime: null,
appointmentEndTime: null,
// "healthConsultationContent": '',
},
id:'',
}; };
}, },
onLoad(options) { onLoad(options) {
@ -227,6 +261,7 @@
}, },
// //
taptime(item, index) { taptime(item, index) {
console.log(item, '8')
this.formdata.appointmentStartTime = item.starttime this.formdata.appointmentStartTime = item.starttime
this.formdata.appointmentEndTime = item.endtime this.formdata.appointmentEndTime = item.endtime
this.timeindex = index this.timeindex = index
@ -236,6 +271,7 @@
if (this.timecurrent != index) { if (this.timecurrent != index) {
this.timecurrent = index this.timecurrent = index
this.timeindex = 0 this.timeindex = 0
// console.log(this.formdata.appointmentStartTime, '889')
this.formdata.appointmentStartTime = this.appointmentTimeList[this.timecurrent].morningList[0] this.formdata.appointmentStartTime = this.appointmentTimeList[this.timecurrent].morningList[0]
.starttime .starttime
this.formdata.appointmentEndTime = this.appointmentTimeList[this.timecurrent].morningList[0] this.formdata.appointmentEndTime = this.appointmentTimeList[this.timecurrent].morningList[0]
@ -260,60 +296,84 @@
onuploaded() { onuploaded() {
this.info(); this.info();
}, },
//
buy() {
var that =this
that.updatalist.hospitalPersonId = that.formdata.doctorId
that.updatalist.hospitalPersonName = that.formdata.doctorName
that.updatalist.totalPrice = that.formdata.price
that.updatalist.receiver = that.formdata.patientName
that.updatalist.patientId = that.formdata.patientId
that.updatalist.phone = that.formdata.phone
that.updatalist.healthAppointDate = that.formdata.appointmentDate
that.updatalist.appointmentStartTime = that.formdata.appointmentStartTime
that.updatalist.appointmentEndTime = that.formdata.appointmentEndTime
addHealthConsultationOrder(that.updatalist).then(res => {
console.log(res, '6')
res.data.payType = "WECHAT_PAY"
res.data.paymentPrice = res.data.totalPrice
res.data.openid = uni.getStorageSync('openid');
that.id = res.data.id
appletGoodsOrderPay(res.data).then(response => {
if (response.code == 200) {
uni.requestPayment({
timeStamp: response.data.timeStamp,
nonceStr: response.data.nonceStr,
package: response.data.prepayId,
signType: response.data.signType,
paySign: response.data.paySign,
success: function(res) {
that.$refs.uToast.show({
title: '支付成功',
type: 'success',
duration: 1500,
})
if (that.timer) {
clearTimeout(that.timer)
}
that.timer = setTimeout(e => {
uni.redirectTo({
url: '/pagesB/paysuccess/paysuccess'
})
}, 1500)
},
fail: function(err) {
that.$refs.uToast.show({
title: '取消支付',
type: 'error',
duration: 1500,
})
if (that.timer) {
clearTimeout(that.timer)
}
that.timer = setTimeout(e => {
uni.redirectTo({
url: `/pagesB/orderDetails/orderDetails?goodsOrderId=${that.id}`
})
}, 1500)
}
});
} else {
that.$refs.uToast.show({
title: response.msg,
type: 'error',
duration: 2000
})
}
})
})
},
//
info() { info() {
consultationInfo(this.formdata).then(res => { consultationInfo(this.formdata).then(res => {
if (res.code == 200) { if (res.code == 200) {
res.data.payType = "WECHAT_PAY" this.buyshow = true
res.data.paymentPrice = res.data.totalPrice this.updatalist.consultationInfoId = res.data.id
res.data.openid = this.openid } else if (res.code == 500) {
let id = res.data.id this.$refs.uToast.show({
appletGoodsOrderPay(res.data).then(response => { title: res.msg,
if (response.code == 200) { type: 'error',
uni.requestPayment({ duration: 1500,
timeStamp: response.data.timeStamp,
nonceStr: response.data.nonceStr,
package: response.data.prepayId,
signType: response.data.signType,
paySign: response.data.paySign,
success: function(res) {
that.$refs.uToast.show({
title: '支付成功',
type: 'success',
duration: 1500,
})
if (that.timer) {
clearTimeout(that.timer)
}
that.timer = setTimeout(e => {
// uni.redirectTo({
// url: `/pages/CommodityOrder/CommodityOrder`
// // url: `/pages/orderDetails/orderDetails?goodsOrderId=${id}`
// })
}, 1500)
},
fail: function(err) {
that.$refs.uToast.show({
title: '取消支付',
type: 'error',
duration: 1500,
})
if (that.timer) {
clearTimeout(that.timer)
}
that.timer = setTimeout(e => {
// uni.redirectTo({
// url: `/pages/orderDetails/orderDetails?goodsOrderId=${id}`
// })
}, 1500)
}
});
} else {
that.$refs.uToast.show({
title: response.msg,
type: 'error',
duration: 2000
})
}
}) })
} }
}) })
@ -338,6 +398,7 @@
res.data[0]?.morningList[0]?.endtime ? this.formdata.appointmentEndTime = res.data[0] res.data[0]?.morningList[0]?.endtime ? this.formdata.appointmentEndTime = res.data[0]
.morningList[0].endtime : '' .morningList[0].endtime : ''
this.appointmentTimeList = res.data this.appointmentTimeList = res.data
// console.log(this.appointmentTimeList, '666')
}) })
}, },
// //

View File

@ -139,6 +139,7 @@
}, },
onLoad(options) { onLoad(options) {
let that = this let that = this
console.log(options)
this.updata = JSON.parse(options.updata) this.updata = JSON.parse(options.updata)
}, },
methods: { methods: {

View File

@ -142,7 +142,7 @@
} from '@/api/pagesB/confirmOrder/index.js' } from '@/api/pagesB/confirmOrder/index.js'
import { import {
confirmReceipt, confirmReceipt,
ssgoodsOrder ssgoodsOrder,
} from '@/api/pagesB/CommodityOrder/index.js' } from '@/api/pagesB/CommodityOrder/index.js'
import { import {
handCloseOrder handCloseOrder
@ -161,11 +161,13 @@
goodsOrderId: null, goodsOrderId: null,
patientId: '', patientId: '',
openid: null, openid: null,
orderTypeList: [ orderType: 'HEALTH_CONSULTATION',
'INTEGRAL_EXCHANGE', orderStatus: 'WAIT_PAY',
'DIRECT_BUY', // orderTypeList: [
], // 'INTEGRAL_EXCHANGE',
orderStatus: '', // 'DIRECT_BUY',
// ],
// orderStatus: '',
pageSize: 15, pageSize: 15,
pageNum: 1, pageNum: 1,
goodsName: '', goodsName: '',
@ -312,6 +314,7 @@
this.goodsOrderinfo() this.goodsOrderinfo()
}, },
onLoad(options) { onLoad(options) {
console.log(options,'88')
this.baseurl = baseurl this.baseurl = baseurl
this.orderTypeList.goodsOrderId = options.goodsOrderId this.orderTypeList.goodsOrderId = options.goodsOrderId
let that = this let that = this

BIN
static/chat.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB