<template>
  <view class="orderCard" @click="viewDetail">
	<view class="title">
	 {{'配件申请单'==titleText?"【"+order.repairName+"】":""}} {{ order.licenseNumber }} 的{{titleText}}
	</view>
	<view class="desc">
		{{'配件申请单'==titleText?'申请':'发起'}}时间：{{formatTimestamp(order.createTime)}}
	</view>
<!--	  <view class="message red" v-if="order.status=='05'">-->
<!--		  <view class="remark">-->
<!--			原因：{{ order.remark }}-->
<!--		  </view>-->
<!--	  </view>-->
<!--    <view v-if="'配件申请单'==titleText">-->
<!--      <image v-if="order.status=='05'" class="stateImg"  src="@/pages-repair/static/weitongguo.png" ></image>-->
<!--      <image v-else-if="order.status=='01'" class="stateImg"  src="@/pages-repair/static/daishenhe.png" ></image>-->
<!--      <image v-else class="stateImg"  src="@/pages-repair/static/yitongguo.png" ></image>-->
<!--    </view>-->
    </view>
</template>

<script>
import {
  getUserInfo,
  getStrData
} from '@/utils/auth';
import {formatTimestamp,getOrderStatusText,builderOrder,saveTicketsRecords} from "@/utils/utils";
import request from '@/utils/request';
export default {
  name: "orderCard",
  props: {
    order: {
      type: Object,
      default: () => {
        return {}
      }
    },
    titleText: {
      type: String,
      default: () => {
        return ""
      }
    },
  },
  data() {
    return {
    }
  },
  mounted(){
    let userInfo = getUserInfo()
    if(userInfo.roleCodes.includes("service_advisor") || userInfo.roleCodes.includes("general_inspection") || (userInfo.roleCodes.includes("repair_staff") && getStrData("ifLeader"))){
      //服务顾问、总检、维修班组长可以派工
      this.roleCanPg = true
    }
    if(userInfo.roleCodes.includes("service_advisor")){
      //服务顾问可以告知取车
      this.roleCanQc = true
    }
    if(userInfo.roleCodes.includes("repair_staff") && this.order.nowRepairId==userInfo.id){
      //维修工角色,并且指派处理的人就是当前用户可以接单
      this.roleCanJd = true
    }
  },
  onLoad(){

  },
  methods: {
    formatTimestamp(value){
      return formatTimestamp(value)
    },
    getFlagColor(flag) {
      if (flag == 1) {
        return '#E8A321'
      } else if (flag === 2) {
        return '#999'
      }
    },
    viewDetail(){
      this.$emit("childEvent",this.order)
    }
  }
}
</script>

<style lang="less" scoped>
.message{
	padding: 2px 0;
	font-size: 15px;
	margin-bottom: 10px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	.icon{
		width: 28rpx;
		height: 28rpx;
		margin-left: 10px;
		margin-right: 10px;
	}
	.goto{
		font-size: 30px;
		margin-right: 10px;
	}
}
.red{
	background: #FFEFEF;
	color: #F92C2C;
}

.orderCard {
  background: #FFFFFF;
  border-radius: 8rpx 8rpx 8rpx 8rpx;
  padding: 10px;
  margin: 10px 0;
  position: relative;
  .title {
	  font-weight: 600;
	  font-size: 30rpx;
	  color: #333333;
	  margin-left: 5px;
	}
	.desc{
		font-size: 28rpx;
		color: #858BA0
	}
	.remark{
		margin: 8px;
	}
	.stateImg{
		width: 50px;
		height: 50px;
		display: block;
		right: 0;
		top: 0;
		position: absolute;
	}
}



</style>
