<template>
	<view>
		<view class="box">
			<view class="item">
				<view class="l">业务费用：</view>
				<view class="r">
					{{form.itemPrice}}元
				</view>
			</view>
			<view class="item">
				<view class="l">停车费用：</view>
				<view class="r">
					<text v-if="form.partMoney">{{form.partMoney}}</text>
					<text v-else>-</text>
				</view>
			</view>
			<view class="item">
				<view class="l">合计费用：</view>
				<view class="r">
					{{form.totalMoney}}元
				</view>
			</view>
			<view class="item">
				<view class="l">支付凭据：</view>
				<view class="r">
					<view class="img">
						<u-upload max-count="3" ref="license" :file-list="imgList" :action="uploadImageUrl" width="300" height="200"></u-upload>
					</view>
				</view>
			</view>
		</view>
		<u-button type="primary" @click="confirmFn">确认</u-button>
	</view>
</template>

<script>
	import request from '../../utils/request.js'
	export default {
		data() {
			return {
				id: '',
				form: {
					partMoney: 0
				},
				imgList: [],
				uploadImageUrl: request.server + '/upload/image',
			}
		},
		onLoad(options) {
			this.id = options.id;
		},
		onShow() {
			this.getBusinessById();
		},
		methods: {
			getBusinessById() {
				this.$api.getBusinessById({
					id: this.id
				}).then(resp => {
					this.form = resp.data;
				})
			},
			confirmFn(){
				this.$api.confirmPay({id:this.form.id}).then(Resp=>{
					this.$common.toast('已支付');
					setTimeout(()=>{
						this.$common.back()
					},500)
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #fff;
	}

	@import '@/common/common.scss'
</style>
