<template>
	<view class="u-page">
		<view class="se-flex  se-flex-v-sa se-pt-140">
			<image class="se-w-300 se-h-300" src="@/static/image/success.png" mode=""></image>
			<view class="se-c-black se-fw-6 se-fs-44 se-ta-c se-mt-20">
				恭喜你，聘用成功
			</view>
			<view class="se-fs-26 se-ta-c  se-mt-20">
				等待师傅确认
			</view>
		</view>
		<view class="se-px-40 se-mt-140">
			<view class="se-px-20 se-pb-80 se-fs-20 se-flex">
				<view @click="onOrderDetail()"
					class="se-mx-10 se-flex-1 se-br-40 se-flex-h-c se-h-80 se-lh-80 se-ta-c se-fs-28 se-c-white se-bgc-orange">
					<text>查看订单详情</text>
				</view>
				<view @click="onCancel()"
					class="se-mx-10 se-flex-1 se-b se-br-40 se-flex-h-c se-h-80 se-lh-80 se-ta-c se-fs-28 se-c-66 se-bgc-f5">
					<text>取消订单</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { deleteOrder } from "@/common/api.js"
	
	export default{
		data(){
			return{
				id:null
			}
		},
		onLoad(options) {
			console.info("求职者订单详情："+options.id)
			this.id = options.id
		},
		methods:{
			onOrderDetail(){
				let that = this;
				uni.redirectTo({
					url:`/pages_subpack/job-order-detail/index?orderId=${that.id}`
				})
			},
			onCancel(){
				uni.showModal({
					title: '确认取消',
					content: '确定要取消这个订单吗？',
					success: (res) => {
						if (res.confirm) {
							uni.showLoading({
								title: '取消中...'
							})
							deleteOrder(this.id).then(res => {
								uni.hideLoading()
								if (res.code == 200) {
									uni.showToast({
										title: '取消成功',
										icon: 'success'
									})
									// 返回上一页
									uni.navigateBack({
										delta: 1
									})
								} else {
									uni.showToast({
										title: res.message || '取消失败',
										icon: 'none'
									})
								}
							}).catch(error => {
								uni.hideLoading()
								uni.showToast({
									title: '取消失败',
									icon: 'none'
								})
							})
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
</style>