details.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128
  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="胎号" required>
  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. let tyreNoList = []
  773. console.info(this.form.tireInsuranceFilesList)
  774. for (let item of this.form.tireInsuranceFilesList) {
  775. if (!item.tyreNo) {
  776. return uni.showToast({
  777. title: `请输入轮胎${item.affiliatedWithGroup }的胎号`,
  778. icon: 'none'
  779. });
  780. }
  781. if (!item.tyreSpecs) {
  782. return uni.showToast({
  783. title: `轮胎${item.affiliatedWithGroup }的胎号没有规格信息,请检查胎号是否正确`,
  784. icon: 'none'
  785. });
  786. }
  787. let existData = tyreNoList.find(i => i.tyreNo === item.tyreNo)
  788. if (existData && Number(existData.index) !== Number(item.affiliatedWithGroup)) {
  789. return uni.showToast({
  790. title: `轮胎${item.affiliatedWithGroup }的胎号重复,请检查轮胎${item.affiliatedWithGroup }的胎号是否正确`,
  791. icon: 'none'
  792. });
  793. } else {
  794. tyreNoList.push({
  795. tyreNo: item.tyreNo,
  796. index: item.affiliatedWithGroup
  797. });
  798. }
  799. if (item.fileUrl == null) {
  800. return uni.showToast({
  801. title: `请上传轮胎${item.affiliatedWithGroup }的${+ item.fileProperties == 1 ?
  802. '车辆角度45%' : item.fileProperties == 2 ? '轮胎DOT' : '安装照片'}`,
  803. icon: 'none'
  804. });
  805. }
  806. }
  807. let obj = {
  808. ...this.form,
  809. jumpUrl: "/pages/home/insurance/details"
  810. }
  811. uni.showLoading({
  812. title: '加载中',
  813. mask: true
  814. });
  815. submit(obj).then(res => {
  816. setTimeout(() => {
  817. uni.showToast({
  818. title: res.msg,
  819. icon: 'none',
  820. });
  821. }, 10);
  822. uni.setStorageSync('isUpdate', true)
  823. this.getDetail(res.code === 601 ? this.form.id : res.data.id)
  824. })
  825. .catch(() => {
  826. uni.hideLoading()
  827. });
  828. },
  829. async approval() {
  830. if (!this.form.consumerName) {
  831. uni.showToast({
  832. title: '请输入联系人',
  833. icon: 'none'
  834. });
  835. return
  836. }
  837. if (!this.form.consumerPhone) {
  838. uni.showToast({
  839. title: '请输入电话',
  840. icon: 'none'
  841. });
  842. return
  843. }
  844. if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(this.form.consumerPhone)) {
  845. uni.showToast({
  846. title: '请输入正确电话',
  847. icon: 'none'
  848. });
  849. return;
  850. }
  851. if (!this.form.vehicleNumber) {
  852. uni.showToast({
  853. title: '请输入车牌号',
  854. icon: 'none'
  855. });
  856. return
  857. }
  858. if (!this.carNoVerify(this.form.vehicleNumber)) {
  859. return
  860. }
  861. for (let item of this.form.tireInsuranceFilesList) {
  862. if (item.fileUrl == null) {
  863. return uni.showToast({
  864. title: `请上传轮胎${item.affiliatedWithGroup }的${+ item.fileProperties == 1 ?
  865. '车辆角度45%' : item.fileProperties == 2 ? '轮胎DOT' : '安装照片'}`,
  866. icon: 'none'
  867. });
  868. }
  869. }
  870. let _this = this
  871. uni.showModal({
  872. title: '提示',
  873. content: '是否提交?',
  874. success: function(res) {
  875. if (res.confirm) {
  876. uni.showLoading({
  877. title: '加载中',
  878. mask: true
  879. });
  880. submitApproval(_this.form).then(res => {
  881. setTimeout(() => {
  882. uni.showToast({
  883. title: '操作成功',
  884. icon: 'none',
  885. duration: 2000
  886. });
  887. }, 10);
  888. _this.getDetail(res.data.id)
  889. })
  890. .catch(() => {
  891. uni.hideLoading()
  892. });
  893. }
  894. }
  895. });
  896. },
  897. async claim() {
  898. let ids = []
  899. let tyreNo = null
  900. let tyreSpecs = null
  901. let brandItem = null
  902. let brandName = null
  903. for (let item of this.form.tireInsuranceFilesList.slice(this.activeTab * 3, this.activeTab * 3 + 3)) {
  904. ids.push(item.id)
  905. tyreNo = item.tyreNo
  906. tyreSpecs = item.tyreSpecs
  907. brandItem = item.brandItem
  908. brandName = item.brandName
  909. }
  910. let obj = {
  911. ...this.form,
  912. fileId: ids.join(","),
  913. tyreNo: tyreNo,
  914. tyreSpecs: tyreSpecs,
  915. brandItem: brandItem,
  916. brandName: brandName,
  917. tireDescription: '轮胎' + Number(Number(this.activeTab) + 1)
  918. }
  919. uni.showModal({
  920. title: '提示',
  921. content: '是否生成保单?',
  922. success: function(res) {
  923. if (res.confirm) {
  924. uni.showLoading({
  925. title: '加载中',
  926. mask: true
  927. });
  928. generateShopAppClaim(obj).then(res => {
  929. setTimeout(() => {
  930. uni.showToast({
  931. title: '操作成功',
  932. icon: 'none',
  933. duration: 2000
  934. });
  935. }, 10);
  936. uni.navigateTo({
  937. url: '/pages/home/claim/details?id=' + res
  938. .data
  939. .claimId,
  940. });
  941. uni.setStorageSync('isClainUpdate', true)
  942. })
  943. .finally(() => {
  944. uni.hideLoading()
  945. });
  946. }
  947. }
  948. });
  949. },
  950. revoke() {
  951. let obj = {
  952. id: this.form.id
  953. }
  954. let _this = this
  955. uni.showModal({
  956. title: '提示',
  957. content: '是否撤销?',
  958. success: function(res) {
  959. if (res.confirm) {
  960. uni.showLoading({
  961. title: '加载中',
  962. mask: true
  963. });
  964. revokeApproval(obj).then(res => {
  965. setTimeout(() => {
  966. uni.showToast({
  967. title: '操作成功',
  968. icon: 'none',
  969. duration: 2000
  970. });
  971. }, 10);
  972. _this.getDetail(res.data.id)
  973. })
  974. .catch(() => {
  975. uni.hideLoading()
  976. });
  977. }
  978. }
  979. });
  980. },
  981. getDetail(id) {
  982. let obj = {
  983. id: id
  984. }
  985. uni.showLoading({
  986. title: '加载中',
  987. mask: true
  988. });
  989. getDetail(obj).then(res => {
  990. for (let item of res.data.tireInsuranceFilesList) {
  991. item.fileObj = {
  992. name: item.fileName,
  993. url: item.fileUrl,
  994. extname: item.fileType,
  995. size: item.fileSize,
  996. }
  997. }
  998. this.form = res.data
  999. })
  1000. .finally(() => {
  1001. uni.hideLoading()
  1002. });
  1003. },
  1004. goBack() {
  1005. uni.navigateBack({
  1006. delta: 1,
  1007. });
  1008. }
  1009. }
  1010. }
  1011. </script>
  1012. <style lang="scss" scoped>
  1013. .right-align {
  1014. text-align: right;
  1015. }
  1016. .photo {
  1017. margin-left: 20rpx;
  1018. width: 38rpx;
  1019. height: 32rpx;
  1020. }
  1021. .photo-upload {
  1022. display: flex;
  1023. justify-content: space-around;
  1024. margin-top: 45rpx;
  1025. .photo-upload-text {
  1026. font-weight: 400;
  1027. font-size: 28rpx;
  1028. color: #5F5F5F;
  1029. line-height: 32rpx;
  1030. text-align: center;
  1031. margin-bottom: 15rpx;
  1032. }
  1033. .photo-upload-img {
  1034. width: 280rpx;
  1035. height: 280rpx;
  1036. background: #D13B34;
  1037. border-radius: 7rpx;
  1038. }
  1039. .photo-upload-upload {
  1040. width: 280rpx;
  1041. height: 280rpx;
  1042. background: #F6F6F6;
  1043. border-radius: 7rpx;
  1044. display: flex;
  1045. justify-content: center;
  1046. align-items: center;
  1047. .photo-upload-img2 {
  1048. width: 219rpx;
  1049. height: 219rpx;
  1050. }
  1051. }
  1052. }
  1053. ::v-deep .file-picker__box {
  1054. width: 280rpx !important;
  1055. height: 280rpx !important;
  1056. }
  1057. ::v-deep .uni-file-picker__container {
  1058. margin: 0 !important;
  1059. }
  1060. ::v-deep .file-picker__box-content {
  1061. margin: 0 !important;
  1062. }
  1063. ::v-deep .file-picker__progress {
  1064. display: none;
  1065. }
  1066. ::v-deep .uni-section .uni-section-header {
  1067. font-weight: bold !important;
  1068. padding: 12px 0px !important;
  1069. border-bottom: 2px solid #F6F6F6;
  1070. }
  1071. .slot-content-item {
  1072. border-radius: 13rpx;
  1073. border: 2rpx solid #03803B;
  1074. padding: 1rpx 5rpx;
  1075. color: #03803B;
  1076. }
  1077. .slot-content-item-placeholder {
  1078. font-weight: 400 !important;
  1079. font-size: 28rpx !important;
  1080. height: 38rpx !important;
  1081. color: #B5B4B4 !important;
  1082. }
  1083. .slot-box {
  1084. gap: 5px;
  1085. display: flex;
  1086. flex-wrap: wrap;
  1087. justify-content: flex-end;
  1088. }
  1089. /* 更强制性的样式控制 */
  1090. ::v-deep .uni-numbox__value {
  1091. /* 完全禁用所有交互 */
  1092. pointer-events: none !important;
  1093. touch-action: none !important;
  1094. }
  1095. </style>