index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <template>
  2. <block>
  3. <!-- <view class="select">
  4. <view class="selectItem" @tap="changeStatus" data-status="id">
  5. <view>入团时间排序</view>
  6. <image :src="
  7. order == 'id'
  8. ? sort == 'asc'
  9. ? 'https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/a970f9087def9ba466276f8a9ee59b1b.png'
  10. : 'https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/5f1df0376dd2a026fdd14ca4d1d39974.png'
  11. : 'https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/996fff6601b828ee6fcc46b1217b2d1a.png'
  12. " mode="widthFix"></image>
  13. </view>
  14. <view class="selectItem" @tap="changeStatus" data-status="order">
  15. <view>订单数量</view>
  16. <image :src="
  17. order == 'order_num'
  18. ? sort == 'asc'
  19. ? 'https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/a970f9087def9ba466276f8a9ee59b1b.png'
  20. : 'https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/5f1df0376dd2a026fdd14ca4d1d39974.png'
  21. : 'https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/996fff6601b828ee6fcc46b1217b2d1a.png'
  22. " mode="widthFix"></image>
  23. </view>
  24. </view> -->
  25. <view class="mItem" v-for="(item, index) in list" :key="index">
  26. <image
  27. :src="item.avatar || 'https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/a035c7dae49cc9904c7b0977895ffb1e.png'">
  28. </image>
  29. <view class="mInfo">
  30. <view class="info1">
  31. <view>
  32. {{ item.username }}
  33. <text class="fz28">{{ item.mobile }}</text>
  34. </view>
  35. <view>{{ item.orderNum }}</view>
  36. </view>
  37. <view class="info2">
  38. <view>入团:{{ parse.filterTime(item.createtime) }}</view>
  39. <view>推广订单</view>
  40. </view>
  41. </view>
  42. </view>
  43. <view v-if="!list.length" style="color: #999; text-align: center; margin: 100rpx 0">暂无数据</view>
  44. </block>
  45. </template>
  46. <script module="parse" lang="wxs">
  47. module.exports = {
  48. filterTime: function(value) {
  49. var nowDate = getDate(value * 1000); //过期时间
  50. var year = nowDate.getFullYear(); //当前年份
  51. var month = nowDate.getMonth() + 1; //当前月份
  52. var date = nowDate.getDate(); //当前几号
  53. var hours = nowDate.getHours(); //当前几小时
  54. return year + '-' + month + '-' + date
  55. }
  56. }
  57. </script>
  58. <script>
  59. // pages/tabbar/index/index.js
  60. var app = getApp();
  61. export default {
  62. data() {
  63. return {
  64. list: [],
  65. loaded: false,
  66. page: 1,
  67. order: 'id',
  68. //id是入团时间 order_num是订单数
  69. //asc升序,desc降序
  70. sort: 'asc',
  71. type: 0,
  72. pageSize:10
  73. };
  74. },
  75. onLoad: function(options) {
  76. uni.setNavigationBarTitle({
  77. title: '我的团队'
  78. });
  79. this.getlist();
  80. },
  81. onPullDownRefresh: function() {},
  82. onReachBottom: function() {
  83. this.loaded || this.getlist();
  84. },
  85. onShareAppMessage: function() {},
  86. methods: {
  87. changeStatus(e) {
  88. var that = this;
  89. var status = e.currentTarget.dataset.status;
  90. var order = this.order;
  91. var sort = this.sort;
  92. if (status == 'id') {
  93. //点的是入团时间排序
  94. if (order == 'id') {
  95. // 之前也是筛选的入团时间
  96. if (sort == 'asc') {
  97. that.sort = 'desc'
  98. } else {
  99. that.sort = 'asc'
  100. }
  101. } else {
  102. //之前筛选的订单数量 那就要变成入团时间排序 并且默认升序
  103. that.order = 'id'
  104. that.sort = 'asc'
  105. }
  106. } else {
  107. //点的是订单数量
  108. if (order == 'order_num') {
  109. // 之前也是筛选的入团时间
  110. if (sort == 'asc') {
  111. that.sort = 'desc'
  112. } else {
  113. that.sort = 'asc'
  114. }
  115. } else {
  116. //之前筛选的订单数量 那就要变成入团时间排序 并且默认升序
  117. that.order = 'order_num'
  118. that.sort = 'asc'
  119. }
  120. }
  121. that.init();
  122. that.getlist();
  123. },
  124. toPage(e) {
  125. app.globalData.toPage(e);
  126. },
  127. init() {
  128. this.page = 1
  129. this.loaded = false
  130. this.list = []
  131. },
  132. async getlist() {
  133. var that = this;
  134. let res = await this.$api.request('/team/index', 'GET', {
  135. page: that.page,
  136. pagesize: that.pageSize,
  137. order: that.order,
  138. sort: that.sort
  139. });
  140. console.log(res)
  141. if (res) {
  142. if (res.length > 0) {
  143. this.list = this.list.concat(res);
  144. this.page++;
  145. // uni.setNavigationBarTitle({
  146. // title: '我的团队(' + res.total + ')'
  147. // });
  148. } else {
  149. this.loaded = true
  150. this.$api.msg('没有更多数据');
  151. }
  152. }
  153. }
  154. }
  155. };
  156. </script>
  157. <style>
  158. page {
  159. background: #f4f5f9;
  160. }
  161. .select {
  162. padding: 30rpx 0 20rpx 0;
  163. background: #fff;
  164. display: flex;
  165. align-items: center;
  166. justify-content: space-around;
  167. }
  168. .selectItem {
  169. display: flex;
  170. align-items: center;
  171. }
  172. .selectItem>view {
  173. font-size: 28rpx;
  174. }
  175. .selectItem>image {
  176. width: 26rpx;
  177. margin-left: 12rpx;
  178. }
  179. .mItem {
  180. margin: 25rpx 30rpx 0;
  181. background: #fff;
  182. padding: 28rpx 20rpx;
  183. display: flex;
  184. align-items: center;
  185. }
  186. .mItem>image {
  187. width: 110rpx;
  188. height: 110rpx;
  189. border-radius: 50%;
  190. margin-right: 25rpx;
  191. }
  192. .mInfo {
  193. flex: 1;
  194. height: 110rpx;
  195. display: flex;
  196. flex-direction: column;
  197. justify-content: center;
  198. }
  199. .info1 {
  200. display: flex;
  201. align-items: center;
  202. justify-content: space-between;
  203. padding-right: 36rpx;
  204. }
  205. .info1>view:nth-child(1) {
  206. font-size: 34rpx;
  207. }
  208. .fz28 {
  209. font-size: 28rpx;
  210. }
  211. .info1>view:nth-child(2) {
  212. color: #1479ff;
  213. font-size: 34rpx;
  214. }
  215. .info2 {
  216. display: flex;
  217. align-items: center;
  218. justify-content: space-between;
  219. margin-top: 26rpx;
  220. }
  221. .info2>view:nth-child(1) {
  222. color: #9194a6;
  223. }
  224. .info2>view:nth-child(2) {
  225. color: #7B9D3E;
  226. }
  227. .fb {
  228. height: 112rpx;
  229. width: 100%;
  230. position: fixed;
  231. bottom: 0;
  232. background: #fff;
  233. display: flex;
  234. justify-content: center;
  235. align-items: center;
  236. }
  237. .addAddress {
  238. width: 670rpx;
  239. height: 80rpx;
  240. display: flex;
  241. justify-content: center;
  242. align-items: center;
  243. background: #1479ff;
  244. border-radius: 50rpx;
  245. }
  246. .addAddress>view {
  247. color: #fff;
  248. font-size: 30rpx;
  249. }
  250. .addAddress>image {
  251. width: 30rpx;
  252. margin-right: 14rpx;
  253. }
  254. view {
  255. font-size: 24rpx;
  256. }
  257. </style>