<!--
 * @Description: 详情弹框
 * @Author: Sugar.
 * @Date: 2023-11-24 13:55:00
 * @LastEditors: Sugar.
 * @LastEditTime: 2023-11-24 13:55:00
 * @FilePath: \cattle_webui\src\views\distribution\recordMr\dialog\details.vue
 * @Copyright: Copyright (c) 2016~2023 by Sugar., All Rights Reserved.
-->
<template>
  <el-dialog
    title="订单详情"
    :visible.sync="open"
    width="800px"
    append-to-body
    :close-on-click-modal="false"
    @close="cancel"
  >
    <div class="dialog" v-if="form">
      <!--   基础信息   -->
      <div class="title-class" style="margin-top: 0">基础信息</div>
      <el-row>
        <el-col :span="12">
          <div class="grid-content bg-purple item-class">票务名称: <span>{{ form.goodsName || ''}}</span></div>
        </el-col>
        <el-col :span="12">
          <div class="grid-content bg-purple item-class">订单号: <span>{{ form.id || '' }}</span></div>
        </el-col>
        <el-col :span="12">
          <div class="grid-content bg-purple item-class">购票人姓名: <span>{{ form.memberName || '' }}</span></div>
        </el-col>
        <el-col :span="12">
          <div class="grid-content bg-purple item-class">购票人手机号: <span>{{ form.memberMobile || '' }}</span></div>
        </el-col>
        <el-col :span="12">
          <div class="grid-content bg-purple item-class">购票人身份证号: <span>{{ form.memberCardId || '' }}</span></div>
        </el-col>
        <el-col :span="12">
          <div class="grid-content bg-purple item-class">剧名名称: <span>{{ form.performName || '' }}</span></div>
        </el-col>
        <el-col :span="12">
          <div class="grid-content bg-purple item-class">票务类型: <span>{{ form.seatTypeName || '' }}</span></div>
        </el-col>
        <el-col :span="12">
          <div class="grid-content bg-purple item-class">场次: <span>{{form.performDate}}   {{ form.performTimeStart }} -- {{ form.performTimeEnd }}</span></div>
        </el-col>
        <el-col :span="12">
          <div class="grid-content bg-purple item-class">购票渠道: <span>{{ sourceList[form.source] || '' }}</span></div>
        </el-col>
        <el-col :span="12">
          <div class="grid-content bg-purple item-class">购票数量: <span>{{ form.viewerNum || '' }}</span></div>
        </el-col>
        <!-- <el-col :span="12">
          <div class="grid-content bg-purple item-class">支付总额: <span>￥{{ form.orderPrice || '' }}</span></div>
        </el-col> -->
        <el-col :span="12">
            <div class="grid-content bg-purple item-class">应收金额: <span>￥{{ form.orderPrice || form.orderPrice == 0 ?
              form.orderPrice : '' }}</span></div>
          </el-col>
          <el-col :span="12">
            <div class="grid-content bg-purple item-class">实收金额: <span>￥{{ form.realPrice || form.realPrice == 0 ?
              form.realPrice : '' }}</span></div>
          </el-col>
        <el-col :span="12">
          <div class="grid-content bg-purple item-class">下单时间: <span>{{ form.createTime || '' }}</span></div>
        </el-col>
        <el-col :span="12">
          <div class="grid-content bg-purple item-class">优惠信息: <span>暂无</span></div>
        </el-col>
        <el-col :span="12">
          <div class="grid-content bg-purple item-class">支付时间: <span>{{ form.payTime || '' }}</span></div>
        </el-col>
        <!-- <el-col :span="12">
          <div class="grid-content bg-purple item-class">支付方式: <span>{{ payWayList[form.payWay] || '' }}</span></div>
        </el-col>
        <el-col :span="12">
          <div class="grid-content bg-purple item-class">订单状态: <span>{{ statusList[form.status] || '' }}</span></div>
        </el-col> -->
        <el-col :span="12">
            <div class="grid-content bg-purple item-class" style="display: flex;">支付方式: <span
                style="display: block;margin-left: 5px;"><dict-tag :options="dict.type.pay_way_type"
                  :value="form.payWay" /></span></div>
          </el-col>
          <el-col :span="12">
            <div class="grid-content bg-purple item-class" style="display: flex;">订单状态: <span
                style="display: block;margin-left: 5px;"><dict-tag :options="dict.type.order_status_type"
                  :value="form.status" /></span></div>
          </el-col>
      </el-row>


      <!--   观影人员信息   -->
      <div class="title-class">观影人员信息</div>
      <el-row>
        <el-col :span="24">
          <el-table ref="tables" :data="form.viewersList" border>
            <el-table-column label="序号" align="center" type="index" width="60"></el-table-column>
            <el-table-column label="姓名" align="center" prop="name" />
            <el-table-column label="身份证号码" align="center" prop="idcard" />
            <el-table-column label="核销状态" align="center">
              <template slot-scope="scope">
                <el-tag v-if="scope.row.qrcodeStatus == 0">未使用</el-tag>
                <el-tag v-if="scope.row.qrcodeStatus == 1" type="success">已使用</el-tag>
                <el-tag v-if="scope.row.qrcodeStatus == 2" type="info">过期</el-tag>
              </template>
            </el-table-column>
            <el-table-column label="核销时间" align="center" prop="qrcodeUseTime" />
            <el-table-column label="座位信息" align="center" prop="seatName" />
          </el-table>
        </el-col>
      </el-row>
    </div>

    <span slot="footer" class="dialog-footer">
      <el-button type="primary" @click="cancel">确定</el-button>
    </span>

  </el-dialog>
