金诚优选前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

203 lines
5.1 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <template>
  2. <view>
  3. <lf-nav title="兑换记录" :showIcon="true" bgColor="#fff"></lf-nav>
  4. <view class="head">
  5. <u-search placeholder="搜你想要的" v-model="value" @custom="onSearch" @search="onSearch" @clear="clearSearch"></u-search>
  6. </view>
  7. <scroll-view :style="{height: autoHeight}" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="isRefresher"
  8. @scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh" >
  9. <view class="content">
  10. <view class="card" v-for="(item, index) in list" :key="index" @click="$url('/pages/order/newdetail/newdetail?type=point&order_id='+item.order_no)">
  11. <view>
  12. <text class="lf-iconfont icon-Group- lf-font-30"></text>
  13. <text class="shop-name">{{item.brand.name}}</text>
  14. <text class="lf-iconfont icon-xiangyou lf-font-24"></text>
  15. </view>
  16. <view class="lf-flex lf-m-t-20" v-for="(item2,index2) of item.items" :key="index2">
  17. <image class="goods-img" :src="item2.item_meta.image"></image>
  18. <view class="info">
  19. <view class="lf-font-26 lf-color-333 lf-line-2">{{item2.item_name}}</view>
  20. <view class="lf-row-between" style="line-height: 1;">
  21. <text class="lf-font-24 lf-color-777">{{item2.item_meta.specs_text}}</text>
  22. <text class="lf-font-32 lf-color-primary lf-font-bold">{{item2.redeem_point}}积分</text>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="order-num">
  27. <text>{{item.status_text}}</text>
  28. <!-- <text style="color: #F63434;">删除订单</text> -->
  29. </view>
  30. </view>
  31. <!-- 空数据的情况 -->
  32. <view class="loading-more">
  33. <text v-if="list.length != 0"
  34. :class="{'loading-more-text': loadingClass}">{{ loadingText }}</text>
  35. <lf-nocontent src="/static/images/empty.png" v-else></lf-nocontent>
  36. </view>
  37. </view>
  38. </scroll-view>
  39. <u-back-top :scrollTop="pageScrollTop"></u-back-top>
  40. </view>
  41. </template>
  42. <script>
  43. export default {
  44. data(){
  45. return {
  46. value: '',
  47. list: [],
  48. page: 1,
  49. isPage: true,
  50. loadingClass: true,
  51. loadingText: '正在加载中',
  52. scrollH: 0,
  53. nav_height: 0,
  54. isRefresher: true,
  55. pageSize: 10,
  56. is_search: false // 当前是否处于搜索中状态
  57. }
  58. },
  59. computed: {
  60. autoHeight(){
  61. return `calc(${this.scrollH}px - ${this.nav_height}px - 180rpx - 120rpx)`;
  62. }
  63. },
  64. onLoad(){
  65. let info = uni.getSystemInfoSync();
  66. this.scrollH = info.screenHeight;
  67. this.getPointOrder()
  68. },
  69. methods: {
  70. // 页面触底,加载下一页
  71. onScrolltolower(){
  72. if(this.isPage){
  73. this.page = this.page + 1;
  74. this.getPointOrder();
  75. }
  76. },
  77. // 下拉刷新处理
  78. refreshFn(options){
  79. this.page = 1;
  80. this.isPage = true;
  81. this.loadingClass = true;
  82. this.list = []
  83. this.loadingText = '正在加载中';
  84. this.getPointOrder(options);
  85. },
  86. // scroll-view 下拉刷新
  87. onRefresherrefresh(){
  88. this.isRefresher = true;
  89. this.refreshFn({type: 'scrollRefresh'});
  90. },
  91. // 触发搜索
  92. onSearch(event){
  93. console.log(event)
  94. if(event){
  95. this.is_search = true;
  96. }else{
  97. this.is_search = false;
  98. }
  99. this.page = 1;
  100. this.isPage = true;
  101. this.loadingClass = true;
  102. this.list = []
  103. this.loadingText = '正在加载中';
  104. this.getPointOrder();
  105. },
  106. // 清除搜索内容
  107. clearSearch(){
  108. if(this.is_search){
  109. this.onSearch(false);
  110. }
  111. },
  112. getPointOrder(options = {}){
  113. let par = {
  114. page: this.page
  115. }
  116. if(this.is_search && this.value){
  117. par.keyword = this.value;
  118. }
  119. this.$http.get({
  120. api: 'api/order/point/list',
  121. header: {
  122. Authorization: this.$cookieStorage.get('user_token')
  123. },
  124. data: par
  125. }).then(res => {
  126. console.log("----", res);
  127. let isPage = this.page < res.data.meta.pagination.total_pages?true:false;
  128. this.isPage = isPage;
  129. if(!isPage) {
  130. this.loadingClass = false;
  131. this.loadingText = '没有更多数据啦~';
  132. }
  133. if(options.type == 'pageRefresh') {
  134. uni.stopPullDownRefresh();
  135. }else if(options.type == 'scrollRefresh') {
  136. this.isRefresher = false;
  137. }
  138. if(this.page == 1) {
  139. this.list = res.data.data;
  140. }else {
  141. this.list.push(...res.data.data);
  142. }
  143. })
  144. }
  145. }
  146. }
  147. </script>
  148. <style>
  149. page{
  150. background-color: #F8F8F8;
  151. }
  152. </style>
  153. <style lang="scss" scoped="scoped">
  154. .head{
  155. padding: 30rpx 32rpx;
  156. background-color: #FFFFFF;
  157. }
  158. .content{
  159. padding: 30rpx 32rpx;
  160. .card{
  161. width: 686rpx;
  162. height: 323rpx;
  163. background: #FFFFFF;
  164. border-radius: 20rpx;
  165. padding: 30rpx;
  166. box-sizing: border-box;
  167. &:nth-child(n+2){
  168. margin-top: 20rpx;
  169. }
  170. .shop-name{
  171. font-size: 28rpx;
  172. color: #222222;
  173. font-weight: bold;
  174. margin: 0 15rpx;
  175. }
  176. .goods-img{
  177. width: 130rpx;
  178. height: 130rpx;
  179. border-radius: 5rpx;
  180. margin-right: 15rpx;
  181. background-color: #EEEEEE;
  182. }
  183. .info{
  184. width: 480rpx;
  185. height: 130rpx;
  186. display: flex;
  187. flex-direction: column;
  188. justify-content: space-between;
  189. }
  190. .order-num{
  191. font-size: 24rpx;
  192. color: #555555;
  193. display: flex;
  194. justify-content: space-between;
  195. margin-top: 28rpx;
  196. }
  197. }
  198. }
  199. </style>