<template>
  <view class="container">
    <view class="containerBody">
      <VNavigationBar background-color="#fff" title="工单详情" title-color="#333"></VNavigationBar>
      <view class="body" v-if="null!=ticketInfo">
        <view class="orderInfo">
          <view class="orderTypeInfo">
            <text class="label">维修类别：</text>
            <text class="value" style="font-size: 35rpx">{{ ticketInfo.repairTypeText }}</text>
          </view>
          <view class="orderStateInfo">
            <text>当前工单状态：</text>
            <text v-if="ticketInfo.statusStr=='待维修' || ticketInfo.statusStr=='已作废'" >{{ ticketInfo.statusStr }}</text>
            <text v-else-if="ticketInfo.statusStr=='维修中'" style="color: #E8A321">{{ ticketInfo.statusStr }}</text>
            <text v-else style="color: #2979FF;">{{ ticketInfo.statusStr }}</text>
          </view>
          <view class="orderDateInfo">
            <text class="label">车辆进厂时间：</text>
            <text class="value">{{ ticketInfo.inTime }}</text>
          </view>
          <view class="orderDateInfo">
            <text class="label">预计竣工时间：</text>
            <text class="value">{{ ticketInfo.outTime }}</text>
          </view>
          <view class="orderDateInfo" v-if="ticketInfo.realOverDate">
            <text class="label">实际竣工时间：</text>
            <text class="value">{{ ticketInfo.realOverDate }}</text>
          </view>
        </view>
        <view class="card cardInfo carCard">
<!--          <view :class="{'end': ticketInfo.ticketsStatus == '02'}" class="orderFlag">-->
<!--            <template>-->
<!--              <image v-if="ticketInfo.ticketsStatus == '02'" mode="aspectFit" src="/static/icons/orderEnd.png"-->
<!--                     style="width: 48rpx;height: 48rpx"></image>-->
<!--              <image v-else mode="aspectFit" src="/static/icons/orderIng.png"-->
<!--                     style="width: 48rpx;height: 48rpx"></image>-->
<!--              <view class="flagBody">-->
<!--                <text>{{ ticketInfo.ticketsStatus == '02' ? '已完成' : ticketInfo.statusStr }}</text>-->
<!--                <text class="flagDesc" v-if="nowRepair.repairItemId">当前工单维修项目：{{ nowRepair.itemName }}</text>-->
<!--                <text class="flagDesc" v-if="ticketInfo.nowRepairName">当前处理人：{{ ticketInfo.nowRepairName }}</text>-->
<!--              </view>-->
<!--            </template>-->
<!--          </view>-->
<!--          <view v-if="wares && wares.length>0" v-for="item in wares" class="noReviewPart" @click="showReviewList(item)">-->
<!--            <u-icon color="#E8A321" name="error-circle-fill" size="14"></u-icon>-->
<!--            <text class="messageText">当前项目有待审批的配件申请单！</text>-->
<!--            <u-icon color="#E8A321" name="arrow-right" size="14"></u-icon>-->
<!--          </view>-->
<!--          <view class="carTitle">车辆信息</view>-->
          <view class="carDetail">
            <view class="carHeader">
              <image v-show="ticketInfo.carInfo.logoImg" :src="imgUrlPrex + ticketInfo.carInfo.logoImg" class="carImage" mode="aspectFit"></image>
              <view class="carHeaderRight">
                <text class="carNumber">{{ ticketInfo.carNo }}</text>
                <text class="carType">{{ ticketInfo.carBrandName+"  " }} <text v-if="ticketInfo.carInfo && ticketInfo.carInfo.carModel"> - {{ticketInfo.carInfo.carModel}}</text></text>
              </view>
            </view>
            <view class="line"></view>
            <view class="carBody">
              <view style="display: flex;flex-direction: column;">
                <view class="infoItem">
                  <view class="label">车主</view>
                  <view class="value">{{ ticketInfo.userName }}</view>
                </view>
                <view class="infoItem">
                  <text class="label">联系方式</text>
                  <text class="value">{{ ticketInfo.userMobile }}</text>
                </view>
                <view class="infoItem">
                  <text class="label">性别</text>
                  <text class="value">{{ ticketInfo.customerInfo.sex === '1' ? '女' : '男' }}</text>
                </view>
                <view class="infoItem" v-if="ticketInfo.handleName">
                  <text class="label">经办人</text>
                  <text class="value">{{ ticketInfo.handleName }}</text>
                </view>
                <view class="infoItem" v-if="ticketInfo.handleMobile">
                  <text class="label">经办人电话</text>
                  <text class="value">{{ ticketInfo.handleMobile }}</text>
                </view>
                <view class="line"></view>
                <view class="infoItem">
                  <view class="label">车架号</view>
                  <view class="value">{{ ticketInfo.carVin }}</view>
                </view>
                <view class="infoItem">
                  <view class="label">发动机号</view>
                  <view class="value">{{ ticketInfo.carInfo.engineNumber }}</view>
                </view>
                <view class="infoItem">
                  <view class="label">车辆注册日期</view>
                  <view class="value">{{ ticketInfo.carRegisterDate }}</view>
                </view>
                <view class="infoItem">
                  <view class="label">年检到期时间</view>
                  <view class="value">{{ ticketInfo.nextInspectionDate}}</view>
                </view>
                <view class="infoItem">
                  <view class="label">保险到期时间</view>
                  <view class="value">{{ ticketInfo.insuranceExpiryDate}}</view>
                </view>
                <view class="infoItem">
                  <view class="label">最近保养日期</view>
                  <view class="value">{{ ticketInfo.maintenanceDate}}</view>
                </view>
                <view class="infoItem">
                  <view class="label">最近保养公里数</view>
                  <view class="value">{{ ticketInfo.maintenanceMileage}}</view>
                </view>
              </view>
            </view>
          </view>
        </view>
        <!-- 维修工时项目-编辑 -->
        <view v-if="(loginUser.roleCodes.includes('weixiu') || loginUser.roleCodes.includes('service_advisor')||loginUser.roleCodes.includes('general_inspection')) && isDetail == '0'">
          <view v-if="ticketInfo.projects && ticketInfo.projects.length > 0 " class="card cardInfo projCard">
            <view class="projTitle">维修工时项目</view>
            <view class="projList">
              <template>
                <view v-for="(item,index) in ticketInfo.projects" :key="item.id" class="projEditItem">
                  <view  class="del-proj-box" @click="delProj(item.id,index)"><uni-icons type="trash" size="25" style="color: #0174F6"></uni-icons></view>
                  <view class="projEditLine1">
                    <text>{{ item.itemName }}</text>
                    <text v-if="canSeeMoney"  class="projAmount">￥{{ item.itemMoney }}</text>
                  </view>
                  <view  class="projBaseInfo" >
                    <view v-if="canSeeMoney">售价：<input class="edit-proj-input" @input="onKeyInput('sj',item)" type="decimal" placeholder="请输入售价" v-model="item.itemPrice" /></view>
                    <view>数量：<input class="edit-proj-input" @input="onKeyInput('sl',item)" type="number" placeholder="请输入数量" v-model="item.itemCount" /></view>
                    <!--                  <view>单位：{{ item.itemUnit}}</view>-->
                    <view v-if="canSeeMoney">折扣：<input class="edit-proj-input" @input="onKeyInput('zk',item)" type="decimal" placeholder="请输入折扣（0-1）" v-model="item.itemDiscount" /></view>
                    <view v-if="canSeeMoney">金额：<input  type="number" disabled placeholder="请输入售价" v-model="item.itemMoney" /></view>
                  </view>
                  <view class="projEditFoot">
                    <view class="block1">
                      <template>
                        <view class="editPeople">
                          <view class="editForm">
                            <text class="label">服务顾问</text>
                            <text >{{item.saleName || ""}}
                            </text>
                          </view>
                          <image  src="/static/icons/edit.png" style="width: 28rpx;height: 28rpx"
                                 @click="editPeople('xs', item)"></image>
                        </view>
                      </template>
                      <template >
                        <image @click="editPeople('xs', item)"src="/pages-order/static/addIcon.png" style="width: 28rpx;height: 28rpx"></image>
                        <!--                      <text class="addText" @click="editPeople('xs', item)">添加服务顾问</text>-->
                      </template>
                    </view>
                    <view class="line"></view>
                    <view class="block2">
                      <template>
                        <view class="editPeople">
                          <view class="editForm">
                            <text class="label">施工人员</text>
                            <text >{{ item.repairNames || ""}}</text>
                          </view>
                          <image  src="/static/icons/edit.png" style="width: 28rpx;height: 28rpx"
                                 @click="editPeople('sg', item)"></image>
                        </view>
                      </template>
                      <template>
                        <image @click="editPeople('sg', item)" src="/pages-order/static/addIcon.png" style="width: 28rpx;height: 28rpx"></image>
                        <!--                      <text class="addText" @click="editPeople('sg', item)">添加施工人员</text>-->
                      </template>

                    </view>
                  </view>
                </view>
              </template>
            </view>
          </view>
        </view>
        <!-- 维修工时项目-只读 -->
        <view v-else>
          <view class="card projDateCard" v-if="ticketInfo.projectList && ticketInfo.projectList.length > 0">
            <view class="projTitle">维修工时项目</view>
            <view class="projTabs">
              <view @click="chooseProjTab(index)" v-for="(item, index) in ticketInfo.projectList" :key="item.groupId" class="projTabItem" :class="{ active: index === activeProjTabKey }">
                {{ item.groupName }}
                <view v-if="index === activeProjTabKey" class="activeLine"></view>
              </view>
            </view>
            <view class="projTabsBottomLine"></view>
            <view class="workPerson">
              <text>服务顾问：{{ticketInfo.projectList[activeProjTabKey].servicer}}</text>
              <text>施工人员：{{ticketInfo.projectList[activeProjTabKey].worker}}</text>
            </view>
            <view class="projList">
              <view class="projItem" v-for="(item, index) in ticketInfo.projectList[activeProjTabKey].wares.slice(0, 5)" :key="item.id">
                <text class="projSeq">{{ index + 1 }}</text>
                <text class="projName">{{ item.itemName }}</text>
              </view>
              <view v-if="ticketInfo.projectList[activeProjTabKey].showAll" class="projItem" v-for="(item, index) in ticketInfo.projectList[activeProjTabKey].wares.slice(5, ticketInfo.projectList[activeProjTabKey].wares.length)" :key="item.id">
                <text class="projSeq">{{ 6 + index }}</text>
                <text class="projName">{{ item.itemName }}</text>
              </view>
            </view>
            <view v-if="ticketInfo.projectList[activeProjTabKey].wares.length > 5" class="action" @click="() => $set(ticketInfo.projectList[activeProjTabKey], 'showAll', !ticketInfo.projectList[activeProjTabKey].showAll)">
              <text>{{ ticketInfo.projectList[activeProjTabKey].showAll ? '收起' : '展开' }}</text>
              <uni-icons :type="ticketInfo.projectList[activeProjTabKey].showAll ? 'top' : 'bottom'" color="#0174f6"></uni-icons>
            </view>
          </view>
        </view>

        <!-- 更换配件清单-编辑 -->
