<template>
  <div id="card-1">
    <el-row>
      <!-- 团购订单详情--商品详情 -->
      <el-col :span="24" class="main">
        <el-col :span="12" class="main_one">
          <el-col :span="24" class="add">
            <el-col :span="2">
              <i class="el-icon-location"></i>
            </el-col>
            <el-col :span="22">
              <el-col :span="24"> {{ address.name }},{{ address.phone }} </el-col>
              <el-col :span="24"> {{ address.province }} , {{ address.city }} , {{ address.area }} , {{ address.address }} </el-col>
            </el-col>
          </el-col>
          <el-col :span="24" class="shop"> <i class="el-icon-s-shop"></i>{{ shop.name }}</el-col>
          <el-col :span="24">
            <el-col :span="24" class="goods bode">
              <el-col :span="6" class="image"><el-image :src="getFile()"></el-image></el-col>
              <el-col :span="18">
                <el-col :span="12">
                  <el-col :span="24"> {{ goods.name }} </el-col>
                  <el-col :span="24"> 规格：{{ spec.name }} </el-col>
                </el-col>
                <el-col :span="12" class="money">
                  <el-col :span="24" style="color: red; font-size: 20px">
                    <p>￥{{ spec.price }}</p>
                  </el-col>
                  <el-col :span="24"> X{{ spec.num }} </el-col>
                  <el-col :span="24">
                    <span class="spanfour" style="color: blue" @click="toUrl(goods.url)"> 查看商品来源:{{ goods.source }}</span>
                  </el-col>
                  <el-col :span="24"> {{ form.is_afterSale == true ? '已申请售后' : '未申请售后' }} </el-col>
                </el-col>
              </el-col>
            </el-col>
          </el-col>
          <el-col :span="24" class="bode">
            <el-col :span="6">下单时间</el-col>
            <el-col :span="18" class="other">{{ form.buy_time }}</el-col>
          </el-col>
          <el-col :span="24" class="bode">
            <el-col :span="6">订单备注</el-col>
            <el-col :span="18" class="other">{{ form.remarks || '' }}</el-col>
          </el-col>
          <el-col :span="24" class="bode">
            <el-col :span="6">配送方式</el-col>
            <el-col :span="18" class="other">{{ form.transport_type_name || '待填写' }}</el-col>
          </el-col>
          <el-col :span="24" class="goods_total bode">
            <el-col :span="24" v-for="(item, index) in total_detail" :key="index">
              <el-col :span="8">{{ item.zh }}</el-col>
              <el-col :span="16" class="other">
                <p>￥{{ item.money }}</p>
              </el-col>
            </el-col>
          </el-col>
          <el-col :span="24" class="goods_total bode">
            <el-col :span="8">实付金额</el-col>
            <el-col :span="16" class="other">
              <p>￥{{ pay.pay_money }} 元</p>
            </el-col>
          </el-col>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'card-1',
  props: {
    address: { type: Object },
    shop: { type: Object },
    goods: { type: Object },
    spec: { type: Object },
    form: { type: Object },
    pay: { type: Object },
    total_detail: { type: Array },
  },
  components: {},
  data: function () {
    return {};
  },
  created() {
    this.search();
  },
  methods: {
    search() {},
    toUrl(url) {
      if (url) window.open(url, '_blank');
      else this.$message.error('该商品还未添加来源网址，无法跳转');
    },
    getActLength() {
      return _.get(this.total_detail, 'act.length');
    },
    // 选择商品
    getFile(value) {
      let name;
      if (this.spec.file && this.spec.file.length != 0) name = this.spec.file[0].url;
      else if (this.goods.file && this.goods.file.length != 0) name = this.goods.file[0].url;
      return name;
    },
  },
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped>
.main {
  // padding: 0 5%;
  .main_one {
    padding: 0 5%;
  }
  .add {
    border-bottom: 2px dashed #ccc;
    margin: 0 0 5px 0;
    padding: 5px 0;
  }
  .shop {
    padding: 4px 0;
    font-size: 18px;
    border-bottom: 1px solid #ccc;
  }
  .goods {
    padding: 10px 0;
    .image {
      padding: 0 10px 0 0;
    }
    .money {
      text-align: right;
    }
  }
  .transport {
    margin: 50px;
    padding: 5px;
    border: 1px solid rgb(254, 195, 195);
  }
  .other {
    text-align: right;
    word-break: break-all;
    p {
      color: red;
      font-size: 20px;
    }
    .spanfour {
      color: blue;
    }
  }
  .el-col {
    margin: 3px 0;
  }
  .bode {
    border-bottom: 1px solid rgb(238, 237, 237);
  }
  .form {
    margin: 20px 0 0 0;
  }
}

/deep/.el-timeline {
  margin: 20px 0 0 0;
  font-size: 16px;
}
/deep/.el-timeline-item__node:nth-child(1) {
  background-color: green;
}
</style>
