<template>
	<view class="allContent">
		<view class="list-item">
			<view><text>车牌号：</text><text>{{state.params['vehiclePlate']}}</text></view>
			<view><text>车牌颜色：</text><text>{{state.params['vehiclePlateColorC']}}</text></view>
			<view v-if="state.params['cardId']"><text>卡号：</text><text>{{state.params['cardId']}}</text></view>
			<view v-if="state.params['obuId']"><text>OBU号：</text><text>{{state.params['obuId']}}</text></view>
			<view><text>订单ID：</text><text>{{state.params['orderNo']}}</text></view>
			<view><text>业务类型：</text><text>{{state.params['businessTypeC']}}</text></view>
			<view><text>用户名称：</text><text>{{state.params['customerName']}}</text></view>
			<view><text>审核状态：</text><text>{{state.params['statusC']}}</text></view>
			<view v-if="state.params['orderStepValue']"><text>订单状态：</text><text>{{state.params['orderStepValue']}}</text></view>
			<view v-if="state.params['reason']"><text>原因：</text><text>{{state.params['reason']}}</text></view>
			<view><text>申请时间：</text><text>{{state.params['insertTime']}}</text></view>
			<view v-if="state.params['address']"><text>邮寄地址：</text><text>{{state.params['address']}}</text></view>
			<view class="btns">
				<view class="btn btn-primary" v-if="state.params['orderStep']=='WAIT_PAY'" @click="pay(state.params['orderNo'],state.params['orderType'])">支付</view>
				<view class="btn btn-primary" v-if="state.params['orderStep']=='DELIVER'" @click="gotoConfirmReceiptSH(state.params['id'])">确认收货</view>
				<view style="display: flex;" v-if="state.params['orderStep']=='ACTIVE_COMPLETE'||state.params['orderStep']=='RECEIVE' || state.params['orderStep']=='WRITE_CARD_COMPLETE' || state.params['orderStep']=='WRITE_OBU_COMPLETE'|| state.params['orderStep']=='EXCHANGE_APPLY'">
					<view class="btn btn-primary" @click="gotoExchangeOrder(state.params)">换货</view>
					<view class="btn btn-primary" @click="activateSH(state.params)">去激活</view>
				</view>
			    <!-- 注销 待支付 取消订单 -->
				<view class="btn btn-primary" v-if="state.params['orderStep']=='WAIT_PAY' && state.params['orderType']=='SIGNOUT'" @click="signout()">取消</view>
			</view>
		</view>
	</view>

</template>

<script setup lang="ts">
	import { reactive } from "vue";
	import { onLoad } from "@dcloudio/uni-app";
	import { pay,signout,gotoConfirmReceiptSH,activateSH,gotoExchangeOrder } from "@/composables/afterSale.js";
	const state = reactive({
		params: {},  //上一个页面传递过来的参数
		promoteName: "",  //产品名称
		promoteId: "",//产品编号
		tableData: [],

	});
    
	onLoad((options) => {
		state.params = JSON.parse(decodeURIComponent(options.params))
		console.log("options.promoteId", state.params)
	})
</script>

<style scoped>
	.allContent {
		background-color: #EEF7F7;
		height: 100vh;
		overflow: hidden;
	}

	.list-item {
		width: 95%;
		border-radius: 10rpx;
		margin: 30rpx auto;
		font-size: 28rpx;
		border: 1rpx solid #ccc;
		padding: 12rpx;
		box-sizing: border-box;
		background-color: white;

	}

	.list-item>view {
		margin-bottom: 20rpx;
		display: flex;
		align-items: center;
	}

	.list-item>view>text:first-child {
		width: 26%;
		display: inline-block;
	}

	.list-item>view>text:last-child {
		width: 74%;
		display: inline-block;
		word-break: break-all;
	}
	.btns {
		position: relative;
		display: flex;
		align-items: center;
		justify-content: flex-end;
		border-top: 1px solid #dcdcdc;
		margin: 0 30rpx;
		padding: 20rpx 0;
	}
	.btn-primary {
		border: 1px solid #00b38b;
		color: #00b38b;
	}
	.btn {
		height: 60rpx;
		line-height: 58rpx;
		border-radius: 30rpx;
		padding: 0 24rpx;
		font-size: 23rpx;
		box-sizing: border-box;
		margin-right: 12rpx;
	}
</style>