<template>
  <div class="orderListItem">
    <div class="title flex-h">
      <div class="orange" v-if="returnStatus(data.MakeStatus) === '已下单'">
        <i class="iconfont icon-dengdai"></i><br>
        <span>{{returnStatus(data.MakeStatus)}}</span>
      </div>
      <div class="orange" v-if="returnStatus(data.MakeStatus) === '制作中'">
        <i class="iconfont icon-dengdai"></i><br>
        <span>{{returnStatus(data.MakeStatus)}}</span>
      </div>
      <div class="grey" v-if="returnStatus(data.MakeStatus) === '已取消'">
        <i class="iconfont icon-quxiao"></i><br>
        <span>{{returnStatus(data.MakeStatus)}}</span>
      </div>
      <div class="green" v-if="returnStatus(data.MakeStatus) === '已完成'">
        <i class="iconfont icon-gouxuan"></i><br>
        <span>{{returnStatus(data.MakeStatus)}}</span>
      </div>
      <div class="flex-item">
        <div>
          <span>{{data.CaseName}}</span>
        </div>
      </div>
      <span>{{toolClass.dateFormat(data.CreateDate, 'MM/dd hh:mm')}}</span>
    </div>
    <div class="line">
      <div>
        <i v-for="(iconItem,iconIndex) in 40" :key="iconIndex"></i>
      </div>
    </div>
    <div class="list flex-h">
      <div class="flex-item">
        <ul>
          <li v-for="(subItem,subIndex) in data.Goods" :key="subIndex">
            <span>{{subItem.GoodsName + (subItem.SpecName!==''?'('+subItem.SpecName+')':'')}}</span>
            <div>
              <span>￥{{subItem.Price}} x {{subItem.Number}}</span>
            </div>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import dict from '../../util/contants'

export default {
  name: '',
  props: ['data'],
  data () {
    return {

    }
  },
  components: {

  },
  created () {
    // console.log(dict)
    // console.log(JSON.stringify(this.data.MakeStatus))
  },
  methods: {
    returnStatus (val) {
      for (var n = 0; n < dict.orderStatus.length; n++) {
        if(val === dict.orderStatus[n].key){
          if (dict.orderStatus[n].value === '已下单'){
            dict.orderStatus[n].value = '制作中'
          }
          return dict.orderStatus[n].value
        }
      }
    },
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
@import 'page.scss';
</style>
