quotation.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  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. <!-- #ifdef APP-PLUS -->
  187. <view class="fixed-bottom">
  188. <u-button type="primary" :loading="loading" style="background-color:#0052FF;"
  189. @tap="sendPayCode">发送微信</u-button>
  190. </view>
  191. <!-- #endif -->
  192. </view>
  193. </template>
  194. <script>
  195. import {
  196. mapState,
  197. mapMutations
  198. } from 'vuex';
  199. import kxjWatermark from '@/components/common/kxj-watermark/kxj-watermark.vue'
  200. import {
  201. pathToBase64,
  202. base64ToPath
  203. } from '@/common/pdf.js'
  204. export default {
  205. components: {
  206. kxjWatermark
  207. },
  208. data() {
  209. return {
  210. loading: true,
  211. bannerImg: '',
  212. texts: [],
  213. payImg: "",
  214. posterUrl: "",
  215. caricon: "", //carlogo
  216. show: false,
  217. companyId: "",
  218. dataInfo: {},
  219. carinfo: {}, //车辆信息
  220. ownerinfo: {}, //车主信息
  221. applyinfo: {}, //投保人信息
  222. insureinfo: {}, //被保人信息
  223. logoimg: "",
  224. }
  225. },
  226. computed: {
  227. ...mapState(["userLoginId"])
  228. },
  229. async onLoad(options) {
  230. this.texts = [this.userLoginId]
  231. this.companyId = options.companyId;
  232. let params = {
  233. companyId: options.companyId
  234. };
  235. let res = await this.$http.post('/insurance/order/getByCompanyId', params);
  236. var data = res.data;
  237. data.kindinfo.map((ele, index) => {
  238. switch (ele.kindCode) {
  239. case "A":
  240. if (ele.amount == 1) {
  241. ele.amount = "投保"
  242. } else {
  243. ele.amount = ele.amount
  244. }
  245. break;
  246. case "D4":
  247. case "SY_FJ_YBW2":
  248. ele.unitAmount = this.toChinesNum(ele.unitAmount);
  249. break;
  250. case "MJ1":
  251. case "MJ2":
  252. case "MJ3":
  253. case "MJ4":
  254. ele.deductibleRate = ele.deductibleRate + "%";
  255. break;
  256. default:
  257. ele.amount = this.toChinesNum(ele.amount);
  258. }
  259. return ele;
  260. });
  261. this.$base.insCompanyList.map(ele => {
  262. if (ele.name == data.inscompany) {
  263. uni.getImageInfo({
  264. src: ele.icon,
  265. success: image => {
  266. pathToBase64(image.path)
  267. .then(base64 => {
  268. this.logoimg = base64;
  269. })
  270. .catch(error => {});
  271. },
  272. fail: err => {}
  273. });
  274. }
  275. return ele;
  276. })
  277. this.dataInfo = data;
  278. this.carinfo = data.carinfo;
  279. this.ownerinfo = data.ownerinfo;
  280. this.applyinfo = data.applyinfo;
  281. this.insureinfo = data.insureinfo;
  282. uni.getImageInfo({
  283. src: '../../static/image/car-insure/baojiadan.png',
  284. success: image => {
  285. pathToBase64(image.path)
  286. .then(base64 => {
  287. this.bannerImg = base64;
  288. })
  289. .catch(error => {});
  290. },
  291. fail: err => {}
  292. });
  293. },
  294. methods: {
  295. //页面返回按钮
  296. back() {
  297. uni.navigateBack({
  298. delta: 1, // 返回的页面数,如果是1表示返回上一页
  299. success: function() {}
  300. });
  301. },
  302. //本地图片转换成base64
  303. turnBase64Image() {
  304. this.
  305. uni.getImageInfo({
  306. src: img,
  307. success: image => {
  308. pathToBase64(image.path)
  309. .then(base64 => {
  310. this[key] = base64;
  311. })
  312. .catch(error => {});
  313. },
  314. fail: err => {}
  315. });
  316. },
  317. toChinesNum(num) {
  318. let overWan = Math.floor(num / 10000);
  319. let result = overWan + "万";
  320. return result;
  321. },
  322. //分享图片到微信
  323. sendPayCode() {
  324. console.log(this.payImg);
  325. if (this.payImg) {
  326. uni.share({
  327. provider: "weixin",
  328. scene: "WXSceneSession",
  329. type: 2,
  330. imageUrl: this.payImg
  331. })
  332. }
  333. },
  334. //页面截图转路径
  335. receiveRenderData(val) {
  336. this.posterUrl = val.replace(/[\r\n]/g, ''); // 去除base64位中的空格
  337. const imageStr = this.posterUrl;
  338. // 将base64转化为临时地址
  339. base64ToPath(imageStr).then(path => {
  340. this.payImg = path
  341. }).catch(error => {
  342. console.log(error);
  343. });
  344. },
  345. showLoading() {
  346. uni.showLoading({
  347. title: '正在生成图片'
  348. });
  349. },
  350. hideLoading() {
  351. uni.hideLoading();
  352. this.loading = false;
  353. },
  354. },
  355. }
  356. </script>
  357. <script module="canvasImage" lang="renderjs">
  358. import html2canvas from 'html2canvas'
  359. export default {
  360. data() {
  361. return {
  362. }
  363. },
  364. mounted() {
  365. // #ifdef APP-PLUS
  366. setTimeout(() => {
  367. this.canvasImage.generateImage()
  368. }, 1000);
  369. // #endif
  370. },
  371. methods: {
  372. // #ifdef APP-PLUS
  373. generateImage() {
  374. setTimeout(() => {
  375. this.$ownerInstance.callMethod('showLoading')
  376. const dom = document.getElementById('panelcanvas') // 需要生成图片内容的 dom 节点
  377. html2canvas(dom, {
  378. width: dom.clientWidth, //dom 原始宽度
  379. height: dom.clientHeight,
  380. scrollY: 0, // html2canvas默认绘制视图内的页面,需要把scrollY,scrollX设置为0
  381. scrollX: 0,
  382. useCORS: true, //支持跨域
  383. // allowTaint: false,
  384. scale: 3, // 设置生成图片的像素比例,默认是1,如果生成的图片模糊的话可以开启该配置项
  385. }).then((canvas) => {
  386. // 生成成功
  387. this.$ownerInstance.callMethod('hideLoading')
  388. this.$ownerInstance.callMethod('receiveRenderData', canvas.toDataURL('image/png'))
  389. }).catch(err => {
  390. console.log('323213213123_errAlert', `【生成图片失败,请重试】${err}`);
  391. // 生成失败 弹出提示弹窗
  392. this.$ownerInstance.callMethod('_errAlert', `【生成图片失败,请重试】${err}`)
  393. })
  394. }, 300)
  395. }
  396. // #endif
  397. },
  398. }
  399. </script>
  400. <style lang="scss" scoped>
  401. @import '@/style/mixin.scss';
  402. .page {
  403. background-color: #F8FAFE;
  404. padding-bottom: 100px;
  405. box-sizing: border-box;
  406. }
  407. .fixed-bottom {
  408. position: fixed;
  409. bottom: 0;
  410. width: 100%;
  411. height: 62px;
  412. background-color: #FFFFFF;
  413. padding: 16px;
  414. box-shadow: 0px -4px 10px 0px #DAE3F4;
  415. border-radius: 0px 0px 0px 0px;
  416. }
  417. .content {
  418. width: 100%;
  419. height: auto;
  420. padding: 16px 16px 0;
  421. position: relative;
  422. .price {
  423. width: 100%;
  424. height: 40px;
  425. background: #FFFFFF;
  426. border-radius: 6px 6px 0px 0px;
  427. }
  428. }
  429. .information {
  430. width: 100%;
  431. height: auto;
  432. background-color: #fff;
  433. box-shadow: 0px 4px 10px 0px #DAE3F4;
  434. border-radius: 6px;
  435. margin-top: 10px;
  436. padding: 10px 10px 0;
  437. >view {
  438. padding: 10px 0;
  439. border-bottom: 1px solid #f2f2f2;
  440. text {
  441. font-size: 14px;
  442. color: #232832;
  443. }
  444. }
  445. .title {
  446. font-size: 15px;
  447. color: #232832;
  448. font-weight: bold;
  449. }
  450. :last-child {
  451. border: none;
  452. }
  453. }
  454. .Basic-information {
  455. background-color: white;
  456. width: 100%;
  457. height: auto;
  458. .basic-logo {
  459. padding: 10px 16px;
  460. border-bottom: 1px solid #f2f2f2;
  461. image {
  462. width: 50px;
  463. height: 50px;
  464. margin-right: 20px;
  465. }
  466. text {
  467. font-size: 12px;
  468. }
  469. text:first-child {
  470. font-weight: bold;
  471. font-size: 18px;
  472. }
  473. }
  474. .basic-data {
  475. padding: 16px;
  476. .arrange {
  477. margin: 4px 0;
  478. font-size: 14px;
  479. text:first-child {
  480. font-weight: bold;
  481. margin-right: 5px;
  482. }
  483. text:last-child {
  484. color: #606266;
  485. }
  486. &::before {
  487. content: "·";
  488. color: #606266;
  489. margin-right: 10px;
  490. font-weight: bold;
  491. }
  492. }
  493. }
  494. .bjdCarSum {
  495. padding: 10px 16px;
  496. border-bottom: 1px solid #f2f2f2;
  497. font-weight: bold;
  498. font-size: 14px;
  499. }
  500. .coverage {
  501. padding: 10px 16px;
  502. .coverage-title {
  503. width: 100%;
  504. view:first-child {
  505. border-top-left-radius: 8px;
  506. }
  507. view:last-child {
  508. border-top-right-radius: 8px;
  509. }
  510. view:nth-child(2) {
  511. border-left: none;
  512. border-right: none;
  513. }
  514. view {
  515. width: 33.33%;
  516. text-align: center;
  517. background: #ff8f63;
  518. color: #fff;
  519. padding: 6px 16px;
  520. border: 1px solid #fff;
  521. font-size: 12px;
  522. box-sizing: border-box;
  523. }
  524. }
  525. .coverage-sum {
  526. width: 100%;
  527. view {
  528. font-size: 12px;
  529. padding: 6px 16px;
  530. }
  531. }
  532. }
  533. }
  534. .Circle {
  535. position: relative;
  536. &::before {
  537. display: block;
  538. content: "";
  539. position: absolute;
  540. width: 10px;
  541. height: 10px;
  542. background: #92b5fe;
  543. top: -5px;
  544. left: -15px;
  545. border-radius: 50%;
  546. }
  547. &::after {
  548. content: "";
  549. position: absolute;
  550. width: 10px;
  551. height: 10px;
  552. background: #92b5fe;
  553. top: -5px;
  554. right: -15px;
  555. border-radius: 50%;
  556. }
  557. }
  558. .footer-button {
  559. z-index: 9999;
  560. margin-top: 20px;
  561. position: fixed;
  562. bottom: 0;
  563. width: 100%;
  564. background: white;
  565. padding: 10px 20px;
  566. button {
  567. width: 70%;
  568. cursor: pointer;
  569. }
  570. }
  571. .tip {
  572. width: 100%;
  573. background-color: #fff;
  574. border-radius: 10upx;
  575. font-size: 32upx;
  576. font-weight: bold;
  577. margin: 0 auto;
  578. padding: 20px;
  579. box-sizing: border-box;
  580. position: fixed;
  581. bottom: 0;
  582. }
  583. /* 底部的样式Start */
  584. .infoBottom {
  585. height: 140upx;
  586. position: fixed;
  587. bottom: 0;
  588. left: 0;
  589. right: 0;
  590. background: #ea552d;
  591. border-top: 1upx solid #ea552d;
  592. z-index: 99;
  593. margin-top: 100px;
  594. }
  595. .infoBottom>button {
  596. // font-size: 30upx;
  597. background: #fff;
  598. color: #333;
  599. flex: 1;
  600. margin: 0upx 30px;
  601. font-weight: bold;
  602. }
  603. /* 底部的样式End */
  604. .watermark {
  605. position: fixed;
  606. top: 50%;
  607. left: 50%;
  608. transform: translate(-50%, -50%);
  609. font-size: 24px;
  610. color: rgba(0, 0, 0, 0.3);
  611. pointer-events: none;
  612. z-index: 9999;
  613. }
  614. </style>