usableDiscountCard.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <view class="content">
  3. <view class="teamTop">
  4. <view class="sumCount">可使用优惠券</view>
  5. </view>
  6. <!-- 列表 -->
  7. <view class="itemContent">
  8. <view v-for="(item,index) in itemData" :key="index">
  9. <view class="item">
  10. <!-- 第一块 -->
  11. <view class="topView" @click="ckCoupon(item)">
  12. <view class="leftView">
  13. <view class="moneyView">
  14. <view>¥</view>
  15. <view class="money">{{item.ActMoney}}</view>
  16. </view>
  17. <view class="condition" v-if="item.WhereMoney != 0">满{{item.WhereMoney}}元可用</view>
  18. <view class="condition" v-else>满任意金额可用</view>
  19. </view>
  20. <view class="rightView">
  21. <view class="cardName">{{item.ActName}}</view>
  22. <!-- 时间截取 -->
  23. <view class="valid">有效期:{{item.StartTime.slice(0,item.StartTime.length-8)}}至 {{item.EndTime.slice(0,item.EndTime.length-8)}}</view>
  24. </view>
  25. </view>
  26. <!-- 第二快 -->
  27. <view class="bottomView">
  28. <view>发放门店:{{item.ShopName}}</view>
  29. <view @click="goDiscountDetail(item)">查看详情</view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <!-- 上拉 加载更多 -->
  35. <view class="noMore" v-if="noMoreShow">没有更多数据</view>
  36. <!-- 无数据空白页 -->
  37. <nodata v-if="itemData.length==0"></nodata>
  38. </view>
  39. </template>
  40. <script>
  41. import nodata from '../../components/nodata/nodata.vue'
  42. export default {
  43. components: {
  44. nodata,
  45. },
  46. data() {
  47. return {
  48. itemData: [],
  49. page: 1,
  50. noMoreShow: false,
  51. payMoney:'',
  52. }
  53. },
  54. onLoad(opt) {
  55. this.page = 1
  56. if(opt.payMoney){
  57. this.payMoney=opt.payMoney;
  58. this.myOrderCoupon()
  59. }
  60. },
  61. methods: {
  62. ckCoupon(item){
  63. console.log(item);
  64. uni.setStorage({
  65. key: 'couponData',
  66. data: item,
  67. success: function () {
  68. uni.navigateBack({
  69. delta:1
  70. })
  71. }
  72. });
  73. },
  74. myOrderCoupon(){
  75. uni.showLoading({
  76. title: '加载中'
  77. })
  78. this.$http('worldKeepCar/maintainOrder/myOrderCoupon', {
  79. money:this.payMoney,
  80. page:this.page,
  81. limit:10,
  82. },'GET').then(res => {
  83. uni.hideLoading();
  84. var list = res.data
  85. // 处理 undefined和null转为空白字符串
  86. list.forEach((item, index) => {
  87. for (const key in item) {
  88. item[key] = this.$praseStrEmpty(item[key])
  89. }
  90. })
  91. if (this.page == 1) {
  92. this.itemData = list
  93. } else {
  94. this.itemData = this.itemData.concat(list)
  95. }
  96. if (list.length < 10) {
  97. this.noMoreShow = false
  98. } else {
  99. this.noMoreShow = true
  100. }
  101. })
  102. },
  103. goDiscountDetail(item) {
  104. uni.navigateTo({
  105. url: '../me/discountDetail?couponId=' + item.ID,
  106. })
  107. },
  108. },
  109. // 下拉刷新 上拉加载更多
  110. onPullDownRefresh() {
  111. this.page = 1
  112. if(opt.payMoney){
  113. this.myOrderCoupon()
  114. }
  115. //this.getItemData()
  116. setTimeout(function() {
  117. uni.stopPullDownRefresh();
  118. }, 1000);
  119. },
  120. onReachBottom() {
  121. this.page++;
  122. if(opt.payMoney){
  123. this.myOrderCoupon()
  124. }
  125. },
  126. }
  127. </script>
  128. <style scoped>
  129. .content {
  130. background: #F4F5F7;
  131. min-height: 100vh;
  132. }
  133. .teamTop {
  134. position: fixed;
  135. top: 0rpx;
  136. left: 0rpx;
  137. background-color: #F4F5F7;
  138. width: 100%;
  139. height: 77rpx;
  140. }
  141. .sumCount {
  142. padding: 20rpx 24rpx;
  143. color: #999999;
  144. font-size: 26rpx;
  145. }
  146. .itemContent {
  147. padding: 55rpx 20rpx 24rpx;
  148. }
  149. .item {
  150. margin: 20rpx 0rpx;
  151. background-color: #FFFFFF;
  152. border-radius: 10rpx;
  153. }
  154. .topView {
  155. display: flex;
  156. justify-content: flex-start;
  157. padding: 22rpx 0rpx;
  158. margin-left: 22rpx;
  159. margin-right: 22rpx;
  160. border-bottom: 1rpx #CCCCCC dashed;
  161. align-items: center;
  162. }
  163. .leftView,
  164. .rightView {
  165. margin-right: 40rpx;
  166. }
  167. .moneyView {
  168. display: flex;
  169. justify-content: flex-start;
  170. color: #FF4F00;
  171. align-items: baseline;
  172. }
  173. .money {
  174. font-size: 56rpx;
  175. }
  176. .condition {
  177. font-size: 22rpx;
  178. color: #999999;
  179. }
  180. .cardName {
  181. font-size: 30rpx;
  182. font-weight: bold;
  183. color: #333333;
  184. margin-top: 10rpx;
  185. margin-bottom: 15rpx;
  186. }
  187. .valid {
  188. font-size: 26rpx;
  189. color: #999999;
  190. }
  191. .bottomView {
  192. display: flex;
  193. justify-content: space-between;
  194. padding: 20rpx 24rpx;
  195. font-size: 24rpx;
  196. color: #666666;
  197. }
  198. .noMore {
  199. text-align: center;
  200. line-height: 50rpx;
  201. color: #999999;
  202. font-size: 28rpx;
  203. }
  204. </style>