details.vue 28 KB

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