details.vue 24 KB

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