hxqm.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <view class="content" style="height: 100vh;">
  3. <view class="" style="height: 87rpx;">
  4. </view>
  5. <view class="djq-wrap">
  6. <view class="djq-top flex f-d-c f-j-c">
  7. <view class="djq-name">
  8. 服务确认二维码
  9. </view>
  10. <view class="djq-time">
  11. 请扫码核销
  12. </view>
  13. </view>
  14. <view class="djq-body">
  15. <view class="ewm">
  16. <tki-qrcode :cid="cid" ref="qrcode" :val="val" :size="size" :unit="unit" :background="background"
  17. :foreground="foreground" :pdground="pdground" :iconSize="iconSize" :lv="lv" :onval="onval"
  18. :loadMake="loadMake" :usingComponents="usingComponents" @result="qrR" />
  19. </view>
  20. <view class="ewm-code" >
  21. {{showVal}}
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import tkiQrcode from '@/components/tki-qrcode/tki-qrcode.vue';
  29. import {
  30. orderDetail
  31. } from '@/api/order.js';
  32. export default {
  33. components: {
  34. tkiQrcode
  35. },
  36. data() {
  37. return {
  38. showVal: '',
  39. type: 1,//1->普通商品核销 2-> 电池核销
  40. orderInfo: {},
  41. order_id: '', //订单编号
  42. cid: 'tki-qrcode-canvas', //canvasId,页面存在多个二维码组件时需设置不同的ID
  43. size: 440, //生成的二维码大小
  44. unit: 'upx', //大小单位尺寸
  45. show: true, //默认使用组件中的image标签显示二维码
  46. val: '', //要生成的内容
  47. background: '#ffffff', //二维码背景色
  48. foreground: '#333333', //二维码前景色
  49. pdground: '#333333', //二维码角标色
  50. icon: '', //二维码图标URL(必须是本地图片,网络图需要先下载至本地)
  51. iconSize: 40, //二维码图标大小
  52. lv: 3, //容错级别
  53. onval: true, //监听val值变化自动重新生成二维码
  54. loadMake: true, //组件初始化完成后自动生成二维码,val需要有值
  55. usingComponents: false, //是否使用了自定义组件模式(主要是为了修复非自定义组件模式时 v-if 无法生成二维码的问题)
  56. showLoading: false, //是否显示loading
  57. loadingText: '二维码生成中', //loading文字
  58. src: '', // 二维码生成后的图片地址或base64
  59. ratio: 1, //页面比例用于计算
  60. ctxSrc: '', //要显示的图片
  61. loading: true, //是否载入图片中
  62. }
  63. },
  64. onLoad(opt) {
  65. this.type = opt.type
  66. // 普通商品核销
  67. if (this.type == 1) {
  68. this.order_id = opt.id
  69. this.getOrderDetail()
  70. }
  71. //电池核销码
  72. if(this.type == 2) {
  73. this.val = 'battery&'+ opt.id + '&' + opt.battery_number
  74. this.showVal = opt.id
  75. }
  76. // 升压器核销码
  77. if(this.type == 3) {
  78. this.val = 'booster&' + opt.id + '&' + opt.booster_number
  79. this.showVal = opt.id
  80. }
  81. },
  82. onShow() {
  83. },
  84. onReachBottom() {
  85. },
  86. onReady() {
  87. },
  88. methods: {
  89. getOrderDetail() {
  90. let that = this;
  91. orderDetail({}, that.order_id).then(e => {
  92. // that.item = e.data;
  93. that.orderInfo = e.data
  94. that.val = that.orderInfo.verify_code
  95. that.showVal = that.val
  96. });
  97. },
  98. qrR() {
  99. },
  100. }
  101. }
  102. </script>
  103. <style lang="scss" scoped>
  104. page .content{
  105. min-height: 100%;
  106. height: auto;
  107. background:$base-color !important;
  108. }
  109. .djq-wrap {
  110. width: 696rpx;
  111. background-color: #fff;
  112. position: relative;
  113. margin: auto;
  114. .djq-top {
  115. height: 185rpx;
  116. background: #F5F5F5;
  117. overflow: hidden;
  118. flex-direction: column;
  119. justify-content: center;
  120. .djq-name {
  121. font-size: 44rpx;
  122. font-weight: bold;
  123. color: #222222;
  124. }
  125. .djq-time {
  126. font-size: 24rpx;
  127. font-weight: 500;
  128. color: #686868;
  129. }
  130. &::after,
  131. &::before {
  132. content: '';
  133. height: 120rpx;
  134. width: 120rpx;
  135. border-radius: 50%;
  136. position: absolute;
  137. top: -60rpx;
  138. background-color: $base-color;
  139. }
  140. &::before {
  141. left: -60rpx;
  142. }
  143. &::after {
  144. right: -60rpx;
  145. }
  146. }
  147. .djq-body {
  148. height: 770rpx;
  149. position: relative;
  150. padding-top: 115rpx;
  151. &::after,
  152. &::before {
  153. content: '';
  154. height: 120rpx;
  155. width: 120rpx;
  156. border-radius: 50%;
  157. position: absolute;
  158. bottom: -60rpx;
  159. background-color: $base-color;
  160. }
  161. &::before {
  162. left: -60rpx;
  163. }
  164. &::after {
  165. right: -60rpx;
  166. }
  167. .ewm {
  168. width: 440rpx;
  169. height: 440rpx;
  170. margin: auto;
  171. }
  172. .ewm-code {
  173. padding-top: 55rpx;
  174. font-size: 44rpx;
  175. font-weight: bold;
  176. color: #333333;
  177. text-align: center;
  178. }
  179. }
  180. }
  181. </style>