<!--        <view v-if="loginUser.roleCodes.includes('repair_warehouse') && isDetail == '0'">-->
<!--          <view v-if="ticketInfo.waresGroupList && ticketInfo.waresGroupList.length > 0" class="card cardInfo projCard">-->
<!--            <view class="projTitle">更换配件清单 <view class="dl-ifcus" v-if="canOpenCus"><text>是否开放给客户</text><switch :checked="ticketInfo.partShow == '1'" style="transform:scale(0.7)" @change="toPartShow" /></view></view>-->
<!--            <view class="projList">-->
<!--              <uni-collapse ref="collapse" >-->
<!--                <uni-collapse-item v-for="(groupItem,groupIndex) in ticketInfo.waresGroupList" :key="groupItem.groupId" :title="groupItem.groupName+'('+groupItem.nums+'类配件，合计：'+groupItem.totalAmount+'元)'" >-->
<!--                  <view class="content">-->
<!--                    <template>-->
<!--                      <view v-for="(item,index) in groupItem.wares" :key="item.id" class="projEditItem">-->
<!--                        <view >-->
<!--                          <view class="projEditLine1">-->
<!--                            <text>{{ item.itemName }}</text>-->
<!--                            <text  class="projAmount"><text v-if="canSeeMoney">￥{{ item.itemMoney }}</text><uni-icons @click="delWares(item,groupIndex,index)" type="trash" size="25" style="color: #0174F6"></uni-icons></text>-->
<!--                          </view>-->
<!--                          <view class="projBaseInfo"  >-->
<!--                            <view v-if="canSeeMoney">售价：<input @input="onKeyInput('sj',item)" style="background: white;padding: 0 10rpx" type="decimal" placeholder="请输入售价" v-model="item.itemPrice" /></view>-->
<!--                            <view>数量：<input @input="onKeyInput('sl',item)" style="background: white;padding: 0 10rpx" type="number" placeholder="请输入数量" v-model="item.itemCount" /></view>-->
<!--                            <view>单位：<input  style="padding: 0 10rpx" type="text"  v-model="item.unitText" disabled /></view>-->
<!--                            <view v-if="canSeeMoney">折扣：<input @input="onKeyInput('zk',item)" style="background: white;padding: 0 10rpx" type="decimal" placeholder="请输入折扣（0-1）" v-model="item.itemDiscount" /></view>-->
<!--                            <view v-if="canSeeMoney">金额：{{ item.itemMoney || "" }}</view>-->
<!--                          </view>-->
<!--                        </view>-->
<!--                      </view>-->
<!--                    </template>-->
<!--                  </view>-->
<!--                </uni-collapse-item>-->
<!--              </uni-collapse>-->
<!--            </view>-->
<!--          </view>-->
<!--        </view>-->
        <!-- 更换配件清单 -->
        <view class="card partCard" v-if="ticketInfo.waresGroupList && ticketInfo.waresGroupList.length > 0">
          <view class="projTitle">更换配件清单
            <view class="dl-ifcus" v-if="canOpenCus">
              <text>是否开放给客户</text>
              <switch :checked="ticketInfo.partShow == '1'" style="transform:scale(0.7)" @change="toPartShow"/>
            </view>
          </view>
          <view class="projTabs">
            <view @click="choosePartTab(index)" v-for="(item, index) in ticketInfo.waresGroupList" :key="item.groupId"
                  class="projTabItem" :class="{ active: index === activePartTabKey }">
              {{ item.groupName }}
              <view v-if="index === activePartTabKey" class="activeLine"></view>
            </view>
          </view>
          <view class="projTabsBottomLine" style="margin-bottom: 0"></view>
          <view v-if="loginUser.roleCodes.includes('repair_warehouse') && isDetail == '0'">
<!--            编辑状态-->
            <template>
              <view v-for="(item,index) in ticketInfo.waresGroupList[activePartTabKey].wares" :key="item.id" class="projEditItem">
                <view >
                  <view class="projEditLine1">
                    <text>{{ item.itemName }}</text>
                    <text  class="projAmount"><text v-if="canSeeMoney">￥{{ item.itemMoney }}</text><uni-icons @click="delWares(item,groupIndex,index)" type="trash" size="25" style="color: #0174F6"></uni-icons></text>
                  </view>
                  <view class="projBaseInfo"  >
                    <view v-if="canSeeMoney">售价：<input @input="onKeyInput('sj',item)" style="background: #F2F2F7;padding: 0 10rpx" type="decimal" placeholder="请输入售价" v-model="item.itemPrice" /></view>
                    <view>数量：<input @input="onKeyInput('sl',item)" style="background: #F2F2F7;padding: 0 10rpx" type="number" placeholder="请输入数量" v-model="item.itemCount" /></view>
                    <view>单位：<input  style="padding: 0 10rpx" type="text"  v-model="item.unitText" disabled /></view>
                    <view v-if="canSeeMoney">折扣：<input @input="onKeyInput('zk',item)" style="background: #F2F2F7;padding: 0 10rpx" type="decimal" placeholder="请输入折扣（0-1）" v-model="item.itemDiscount" /></view>
                    <view v-if="canSeeMoney">金额：{{ item.itemMoney || "" }}</view>
                  </view>
                </view>
              </view>
            </template>
          </view>
          <view v-else>
