
<!-- 驳回原因用户姓名输入 -->
<template>
  <div>
    <a-divider orientation="left">下单用户信息</a-divider>
    <a-descriptions :column="4">
      <a-descriptions-item label="姓名" span="2">{{ info.user.name || info.user.nickname }}</a-descriptions-item>
      <a-descriptions-item label="电话" span="2">{{ info.user.username }}</a-descriptions-item>
      <a-descriptions-item label="身份" span="2">{{ info.user.identity.name || '--' }}</a-descriptions-item>
    </a-descriptions>
    <br/><a-divider orientation="left">{{ info.channel.text + info.operation_type.text }}</a-divider>
    <a-descriptions :column="4">
      <a-descriptions-item :label="info.channel.text + info.operation_type.text+ '方式'" span="2">{{ info.type.text }}</a-descriptions-item>
      <a-descriptions-item :label="info.operation_type.text + '数量'" span="2">{{ info.items_count.qty_all }}件</a-descriptions-item>
      <a-descriptions-item label="是否使用优惠券兑换" span="2">{{ info.items_count.coupon_all>0 ?'是':'否' }}</a-descriptions-item>
      <a-descriptions-item label="使用优惠券兑换数量" span="2" v-if="info.items_count.coupon_all>0">{{ info.items_count.coupon_all + '件' }}</a-descriptions-item>
      <a-descriptions-item label="使用优惠券兑换抵扣金额" span="2" v-if="info.items_count.coupon_all>0">{{ info.coupon.price + '元' }}</a-descriptions-item>
    </a-descriptions>
    <br/><a-divider orientation="left">购买商品</a-divider>
    <a-descriptions :column="4">
      <a-descriptions-item label="商品名称" span="2">{{ info.items[0].sku.goods_name }}</a-descriptions-item>
      <a-descriptions-item label="" span="2">
        <img :src="info.items[0].sku.cover" alt="" style="width: 200px;">
      </a-descriptions-item>
    </a-descriptions>
    <br/><a-divider orientation="left">订单信息</a-divider>
    <a-descriptions :column="4">
      <a-descriptions-item label="订单号" span="2">{{ info.order_no }}</a-descriptions-item>
      <a-descriptions-item label="订单状态" span="2">{{ info.state.text }}</a-descriptions-item>
      <a-descriptions-item label="下单时间" span="2">{{ info.created_at }}</a-descriptions-item>
      <a-descriptions-item label="快递单号" span="2">{{ info.express.express_no || '-' }}</a-descriptions-item>
      <a-descriptions-item label="收货人" span="2">{{ info.express.name || '-' }} {{ info.express.mobile?'('+info.express.mobile +')':'-' }}</a-descriptions-item>
      <a-descriptions-item label="收货地址" span="3">{{ info.express.full_address || '--' }}</a-descriptions-item>
    </a-descriptions>
    <br/>
  </div>
</template>

<script>
import { changeStatusTwo } from '@/api/organization'
export default {
  name: 'StockInfo',
  props: {
    info: {
      type: Object,
      default: () => {
          return {}
        }
    }
  },
  data: () => ({
    formItemLayout: {
      labelCol: { span: 6 },
      wrapperCol: { span: 14 }
    },
    loading: false
  }),
  beforeCreate () {
    this.form = this.$form.createForm(this)
  },
  methods: {
    onOk () {
      return new Promise(resolve => {
        this.form.validateFields((errors, values) => {
          if (!errors) {
            const params = {
              status: values.status
            }
            changeStatusTwo(this.item.order_item_id, params).then((res) => {
              this.$notification.success({
                message: '成功',
                description: '修改成功'
              })
              resolve(true)
            }).catch((err) => {
              this.$notification.error({
                message: '失败',
                description: err.message
              })
              resolve(false)
            })
          }
        })
      })
    }
  }
}
</script>

<style scoped>

</style>
