hxqm.vue 4.2 KB

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