<!--            只读状态-->
            <view class="projList">
              <view class="projItem"
                    v-for="(item, index) in ticketInfo.waresGroupList[activePartTabKey].wares.slice(0, 5)" :key="item.id">
                <text class="projSeq">{{ index + 1 }}</text>
                <text class="projName">{{ item.itemName }}</text>
                <text style="color: #636C8C;font-size: 32rpx;">x{{ item.itemCount || "0" }}</text>
              </view>
              <view v-if="ticketInfo.waresGroupList[activePartTabKey].showAll" class="projItem"
                    v-for="(item, index) in ticketInfo.waresGroupList[activePartTabKey].wares.slice(5, ticketInfo.waresGroupList[activePartTabKey].wares.length)"
                    :key="item.id">
                <text class="projSeq">{{ 6 + index }}</text>
                <text class="projName">{{ item.itemName }}</text>
                <text style="color: #636C8C;font-size: 32rpx;">x{{ item.itemCount || "0" }}</text>
              </view>
            </view>
            <view v-if="ticketInfo.waresGroupList[activePartTabKey].wares.length > 5" class="action"
                  @click="() => $set(ticketInfo.waresGroupList[activePartTabKey], 'showAll', !ticketInfo.waresGroupList[activePartTabKey].showAll)">
              <text>{{ ticketInfo.waresGroupList[activePartTabKey].showAll ? '收起' : '展开' }}</text>
              <uni-icons :type="ticketInfo.waresGroupList[activePartTabKey].showAll ? 'top' : 'bottom'"
                         color="#0174f6"></uni-icons>
            </view>
          </view>
        </view>

        <view v-if="isDetail == '1'" class="card cardInfo projCard">
          <view class="projTitle">维修进度记录表</view>
          <view class="projList">
            <view class="tushi-box">
              <view class="tushi-item" style="color: #B7BDC6">待维修  </view>
              <view class="tushi-item" style="color: #E8A321">维修中  </view>
              <view class="tushi-item" style="color: #2979FF;">已完成</view>
            </view>
            <uni-steps :canOpenCus="canOpenCus" :options="list2" active-color="#007AFF" :active="active" :doingActive="doingActive" direction="column" @prviewImage="prviewImage" @sendCusImgManage="sendCusImgManage"/>
          </view>
        </view>
        <view v-if="isDetail == '1'" class="card cardInfo projCard">
          <view class="projTitle">维修记录</view>
          <view class="projList">
            <template>
              <view v-for="item in ticketInfo.records" :key="item.id" class="projItem">
                <view class="projTop">
                  <text class="projName">{{ item.type }}【{{item.roleName}}-{{item.dealUserName}}】</text>
                </view>
                <view class="projBody">
                  <view class="projDate" style="padding: 10rpx 0 0 0" v-if="item.projectName">
                    <text class="projDateText">本次维修项目：{{ item.projectName }}</text>
                  </view>
                  <view class="projDate" style="padding: 10rpx 0">
                    <image mode="aspectFit"  src="/static/icons/date.png" style="width: 24rpx;height: 24rpx"></image>
                    <text class="projDateText">{{ item.createTime }}</text>
                  </view>
                  <template >
                    <view class="projDesc">
                      {{ item.remark }}
                    </view>
                    <view class="projImg" v-if="item.itemList && item.itemList.length>0">
                      <image v-for="(img, imgIndex) in item.itemList" @click="prviewImage(item.itemList,imgIndex)" :key="imgIndex" :src="imgUrlPrex + img.image"
                             class="projImgItem"></image>
                    </view>
                    <view class="projSend" v-if="item.itemList.length>0 && canOpenCus">
                      <template >
                          <image mode="aspectFit" src="/static/icons/send.png" style="width: 28rpx;height: 28rpx"></image>
                          <text style="color: #0174F6" @click="sendCusImgManage(item.itemList)">发送给客户</text>
                      </template>
                    </view>
                  </template>
                </view>
              </view>
            </template>
          </view>
        </view>
      </view>
      <view v-if="isDetail == '0' && null!=ticketInfo" class="foot">
        <view class="submit" @click="submit">保存工单</view>
      </view>
    </view>
    <!--    悬浮操作-->
    <uni-fab v-if="content.length>0" ref="fab" :pattern="pattern" :content="content" :horizontal="horizontal" :vertical="vertical"
             :direction="direction" @trigger="trigger" @fabClick="fabClick" />
    <!-- 普通弹窗---拍照上传 -->
    <uni-popup ref="popup" background-color="#fff">
      <view class="popup-content">
        <view v-if="!ifCallCus">
          <view class="dl-avatar-box">
            <uni-file-picker :value="fileList" :sizeType="sizeType" @select="afterRead" @delete="deleteFile" limit="9" title="最多选择9张图片"></uni-file-picker>
          </view>
          <button type="primary" @click="saveWorkingItem">保存</button>
        </view>
        <view v-else>
          <view class="formItem">
            <view class="formLabel">服务顾问姓名</view>
            <view class="formContainer">
              <input placeholder="请填写联系人姓名" v-model="callServiceInfo.name" type="text"/>
            </view>
          </view>
          <view class="formItem">
            <view class="formLabel">服务顾问手机号</view>
            <view class="formContainer">
              <input placeholder="请填写联系人联系方式" v-model="callServiceInfo.tel" type="number"/>
            </view>
          </view>
          <button type="primary" @click="saveWorkingItem">通知客户取车</button>
        </view>
      </view>
    </uni-popup>
    <view >
      <u-modal :show="show" :title="title" confirmText="电话" cancelText="短信" showCancelButton
               @cancel="message" @confirm="phone " closeOnClickOverlay @close="show = false">
        客户：<view v-if="ticketInfo">{{ ticketInfo.userName}}（{{ ticketInfo.userMobile }}）</view>
      </u-modal>
    </view>
  </view>
</template>

