details.vue 31 KB

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