quotation.vue 17 KB

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