<script>
import VNavigationBar from '@/components/VNavigationBar.vue'
import {bus} from "@/utils/eventBus";
import request from '@/utils/request';
import upload from '@/utils/upload'
import {getOrderStatusText,formatDate,formatTimestamp,getDictTextByCodeAndValue,saveTicketsRecords} from "@/utils/utils";
import {getToken,getUserInfo,setJSONData,getJSONData,setStorageWithExpiry,getStorageWithExpiry} from '@/utils/auth'
import config from '@/config'
export default {
  components: {
    VNavigationBar,
  },
  data() {
    return {
      show:false,
      title:'通知客户',
      linkContent:'请选择通知客户方式',
      //以下是悬浮操作需要的参数
      direction: 'vertical',
      horizontal: 'right',
      vertical: 'bottom',
      pattern: {
        color: '#7A7E83',
        backgroundColor: '#fff',
        selectedColor: '#007AFF',
        buttonColor: '#007AFF',
        iconColor: '#fff'
      },
      content: [],
      //维修配件申请单
      wares:[],
      sizeType:['compressed'],
      //上传的图片数组
      fileList: [],
      imgUrlPrex:config.baseImageUrl,
      //是否详情页(0否1是)
      isDetail:'1',
      // role: 'yewu',
      ticketId: '',
      //工单信息
      ticketInfo: null,
      //当前维修的项目
      nowRepair:{
        repairItemId:"",
        itemName:"",
      },
      //是否可以授权给客户看
      canOpenCus:false,
      //是否可以看见钱
      canSeeMoney:false,
      //当前选择的操作:working-维修期间|done_half-阶段完成|done-全部完成递交下一维修班组选人维修
      nowChooseOperate:"",
      carInfo: {},
      userInfo: {},
      loginUser:{},
      selectedProj: [],
      submitData:[],
      //是否是通知客户取车操作，默认都不是
      ifCallCus:false,
      //维修项目进度记录表
      // tableData:[],
      active: -1,
      doingActive: -1,
      //维修项目进度记录表
      list2: [],
      //通知客户取车联系人对象
      callServiceInfo:{
        name:"",
        tel:""
      },
      //删除的项目id、配件id
      delProjId:[],
      activeProjTabKey: 0,
      activePartTabKey: 0,
      processList: [{}, {}]
    };
  },
  watch: {
    // ticketInfo: {
    //   handler(newVal, oldVal) {
    //     console.log(newVal, "有变化");
    //     setJSONData("projects",newVal.projects)
    //   },
    //   // 开启深度监听
    //   deep: true
    // }
  },
  onLoad(data) {
    if(!getToken()){
      uni.reLaunch({
        url: '/pages/login/login'
      })
    }else {
      this.loginUser = getUserInfo()
      this.canSeeMoney = !this.loginUser.roleCodes.includes('repair_staff');
      console.log(this.loginUser, 294)
      console.log(data)
      if (data.id) {
        this.ticketId = data.id
      }
      if (data.isDetail) {
        this.isDetail = data.isDetail
      }
      this.refreshData(false)
    }
  },

  methods: {
    chooseProjTab(index) {
      this.activeProjTabKey = index
    },
    choosePartTab(index) {
      this.activePartTabKey = index
    },
    /**
     * 刷新数据通用方法
     */
    refreshData(cache){
      //获取订单详情
      this.getOrderDetail(cache)
      //查维修进度记录
      this.getProjItem()
      //获取当前订单是否有审批的配件
      this.waresByTicket()
    },
    /**
     * 删除项目
     */
    delProj(id,index){
      this.delProjId.push(id)
      //从列表中移除
      this.$nextTick(()=>{
        this.ticketInfo.projects.splice(index,1)
      })
    },
    /**
     * 删除配件
     */
    delWares(item,groupIndex,itemIndex){
      this.delProjId.push(item.id)
      //从列表中移除
      this.$nextTick(()=>{
        this.ticketInfo.waresGroupList[groupIndex].wares.splice(itemIndex,1)
        if(this.ticketInfo.waresGroupList[groupIndex].wares.length==0){
          this.ticketInfo.waresGroupList.splice(groupIndex,1)
        }else{
          //重新计算总价格数量
          let groupItem = this.ticketInfo.waresGroupList[groupIndex]
          groupItem.nums = groupItem.nums-1
          groupItem.totalAmount = groupItem.totalAmount-item.itemMoney
          this.ticketInfo.waresGroupList[groupIndex]=groupItem
        }
      })
    },
    /**
     * 监听输入框
     */
    onKeyInput(type,item){
      this.$nextTick(()=>{
        if("zk"==type && (item.itemDiscount<0 || item.itemDiscount>1)){
          uni.showToast({
            title: '请输入正确的折扣（数字0-1）',
            icon: 'none'
          })
          item.itemDiscount=1
          return
        }
        if((item.itemPrice && item.itemPrice>0) && (item.itemCount && item.itemCount>0) && (item.itemDiscount && item.itemDiscount>0 && item.itemDiscount<=1)){
          //数据符合要求重新计算
          item.itemMoney = item.itemPrice*item.itemCount*item.itemDiscount
        }
      })
      // setJSONData("projects",this.ticketInfo.projects)
      console.log(item,"item")
    },
    /**
     * 预览图片
     */
    prviewImage(imgList, index) {
      let urls = []
      imgList.forEach(i => {
        urls.push(this.imgUrlPrex+i.image)
      })
      uni.previewImage({
        urls: urls,
        current: index
      });
    },
    submit (){
      let canSubmit = true
      let itemList = []
      //校验所有项目、配件是否填写了价格、数量、折扣，并且是否合理
      if(this.ticketInfo.projects && this.ticketInfo.projects.length>0){
        this.ticketInfo.projects.map((item)=>{
          if(!item.repairIds || item.repairIds==null || item.repairIds==''){
            //某个维修项目没选施工人员
            canSubmit=false
            uni.showToast({
              title: '维修项目'+item.itemName+'请选择施工人员！',
              icon: 'none'
            })
            return
          }
          //不校验项目金额、折扣、数量必填，但是为null的设置为0
          if(!item.itemPrice){
            item.itemPrice = 0
          }
          if(!item.itemCount){
            item.itemCount = 0
          }
          if(!item.itemDiscount){
            item.itemDiscount = 1
          }
          item.itemMoney = item.itemPrice*item.itemCount*item.itemDiscount
          let itemObj = {
            id:item.id,
            ticketId:item.ticketId,
            itemPrice:item.itemPrice,
            itemCount:item.itemCount,
            itemDiscount:item.itemDiscount,
            itemMoney:item.itemMoney,
          }
          itemList.push(itemObj)
        })
      }
      //修改配件的信息
      if(this.ticketInfo.waresGroupList && this.ticketInfo.waresGroupList.length>0){
        this.ticketInfo.waresGroupList.map((groupItem)=>{
          groupItem.wares.map((item)=>{
            //不校验项目金额、折扣、数量必填，但是为null的设置为0
            if(!item.itemPrice){
              item.itemPrice = 0
            }
            if(!item.itemCount){
              item.itemCount = 0
            }
            if(!item.itemDiscount){
              item.itemDiscount = 1
            }
            item.itemMoney = item.itemPrice*item.itemCount*item.itemDiscount
            let itemObj = {
              id:item.id,
              ticketId:item.ticketId,
              itemPrice:item.itemPrice,
              itemCount:item.itemCount,
              itemDiscount:item.itemDiscount,
              itemMoney:item.itemMoney,
            }
            itemList.push(itemObj)
          })
        })
      }

      if(canSubmit){
        //更新工单配件价格
        request({
          url: '/admin-api/repair/titem/updateRepairItem',
          method: 'PUT',
          data:{"itemList":itemList,"delProjIdList":this.delProjId,"ticketId":this.ticketId}
        }).then((res) => {
          if(res.code==200){
            uni.showToast({
              title: '操作成功！',
              icon: 'none'
            })
            setTimeout(()=>{
              //判断角色
              if(this.loginUser.roleCodes.includes('repair_warehouse')){
                //仓管
                uni.navigateTo({
                  url: '/pages-warehouse/home/home'
                })
              }else{
                //其他
                uni.navigateTo({
                  url: '/pages-home/home/home'
                })
              }
            },700)
          }else{
            uni.showToast({
              title: '操作失败，请联系管理员',
              icon: 'none'
            })
          }
        })

      }
    },
    afterRead(file) {
      for (let i = 0; i < file.tempFilePaths.length; i++) {
        upload({
          url:'/admin-api/infra/file/upload',
          filePath: file.tempFilePaths[i]
        }).then((res)=>{
          this.fileList.push({
            url: config.baseImageUrl+res.data
          })
          console.log(this.fileList)
        })
      }
    },
    deleteFile(file, index) {
      console.log('删除文件');
      this.fileList.splice(index, 1);
    },
    /**
     * 保存工作记录信息
     */
    async saveWorkingItem(){
      try {
        let fileStr = this.fileList.map(item=>item.url.replace(config.baseImageUrl,"")).join(",")
        if("working"==this.nowChooseOperate){
          //维修中拍照
          const result = await saveTicketsRecords(this.ticketInfo.id,null,this.nowRepair.repairItemId,null,"sgz","施工中拍照记录",fileStr,"","");
          console.log(result)
        }else if("done_half"==this.nowChooseOperate){
          //阶段完成
          const result = await saveTicketsRecords(this.ticketInfo.id, '03',this.nowRepair.repairItemId,"03","sgwczj","阶段完成",fileStr,"","");
        }else if("other"==this.nowChooseOperate){
          //项目完成
          const result = await new Promise((resolve, reject) => {
            uni.showModal({
              title: '提示', // 对话框标题
              content: '是否移交总检？', // 对话框内容
              confirmText: '是', // 确认按钮文本
              cancelText: '否', // 取消按钮文本
              success: (res) => {
                if (res.confirm) {
                  // 用户点击了确定按钮
                  resolve(saveTicketsRecords(this.ticketInfo.id, '03',this.nowRepair.repairItemId,"03","sgwczj","维修完成移交总检",fileStr,"02",""))
                  this.nowChooseOperate = 'done'
                } else if (res.cancel) {
                  // 用户点击了取消按钮
                  resolve(saveTicketsRecords(this.ticketInfo.id, '03',this.nowRepair.repairItemId,"03","sgwczj","维修完成移交下一班组维修",fileStr,"",""))
                }
              },
              fail: (err) => {
                console.error('我是是否移交总检的弹窗，我报错了', err);
              }
            });
          })
          // const result = await saveTicketsRecords(this.ticketInfo.id, '03',this.nowRepair.repairItemId,"03","sgwczj","维修完成移交下一班组维修",fileStr,"","");
        }else if("done"==this.nowChooseOperate){
          //移交总检
          const result = await saveTicketsRecords(this.ticketInfo.id, '03',this.nowRepair.repairItemId,"03","sgwczj","维修完成移交总检",fileStr,"02","");
        }else if("check"==this.nowChooseOperate){
          //总检拍照
          let dataObj = {
            id: this.ticketInfo.id,
            remark: "车辆总检",
            image: fileStr
          }
          request({
            url: '/admin-api/repair/tickets/inspection',
            method: 'POST',
            data:dataObj
          }).then((res) => {
          })
        }else if("out"==this.nowChooseOperate){
          //出厂检验
          let dataObj = {
            id: this.ticketInfo.id,
            remark: "车辆出厂检验",
            image: fileStr
          }
          request({
            url: '/admin-api/repair/tickets/confirm',
            method: 'POST',
            data:dataObj
          }).then((res) => {
          })
        }else if("callCus"==this.nowChooseOperate){
          //服务顾问通知客户取车，
          let dataObj = {
            id: this.ticketInfo.id,
            name:this.callServiceInfo.name,
            mobile:this.callServiceInfo.tel,
          }
          request({
            url: '/admin-api/repair/tickets/noticeCus',
            method: 'POST',
            data:dataObj
          }).then((res) => {
          })
        }else if("over"==this.nowChooseOperate){
          //服务顾问交车
          let dataObj = {
            id: this.ticketInfo.id,
            remark: "交车",
            image: fileStr
          }
          request({
            url: '/admin-api/repair/tickets/overOrder',
            method: 'POST',
            data:dataObj
          }).then((res) => {
          })
        }
        this.$refs.popup.close()
        uni.showToast({
          title: '操作成功',
          icon: 'none'
        })
        if("done"==this.nowChooseOperate || "check"==this.nowChooseOperate || "callCus"==this.nowChooseOperate || "out"==this.nowChooseOperate || "over"==this.nowChooseOperate){
          //移交总检需要返回| 总检拍照后需要返回 | 服务顾问交车后返回
          setTimeout(() => {
            uni.navigateBack()
          },500)
        }else if("other"==this.nowChooseOperate){
          //移交下一班组维修，需要指派下一个维修人
          setTimeout(()=>{
            uni.navigateTo({
              url: '/pages-order/choosePeople/choosePeople?id=' + this.ticketInfo.id+'&itemId='+this.nowRepair.repairItemId +'&ifDetail=true'
            })
          },500)
        }else{
          //停留当前页面，刷新数据
          this.refreshData(false)
        }
      } catch (error) {
        console.error(error);
      }
    },
    /**
     * 判断工单状态和角色控制显示什么操作按钮
     */
    checkRoleOperate(){
      this.content = []
      if(this.loginUser.roleCodes.includes("service_advisor")){
        //服务顾问
        this.canOpenCus = true
          //服务顾问可以进行出厂检验  和通知客户取车
          if("05"==this.ticketInfo.ticketsStatus) {
            this.content.push({
              text: '出厂检验', active: false, code: "out"
            })
          }
          if("07"==this.ticketInfo.ticketsStatus){
            //工单状态是待通知客户取车，才能通知
            this.content.push({
              text: '通知取车', active: false,code:"callCus"
            })
          }
          if("06"==this.ticketInfo.ticketsStatus || "02"==this.ticketInfo.ticketsStatus ){
            //工单状态是已结算或者挂账，可以交车
            this.content.push({
              text: '交车', active: false,code:"over"
            })
          }
        //设置服务顾问默认的姓名联系方式
        this.callServiceInfo.name = this.loginUser.nickname
        this.callServiceInfo.tel = this.loginUser.mobile
      }
      if(this.loginUser.roleCodes.includes("weixiu")){
        //维修管理员
        this.canOpenCus = true
      }
      if(this.loginUser.roleCodes.includes("general_inspection")){
        //维修总检
        this.canOpenCus = true
        if(this.ticketInfo.nowRepairId==this.loginUser.id && "05"==this.ticketInfo.ticketsStatus){
          //当前用户就是处理人，可以进行总检拍照
          this.content.push({
            text: '总检拍照', active: false,code:"check"
          })
        }
      }
      if(this.loginUser.roleCodes.includes("repair_staff")){
        //维修工角色，可以提交配件申请
        this.content.push({
          text: '配件申请', active: false, code: "apply"
        })
        console.log(this.ticketInfo,"this.ticketInfo")
        if ("05" == this.ticketInfo.ticketsStatus && this.ticketInfo.nowRepairId == this.loginUser.id) {
          //订单状态处于维修中 ，且自己就是施工人
          if ("02" == this.ticketInfo.ticketsWorkStatus) {
            //当前正在施工且可以随时上传图片、也可以结束施工
            this.content.push({
              text: '拍照上传', active: false, code: "working"
            })
            this.content.push({
              text: '阶段完成', active: false, code: "done_half"
            })
            this.content.push({
              text: '项目完成', active: false, code: "other"
            })
            this.content.push({
              text: '移交总检', active: false, code: "done"
            })
            //查当前维修的项目
            this.selectNowRepair()
          }
          if ("03" == this.ticketInfo.ticketsWorkStatus || "04" == this.ticketInfo.ticketsWorkStatus) {
            //当前子状态是已接单和已完成，可以开始施工，也可以直接移交总检
            this.content.push({
              text: '开始施工', active: false, code: "start"
            })
            this.content.push({
              text: '移交总检', active: false, code: "done"
            })
          }
        }
      }
    },
    /**
     * 操作按钮点击事件
     */
    trigger(e) {
      //默认不是同时客户取车操作
      this.ifCallCus = false
      console.log(e)
      this.content[e.index].active = !e.item.active
      this.nowChooseOperate = e.item.code
      if("working"==e.item.code || "done_half"==e.item.code || "done"==e.item.code || "other"==e.item.code || "check"==e.item.code || "out"==e.item.code || "over"==e.item.code){
        //维修过程中拍照上传、阶段完成、移交其他班组、移交总检、出厂检验、交车
        this.fileList=[]
        this.$refs.popup.open("bottom")
      }else if("start" == e.item.code){
        //开始施工
        this.startWork(this.ticketInfo.id)
      }else if("apply" == e.item.code){
        //配件申请
        uni.navigateTo({
          url: '/pages-repair/apply/applyForm?ticketId='+this.ticketId
        })
      }else if("callCus"==e.item.code){
        this.show = true

      }
      // uni.showModal({
      //   title: '提示',
      //   content: `您${this.content[e.index].active ? '选中了' : '取消了'}${e.item.text}${e.item.code}`,
      //   success: function(res) {
      //     if (res.confirm) {
      //       console.log('用户点击确定')
      //     } else if (res.cancel) {
      //       console.log('用户点击取消')
      //     }
      //   }
      // })
    },

    message(){
      this.show = false
      // //服务顾问通知客户取车
      this.ifCallCus = true
      this.$refs.popup.open("bottom")
    },

    phone(){
      let that = this
      uni.makePhoneCall({
        phoneNumber: that.ticketInfo.userMobile,
        success: function (res) {
          console.log('拨号成功', res);
          //服务顾问电话通知客户取车
          let dataObj = {
            id: that.ticketInfo.id,
            name:that.ticketInfo.userName
          }
          request({
            url: '/admin-api/repair/tickets/noticeCus',
            method: 'POST',
            data:dataObj
          }).then((res) => {
            setTimeout(() => {
              uni.navigateBack()
            },500)
          })
        },
        fail: function (err) {
          if (err.errMsg.includes('cancel')) {
            console.log('用户取消拨号');
          } else {
            console.log('拨号失败', err);
          }
        }
      });
    },

    /**
     * 维修照片是否授权给客户看管理
     */
    sendCusImgManage(itemList){
      console.log(itemList)
      setJSONData("chooseImg",itemList)
      uni.navigateTo({
        url: '/pages-order/chooseImg/chooseImg'
      })
    },
    /**
     * 点击悬浮操作按钮
     */
    fabClick() {

    },
    /**
     * 开始施工
     */
    startWork(id){
      let paramsObj = {ticketId:id}
      //先查当前用户在本工单下有几个维修项目
      request({
        url: '/admin-api/repair/titem/listProject',
        method: 'get',
        params:paramsObj
      }).then((res) => {
        console.log(res)
        if (res.code == 200 && res.data.length>0) {
          if(res.data.length==1){
            //只有1个，直接开始施工
            this.startWorkRequest(id,"02",res.data[0].id,"02","kssg","开始施工")
          }else{
            uni.showActionSheet({
              itemList: res.data.map(m => m.itemName),
              success: ({
                          tapIndex
                        }) => {
                this.startWorkRequest(id,"02",res.data[tapIndex].id,"02","kssg","开始施工")
              }
            })
          }
        }else{
          uni.showToast({
            title: '操作失败，请联系管理员',
            icon: 'none'
          })
        }
      })
    },
    /**
     * 开始施工请求后台
     */
    async startWorkRequest(id,ticketsWorkStatus,itemId,itemStatus,recordType,remark){
      try {
        const result = await saveTicketsRecords(id,ticketsWorkStatus,itemId,itemStatus,recordType,remark,null);
        //刷新数据
        this.refreshData(false)
      } catch (error) {
        console.error(error);
      }
    },
    /**
     * 是否开放给用户----配件单
     */
    toPartShow(row){
      console.log(row.detail.value)
      const show = row.detail.value?'1':'0'
      request({
        url: '/admin-api/repair/tickets/show',
        method: 'get',
        params:{id:this.ticketId,show:show}
      }).then((res)=>{
        uni.showToast({
          title: '设置成功！',
          icon: 'none'
        })
      })
    },
    /**
     * 查看维修进度记录
     */
    getProjItem(){
      request({
        url: '/admin-api/repair/titem/getProjList',
        method: 'get',
        params:{ticketId:this.ticketId}
      }).then((res)=>{
        if(res.code==200){
          this.list2 = []
          //当前在修的项目
          let endIndex = -1
          for (let i = 0; i < res.data.length; i++) {
            let thisObj = res.data[i]
            thisObj.title = thisObj.itemName
            if(thisObj.itemStatus=='03'){
              //这个项目已处理完毕,
              endIndex = i
              thisObj.desc = formatTimestamp(thisObj.updateTime)
            }else if(thisObj.itemStatus=='02'){
              //正在处理中
              this.doingActive = i
            }
            this.list2.push(thisObj)
          }
          this.active = endIndex
          console.log(this.list2,"thisObj.itemStatus=='02'")
        }
      })
    },
    /**
     * 查看订单详情
     */
    getOrderDetail(cache){
      request({
        url: '/admin-api/repair/tickets/get',
        method: 'get',
        params:{id:this.ticketId,ifApp:true}
      }).then((res)=>{
        let resultObj = res.data
        resultObj.statusStr = getOrderStatusText(res.data.ticketsStatus)
        //注册日期
        if (null != resultObj.carInfo.carRegisterDate){
          resultObj.carRegisterDate = formatDate(resultObj.carInfo.carRegisterDate)
        }else{
          resultObj.carRegisterDate = '未知'
        }
        //进厂日期
        if (null != resultObj.inTime){
          resultObj.inTime = formatDate(resultObj.inTime)
        }else{
          resultObj.inTime = '未知'
        }
        //最近保养日期
        if (null != resultObj.maintenanceDate){
          resultObj.maintenanceDate = formatDate(resultObj.maintenanceDate)
        }else{
          resultObj.maintenanceDate = '未知'
        }
        //最近保养公里数
        if (!resultObj.maintenanceMileage){
          resultObj.maintenanceMileage = '未知'
        }
        //预计竣工日期
        if (null != resultObj.outTime){
          resultObj.outTime = formatDate(resultObj.outTime)
        }else{
          resultObj.outTime = '未知'
        }
        //年检时间
        console.log(resultObj.carInfo)
        if (null != resultObj.carInfo.nextInspectionDate){
          resultObj.nextInspectionDate = formatDate(resultObj.carInfo.nextInspectionDate)
        } else {
          resultObj.nextInspectionDate = '未知'
        }
        //保险时间
        if (null != resultObj.carInfo.insuranceExpiryDate) {
          resultObj.insuranceExpiryDate = formatDate(resultObj.carInfo.insuranceExpiryDate)
        } else {
          resultObj.insuranceExpiryDate = '未知'
        }
        //生日
        if (null != resultObj.customerInfo.birthday) {
          resultObj.birthday = formatDate(resultObj.customerInfo.birthday)
        } else {
          resultObj.birthday = '未知'
        }
        //维修记录格式化时间
        if (null != resultObj.records){
          resultObj.records.map((item)=>{
            item.createTime = formatTimestamp(item.createTime)
          })
        }
        if(cache){
          //从缓存中获取项目的信息替换掉
          let projects = getJSONData("projects")
          let projectMap = new Map();
          if(projects){
            //转key value形式
            projects.map((item)=>{
              projectMap.set(item.id,item)
            })
            resultObj.projects = resultObj.projects.map((item)=>{
              if(projectMap.has(item.id)){
                console.log(projectMap.get(item.id))
                let localObj = projectMap.get(item.id)
                item.itemPrice = localObj.itemPrice
                item.itemCount = localObj.itemCount
                item.itemDiscount = localObj.itemDiscount
                item.itemMoney = localObj.itemMoney
              }
              return item
            })
          }
        }
        let newProArray = []
        if(this.delProjId.length>0){
          //有删除的项目，需要比对删掉
          resultObj.projects.map((item)=>{
            if(this.delProjId.indexOf(item.id)==-1){
              newProArray.push(item)
            }
          })
          resultObj.projects =newProArray

          // //新的配件分组list
          // let newWaresGroupList = []
          // //有删除的配件，需要比对删掉
          // resultObj.waresGroupList.map((groupItem)=>{
          //   let newWaresList = []
          //   groupItem.wares.map((item)=>{
          //     if(this.delProjId.indexOf(item.id)==-1){
          //       newWaresList.push(item)
          //     }
          //   })
          //   if(newWaresList.length>0){
          //     groupItem.wares = newWaresList
          //     newWaresGroupList.push(groupItem)
          //   }
          // })
          // resultObj.projects =newWaresGroupList
        }
        this.$nextTick(()=>{
          this.ticketInfo = resultObj
          //判断当前角色及工单状态显示操作按钮
          this.checkRoleOperate()
        })
      })
    },

    /**
     * 查询当前工单下的审批单
     */
    waresByTicket(){
      request({
        url: '/admin-api/repair/tw/list',
        method: 'get',
        params:{ticketId:this.ticketId,status:'01'}
      }).then((res)=>{
        if (res.code == 200){
          this.wares = res.data
        }
      })
    },

    /**
     * 查当前维修的项目
     */
    selectNowRepair(){
      request({
        url: '/admin-api/dl/repair-records/listByTicketId',
        method: 'get',
        params:{ticketId:this.ticketInfo.id}
      }).then((res)=>{
        if(res.code==200){
          if(res.data && res.data.hasOwnProperty("repair_item_id")){
              this.nowRepair.repairItemId = res.data.repair_item_id
              this.nowRepair.itemName = res.data.item_name
          }
        }else{
          uni.showToast({
            title: res.msg,
            icon: 'none'
          })
        }
      })
    },
    editPeople(type, proj) {
      //需要选施工人员，记录缓存
      setJSONData("projects",this.ticketInfo.projects)
      bus.$off('choosePeople')
      bus.$on('choosePeople', (data) => {
        console.log('choosePeople', data)
        //需要将缓存中的值取出来
        this.refreshData(true)
      })
      uni.navigateTo({
        url: `/pages-order/choosePeople/choosePeople?type=${type}&ticketId=${this.ticketId}&projectId=${proj.projectId}`
        // url: `/pages-order/choosePeople/choosePeople?type=${type}&id=${this.ticketId}`
      })
    },
    /**
     * 点击配件申请单提醒，查看相关配件
     * @param wareId
     */
    showReviewList(formData) {
      uni.navigateTo({
        url: '/pages-order/reviewList/reviewList?formData='+encodeURIComponent(JSON.stringify(formData))
      })
    }
  }
}
</script>

