djqQm.vue 4.4 KB

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