details.vue 30 KB

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