<style lang="less" scoped>

.popup-content {
@include flex;
  align-items: center;
  justify-content: center;
  padding: 15px;
  height: auto;
  background-color: #fff;
}
.container {
  height: 100%;
  background-color: #F3F5F7;

  .containerBody {
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .body {
    flex: 1;
    height: 0;
    overflow: auto;
    position: relative;
    background-size: 100% 600rpx;
    background: linear-gradient(180deg, #CEE5FF 0%, rgba(206, 229, 255, 0) 100%) no-repeat;
  }

  .card {
    background: #FFFFFF;
    border-radius: 8rpx 8rpx 8rpx 8rpx;
    margin: 20rpx 32rpx;
  }

  .phone {
    background: #0174F6;

    .phoneHeader {
      padding: 20rpx 30rpx;

      .title {
        font-weight: bold;
        font-size: 32rpx;
        color: #FFFFFF;
        margin-bottom: 10rpx;
      }

      .desc {
        font-weight: 500;
        font-size: 28rpx;
        color: rgba(255, 255, 255, 0.7);
      }
    }

    .phoneBody {
      background: #FFFFFF;
      border-radius: 8rpx 8rpx 8rpx 8rpx;
      padding: 0 30rpx;

      .searchBox {
        padding: 40rpx 0;
        border-bottom: 1rpx solid #EEEEEE;
      }

      .btn {
        padding: 40rpx 0;

        display: flex;
        align-items: center;
        justify-content: center;
        column-gap: 10rpx;

        font-weight: 500;
        font-size: 32rpx;
        color: #0174F6;

        .btnIcon {
          width: 32rpx;
          height: 32rpx;
        }
      }
    }
  }

  .cardInfo {
    overflow: hidden;
    .noReviewPart {
      padding: 10rpx 36rpx 10rpx 36rpx;
      display: flex;
      align-items: center;
      column-gap: 10rpx;
      margin-top: 10rpx;
      background: #FFF6E7;
      border-radius: 4rpx 4rpx 4rpx 4rpx;

      font-weight: 500;
      font-size: 28rpx;
      color: #E8A321;

      .messageText {
        flex: 1;
        width: 0;
      }
    }

    &.none {
      position: relative;
      display: flex;
      flex-direction: column;
      align-items: center;

      .cardNoneIcon {
        width: 336rpx;
      }

      .btn {
        position: absolute;
        bottom: 40rpx;
        left: 50%;
        transform: translateX(-50%);

        display: flex;
        align-items: center;
        column-gap: 10rpx;

        font-weight: 500;
        font-size: 28rpx;
        color: #0174F6;
      }
    }
  }

  .projTitle, .userTitle, .carTitle {
    padding: 30rpx;
    font-weight: bold;
    font-size: 36rpx;
    color: #333333;
  }

  .dl-ifcus{
    font-size: 14px;
    float: right;
  }

  .carCard {
    .orderFlag {
      display: flex;
      align-items: center;
      column-gap: 14rpx;
      padding: 20rpx 30rpx;
      background: #FFFBF3;
      border-radius: 8rpx 8rpx 0rpx 0rpx;
      border-top: 8rpx solid #E8A321;

      &.end {
        border-top: 8rpx solid #17DBB1;
        background-color: #E3FFF9;
      }

      .flagBody {
        display: flex;
        flex-direction: column;
        row-gap: 10rpx;
        font-weight: bold;
        font-size: 32rpx;
        color: #333333;

        .flagDesc {
          font-weight: 500;
          font-size: 28rpx;
          color: #999999;
        }
      }

    }

    .carDetail {
      background-size: 100% 184rpx;
      padding: 30rpx 30rpx;

      .carHeader {
        border-radius: 8rpx 8rpx 8rpx 8rpx;

        display: flex;
        align-items: center;
        column-gap: 20rpx;

        padding-bottom: 30rpx;

        .carImage {
          width: 192rpx;
          height: 120rpx;
          //background: #F2F2F7;
          border-radius: 8rpx 8rpx 8rpx 8rpx;
        }

        .carHeaderRight {
          display: flex;
          flex-direction: column;
          row-gap: 20rpx;
          font-weight: bold;
          font-size: 36rpx;
          color: #333333;

          .carType {
            font-weight: 500;
            font-size: 32rpx;
            color: #858BA0;
          }
        }
      }
      .line {
        height: 1rpx;
        background-color: #ddd;
      }
      .carBody {
        display: flex;
        flex-direction: column;
        row-gap: 30rpx;
        padding-top: 30rpx;
      }

      .carFoot {

      }
    }
  }

  .projCard {
    padding-bottom: 30rpx;

    .projList {
      padding: 0 20rpx;
      display: flex;
      flex-direction: column;
      //gap: 20rpx;

      .tushi-box{
        font-weight: 500;
        font-size: 32rpx;
        line-height: 40rpx;
        display: flex;
        align-items: center;
        justify-content: center;
      }
      .tushi-item{
        padding: 0 20rpx;
        color: #606266;
      }

      .projItem {
        background: #FFFFFF;
        border-radius: 8rpx 8rpx 8rpx 8rpx;
        border: 1rpx solid #DDDDDD;
        padding: 0 20rpx;
        margin-bottom: 10rpx;

        .projTop {
          padding: 20rpx 0;
          border-bottom: 1rpx solid #eee;
          display: flex;
          align-items: center;
          justify-content: space-between;
          font-weight: 500;
          font-size: 32rpx;
          color: #333333;

          .projAmount {
            font-weight: bold;
            color: #0174F6;
          }
        }

        .projBody {
          padding-bottom: 20rpx;

          .projDate {
            font-weight: 500;
            font-size: 30rpx;
            color: #636C8C;

            display: flex;
            align-items: center;
            column-gap: 10rpx;

            padding: 20rpx 0;
          }

          .projDesc {
            font-weight: 500;
            font-size: 30rpx;
            color: #858BA0;
          }

          .projImg {
            width: 100%;
            display: grid;
            grid-template-columns: repeat(auto-fill, 120rpx);
            justify-content: space-between;
            gap: 20rpx;
            padding: 20rpx 0;

            .projImgItem {
              width: 120rpx;
              height: 120rpx;
              background-color: #efefef;
            }
          }

          .projSend {
            display: flex;
            align-items: center;
            font-weight: 500;
            font-size: 28rpx;
            column-gap: 8rpx;
          }

        }
      }

      .projEditItem {
        margin-bottom: 17rpx;
        padding: 0 20rpx;
        background: #F2F2F7;
        border-radius: 4rpx 4rpx 4rpx 4rpx;
        position: relative;
        .del-proj-box{
          position: absolute;
          top: -10px;
          right: -10px;
        }
        .del-wares-box{
          position: absolute;
          top: 0;
          right: 0;
        }
        .projEditLine1 {
          display: flex;
          align-items: center;
          justify-content: space-between;

          font-weight: 500;
          font-size: 28rpx;
          color: #333333;

          padding: 15rpx 0;

          .projAmount {
            color: #0174F6;
          }
        }

        .projBaseInfo {
          display: grid;
          grid-template-columns: 1fr 1fr;
          font-size: 28rpx;
          color: #999999;
          gap: 20rpx;
          margin-bottom: 20rpx;
        }

        .projEditFoot {
          padding: 10rpx 0;
          border-top: 1px solid #DDDDDD;

          display: flex;
          align-items: center;
          column-gap: 10rpx;

          .block1, .block2 {
            flex: 1;
            width: 0;

            display: flex;
            align-items: center;
            justify-content: center;
            column-gap: 8rpx;

            font-size: 28rpx;
            color: #0174F6;
            line-height: 28rpx;

            .editPeople {
              flex: 1;
              width: 0;

              display: flex;
              justify-content: space-between;
              align-items: center;

              .editForm {
                display: flex;
                flex-direction: column;
                row-gap: 10rpx;
                font-size: 28rpx;
                color: #333333;

                .label {
                  font-size: 28rpx;
                  color: #999999;
                }
              }
            }
          }

          .line {
            height: 28rpx;
            width: 2rpx;
            background-color: #DDDDDD;
          }

        }
      }
    }
  }
  .projEditItem {
    //margin-bottom: 25rpx;
    padding: 0 20rpx 10rpx 20rpx;
    border-bottom: 1rpx solid #F2F2F7;
    //background: #F2F2F7;
    border-radius: 4rpx 4rpx 4rpx 4rpx;
    position: relative;
    .del-proj-box{
      position: absolute;
      top: -10px;
      right: -10px;
    }
    .del-wares-box{
      position: absolute;
      top: 0;
      right: 0;
    }
    .projEditLine1 {
      display: flex;
      align-items: center;
      justify-content: space-between;

      font-weight: 500;
      font-size: 28rpx;
      color: #333333;

      padding: 15rpx 0;

      .projAmount {
        color: #0174F6;
      }
    }

    .projBaseInfo {
      display: grid;
      grid-template-columns: 1fr 1fr;
      font-size: 28rpx;
      color: #999999;
      gap: 20rpx;
      margin-bottom: 20rpx;
    }

    .projEditFoot {
      padding: 10rpx 0;
      border-top: 1px solid #DDDDDD;

      display: flex;
      align-items: center;
      column-gap: 10rpx;

      .block1, .block2 {
        flex: 1;
        width: 0;

        display: flex;
        align-items: center;
        justify-content: center;
        column-gap: 8rpx;

        font-size: 28rpx;
        color: #0174F6;
        line-height: 28rpx;

        .editPeople {
          flex: 1;
          width: 0;

          display: flex;
          justify-content: space-between;
          align-items: center;

          .editForm {
            display: flex;
            flex-direction: column;
            row-gap: 10rpx;
            font-size: 28rpx;
            color: #333333;

            .label {
              font-size: 28rpx;
              color: #999999;
            }
          }
        }
      }

      .line {
        height: 28rpx;
        width: 2rpx;
        background-color: #DDDDDD;
      }

    }
  }
  .projDateCard, .partCard {
    line-height: 1;
    .projTabs {
      display: flex;
      overflow: scroll;
      .projTabItem {
        padding: 10rpx 20rpx 30rpx;
        flex-shrink: 0;
        font-weight: 500;
        font-size: 32rpx;
        color: #636C8C;
        &.active {
          font-weight: bold;
          color: #0174F6;
          position: relative;
        }
        .activeLine {
          position: absolute;
          bottom: 0;
          left: 50%;
          transform: translateX(-50%);
          width: 36rpx;
          height: 8rpx;
          background: #0174F6;
          border-radius: 4rpx 4rpx 4rpx 4rpx;
        }
      }
    }
    .projTabsBottomLine {
      width: 686rpx;
      height: 1rpx;
      background-color: #eee;
      margin-bottom: 20rpx;
    }
    .workPerson {
      width: 646rpx;
      margin: 0 auto;
      padding: 30rpx 20rpx;
      background: #F3F5F7;
      border-radius: 6rpx 6rpx 6rpx 6rpx;

      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;

      font-weight: 500;
      font-size: 30rpx;
      color: #636C8C;
    }

    .projList {
      padding: 0 20rpx;
      .projItem {
        padding: 40rpx 0;
        font-weight: 500;
        font-size: 32rpx;
        line-height: 40rpx;
        color: #333333;
        border-bottom: 1rpx solid #EEEEEE;
        display: flex;
        column-gap: 10rpx;
      }
      .projSeq {
        width: 40rpx;
        height: 40rpx;
        background: #0174F6;
        border-radius: 50%;
        display: inline-block;
        text-align: center;
        line-height: 40rpx;
        font-weight: 500;
        font-size: 16px;
        color: #FFFFFF;
      }
      .projName {
        flex: 1;
        width: 0;
        word-break: break-all;
      }
      .projItem:last-child {
        border-bottom: none;
      }
    }

    .action {
      font-weight: 500;
      font-size: 30rpx;
      color: #0174F6;
      text-align: center;
      padding-bottom: 30rpx;
    }
  }

  .userCard {
    .userContainer {
      display: flex;
      flex-direction: column;
      row-gap: 30rpx;
      margin: 0 30rpx;
      padding-bottom: 10rpx;
    }
  }

  .infoItem {
    padding: 20rpx 0;
    display: flex;
    justify-content: space-between;
    font-weight: 500;
    font-size: 32rpx;
    line-height: 1;

    .label {
      color: #636C8C;
    }

    .value {
      color: #333333;
    }
  }

  .projFoot, .userFoot, .carFoot {
    padding: 20rpx;
    font-weight: 500;
    font-size: 28rpx;
    color: #0174F6;
    display: flex;
    align-items: center;
    justify-content: center;
    column-gap: 6rpx;
  }

  .foot {
    padding: 30rpx;
    background-color: #fff;

    .submit {
      margin: 0 auto;

      width: 510rpx;
      height: 76rpx;
      background: #0174F6;
      border-radius: 38rpx 38rpx 38rpx 38rpx;

      display: flex;
      align-items: center;
      justify-content: center;

      font-size: 32rpx;
      color: #FFFFFF;
    }
  }

  .formItem {
    padding: 40rpx 0;
    margin: 0 32rpx;
    border-bottom: 1rpx solid #EEEEEE;
  }

  .formLabel {
    font-weight: 500;
    font-size: 28rpx;
    color: #333333;
    padding-bottom: 20rpx;
  }

  .edit-proj-input{
    background: white;
    width: 90%;
    padding: 3rpx 5rpx;
    border-radius: 5px;
  }
}
.orderInfo {
  padding: 0 32rpx;
  margin: 40rpx 0;
  line-height: 1;
  display: flex;
  flex-direction: column;
  .orderTypeInfo {
    padding: 10rpx 0;
    font-weight: bold;
    font-size: 40rpx;
    color: #333333;
  }
  .orderStateInfo {
    padding: 10rpx 0;
    font-weight: 500;
    font-size: 32rpx;
    color: #666666;
  }
  .orderDateInfo {
    padding: 10rpx 0;
    font-weight: 500;
    font-size: 32rpx;
    color: #0174F6;
  }
}
.processCard {
  line-height: 1;
  .tushi-box {
    display: flex;
    align-items: center;
    column-gap: 40rpx;
    justify-content: center;
    padding-bottom: 30rpx;
    font-weight: 500;
    font-size: 32rpx;
    line-height: 40rpx;
  }
  .processList {
    padding: 0 20rpx;
  }
  .processItem {
    display: flex;
    column-gap: 14rpx;
    margin-bottom: 20rpx;
    display: flex;
    align-items: stretch;
    .left {
      padding-bottom: 24rpx;
      display: flex;
      flex-direction: column;
      row-gap: 8rpx;
      .processSeq {
        width: 32rpx;
        height: 32rpx;
        background: #0174F6;
        border-radius: 18rpx 18rpx 18rpx 18rpx;
        font-weight: 500;
        font-size: 28rpx;
        color: #FFFFFF;
        line-height: 32rpx;
        text-align: center;
      }
      .line {
        flex: 1;
        height: 0;
        width: 2rpx;
        background-color: #0174f6;
        margin: 0 auto;
      }
    }
    .right {
      padding-bottom: 20rpx;
      border-bottom: 1rpx solid #eee;
      display: flex;
      flex-direction: column;
      row-gap: 20rpx;
      .processName {
        font-weight: 500;
        font-size: 32rpx;
        color: #333333;
      }
      .processDate {
        font-weight: 500;
        font-size: 28rpx;
        color: #858BA0;
      }
      .processImgList {
        display: flex;
        gap: 10rpx;
      }
      .processImgItem {
        width: 120rpx;
        height: 120rpx;
        background-color: #eee;
      }
      .processSendUser {
        display: flex;
        column-gap: 10rpx;
        font-weight: 500;
        font-size: 32rpx;
        color: #0174F6;
      }
    }
  }
}
</style>
