<template>
  <view>
    <view class="box">
      <view class="item">
        <view class="l">订单号：</view>
        <view class="r">
          {{ form.no }}
        </view>
      </view>
      <view class="item-line">
        业务项
      </view>
      <view class="item" v-for="item in form.items" :key="item.id">
        <view class="l" style="flex: 7;">{{ item.itemTypeName }}：</view>
        <view class="r">
          {{ item.itemName }}({{ item.itemPrice }}x{{ item.num }}={{ item.total }}元)
        </view>
      </view>
      <view class="item">
        <view class="l" style="flex: 7;">业务费：</view>
        <view class="r">
          {{ form.itemPrice }}
          <text>(元)</text>
        </view>
      </view>
      <view class="item">
        <view class="l" style="flex: 7;">境外车停车费：</view>
        <view class="r">
          {{ form.partMoney }}
          <text>(元)</text>
        </view>
      </view>
      <view class="item">
        <view class="l" style="flex: 7;">中国车停车费：</view>
        <view class="r">
          {{ form.chinaPartMoney }}
          <text>(元)</text>
        </view>
      </view>
      <view class="item">
        <view class="l" style="flex: 7;">合计费用：</view>
        <view class="r">
          {{ form.totalMoney }}元
        </view>
      </view>
    </view>
    <u-button type="primary" @click="confirmFn">马上支付</u-button>
  </view>
</template>

<script>
export default {
  data() {
    return {
      id: '',
      form: {
        partMoney: 0
      },
    }
  },
  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.confirmBusiness({ids: this.form.id}).then(Resp => {
        this.$common.toast('已确认');
        setTimeout(() => {
          this.$common.back()
        }, 500)
      })
    }
  }
}
</script>

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

.item-line {
  color: #a2a2a2;
  padding: 5px 0 10px 29px;
  border-bottom: 1px solid #E5E5E5;
}

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