<template>
	<view>
		<!-- 顶部操作条 -->
		<cu-custom :bgColor="'bg-main-color'" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">支付结果</block>
		</cu-custom>
		<view class="padding-lg margin-xl text-center">
			<view class="text-xxl">{{payResult ? '支付成功' : '支付失败'}}</view>
			<view class="margin-top">
				<view class="cu-btn bg-main-color radius text-xl shadow-blur" @click="showMyOrder">查看我的订单</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				payResult: false,
				servOrderTabList: [{
					type: 'ordersWait2Pay',
					name: '待付款'
				}, {
					type: 'ordersWait2Serv',
					name: '待服务'
				}, {
					type: 'ordersServing',
					name: '服务中'
				}, {
					type: 'ordersAfterServ',
					name: '售后中'
				}, {
					type: 'ordersFinish',
					name: '已完成'
				}],
				servOrderType: 'servOrder'
			}
		},
		onLoad(options) {
			if (options.payResult === '0') {
				this.payResult = true;
			}
		},
		methods: {
			showMyOrder() {
				let params = null;
				if (this.payResult) {
					params = {
						orderType: this.servOrderType,
						tabHeaderList: this.servOrderTabList,
						tabCur: 1
					}
				} else {
					params = {
						orderType: this.servOrderType,
						tabHeaderList: this.servOrderTabList,
						tabCur: 0
					}
				}
				uni.navigateTo({
					url: '/pages/my/my-order?tabInfo=' + encodeURIComponent(JSON.stringify(params))
				})
			}
		},
	}
</script>

<style>
</style>
