<template>
  <view>
    <view class="i_title">
      {{itemTitle}}
    </view>
    <view>
      <table class="i_table">
        <thead>
          <tr>
            <th>名称</th>
            <th>单价</th>
            <th>数量</th>
            <th>合计</th>
            <th>备注</th>
          </tr>
        </thead>
        <tbody>
          <tr v-for="item in list">
            <td>{{item[title].name}}</td>
            <td>{{item.itemPrice}}</td>
            <td>{{item.itemCount}}</td>
            <td>{{item.itemMoney}}</td>
            <td>{{item.remark}}</td>
          </tr>
        </tbody>
      </table>
    </view>
  </view>
</template>

<script>
export default {
  name: "ticketsItem",
  props:{
    list: {
      type: Array,
      default: () => {return []}
    },
    title: {
      type: String,
      defalut: ""
    }
  },
  data:{
    itemTitle: null
  },
  created(){
    this.getTitle()
  },
  methods:{
    getTitle(){
      switch (this.title){
        case "project":
          this.itemTitle =  "项目"
          break
        case "wares":
          this.itemTitle =   "配件"
          break
        case "others":
          this.itemTitle =   "其他"
          break
        default:
          return ""
      }
    }
  }
}
</script>

<style scoped lang="less">
.i_table{
  width: 100%;
  text-align: center;
}
.i_title{
  font-size: 1.2rem;
}
</style>
