team.vue 8.7 KB

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