<template>
  <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: 18px;margin-top: 40rpx;color: #00aa00;">支付成功</view>
			
			<view style="font-size: 24px;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: 18px;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 { getRechargeResultApi,getRechargeQueryResultApi } from '../../api/index/index'
export default {
  data() {
    return {
		resultData:{}, 
    };
  }, 
  onLoad(option) {
		this.resultData = JSON.parse(option.result)
		this.$forceUpdate()
		console.log(this.resultData)
		console.log(this.resultData.orderList[0])
		
		// 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": "外卖（提前一天预定，下午16：00截止订单；第二天下午16：30取货）"
		// 		}
		// 	],
		// 	"payAmount": 70,
		// 	"payParamStr": null,
		// 	"redEnvelope": 0,
		// 	"subsidyBal": 0,
		// 	"tradeId": "416036469958774784",
		// 	"unpaidBalance": 0,
		// 	"walletBal": 1267,
		// }   
	
  },
  methods:{
	  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;
		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;
	}

</style>