2024-05-29 21:49:52 +08:00
|
|
|
<template>
|
|
|
|
<view>
|
2024-06-05 19:15:26 +08:00
|
|
|
<!-- topbar -->
|
|
|
|
<u-navbar title="收银台" bgColor="#d43030" :titleStyle="{ color: '#FFF'}" :autoBack="true" placeholder>
|
|
|
|
<view class="u-nav-slot" slot="left">
|
|
|
|
<u-icon name="arrow-left" color="#fff" size="19"></u-icon>
|
|
|
|
</view>
|
|
|
|
</u-navbar>
|
2024-12-12 16:59:03 +08:00
|
|
|
<!-- 价格 -->
|
|
|
|
<view></view>
|
2024-06-05 19:15:26 +08:00
|
|
|
<button @click="pay" type="primary" style="margin-top:200rpx;">确认支付</button>
|
2024-05-29 21:49:52 +08:00
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
order_sn: '' //订单号
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onLoad(options) {
|
|
|
|
this.order_sn = options.order_sn; // 从提交订单页面传递过来的订单号
|
2024-12-12 16:59:03 +08:00
|
|
|
},
|
|
|
|
computed(){
|
|
|
|
|
2024-05-29 21:49:52 +08:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
// 支付方法
|
|
|
|
pay() {
|
|
|
|
uni.$u.http.post('/Api/Pay/pay', {
|
|
|
|
order_sn: this.order_sn
|
|
|
|
}, {
|
|
|
|
header: {
|
|
|
|
'Token': this.$store.state.userInfo.token,
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
|
|
}
|
2024-06-04 21:15:40 +08:00
|
|
|
}).then((res) => {
|
|
|
|
if (res.data.status === 1) {
|
|
|
|
// 调用微信支付接口
|
|
|
|
this.requestPayment(res.data.payMsg);
|
2024-06-12 14:43:07 +08:00
|
|
|
}else{
|
|
|
|
uni.showToast({
|
|
|
|
title: '支付失败',
|
|
|
|
icon: 'error'
|
|
|
|
});
|
|
|
|
console.error(res.data.msg)
|
2024-06-04 21:15:40 +08:00
|
|
|
}
|
2024-05-29 21:49:52 +08:00
|
|
|
})
|
2024-06-04 21:15:40 +08:00
|
|
|
},
|
|
|
|
// 调用微信支付接口
|
|
|
|
requestPayment(payMsg) {
|
|
|
|
uni.requestPayment({
|
|
|
|
timeStamp: payMsg.timeStamp,
|
|
|
|
nonceStr: payMsg.nonceStr,
|
|
|
|
package: payMsg.package,
|
|
|
|
signType: payMsg.signType,
|
|
|
|
paySign: payMsg.paySign,
|
|
|
|
success: (res) => {
|
2024-06-12 14:43:07 +08:00
|
|
|
if(res.status===1){
|
|
|
|
uni.showToast({
|
|
|
|
title: '支付成功',
|
|
|
|
icon: 'success'
|
|
|
|
})
|
|
|
|
}
|
2024-06-04 21:15:40 +08:00
|
|
|
},
|
|
|
|
fail: (err) => {
|
|
|
|
uni.showToast({
|
|
|
|
title: '支付失败',
|
2024-06-12 14:43:07 +08:00
|
|
|
icon: 'error'
|
2024-06-04 21:15:40 +08:00
|
|
|
});
|
2024-06-12 14:43:07 +08:00
|
|
|
console.error(err)
|
2024-06-04 21:15:40 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
2024-05-29 21:49:52 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|
|
|
</style>
|