coupon.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <view class="container">
  3. <view class="help">使用说明</view>
  4. <view v-if="couponList.length>0" class="coupon-list">
  5. <block v-for="(item, index) in couponList" :key="item.id">
  6. <view class="item" :style="'background: ' + (item.coupon_status==1?'linear-gradient(to right,#cfa568,#e3bf79)':'linear-gradient(to right,#999,#DDDDDD)')">
  7. <view class="tag">新人专享</view>
  8. <view class="content">
  9. <view class="left">
  10. <view class="name">{{item.name||''}}</view>
  11. <view class="time">有效期至{{item.use_end_date||''}}</view>
  12. </view>
  13. <view class="right">
  14. <image v-if="item.coupon_status==1" class='mid-img' src='../../../static/images/coupon_ksy.png'></image>
  15. <image v-if="item.coupon_status==2" class='mid-img' src='../../../static/images/coupon_ysy.png'></image>
  16. <image v-if="item.coupon_status==3" class='mid-img' src='../../../static/images/coupon_gq.png'></image>
  17. </view>
  18. </view>
  19. <view class="condition">
  20. <text class="txt">满¥{{item.min_goods_amount}} 减¥{{item.type_money}}</text>
  21. </view>
  22. </view>
  23. </block>
  24. </view>
  25. <show-empty v-else text="没有优惠券"></show-empty>
  26. </view>
  27. </template>
  28. <script>
  29. const util = require("@/utils/util.js");
  30. const api = require('@/utils/api.js');
  31. export default {
  32. data() {
  33. return {
  34. couponList: null
  35. }
  36. },
  37. methods: {
  38. loadListData: function() {
  39. let that = this;
  40. util.request(api.CouponList).then(function(res) {
  41. if (res.errno === 0) {
  42. that.couponList = res.data
  43. }
  44. });
  45. }
  46. },
  47. onShow: function() {
  48. this.loadListData()
  49. }
  50. }
  51. </script>
  52. <style lang="scss">
  53. page {
  54. background: #f4f4f4;
  55. min-height: 100%;
  56. }
  57. .container {
  58. background: #f4f4f4;
  59. min-height: 100%;
  60. padding-top: 30rpx;
  61. }
  62. .coupon-form {
  63. height: 110rpx;
  64. width: 100%;
  65. background: #fff;
  66. padding-left: 30rpx;
  67. padding-right: 30rpx;
  68. padding-top: 20rpx;
  69. display: flex;
  70. }
  71. .input-box {
  72. flex: 1;
  73. height: 70rpx;
  74. color: #333;
  75. font-size: 24rpx;
  76. background: #fff;
  77. position: relative;
  78. border: 1px solid rgba(0, 0, 0, 0.15);
  79. border-radius: 4rpx;
  80. margin-right: 30rpx;
  81. }
  82. .input-box .coupon-sn {
  83. position: absolute;
  84. top: 10rpx;
  85. left: 30rpx;
  86. height: 50rpx;
  87. width: 100%;
  88. color: #000;
  89. line-height: 50rpx;
  90. font-size: 24rpx;
  91. }
  92. .clear-icon {
  93. position: absolute;
  94. top: 21rpx;
  95. right: 30rpx;
  96. width: 28rpx;
  97. height: 28rpx;
  98. }
  99. .add-btn {
  100. display: flex;
  101. justify-content: center;
  102. align-items: center;
  103. height: 70rpx;
  104. border: none;
  105. width: 168rpx;
  106. background: #b4282d;
  107. border-radius: 0;
  108. line-height: 70rpx;
  109. color: #fff;
  110. font-size: 28rpx;
  111. }
  112. .add-btn.disabled {
  113. background: #ccc;
  114. }
  115. .help {
  116. height: 72rpx;
  117. line-height: 72rpx;
  118. text-align: right;
  119. padding-right: 30rpx;
  120. background: url(https://platform-wxmall.oss-cn-beijing.aliyuncs.com/upload/20180727/15032866437ca8.png) 590rpx center no-repeat;
  121. background-size: 28rpx;
  122. color: #999;
  123. font-size: 24rpx;
  124. }
  125. .coupon-list {
  126. width: 100%;
  127. height: auto;
  128. overflow: hidden;
  129. padding-left: 30rpx;
  130. padding-right: 30rpx;
  131. }
  132. .item {
  133. position: relative;
  134. height: 290rpx;
  135. width: 100%;
  136. border-radius: 8rpx;
  137. margin-bottom: 30rpx;
  138. padding-top: 52rpx;
  139. }
  140. .tag {
  141. height: 32rpx;
  142. background: #A48143;
  143. padding-left: 16rpx;
  144. padding-right: 16rpx;
  145. position: absolute;
  146. left: 20rpx;
  147. color: #fff;
  148. top: 20rpx;
  149. font-size: 20rpx;
  150. text-align: center;
  151. line-height: 32rpx;
  152. }
  153. .content {
  154. margin-top: 24rpx;
  155. margin-left: 40rpx;
  156. display: flex;
  157. margin-right: 40rpx;
  158. flex-direction: row;
  159. align-items: center;
  160. }
  161. .content .left {
  162. flex: 1;
  163. }
  164. .name {
  165. font-size: 44rpx;
  166. color: #fff;
  167. margin-bottom: 14rpx;
  168. }
  169. .time {
  170. font-size: 24rpx;
  171. color: rgba(255, 255, 255, 0.8);
  172. line-height: 30rpx;
  173. }
  174. .content .right {
  175. width: 162rpx;
  176. display: flex;
  177. justify-content: center;
  178. align-items: center;
  179. }
  180. .content .right .mid-img {
  181. width: 100rpx;
  182. height: 100rpx;
  183. }
  184. .condition {
  185. position: absolute;
  186. width: 100%;
  187. bottom: 0;
  188. left: 0;
  189. height: 78rpx;
  190. background: rgba(0, 0, 0, .08);
  191. padding: 24rpx 40rpx;
  192. display: flex;
  193. flex-direction: row;
  194. }
  195. .condition .txt {
  196. display: block;
  197. height: 30rpx;
  198. flex: 1;
  199. overflow: hidden;
  200. font-size: 24rpx;
  201. line-height: 30rpx;
  202. color: #fff;
  203. }
  204. .condition .icon {
  205. margin-left: 30rpx;
  206. width: 24rpx;
  207. height: 24rpx;
  208. }
  209. </style>