index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  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/762843841e1964468d3b1f72117a7a6e.png'
  10. : 'https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/0c180f41253fc7bc5ac4fd2d69f5d480.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/762843841e1964468d3b1f72117a7a6e.png'
  20. : 'https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/0c180f41253fc7bc5ac4fd2d69f5d480.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 class="mItem" v-for="(item, index) in list" :key="index">
  44. <view class="mtop">
  45. <image class="avatar"
  46. :src="item.avatar || 'https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/a035c7dae49cc9904c7b0977895ffb1e.png'">
  47. </image>
  48. <view class="mInfo">
  49. <view class="info1">
  50. <view>
  51. {{ item.username }}
  52. </view>
  53. <view>入团:{{ parse.filterTime(item.createtime) }}</view>
  54. </view>
  55. <view class="info2">
  56. <view>{{ item.mobile || '暂无手机号码'}}</view>
  57. <view>自购(单):
  58. <text class="fw700"> {{ item.orderNum }} </text>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="mbot">
  64. <view class="mleve">
  65. {{item.groupName}}
  66. </view>
  67. <view class="mInfo2">
  68. <view class="info3">
  69. <view>
  70. 下级(人): <text class="fw700"> {{item.childCount}} </text>
  71. </view>
  72. <view>下级推广(单):<text class="fw700">{{item.childOrderNum}} </text> </view>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. <view v-if="!list.length" style="color: #999; text-align: center; margin: 100rpx 0">暂无数据</view>
  78. </block>
  79. </template>
  80. <script module="parse" lang="wxs">
  81. module.exports = {
  82. filterTime: function(value) {
  83. var nowDate = getDate(value * 1000); //过期时间
  84. var year = nowDate.getFullYear(); //当前年份
  85. var month = nowDate.getMonth() + 1; //当前月份
  86. var date = nowDate.getDate(); //当前几号
  87. var hours = nowDate.getHours(); //当前几小时
  88. return year + '-' + month + '-' + date
  89. }
  90. }
  91. </script>
  92. <script>
  93. // pages/tabbar/index/index.js
  94. var app = getApp();
  95. export default {
  96. data() {
  97. return {
  98. list: [],
  99. loaded: false,
  100. page: 1,
  101. order: 'id',
  102. //id是入团时间 order_num是订单数
  103. //asc升序,desc降序
  104. sort: 'asc',
  105. type: 0,
  106. pageSize: 10
  107. };
  108. },
  109. onLoad: function(options) {
  110. uni.setNavigationBarTitle({
  111. title: '我的团队'
  112. });
  113. this.getlist();
  114. },
  115. onPullDownRefresh: function() {},
  116. onReachBottom: function() {
  117. this.loaded || this.getlist();
  118. },
  119. onShareAppMessage: function() {},
  120. methods: {
  121. changeStatus(e) {
  122. var that = this;
  123. var status = e.currentTarget.dataset.status;
  124. var order = this.order;
  125. var sort = this.sort;
  126. if (status == 'id') {
  127. //点的是入团时间排序
  128. if (order == 'id') {
  129. // 之前也是筛选的入团时间
  130. if (sort == 'asc') {
  131. that.sort = 'desc'
  132. } else {
  133. that.sort = 'asc'
  134. }
  135. } else {
  136. //之前筛选的订单数量 那就要变成入团时间排序 并且默认升序
  137. that.order = 'id'
  138. that.sort = 'asc'
  139. }
  140. } else {
  141. //点的是订单数量
  142. if (order == 'order_num') {
  143. // 之前也是筛选的入团时间
  144. if (sort == 'asc') {
  145. that.sort = 'desc'
  146. } else {
  147. that.sort = 'asc'
  148. }
  149. } else {
  150. //之前筛选的订单数量 那就要变成入团时间排序 并且默认升序
  151. that.order = 'order_num'
  152. that.sort = 'asc'
  153. }
  154. }
  155. that.init();
  156. that.getlist();
  157. },
  158. toPage(e) {
  159. app.globalData.toPage(e);
  160. },
  161. init() {
  162. this.page = 1
  163. this.loaded = false
  164. this.list = []
  165. },
  166. async getlist() {
  167. var that = this;
  168. let res = await this.$api.request('/team/index', 'GET', {
  169. page: that.page,
  170. pagesize: that.pageSize,
  171. order: that.order,
  172. sort: that.sort
  173. });
  174. console.log(res)
  175. if (res) {
  176. if (res.data.length > 0) {
  177. this.list = this.list.concat(res.data);
  178. this.page++;
  179. // uni.setNavigationBarTitle({
  180. // title: '我的团队(' + res.total + ')'
  181. // });
  182. } else {
  183. this.loaded = true
  184. this.$api.msg('没有更多数据');
  185. }
  186. }
  187. }
  188. }
  189. };
  190. </script>
  191. <style>
  192. page {
  193. background: #f4f5f9;
  194. }
  195. .select {
  196. padding: 30rpx 0 20rpx 0;
  197. background: #fff;
  198. display: flex;
  199. align-items: center;
  200. justify-content: space-around;
  201. }
  202. .selectItem {
  203. display: flex;
  204. align-items: center;
  205. }
  206. .selectItem>view {
  207. font-size: 28rpx;
  208. }
  209. .selectItem>image {
  210. width: 26rpx;
  211. margin-left: 12rpx;
  212. }
  213. .mItem {
  214. margin: 25rpx 30rpx 0;
  215. background: #fff;
  216. padding: 28rpx 20rpx;
  217. }
  218. .mtop {
  219. display: flex;
  220. align-items: center;
  221. }
  222. .mleve{
  223. width: 130rpx;
  224. height: 40rpx;
  225. border-radius: 40rpx;
  226. display: flex;
  227. align-items: center;
  228. justify-content: center;
  229. background: #FB4C6F;
  230. color: #fff;
  231. margin-left: -10rpx;
  232. font-size: 24rpx;
  233. margin-top: 12rpx;
  234. }
  235. .mbot {
  236. display: flex;
  237. align-items: center;
  238. }
  239. .avatar {
  240. width: 110rpx;
  241. height: 110rpx;
  242. border-radius: 50%;
  243. margin-right: 25rpx;
  244. }
  245. .mInfo {
  246. flex: 1;
  247. height: 110rpx;
  248. display: flex;
  249. flex-direction: column;
  250. justify-content: center;
  251. border-bottom: 1px solid #F3F0F3;
  252. padding-bottom: 14rpx;
  253. }
  254. .mInfo2 {
  255. flex: 1;
  256. display: flex;
  257. flex-direction: column;
  258. justify-content: center;
  259. margin-top: 12rpx;
  260. margin-left: 12rpx;
  261. }
  262. .info1 {
  263. display: flex;
  264. align-items: center;
  265. justify-content: space-between;
  266. }
  267. .info1>view:nth-child(1) {
  268. font-size: 30rpx;
  269. color: ;
  270. }
  271. .fz28 {
  272. font-size: 28rpx;
  273. }
  274. .info1>view:nth-child(2) {
  275. color: #8E8E8E;
  276. font-size: 24rpx;
  277. }
  278. .info2 {
  279. display: flex;
  280. align-items: center;
  281. justify-content: space-between;
  282. margin-top: 26rpx;
  283. }
  284. .info2>view:nth-child(1) {
  285. color: #010101;
  286. font-size: 24rpx;
  287. }
  288. .info2>view:nth-child(2) {
  289. color: #8E8E8E;
  290. }
  291. .fb {
  292. height: 112rpx;
  293. width: 100%;
  294. position: fixed;
  295. bottom: 0;
  296. background: #fff;
  297. display: flex;
  298. justify-content: center;
  299. align-items: center;
  300. }
  301. .info3 {
  302. display: flex;
  303. align-items: center;
  304. justify-content: space-between;
  305. font-size: 24rpx;
  306. color: #8E8E8E;
  307. }
  308. .fw700{
  309. font-weight: 700;
  310. color: #010101;
  311. margin-left: 4rpx;
  312. }
  313. .addAddress {
  314. width: 670rpx;
  315. height: 80rpx;
  316. display: flex;
  317. justify-content: center;
  318. align-items: center;
  319. background: #1479ff;
  320. border-radius: 50rpx;
  321. }
  322. .addAddress>view {
  323. color: #fff;
  324. font-size: 30rpx;
  325. }
  326. .addAddress>image {
  327. width: 30rpx;
  328. margin-right: 14rpx;
  329. }
  330. view {
  331. font-size: 24rpx;
  332. }
  333. </style>