quotation.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. <template>
  2. <view class='page'>
  3. <view class="" id="panelcanvas">
  4. <image class="paymentCode-back" :src="detailbackimg" mode=""></image>
  5. <uni-NavBar headerTitle="报价单" background="transparent" :isShared="false" :isSlot="false"
  6. @share="share"></uni-NavBar>
  7. <view class="header-title dis a-c j-s ">
  8. <view class="dis a-c left">
  9. <image :src="insCompanyVo.logo" mode=""></image>
  10. <text class="ml-1">{{companyName}}</text>
  11. </view>
  12. <text>{{order.createTime}}</text>
  13. </view>
  14. <view class="content dis f-c">
  15. <view class="scroll-content">
  16. <view class="view dis a-c j-s ">
  17. <text>车主</text>
  18. <text>{{ownersInfo.name}}</text>
  19. </view>
  20. <view class="view dis a-c j-s ">
  21. <text>车牌号</text>
  22. <text>{{carInfoVo.licenseNo}}</text>
  23. </view>
  24. <view class="view dis a-c j-s ">
  25. <text>车架号</text>
  26. <text>{{carInfoVo.vinNo}}</text>
  27. </view>
  28. <view class="view dis a-c j-s ">
  29. <text>品牌型号</text>
  30. <text>{{carInfoVo.brandName}}</text>
  31. </view>
  32. <view class="view dis a-c j-s ">
  33. <text>发动机号</text>
  34. <text>{{carInfoVo.engineNo}}</text>
  35. </view>
  36. <view class="view dis a-c j-s " v-if="ciRiskInfoVo">
  37. <text>交强险起保时间</text>
  38. <text>{{ciRiskInfoVo.startDate}}</text>
  39. </view>
  40. <view class="view dis a-c j-s " v-if="biRiskInfoVo">
  41. <text>商业险起保时间</text>
  42. <text>{{biRiskInfoVo.startDate}}</text>
  43. </view>
  44. <view class="tab dis f-c">
  45. <view class="header-title"
  46. style="background: linear-gradient( 180deg, #FFF8F8 0%, #FFFFFF 100%)">
  47. 报价方案
  48. </view>
  49. <view class="items dis f-c ">
  50. <view class="table mb-3" v-if="kindInfoVo.length>0">
  51. <view class="header dis a-c j-s">
  52. <text class="th special">商业险</text>
  53. <text class="th">保额</text>
  54. <text class="th">保费</text>
  55. </view>
  56. <view class="tr dis a-c j-c" v-for="(item,index) in kindInfoVo" :key="index">
  57. <text class="td special">{{item.kindName}}</text>
  58. <text v-if="['A'].includes(item.kindCode)" class="td">{{item.amount}}</text>
  59. <text v-else-if="['D4', 'SY_FJ_YBW2'].includes(item.kindCode)"
  60. class="td">{{convertedValue(item.amount)}}</text>
  61. <text v-else-if="['MJ1', 'MJ2', 'MJ3', 'MJ4'].includes(item.kindCode)"
  62. class="td">{{item.amount}}%</text>
  63. <text v-else-if="['TY1', 'TY2', 'TY3', 'TY4'].includes(item.kindCode)"
  64. class="td">{{item.amount}}次</text>
  65. <text v-else class="td">{{convertedValue(item.amount)}}</text>
  66. <text class="td">{{item.premium?item.premium:'-'}}</text>
  67. </view>
  68. </view>
  69. <view class="table" v-if="accidentalDrivings.length>0">
  70. <view class="header dis a-c j-s">
  71. <text class="th special">驾意险</text>
  72. <text class="th">单价/数量</text>
  73. <text class="th">保费</text>
  74. </view>
  75. <view class="tr dis a-c j-c" v-for="(item,index) in accidentalDrivings" :key="index">
  76. <text class="td special">{{item.productName}}</text>
  77. <text class="td">{{item.quantity}}份</text>
  78. <text class="td">{{item.sumAmount}}</text>
  79. </view>
  80. </view>
  81. <view class="item dis a-c j-s mt-3">
  82. <text>交强险</text>
  83. <text>¥{{costs.ciPremium}} </text>
  84. </view>
  85. <view class="item dis a-c j-s">
  86. <text>车船税</text>
  87. <text>¥{{costs.vvTax}} </text>
  88. </view>
  89. <view class="item dis a-start j-s">
  90. <text>商业险</text>
  91. <text>¥{{costs.biPremium}} </text>
  92. </view>
  93. <view class="item dis a-start j-s">
  94. <text>驾意险</text>
  95. <text>¥{{costs.niPremium}} </text>
  96. </view>
  97. <view class="item dis a-c j-s ">
  98. <text>保费合计</text>
  99. <text class="price">¥{{costs.sumPremium}} </text>
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. </view>
  106. <!-- #ifdef APP-PLUS -->
  107. <view class="" style="padding: 0 20rpx;box-sizing: border-box;">
  108. <view class="btn mt-3 dis a-c j-c " @click="sendPayCode">
  109. 分享
  110. </view>
  111. </view>
  112. <!-- #endif -->
  113. </view>
  114. </template>
  115. <script>
  116. import {
  117. mapState
  118. } from "vuex"
  119. import {
  120. turnBase64Image
  121. } from '@/plugins/utils.js';
  122. import {
  123. pathToBase64,
  124. base64ToPath
  125. } from '@/common/pdf.js'
  126. import QR from "@/common/wxqrcode.js"
  127. export default {
  128. data() {
  129. return {
  130. detailbackimg: "", //背景图
  131. payImg: "",
  132. posterUrl: '',
  133. companyName: "",
  134. ordersNo: "",
  135. quoteNo: "",
  136. ciRiskInfoVo: {}, //交强险
  137. biRiskInfoVo: {}, //商业险
  138. kindInfoVo: [], //险别信息
  139. carInfoVo: {}, //车辆信息
  140. ownersInfo: {}, //车主信息
  141. policyHolderInfo: {}, //投保人信息
  142. insuredPersonInfo: {}, //被保人信息
  143. order: {},
  144. costs: {},
  145. accidentalDrivings: [], //驾意险
  146. insCompanyVo: {}, //保险公司信息
  147. }
  148. },
  149. onShow() {
  150. },
  151. async mounted() {
  152. this.detailbackimg = await turnBase64Image('/static/image/detailback.png');
  153. },
  154. async onLoad(options) {
  155. if (options.ordersNo) {
  156. let res = await this.$http.get('/supplementOrder/getOrderDetail?ordersNo=' + options.ordersNo);
  157. if (res.code == "200") {
  158. this.order = res.data.order;
  159. this.companyName = res.data.order.companyName;
  160. this.ordersNo = res.data.order.ordersNo;
  161. this.quoteNo = res.data.order.quoteNo;
  162. this.ciRiskInfoVo = res.data.ciRiskInfoVo;
  163. this.biRiskInfoVo = res.data.biRiskInfoVo;
  164. this.kindInfoVo = res.data.kindInfoVo;
  165. this.costs = res.data.costs;
  166. this.accidentalDrivings = res.data.accidentalDrivings;
  167. this.carInfoVo = res.data.carInfoVo;
  168. this.ownersInfo = res.data.ownersInfo;
  169. this.policyHolderInfo = res.data.policyHolderInfo;
  170. this.insuredPersonInfo = res.data.insuredPersonInfo;
  171. this.insCompanyVo = res.data.insCompanyVo[0];
  172. this.kindInfoVo = this.kindInfoVo.filter(item => item.kindCode != 'J1')
  173. }
  174. }
  175. },
  176. methods: {
  177. //商业险保额换算
  178. convertedValue(num) {
  179. if (num < 10000) {
  180. return num.toString();
  181. } else if (num < 100000000) {
  182. return (Math.floor(num / 10000 * 10) / 10) + '万';
  183. } else {
  184. return (Math.floor(num / 100000000 * 10) / 10) + '亿';
  185. }
  186. },
  187. //分享图片到微信
  188. sendPayCode() {
  189. console.log(this.payImg);
  190. if (this.payImg) {
  191. uni.share({
  192. provider: "weixin",
  193. scene: "WXSceneSession",
  194. type: 2,
  195. imageUrl: this.payImg
  196. })
  197. }
  198. },
  199. //页面截图转路径
  200. receiveRenderData(val) {
  201. this.posterUrl = val.replace(/[\r\n]/g, ''); // 去除base64位中的空格
  202. const imageStr = this.posterUrl;
  203. // 将base64转化为临时地址
  204. base64ToPath(imageStr).then(path => {
  205. this.payImg = path
  206. }).catch(error => {
  207. console.log(error);
  208. });
  209. },
  210. showLoading() {
  211. uni.showLoading({
  212. title: '正在生成图片'
  213. });
  214. },
  215. hideLoading() {
  216. uni.hideLoading();
  217. this.loading = false;
  218. },
  219. }
  220. }
  221. </script>
  222. <script module="canvasImage" lang="renderjs">
  223. import html2canvas from 'html2canvas'
  224. export default {
  225. data() {
  226. return {
  227. }
  228. },
  229. mounted() {
  230. // #ifdef APP-PLUS
  231. setTimeout(() => {
  232. this.canvasImage.generateImage()
  233. }, 1000);
  234. // #endif
  235. },
  236. methods: {
  237. // #ifdef APP-PLUS
  238. generateImage() {
  239. setTimeout(() => {
  240. this.$ownerInstance.callMethod('showLoading')
  241. const dom = document.getElementById('panelcanvas') // 需要生成图片内容的 dom 节点
  242. html2canvas(dom, {
  243. width: dom.clientWidth, //dom 原始宽度
  244. height: dom.clientHeight,
  245. scrollY: 0, // html2canvas默认绘制视图内的页面,需要把scrollY,scrollX设置为0
  246. scrollX: 0,
  247. useCORS: true, //支持跨域
  248. // allowTaint: false,
  249. scale: 3, // 设置生成图片的像素比例,默认是1,如果生成的图片模糊的话可以开启该配置项
  250. }).then((canvas) => {
  251. // 生成成功
  252. this.$ownerInstance.callMethod('hideLoading')
  253. this.$ownerInstance.callMethod('receiveRenderData', canvas.toDataURL('image/png'))
  254. }).catch(err => {
  255. console.log('323213213123_errAlert', `【生成图片失败,请重试】${err}`);
  256. // 生成失败 弹出提示弹窗
  257. this.$ownerInstance.callMethod('_errAlert', `【生成图片失败,请重试】${err}`)
  258. })
  259. }, 300)
  260. }
  261. // #endif
  262. },
  263. }
  264. </script>
  265. <style lang="scss" scoped>
  266. .page {
  267. background-color: #F8F8F8;
  268. height: 100vh;
  269. }
  270. .page {
  271. position: relative;
  272. background-color: #f8f8f8;
  273. }
  274. /* 背景图 */
  275. .paymentCode-back {
  276. width: 100%;
  277. height: 492rpx;
  278. position: fixed;
  279. top: 0;
  280. left: 0;
  281. z-index: 0;
  282. }
  283. .header-title {
  284. position: relative;
  285. padding: 0 30rpx;
  286. box-sizing: border-box;
  287. margin: 16rpx 0;
  288. .left {
  289. image {
  290. width: 40rpx;
  291. height: 40rpx;
  292. }
  293. text {
  294. font-size: 36rpx;
  295. color: #333;
  296. font-weight: bold;
  297. }
  298. }
  299. >text {
  300. font-size: 26rpx;
  301. color: rgba(51, 51, 51, 0.7);
  302. }
  303. }
  304. .content {
  305. padding: 0 20rpx;
  306. box-sizing: border-box;
  307. position: relative;
  308. .scroll-content {
  309. height: calc(100vh - 200px);
  310. background: #FFFFFF;
  311. box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(0, 0, 0, 0.05);
  312. border-radius: 20rpx 20rpx 10rpx 10rpx;
  313. padding: 30rpx;
  314. box-sizing: border-box;
  315. overflow: auto;
  316. .view {
  317. font-size: 30rpx;
  318. color: #666;
  319. margin-bottom: 30rpx;
  320. >text:last-child {
  321. color: #333;
  322. font-weight: bold;
  323. width: 65%;
  324. text-align: right;
  325. }
  326. }
  327. .qrCode {
  328. margin-top: 10px;
  329. >text {
  330. font-size: 30rpx;
  331. color: #333;
  332. }
  333. .qr {
  334. width: 290rpx;
  335. height: 290rpx;
  336. margin: 10rpx auto 0;
  337. padding: 10rpx;
  338. box-sizing: border-box;
  339. }
  340. .undoButton {
  341. padding: 13rpx 26rpx;
  342. box-sizing: border-box;
  343. background: rgba(253, 233, 53, 0.2);
  344. border-radius: 58rpx 58rpx 58rpx 58rpx;
  345. border: 1rpx solid #FDE935;
  346. font-size: 30rpx;
  347. color: #1F1F1F;
  348. }
  349. }
  350. }
  351. }
  352. .tab {
  353. background-color: #fff;
  354. border-radius: 0 0 10rpx 10rpx;
  355. .header-title {
  356. background: linear-gradient(180deg, #FFFCEA 0%, #FFFFFF 100%);
  357. border-radius: 20rpx 20rpx 0rpx 0rpx;
  358. font-size: 32rpx;
  359. color: #333;
  360. font-weight: bold;
  361. padding: 20rpx;
  362. box-sizing: border-box;
  363. }
  364. .items {
  365. padding: 0 20rpx;
  366. box-sizing: border-box;
  367. .item {
  368. margin-bottom: 30rpx;
  369. >text:first-child {
  370. font-size: 30rpx;
  371. color: #666;
  372. }
  373. >:nth-child(2) {
  374. font-size: 30rpx;
  375. color: #333;
  376. font-weight: bold;
  377. width: 70%;
  378. text-align: right;
  379. }
  380. }
  381. .table {
  382. width: 100%;
  383. border-radius: 4rpx;
  384. border: 1rpx solid #FFD9D9;
  385. .header {
  386. background-color: #FFF8F8;
  387. border-radius: 4rpx 4rpx 0 0;
  388. .th {
  389. padding: 15rpx;
  390. box-sizing: border-box;
  391. text-align: center;
  392. font-size: 28rpx;
  393. color: #FF5B45;
  394. flex: 1;
  395. }
  396. .th.special {
  397. flex: 2;
  398. }
  399. }
  400. .tr {
  401. .td {
  402. padding: 15rpx;
  403. box-sizing: border-box;
  404. text-align: center;
  405. font-size: 28rpx;
  406. flex: 1;
  407. }
  408. .td.special {
  409. flex: 2;
  410. }
  411. }
  412. .tr:nth-child(odd) {
  413. background-color: #FBFBFB;
  414. }
  415. }
  416. }
  417. }
  418. .price {
  419. color: #FF540A !important;
  420. }
  421. .btn {
  422. width: 100%;
  423. height: 88rpx;
  424. background: #FDE935;
  425. margin: 30rpx auto 0;
  426. border-radius: 58rpx 58rpx 58rpx 58rpx;
  427. font-size: 36rpx;
  428. color: #1F1F1F;
  429. font-weight: bold;
  430. }
  431. </style>