orderDetail.vue 9.61 KB
<template>
  <div class="marketing">
    <div class="container-detail">
      <div class="order-info">
        <div class="order-info-title">订单信息</div>
        <glsx-rows class="order-info-wrap" :layoutData="detailData" :layoutParams="orderParams">
          <template slot="refundDate" slot-scope="scope">
            <span class="text-14 color-3 line-20">{{ dateFormatFun(scope.scope.refundDate) }}</span>
          </template>
        </glsx-rows>
      </div>

      <div class="order-info">
        <div class="order-info-title">基本信息</div>
        <glsx-rows class="order-info-wrap" :layoutData="detailData" :layoutParams="basicParams">
          <template slot="paySource">
            <span class="text-14 color-3 line-20">微信支付</span>
          </template>
          <template slot="orderStatus">
            <span class="text-14 color-3 line-20">已付款</span>
          </template>
        </glsx-rows>
        <glsx-descriptions class="order-info-desc" :tableModel="theSameDescri" :showData="detailData">
          <span slot="couponList" slot-scope="scope">
            {{ scope.scope.couponList && scope.scope.couponList.length > 0 ? scope.scope.couponList[0].couponName : ' — ' }}
          </span>
          <template slot="orderType" slot-scope="scope">
            <span>{{ scope.scope.orderType == 1 ? '套餐' : '权益卡' }}</span>
          </template>
          <template slot="amount">
            <span>1</span>
          </template>

          <template slot="totalPrice" slot-scope="scope">
            <span>{{ scope.scope.originalPrice * 1 }}</span>
          </template>
          <template slot="orderStatus" slot-scope="scope">
            <span>{{ scope.scope.orderStatus == 2 ? '待收货' : scope.scope.orderStatus == 3 ? '已完成' : scope.scope.orderStatus == 4 ? '售后中' : scope.scope.orderStatus == 5 ? '退款失败' : scope.scope.orderStatus == 6 ? '已退款' : '' }}</span>
          </template>
        </glsx-descriptions>
      </div>
      <template v-if="detailData.orderType == 1">
        <div class="order-info">
          <div class="order-info-title">套餐使用详情</div>
          <GLTable class="meal-table" ref="mealRef" :searchForm="tableSearchForm" :getListApi="getListApi" :hasPage="false" :tableParams="tableParams">
            <div slot="verification" slot-scope="scope">
              <GLTable :hasNum="false" class="verificationTable" :hasPage="false" :noDataImg="url" :tableParams="verificationParams" :tableData="scope.scope.verificationPackageCouponList">
                <span slot="verificationDate" slot-scope="scope">
                  {{ dateFormatFun(scope.scope.verificationDate) }}
                </span>
              </GLTable>
            </div>
            <div slot="discountType" slot-scope="scope">
              <img class="content-meal-logo" :src="numToCoupon[scope.scope.discountType]" />
            </div>
            <div slot="residueCount" slot-scope="scope">
              <span v-if="scope.scope.residueCount == -1">无限次</span>
              <span v-else>{{ scope.scope.residueCount }}</span>
            </div>
          </GLTable>
        </div>
      </template>
    </div>
  </div>
</template>

