hxqm.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. if(this.type == 2) {
  72. this.val = opt.id + '&' + opt.dcode
  73. this.showVal = opt.id
  74. }
  75. },
  76. onShow() {
  77. },
  78. onReachBottom() {
  79. },
  80. onReady() {
  81. },
  82. methods: {
  83. getOrderDetail() {
  84. let that = this;
  85. orderDetail({}, that.order_id).then(e => {
  86. // that.item = e.data;
  87. that.orderInfo = e.data
  88. that.val = that.orderInfo.verify_code
  89. that.showVal = that.val
  90. });
  91. },
  92. qrR() {
  93. },
  94. }
  95. }
  96. </script>
  97. <style lang="scss" scoped>
  98. page .content{
  99. min-height: 100%;
  100. height: auto;
  101. background:$base-color !important;
  102. }
  103. .djq-wrap {
  104. width: 696rpx;
  105. background-color: #fff;
  106. position: relative;
  107. margin: auto;
  108. .djq-top {
  109. height: 185rpx;
  110. background: #F5F5F5;
  111. overflow: hidden;
  112. flex-direction: column;
  113. justify-content: center;
  114. .djq-name {
  115. font-size: 44rpx;
  116. font-weight: bold;
  117. color: #222222;
  118. }
  119. .djq-time {
  120. font-size: 24rpx;
  121. font-weight: 500;
  122. color: #686868;
  123. }
  124. &::after,
  125. &::before {
  126. content: '';
  127. height: 120rpx;
  128. width: 120rpx;
  129. border-radius: 50%;
  130. position: absolute;
  131. top: -60rpx;
  132. background-color: $base-color;
  133. }
  134. &::before {
  135. left: -60rpx;
  136. }
  137. &::after {
  138. right: -60rpx;
  139. }
  140. }
  141. .djq-body {
  142. height: 770rpx;
  143. position: relative;
  144. padding-top: 115rpx;
  145. &::after,
  146. &::before {
  147. content: '';
  148. height: 120rpx;
  149. width: 120rpx;
  150. border-radius: 50%;
  151. position: absolute;
  152. bottom: -60rpx;
  153. background-color: $base-color;
  154. }
  155. &::before {
  156. left: -60rpx;
  157. }
  158. &::after {
  159. right: -60rpx;
  160. }
  161. .ewm {
  162. width: 440rpx;
  163. height: 440rpx;
  164. margin: auto;
  165. }
  166. .ewm-code {
  167. padding-top: 55rpx;
  168. font-size: 44rpx;
  169. font-weight: bold;
  170. color: #333333;
  171. text-align: center;
  172. }
  173. }
  174. }
  175. </style>