<template>
	<view>
		<view class="paddding-x-two" v-if="JSON.stringify(detailData) != '{}'">
			<releaseForm :detailData="detailData" :statusBtn="detailInfo.status" @submit="handleSubmit"></releaseForm>
		</view>
	</view>
</template>

<script>
	import {
		orderDetailMsgNew,
		updateOrderFunction
	} from '../../api/system/index.js'
	import releaseForm from '@/components/form.vue'
	export default {
		components: {
			releaseForm
		},
		data() {
			return {
				detailInfo: {},//从上个页面接受的参数
				detailData:{},//详情页的数据
			}
		},
		onLoad(option) {
			if(option.detailInfo){
				this.detailInfo = JSON.parse(decodeURIComponent(option.detailInfo))
				this.getOrder()
			}
		},
		methods: {
			//获取订单详情列表
			getOrder() {
				let that = this
				orderDetailMsgNew({
					id: that.detailInfo.id
				}).then(res => {
					console.log('订单详情', res)
					if (res.code == 200) {
						that.detailData = res.data
					}
				})
			},
			//重新发布和修改按钮事件
			handleSubmit(data){
				console.log(data,'表单重新提交')
				updateOrderFunction(data).then(res=>{
					console.log(res,'重新提交返回')
				})
			}
		}
	}
</script>

<style>
	@import url("@/css/form.css");

	::v-deep .u-border {
		border: 0 !important;
		background: #F5F5F5 !important;
	}

	::v-deep .u-upload__wrap__preview {
		margin: 0 6rpx 10rpx 0 !important;
	}
</style>
