details.vue 23 KB

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