details.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891
  1. <template>
  2. <view class="">
  3. <uni-section title="基本信息" style="padding: 0 62rpx;" titleColor="5F5F5F" titleFontSize="28rpx">
  4. <template v-slot:right>
  5. <text style="color: #5F5F5F;">
  6. {{form.claimNo}}
  7. </text>
  8. </template>
  9. <uni-forms ref="form1" :modelValue="form" :border="true" label-width="80">
  10. <uni-forms-item name="consumerName" label="联系人">
  11. <uni-easyinput v-model="form.consumerName" class="right-align" placeholder-class="placeholder-right"
  12. placeholder="请输入联系人" :inputBorder="false" :disabled="true" :clearable="false"></uni-easyinput>
  13. </uni-forms-item>
  14. <uni-forms-item name="consumerPhone" label="电话" required>
  15. <uni-easyinput v-model="form.consumerPhone" class="right-align"
  16. placeholder-class="placeholder-right" placeholder="请输入电话" :inputBorder="false" :disabled="true"
  17. :clearable="false"></uni-easyinput>
  18. </uni-forms-item>
  19. <uni-forms-item name="vehicleNumber" label="车牌号">
  20. <uni-easyinput v-model="form.vehicleNumber" class="right-align"
  21. placeholder-class="placeholder-right" placeholder="请输入车牌号" :inputBorder="false" :disabled="true"
  22. :clearable="false"></uni-easyinput>
  23. </uni-forms-item>
  24. <uni-forms-item name="tyreNo" label="胎号">
  25. <uni-easyinput v-model="form.tyreNo" class="right-align" placeholder-class="placeholder-right"
  26. placeholder="请输入胎号" :inputBorder="false" :disabled="true" :clearable="false"></uni-easyinput>
  27. </uni-forms-item>
  28. <uni-forms-item name="tyreSpecs" label="规格型号">
  29. <uni-easyinput v-model="form.tyreSpecs" class="right-align" placeholder-class="placeholder-right"
  30. placeholder="" :inputBorder="false" :disabled="true" :clearable="false"></uni-easyinput>
  31. </uni-forms-item>
  32. <uni-forms-item name="brandItem" label="花纹">
  33. <uni-easyinput v-model="form.brandItem" class="right-align" placeholder-class="placeholder-right"
  34. placeholder="" :inputBorder="false" :disabled="true" :clearable="false"></uni-easyinput>
  35. </uni-forms-item>
  36. <uni-forms-item name="brandName" label="品牌">
  37. <uni-easyinput v-model="form.brandName" class="right-align" placeholder-class="placeholder-right"
  38. placeholder="" :inputBorder="false" :disabled="true" :clearable="false"></uni-easyinput>
  39. </uni-forms-item>
  40. <uni-forms-item name="tireQuantity" label="轮胎数量" required>
  41. <uni-easyinput v-model="form.tireQuantity" class="right-align" placeholder-class="placeholder-right"
  42. placeholder="请输入数量" :inputBorder="false" :disabled="true" type="number"
  43. @blur="intBlur('tireQuantity',form.tireQuantity)" :clearable="false"></uni-easyinput>
  44. </uni-forms-item>
  45. <uni-forms-item name="claimAmount" label="索赔金额">
  46. <uni-easyinput v-model="form.claimAmount" class="right-align" placeholder-class="placeholder-right"
  47. placeholder="" :inputBorder="false" :disabled="true" type="number"
  48. @blur="handleBlur(form.claimAmount)" :clearable="false"></uni-easyinput>
  49. </uni-forms-item>
  50. <uni-forms-item name="claimReason" label="理赔原因">
  51. <uni-easyinput v-model="form.claimReason" class="right-align" type="textarea"
  52. placeholder-class="placeholder-right" placeholder="请输入内容" :inputBorder="false"
  53. :disabled="true"></uni-easyinput>
  54. </uni-forms-item>
  55. </uni-forms>
  56. </uni-section>
  57. <uni-section title="相应图片信息" style="padding: 0 62rpx 60rpx 62rpx;margin-top: 30rpx;" titleColor="5F5F5F"
  58. titleFontSize="28rpx">
  59. <view class="photo-upload">
  60. <view>
  61. <view class="photo-upload-text">示例照片</view>
  62. <view>
  63. <image class="photo-upload-img" src="@/static/images/home/claim/em4.png" />
  64. </view>
  65. </view>
  66. <view>
  67. <view class="photo-upload-text" style="color: #03803B;">病象</view>
  68. <view class="photo-upload-upload">
  69. <uni-file-picker v-model="form.file1" return-type="object" limit="1" :imageStyles="imageStyles"
  70. file-mediatype="image" @select="fileSelect1" @delete="fileDelete"
  71. :del-icon="false" :sourceType="['camera']" :readonly="!form.file1">
  72. <image class="photo-upload-img2" src="@/static/images/home/claim/upload.png" />
  73. </uni-file-picker>
  74. </view>
  75. </view>
  76. </view>
  77. <view class="photo-upload">
  78. <view>
  79. <view class="photo-upload-text">示例照片</view>
  80. <view>
  81. <image class="photo-upload-img" src="@/static/images/home/claim/em2.png" />
  82. </view>
  83. </view>
  84. <view>
  85. <view class="photo-upload-text" style="color: #03803B;">轮胎DOT</view>
  86. <view class="photo-upload-upload">
  87. <uni-file-picker v-model="form.file2" return-type="object" limit="1" :imageStyles="imageStyles"
  88. file-mediatype="image" @select="fileSelect2" @delete="fileDelete"
  89. :del-icon="false" :sourceType="['camera']" :readonly="!form.file2">
  90. <image class="photo-upload-img2" src="@/static/images/home/claim/upload.png" />
  91. </uni-file-picker>
  92. </view>
  93. </view>
  94. </view>
  95. <view class="photo-upload">
  96. <view>
  97. <view class="photo-upload-text">示例照片</view>
  98. <view>
  99. <image class="photo-upload-img" src="@/static/images/home/claim/em3.png" />
  100. </view>
  101. </view>
  102. <view>
  103. <view class="photo-upload-text" style="color: #03803B;">花纹深度</view>
  104. <view class="photo-upload-upload">
  105. <uni-file-picker v-model="form.file3" return-type="object" limit="1" :imageStyles="imageStyles"
  106. file-mediatype="image" @select="fileSelect3" @delete="fileDelete"
  107. :del-icon="false" :sourceType="['camera']" :readonly="!form.file3">
  108. <image class="photo-upload-img2" src="@/static/images/home/claim/upload.png" />
  109. </uni-file-picker>
  110. </view>
  111. </view>
  112. </view>
  113. <!-- <view class="photo-upload">
  114. <view>
  115. <view class="photo-upload-text">示例照片</view>
  116. <view>
  117. <image class="photo-upload-img" src="@/static/images/home/claim/em4.png" />
  118. </view>
  119. </view>
  120. <view>
  121. <view class="photo-upload-text" style="color: #B5B4B4;">鼓包处照片</view>
  122. <view class="photo-upload-upload">
  123. <uni-file-picker v-model="form.file4" return-type="object" limit="1" :imageStyles="imageStyles"
  124. file-mediatype="image" @select="fileSelect4" @delete="fileDelete" @success="fileSuccess"
  125. :del-icon="false">
  126. <image class="photo-upload-img2" src="@/static/images/home/claim/upload.png" />
  127. </uni-file-picker>
  128. </view>
  129. </view>
  130. </view> -->
  131. </uni-section>
  132. <!-- <view style="height: 200rpx;display: flex;align-items: center;justify-content: center;">
  133. <debounce-button style="color:#ffffff;backgroundColor:#03803B;width: 400rpx;" @click="submit">提交材料</debounce-button>
  134. </view> -->
  135. <!-- <view style="padding:30rpx 20rpx;">
  136. <debounce-button v-if="!form.id" bgColor='#03803B' @click="submit">保存</debounce-button>
  137. <view v-if="form.auditStatus==0" style="display: flex;">
  138. <debounce-button bgColor='#03803B' style="width: 260rpx;" @click="submit">保存</debounce-button>
  139. <debounce-button type="warn" v-if="form.auditStatus==0" style="width: 260rpx;"
  140. @click="approval">提交</debounce-button>
  141. </view>
  142. <debounce-button type="warn" v-if="form.auditStatus==1" @click="revoke">撤销审核</debounce-button>
  143. </view> -->
  144. </view>
  145. </template>
  146. <script>
  147. import http from '@/http/api.js'
  148. import {
  149. clientId,
  150. clientSecret
  151. } from '@/common/setting'
  152. import {
  153. submit,
  154. getDetail,
  155. fileRemove,
  156. submitApproval,
  157. revokeApproval
  158. } from '@/api/home/claim.js'
  159. export default {
  160. data() {
  161. return {
  162. form: {
  163. file1: null,
  164. file2: null,
  165. file3: null,
  166. file4: null,
  167. claimSourceType: 1,
  168. tireQuantity: null,
  169. claimAmount: null,
  170. claimAttachmentList: [],
  171. },
  172. imageStyles: {
  173. width: 145,
  174. height: 145,
  175. border: false,
  176. },
  177. mapObject: {
  178. text: 'name',
  179. value: 'code',
  180. children: 'children'
  181. },
  182. addressData: [],
  183. labelList: [],
  184. corpsTypeList: [],
  185. storeAttributesList: [],
  186. chainAttributeList: [],
  187. signingLevelList: []
  188. }
  189. },
  190. onLoad(option) {
  191. this.addressData = JSON.parse(uni.getStorageSync("addressData"))
  192. if (option && option.id) {
  193. this.getDetail(option.id)
  194. }
  195. },
  196. methods: {
  197. removeByIdFilter(arr, id) {
  198. return arr.filter(item => item.id !== id);
  199. },
  200. intBlur(name, value) {
  201. if (!this.form[name]) return
  202. // 使用toFixed处理小数位
  203. try {
  204. const num = parseFloat(this.form[name])
  205. if (!isNaN(num)) {
  206. this.form[name] = Math.floor(num)
  207. }
  208. } catch (e) {
  209. console.error('格式化错误', e)
  210. }
  211. },
  212. handleBlur(value) {
  213. if (!this.form.claimAmount) return
  214. // 使用toFixed处理小数位
  215. try {
  216. const num = parseFloat(this.form.claimAmount)
  217. if (!isNaN(num)) {
  218. this.form.claimAmount = num.toFixed(4)
  219. }
  220. } catch (e) {
  221. console.error('格式化错误', e)
  222. }
  223. },
  224. fileDelete(row) {
  225. if (row.tempFile.id) {
  226. uni.showLoading({
  227. title: '加载中',
  228. mask: true
  229. });
  230. fileRemove(row.tempFile.id).then(res => {
  231. uni.showToast({
  232. title: '删除成功',
  233. icon: 'none'
  234. });
  235. this.form.claimAttachmentList = this.removeByIdFilter(this.form.claimAttachmentList, row
  236. .tempFile.id);
  237. }).finally(() => {
  238. uni.hideLoading()
  239. });
  240. }
  241. },
  242. getFileExtension(filename) {
  243. return filename.slice(((filename.lastIndexOf(".") - 1) >>> 0) + 2);
  244. },
  245. fileSelect1(files) {
  246. files.tempFiles.forEach(file => {
  247. uni.showLoading({
  248. title: '加载中',
  249. mask: true
  250. });
  251. uni.uploadFile({
  252. url: http.config.baseURL +
  253. '/blade-resource/oss/endpoint/put-file', // 仅为示例,非真实的接口地址
  254. filePath: file.path,
  255. header: {
  256. // 客户端认证参数
  257. 'Authorization': 'Basic ' + Base64.encode(clientId + ':' + clientSecret),
  258. 'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken')
  259. },
  260. name: 'file',
  261. success: (res) => {
  262. const data = JSON.parse(res.data).data
  263. this.form.file1 = {
  264. ...this.form.file1,
  265. url: data.link,
  266. name: data.originalName,
  267. extname: this.getFileExtension(data.originalName),
  268. size: file.size,
  269. }
  270. uni.showToast({
  271. title: '上传成功',
  272. icon: 'none'
  273. });
  274. },
  275. fail: (err) => {
  276. uni.showToast({
  277. title: '上传失败',
  278. icon: 'none'
  279. });
  280. },
  281. complete: () => {
  282. uni.hideLoading()
  283. }
  284. })
  285. })
  286. },
  287. fileSelect2(files) {
  288. files.tempFiles.forEach(file => {
  289. uni.showLoading({
  290. title: '加载中',
  291. mask: true
  292. });
  293. uni.uploadFile({
  294. url: http.config.baseURL +
  295. '/blade-resource/oss/endpoint/put-file', // 仅为示例,非真实的接口地址
  296. filePath: file.path,
  297. header: {
  298. // 客户端认证参数
  299. 'Authorization': 'Basic ' + Base64.encode(clientId + ':' + clientSecret),
  300. 'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken')
  301. },
  302. name: 'file',
  303. success: (res) => {
  304. const data = JSON.parse(res.data).data
  305. this.form.file2 = {
  306. ...this.form.file2,
  307. url: data.link,
  308. name: data.originalName,
  309. extname: this.getFileExtension(data.originalName),
  310. size: file.size,
  311. }
  312. uni.showToast({
  313. title: '上传成功',
  314. icon: 'none'
  315. });
  316. },
  317. fail: (err) => {
  318. uni.showToast({
  319. title: '上传失败',
  320. icon: 'none'
  321. });
  322. },
  323. complete: () => {
  324. uni.hideLoading()
  325. }
  326. })
  327. })
  328. },
  329. fileSelect3(files) {
  330. files.tempFiles.forEach(file => {
  331. uni.showLoading({
  332. title: '加载中',
  333. mask: true
  334. });
  335. uni.uploadFile({
  336. url: http.config.baseURL +
  337. '/blade-resource/oss/endpoint/put-file', // 仅为示例,非真实的接口地址
  338. filePath: file.path,
  339. header: {
  340. // 客户端认证参数
  341. 'Authorization': 'Basic ' + Base64.encode(clientId + ':' + clientSecret),
  342. 'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken')
  343. },
  344. name: 'file',
  345. success: (res) => {
  346. const data = JSON.parse(res.data).data
  347. this.form.file3 = {
  348. ...this.form.file3,
  349. url: data.link,
  350. name: data.originalName,
  351. extname: this.getFileExtension(data.originalName),
  352. size: file.size,
  353. }
  354. uni.showToast({
  355. title: '上传成功',
  356. icon: 'none'
  357. });
  358. },
  359. fail: (err) => {
  360. uni.showToast({
  361. title: '上传失败',
  362. icon: 'none'
  363. });
  364. },
  365. complete: () => {
  366. uni.hideLoading()
  367. }
  368. })
  369. })
  370. },
  371. fileSelect4(files) {
  372. files.tempFiles.forEach(file => {
  373. uni.showLoading({
  374. title: '加载中',
  375. mask: true
  376. });
  377. uni.uploadFile({
  378. url: http.config.baseURL +
  379. '/blade-resource/oss/endpoint/put-file', // 仅为示例,非真实的接口地址
  380. filePath: file.path,
  381. header: {
  382. // 客户端认证参数
  383. 'Authorization': 'Basic ' + Base64.encode(clientId + ':' + clientSecret),
  384. 'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken')
  385. },
  386. name: 'file',
  387. success: (res) => {
  388. const data = JSON.parse(res.data).data
  389. this.form.file4 = {
  390. ...this.form.file4,
  391. url: data.link,
  392. name: data.originalName,
  393. extname: this.getFileExtension(data.originalName),
  394. size: file.size,
  395. }
  396. uni.showToast({
  397. title: '上传成功',
  398. icon: 'none'
  399. });
  400. },
  401. fail: (err) => {
  402. uni.showToast({
  403. title: '上传失败',
  404. icon: 'none'
  405. });
  406. },
  407. complete: () => {
  408. uni.hideLoading()
  409. }
  410. })
  411. })
  412. },
  413. async submit() {
  414. // if (!this.form.consumerName) {
  415. // uni.showToast({
  416. // title: '请输入联系人',
  417. // icon: 'none'
  418. // });
  419. // return
  420. // }
  421. if (!this.form.consumerPhone) {
  422. uni.showToast({
  423. title: '请输入电话',
  424. icon: 'none'
  425. });
  426. return
  427. }
  428. if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(this.form.consumerPhone)) {
  429. uni.showToast({
  430. title: '请输入正确电话',
  431. icon: 'none'
  432. });
  433. return;
  434. }
  435. // if (!this.form.vehicleNumber) {
  436. // uni.showToast({
  437. // title: '请输入车牌号',
  438. // icon: 'none'
  439. // });
  440. // return
  441. // }
  442. // if (!this.form.tyreSpecs) {
  443. // uni.showToast({
  444. // title: '请输入规格型号',
  445. // icon: 'none'
  446. // });
  447. // return
  448. // }
  449. // if (!this.form.tyreNo) {
  450. // uni.showToast({
  451. // title: '请输入胎号',
  452. // icon: 'none'
  453. // });
  454. // return
  455. // }
  456. const decimalRegex = /^-?\d+\.\d+$/ // 小数正则
  457. if (!Number(this.form.tireQuantity) || decimalRegex.test(Number(this.form.tireQuantity))) {
  458. uni.showToast({
  459. title: '请正确输入轮胎数量',
  460. icon: 'none'
  461. });
  462. return
  463. }
  464. // if (!this.form.claimReason) {
  465. // uni.showToast({
  466. // title: '请输入理赔原因',
  467. // icon: 'none'
  468. // });
  469. // return
  470. // }
  471. if (!this.form.file1) {
  472. uni.showToast({
  473. title: '请上传病象',
  474. icon: 'none'
  475. });
  476. return
  477. }
  478. if (!this.form.file2) {
  479. uni.showToast({
  480. title: '请上传轮胎DOT',
  481. icon: 'none'
  482. });
  483. return
  484. }
  485. if (!this.form.file3) {
  486. uni.showToast({
  487. title: '请上传花纹深度',
  488. icon: 'none'
  489. });
  490. return
  491. }
  492. // if (!this.form.file4) {
  493. // uni.showToast({
  494. // title: '请上传鼓包处照片',
  495. // icon: 'none'
  496. // });
  497. // return
  498. // }
  499. let obj = await this.convertData(this.$deepClone(this.form))
  500. uni.showLoading({
  501. title: '加载中',
  502. mask: true
  503. });
  504. submit(obj).then(res => {
  505. setTimeout(() => {
  506. uni.showToast({
  507. title: '保存成功',
  508. icon: 'none',
  509. });
  510. }, 10);
  511. this.getDetail(res.data.id)
  512. })
  513. .catch(() => {
  514. uni.hideLoading()
  515. });
  516. },
  517. async approval() {
  518. // if (!this.form.consumerName) {
  519. // uni.showToast({
  520. // title: '请输入联系人',
  521. // icon: 'none'
  522. // });
  523. // return
  524. // }
  525. if (!this.form.consumerPhone) {
  526. uni.showToast({
  527. title: '请输入电话',
  528. icon: 'none'
  529. });
  530. return
  531. }
  532. if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(this.form.consumerPhone)) {
  533. uni.showToast({
  534. title: '请输入正确电话',
  535. icon: 'none'
  536. });
  537. return;
  538. }
  539. // if (!this.form.vehicleNumber) {
  540. // uni.showToast({
  541. // title: '请输入车牌号',
  542. // icon: 'none'
  543. // });
  544. // return
  545. // }
  546. // if (!this.form.tyreSpecs) {
  547. // uni.showToast({
  548. // title: '请输入规格型号',
  549. // icon: 'none'
  550. // });
  551. // return
  552. // }
  553. // if (!this.form.tyreNo) {
  554. // uni.showToast({
  555. // title: '请输入胎号',
  556. // icon: 'none'
  557. // });
  558. // return
  559. // }
  560. const decimalRegex = /^-?\d+\.\d+$/ // 小数正则
  561. if (!Number(this.form.tireQuantity) || decimalRegex.test(Number(this.form.tireQuantity))) {
  562. uni.showToast({
  563. title: '请正确输入轮胎数量',
  564. icon: 'none'
  565. });
  566. return
  567. }
  568. // if (!this.form.claimReason) {
  569. // uni.showToast({
  570. // title: '请输入理赔原因',
  571. // icon: 'none'
  572. // });
  573. // return
  574. // }
  575. if (!this.form.file1) {
  576. uni.showToast({
  577. title: '请上传病象',
  578. icon: 'none'
  579. });
  580. return
  581. }
  582. if (!this.form.file2) {
  583. uni.showToast({
  584. title: '请上传轮胎DOT',
  585. icon: 'none'
  586. });
  587. return
  588. }
  589. if (!this.form.file3) {
  590. uni.showToast({
  591. title: '请上传花纹深度',
  592. icon: 'none'
  593. });
  594. return
  595. }
  596. // if (!this.form.file4) {
  597. // uni.showToast({
  598. // title: '请上传鼓包处照片',
  599. // icon: 'none'
  600. // });
  601. // return
  602. // }
  603. let form = await this.convertData(this.$deepClone(this.form))
  604. let obj = {
  605. id: this.form.id
  606. }
  607. let _this = this
  608. uni.showModal({
  609. title: '提示',
  610. content: '是否提交审核?',
  611. success: function(res) {
  612. if (res.confirm) {
  613. uni.showLoading({
  614. title: '加载中',
  615. mask: true
  616. });
  617. submit(form).then(res => {
  618. submitApproval(obj).then(res => {
  619. setTimeout(() => {
  620. uni.showToast({
  621. title: '操作成功',
  622. icon: 'none',
  623. duration: 2000
  624. });
  625. }, 10);
  626. _this.getDetail(_this.form.id)
  627. })
  628. .catch(() => {
  629. uni.hideLoading()
  630. });
  631. })
  632. .catch(() => {
  633. uni.hideLoading()
  634. });
  635. }
  636. }
  637. });
  638. },
  639. revoke() {
  640. let obj = {
  641. id: this.form.id
  642. }
  643. let _this = this
  644. uni.showModal({
  645. title: '提示',
  646. content: '是否撤销审核?',
  647. success: function(res) {
  648. if (res.confirm) {
  649. uni.showLoading({
  650. title: '加载中',
  651. mask: true
  652. });
  653. revokeApproval(obj).then(res => {
  654. setTimeout(() => {
  655. uni.showToast({
  656. title: '操作成功',
  657. icon: 'none',
  658. duration: 2000
  659. });
  660. }, 10);
  661. _this.getDetail(_this.form.id)
  662. })
  663. .catch(() => {
  664. uni.hideLoading()
  665. });
  666. }
  667. }
  668. });
  669. },
  670. getDetail(id) {
  671. let obj = {
  672. id: id
  673. }
  674. uni.showLoading({
  675. title: '加载中',
  676. mask: true
  677. });
  678. getDetail(obj).then(res => {
  679. res.data.claimAttachmentList.forEach(item => {
  680. if (item.fileProperties == 1) {
  681. res.data.file1 = {
  682. ...item,
  683. url: item.fileUrl,
  684. name: item.fileName,
  685. extname: item.fileType,
  686. size: item.fileSize,
  687. }
  688. }
  689. if (item.fileProperties == 2) {
  690. res.data.file2 = {
  691. ...item,
  692. url: item.fileUrl,
  693. name: item.fileName,
  694. extname: item.fileType,
  695. size: item.fileSize,
  696. }
  697. }
  698. if (item.fileProperties == 3) {
  699. res.data.file3 = {
  700. ...item,
  701. url: item.fileUrl,
  702. name: item.fileName,
  703. extname: item.fileType,
  704. size: item.fileSize,
  705. }
  706. }
  707. // if (item.fileProperties == 4) {
  708. // res.data.file4 = {
  709. // ...item,
  710. // url: item.fileUrl,
  711. // name: item.fileName,
  712. // extname: item.fileType,
  713. // size: item.fileSize,
  714. // }
  715. // }
  716. })
  717. this.form = res.data
  718. })
  719. .finally(() => {
  720. uni.hideLoading()
  721. });
  722. },
  723. async convertData(obj) {
  724. let fileList = []
  725. if (obj.file1 && Object.keys(obj.file1).length) {
  726. fileList.push({
  727. ...obj.file1,
  728. fileProperties: 1,
  729. })
  730. }
  731. if (obj.file2 && Object.keys(obj.file2).length) {
  732. fileList.push({
  733. ...obj.file2,
  734. fileProperties: 2,
  735. })
  736. }
  737. if (obj.file3 && Object.keys(obj.file3).length) {
  738. fileList.push({
  739. ...obj.file3,
  740. fileProperties: 3,
  741. })
  742. }
  743. // if (obj.file4 && Object.keys(obj.file4).length) {
  744. // fileList.push({
  745. // ...obj.file4,
  746. // fileProperties: 4
  747. // })
  748. // }
  749. //附件明细为空时直接赋值
  750. if (obj.claimAttachmentList.length == 0) {
  751. fileList.forEach(item => {
  752. obj.claimAttachmentList.push({
  753. fileProperties: item.fileProperties,
  754. fileUrl: item.url,
  755. fileName: item.name,
  756. fileType: item.extname,
  757. fileSize: item.size
  758. })
  759. })
  760. } else {
  761. //附件明细有明细区分赋值
  762. fileList.forEach(item => {
  763. if (obj.claimAttachmentList.filter(row => row.fileProperties == item.fileProperties)
  764. .length == 0) {
  765. //原附件明细不存在,直接push新元素
  766. obj.claimAttachmentList.push({
  767. fileProperties: item.fileProperties,
  768. fileUrl: item.url,
  769. fileName: item.name,
  770. fileType: item.extname,
  771. fileSize: item.size
  772. })
  773. } else {
  774. //原附件存在明细时,对应赋值
  775. obj.claimAttachmentList.forEach(row => {
  776. if (item.fileProperties == row.fileProperties) {
  777. row.fileUrl = item.url
  778. row.fileName = item.name
  779. row.fileType = item.extname
  780. row.fileSize = item.size
  781. }
  782. })
  783. }
  784. })
  785. }
  786. console.log(obj)
  787. return obj
  788. }
  789. }
  790. }
  791. </script>
  792. <style lang="scss" scoped>
  793. .right-align {
  794. text-align: right;
  795. }
  796. .photo {
  797. margin-left: 20rpx;
  798. width: 38rpx;
  799. height: 32rpx;
  800. }
  801. .photo-upload {
  802. display: flex;
  803. justify-content: space-around;
  804. margin-top: 45rpx;
  805. .photo-upload-text {
  806. font-weight: 400;
  807. font-size: 28rpx;
  808. color: #5F5F5F;
  809. line-height: 32rpx;
  810. text-align: center;
  811. margin-bottom: 15rpx;
  812. }
  813. .photo-upload-img {
  814. width: 280rpx;
  815. height: 280rpx;
  816. background: #D13B34;
  817. border-radius: 7rpx;
  818. }
  819. .photo-upload-upload {
  820. width: 280rpx;
  821. height: 280rpx;
  822. background: #F6F6F6;
  823. border-radius: 7rpx;
  824. display: flex;
  825. justify-content: center;
  826. align-items: center;
  827. .photo-upload-img2 {
  828. width: 219rpx;
  829. height: 219rpx;
  830. }
  831. }
  832. }
  833. ::v-deep .file-picker__box {
  834. width: 280rpx !important;
  835. height: 280rpx !important;
  836. }
  837. ::v-deep .uni-file-picker__container {
  838. margin: 0 !important;
  839. }
  840. ::v-deep .file-picker__box-content {
  841. margin: 0 !important;
  842. }
  843. ::v-deep .file-picker__progress {
  844. display: none;
  845. }
  846. ::v-deep .uni-section .uni-section-header {
  847. font-weight: bold !important;
  848. padding: 12px 0px !important;
  849. border-bottom: 2px solid #F6F6F6;
  850. }
  851. .slot-content-item {
  852. border-radius: 13rpx;
  853. border: 2rpx solid #03803B;
  854. padding: 1rpx 5rpx;
  855. color: #03803B;
  856. }
  857. .slot-content-item-placeholder {
  858. font-weight: 400 !important;
  859. font-size: 28rpx !important;
  860. height: 38rpx !important;
  861. color: #B5B4B4 !important;
  862. }
  863. .slot-box {
  864. gap: 5px;
  865. display: flex;
  866. flex-wrap: wrap;
  867. justify-content: flex-end;
  868. }
  869. </style>