quotation.vue 14 KB

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