team.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. <template>
  2. <view class="content">
  3. <view class="status_bar"></view>
  4. <view class="top-wrap flex">
  5. <view class="item">
  6. <view class="">
  7. 下级人数
  8. </view>
  9. <view class="val">
  10. 90
  11. </view>
  12. </view>
  13. <view class="item">
  14. <view class="">
  15. 团队业绩
  16. </view>
  17. <view class="val">
  18. ¥900
  19. </view>
  20. </view>
  21. </view>
  22. <!-- <view class="content-money">
  23. <view class="body-title">
  24. <view class="goback-box" @click="toBack">
  25. <image class="goback" src="../../static/icon/fanhui.png" mode=""></image>
  26. </view>
  27. <view class="header">我的推广</view>
  28. </view>
  29. <view class="content-bg">
  30. <image src="../../static/img/tg-bg.png" mode=""></image>
  31. </view>
  32. <view class="money-box">
  33. <view class="money">{{ alls|| '0' }}</view>
  34. <view>我的团队</view>
  35. </view>
  36. </view> -->
  37. <swiper :current="tabCurrentIndex" :style="{ height: maxheight }" class="swiper-box" duration="300"
  38. @change="changeTab" disable-touch>
  39. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  40. <scroll-view class="list-scroll-content" :style="{ height: maxheight }" scroll-y
  41. @scrolltolower="loadData">
  42. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  43. <view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item">
  44. <view class="top flex">
  45. <view class="name clamp">
  46. {{item.nickname}}
  47. </view>
  48. <image src="https://stx2.qiniu1314.com/static/img/level0.png" mode="" class="gp"></image>
  49. <view class="tc">
  50. </view>
  51. <image src="../../static/icon/call.png" mode="" class="call"></image>
  52. </view>
  53. <view class="info">
  54. <view class="info-item flex">
  55. <view class="">
  56. 待处理单数:<text>5</text>
  57. </view>
  58. <view class="">
  59. 待处理单数:<text>5</text>
  60. </view>
  61. <view class="">
  62. 待处理单数:<text>5</text>
  63. </view>
  64. </view>
  65. <view class="info-val flex">
  66. <view class="">
  67. 累计金额:<text>¥5000</text>
  68. </view>
  69. <view class="more">
  70. 查看明细<image src="../../static/index/in-go.png" mode=""></image>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  76. </scroll-view>
  77. </swiper-item>
  78. </swiper>
  79. </view>
  80. </template>
  81. <script>
  82. import {
  83. myspread,
  84. getLevelList
  85. } from '@/api/user.js';
  86. import empty from '@/components/empty';
  87. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  88. import {
  89. mapState,
  90. mapMutations
  91. } from 'vuex';
  92. export default {
  93. components: {
  94. empty,
  95. uniLoadMore
  96. },
  97. onReady(res) {
  98. var _this = this;
  99. uni.getSystemInfo({
  100. success: resu => {
  101. const query = uni.createSelectorQuery();
  102. query.select('.swiper-box').boundingClientRect();
  103. query.exec(function(res) {
  104. _this.maxheight = resu.windowHeight - res[0].top + 'px';
  105. console.log('打印页面的剩余高度', _this.height);
  106. });
  107. },
  108. fail: res => {}
  109. });
  110. },
  111. data() {
  112. return {
  113. // 头部图高度
  114. maxheight: '',
  115. tabCurrentIndex: 0,
  116. navList: [{
  117. state: 0,
  118. text: '直接推荐',
  119. loadingType: 'more',
  120. orderList: [],
  121. page: 1, //当前页数
  122. limit: 10 //每次信息条数
  123. },
  124. {
  125. state: 1,
  126. text: '间接推荐',
  127. loadingType: 'more',
  128. orderList: [],
  129. page: 1, //当前页数
  130. limit: 10 //每次信息条数
  131. }],
  132. alls: 0,
  133. all: '',
  134. list: '',
  135. totalLevel: '',
  136. order: '',
  137. zt_order: '',
  138. jt_order: '',
  139. listList: []
  140. };
  141. },
  142. computed: {
  143. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
  144. ...mapState(['baseURL'])
  145. },
  146. onLoad(options) {},
  147. onShow() {
  148. this.loadData();
  149. getLevelList().then(res => {
  150. console.log(res);
  151. this.listList = res.data.list
  152. })
  153. },
  154. methods: {
  155. showLevel(val) {
  156. let data = this.listList.find(item => item.grade == val.level)
  157. if(data) {
  158. return data.name
  159. }else {
  160. if(val.orderCount > 0) {
  161. return '会员'
  162. }else {
  163. return '粉丝'
  164. }
  165. }
  166. },
  167. // 页面跳转
  168. navto(e) {
  169. uni.navigateTo({
  170. url: e
  171. });
  172. },
  173. //获取收入支出信息
  174. async loadData(source) {
  175. //这里是将订单挂载到tab列表下
  176. let index = this.tabCurrentIndex;
  177. let navItem = this.navList[index];
  178. let state = navItem.state;
  179. if (source === 'tabChange' && navItem.loaded === true) {
  180. //tab切换只有第一次需要加载数据
  181. return;
  182. }
  183. if (navItem.loadingType === 'loading') {
  184. //防止重复加载
  185. return;
  186. }
  187. if (navItem.loadingType === 'noMore') {
  188. //防止重复加载
  189. return;
  190. }
  191. // 修改当前对象状态为加载中
  192. navItem.loadingType = 'loading';
  193. myspread({
  194. page: navItem.page,
  195. limit: navItem.limit,
  196. grade:state,
  197. uid: this.userInfo.uid
  198. })
  199. .then(({
  200. data
  201. }) => {
  202. console.log(data,'的');
  203. this.order = data.order
  204. this.zt_order = data.zt_order
  205. this.jt_order = data.jt_order
  206. this.all = data.total;
  207. this.alls = data.all;
  208. this.totalLevel = data.totalLevel
  209. if (data.list.length > 0) {
  210. this.list = data.list;
  211. navItem.orderList = navItem.orderList.concat(data.list);
  212. navItem.page++;
  213. }
  214. this.$nextTick(function() {
  215. if (navItem.limit == data.list.length) {
  216. //判断是否还有数据, 有改为 more, 没有改为noMore
  217. navItem.loadingType = 'more';
  218. return;
  219. } else {
  220. //判断是否还有数据, 有改为 more, 没有改为noMore
  221. navItem.loadingType = 'noMore';
  222. }
  223. });
  224. this.$set(navItem, 'loaded', true);
  225. })
  226. .catch(e => {
  227. console.log(e);
  228. });
  229. },
  230. //swiper 切换
  231. changeTab(e) {
  232. this.tabCurrentIndex = e.target.current;
  233. this.loadData('tabChange');
  234. },
  235. //顶部tab点击
  236. tabClick(index) {
  237. this.tabCurrentIndex = index;
  238. },
  239. // 点击返回 我的页面
  240. toBack() {
  241. uni.switchTab({
  242. url: '/pages/user/user'
  243. });
  244. }
  245. }
  246. };
  247. </script>
  248. <style lang="scss">
  249. page {
  250. background: #f8f8f8;
  251. height: 100%;
  252. }
  253. .status_bar {
  254. height: var(--status-bar-height);
  255. width: 100%;
  256. background: #5dbc7c;
  257. }
  258. .top-wrap {
  259. background-color: $base-color;
  260. padding: 34rpx 32rpx;
  261. .item {
  262. width: 327rpx;
  263. height: 152rpx;
  264. padding: 30rpx 0 0 30rpx;
  265. background: #FFFFFF;
  266. border-radius: 16rpx;
  267. font-size: 28rpx;
  268. font-weight: bold;
  269. color: #303133;
  270. view {
  271. padding-bottom: 15rpx;
  272. }
  273. .val {
  274. font-size: 36rpx;
  275. }
  276. }
  277. }
  278. .order-item {
  279. width: 684rpx;
  280. background: #FFFFFF;
  281. border-radius: 16rpx;
  282. margin: 0 auto 20rpx;
  283. .top {
  284. width: 684rpx;
  285. height: 76rpx;
  286. background: #E9EEFF;
  287. border-radius: 16rpx 16rpx 0 0;
  288. justify-content: flex-start;
  289. padding:0 32rpx;
  290. .name {
  291. width: 150rpx;
  292. }
  293. .gp {
  294. width: 150rpx;
  295. height: 48rpx;
  296. }
  297. .tc {
  298. flex-grow: 1;
  299. }
  300. .call {
  301. width: 52rpx;
  302. height: 52rpx;
  303. }
  304. }
  305. .info {
  306. // height: 164rpx;
  307. .info-item {
  308. width: 618rpx;
  309. margin: auto;
  310. height: 80rpx;
  311. font-size: 28rpx;
  312. border-bottom:#DDE1EB 1px solid;
  313. text {
  314. font-weight: bold;
  315. }
  316. }
  317. .info-val {
  318. padding:0 33rpx;
  319. height: 80rpx;
  320. font-weight: 500;
  321. font-size: 28rpx;
  322. color: #303133;
  323. text {
  324. font-weight: bold;
  325. font-size: 28rpx;
  326. color: #FF6B2E;
  327. }
  328. .more {
  329. font-weight: 500;
  330. font-size: 24rpx;
  331. color: #999999;
  332. }
  333. image {
  334. display: inline-block;
  335. margin-left: 10rpx;
  336. width: 10rpx;
  337. height: 20rpx;
  338. vertical-align: middle;
  339. }
  340. }
  341. }
  342. }
  343. .list-scroll-content {
  344. padding-top: 20rpx;
  345. }
  346. </style>