list.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <zj-page-layout
  3. :hasFooter="false"
  4. :isScroll="true"
  5. :refresherTriggered="refresherTriggered"
  6. @refresherrefresh="refresherrefresh"
  7. @scrolltolower="scrolltolower">
  8. <template slot="header">
  9. <view class="header-container">
  10. <u-tabs
  11. :scrollable="false"
  12. :list="tabList"
  13. :current="curTab"
  14. @click="changeTab"
  15. lineColor="#01C30B"
  16. :activeStyle="{
  17. color: '#01C30B'
  18. }"
  19. :inactiveStyle="{
  20. color: '#666666'
  21. }"
  22. itemStyle="padding-left: 0; padding-right: 0; height: 88rpx;">
  23. </u-tabs>
  24. </view>
  25. </template>
  26. <view class="list-container">
  27. <view class="item" @tap="$navPage(`/pages/mine/myBuy/detail`)">
  28. <view class="top">
  29. <image src="@/static/common/logo.png"></image>
  30. <view class="user">
  31. <view class="name">李海</view>
  32. <view class="time">21小时前发布</view>
  33. </view>
  34. <view class="status">待付款</view>
  35. </view>
  36. <view class="goods">
  37. <image src="@/static/user/other_book.png"></image>
  38. <view class="main">
  39. <view class="name">商品名称</view>
  40. <view class="des">商品描述</view>
  41. <view class="price"><text>¥18.00</text>x2</view>
  42. </view>
  43. </view>
  44. <view class="total">订单总金额<text>¥1200.00</text></view>
  45. <view class="bottom">
  46. <view class="left-location">天河区棠下</view>
  47. <view class="right-btn">
  48. <u-button text="取消订单" shape="circle"></u-button>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </zj-page-layout>
  54. </template>
  55. <script>
  56. export default {
  57. data() {
  58. return {
  59. imgUrl: this.$imageUrl,
  60. tabList: [
  61. {name: '全部', value: 1},
  62. {name: '待付款', value: 2},
  63. {name: '待发货', value: 3},
  64. {name: '待收货', value: 4},
  65. {name: '已收货', value: 5},
  66. {name: '售后中', value: 6},
  67. ],
  68. curTab: 0,
  69. dataList: [],
  70. pageNum: 1,
  71. refresherTriggered: false,
  72. }
  73. },
  74. async onLoad() {
  75. // await this.getList()
  76. },
  77. methods: {
  78. //获取列表数据
  79. async getList() {
  80. this.$api.post('/xxx/xxxlist', {
  81. pageNum: this.pageNum,
  82. pageSize: 10,
  83. }).then(res => {
  84. this.loadStatus = 0;
  85. let list = res.data.records;
  86. if(list.length < 10){
  87. this.loadStatus = 2;
  88. }
  89. this.dataList = this.dataList.concat(list);
  90. }).catch(() => {
  91. this.loadStatus = 2;
  92. }).finally(res => {
  93. this.refresherTriggered = false;
  94. })
  95. },
  96. // 滚动到底部
  97. scrolltolower(e) {
  98. if (this.loadStatus === 0) {
  99. this.pageNum++;
  100. this.getList();
  101. }
  102. },
  103. // 触发下拉刷新
  104. refresherrefresh(e) {
  105. this.refresherTriggered = true;
  106. this.dataList = [];
  107. this.pageNum = 1;
  108. this.getList();
  109. },
  110. }
  111. }
  112. </script>
  113. <style lang="scss" scoped>
  114. .header-container {
  115. background: #ffffff;
  116. }
  117. .list-container {
  118. .item {
  119. margin-top: 30rpx;
  120. background: #ffffff;
  121. padding: 20rpx 30rpx;
  122. .top {
  123. display: flex;
  124. align-items: center;
  125. image {
  126. width: 88rpx;
  127. height: 88rpx;
  128. border-radius: 50%;
  129. flex-shrink: 0;
  130. }
  131. .user {
  132. margin-left: 20rpx;
  133. flex: 1;
  134. .name {
  135. }
  136. .time {
  137. color: $sec-font;
  138. font-size: 24rpx;
  139. margin-top: 8rpx;
  140. }
  141. }
  142. .status {
  143. color: $assist-color;
  144. }
  145. }
  146. .goods {
  147. display: flex;
  148. padding: 30rpx 0;
  149. image {
  150. width: 120rpx;
  151. height: 120rpx;
  152. }
  153. .main {
  154. flex: 1;
  155. margin-left: 20rpx;
  156. .name {
  157. font-size: 32rpx;
  158. }
  159. .des {
  160. margin-top: 12rpx;
  161. font-size: 28rpx;
  162. color: $reg-font;
  163. }
  164. .price {
  165. margin-top: 12rpx;
  166. text {
  167. color: $assist-color;
  168. font-weight: 500;
  169. font-size: 32rpx;
  170. margin-right: 12rpx;
  171. }
  172. }
  173. }
  174. }
  175. .total {
  176. border-top: 1px solid #eaeaea;
  177. height: 80rpx;
  178. display: flex;
  179. align-items: center;
  180. justify-content: end;
  181. font-size: 28rpx;
  182. text {
  183. margin-left: 12rpx;
  184. color: $assist-color;
  185. }
  186. }
  187. .bottom {
  188. border-top: 1px solid #eaeaea;
  189. padding-top: 20rpx;
  190. display: flex;
  191. align-items: center;
  192. justify-content: space-between;
  193. .left-location {
  194. font-size: 24rpx;
  195. color: $sec-font;
  196. }
  197. .right-btn {
  198. .u-button {
  199. height: 60rpx;
  200. }
  201. }
  202. }
  203. }
  204. }
  205. </style>