RepairDetails.vue 23 KB

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