<script>
import { getOrderPageDetail, getCouponList } from '@/api/modules/order'
import { dateFormat } from '@/utils/index.js'
export default {
  data() {
    return {
      detailData: {}, //this.$route.query.detail,
      mylist: [],
      layout: 'sizes, prev, pager, next, jumper, ->, total',
      tableTotal: 0,
      pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
      orderParams: [
        {
          label: '订单编号:',
          prop: 'orderCode',
          span: 8
        },
        {
          label: '下单时间:',
          prop: 'createDate',
          span: 8
        },
        {
          label: '退款时间:',
          prop: 'refundDate',
          addHtml: 'refundDate',
          span: 8,
          isHidden: data => {
            if (data.orderStatus == 4 || data.orderStatus == 5 || data.orderStatus == 6) {
              return true
            }
            return false
          }
        },
        {
          label: '退款说明:',
          prop: 'refundReason',
          span: 8,
          isHidden: data => {
            if (data.orderStatus == 4 || data.orderStatus == 5 || data.orderStatus == 6) {
              return true
            }
            return false
          }
        },
        {
          label: '推荐人:',
          prop: 'shareStaffName',
          span: 8
        }
      ],
      basicParams: [
        {
          label: '用户名称:',
          prop: 'accountName',
          span: 8
        },
        {
          label: '手机号:',
          prop: 'mobile',
          span: 8
        },
        {
          label: '付款状态:',
          prop: 'orderStatus',
          addHtml: 'orderStatus',
          span: 8
        },
        {
          label: '付款金额:',
          prop: 'realPayPrice',
          span: 8
        },
        {
          label: '付款方式:',
          prop: 'paySource',
          addHtml: 'paySource',
          span: 8
        },
        {
          label: '付款时间:',
          prop: 'createDate',
          span: 8
        },
        {
          label: '开通门店:',
          prop: 'merchantName',
          span: 8
        }
      ],
      theSameDescri: [
        {
          colList: [{ thColspan: 1, tdColspan: 5, label: '商品名称', name: 'couponList', addHtml: 'couponList' }]
        },
        {
          colList: [
            { thColspan: 1, tdColspan: 2, label: '类型', name: 'orderType', addHtml: 'orderType' },
            { thColspan: 1, tdColspan: 2, label: '单价/元', name: 'originalPrice' }
          ]
        },
        {
          colList: [
            { thColspan: 1, tdColspan: 2, label: '数量', name: 'amount', addHtml: 'amount' },
            { thColspan: 1, tdColspan: 2, label: '小计/元', name: 'totalPrice', addHtml: 'totalPrice' }
          ]
        },
        {
          colList: [
            { thColspan: 1, tdColspan: 2, label: '实收金额', name: 'realPayPrice', color: '#5850FF' },
            { thColspan: 1, tdColspan: 2, label: '状态', name: 'orderStatus', addHtml: 'orderStatus' }
          ]
        }
      ],
      getListApi: getCouponList,
      tableParams: {
        listName: '',
        tableOption: false,
        tableColumns: [
          {
            label: '',
            prop: '',
            columnattrs: {
              type: 'expand'
            },
            addHtml: 'verification'
          },
          {
            label: '券类型',
            prop: 'discountType',
            addHtml: 'discountType',
            width: '240'
          },
          {
            label: '券名称',
            prop: 'couponName',
            width: '180'
          },
          {
            label: '已核销次数',
            prop: 'usedCount'
          },
          {
            label: '剩余核销次数',
            prop: 'residueCount',
            addHtml: 'residueCount'
          }
        ]
      },
      verificationParams: {
        listName: 'list',
        tableOption: false,
        tableColumns: [
          {
            label: '核销门店',
            prop: 'verificationMerchantName',
            width: 300
          },
          {
            label: '核销日期',
            prop: 'verificationDate',
            addHtml: 'verificationDate',
            width: 300
          }
        ]
      },
      numToCoupon: {
        2: require('../../assets/coupon/icon-discount.png'),
        3: require('../../assets/coupon/icon-cash.png'),
        4: require('../../assets/coupon/icon-exchange.png'),
        7: require('../../assets/coupon/icon-service.png')
      },
      tableSearchForm: {}
    }
  },
  created() {
    if (window.__POWERED_BY_QIANKUN__) {
      this.accountLevel = this.$globalState.session.accountLevel
    }
    this.tableSearchForm = {
      id: this.$route.query.id
    }

    this.getOrderPageDetail()
  },
  mounted() {},
  methods: {
    dateFormatFun(date) {
      return dateFormat(date)
    },
    getOrderPageDetail() {
      getOrderPageDetail({ id: this.$route.query.id }).then(res => {
        if (res.code == '0') {
          this.detailData = res.data
        } else {
          this.$message.error(`${res.message}`)
        }
      })
    },
    goBack() {
      this.$router.push('/memberCenter/order')
    }
  }
}
</script>

<style lang="scss" scoped>
.marketing {
  .container-detail {
    padding-bottom: 20px;
    .order-info {
      width: 100%;
      height: auto;
      background: #ffffff;
      box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
      margin-bottom: 10px;
      &-title {
        line-height: 28px;
        font-size: 16px;
        font-weight: 500;
        color: #333333;
        padding: 15px 0 15px 20px;
        border-bottom: 1px solid #d8d8d8;
      }

      &-wrap {
        padding: 32px 68px;
      }
      &-desc {
        padding: 0 0 32px 68px;
        margin-top: -12px;
      }
      .meal-table {
        padding: 20px;
        .verificationTable {
          padding-left: 10px;
        }
        .content-meal-logo {
          width: 58px;
          height: 22px;
        }
      }
    }
    .m-b-7 {
      margin-bottom: 70px;
    }
  }
  .footer-panel {
    position: fixed;
    bottom: 0px;
    height: 78px;
    left: 220px;
    width: 100%;
    background: #ffffff;
    box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
    z-index: 999;
    div {
      display: inline-block;
      position: relative;
      transform: translate(-50%, -50%);
      left: 50%;
      top: 50%;
      margin-left: -110px;
    }
  }
}
</style>