details.vue 31 KB

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