<!--
  Copyright (c) 2020.
  author: song
  email: 15235360226@163.com
  -->

<template>
  <div class="inner">
    <bread-crumb :arr="arr" class="pb-5 mb-5" />
    <div class="white pa-5 mb-5 d-flex flex-nowrap align-center justify-space-between">
      <div>
        <span class="font-16 textColor">联系人：</span>
        <a-input :default-value="name" style="width:auto" />
      </div>
      <div>
        <span class="font-16 textColor">联系电话：</span>
        <a-input :default-value="phone" style="width:auto" />
      </div>
      <div>
        <span class="font-16 textColor">公司名称：</span>
        <a-input :default-value="company" style="width:200px" />
      </div>
    </div>
    <div class="cart-box">
      <div :key="list.id" class="d-flex flex-column pa-5 white div-box mb-8" v-for="list in lists">
        <p class="font-bold-20 title-color">{{ list.title }}</p>
        <div
          :key="index"
          @click="jumpDetails(item)"
          class="d-flex flex-nowrap flex-row pointer mb-8"
          v-for="(item, index) in list.list"
        >
          <img :src="item.src" class="cart-pic mr-8" />
          <div class="flex-1 flex-column">
            <p class="font-bold-20 title-color">{{ item.title }}</p>
            <p class="font-14 textColor">{{ item.content }}</p>
          </div>
        </div>
      </div>
    </div>
    <div class="d-flex flex-row-reverse pb-10">
      <a-button type="primary">提交</a-button>
    </div>
  </div>
</template>

<script>
import { mapState, mapMutations } from 'vuex';
import BreadCrumb from 'components/BreadCrumb/BreadCrumb.vue';
import { front } from 'config/api';

export default {
  name: 'Cart',
  components: { BreadCrumb },
  data() {
    return {
      arr: [{ name: '购物车', url: '' }],
      name: '张三',
      phone: '15233330000',
      company: '山西传控电子科技有限公司',
      lists: [
        {
          id: 1,
          title: '服务',
          list: [
            {
              src: 'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2059927486,2456161292&fm=26&gp=0.jpg',
              title: '检验检测服务',
              content: '用户填写的需求描述',
            },
            {
              src: 'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2059927486,2456161292&fm=26&gp=0.jpg',
              title: '检验检测服务',
              content: '用户填写的需求描述',
            },
          ],
        },
        {
          id: 2,
          title: '设备',
          list: [
            {
              src: 'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2059927486,2456161292&fm=26&gp=0.jpg',
              title: '检验检测服务',
              content: '用户填写的需求描述',
            },
            {
              src: 'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2059927486,2456161292&fm=26&gp=0.jpg',
              title: '检验检测服务',
              content: '用户填写的需求描述',
            },
          ],
        },
      ],
    };
  },
  computed: mapState('home', []),
  created() {},
  methods: {
    ...mapMutations('home', []),
    // 获取活动公告列表
    async getData() {
      try {
        this.setActIpCon(this.iptCon);
        const params = {
          param: {},
        };
        // const res = await front(params);
        // const { data, msg, code } = res.data;
        // if (code === 200) {
        //   this.lists = data.list;
        //   this.total = parseInt(data.total);
        // }
      } catch (error) {
        console.log(error);
      }
    },

    // 跳转到详情界面
    jumpDetails(item) {
      console.log('item: ', item);
      // this.$router.push('/ActDetails');
    },
  },
};
</script>

<style scoped lang="stylus">
.inner {
  margin: 40px auto;
}

.cart-box {
  .div-box {
    box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
  }

  .cart-pic {
    width: 233px;
    height: 128px;
  }
}
</style>
