details.vue 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076
  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="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" type="number"
  17. placeholder-class="placeholder-right" placeholder="请输入电话" :inputBorder="false"
  18. :disabled="form.auditStatus>0||form.claimSourceType>1" :clearable="false" maxlength="11"
  19. @change="photoChange"></uni-easyinput>
  20. </uni-forms-item>
  21. <uni-forms-item name="vehicleNumber" label="车牌号">
  22. <view style="display: flex;align-items: center;">
  23. <!-- <uni-easyinput v-model="form.vehicleNumber" class="right-align"
  24. placeholder-class="placeholder-right" placeholder="请输入车牌号" :inputBorder="false"
  25. :disabled="true" :clearable="false" @change="carNoVerify" maxlength="8"
  26. @click="handleInputFocus"></uni-easyinput> -->
  27. <view style="display: flex;align-items: center;height: 36px;width: 100%;">
  28. <view @click="handleInputFocus()" style="width: 100%;text-align: right;padding: 0 20rpx;"
  29. :style="form.vehicleNumber?'color:#000;':'color:#B5B4B4;font-size: 24rpx;'">
  30. {{form.vehicleNumber||(form.auditStatus>0||form.claimSourceType>1?' ':'请输入车牌号')}}
  31. </view>
  32. </view>
  33. <uni-icons v-if="!(form.auditStatus>0||form.claimSourceType>1)" type="camera" size="24"
  34. color='#03803B' @click="allClick('识别车牌号')"></uni-icons>
  35. </view>
  36. </uni-forms-item>
  37. <uni-forms-item name="tyreNo" label="胎号">
  38. <view style="display: flex;align-items: center;">
  39. <uni-easyinput v-model="form.tyreNo" class="right-align" placeholder-class="placeholder-right"
  40. :placeholder="form.auditStatus>0||form.claimSourceType>1?' ':'请输入胎号'" :inputBorder="false"
  41. :disabled="form.auditStatus>0||form.claimSourceType>1" :clearable="false"
  42. @change="getMaterialDetail"></uni-easyinput>
  43. <uni-icons v-if="!(form.auditStatus>0||form.claimSourceType>1)" type="scan" size="24"
  44. color='#03803B' @click="allClick('识别胎号')"></uni-icons>
  45. </view>
  46. </uni-forms-item>
  47. <uni-forms-item name="tyreSpecs" label="规格型号">
  48. <uni-easyinput v-model="form.tyreSpecs" class="right-align" placeholder-class="placeholder-right"
  49. placeholder="" :inputBorder="false" :disabled="true" :clearable="false"></uni-easyinput>
  50. </uni-forms-item>
  51. <uni-forms-item name="brandItem" label="花纹">
  52. <uni-easyinput v-model="form.brandItem" class="right-align" placeholder-class="placeholder-right"
  53. placeholder="" :inputBorder="false" :disabled="true" :clearable="false"></uni-easyinput>
  54. </uni-forms-item>
  55. <uni-forms-item name="brandName" label="品牌">
  56. <uni-easyinput v-model="form.brandName" class="right-align" placeholder-class="placeholder-right"
  57. placeholder="" :inputBorder="false" :disabled="true" :clearable="false"></uni-easyinput>
  58. </uni-forms-item>
  59. <uni-forms-item name="tireQuantity" label="轮胎数量">
  60. <uni-easyinput v-model="form.tireQuantity" class="right-align" placeholder-class="placeholder-right"
  61. placeholder="请输入数量" :inputBorder="false" :disabled="true" type="number"
  62. @blur="intBlur('tireQuantity',form.tireQuantity)" :clearable="false"></uni-easyinput>
  63. </uni-forms-item>
  64. <uni-forms-item name="claimAmount" label="索赔金额">
  65. <uni-easyinput v-model="form.claimAmount" class="right-align" placeholder-class="placeholder-right"
  66. placeholder="" :inputBorder="false" :disabled="true" type="number"
  67. @blur="handleBlur(form.claimAmount)" :clearable="false"></uni-easyinput>
  68. </uni-forms-item>
  69. <uni-forms-item name="claimReason" label="理赔原因">
  70. <uni-easyinput v-model="form.claimReason" class="right-align" type="textarea"
  71. placeholder-class="placeholder-right"
  72. :placeholder="form.auditStatus>0||form.claimSourceType>1?' ':'请输入内容'" :inputBorder="false"
  73. :del-icon="!(form.auditStatus>0||form.claimSourceType>1)"
  74. :disabled="form.auditStatus>0||form.claimSourceType>1"></uni-easyinput>
  75. </uni-forms-item>
  76. </uni-forms>
  77. </uni-section>
  78. <uni-section title="相应图片信息" style="padding: 0 62rpx 60rpx 62rpx;margin-top: 30rpx;" titleColor="5F5F5F"
  79. titleFontSize="28rpx">
  80. <view class="photo-upload">
  81. <view>
  82. <view class="photo-upload-text">示例照片</view>
  83. <view>
  84. <image class="photo-upload-img" src="@/static/images/home/claim/em4.png" />
  85. </view>
  86. </view>
  87. <view>
  88. <view class="photo-upload-text" style="color: #03803B;">病象</view>
  89. <view class="photo-upload-upload">
  90. <uni-file-picker v-model="form.file1" return-type="object" limit="1" :imageStyles="imageStyles"
  91. file-mediatype="image" @select="fileSelect1" @delete="fileDelete"
  92. :del-icon="!(form.auditStatus>0||form.claimSourceType>1)" :sourceType="['camera']">
  93. <image class="photo-upload-img2" src="@/static/images/home/claim/upload.png" />
  94. </uni-file-picker>
  95. </view>
  96. </view>
  97. </view>
  98. <view class="photo-upload">
  99. <view>
  100. <view class="photo-upload-text">示例照片</view>
  101. <view>
  102. <image class="photo-upload-img" src="@/static/images/home/claim/em2.png" />
  103. </view>
  104. </view>
  105. <view>
  106. <view class="photo-upload-text" style="color: #03803B;">轮胎DOT</view>
  107. <view class="photo-upload-upload">
  108. <uni-file-picker v-model="form.file2" return-type="object" limit="1" :imageStyles="imageStyles"
  109. file-mediatype="image" @select="fileSelect2" @delete="fileDelete"
  110. :del-icon="!(form.auditStatus>0||form.claimSourceType>1)" :sourceType="['camera']">
  111. <image class="photo-upload-img2" src="@/static/images/home/claim/upload.png" />
  112. </uni-file-picker>
  113. </view>
  114. </view>
  115. </view>
  116. <view class="photo-upload">
  117. <view>
  118. <view class="photo-upload-text">示例照片</view>
  119. <view>
  120. <image class="photo-upload-img" src="@/static/images/home/claim/em3.png" />
  121. </view>
  122. </view>
  123. <view>
  124. <view class="photo-upload-text" style="color: #03803B;">花纹深度</view>
  125. <view class="photo-upload-upload">
  126. <uni-file-picker v-model="form.file3" return-type="object" limit="1" :imageStyles="imageStyles"
  127. file-mediatype="image" @select="fileSelect3" @delete="fileDelete"
  128. :del-icon="!(form.auditStatus>0||form.claimSourceType>1)" :sourceType="['camera']">
  129. <image class="photo-upload-img2" src="@/static/images/home/claim/upload.png" />
  130. </uni-file-picker>
  131. </view>
  132. </view>
  133. </view>
  134. </uni-section>
  135. <u-keyboard ref="uKeyboard" mode="car" :show="carShow" @change="carChange" @backspace="backspace"
  136. :showCancel="false" :showConfirm="false" @close="carShow=false" :safeAreaInsetBottom="true"
  137. :autoChange="true"></u-keyboard>
  138. <!--<view v-if="form.claimSourceType==1" style="padding:30rpx 20rpx;">
  139. <debounce-button v-if="!form.id" bgColor="#03803B" @click="submit">保存</debounce-button>
  140. <view v-if="form.auditStatus==0" style="display: flex;">
  141. <debounce-button bgColor="#03803B" style="width: 260rpx;" @click="submit">保存</debounce-button>
  142. <debounce-button type="warn" v-if="form.auditStatus==0" style="width: 260rpx;"
  143. @click="approval">提交</debounce-button>
  144. </view>
  145. <debounce-button type="warn" v-if="form.auditStatus==1" @click="revoke">撤销审核</debounce-button>
  146. </view> -->
  147. <view v-if="form.claimSourceType==1" class="nav-bottom-height">
  148. </view>
  149. <view v-if="form.claimSourceType==1" class="goods-nav-bottom">
  150. <uni-goods-nav v-if="!form.id" :fill="true" :options="[]" :buttonGroup="buttonGroup"
  151. @buttonClick="buttonClick" />
  152. <uni-goods-nav v-if="form.auditStatus==0" :fill="true" :options="[]" :buttonGroup="buttonGroup2"
  153. @buttonClick="buttonClick2" />
  154. <uni-goods-nav v-if="form.auditStatus==1" :fill="true" :options="[]" :buttonGroup="buttonGroup3"
  155. @buttonClick="buttonClick3" />
  156. </view>
  157. </view>
  158. </template>
  159. <script>
  160. import http from '@/http/api.js'
  161. import {
  162. clientId,
  163. clientSecret
  164. } from '@/common/setting'
  165. import {
  166. submit,
  167. getDetail,
  168. fileRemove,
  169. submitApproval,
  170. revokeApproval,
  171. getMaterialDetail
  172. } from '@/api/home/claim.js'
  173. export default {
  174. data() {
  175. return {
  176. buttonGroup: [{
  177. text: '保存',
  178. backgroundColor: '#03803B',
  179. color: '#fff'
  180. }],
  181. buttonGroup2: [{
  182. text: '保存',
  183. backgroundColor: '#03803B',
  184. color: '#fff'
  185. },
  186. {
  187. text: '提交',
  188. backgroundColor: '#e64340',
  189. color: '#fff'
  190. }
  191. ],
  192. buttonGroup3: [{
  193. text: '撤销审核',
  194. backgroundColor: '#e64340',
  195. color: '#fff'
  196. }],
  197. carShow: false,
  198. form: {
  199. file1: null,
  200. file2: null,
  201. file3: null,
  202. file4: null,
  203. vehicleNumber: '',
  204. tyreNo: null,
  205. tyreSpecs: null,
  206. claimSourceType: 1,
  207. tireQuantity: 1,
  208. claimAmount: null,
  209. claimType: 1,
  210. claimAttachmentList: [],
  211. },
  212. imageStyles: {
  213. width: 145,
  214. height: 145,
  215. border: false,
  216. },
  217. mapObject: {
  218. text: 'name',
  219. value: 'code',
  220. children: 'children'
  221. },
  222. addressData: [],
  223. labelList: [],
  224. corpsTypeList: [],
  225. storeAttributesList: [],
  226. chainAttributeList: [],
  227. signingLevelList: [],
  228. }
  229. },
  230. onLoad(option) {
  231. this.addressData = JSON.parse(uni.getStorageSync("addressData"))
  232. if (option && option.id) {
  233. this.getDetail(option.id)
  234. }
  235. },
  236. methods: {
  237. buttonClick(e) {
  238. if (e.index == 0) {
  239. this.submit()
  240. }
  241. },
  242. buttonClick2(e) {
  243. if (e.index == 0) {
  244. this.submit()
  245. }
  246. if (e.index == 1) {
  247. this.approval()
  248. }
  249. },
  250. buttonClick3(e) {
  251. if (e.index == 0) {
  252. this.revoke()
  253. }
  254. },
  255. // 处理输入框聚焦事件
  256. handleInputFocus() {
  257. if (this.form.auditStatus > 0 || this.form.claimSourceType > 1) return
  258. this.carShow = true;
  259. },
  260. // 按键被点击(点击退格键不会触发此事件)
  261. carChange(val) {
  262. // 将每次按键的值拼接到value变量中,注意+=写法
  263. if (this.form.vehicleNumber.length < 8) {
  264. this.form.vehicleNumber += val;
  265. }
  266. },
  267. // 退格键被点击
  268. backspace() {
  269. if (this.form.vehicleNumber.length) this.form.vehicleNumber = this.form.vehicleNumber.substr(0, this.form
  270. .vehicleNumber.length - 1);
  271. },
  272. photoChange(val) {
  273. if (val) {
  274. if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(val)) {
  275. uni.showToast({
  276. title: '请输入正确电话',
  277. icon: 'none'
  278. });
  279. return;
  280. }
  281. }
  282. },
  283. carNoVerify(plateNumber) {
  284. if (plateNumber) {
  285. const PROVINCES = [
  286. '京', '津', '冀', '晋', '蒙', '辽', '吉', '黑',
  287. '沪', '苏', '浙', '皖', '闽', '赣', '鲁', '豫',
  288. '鄂', '湘', '粤', '桂', '琼', '川', '贵', '云',
  289. '渝', '藏', '陕', '甘', '青', '宁', '新', '台',
  290. '港', '澳'
  291. ]
  292. const AGENCY_PATTERN = /^[A-HJ-NP-Z]$/
  293. const BLUE_PLATE_PATTERN = /^[0-9A-HJ-NP-Z]{5}$/
  294. // 绿牌能源类型标识
  295. const ENERGY_TYPES = {
  296. 'D': '纯电动',
  297. 'F': '非纯电动'
  298. }
  299. const GREEN_PLATE_PATTERN = /^[0-9A-HJ-NP-Z]{6}$/
  300. const plate = plateNumber.toUpperCase().trim()
  301. // 长度检查
  302. if (plate.length !== 7 && plate.length !== 8) {
  303. uni.showToast({
  304. title: '请输入有效的车牌号!',
  305. icon: 'none'
  306. });
  307. return false
  308. }
  309. // 省份简称检查
  310. if (!PROVINCES.includes(plate.charAt(0))) {
  311. uni.showToast({
  312. title: '请输入有效的车牌号!',
  313. icon: 'none'
  314. });
  315. return false
  316. }
  317. // 发牌机关代号检查
  318. if (!AGENCY_PATTERN.test(plate.charAt(1))) {
  319. return uni.showToast({
  320. title: '请输入有效的车牌号!',
  321. icon: 'none'
  322. });
  323. }
  324. // 蓝牌检查
  325. if (plate.length === 7) {
  326. const serial = plate.substring(2)
  327. if (!(BLUE_PLATE_PATTERN.test(serial) && !/[IO]/.test(serial))) {
  328. uni.showToast({
  329. title: '请输入有效的车牌号!',
  330. icon: 'none'
  331. });
  332. return false
  333. }
  334. }
  335. // 绿牌检查
  336. if (plate.length === 8) {
  337. const energyType = plate.charAt(2)
  338. const serial = plate.substring(2)
  339. if (!((energyType === 'D' || energyType === 'F'))) {
  340. uni.showToast({
  341. title: '请输入有效的车牌号!',
  342. icon: 'none'
  343. });
  344. return false
  345. }
  346. if (!(GREEN_PLATE_PATTERN.test(serial) && !/[IO]/.test(serial))) {
  347. uni.showToast({
  348. title: '请输入有效的车牌号!',
  349. icon: 'none'
  350. });
  351. return false
  352. }
  353. }
  354. }
  355. return true
  356. },
  357. allClick(name) {
  358. if (!(this.form.auditStatus > 0 || this.form.claimSourceType > 1)) {
  359. if (name == '识别车牌号') {
  360. let _this = this
  361. uni.chooseImage({
  362. count: 1, //默认9
  363. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  364. sourceType: ['camera'],
  365. success: function(file) {
  366. uni.showLoading({
  367. title: '加载中',
  368. mask: true
  369. });
  370. uni.uploadFile({
  371. url: http.config.baseURL +
  372. '/gubersail-app/appClaim/recognizeLicensePlateNumber', // 仅为示例,非真实的接口地址
  373. filePath: file.tempFilePaths[0],
  374. header: {
  375. // 客户端认证参数
  376. 'Authorization': 'Basic ' + Base64.encode(clientId + ':' +
  377. clientSecret),
  378. 'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken')
  379. },
  380. name: 'file',
  381. success: (res) => {
  382. const data = JSON.parse(res.data)
  383. console.log(data)
  384. _this.form.vehicleNumber = data.data
  385. uni.showToast({
  386. title: data.msg,
  387. icon: 'none',
  388. duration: 2000
  389. });
  390. },
  391. fail: (err) => {
  392. uni.showToast({
  393. title: err,
  394. icon: 'none',
  395. duration: 2000
  396. });
  397. },
  398. complete: () => {
  399. uni.hideLoading()
  400. }
  401. })
  402. }
  403. });
  404. }
  405. if (name == '识别胎号') {
  406. let _this = this
  407. uni.scanCode({
  408. scanType: ['barCode'],
  409. onlyFromCamera: true,
  410. success: function(res) {
  411. _this.form.tyreNo = res.result
  412. _this.getMaterialDetail(res.result)
  413. }
  414. });
  415. }
  416. }
  417. },
  418. getMaterialDetail(val) {
  419. if (val) {
  420. let obj = {
  421. tireNumber: val
  422. }
  423. getMaterialDetail(obj).then(res => {
  424. console.log(res.data)
  425. if (res.data) {
  426. this.form.tyreSpecs = res.data.sizeId
  427. this.form.brandItem = res.data.pattern
  428. this.form.brandName = res.data.brand
  429. } else {
  430. uni.showToast({
  431. title: res.msg,
  432. icon: 'none'
  433. });
  434. this.form.tyreSpecs = null
  435. this.form.brandItem = null
  436. this.form.brandName = null
  437. }
  438. })
  439. } else {
  440. this.form.tyreSpecs = null
  441. this.form.brandItem = null
  442. this.form.brandName = null
  443. }
  444. },
  445. removeByIdFilter(arr, id) {
  446. return arr.filter(item => item.id !== id);
  447. },
  448. // handleInput(value) {
  449. // const decimalRegex = /^-?\d+\.\d+$/ // 小数正则
  450. // if (decimalRegex.test(value)) {
  451. // uni.showToast({
  452. // title: '请输入整数',
  453. // icon: 'none'
  454. // });
  455. // }
  456. // },
  457. intBlur(name, value) {
  458. if (!this.form[name]) return
  459. // 使用toFixed处理小数位
  460. try {
  461. const num = parseFloat(this.form[name])
  462. if (!isNaN(num)) {
  463. this.form[name] = Math.floor(num)
  464. }
  465. } catch (e) {
  466. console.error('格式化错误', e)
  467. }
  468. },
  469. handleBlur(value) {
  470. if (!this.form.claimAmount) return
  471. // 使用toFixed处理小数位
  472. try {
  473. const num = parseFloat(this.form.claimAmount)
  474. if (!isNaN(num)) {
  475. this.form.claimAmount = num.toFixed(4)
  476. }
  477. } catch (e) {
  478. console.error('格式化错误', e)
  479. }
  480. },
  481. fileDelete(row) {
  482. if (row.tempFile.id) {
  483. uni.showLoading({
  484. title: '加载中',
  485. mask: true
  486. });
  487. fileRemove(row.tempFile.id).then(res => {
  488. uni.showToast({
  489. title: '删除成功',
  490. icon: 'none'
  491. });
  492. this.form.claimAttachmentList = this.removeByIdFilter(this.form.claimAttachmentList, row
  493. .tempFile.id);
  494. }).finally(() => {
  495. uni.hideLoading()
  496. });
  497. }
  498. },
  499. getFileExtension(filename) {
  500. return filename.slice(((filename.lastIndexOf(".") - 1) >>> 0) + 2);
  501. },
  502. fileSelect1(files) {
  503. files.tempFiles.forEach(file => {
  504. uni.showLoading({
  505. title: '加载中',
  506. mask: true
  507. });
  508. uni.uploadFile({
  509. url: http.config.baseURL +
  510. '/blade-resource/oss/endpoint/put-file', // 仅为示例,非真实的接口地址
  511. filePath: file.path,
  512. header: {
  513. // 客户端认证参数
  514. 'Authorization': 'Basic ' + Base64.encode(clientId + ':' + clientSecret),
  515. 'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken')
  516. },
  517. name: 'file',
  518. success: (res) => {
  519. const data = JSON.parse(res.data).data
  520. this.form.file1 = {
  521. ...this.form.file1,
  522. url: data.link,
  523. name: data.originalName,
  524. extname: this.getFileExtension(data.originalName),
  525. size: file.size,
  526. }
  527. uni.showToast({
  528. title: '上传成功',
  529. icon: 'none'
  530. });
  531. },
  532. fail: (err) => {
  533. uni.showToast({
  534. title: '上传失败',
  535. icon: 'none'
  536. });
  537. },
  538. complete: () => {
  539. uni.hideLoading()
  540. }
  541. })
  542. })
  543. },
  544. fileSelect2(files) {
  545. files.tempFiles.forEach(file => {
  546. uni.showLoading({
  547. title: '加载中',
  548. mask: true
  549. });
  550. uni.uploadFile({
  551. url: http.config.baseURL +
  552. '/blade-resource/oss/endpoint/put-file', // 仅为示例,非真实的接口地址
  553. filePath: file.path,
  554. header: {
  555. // 客户端认证参数
  556. 'Authorization': 'Basic ' + Base64.encode(clientId + ':' + clientSecret),
  557. 'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken')
  558. },
  559. name: 'file',
  560. success: (res) => {
  561. const data = JSON.parse(res.data).data
  562. this.form.file2 = {
  563. ...this.form.file2,
  564. url: data.link,
  565. name: data.originalName,
  566. extname: this.getFileExtension(data.originalName),
  567. size: file.size,
  568. }
  569. uni.showToast({
  570. title: '上传成功',
  571. icon: 'none'
  572. });
  573. },
  574. fail: (err) => {
  575. uni.showToast({
  576. title: '上传失败',
  577. icon: 'none'
  578. });
  579. },
  580. complete: () => {
  581. uni.hideLoading()
  582. }
  583. })
  584. })
  585. },
  586. fileSelect3(files) {
  587. files.tempFiles.forEach(file => {
  588. uni.showLoading({
  589. title: '加载中',
  590. mask: true
  591. });
  592. uni.uploadFile({
  593. url: http.config.baseURL +
  594. '/blade-resource/oss/endpoint/put-file', // 仅为示例,非真实的接口地址
  595. filePath: file.path,
  596. header: {
  597. // 客户端认证参数
  598. 'Authorization': 'Basic ' + Base64.encode(clientId + ':' + clientSecret),
  599. 'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken')
  600. },
  601. name: 'file',
  602. success: (res) => {
  603. const data = JSON.parse(res.data).data
  604. this.form.file3 = {
  605. ...this.form.file3,
  606. url: data.link,
  607. name: data.originalName,
  608. extname: this.getFileExtension(data.originalName),
  609. size: file.size,
  610. }
  611. uni.showToast({
  612. title: '上传成功',
  613. icon: 'none'
  614. });
  615. },
  616. fail: (err) => {
  617. uni.showToast({
  618. title: '上传失败',
  619. icon: 'none'
  620. });
  621. },
  622. complete: () => {
  623. uni.hideLoading()
  624. }
  625. })
  626. })
  627. },
  628. fileSelect4(files) {
  629. files.tempFiles.forEach(file => {
  630. uni.showLoading({
  631. title: '加载中',
  632. mask: true
  633. });
  634. uni.uploadFile({
  635. url: http.config.baseURL +
  636. '/blade-resource/oss/endpoint/put-file', // 仅为示例,非真实的接口地址
  637. filePath: file.path,
  638. header: {
  639. // 客户端认证参数
  640. 'Authorization': 'Basic ' + Base64.encode(clientId + ':' + clientSecret),
  641. 'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken')
  642. },
  643. name: 'file',
  644. success: (res) => {
  645. const data = JSON.parse(res.data).data
  646. this.form.file4 = {
  647. ...this.form.file4,
  648. url: data.link,
  649. name: data.originalName,
  650. extname: this.getFileExtension(data.originalName),
  651. size: file.size,
  652. }
  653. uni.showToast({
  654. title: '上传成功',
  655. icon: 'none'
  656. });
  657. },
  658. fail: (err) => {
  659. uni.showToast({
  660. title: '上传失败',
  661. icon: 'none'
  662. });
  663. },
  664. complete: () => {
  665. uni.hideLoading()
  666. }
  667. })
  668. })
  669. },
  670. async submit() {
  671. if (!this.form.consumerPhone) {
  672. uni.showToast({
  673. title: '请输入电话',
  674. icon: 'none'
  675. });
  676. return
  677. }
  678. if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(this.form.consumerPhone)) {
  679. uni.showToast({
  680. title: '请输入正确电话',
  681. icon: 'none'
  682. });
  683. return;
  684. }
  685. if (!this.carNoVerify(this.form.vehicleNumber)) {
  686. return
  687. }
  688. if (!this.form.file1) {
  689. uni.showToast({
  690. title: '请上传病象',
  691. icon: 'none'
  692. });
  693. return
  694. }
  695. if (!this.form.file2) {
  696. uni.showToast({
  697. title: '请上传轮胎DOT',
  698. icon: 'none'
  699. });
  700. return
  701. }
  702. if (!this.form.file3) {
  703. uni.showToast({
  704. title: '请上传花纹深度',
  705. icon: 'none'
  706. });
  707. return
  708. }
  709. // if (!this.form.file4) {
  710. // uni.showToast({
  711. // title: '请上传鼓包处照片',
  712. // icon: 'none'
  713. // });
  714. // return
  715. // }
  716. let obj = await this.convertData(this.$deepClone(this.form))
  717. uni.showLoading({
  718. title: '加载中',
  719. mask: true
  720. });
  721. submit(obj).then(res => {
  722. setTimeout(() => {
  723. uni.showToast({
  724. title: '保存成功',
  725. icon: 'none',
  726. });
  727. }, 10);
  728. uni.setStorageSync('isUpdate', true)
  729. this.getDetail(res.data.id)
  730. })
  731. .catch(() => {
  732. uni.hideLoading()
  733. });
  734. },
  735. async approval() {
  736. if (!this.form.consumerPhone) {
  737. uni.showToast({
  738. title: '请输入电话',
  739. icon: 'none'
  740. });
  741. return
  742. }
  743. if (!this.carNoVerify(this.form.vehicleNumber)) {
  744. return
  745. }
  746. if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(this.form.consumerPhone)) {
  747. uni.showToast({
  748. title: '请输入正确电话',
  749. icon: 'none'
  750. });
  751. return;
  752. }
  753. if (!this.form.file1) {
  754. uni.showToast({
  755. title: '请上传病象',
  756. icon: 'none'
  757. });
  758. return
  759. }
  760. if (!this.form.file2) {
  761. uni.showToast({
  762. title: '请上传轮胎DOT',
  763. icon: 'none'
  764. });
  765. return
  766. }
  767. if (!this.form.file3) {
  768. uni.showToast({
  769. title: '请上传花纹深度',
  770. icon: 'none'
  771. });
  772. return
  773. }
  774. // if (!this.form.file4) {
  775. // uni.showToast({
  776. // title: '请上传鼓包处照片',
  777. // icon: 'none'
  778. // });
  779. // return
  780. // }
  781. let form = await this.convertData(this.$deepClone(this.form))
  782. let obj = {
  783. id: this.form.id
  784. }
  785. let _this = this
  786. uni.showModal({
  787. title: '提示',
  788. content: '是否提交审核?',
  789. success: function(res) {
  790. if (res.confirm) {
  791. uni.showLoading({
  792. title: '加载中',
  793. mask: true
  794. });
  795. submit(form).then(res => {
  796. submitApproval(obj).then(res => {
  797. setTimeout(() => {
  798. uni.showToast({
  799. title: '操作成功',
  800. icon: 'none',
  801. duration: 2000
  802. });
  803. }, 10);
  804. _this.getDetail(_this.form.id)
  805. })
  806. .catch(() => {
  807. uni.hideLoading()
  808. });
  809. })
  810. .catch(() => {
  811. uni.hideLoading()
  812. });
  813. }
  814. }
  815. });
  816. },
  817. revoke() {
  818. let obj = {
  819. id: this.form.id
  820. }
  821. let _this = this
  822. uni.showModal({
  823. title: '提示',
  824. content: '是否撤销审核?',
  825. success: function(res) {
  826. if (res.confirm) {
  827. uni.showLoading({
  828. title: '加载中',
  829. mask: true
  830. });
  831. revokeApproval(obj).then(res => {
  832. setTimeout(() => {
  833. uni.showToast({
  834. title: '操作成功',
  835. icon: 'none',
  836. duration: 2000
  837. });
  838. }, 10);
  839. _this.getDetail(_this.form.id)
  840. })
  841. .catch(() => {
  842. uni.hideLoading()
  843. });
  844. }
  845. }
  846. });
  847. },
  848. getDetail(id) {
  849. let obj = {
  850. id: id
  851. }
  852. uni.showLoading({
  853. title: '加载中',
  854. mask: true
  855. });
  856. getDetail(obj).then(res => {
  857. res.data.claimAttachmentList.forEach(item => {
  858. if (item.fileProperties == 1) {
  859. res.data.file1 = {
  860. ...item,
  861. url: item.fileUrl,
  862. name: item.fileName,
  863. extname: item.fileType,
  864. size: item.fileSize,
  865. }
  866. }
  867. if (item.fileProperties == 2) {
  868. res.data.file2 = {
  869. ...item,
  870. url: item.fileUrl,
  871. name: item.fileName,
  872. extname: item.fileType,
  873. size: item.fileSize,
  874. }
  875. }
  876. if (item.fileProperties == 3) {
  877. res.data.file3 = {
  878. ...item,
  879. url: item.fileUrl,
  880. name: item.fileName,
  881. extname: item.fileType,
  882. size: item.fileSize,
  883. }
  884. }
  885. // if (item.fileProperties == 4) {
  886. // res.data.file4 = {
  887. // ...item,
  888. // url: item.fileUrl,
  889. // name: item.fileName,
  890. // extname: item.fileType,
  891. // size: item.fileSize,
  892. // }
  893. // }
  894. })
  895. this.form = res.data
  896. })
  897. .finally(() => {
  898. uni.hideLoading()
  899. });
  900. },
  901. async convertData(obj) {
  902. let fileList = []
  903. if (obj.file1 && Object.keys(obj.file1).length) {
  904. fileList.push({
  905. ...obj.file1,
  906. fileProperties: 1,
  907. })
  908. }
  909. if (obj.file2 && Object.keys(obj.file2).length) {
  910. fileList.push({
  911. ...obj.file2,
  912. fileProperties: 2,
  913. })
  914. }
  915. if (obj.file3 && Object.keys(obj.file3).length) {
  916. fileList.push({
  917. ...obj.file3,
  918. fileProperties: 3,
  919. })
  920. }
  921. // if (obj.file4 && Object.keys(obj.file4).length) {
  922. // fileList.push({
  923. // ...obj.file4,
  924. // fileProperties: 4
  925. // })
  926. // }
  927. //附件明细为空时直接赋值
  928. if (obj.claimAttachmentList.length == 0) {
  929. fileList.forEach(item => {
  930. obj.claimAttachmentList.push({
  931. fileProperties: item.fileProperties,
  932. fileUrl: item.url,
  933. fileName: item.name,
  934. fileType: item.extname,
  935. fileSize: item.size,
  936. })
  937. })
  938. } else {
  939. //附件明细有明细区分赋值
  940. fileList.forEach(item => {
  941. if (obj.claimAttachmentList.filter(row => row.fileProperties == item.fileProperties)
  942. .length == 0) {
  943. //原附件明细不存在,直接push新元素
  944. obj.claimAttachmentList.push({
  945. fileProperties: item.fileProperties,
  946. fileUrl: item.url,
  947. fileName: item.name,
  948. fileType: item.extname,
  949. fileSize: item.size,
  950. })
  951. } else {
  952. //原附件存在明细时,对应赋值
  953. obj.claimAttachmentList.forEach(row => {
  954. if (item.fileProperties == row.fileProperties) {
  955. row.fileUrl = item.url
  956. row.fileName = item.name
  957. row.fileType = item.extname
  958. row.fileSize = item.size
  959. }
  960. })
  961. }
  962. })
  963. }
  964. console.log(obj)
  965. return obj
  966. }
  967. }
  968. }
  969. </script>
  970. <style lang="scss" scoped>
  971. .right-align {
  972. text-align: right;
  973. }
  974. .photo {
  975. margin-left: 20rpx;
  976. width: 38rpx;
  977. height: 32rpx;
  978. }
  979. .photo-upload {
  980. display: flex;
  981. justify-content: space-around;
  982. margin-top: 45rpx;
  983. .photo-upload-text {
  984. font-weight: 400;
  985. font-size: 28rpx;
  986. color: #5F5F5F;
  987. line-height: 32rpx;
  988. text-align: center;
  989. margin-bottom: 15rpx;
  990. }
  991. .photo-upload-img {
  992. width: 280rpx;
  993. height: 280rpx;
  994. background: #D13B34;
  995. border-radius: 7rpx;
  996. }
  997. .photo-upload-upload {
  998. width: 280rpx;
  999. height: 280rpx;
  1000. background: #F6F6F6;
  1001. border-radius: 7rpx;
  1002. display: flex;
  1003. justify-content: center;
  1004. align-items: center;
  1005. .photo-upload-img2 {
  1006. width: 219rpx;
  1007. height: 219rpx;
  1008. }
  1009. }
  1010. }
  1011. ::v-deep .uni-file-picker__container {
  1012. margin: 0 !important;
  1013. }
  1014. ::v-deep .file-picker__box-content {
  1015. margin: 0 !important;
  1016. }
  1017. ::v-deep .file-picker__progress {
  1018. display: none;
  1019. }
  1020. ::v-deep .uni-section .uni-section-header {
  1021. font-weight: bold !important;
  1022. padding: 12px 0px !important;
  1023. border-bottom: 2px solid #F6F6F6;
  1024. }
  1025. ::v-deep .file-picker__box {
  1026. width: 280rpx !important;
  1027. height: 280rpx !important;
  1028. }
  1029. .slot-content-item {
  1030. border-radius: 13rpx;
  1031. border: 2rpx solid #03803B;
  1032. padding: 1rpx 5rpx;
  1033. color: #03803B;
  1034. }
  1035. .slot-content-item-placeholder {
  1036. font-weight: 400 !important;
  1037. font-size: 28rpx !important;
  1038. height: 38rpx !important;
  1039. color: #B5B4B4 !important;
  1040. }
  1041. .slot-box {
  1042. gap: 5px;
  1043. display: flex;
  1044. flex-wrap: wrap;
  1045. justify-content: flex-end;
  1046. }
  1047. </style>