quotation1.vue 12 KB

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