quotation.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. <template>
  2. <view style="height: 100vh;position: relative;">
  3. <public-module></public-module>
  4. <view class="page" id="panelcanvas">
  5. <image :src="bannerImg" mode="" style="width: 100%;height: 450px;position: absolute;"></image>
  6. <view class="content">
  7. <view class="price dis a-c j-c">
  8. <image :src="logoimg" mode="" style="width: 20px;height: 20px;">
  9. </image>
  10. <text style="font-weight: bold;margin-left: 6px; font-size: 16px;">{{dataInfo.inscompany}}报价单</text>
  11. </view>
  12. <view
  13. style="background-color: #fff;border-radius:0 0 6px 6px ; box-shadow: 0px 4px 10px 0px rgba(123,160,239,0.2);"
  14. class="dis a-c j-c p-2 ">
  15. <view style="font-size: 15px;font-weight: bold;" class="dis j-s a-c ">
  16. <text style="color: #232832;">订单编号:{{dataInfo.orderno}}</text>
  17. </view>
  18. </view>
  19. </view>
  20. <view style="padding:0 16px;position: relative;">
  21. <view class="information">
  22. <text class="title">车辆信息</text>
  23. <view class="dis j-s a-c">
  24. <text>车牌号:</text>
  25. <text>{{dataInfo.licenseno}}</text>
  26. </view>
  27. <view class="dis j-s a-c">
  28. <text>品牌型号:</text>
  29. <text>{{carinfo.modelcname}}</text>
  30. </view>
  31. <view class="dis j-s a-c">
  32. <text>发动机号:</text>
  33. <text>{{carinfo.engineNo}}</text>
  34. </view>
  35. <view class="dis j-s a-c">
  36. <text>座位数:</text>
  37. <text>{{carinfo.seatCount}}</text>
  38. </view>
  39. </view>
  40. <view class="information">
  41. <text class="title">人员信息</text>
  42. <view class="dis j-s a-c">
  43. <text>车主姓名:</text>
  44. <text>{{ownerinfo.name}}</text>
  45. </view>
  46. <view class="dis j-s a-c">
  47. <text>车主身份证号:</text>
  48. <text>{{ownerinfo.identifyNumber}}</text>
  49. </view>
  50. <view class="dis j-s a-c">
  51. <text>投保人姓名:</text>
  52. <text>{{applyinfo.name}}</text>
  53. </view>
  54. <view class="dis j-s a-c">
  55. <text>投保人身份证号:</text>
  56. <text>{{applyinfo.identifyNumber}}</text>
  57. </view>
  58. <view class="dis j-s a-c">
  59. <text>被保人姓名:</text>
  60. <text>{{insureinfo.name}}</text>
  61. </view>
  62. <view class="dis j-s a-c">
  63. <text>被保人身份证号:</text>
  64. <text>{{insureinfo.identifyNumber}}</text>
  65. </view>
  66. </view>
  67. <view class="information">
  68. <text class="title">保费信息</text>
  69. <view class="dis j-s f-c" v-if="dataInfo.jqpremium">
  70. <view class="dis j-s a-c">
  71. <text>交强险:</text>
  72. <text>¥{{dataInfo.jqpremium}}</text>
  73. </view>
  74. <view class="dis f-c">
  75. <text
  76. style="color: rgba(35,40,50,0.9);letter-spacing: 1px;">起保日期:{{dataInfo.jqstartdate}}</text>
  77. <text
  78. style="color: rgba(35,40,50,0.9);letter-spacing: 1px;">终保日期:{{dataInfo.jqenddate}}</text>
  79. </view>
  80. <view class="dis f-c" style="background-color: #F9F9F9;border-radius: 10px;padding: 6px;">
  81. <view class="dis j-s a-c" style="border-bottom: 1px solid #f2f2f2;">
  82. <text style="color: rgba(35,40,50,0.8)">险别/名称</text>
  83. <text style="color: rgba(35,40,50,0.8)">保额</text>
  84. </view>
  85. <view class="dis j-s a-c" v-for="(item,index) in dataInfo.jqInsuranceType" :key="index"
  86. style="margin-top: 6px;">
  87. <text>{{item.name}}</text>
  88. <text>{{item.amount}}</text>
  89. </view>
  90. </view>
  91. </view>
  92. <view class="dis j-s a-c">
  93. <text>车船税:</text>
  94. <text>¥{{dataInfo.taxamount}}</text>
  95. </view>
  96. <view class="dis f-c j-s " v-if="dataInfo.sypremium">
  97. <view class="dis j-s a-c">
  98. <text>商业险</text>
  99. <text>¥{{dataInfo.sypremium}}</text>
  100. </view>
  101. <view class="dis f-c">
  102. <text
  103. style="color: rgba(35,40,50,0.9);letter-spacing: 1px;">起保日期:{{dataInfo.systartdate}}</text>
  104. <text
  105. style="color: rgba(35,40,50,0.9);letter-spacing: 1px;">终保日期:{{dataInfo.syenddate}}</text>
  106. </view>
  107. <view class=" dis j-s f-c p-2"
  108. style="border: none;background-color: #F9F9F9;border-radius: 10px;">
  109. <view class="dis j-s a-c" style="border-bottom: 1px solid #f2f2f2;">
  110. <view class="dis j-start" style="width: 50%;">
  111. <text style="color: rgba(35,40,50,0.8)">险别/名称</text>
  112. </view>
  113. <view class="dis j-c" style="width: 25%;">
  114. <text style="color: rgba(35,40,50,0.8)">保额</text>
  115. </view>
  116. <view class="dis j-end" style="width: 25%;">
  117. <text style="color: rgba(35,40,50,0.8)">保费(元)</text>
  118. </view>
  119. </view>
  120. <view class="coverage-sum dis j-s" v-for="(item,index) in dataInfo.kindinfo" :key="index"
  121. style="margin-top: 6px;">
  122. <view style="width: 50%;" class="dis a-c j-start">
  123. <text>{{item.kindName}}</text>
  124. </view>
  125. <view style="width: 25%;" class="dis a-c j-c"
  126. v-if="['D4', 'SY_FJ_YBW2'].includes(item.kindCode)">
  127. <text>{{item.unitAmount}}/座*{{dataInfo.carinfo.seatCount-1}}</text>
  128. </view>
  129. <view style="width: 25%;" class="dis a-c j-c"
  130. v-else-if="['MJ1', 'MJ2', 'MJ3', 'MJ4'].includes(item.kindCode)">
  131. <text>{{item.deductibleRate}}</text>
  132. </view>
  133. <view style="width: 25%;" class="dis a-c j-c"
  134. v-else-if="['TY1', 'TY2', 'TY3', 'TY4'].includes(item.kindCode)">
  135. <text>{{item.serviceTimes}}/次</text>
  136. </view>
  137. <view style="width: 25%;" class="dis a-c j-c" v-else>
  138. <text>{{item.amount}}</text>
  139. </view>
  140. <view style="width: 25%;" class="dis a-c j-end">
  141. <text>¥{{item.coveragePremium}}</text>
  142. </view>
  143. </view>
  144. </view>
  145. </view>
  146. <view class="dis f-c j-s " v-if="dataInfo.jypremium">
  147. <view class="dis j-s a-c">
  148. <text>附加险:意外险</text>
  149. <text>¥{{dataInfo.jypremium}}</text>
  150. </view>
  151. <view class=" dis j-s f-c p-2" v-if="dataInfo.accidentInfo.length>0"
  152. style="border: none;background-color: #F9F9F9;border-radius: 10px;">
  153. <view class="dis j-s a-c" style="border-bottom: 1px solid #f2f2f2;">
  154. <view class="dis j-start" style="width: 50%;">
  155. <text style="color: rgba(35,40,50,0.8)">险别/名称</text>
  156. </view>
  157. <view class="dis j-c" style="width: 25%;">
  158. <text style="color: rgba(35,40,50,0.8)">保额</text>
  159. </view>
  160. <view class="dis j-end" style="width: 25%;">
  161. <text style="color: rgba(35,40,50,0.8)">保费(元)</text>
  162. </view>
  163. </view>
  164. <view class="coverage-sum dis j-s" v-for="(item,index) in dataInfo.accidentInfo"
  165. :key="index" style="margin-top: 6px;">
  166. <view style="width: 50%;" class="dis a-c j-start">
  167. <text>{{item.name}}</text>
  168. </view>
  169. <view style="width: 25%;" class="dis a-c j-c">
  170. <text>{{item.amount}}</text>
  171. </view>
  172. <view style="width: 25%;" class="dis a-c j-c">
  173. <text>{{item.premium}}</text>
  174. </view>
  175. </view>
  176. </view><strong></strong>
  177. </view>
  178. <view class="dis j-s a-c">
  179. <text>应缴金额:</text>
  180. <text style="color: #0052FF;font-weight: bold;">¥{{dataInfo.sumpremium}}</text>
  181. </view>
  182. </view>
  183. </view>
  184. <kxj-watermark type="fixation" color="#333" :texts="texts" :count="12"></kxj-watermark>
  185. </view>
  186. <view class="fixed-bottom">
  187. <u-button type="primary" :loading="loading" style="background-color:#0052FF;"
  188. @tap="sendPayCode">发送微信</u-button>
  189. </view>
  190. </view>
  191. </template>
  192. <script>
  193. import {
  194. mapState,
  195. mapMutations
  196. } from 'vuex';
  197. import kxjWatermark from '@/components/common/kxj-watermark/kxj-watermark.vue'
  198. import {
  199. pathToBase64,
  200. base64ToPath
  201. } from '@/common/pdf.js'
  202. export default {
  203. components: {
  204. kxjWatermark
  205. },
  206. data() {
  207. return {
  208. loading: true,
  209. bannerImg: '',
  210. texts: [],
  211. payImg: "",
  212. posterUrl: "",
  213. caricon: "", //carlogo
  214. show: false,
  215. companyId: "",
  216. dataInfo: {},
  217. carinfo: {}, //车辆信息
  218. ownerinfo: {}, //车主信息
  219. applyinfo: {}, //投保人信息
  220. insureinfo: {}, //被保人信息
  221. logoimg: "",
  222. }
  223. },
  224. computed: {
  225. ...mapState(["userLoginId"])
  226. },
  227. async onLoad(options) {
  228. this.texts = [this.userLoginId]
  229. this.companyId = options.companyId;
  230. let params = {
  231. companyId: options.companyId
  232. };
  233. let res = await this.$http.post('/insurance/order/getByCompanyId', params);
  234. var data = res.data;
  235. data.kindinfo.map((ele, index) => {
  236. switch (ele.kindCode) {
  237. case "A":
  238. if (ele.amount == 1) {
  239. ele.amount = "投保"
  240. } else {
  241. ele.amount = ele.amount
  242. }
  243. break;
  244. case "D4":
  245. case "SY_FJ_YBW2":
  246. ele.unitAmount = this.toChinesNum(ele.unitAmount);
  247. break;
  248. case "MJ1":
  249. case "MJ2":
  250. case "MJ3":
  251. case "MJ4":
  252. ele.deductibleRate = ele.deductibleRate + "%";
  253. break;
  254. default:
  255. ele.amount = this.toChinesNum(ele.amount);
  256. }
  257. return ele;
  258. });
  259. this.$base.insCompanyList.map(ele => {
  260. if (ele.name == data.inscompany) {
  261. uni.getImageInfo({
  262. src: ele.icon,
  263. success: image => {
  264. pathToBase64(image.path)
  265. .then(base64 => {
  266. this.logoimg = base64;
  267. })
  268. .catch(error => {});
  269. },
  270. fail: err => {}
  271. });
  272. }
  273. return ele;
  274. })
  275. this.dataInfo = data;
  276. this.carinfo = data.carinfo;
  277. this.ownerinfo = data.ownerinfo;
  278. this.applyinfo = data.applyinfo;
  279. this.insureinfo = data.insureinfo;
  280. uni.getImageInfo({
  281. src: '../../static/image/car-insure/baojiadan.png',
  282. success: image => {
  283. pathToBase64(image.path)
  284. .then(base64 => {
  285. this.bannerImg = base64;
  286. })
  287. .catch(error => {});
  288. },
  289. fail: err => {}
  290. });
  291. },
  292. methods: {
  293. //页面返回按钮
  294. back() {
  295. uni.navigateBack({
  296. delta: 1, // 返回的页面数,如果是1表示返回上一页
  297. success: function() {}
  298. });
  299. },
  300. //本地图片转换成base64
  301. turnBase64Image() {
  302. this.
  303. uni.getImageInfo({
  304. src: img,
  305. success: image => {
  306. pathToBase64(image.path)
  307. .then(base64 => {
  308. this[key] = base64;
  309. })
  310. .catch(error => {});
  311. },
  312. fail: err => {}
  313. });
  314. },
  315. toChinesNum(num) {
  316. let overWan = Math.floor(num / 10000);
  317. let result = overWan + "万";
  318. return result;
  319. },
  320. //分享图片到微信
  321. sendPayCode() {
  322. console.log(this.payImg);
  323. if (this.payImg) {
  324. uni.share({
  325. provider: "weixin",
  326. scene: "WXSceneSession",
  327. type: 2,
  328. imageUrl: this.payImg
  329. })
  330. }
  331. },
  332. //页面截图转路径
  333. receiveRenderData(val) {
  334. this.posterUrl = val.replace(/[\r\n]/g, ''); // 去除base64位中的空格
  335. const imageStr = this.posterUrl;
  336. // 将base64转化为临时地址
  337. base64ToPath(imageStr).then(path => {
  338. this.payImg = path
  339. }).catch(error => {
  340. console.log(error);
  341. });
  342. },
  343. showLoading() {
  344. uni.showLoading({
  345. title: '正在生成图片'
  346. });
  347. },
  348. hideLoading() {
  349. uni.hideLoading();
  350. this.loading = false;
  351. },
  352. },
  353. }
  354. </script>
  355. <script module="canvasImage" lang="renderjs">
  356. import html2canvas from 'html2canvas'
  357. export default {
  358. data() {
  359. return {
  360. }
  361. },
  362. mounted() {
  363. // #ifdef APP-PLUS
  364. setTimeout(() => {
  365. this.canvasImage.generateImage()
  366. }, 1000);
  367. // #endif
  368. },
  369. methods: {
  370. // #ifdef APP-PLUS
  371. generateImage() {
  372. setTimeout(() => {
  373. this.$ownerInstance.callMethod('showLoading')
  374. const dom = document.getElementById('panelcanvas') // 需要生成图片内容的 dom 节点
  375. html2canvas(dom, {
  376. width: dom.clientWidth, //dom 原始宽度
  377. height: dom.clientHeight,
  378. scrollY: 0, // html2canvas默认绘制视图内的页面,需要把scrollY,scrollX设置为0
  379. scrollX: 0,
  380. useCORS: true, //支持跨域
  381. // allowTaint: false,
  382. scale: 3, // 设置生成图片的像素比例,默认是1,如果生成的图片模糊的话可以开启该配置项
  383. }).then((canvas) => {
  384. // 生成成功
  385. this.$ownerInstance.callMethod('hideLoading')
  386. this.$ownerInstance.callMethod('receiveRenderData', canvas.toDataURL('image/png'))
  387. }).catch(err => {
  388. console.log('323213213123_errAlert', `【生成图片失败,请重试】${err}`);
  389. // 生成失败 弹出提示弹窗
  390. this.$ownerInstance.callMethod('_errAlert', `【生成图片失败,请重试】${err}`)
  391. })
  392. }, 300)
  393. }
  394. // #endif
  395. },
  396. }
  397. </script>
  398. <style lang="scss" scoped>
  399. @import '@/style/mixin.scss';
  400. .page {
  401. background-color: #F8FAFE;
  402. padding-bottom: 100px;
  403. box-sizing: border-box;
  404. }
  405. .fixed-bottom {
  406. position: fixed;
  407. bottom: 0;
  408. width: 100%;
  409. height: 62px;
  410. background-color: #FFFFFF;
  411. padding: 16px;
  412. box-shadow: 0px -4px 10px 0px #DAE3F4;
  413. border-radius: 0px 0px 0px 0px;
  414. }
  415. .content {
  416. width: 100%;
  417. height: auto;
  418. padding: 16px 16px 0;
  419. position: relative;
  420. .price {
  421. width: 100%;
  422. height: 40px;
  423. background: #FFFFFF;
  424. border-radius: 6px 6px 0px 0px;
  425. }
  426. }
  427. .information {
  428. width: 100%;
  429. height: auto;
  430. background-color: #fff;
  431. box-shadow: 0px 4px 10px 0px #DAE3F4;
  432. border-radius: 6px;
  433. margin-top: 10px;
  434. padding: 10px 10px 0;
  435. >view {
  436. padding: 10px 0;
  437. border-bottom: 1px solid #f2f2f2;
  438. text {
  439. font-size: 14px;
  440. color: #232832;
  441. }
  442. }
  443. .title {
  444. font-size: 15px;
  445. color: #232832;
  446. font-weight: bold;
  447. }
  448. :last-child {
  449. border: none;
  450. }
  451. }
  452. .Basic-information {
  453. background-color: white;
  454. width: 100%;
  455. height: auto;
  456. .basic-logo {
  457. padding: 10px 16px;
  458. border-bottom: 1px solid #f2f2f2;
  459. image {
  460. width: 50px;
  461. height: 50px;
  462. margin-right: 20px;
  463. }
  464. text {
  465. font-size: 12px;
  466. }
  467. text:first-child {
  468. font-weight: bold;
  469. font-size: 18px;
  470. }
  471. }
  472. .basic-data {
  473. padding: 16px;
  474. .arrange {
  475. margin: 4px 0;
  476. font-size: 14px;
  477. text:first-child {
  478. font-weight: bold;
  479. margin-right: 5px;
  480. }
  481. text:last-child {
  482. color: #606266;
  483. }
  484. &::before {
  485. content: "·";
  486. color: #606266;
  487. margin-right: 10px;
  488. font-weight: bold;
  489. }
  490. }
  491. }
  492. .bjdCarSum {
  493. padding: 10px 16px;
  494. border-bottom: 1px solid #f2f2f2;
  495. font-weight: bold;
  496. font-size: 14px;
  497. }
  498. .coverage {
  499. padding: 10px 16px;
  500. .coverage-title {
  501. width: 100%;
  502. view:first-child {
  503. border-top-left-radius: 8px;
  504. }
  505. view:last-child {
  506. border-top-right-radius: 8px;
  507. }
  508. view:nth-child(2) {
  509. border-left: none;
  510. border-right: none;
  511. }
  512. view {
  513. width: 33.33%;
  514. text-align: center;
  515. background: #ff8f63;
  516. color: #fff;
  517. padding: 6px 16px;
  518. border: 1px solid #fff;
  519. font-size: 12px;
  520. box-sizing: border-box;
  521. }
  522. }
  523. .coverage-sum {
  524. width: 100%;
  525. view {
  526. font-size: 12px;
  527. padding: 6px 16px;
  528. }
  529. }
  530. }
  531. }
  532. .Circle {
  533. position: relative;
  534. &::before {
  535. display: block;
  536. content: "";
  537. position: absolute;
  538. width: 10px;
  539. height: 10px;
  540. background: #92b5fe;
  541. top: -5px;
  542. left: -15px;
  543. border-radius: 50%;
  544. }
  545. &::after {
  546. content: "";
  547. position: absolute;
  548. width: 10px;
  549. height: 10px;
  550. background: #92b5fe;
  551. top: -5px;
  552. right: -15px;
  553. border-radius: 50%;
  554. }
  555. }
  556. .footer-button {
  557. z-index: 9999;
  558. margin-top: 20px;
  559. position: fixed;
  560. bottom: 0;
  561. width: 100%;
  562. background: white;
  563. padding: 10px 20px;
  564. button {
  565. width: 70%;
  566. cursor: pointer;
  567. }
  568. }
  569. .tip {
  570. width: 100%;
  571. background-color: #fff;
  572. border-radius: 10upx;
  573. font-size: 32upx;
  574. font-weight: bold;
  575. margin: 0 auto;
  576. padding: 20px;
  577. box-sizing: border-box;
  578. position: fixed;
  579. bottom: 0;
  580. }
  581. /* 底部的样式Start */
  582. .infoBottom {
  583. height: 140upx;
  584. position: fixed;
  585. bottom: 0;
  586. left: 0;
  587. right: 0;
  588. background: #ea552d;
  589. border-top: 1upx solid #ea552d;
  590. z-index: 99;
  591. margin-top: 100px;
  592. }
  593. .infoBottom>button {
  594. // font-size: 30upx;
  595. background: #fff;
  596. color: #333;
  597. flex: 1;
  598. margin: 0upx 30px;
  599. font-weight: bold;
  600. }
  601. /* 底部的样式End */
  602. .watermark {
  603. position: fixed;
  604. top: 50%;
  605. left: 50%;
  606. transform: translate(-50%, -50%);
  607. font-size: 24px;
  608. color: rgba(0, 0, 0, 0.3);
  609. pointer-events: none;
  610. z-index: 9999;
  611. }
  612. </style>