</template>

<script>
import { getSelectById } from '@/api/order/orderMr'
export default {
  name: "detailsDia",
  dicts: ['order_form_type', 'order_status_type', 'pay_way_type', 'personnel_type'],
  data() {
    return {
      title: "编辑",
      model: "EDIT",
      open: false,
      loading: false,
      form: {
        id: undefined,
      },
      performerVisible: false,
      performerList: [],
      refund: false,
      statusList: {
        0: '待支付',
        2: '超时取消',
        3: '待使用',
        4: '退款中',
        5: '己退款',
        6: '退款失败',
        7: '己使用',
        8: '己超期',
        9: '关闭',
      },
      payList: {
        0: '未支付',
        1: '已支付',
        2: '支付中',
        3: '支付失败',
        4: '支付退款',
      },
      payWayList: {
        'cahsh': '现金',
        'wecaht.applet': '微信小程序支付',
        'alipay': '支付宝',
        'wecaht.h5': '微信公众号支付',
        'meituan': '美团支付',
      },
      sourceList: {
        1: '小程序',
        2: '公众号',
        3: '美团',
        4: '携程',
        5: '团购',
      },
      dataList: []
    };
  },
  methods: {
    /**
     * 打开弹框
     * @date 2023-11-22
     * @param {any} obj
     * @returns {any}
     */
    openDialog(title, obj, type) {
      this.open = true;
      this.getSelectByIdApi(obj);
    },
    /** 获取详情 */
    getSelectByIdApi(row) {
      const id = row.orderId
      getSelectById(id).then(response => {
        this.form = response.data;
      });
    },
    /**
     * 关闭弹框
     * @date 2023-11-22
     * @returns {any}
     */
    cancel() {
      this.open = false;
    },
  },
};
</script>

<style lang="scss" scoped>
.dialog {
  padding: 0 30px;
  max-height: 65vh;
  overflow-y: auto;
}
.dialog {
  padding: 0 30px;
  .upload-btn {
    width: 100px;
    height: 100px;
    background-color: #fbfdff;
    border: dashed 1px #c0ccda;
    border-radius: 5px;
    i {
      font-size: 30px;
      margin-top: 20px;
    }
    &-text {
      margin-top: -10px;
    }
  }
  .avatar {
    cursor: pointer;
  }
  .title-class{
    font-size: 16px;
    font-weight: bold;
    color: black;
    margin-bottom: 20px;
    margin-top: 20px;
  }
  .item-class{
    margin-bottom: 20px;
  }
}
</style>
