quotation1.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  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 style="letter-spacing: 1px;">{{ dataInfo.jqstartdate }}</text>
  48. </view>
  49. <view class="circulate-data dis a-c " v-if="dataInfo.systartdate">
  50. <text>商业投保时间:</text>
  51. <text style="letter-spacing: 1px;">{{ 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" :loading="loading" style="width: 100%;background: #2D4D89;"
  120. @click="sendPayCode">发送到微信</u-button>
  121. <!-- <button type="default" @tap="sendPayCode">发送到微信</button> -->
  122. </view>
  123. </view>
  124. </template>
  125. <script>
  126. import {
  127. pathToBase64,
  128. base64ToPath
  129. } from '@/common/pdf.js'
  130. export default {
  131. data() {
  132. return {
  133. loading: true,
  134. payImg: "",
  135. posterUrl: "",
  136. caricon: "", //carlogo
  137. show: false,
  138. companyId: "",
  139. dataInfo: {},
  140. carinfo: {}, //车辆信息
  141. ownerinfo: {}, //车主信息
  142. applyinfo: {}, //投保人信息
  143. insureinfo: {}, //被保人信息
  144. logoimg: "",
  145. }
  146. },
  147. async onLoad(options) {
  148. this.companyId = options.companyId;
  149. let params = {
  150. companyId: options.companyId
  151. };
  152. let res = await this.$http.post('/insurance/order/getByCompanyId', params);
  153. var data = res.data;
  154. data.kindinfo.map((ele, index) => {
  155. switch (ele.kindCode) {
  156. case "A":
  157. if (ele.amount == 1) {
  158. ele.amount = "投保"
  159. } else {
  160. ele.amount = ele.amount
  161. }
  162. break;
  163. case "D4":
  164. case "SY_FJ_YBW2":
  165. ele.unitAmount = this.toChinesNum(ele.unitAmount);
  166. break;
  167. case "MJ1":
  168. case "MJ2":
  169. case "MJ3":
  170. case "MJ4":
  171. ele.deductibleRate = ele.deductibleRate + "%";
  172. break;
  173. default:
  174. ele.amount = this.toChinesNum(ele.amount);
  175. }
  176. return ele;
  177. });
  178. this.$base.insCompanyList.map(ele => {
  179. if (ele.name == data.inscompany) {
  180. uni.getImageInfo({
  181. src: ele.icon,
  182. success: image => {
  183. pathToBase64(image.path)
  184. .then(base64 => {
  185. this.logoimg = base64;
  186. })
  187. .catch(error => {});
  188. },
  189. fail: err => {}
  190. });
  191. }
  192. return ele;
  193. })
  194. this.dataInfo = data;
  195. this.carinfo = data.carinfo;
  196. this.ownerinfo = data.ownerinfo;
  197. this.applyinfo = data.applyinfo;
  198. this.insureinfo = data.insureinfo;
  199. uni.getImageInfo({
  200. src: '../../static/icon/Group@2x.png',
  201. success: image => {
  202. pathToBase64(image.path)
  203. .then(base64 => {
  204. this.caricon = base64
  205. })
  206. .catch(error => {});
  207. },
  208. });
  209. },
  210. methods: {
  211. //本地图片转换成base64
  212. turnBase64Image() {
  213. this.
  214. uni.getImageInfo({
  215. src: img,
  216. success: image => {
  217. pathToBase64(image.path)
  218. .then(base64 => {
  219. this[key] = base64;
  220. })
  221. .catch(error => {});
  222. },
  223. fail: err => {}
  224. });
  225. },
  226. toChinesNum(num) {
  227. let overWan = Math.floor(num / 10000);
  228. let result = overWan + "万";
  229. return result;
  230. },
  231. //分享图片到微信
  232. sendPayCode() {
  233. if (this.payImg) {
  234. uni.share({
  235. provider: "weixin",
  236. scene: "WXSceneSession",
  237. type: 2,
  238. imageUrl: this.payImg
  239. })
  240. }
  241. },
  242. //页面截图转路径
  243. receiveRenderData(val) {
  244. this.posterUrl = val.replace(/[\r\n]/g, ''); // 去除base64位中的空格
  245. const imageStr = this.posterUrl;
  246. // 将base64转化为临时地址
  247. base64ToPath(imageStr).then(path => {
  248. this.payImg = path
  249. }).catch(error => {});
  250. },
  251. showLoading() {
  252. uni.showLoading({
  253. title: '正在生成图片'
  254. });
  255. },
  256. hideLoading() {
  257. uni.hideLoading();
  258. this.loading = false;
  259. },
  260. },
  261. }
  262. </script>
  263. <script module="canvasImage" lang="renderjs">
  264. import html2canvas from 'html2canvas'
  265. export default {
  266. data() {
  267. return {
  268. }
  269. },
  270. mounted() {
  271. // #ifdef APP-PLUS
  272. setTimeout(() => {
  273. this.canvasImage.generateImage()
  274. }, 1000);
  275. // #endif
  276. },
  277. methods: {
  278. // #ifdef APP-PLUS
  279. generateImage() {
  280. setTimeout(() => {
  281. this.$ownerInstance.callMethod('showLoading')
  282. const dom = document.getElementById('panelcanvas') // 需要生成图片内容的 dom 节点
  283. html2canvas(dom, {
  284. width: dom.clientWidth, //dom 原始宽度
  285. height: dom.clientHeight,
  286. scrollY: 0, // html2canvas默认绘制视图内的页面,需要把scrollY,scrollX设置为0
  287. scrollX: 0,
  288. useCORS: true, //支持跨域
  289. // allowTaint: false,
  290. scale: 2, // 设置生成图片的像素比例,默认是1,如果生成的图片模糊的话可以开启该配置项
  291. }).then((canvas) => {
  292. // 生成成功
  293. this.$ownerInstance.callMethod('hideLoading')
  294. this.$ownerInstance.callMethod('receiveRenderData', canvas.toDataURL('image/png'))
  295. }).catch(err => {
  296. // 生成失败 弹出提示弹窗
  297. this.$ownerInstance.callMethod('_errAlert', `【生成图片失败,请重试】${err}`)
  298. })
  299. }, 300)
  300. }
  301. // #endif
  302. },
  303. }
  304. </script>
  305. <style lang="scss" scoped>
  306. @import '@/style/mixin.scss';
  307. .page {
  308. padding: 10px 16px;
  309. box-sizing: border-box;
  310. }
  311. .image-icon {
  312. width: 45px;
  313. height: 45px;
  314. }
  315. .quotation-header {
  316. width: 100%;
  317. height: 60px;
  318. background: rgba(45, 77, 137, 0.06);
  319. border-radius: 0px 0px 0px 0px;
  320. border: 1px dashed rgba(45, 77, 137, 0.2);
  321. padding: 10px;
  322. >view {
  323. padding: 10px;
  324. margin-left: 25px;
  325. text:first-child {
  326. color: #232832;
  327. font-weight: bold;
  328. font-size: 14px;
  329. }
  330. }
  331. }
  332. .quotation-data {
  333. width: 100%;
  334. margin-top: 10px;
  335. border: 1px solid #000000;
  336. .circulate-impany {
  337. height: 37px;
  338. padding: 8px 6px;
  339. background: rgba(45, 77, 137, 0.1);
  340. border-bottom: 1px solid #000000;
  341. font-weight: 700;
  342. }
  343. .circulate-data {
  344. height: 37px;
  345. color: #232832;
  346. padding: 8px 6px;
  347. border-bottom: 1px solid #000000;
  348. text:first-child {
  349. color: #232832;
  350. font-weight: bold;
  351. font-size: 14px;
  352. }
  353. text:last-child {
  354. color: rgba(35, 40, 50, 0.8);
  355. font-size: 14px;
  356. }
  357. }
  358. .coverage {
  359. .coverage-title {
  360. width: 100%;
  361. view:nth-child(1) {
  362. border-left: none;
  363. border-top: none;
  364. }
  365. view:nth-child(2) {
  366. border-top: none;
  367. border-left: none;
  368. border-right: none;
  369. }
  370. view:nth-child(3) {
  371. border-right: none;
  372. border-top: none;
  373. }
  374. view {
  375. text-align: center;
  376. background: #F8F8F8;
  377. color: #232832;
  378. padding: 6px;
  379. border: 1px solid #000;
  380. font-size: 12px;
  381. box-sizing: border-box;
  382. }
  383. }
  384. .coverage-sum {
  385. width: 100%;
  386. view:nth-child(1) {
  387. border-left: none;
  388. }
  389. view:nth-child(2) {
  390. border-left: none;
  391. border-right: none;
  392. width: 27%;
  393. }
  394. view:nth-child(3) {
  395. width: 27%;
  396. border-right: none;
  397. }
  398. view {
  399. text-align: center;
  400. font-size: 12px;
  401. background: #F8F8F8;
  402. color: #232832;
  403. padding: 6px;
  404. border: 1px solid #000;
  405. border-top: none;
  406. }
  407. }
  408. }
  409. .circulate-sum {
  410. padding: 10px;
  411. view {
  412. view:nth-child(1) {
  413. width: 70%;
  414. text-align: end;
  415. }
  416. view:nth-child(2) {
  417. width: 25%;
  418. text-align: start;
  419. }
  420. }
  421. }
  422. }
  423. .infoBottom {
  424. height: 140upx;
  425. position: fixed;
  426. bottom: 0;
  427. left: 0;
  428. right: 0;
  429. background: #ea552d;
  430. border-top: 1upx solid #ea552d;
  431. z-index: 99;
  432. margin-top: 100px;
  433. }
  434. .infoBottom>button {
  435. // font-size: 30upx;
  436. background: #fff;
  437. color: #333;
  438. flex: 1;
  439. margin: 0upx 30px;
  440. font-weight: bold;
  441. }
  442. /* 底部的样式End */
  443. </style>