Dining_Hall/pages/advanceOrder/payResult.vue

184 lines
5.6 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<page-meta :page-font-size="fontValue+'px'" :root-font-size="fontValue+'px'"></page-meta>
<view>
<div class="body"></div>
<view style="width: 100%;height: 50vh;display: flex;flex-direction: column;align-items: center;">
<view style="margin-top: 20vh;display: flex;flex-direction: column;align-items: center;width: 100%;">
<u-icon name="checkmark-circle-fill" size="64" color="#00aa00"></u-icon>
<view style="color: 00aa00;font-size: 36rpx;margin-top: 40rpx;color: #00aa00;">支付成功</view>
<view style="font-size: 48rpx;width: 100%;text-align: center;margin: 20rpx;font-weight: bold;">{{(resultData.payAmount/100).toFixed(2)}}</view>
<view style="width: 80%;display: flex; justify-content: space-between;margin: 20rpx auto;">
<view class="search-btn" @click="goIndex">返回首页</view>
<view class="back-btn" @click="goDetail">查看订单</view>
</view>
</view>
<!-- <view style="margin-top: 20vh;display: flex;flex-direction: column;align-items: center;width: 100%;" v-else>
<u-icon name="error-circle-fill" size="64" color="#ff007f"></u-icon>
<view style="color: 00aa00;font-size: 36rpx;margin-top: 40rpx;">支付失败</view>
<view style="width: 80%;display: flex; justify-content: space-between;margin: 20rpx auto;">
<view class="search-btn" @click="goBack">返回</view>
<view class="back-btn" @click="goIndex">取消</view>
</view>
</view> -->
</view>
</view>
</template>
<script>
import { syncPayStateApi } from '@/api/advanceOrder/index.js'
export default {
data() {
return {
fontValue:uni.getStorageSync('fontSize') || 8,
resultData:{},
};
},
onLoad(option) {
this.resultData = JSON.parse(option.result)
this.$forceUpdate()
console.log(this.resultData)
console.log(this.resultData.orderList[0])
setTimeout(()=>{
this.syncPayState()
},1000)
// this.resultData = {
// "accBal": 1267,
// "code": 10000,
// "expireTime": null,
// "extParam": null,
// "goodIdSet": null,
// "lessAmountForDelivery": 0,
// "msg": "成功",
// "orderAmountChangeList": [
// ],
// "orderList": [
// {
// "canteenId": "378928463446282240",
// "canteenName": "宏源工业园",
// "checkState": null,
// "commentState": 2,
// "couponAmount": 0,
// "deductionType": 1,
// "deliveryAmount": 0,
// "discountsAmount": 0,
// "dishesState": 1,
// "expireTime": null,
// "imgUrl": null,
// "lessAmountForDelivery": null,
// "machineName": null,
// "machineNum": null,
// "machineSn": null,
// "macOrderId": "416036469958774785",
// "mealCode": null,
// "mealtimeName": "下午茶",
// "mealtimeType": "3",
// "needPayAmount": 70,
// "orderDate": "2025-02-20",
// "orderDetailList": [
// {
// "calcTotalAmount": 70,
// "checkState": null,
// "detailId": "416036470088798208",
// "detailState": 1,
// "detailType": 1,
// "goodsDishesId": "385949065063436288",
// "goodsDishesImgUrl": "http://sgwpdm.ah.sgcc.com.cn/canteen/lnyst/378915229716713472/dishes/8e3978b0f293495d91c12666633744a3.jpg",
// "goodsDishesName": "萝卜包",
// "goodsDishesTypeName": null,
// "goodsRefundNum": 0,
// "imageUrl": "http://sgwpdm.ah.sgcc.com.cn/canteen/lnyst/378915229716713472/dishes/8e3978b0f293495d91c12666633744a3.jpg",
// "menuDetailId": "413945018588336132",
// "orderId": "416036469958774786",
// "prefPrice": 70,
// "price": 70,
// "quantity": 1,
// "realAmount": 0,
// "realPrice": 0.0,
// "refundAmount": 0,
// "salePrice": 70,
// "salesMode": 1,
// "shoppingCartId": "416036442989400064",
// "tasteName": null,
// "totalAmount": 70,
// "unitName": null,
// "weightUnit": 100
// }
// ],
// "orderDetailSum": 1,
// "orderId": "416036469958774786",
// "orderRefundState": 1,
// "orderState": 4,
// "orderStateMixMobile": 22,
// "orderTime": "2025-02-19 10:02:24",
// "orderType": 2,
// "packingAmount": 0,
// "payableAmount": 70,
// "payState": 1,
// "payTime": null,
// "payType": 1,
// "plateNum": null,
// "plateSerialNum": null,
// "realAmount": 0,
// "refundAmount": 0,
// "refundTime": null,
// "sourceType": 7,
// "stallId": "379068538876334080",
// "stallName": "外卖提前一天预定下午1600截止订单第二天下午1630取货"
// }
// ],
// "payAmount": 70,
// "payParamStr": null,
// "redEnvelope": 0,
// "subsidyBal": 0,
// "tradeId": "416036469958774784",
// "unpaidBalance": 0,
// "walletBal": 1267,
// }
},
methods:{
async syncPayState() {
let param = {
"orderId":this.resultData.orderList[0].orderId,
"ifManualSync": 2
}
const res = await syncPayStateApi(param)
console.log(res)
},
goIndex(){
uni.switchTab({
url: '/pages/index'
})
},
goBack(){
uni.navigateBack()
},
goDetail(){
uni.navigateTo({
url: `/pages/work/details?params=${JSON.stringify(this.resultData.orderList[0])}`
})
},
}
};
</script>
<style scoped>
.search-btn{
width: 40%;background: #fff;
height: 40px;line-height: 40px;
text-align: center;color: #000;font-size: 28rpx;
border-radius: 10rpx;margin-top: 40rpx;
border: 1px solid #ccc;
}
.back-btn{
width: 40%;background: #ff6633;height: 40px;line-height: 40px;text-align: center;color: #fff;border-radius: 10rpx;margin-top: 40rpx;font-size: 28rpx;
}
</style>