quotation.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  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">投保</text>
  59. <text v-else-if="['D4', 'SY_FJ_YBW2'].includes(item.kindCode)"
  60. class="td">{{convertedValue(item.unitAmount)}}</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.serviceTimes}}次</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">1119险种5座非营运客车 保额21000保费5(山西)</text>
  77. <text class="td">投保</text>
  78. <text class="td">10252.00</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. }
  173. }
  174. },
  175. methods: {
  176. //商业险保额换算
  177. convertedValue(num) {
  178. if (num < 10000) {
  179. return num.toString();
  180. } else if (num < 100000000) {
  181. return (Math.floor(num / 10000 * 10) / 10) + '万';
  182. } else {
  183. return (Math.floor(num / 100000000 * 10) / 10) + '亿';
  184. }
  185. },
  186. //分享图片到微信
  187. sendPayCode() {
  188. console.log(this.payImg);
  189. if (this.payImg) {
  190. uni.share({
  191. provider: "weixin",
  192. scene: "WXSceneSession",
  193. type: 2,
  194. imageUrl: this.payImg
  195. })
  196. }
  197. },
  198. //页面截图转路径
  199. receiveRenderData(val) {
  200. this.posterUrl = val.replace(/[\r\n]/g, ''); // 去除base64位中的空格
  201. const imageStr = this.posterUrl;
  202. // 将base64转化为临时地址
  203. base64ToPath(imageStr).then(path => {
  204. this.payImg = path
  205. }).catch(error => {
  206. console.log(error);
  207. });
  208. },
  209. showLoading() {
  210. uni.showLoading({
  211. title: '正在生成图片'
  212. });
  213. },
  214. hideLoading() {
  215. uni.hideLoading();
  216. this.loading = false;
  217. },
  218. }
  219. }
  220. </script>
  221. <script module="canvasImage" lang="renderjs">
  222. import html2canvas from 'html2canvas'
  223. export default {
  224. data() {
  225. return {
  226. }
  227. },
  228. mounted() {
  229. // #ifdef APP-PLUS
  230. setTimeout(() => {
  231. this.canvasImage.generateImage()
  232. }, 1000);
  233. // #endif
  234. },
  235. methods: {
  236. // #ifdef APP-PLUS
  237. generateImage() {
  238. setTimeout(() => {
  239. this.$ownerInstance.callMethod('showLoading')
  240. const dom = document.getElementById('panelcanvas') // 需要生成图片内容的 dom 节点
  241. html2canvas(dom, {
  242. width: dom.clientWidth, //dom 原始宽度
  243. height: dom.clientHeight,
  244. scrollY: 0, // html2canvas默认绘制视图内的页面,需要把scrollY,scrollX设置为0
  245. scrollX: 0,
  246. useCORS: true, //支持跨域
  247. // allowTaint: false,
  248. scale: 3, // 设置生成图片的像素比例,默认是1,如果生成的图片模糊的话可以开启该配置项
  249. }).then((canvas) => {
  250. // 生成成功
  251. this.$ownerInstance.callMethod('hideLoading')
  252. this.$ownerInstance.callMethod('receiveRenderData', canvas.toDataURL('image/png'))
  253. }).catch(err => {
  254. console.log('323213213123_errAlert', `【生成图片失败,请重试】${err}`);
  255. // 生成失败 弹出提示弹窗
  256. this.$ownerInstance.callMethod('_errAlert', `【生成图片失败,请重试】${err}`)
  257. })
  258. }, 300)
  259. }
  260. // #endif
  261. },
  262. }
  263. </script>
  264. <style lang="scss" scoped>
  265. .page {
  266. background-color: #F8F8F8;
  267. height: 100vh;
  268. }
  269. .page {
  270. position: relative;
  271. background-color: #f8f8f8;
  272. }
  273. /* 背景图 */
  274. .back {
  275. width: 100%;
  276. height: 492rpx;
  277. position: fixed;
  278. top: 0;
  279. left: 0;
  280. z-index: 0;
  281. }
  282. .header-title {
  283. position: relative;
  284. padding: 0 30rpx;
  285. box-sizing: border-box;
  286. margin: 16rpx 0;
  287. .left {
  288. image {
  289. width: 40rpx;
  290. height: 40rpx;
  291. }
  292. text {
  293. font-size: 36rpx;
  294. color: #333;
  295. font-weight: bold;
  296. }
  297. }
  298. >text {
  299. font-size: 26rpx;
  300. color: rgba(51, 51, 51, 0.7);
  301. }
  302. }
  303. .content {
  304. padding: 0 20rpx;
  305. box-sizing: border-box;
  306. position: relative;
  307. .scroll-content {
  308. height: calc(100vh - 200px);
  309. background: #FFFFFF;
  310. box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(0, 0, 0, 0.05);
  311. border-radius: 20rpx 20rpx 10rpx 10rpx;
  312. padding: 30rpx;
  313. box-sizing: border-box;
  314. overflow: auto;
  315. .view {
  316. font-size: 30rpx;
  317. color: #666;
  318. margin-bottom: 30rpx;
  319. >text:last-child {
  320. color: #333;
  321. font-weight: bold;
  322. width: 65%;
  323. text-align: right;
  324. }
  325. }
  326. .qrCode {
  327. margin-top: 10px;
  328. >text {
  329. font-size: 30rpx;
  330. color: #333;
  331. }
  332. .qr {
  333. width: 290rpx;
  334. height: 290rpx;
  335. margin: 10rpx auto 0;
  336. padding: 10rpx;
  337. box-sizing: border-box;
  338. }
  339. .undoButton {
  340. padding: 13rpx 26rpx;
  341. box-sizing: border-box;
  342. background: rgba(253, 233, 53, 0.2);
  343. border-radius: 58rpx 58rpx 58rpx 58rpx;
  344. border: 1rpx solid #FDE935;
  345. font-size: 30rpx;
  346. color: #1F1F1F;
  347. }
  348. }
  349. }
  350. }
  351. .tab {
  352. background-color: #fff;
  353. border-radius: 0 0 10rpx 10rpx;
  354. .header-title {
  355. background: linear-gradient(180deg, #FFFCEA 0%, #FFFFFF 100%);
  356. border-radius: 20rpx 20rpx 0rpx 0rpx;
  357. font-size: 32rpx;
  358. color: #333;
  359. font-weight: bold;
  360. padding: 20rpx;
  361. box-sizing: border-box;
  362. }
  363. .items {
  364. padding: 0 20rpx;
  365. box-sizing: border-box;
  366. .item {
  367. margin-bottom: 30rpx;
  368. >text:first-child {
  369. font-size: 30rpx;
  370. color: #666;
  371. }
  372. >:nth-child(2) {
  373. font-size: 30rpx;
  374. color: #333;
  375. font-weight: bold;
  376. width: 70%;
  377. text-align: right;
  378. }
  379. }
  380. .table {
  381. width: 100%;
  382. border-radius: 4rpx;
  383. border: 1rpx solid #FFD9D9;
  384. .header {
  385. background-color: #FFF8F8;
  386. border-radius: 4rpx 4rpx 0 0;
  387. .th {
  388. padding: 15rpx;
  389. box-sizing: border-box;
  390. text-align: center;
  391. font-size: 28rpx;
  392. color: #FF5B45;
  393. flex: 1;
  394. }
  395. .th.special {
  396. flex: 2;
  397. }
  398. }
  399. .tr {
  400. .td {
  401. padding: 15rpx;
  402. box-sizing: border-box;
  403. text-align: center;
  404. font-size: 28rpx;
  405. flex: 1;
  406. }
  407. .td.special {
  408. flex: 2;
  409. }
  410. }
  411. .tr:nth-child(odd) {
  412. background-color: #FBFBFB;
  413. }
  414. }
  415. }
  416. }
  417. .price {
  418. color: #FF540A !important;
  419. }
  420. .btn {
  421. width: 100%;
  422. height: 88rpx;
  423. background: #FDE935;
  424. margin: 30rpx auto 0;
  425. border-radius: 58rpx 58rpx 58rpx 58rpx;
  426. font-size: 36rpx;
  427. color: #1F1F1F;
  428. font-weight: bold;
  429. }
  430. </style>