quotation.vue 14 KB

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