Mixin.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. export default {
  2. data() {
  3. return {
  4. immediateCoverage: "0", //即时起保标识
  5. transferScene: "0", //过户车标识
  6. biTransferScene: "0", //商业过户标识
  7. secondHandCarScene: "0", //二手车标识
  8. immediateCoverageList: [{ //即时起保选项
  9. label: '是',
  10. value: "1",
  11. },
  12. {
  13. label: '否',
  14. value: "0",
  15. },
  16. ],
  17. transferList: [{ //过户车选项
  18. label: '是',
  19. value: "1",
  20. },
  21. {
  22. label: '否',
  23. value: "0",
  24. },
  25. ],
  26. biTransferList: [{ //商业过户选项
  27. label: '是',
  28. value: "1",
  29. },
  30. {
  31. label: '否',
  32. value: "0",
  33. },
  34. ],
  35. secondHandCarList: [{ //商业过户选项
  36. label: '是',
  37. value: "1",
  38. },
  39. {
  40. label: '否',
  41. value: "0",
  42. },
  43. ],
  44. vehicleAndVesselTaxModel: {
  45. taxRelifFlag: "正常交税",
  46. taxpayerIdentifier: "身份证",
  47. relifReason: "",
  48. taxPaidAreaCode: "",
  49. },
  50. // 车船税信息
  51. vehicleAndVesselTaxVo: {
  52. taxRelifFlag: "1", //类型
  53. identifyNumber: "", //纳税人识别号
  54. taxpayerIdentifier: "01", //纳税人证件类型
  55. taxpayerName: "", //纳税人名称
  56. extendChar2: "", //减免税凭证号
  57. paidFreeCertificate: "", //完税凭证号
  58. relifReason: "", //减免税原因
  59. taxComCode: "", //税务机关代码
  60. taxComName: "", ///税务机关名称
  61. taxDocumentDate: "", //完税日期
  62. taxPaidAreaCode: "", //完税凭证地区代码
  63. taxRelief: "", //减税比例
  64. },
  65. carImageListId: [], //车辆影像
  66. ownerImageListId: [], //车主影像
  67. policyHolderImageListId: [], //投保人影像
  68. insuredPersonImageListId: [], //被保人影像
  69. productId: "", //报价险种code
  70. productName: "", //报价险种name
  71. quotableCompanyList: [], //可报价保险公司列表集合
  72. order: {},
  73. costs: {},
  74. accidentalDrivings: {},
  75. ciRiskInfoVo: { //交强险种大类
  76. amount: 0,
  77. endDate: '',
  78. instantFlag: false,
  79. premium: 0,
  80. riskCode: "0507",
  81. startDate: '',
  82. },
  83. biRiskInfoVo: { //商业险种大类
  84. amount: 0,
  85. endDate: '',
  86. instantFlag: false,
  87. premium: 0,
  88. riskCode: "0510",
  89. startDate: '',
  90. },
  91. quoteno: "", //报价号
  92. // 比价表格字段
  93. optimalColumn: [{
  94. name: 'companyName',
  95. label: '保险公司',
  96. fixed: true,
  97. width: 100,
  98. align: "center",
  99. },
  100. {
  101. name: 'A',
  102. label: '车损险',
  103. formatter: true,
  104. align: "center",
  105. sorter: true,
  106. },
  107. {
  108. name: 'B',
  109. label: '三者责任险',
  110. formatter: true,
  111. align: "center",
  112. sorter: true,
  113. },
  114. {
  115. name: 'D3',
  116. label: '司机责任险',
  117. align: "center",
  118. sorter: true,
  119. },
  120. {
  121. name: 'D4',
  122. label: '乘客责任险',
  123. align: "center",
  124. sorter: true,
  125. },
  126. {
  127. name: 'SY_FJ_YBW1',
  128. label: '附加医保外-三者',
  129. align: "center",
  130. width: 140,
  131. sorter: true,
  132. },
  133. {
  134. name: 'SY_FJ_YBW3',
  135. label: '附加医保外-司机',
  136. align: "center",
  137. width: 140,
  138. sorter: true,
  139. },
  140. {
  141. name: 'SY_FJ_YBW2',
  142. label: '附加医保外-乘客',
  143. align: "center",
  144. width: 140,
  145. sorter: true,
  146. },
  147. {
  148. name: 'TY1',
  149. label: '道路救援服务特约条款',
  150. align: "center",
  151. width: 180,
  152. sorter: true,
  153. },
  154. {
  155. name: 'TY1',
  156. label: '车辆安全检测特约条款',
  157. align: "center",
  158. width: 180,
  159. sorter: true,
  160. },
  161. {
  162. name: 'TY3',
  163. label: '代为驾驶服务特约条款',
  164. align: "center",
  165. width: 180,
  166. sorter: true,
  167. },
  168. {
  169. name: 'TY4',
  170. label: '代为送检服务特约条款',
  171. align: "center",
  172. width: 180,
  173. sorter: true,
  174. },
  175. {
  176. name: 'L',
  177. label: '附加车身划痕损失险',
  178. align: "center",
  179. width: 180,
  180. sorter: true,
  181. },
  182. {
  183. name: 'BD',
  184. label: '附加法定节假日限额翻倍险',
  185. align: "center",
  186. width: 220,
  187. sorter: true,
  188. },
  189. {
  190. name: 'MJ1',
  191. label: '附加绝对免赔率特约条款(车损)',
  192. align: "center",
  193. width: 260,
  194. sorter: true,
  195. },
  196. {
  197. name: 'MJ2',
  198. label: '附加绝对免赔率特约条款(机动车第三者责任保险)',
  199. align: "center",
  200. width: 350,
  201. sorter: true,
  202. },
  203. {
  204. name: 'MJ3',
  205. label: '附加绝对免赔率特约条款(机动车车上人员责任保险(司机))',
  206. align: "center",
  207. width: 420,
  208. sorter: true,
  209. },
  210. {
  211. name: 'MJ4',
  212. label: '附加绝对免赔率特约条款(机动车车上人员责任保险(乘客))',
  213. align: "center",
  214. width: 420,
  215. sorter: true,
  216. },
  217. ],
  218. optimalData: [], //比价列表
  219. // 保险公司icon
  220. companylogoList: [{
  221. name: "中煤财险",
  222. icon: "/static/image/insuranceCompany/zhongmei.png"
  223. }, //华农
  224. {
  225. name: "恒邦财险",
  226. icon: "/static/image/insuranceCompany/hengbang.png"
  227. },
  228. {
  229. name: "安盛天平",
  230. icon: "/static/image/insuranceCompany/ansheng.png"
  231. },
  232. {
  233. name: "中国人寿",
  234. icon: "/static/image/insuranceCompany/renshou.png"
  235. },
  236. {
  237. name: "众安财险",
  238. icon: "/static/image/insuranceCompany/zhongan.png"
  239. },
  240. {
  241. name: "永诚财险",
  242. icon: "/static/image/insuranceCompany/yongcheng.png"
  243. },
  244. {
  245. name: "永安财险",
  246. icon: "/static/image/insuranceCompany/yongan.png"
  247. },
  248. {
  249. name: "紫金财险",
  250. icon: "/static/image/insuranceCompany/zijin.png"
  251. },
  252. {
  253. name: "国任财险",
  254. icon: "/static/image/insuranceCompany/guoren.png"
  255. },
  256. {
  257. name: "华泰财险",
  258. icon: "/static/image/insuranceCompany/huatai.png"
  259. },
  260. {
  261. name: "大家财险",
  262. icon: "/static/image/insuranceCompany/dajia.png"
  263. },
  264. {
  265. name: "太平财险",
  266. icon: "/static/image/insuranceCompany/taiping.png"
  267. },
  268. {
  269. name: "华农财险",
  270. icon: "/static/image/insuranceCompany/huanong.png"
  271. },
  272. {
  273. name: "渤海财险",
  274. icon: "/static/image/insuranceCompany/bohai.png"
  275. },
  276. {
  277. name: "泰康财险",
  278. icon: "/static/image/insuranceCompany/taikang.png"
  279. },
  280. {
  281. name: "诚泰财险",
  282. icon: "/static/image/insuranceCompany/chengtai.png"
  283. },
  284. {
  285. name: "阳光财险",
  286. icon: "/static/image/insuranceCompany/yangguang.png"
  287. },
  288. {
  289. name: "太平洋财险",
  290. icon: "/static/image/insuranceCompany/taipingyang.png"
  291. },
  292. {
  293. name: "泰山财险",
  294. icon: "/static/image/insuranceCompany/taishan.png"
  295. },
  296. ]
  297. };
  298. },
  299. watch: {
  300. // 过户车
  301. 'carInfo.transfer': {
  302. handler(val) {
  303. if (val) {
  304. this.transferScene = '1';
  305. } else {
  306. this.transferScene = '0';
  307. }
  308. },
  309. },
  310. // 商业过户
  311. 'carInfo.biTransfer': {
  312. handler(val) {
  313. if (val) {
  314. this.biTransferScene = '1';
  315. } else {
  316. this.biTransferScene = '0';
  317. }
  318. },
  319. },
  320. //二手车
  321. 'carInfo.secondHandCar': {
  322. handler(val) {
  323. if (val) {
  324. this.secondHandCarScene = '1';
  325. } else {
  326. this.secondHandCarScene = '0';
  327. }
  328. },
  329. },
  330. },
  331. methods: {
  332. //与当前日期对比
  333. isDateBeforeToday(date) {
  334. const inputDate = new Date(date); // 将输入的日期转换为 Date 对象
  335. const today = new Date(); // 获取当前日期
  336. // 比较日期是否小于当前日期
  337. if (inputDate < today) {
  338. return true; // 输入日期小于当前日期
  339. } else {
  340. return false; // 输入日期大于等于当前日期
  341. }
  342. },
  343. //更新车辆性质
  344. transferChange(e, name) {
  345. console.log(e, name);
  346. if (e == 1) {
  347. this.carInfo[name] = true;
  348. if (name == 'transfer') { //过户车给转移登记日期赋值
  349. this.carInfo.transferDate = this.carInfo.issueDate;
  350. }
  351. } else {
  352. this.carInfo[name] = false;
  353. if (name == 'transfer') {
  354. this.carInfo.transferDate = "";
  355. }
  356. }
  357. },
  358. // 比价表格数据格式化
  359. tableformatter(row, column, rowIndex, columnIndex) {
  360. return `${row.age}\n${row.id}`
  361. },
  362. // 表格头部样式
  363. cellheaderStyle() {
  364. return {
  365. color: '#333',
  366. fontSize: '28rpx'
  367. }
  368. },
  369. //影像查询
  370. async imageEcho(list) {
  371. list.forEach((keys) => {
  372. switch (keys.imageCode) {
  373. case 'C01':
  374. this.carImageListId.push({
  375. imageBase64List: [{
  376. imageId: keys.imageBase64List[0].imageId
  377. }],
  378. imageCode: keys.imageCode,
  379. })
  380. break;
  381. case 'D01':
  382. this.carImageListId.push({
  383. imageBase64List: [{
  384. imageId: keys.imageBase64List[0].imageId
  385. }],
  386. imageCode: keys.imageCode,
  387. })
  388. break;
  389. case 'C02':
  390. this.ownerImageListId.push({
  391. imageBase64List: [{
  392. imageId: keys.imageBase64List[0].imageId
  393. }],
  394. imageCode: keys.imageCode,
  395. })
  396. break;
  397. case 'D02':
  398. this.ownerImageListId.push({
  399. imageBase64List: [{
  400. imageId: keys.imageBase64List[0].imageId
  401. }],
  402. imageCode: keys.imageCode,
  403. })
  404. break;
  405. case 'C03':
  406. this.policyHolderImageListId.push({
  407. imageBase64List: [{
  408. imageId: keys.imageBase64List[0].imageId
  409. }],
  410. imageCode: keys.imageCode,
  411. })
  412. break;
  413. case 'D03':
  414. this.policyHolderImageListId.push({
  415. imageBase64List: [{
  416. imageId: keys.imageBase64List[0].imageId
  417. }],
  418. imageCode: keys.imageCode,
  419. })
  420. break;
  421. case 'C04':
  422. this.insuredPersonImageListId.push({
  423. imageBase64List: [{
  424. imageId: keys.imageBase64List[0].imageId
  425. }],
  426. imageCode: keys.imageCode,
  427. })
  428. break;
  429. case 'D04':
  430. this.insuredPersonImageListId.push({
  431. imageBase64List: [{
  432. imageId: keys.imageBase64List[0].imageId
  433. }],
  434. imageCode: keys.imageCode,
  435. })
  436. break;
  437. default:
  438. break;
  439. }
  440. });
  441. },
  442. //保险公司数据前置处理
  443. commpanyList(item) {
  444. console.log(this.quotableCompanyList);
  445. let quoteRecord = (item && item.insCompanyVo && item.insCompanyVo[0]) || {};
  446. this.quotableCompanyList.map(ele => {
  447. ele["result"] = {};
  448. ele["quoteCode"] = 0;
  449. ele["checked"] = false;
  450. ele["msg"] = "";
  451. ele["lastYearMsg"] = "";
  452. ele["agreementName"] = "";
  453. ele["apiType"] = "";
  454. ele["coefficient"] = "";
  455. ele["discount"] = "";
  456. ele["isInspect"] = false;
  457. ele["syAdjustRate"] = "";
  458. ele["selectShow"] = false;
  459. ele['underwritingDescription'] = "";
  460. ele['isComparableShow'] = false;
  461. ele['isComparableshowHide'] = false;
  462. ele['isComparableDisabled'] = false;
  463. ele['insurancePlanInfo'] = null;
  464. if (quoteRecord.id && ele.id === quoteRecord.id) {
  465. if (quoteRecord.costs && quoteRecord.costs.sumPremium) {
  466. ele.result = item;
  467. ele.insurancePlanInfo = {};
  468. ele.insurancePlanInfo.drivings = item.accidentalDrivings;
  469. ele.insurancePlanInfo.kinds = item.kindInfoVo.filter(item => item.kindCode != 'J1');
  470. ele.quoteCode = 200;
  471. } else {
  472. ele.result = item;
  473. ele.msg = item.errorMessage;
  474. ele.insurancePlanInfo = {};
  475. ele.insurancePlanInfo.drivings = item.accidentalDrivings;
  476. ele.insurancePlanInfo.kinds = item.kindInfoVo.filter(item => item.kindCode != 'J1');
  477. ele.quoteCode = 3;
  478. }
  479. }
  480. return ele;
  481. })
  482. },
  483. //根据报价险种更新险种大类日期
  484. riskTypeEchoProcessing(code) {
  485. switch (code) {
  486. case '0330':
  487. this.ciRiskInfoVo.startDate = this.jqstartDate;
  488. this.ciRiskInfoVo.endDate = this.jqendDate;
  489. break;
  490. case '034001':
  491. case '034002':
  492. this.biRiskInfoVo.startDate = this.systartDate;
  493. this.biRiskInfoVo.endDate = this.syendDate;
  494. break;
  495. case '0330034002':
  496. case '0330034001':
  497. this.ciRiskInfoVo.startDate = this.jqstartDate;
  498. this.ciRiskInfoVo.endDate = this.jqendDate;
  499. this.biRiskInfoVo.startDate = this.systartDate;
  500. this.biRiskInfoVo.endDate = this.syendDate;
  501. break;
  502. }
  503. },
  504. //跳转微信客服
  505. async getWechatCustomer() {
  506. let res = await this.$http.get('/organization/wechat/customerService/manage/find/link')
  507. if (res.code == 200) {
  508. if (plus) { // 确保在App环境下
  509. plus.runtime.openURL(res.data);
  510. }
  511. }
  512. },
  513. //右上角返回主页
  514. home() {
  515. uni.switchTab({
  516. url: '/pages/index/index'
  517. })
  518. },
  519. back() {
  520. uni.navigateBack(-1)
  521. },
  522. // 数字单位转化
  523. convertedValue(num) {
  524. if (num < 10000) {
  525. return num.toString();
  526. } else if (num < 100000000) {
  527. return (Math.floor(num / 10000 * 10) / 10) + '万';
  528. } else {
  529. return (Math.floor(num / 100000000 * 10) / 10) + '亿';
  530. }
  531. },
  532. // 日期格式化
  533. formatter(type, value) {
  534. if (type === 'year') {
  535. return `${value}年`
  536. }
  537. if (type === 'month') {
  538. return `${value}月`
  539. }
  540. if (type === 'day') {
  541. return `${value}日`
  542. }
  543. if (type === 'hour') {
  544. return `${value}时`
  545. }
  546. if (type === 'minute') {
  547. return `${value}分`
  548. }
  549. return value
  550. },
  551. //计算输入时间一年后的的前一天(输入的参数为字符串("2019-03-02")最终输出也为日期的字符串)
  552. oneYearPast(time) {
  553. var date = new Date(time);
  554. date.setSeconds(date.getSeconds() - 1);
  555. date.setFullYear(date.getFullYear() + 1); //一年后
  556. date.setTime(date.getTime()); //一年后的前一天
  557. var strYear = date.getFullYear();
  558. var strDay = date.getDate();
  559. var strMonth = date.getMonth() + 1;
  560. var hh = date.getHours();
  561. var minutes = date.getMinutes(); // 分
  562. var Seconds = date.getSeconds();
  563. if (hh < 10) {
  564. hh = "0" + hh;
  565. }
  566. if (minutes < 10) {
  567. minutes = "0" + minutes;
  568. }
  569. if (Seconds < 10) {
  570. Seconds = "0" + Seconds;
  571. }
  572. if (strMonth < 10) {
  573. strMonth = "0" + strMonth;
  574. }
  575. if (strDay < 10) {
  576. strDay = "0" + strDay;
  577. }
  578. var datastr =
  579. strYear + "-" + strMonth + "-" + strDay + " " + hh + ":" + minutes + ":" + Seconds;
  580. return datastr;
  581. },
  582. //次日
  583. nextday() {
  584. var date = new Date();
  585. date.setFullYear(date.getFullYear());
  586. date.setTime(date.getTime() + 24 * 60 * 60 * 1000);
  587. var strYear = date.getFullYear();
  588. var strDay = date.getDate();
  589. var strMonth = date.getMonth() + 1;
  590. var hh = date.getHours();
  591. if (hh < 10) {
  592. hh = "0" + hh;
  593. }
  594. if (strMonth < 10) {
  595. strMonth = "0" + strMonth;
  596. }
  597. if (strDay < 10) {
  598. strDay = "0" + strDay;
  599. }
  600. var datastr = strYear + "-" + strMonth + "-" + strDay + " " + "00:00:00";
  601. return datastr;
  602. },
  603. //时间转换
  604. transformTime(date) {
  605. var d = new Date(date);
  606. var strYear = d.getFullYear();
  607. var strMonth = d.getMonth() + 1;
  608. var strDay = d.getDate();
  609. var hh = d.getHours();
  610. var minutes = d.getMinutes(); // 分
  611. var Seconds = d.getSeconds();
  612. if (hh < 10) {
  613. hh = "0" + hh;
  614. }
  615. if (minutes < 10) {
  616. minutes = "0" + minutes;
  617. }
  618. if (Seconds < 10) {
  619. Seconds = "0" + Seconds;
  620. }
  621. if (strMonth < 10) {
  622. strMonth = "0" + strMonth;
  623. }
  624. if (strDay < 10) {
  625. strDay = "0" + strDay;
  626. }
  627. var datetime =
  628. strYear + "-" + strMonth + "-" + strDay + " " + hh + ":" + minutes + ":" + Seconds;
  629. return datetime;
  630. },
  631. },
  632. computed: {
  633. },
  634. };