<template>
  <div class="order-info-con common">
    <div class="title">订单信息</div>
    <div class="info-list">
      <div class="item">
        <div class="label">订单编号：</div>
        <div class="val">{{ data.oid }}</div>
        <div class="copy" @click="handleCopy(data.oid)">复制</div>
      </div>
      <div class="item">
        <div class="label">下单时间：</div>
        <div class="val">{{ data.createTime | timeFilter }}</div>
      </div>
      <div class="item">
        <div class="label">支付方式：</div>
        <div class="val">{{ PayMethodTypeLabel[data.payType] || '--' }}</div>
      </div>
      <div class="item">
        <div class="label">支付时间：</div>
        <div class="val">{{ data.payTime | timeFilter }}</div>
      </div>
    </div>
    <!-- <div class="link flex-default">
      <div class="item flex-default" @click="platformList">
        <m-icon icon="icon-service" :size="18" />
        <span class="label">联系客服</span>
      </div>
      <div class="line" />
      <div class="item flex-default" @click="shopList">
        <m-icon icon="icon-shop-blue" :size="18" />
        <span class="label">联系卖家</span>
      </div>
    </div> -->
  </div>
</template>

<script>
const PayMethodType = {
  DEFAULT: 0,
  ALIPAY: 1,
  WXPAY: 2,
  CCNY: 3,
  CREDIT: 4,
};
const PayMethodTypeLabel = {
  [PayMethodType.DEFAULT]: "默认",
  [PayMethodType.ALIPAY]: "支付宝",
  [PayMethodType.WXPAY]: "微信",
  [PayMethodType.CCNY]: "CCNY",
  [PayMethodType.CREDIT]: "积分",
};
export default {
  data() {
    return {
      PayMethodType,
      PayMethodTypeLabel,
    }
  },
  props: {
    data: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  computed: {},
  methods: {
    shopList() {
      this.contactCustomer(this.data.merchantId);
    },
    platformList() {
      this.contactCustomer("e3ac4b4a4e65460dbd9f1ec6cbd7a900");
    },
    contactCustomer(merchantId) {
      this.$showLoading();
      this.$api({
        apiName: "listShopCustomer",
        postData: { merchantId: merchantId },
        success: (res) => {
          if (res && res.length > 0) {
            let customer = res[0];
            let query = { customer: JSON.stringify(customer) };
            this.$router.push({ name: "customer-service-chat", query });
          } else {
            this.$toast("该商家暂未开通客服！");
          }
        },
        complete: () => {
          this.$hideLoading();
        },
      });
    },
  },
};
</script>

<style lang="less">
@import "../components/order-info.less";
</style>



