team.vue 7.5 KB

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