quotation.vue 16 KB

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