RepairDetails.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890
  1. <template>
  2. <view>
  3. <!-- 状态 -->
  4. <!-- && userInfoRoleName.indexOf('admin') == -1 -->
  5. <view class="label" v-if="(form.dispatchingWorkers == 2 || form.status == 3 || form.status == 4)">
  6. <view class="tab" ref="wx" :style="{'color':wxStyle,'height':'100%','border-right': '1rpx solid #f4f4f4'}" @click="tab('wx')">
  7. <text>报修单</text>
  8. </view>
  9. <view class="tab" ref="gz" :style="{'color':gzStyle,'height':'100%','border-left': '1rpx solid #f4f4f4'}"
  10. @click="tab('gz')">
  11. <text>工作单</text>
  12. </view>
  13. </view>
  14. <view class="repairdetails" v-if="form.status == 1">
  15. <view class="cardBox">
  16. <!-- <view class="text">设备信息:</view> -->
  17. <u-input v-model="form.deviceName" disabledColor="#fff" disabled
  18. border="none" placeholder="请选择设备信息" >
  19. <!-- <template slot="suffix">
  20. <u-icon name="scan" color="#bbb" size="32"></u-icon>
  21. </template> -->
  22. </u-input>
  23. </view>
  24. <view class="cardBox">
  25. <!-- <view class="text">客户名称:</view> -->
  26. <u-input v-model="form.corpName" disabled disabledColor="#fff"
  27. border="none" placeholder="客户名称" ></u-input>
  28. </view>
  29. <view class="cardBox">
  30. <!-- <view class="text">地址:</view> -->
  31. <u-input v-model="form.deviceAddress" disabledColor="#fff" disabled
  32. border="none" placeholder="设备地址" ></u-input>
  33. </view>
  34. <view class="cardBox">
  35. <!-- <view class="text">故障描述:</view> -->
  36. <u--textarea v-model="form.faultDescribe" placeholder="故障描述" disabled
  37. border="none" >
  38. </u--textarea>
  39. </view>
  40. <view class="kapian">
  41. <!-- <view style="font-size: 30rpx;color: #999;margin-left: 10rpx;">添加图片</view> -->
  42. <view style="margin-top: 20rpx;">
  43. <u-upload
  44. :fileList="userImgList"
  45. :disabled="form.status != 3"
  46. @afterRead="afterRead"
  47. @delete="deletePic"
  48. name="1"
  49. multiple
  50. :maxCount="10"
  51. ></u-upload>
  52. </view>
  53. </view>
  54. </view>
  55. <!-- 维修单 -->
  56. <view class="repairdetails" v-if="wxStyle != ''">
  57. <view class="cardBox">
  58. <!-- <view class="text">设备信息:</view> -->
  59. <u-input v-model="form.deviceName" disabledColor="#fff" disabled
  60. border="none" placeholder="请选择设备信息" >
  61. <!-- <template slot="suffix">
  62. <u-icon name="scan" color="#bbb" size="32"></u-icon>
  63. </template> -->
  64. </u-input>
  65. </view>
  66. <view class="cardBox">
  67. <!-- <view class="text">客户名称:</view> -->
  68. <u-input v-model="form.corpName" disabled disabledColor="#fff"
  69. border="none" placeholder="客户名称" ></u-input>
  70. </view>
  71. <view class="cardBox">
  72. <!-- <view class="text">地址:</view> -->
  73. <u-input v-model="form.deviceAddress" disabledColor="#fff" disabled
  74. border="none" placeholder="设备地址" ></u-input>
  75. </view>
  76. <view class="cardBox">
  77. <!-- <view class="text">故障描述:</view> -->
  78. <u--textarea v-model="form.faultDescribe" placeholder="故障描述" disabled
  79. border="none" >
  80. </u--textarea>
  81. </view>
  82. <view class="kapian">
  83. <!-- <view style="font-size: 30rpx;color: #999;margin-left: 10rpx;">添加图片</view> -->
  84. <view style="margin-top: 20rpx;">
  85. <u-upload
  86. :fileList="userImgList"
  87. disabled
  88. @afterRead="afterRead"
  89. @delete="deletePic"
  90. name="1"
  91. multiple
  92. :maxCount="10"
  93. ></u-upload>
  94. </view>
  95. </view>
  96. </view>
  97. <!-- 工作单 -->
  98. <view class="repairdetails" v-if="gzStyle != ''">
  99. <view class="cardBox">
  100. <!-- <view class="text">设备信息:</view> -->
  101. <u-input v-model="form.deviceName" disabledColor="#fff" disabled
  102. border="none" placeholder="请选择设备信息" >
  103. <!-- <template slot="suffix">
  104. <u-icon name="scan" color="#bbb" size="32"></u-icon>
  105. </template> -->
  106. </u-input>
  107. </view>
  108. <view class="cardBox">
  109. <u--textarea v-model="form.repairDescription"
  110. placeholder="维修描述" border="none"
  111. :disabled="userInfoRoleName.indexOf('admin') != -1?form.status != 2:form.status != 3" >
  112. </u--textarea>
  113. </view>
  114. <view class="kapian">
  115. <!-- <view style="font-size: 30rpx;color: #999;margin-left: 10rpx;">添加图片</view> -->
  116. <view style="margin-top: 20rpx;">
  117. <u-upload
  118. :fileList="form.maintenanceFiles"
  119. :disabled="userInfoRoleName.indexOf('admin') != -1?form.status != 2:form.status != 3"
  120. @afterRead="afterRead"
  121. @delete="deletePic"
  122. name="1"
  123. multiple
  124. :maxCount="10"
  125. ></u-upload>
  126. </view>
  127. </view>
  128. <view>
  129. <view class="kapian" v-for="(item,index) in form.maintenanceFees" :key="item.id">
  130. <view class="WXflex">
  131. <view></view>
  132. <view class="wxscfun"
  133. style="color: #fff; background-color: #FD4B09;" v-if="form.status == 3"
  134. @click="kapianClick(item,index)">修改</view>
  135. </view>
  136. <view class="repairProject">
  137. <view class="wxbox">
  138. {{item.costName}}
  139. </view>
  140. <view class="wxbox" style="color: #FD4B09;">
  141. {{item.amount}}元
  142. </view>
  143. </view>
  144. </view>
  145. </view>
  146. <view class="kapian" >
  147. <view class="wxtitleflex">
  148. <view class="wxtitle">添加费用</view>
  149. <!-- form.status == 3 || userInfoRoleName.indexOf('admin') != -1 -->
  150. <view v-if="userInfoRoleName.indexOf('admin') == -1?form.status != 4:form.status != 3"
  151. style="color: #fff; background-color: #FD4B09;" class="addwx"
  152. @click="kapianShow = true">添加</view>
  153. </view>
  154. </view>
  155. </view>
  156. <!-- wxaddfun -->
  157. <u-gap height="60"></u-gap>
  158. <view class="bottombox">
  159. <view class="bottombox_name" v-if="form.dispatchingWorkers == 2 && form.status != 1">
  160. <text>{{form.maintenanceWorkerName}}</text>
  161. </view>
  162. <view class="bottombox_name" @click="pickerShowfun" v-if="form.dispatchingWorkers == 1 && userInfoRoleName.indexOf('admin') != -1">
  163. <text>{{form.maintenanceWorkerName == null || form.maintenanceWorkerName == '' ? '请选择维修工' : form.maintenanceWorkerName}}</text>
  164. </view>
  165. <view v-if="(form.status == 3 || form.status == 4) && form.dispatchingWorkers == 3" style="color: #FD4B09;">维修费:{{form.maintenanceAmount?form.maintenanceAmount:0}}元</view>
  166. <view class="bottombox_right">
  167. <view class="buttonClass"
  168. v-if="form.dispatchingWorkers == 1 && userInfoRoleName.indexOf('admin') != -1"
  169. @click="maintenanceDispatchingWorkersfun">确认派工</view>
  170. <view class="buttonClass"
  171. v-if="form.dispatchingWorkers == 2 && userInfoRoleName.indexOf('admin') != -1"
  172. @click="maintenanceRevokeDispatchingWorkersfun">撤销派工</view>
  173. <view class="buttonClass" v-if="form.dispatchingWorkers == 2 && userInfoRoleName.indexOf('维修工') != -1"
  174. @click="modalTitle = '确认接单';modalShow = true">确认接单</view>
  175. <view class="buttonClass" v-if="form.status == 3 && userInfoRoleName.indexOf('维修工') != -1 && form.dispatchingWorkers == 3"
  176. @click="Confirmexpenses">确认费用</view>
  177. <view class="buttonClass" v-if="form.status == 4"
  178. @click="modalTitle = '撤销费用';modalShow = true">撤销费用</view>
  179. <view class="buttonClass" v-if="form.status == 4"
  180. @click="modalTitle = '确认结算';modalShow = true">确认结算</view>
  181. </view>
  182. </view>
  183. <u-picker :show="pickerShow" :columns="pickerList" keyName="name"
  184. @confirm="pickerShowConfirm" @cancel="pickerShowCancel"></u-picker>
  185. <u-toast ref="uToast"></u-toast>
  186. <!-- 添加费用弹窗 -->
  187. <u-modal :show="modalShow" :title="'是否要' + modalTitle" showCancelButton cancelText="取消"
  188. @confirm="modalConfirm" @cancel="modalShow = false">
  189. </u-modal>
  190. <!-- <u-popup :show="show" mode="top" @close="close" @open="open">
  191. <view>
  192. <text>人生若只如初见,何事秋风悲画扇</text>
  193. </view>
  194. </u-popup> -->
  195. <u-modal :show="kapianShow" title="收费项目" :showCancelButton="true" @cancel="kapianCancel" @confirm="kapianConfirm" confirmColor="#FD4B09">
  196. <view style="position: relative;">
  197. <view class="positionSC" @click="maintenanceDe(kapianindex)">删除</view>
  198. <view class="kapianModel">
  199. <text style="color: #FD4B09;font-size: 28rpx;">项目:</text>
  200. <u-input v-model="kapian.costName" disabledColor="#fff" :disabled="form.status != 3"
  201. border="bottom" confirm-type="next" placeholder="收费项目" ></u-input>
  202. </view>
  203. <view class="kapianModel">
  204. <text style="color: #FD4B09;font-size: 28rpx;">金额:</text>
  205. <u-input v-model="kapian.amount" disabledColor="#fff" :disabled="form.status != 3"
  206. border="bottom" type="digit" confirm-type="done" @input="moneyInput" placeholder="金额" ></u-input>
  207. </view>
  208. </view>
  209. <u-toast ref="uToastkapian"></u-toast>
  210. </u-modal>
  211. <!-- <u-overlay :show="overlayShow">
  212. <view class="warp">
  213. <view class="rect" @tap.stop></view>
  214. </view>
  215. </u-overlay> -->
  216. <u-loading-page bg-color="#e8e8e8" :loading="overlayShow" loading-text="加载中..." style="z-index: 999;" bgColor="rgba(0,0,0,0.5)"></u-loading-page>
  217. </view>
  218. </template>
  219. <script>
  220. import {
  221. maintenanceDetail,
  222. maintenanceReceivingOrders,
  223. maintenanceConfirm,
  224. userList,
  225. maintenanceDispatchingWorkers,
  226. maintenanceRevokeDispatchingWorkers,
  227. maintenancerRvokeConfirmFees
  228. } from '@/api/device/index.js'
  229. import http from '@/http/api.js'
  230. import {
  231. clientId,
  232. clientSecret
  233. } from '@/common/setting'
  234. export default {
  235. data() {
  236. return {
  237. modalShow:false,
  238. modalTitle:'',
  239. id:null,
  240. wxStyle: '',
  241. gzStyle: '',
  242. overlayShow: false,
  243. form:{
  244. maintenanceFees:[
  245. {
  246. id:null,
  247. costId:null,
  248. costName:null,
  249. number:1,
  250. price:null,
  251. amount:null,
  252. currency:'CNY',
  253. settlementAmount:null,
  254. remarks:null,
  255. }
  256. ]
  257. },
  258. // 项目
  259. kapian: {},
  260. // 弹窗的开启
  261. pickerShow:false,
  262. // 添加费用弹窗
  263. kapianShow: false,
  264. pickerList:[],
  265. userInfoRoleName:[],
  266. // 当前点击费用的下标
  267. kapianindex:null,
  268. // 用户图片
  269. userImgList: [],
  270. }
  271. },
  272. onLoad(e) {
  273. this.id = e.id
  274. this.type = e.type
  275. this.userInfoRoleName = uni.getStorageSync('userInfo').role_name.split(',')
  276. this.maintenanceDetailfun()
  277. },
  278. onShow() {
  279. },
  280. methods: {
  281. // 添加费用的点击
  282. kapianClick(item,index) {
  283. if (this.form.status == 4) return
  284. this.kapian = item
  285. this.kapianindex = index
  286. this.kapianShow = true;
  287. },
  288. // 添加项目取消
  289. kapianCancel() {
  290. this.kapian = {};
  291. this.kapianShow = false;
  292. },
  293. // 添加项目确认
  294. kapianConfirm() {
  295. console.log(this.kapianindex,319);
  296. if(!this.kapian.costName) {
  297. this.$refs.uToastkapian.show({
  298. type: 'warning',
  299. position:'top',
  300. message: "请输入项目名称",
  301. })
  302. return
  303. }
  304. if(!this.kapian.amount) {
  305. this.$refs.uToastkapian.show({
  306. type: 'warning',
  307. position:'top',
  308. message: "请输入金额",
  309. })
  310. return
  311. }
  312. if(Number(this.kapian.amount) <= 0) {
  313. this.$refs.uToastkapian.show({
  314. type: 'warning',
  315. position:'top',
  316. message: "请输入不包含负数的数字",
  317. })
  318. return
  319. }
  320. if (this.kapianindex != null) {
  321. this.form.maintenanceFees[this.kapianindex] = this.kapian
  322. }else {
  323. this.form.maintenanceFees.push(this.kapian)
  324. }
  325. var money = 0
  326. for (let fees of this.form.maintenanceFees) {
  327. money += Number(fees.amount)
  328. }
  329. this.form.maintenanceAmount = money;
  330. this.kapianindex = null
  331. this.kapianShow = false;
  332. this.kapian = {}
  333. },
  334. moneyInput(value) {
  335. if (!value) return
  336. //正则表达试
  337. value = (value.match(/^\d*(\.?\d{0,2})/g)[0]) || null
  338. //重新赋值给input
  339. this.$nextTick(() => {
  340. this.kapian.amount = value
  341. })
  342. // var money = 0
  343. // for (let fees of this.form.maintenanceFees) {
  344. // money += Number(fees.amount)
  345. // }
  346. // this.form.maintenanceAmount = money;
  347. },
  348. tab(type) {
  349. if(type == "wx") {
  350. this.wxStyle = "#fd4b09"
  351. this.gzStyle = ""
  352. // this.form.status = 2
  353. } else if (type == "gz") {
  354. if (this.form.dispatchingWorkers == 2 && this.userInfoRoleName.indexOf('admin') == -1) return
  355. this.gzStyle = "#fd4b09"
  356. this.wxStyle = ""
  357. // this.form.status = 3
  358. }
  359. },
  360. // 设备删除
  361. maintenanceDe(index){
  362. this.kapianindex = null
  363. this.kapianShow = false;
  364. this.kapian = {}
  365. this.form.maintenanceFees.splice(index,1)
  366. var money = 0
  367. for (let fees of this.form.maintenanceFees) {
  368. money += Number(fees.amount)
  369. }
  370. this.form.maintenanceAmount = money;
  371. },
  372. // 撤销派工
  373. maintenanceRevokeDispatchingWorkersfun(){
  374. this.modalTitle = '撤销派工'
  375. this.modalShow = true
  376. },
  377. // 派工
  378. maintenanceDispatchingWorkersfun(){
  379. if (!this.form.maintenanceWorkerId) {
  380. return this.$refs.uToast.show({type: 'warning',message: '请选择维修工'})
  381. }
  382. // if (!this.form.maintenanceWorkerTel) {
  383. // return this.$refs.uToast.show({type: 'warning',message: '请输入维修工电话'})
  384. // }
  385. this.modalTitle = '派工'
  386. this.modalShow = true
  387. },
  388. // 确认派工弹窗
  389. modalConfirm(){
  390. this.modalShow = false
  391. if (this.modalTitle == '派工') {
  392. this.overlayShow = true;
  393. maintenanceDispatchingWorkers(this.form).then(res=>{
  394. if (res.code == 200) {
  395. this.$refs.uToast.show({
  396. type: 'success',
  397. message: "派工成功",
  398. })
  399. this.form = res.data
  400. this.tab('wx')
  401. }else {
  402. this.$refs.uToast.show({
  403. type: 'error',
  404. message: res.msg,
  405. })
  406. }
  407. this.overlayShow = false;
  408. })
  409. }else if (this.modalTitle == '撤销派工') {
  410. this.overlayShow = true;
  411. this.form.maintenanceWorkerId = null
  412. this.form.maintenanceWorkerName = null
  413. this.form.maintenanceWorkerTel = null
  414. maintenanceRevokeDispatchingWorkers(this.form).then(res=>{
  415. if (res.code == 200) {
  416. this.$refs.uToast.show({
  417. type: 'success',
  418. message: "撤销派工成功",
  419. })
  420. this.form = res.data
  421. this.wxStyle = ""
  422. this.gzStyle = ""
  423. }else {
  424. this.$refs.uToast.show({
  425. type: 'error',
  426. message: res.msg,
  427. })
  428. }
  429. this.overlayShow = false;
  430. })
  431. }else if (this.modalTitle == '确认接单') {
  432. this.receivingOrdersfun()
  433. }else if (this.modalTitle == '确认费用') {
  434. this.overlayShow = true
  435. maintenanceConfirm(this.form).then(res=>{
  436. if (res.code == 200) {
  437. this.$refs.uToast.show({
  438. type: 'success',
  439. message: "操作成功",
  440. })
  441. // uni.navigateBack({
  442. // delta: 1
  443. // });
  444. this.form = res.data
  445. }else {
  446. this.$refs.uToast.show({
  447. type: 'error',
  448. message: res.msg,
  449. })
  450. }
  451. this.overlayShow = false;
  452. })
  453. }else if (this.modalTitle == '撤销费用') {
  454. this.Revocationfeesfun()
  455. }else if (this.modalTitle == '确认结算') {
  456. this.ConfirmSettlement()
  457. }
  458. },
  459. // 维修工弹窗开启
  460. pickerShowfun(){
  461. this.pickerShow = true
  462. this.userListfun()
  463. },
  464. // 维修工获取
  465. userListfun(){
  466. userList({roleAlias:'维修工'}).then(res=>{
  467. this.pickerList = [res.data]
  468. })
  469. },
  470. // 维修工弹窗的确认
  471. pickerShowConfirm(e){
  472. console.log(e.value[0],181);
  473. this.form.maintenanceWorkerId = e.value[0].id
  474. this.form.maintenanceWorkerName = e.value[0].name
  475. this.form.maintenanceWorkerTel = e.value[0].phone
  476. this.pickerShow = false
  477. },
  478. // 维修工弹窗取消
  479. pickerShowCancel() {
  480. this.pickerShow = false
  481. },
  482. // 维修费用的添加
  483. wxaddfun(){
  484. this.form.maintenanceFees.push({
  485. id:null,
  486. costId:null,
  487. costName:null,
  488. number:1,
  489. price:null,
  490. amount:null,
  491. currency:'CNY',
  492. settlementAmount:null,
  493. remarks:null,
  494. })
  495. },
  496. // 确认费用
  497. Confirmexpenses(){
  498. let a = true
  499. if (this.form.maintenanceFees.length <= 0) {
  500. return this.$refs.uToast.show({type: 'warning',message: '请添加维修费用'})
  501. }else {
  502. this.form.maintenanceFees.map((item,index)=>{
  503. if (!item.costName) {
  504. this.$refs.uToast.show({type: 'warning',message: `请填写序号${index + 1}的费用名称`})
  505. a = false
  506. return
  507. }
  508. if (!item.amount) {
  509. this.$refs.uToast.show({type: 'warning',message: `请填写序号${index + 1}的金额`})
  510. a = false
  511. return
  512. }
  513. })
  514. if (a == false) {
  515. return
  516. }
  517. var imgList = this.form.maintenanceFiles
  518. for (let key in imgList) {
  519. this.form.maintenanceFiles[key].sort = key + 1
  520. }
  521. this.modalTitle = '确认费用'
  522. this.modalShow = true
  523. }
  524. },
  525. // 撤销费用
  526. Revocationfeesfun(){
  527. this.overlayShow = true;
  528. maintenancerRvokeConfirmFees(this.form).then(res=>{
  529. if (res.code == 200) {
  530. this.$refs.uToast.show({
  531. type: 'success',
  532. message: "撤销成功",
  533. })
  534. this.form = res.data
  535. }else {
  536. this.$refs.uToast.show({
  537. type: 'error',
  538. message: res.msg,
  539. })
  540. }
  541. this.overlayShow = false;
  542. })
  543. },
  544. // 确认结算
  545. ConfirmSettlement(){
  546. // this.overlayShow = true;
  547. // this.overlayShow = false;
  548. this.$refs.uToast.show({
  549. message: "功能暂未开启,请耐心等待"
  550. })
  551. },
  552. // 确认接单接口
  553. receivingOrdersfun(){
  554. this.overlayShow = true
  555. maintenanceReceivingOrders(this.form).then(res=>{
  556. console.log(res,180);
  557. if (res.code == 200) {
  558. this.$refs.uToast.show({
  559. type: 'success',
  560. message: "接单成功",
  561. })
  562. this.form = res.data
  563. this.tab('gz')
  564. }else {
  565. this.$refs.uToast.show({
  566. type: 'error',
  567. message: res.msg,
  568. })
  569. }
  570. this.overlayShow = false
  571. })
  572. },
  573. // 维修设备详情
  574. maintenanceDetailfun(){
  575. maintenanceDetail({id:this.id}).then(res=>{
  576. this.form = res.data
  577. let arr1 = []
  578. let arr2 = []
  579. for (let index in this.form.maintenanceFiles) {
  580. if(this.form.maintenanceFiles[index].uploadType == 0) {
  581. arr1.push(this.form.maintenanceFiles[index])
  582. }else{
  583. arr2.push(this.form.maintenanceFiles[index])
  584. }
  585. }
  586. this.userImgList = arr1;
  587. this.form.maintenanceFiles = arr2;
  588. if (this.form.status == 4) {
  589. this.gzStyle = "#fd4b09"
  590. this.wxStyle = ""
  591. } else if (this.form.status == 3 && this.form.dispatchingWorkers == 3) {
  592. this.gzStyle = "#fd4b09"
  593. this.wxStyle = ""
  594. } else if (this.form.status == 3 && this.form.dispatchingWorkers == 1) {
  595. this.wxStyle = "#fd4b09"
  596. this.gzStyle = ""
  597. } else if (this.form.dispatchingWorkers == 2) {
  598. console.log(this.form.status);
  599. this.wxStyle = "#fd4b09"
  600. this.gzStyle = ""
  601. } else if (this.form.status == 1) {
  602. userList({roleAlias:'维修工'}).then(res=>{
  603. this.wxUserList = [res.data]
  604. })
  605. }
  606. // if (this.type == 'JD') {
  607. // this.form.maintenanceFees.push({
  608. // id:null,
  609. // costId:null,
  610. // costName:null,
  611. // number:1,
  612. // price:null,
  613. // amount:null,
  614. // currency:'CNY',
  615. // settlementAmount:null,
  616. // remarks:null,
  617. // })
  618. // }
  619. })
  620. },
  621. // 图片删除
  622. deletePic(e){
  623. if(e.file.uploadType == 0) return this.$refs.uToast.show({ type: 'warning', message: '请勿删除客户添加的图片',})
  624. if(this.form.status != 3) return this.$refs.uToast.show({ type: 'warning', message: '修改数据请撤销费用',})
  625. this.form.maintenanceFiles.splice(e.index,1)
  626. },
  627. // 上传图片
  628. async afterRead(event){
  629. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  630. let lists = [].concat(event.file)
  631. console.log(lists);
  632. let fileListLen = this.form.maintenanceFiles.length
  633. lists.map((item) => {
  634. this.form.maintenanceFiles.push({
  635. uploadType:1,
  636. ...item
  637. })
  638. })
  639. for (let i = 0; i < lists.length; i++) {
  640. const result = await this.uploadFilePromise(lists[i].url)
  641. let item = this.form.maintenanceFiles[fileListLen]
  642. this.form.maintenanceFiles.splice(fileListLen, 1, Object.assign(item, {
  643. sort: this.form.maintenanceFiles.length,
  644. fileName: JSON.parse(result).data.originalName,
  645. url: JSON.parse(result).data.link
  646. }))
  647. fileListLen++
  648. }
  649. },
  650. uploadFilePromise(url) {
  651. return new Promise((resolve, reject) => {
  652. let a = uni.uploadFile({
  653. url: http.config.baseURL +
  654. '/blade-resource/oss/endpoint/put-file', // 仅为示例,非真实的接口地址
  655. filePath: url,
  656. name: 'file',
  657. formData: {
  658. user: 'test'
  659. },
  660. header: {
  661. // 客户端认证参数
  662. 'Authorization': 'Basic ' + Base64.encode(clientId + ':' +
  663. clientSecret),
  664. 'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken')
  665. },
  666. success: (res) => {
  667. setTimeout(() => {
  668. resolve(res.data)
  669. }, 1000)
  670. }
  671. });
  672. })
  673. },
  674. }
  675. }
  676. </script>
  677. <style lang="scss" scoped>
  678. .kapianModel {
  679. display: flex;
  680. align-items: center;
  681. // justify-content: flex-start;
  682. }
  683. .positionSC {
  684. position: absolute;
  685. top: -80rpx;
  686. right: -60rpx;
  687. background: #fd4b09;
  688. color: #fff;
  689. font-size: 30rpx;
  690. padding: 10rpx 15rpx;
  691. border-radius: 12rpx;
  692. }
  693. .label {
  694. left: 0rpx;
  695. top: 190rpx;
  696. width: 100%;
  697. height: 114rpx;
  698. line-height: 40rpx;
  699. background-color: rgba(255, 255, 255, 1);
  700. text-align: center;
  701. display: flex;
  702. align-items: center;
  703. .tab {
  704. width: 50%;
  705. display: flex;
  706. color: #c4c4c4;
  707. align-items: center;
  708. justify-content: center;
  709. font-size: 40rpx;
  710. text-align: left;
  711. font-family: PingFangSC-semiBold;
  712. }
  713. }
  714. .repairdetails {
  715. padding: 20rpx;
  716. box-sizing: border-box;
  717. }
  718. .cardBox {
  719. background: #fff;
  720. border-radius: 12rpx;
  721. width: 100%;
  722. padding: 30rpx;
  723. box-sizing: border-box;
  724. margin-bottom: 20rpx;
  725. display: flex;
  726. align-items: center;
  727. justify-content: center;
  728. }
  729. .text {
  730. font-size: 30rpx;
  731. color: #999;
  732. margin-right: 10rpx;
  733. }
  734. .kapian {
  735. background: #fff;
  736. border-radius: 12rpx;
  737. width: 100%;
  738. padding: 30rpx;
  739. box-sizing: border-box;
  740. margin-bottom: 20rpx;
  741. .repairProject {
  742. display: flex;
  743. justify-content: space-between;
  744. padding: 0 20rpx;
  745. }
  746. .wxtitleflex {
  747. display: flex;
  748. align-items: center;
  749. justify-content: space-between;
  750. }
  751. .wxtitle {
  752. font-size: 34rpx;
  753. color: #888;
  754. }
  755. .wxbox {
  756. border-bottom: 2rpx solid #eee;
  757. display: flex;
  758. align-items: center;
  759. justify-content: center;
  760. padding: 20rpx 0;
  761. margin: 10rpx 0;
  762. }
  763. .addwx {
  764. color: #dd451b;
  765. font-size: 30rpx;
  766. padding: 10rpx 20rpx;
  767. border: 2rpx solid;
  768. border-radius: 30rpx;
  769. }
  770. .WXflex {
  771. display: flex;
  772. justify-content: space-between;
  773. align-items: center;
  774. .xuhao {
  775. font-size: 32rpx;
  776. color: #101010;
  777. }
  778. .wxscfun {
  779. color: red;
  780. font-size: 30rpx;
  781. padding: 10rpx 20rpx;
  782. border: 2rpx solid;
  783. border-radius: 28rpx;
  784. }
  785. }
  786. }
  787. .bottombox {
  788. position: fixed;
  789. bottom: 0;
  790. width: 100%;
  791. height: 120rpx;
  792. background: #fff;
  793. box-shadow: 0rpx 4rpx 4rpx 4rpx rgba(0, 0, 0, 0.5);
  794. padding: 0 40rpx;
  795. box-sizing: border-box;
  796. display: flex;
  797. justify-content: space-between;
  798. align-items: center;
  799. .bottombox_name {
  800. font-size: 38rpx;
  801. color: #101010;
  802. }
  803. .bottombox_right {
  804. display: flex;
  805. .buttonClass {
  806. // background: #2d4a6a;
  807. background: #FD4B09;
  808. padding: 15rpx;
  809. margin: 0 5rpx;
  810. border-radius: 30rpx;
  811. color: #fff;
  812. // font-weight: bold;
  813. // margin: 0 10rpx;
  814. }
  815. }
  816. }
  817. </style>