discountCard.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <view class="box">
  3. <view class="tab">
  4. <view class="tabLine" :class="{tabActive:tabIndex==1}" @click="tabClick(1)">可使用</view>
  5. <view class="tabLine" :class="{tabActive:tabIndex==2}" @click="tabClick(2)">可赠送</view>
  6. </view>
  7. <view class="main" :class="{mainActive:tabIndex==1}">
  8. <view class="okBox" v-if="tabIndex==1">
  9. <view class="tabLine2" :class="{tabActive2:tabIndex2==1}" @click="tabClick2(1)">可使用</view>
  10. <view class="tabLine2" :class="{tabActive2:tabIndex2==2}" @click="tabClick2(2)">已使用</view>
  11. <view class="tabLine2" :class="{tabActive2:tabIndex2==3}" @click="tabClick2(3)">已过期</view>
  12. </view>
  13. <view class="itemBg" v-for="(item,index) in items" @click="goDetail(item.ID)">
  14. <view class="itemTop">
  15. <view class="leftB">
  16. <view class="use">¥<span class="use2">{{item.actMoney}}</span></view>
  17. <!-- <view class="used">¥<span class="used2">{{item.actMoney}}</span></view> -->
  18. </view>
  19. <view class="centerB">
  20. <view class="name">{{item.actName}}</view>
  21. <view class="time" v-if="item.startTime">有效期:{{item.startTime}}-{{item.endTime}}</view>
  22. <view class="time" v-else></view>
  23. </view>
  24. <view class="rightB"></view>
  25. </view>
  26. <view class="itemBottom">
  27. <view>可用次数:10</view>
  28. <view>查看详情 ></view>
  29. </view>
  30. </view>
  31. <!-- 无数据空白页 -->
  32. <nodata v-if="items.length==0"></nodata>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import nodata from '@/components/nodata/nodata.vue'
  38. export default {
  39. components: {
  40. nodata
  41. },
  42. data() {
  43. return {
  44. tabIndex: 1,
  45. tabIndex2: 1,
  46. items: [],
  47. }
  48. },
  49. onLoad(opt) {
  50. this.tabIndex = opt.num;
  51. this.myOrderCoupon()
  52. },
  53. onShow() {
  54. console.log(this.tabIndex)
  55. this.myOrderCoupon()
  56. },
  57. methods: {
  58. tabClick(num) {
  59. this.tabIndex = num;
  60. this.myOrderCoupon()
  61. },
  62. tabClick2(num) {
  63. this.tabIndex2 = num;
  64. this.myOrderCoupon()
  65. },
  66. goDetail(id) {
  67. uni.navigateTo({
  68. url: 'orderDetail?id=' + id
  69. })
  70. },
  71. myOrderCoupon() {
  72. uni.showLoading({
  73. title: '加载中'
  74. })
  75. this.$http('opencoupon/listCoupon', {
  76. // page: this.page,
  77. // limit: 10,
  78. }, 'POST').then(res => {
  79. uni.hideLoading();
  80. // var list = res.data.Items
  81. var list = res.data
  82. // 处理 undefined和null转为空白字符串
  83. // list.forEach((item, index) => {
  84. // for (const key in item) {
  85. // item[key] = this.$praseStrEmpty(item[key])
  86. // }
  87. // })
  88. this.items = list
  89. })
  90. },
  91. }
  92. }
  93. </script>
  94. <style scoped>
  95. .box {
  96. min-height: 100vh;
  97. background: #F4F5F7;
  98. }
  99. .tab {
  100. background: #FFFFFF;
  101. display: flex;
  102. justify-content: space-around;
  103. line-height: 92rpx;
  104. position: fixed;
  105. width: calc(100vw - 48rpx);
  106. padding-left: 24rpx;
  107. padding-right: 24rpx;
  108. height: 92rpx;
  109. z-index: 11;
  110. }
  111. .tabLine {
  112. font-size: 30rpx;
  113. text-align: center;
  114. }
  115. .tabActive {
  116. color: #F03B3B;
  117. border-bottom: 4rpx solid #F03B3B;
  118. }
  119. .main {
  120. padding-top: 92rpx;
  121. padding-bottom: 20rpx;
  122. background-color: #F4F5F7;
  123. }
  124. .mainActive{
  125. padding-top: 184rpx;
  126. padding-bottom: 20rpx;
  127. background-color: #F4F5F7;
  128. }
  129. .okBox {
  130. background: #FFFFFF;
  131. display: flex;
  132. justify-content: flex-start;
  133. align-items: center;
  134. border-top: 1rpx solid #EEEEEE;
  135. position: fixed;
  136. width: 100vw;
  137. padding-left: 24rpx;
  138. padding-right: 24rpx;
  139. margin-top: -93rpx;
  140. height: 92rpx;
  141. z-index: 11;
  142. }
  143. .tabLine2 {
  144. font-size: 28rpx;
  145. text-align: center;
  146. width: 144rpx;
  147. height: 56rpx;
  148. background: #F4F5F7;
  149. border-radius: 28rpx;
  150. line-height: 56rpx;
  151. margin-right: 24rpx;
  152. }
  153. .tabActive2 {
  154. background-color: rgba(240, 59, 59, 0.06);
  155. border-radius: 28rpx;
  156. background-color: 0.06;
  157. font-size: 28rpx;
  158. color: #F03B3B;
  159. width: 144rpx;
  160. height: 56rpx;
  161. line-height: 56rpx;
  162. margin-right: 24rpx;
  163. }
  164. .itemBg {
  165. margin: 20rpx 24rpx 0rpx;
  166. background-color: #FFFFFF;
  167. border-radius: 10rpx;
  168. padding: 40rpx 20rpx 20rpx;
  169. }
  170. .itemTop {
  171. display: flex;
  172. justify-content: space-between;
  173. margin-bottom: 40rpx;
  174. }
  175. .use {
  176. font-size: 26rpx;
  177. color: #F03B3B;
  178. }
  179. .use2 {
  180. font-size: 40rpx;
  181. font-weight: 500;
  182. color: #F03B3B;
  183. line-height: 56rpx;
  184. }
  185. .used {
  186. font-size: 26rpx;
  187. color: #666666;
  188. }
  189. .used2 {
  190. font-size: 40rpx;
  191. font-weight: 500;
  192. color: #666666;
  193. line-height: 56rpx;
  194. }
  195. .name{
  196. font-size: 30rpx;
  197. font-weight: 500;
  198. color: #333333;
  199. line-height: 42rpx;
  200. }
  201. .time{
  202. font-size: 24rpx;
  203. color: #666666;
  204. }
  205. .itemBottom {
  206. display: flex;
  207. justify-content: space-between;
  208. padding-top: 20rpx;
  209. border-top: 1rpx solid #EEEEEE;
  210. font-size: 24rpx;
  211. color: #999999;
  212. line-height: 33rpx;
  213. }
  214. </style>