quotation1.vue 11 KB

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