Authored by lzhy

一件代发

  1 +<template>
  2 + <table cellspacing="0" cellpadding="0" class="order-detail">
  3 + <thead>
  4 + <tr>
  5 + <template v-for="(cols, index) in tableCols">
  6 + <th :key="index" :style="'width: ' + cols.width">{{ cols.title }}</th>
  7 + </template>
  8 + </tr>
  9 + </thead>
  10 + <tbody>
  11 + <template v-for="(goods, index) in tableData">
  12 + <tr :key="index">
  13 + <td>{{ goods.productSku }}</td>
  14 + <td>
  15 + <img
  16 + :src="
  17 + 'http://shopmanage.yohobuy.com/platform/product/getRemoteImageUrlBySku?sku_id=' +
  18 + goods.productSku +
  19 + '&size=40x60'
  20 + "
  21 + />
  22 + </td>
  23 + <td style="text-align: left">
  24 + <p>{{ goods.productName }}</p>
  25 + <p>{{ goods.prodcutCode }}</p>
  26 + <p>尺码:{{ goods.sizeName }} 颜色:{{ goods.colorName }}</p>
  27 + </td>
  28 + <td>{{ goods.buyNumber }}</td>
  29 + <td>{{ goods.retailPrice }}</td>
  30 + <td>{{ goods.salePrice }}</td>
  31 + <td>{{ goods.lastPrice }}</td>
  32 + <td>
  33 + {{
  34 + goodsPromos[goods.id] && goodsPromos[goods.id].couponsDiscountAmount
  35 + ? goodsPromos[goods.id].couponsDiscountAmount
  36 + : 0
  37 + }}
  38 + </td>
  39 + <td>{{ goodsPromos[goods.id] && goodsPromos[goods.id].yohoCoin ? goodsPromos[goods.id].yohoCoin : 0 }}</td>
  40 + <td>
  41 + {{ goodsPromos[goods.id] && goodsPromos[goods.id].redPackage ? goodsPromos[goods.id].redPackage : 0 }}
  42 + </td>
  43 + <td>
  44 + {{
  45 + goodsPromos[goods.id] && goodsPromos[goods.id].giftCardAmount ? goodsPromos[goods.id].giftCardAmount : 0
  46 + }}
  47 + </td>
  48 + <td>
  49 + {{
  50 + goodsPromos[goods.id] && goodsPromos[goods.id].activityAmount ? goodsPromos[goods.id].activityAmount : 0
  51 + }}
  52 + </td>
  53 + <td>{{ goods.subtotal }}</td>
  54 + </tr>
  55 + </template>
  56 + </tbody>
  57 + <tfoot>
  58 + <tr>
  59 + <td colspan="13" style="text-align: left">
  60 + <span>实付金额:¥{{ orderInfo.lastOrderAmount }}</span>
  61 + <span>快递费:¥{{ orderInfo.shippingCost }}</span>
  62 + </td>
  63 + </tr>
  64 + <tr>
  65 + <td td colspan="13">
  66 + <div class="ivu-card">
  67 + <div class="ivu-card-head" style="text-align: left">
  68 + <p slot="title">使用优惠券</p>
  69 + </div>
  70 + <i-table border :columns="couponsTableCols" :data="couponsData"></i-table>
  71 + </div>
  72 + </td>
  73 + </tr>
  74 + <tr>
  75 + <td colspan="13">
  76 + <template v-if="orderPromos">
  77 + <template v-for="(item, index) in orderPromos">
  78 + <Row :key="index">{{ item.promotionTitle }} {{ item.beginTime }} — {{ item.endTime }}</Row>
  79 + </template>
  80 + </template>
  81 + <template v-else>
  82 + <span>没有参加活动.</span>
  83 + </template>
  84 + </td>
  85 + </tr>
  86 + </tfoot>
  87 + </table>
  88 +</template>
  89 +
  90 +<script>
  91 +export default {
  92 + name: 'DataTable',
  93 + props: {
  94 + orderInfo: {
  95 + type: Array,
  96 + },
  97 + tableData: {
  98 + type: Array,
  99 + },
  100 + couponsData: {
  101 + type: Array,
  102 + },
  103 + goodsPromos: {
  104 + type: Object,
  105 + },
  106 + orderPromos: {
  107 + type: Object,
  108 + },
  109 + },
  110 + data() {
  111 + return {
  112 + tableCols: [
  113 + { title: 'sku', width: '8%' },
  114 + { title: '商品图片', width: '8%' },
  115 + { title: '商品信息', width: '10%' },
  116 + { title: '数量', width: '6%' },
  117 + { title: '吊牌价', width: '6%' },
  118 + { title: '销售价', width: '6%' },
  119 + { title: '成交价', width: '6%' },
  120 + { title: '优惠券', width: '6%' },
  121 + { title: 'YOHO币', width: '6%' },
  122 + { title: '红包', width: '6%' },
  123 + { title: '礼品卡', width: '6%' },
  124 + { title: '活动优惠', width: '6%' },
  125 + { title: '小计', width: '6%' },
  126 + ],
  127 + couponsTableCols: [
  128 + {
  129 + title: '优惠券名称',
  130 + key: 'couponTitle',
  131 + },
  132 + {
  133 + title: '优惠券面值',
  134 + key: 'couponAmount',
  135 + },
  136 + {
  137 + title: '优惠券金额调整',
  138 + key: 'couponAdjustAmount',
  139 + },
  140 + {
  141 + title: '费用承担类型',
  142 + key: 'feeSharingTypeStr',
  143 + },
  144 + {
  145 + title: '费用承担比例',
  146 + key: 'feeSharingRatio',
  147 + },
  148 + ],
  149 + };
  150 + },
  151 +};
  152 +</script>
  153 +<style lang="scss">
  154 +table.order-detail {
  155 + width: 100%;
  156 + height: auto;
  157 + thead {
  158 + th {
  159 + padding: 8px 0;
  160 + border: 1px solid #cccccc;
  161 + text-align: center;
  162 + }
  163 + }
  164 + tbody,
  165 + tfoot {
  166 + tr {
  167 + height: 35px;
  168 + td {
  169 + border: 1px solid #cccccc;
  170 + border-top: none;
  171 + border-right: none;
  172 + text-align: center;
  173 + padding: 5px;
  174 + span {
  175 + margin-left: 10px;
  176 + margin-right: 20px;
  177 + }
  178 + }
  179 + td:last-child {
  180 + border-right: 1px solid #cccccc;
  181 + }
  182 + }
  183 + }
  184 +}
  185 +</style>