quotation.vue 17 KB

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