djqQm.vue 4.8 KB

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