sz.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="content-money">
  5. <view class="status_bar"><!-- 这里是状态栏 --></view>
  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" v-if="type == 5">我的贡献值</view>
  9. <view class="header" v-if="type == 6">我的分红点</view>
  10. <view class="header" v-if="type == 7">我的分红额</view>
  11. <view class="header" v-if="type == 10">我的C积分</view>
  12. <view class="header" v-if="type == 13">我的肥料</view>
  13. </view>
  14. <view class="content-bg"><image src="../../static/user/tg-bg.png" mode=""></image></view>
  15. <view class="money-box">
  16. <template v-if="type == 10">
  17. <view class="money" >{{ userInfo.integral }}</view>
  18. <view >C积分</view>
  19. </template>
  20. <template v-if="type == 6">
  21. <view class="money" >{{ userInfo.dividend_points }}</view>
  22. <view >分红点</view>
  23. </template>
  24. <template v-if="type == 7">
  25. <view class="money" >{{ userInfo.dividend_amount }}</view>
  26. <view >分红额</view>
  27. </template>
  28. <template v-if="type == 13">
  29. <view class="money" >{{ userInfo.recommend_speed }}</view>
  30. <view >肥料</view>
  31. </template>
  32. </view>
  33. <view class="moneybtn-box">
  34. <template v-if="type == 5">
  35. <view class="money-btn" @click="navto('/pages/user/gxdh?type=1')">转换报单币</view>
  36. <view class="money-btn" ></view>
  37. <view class="money-btn" @click="navto('/pages/user/gxdh?type=2')">转换佣金</view>
  38. </template>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="navbar">
  43. <view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  44. </view>
  45. <swiper :current="tabCurrentIndex" :style="{ height: maxheight }" class="swiper-box" duration="300" @change="changeTab">
  46. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex" :style="{ height: maxheight }">
  47. <scroll-view scroll-y="true" class="list-scroll-content" @scrolltolower="getList()" :style="{ height: maxheight }" >
  48. <!-- 空白页 -->
  49. <empty v-if="tabItem.loaded && tabItem.orderList.length === 0"></empty>
  50. <!-- 订单列表 -->
  51. <view class="order-item flex" v-for="(item, index) in tabItem.orderList" :key="index">
  52. <view class="title-box">
  53. <view class="title">
  54. <text>{{ item.mark||item.title }}</text>
  55. </view>
  56. <view class="time">
  57. <text>{{ item.add_time }}</text>
  58. </view>
  59. </view>
  60. <view class="money">
  61. <text>{{ (item.pm == 0 ? '-' : '+') + item.number }}</text>
  62. </view>
  63. </view>
  64. <uni-load-more :status="tabItem.loadingType" v-if="tabItem.loaded == false || tabItem.orderList.length > 0"></uni-load-more>
  65. </scroll-view>
  66. </swiper-item>
  67. </swiper>
  68. </view>
  69. </template>
  70. <script>
  71. import empty from '@/components/empty';
  72. import {
  73. mapState,
  74. mapMutations
  75. } from 'vuex';
  76. import { spreadCommission } from '@/api/wallet.js';
  77. export default {
  78. components: {
  79. empty
  80. },
  81. data() {
  82. return {
  83. maxheight: '',
  84. tabCurrentIndex: 0,
  85. navList: [
  86. {
  87. state: 1,
  88. text: '收入',
  89. loadingType: 'more',
  90. orderList: [],
  91. page: 1, //当前页面
  92. limit: 10 //每次信息条数
  93. },
  94. {
  95. state: 0,
  96. text: '支出',
  97. loadingType: 'more',
  98. orderList: [],
  99. page: 1, //当前页面
  100. limit: 10 //每次信息条数
  101. }
  102. ],
  103. type: 0,//1-复投积分 2-佣金 3-分红额度 4-消费积分
  104. }
  105. },
  106. onLoad(opt) {
  107. this.type = opt.type
  108. },
  109. computed: {
  110. ...mapState('user',['userInfo'])
  111. },
  112. onShow() {
  113. this.getList()
  114. },
  115. onReady(res) {
  116. var _this = this;
  117. uni.getSystemInfo({
  118. success: resu => {
  119. const query = uni.createSelectorQuery();
  120. query.select('.swiper-box').boundingClientRect();
  121. query.exec(function(res) {
  122. _this.maxheight = resu.windowHeight - res[0].top + 'px';
  123. console.log('打印页面的剩余高度', _this.maxheight);
  124. });
  125. },
  126. fail: res => {}
  127. });
  128. },
  129. methods:{
  130. navto(url) {
  131. uni.navigateTo({
  132. url
  133. })
  134. },
  135. //顶部tab点击
  136. tabClick(index) {
  137. this.tabCurrentIndex = index;
  138. },
  139. changeTab(res) {
  140. console.log(res);
  141. let that = this
  142. that.tabCurrentIndex = res.detail.current
  143. that.getList('tab')
  144. },
  145. getList(type) {
  146. let that = this
  147. let item = that.navList[that.tabCurrentIndex]
  148. let status = 0
  149. let qdata = {
  150. page: item.page,
  151. limit: item.limit,
  152. }
  153. if(type == 'tab' && item.loaded) {
  154. return
  155. }
  156. if(item.loadingType == 'noMore' || item.loadingType == 'loading') {
  157. return
  158. }
  159. item.loadingType = 'loading'
  160. if(that.type == 2 || that.type ==4) {
  161. if(that.type == 2 ) {
  162. if(item.state == 1) {
  163. status =3
  164. }else {
  165. status = 4
  166. }
  167. }else {
  168. if(item.state == 1) {
  169. status = 2
  170. }else {
  171. status =1
  172. }
  173. }
  174. }else {
  175. if(that.type == 1) {
  176. status = 7
  177. qdata.category = 'resumption'
  178. if(item.state == 1) {
  179. qdata.pm = 1
  180. }else {
  181. qdata.pm = 0
  182. }
  183. }else if(that.type == 3){
  184. status = 6
  185. qdata.category = 'pool'
  186. if(item.state == 1) {
  187. qdata.pm = 1
  188. }else {
  189. qdata.pm = 0
  190. }
  191. }else if(that.type == 8) {
  192. status = 8
  193. qdata.category = 'points'
  194. if(item.state == 1) {
  195. qdata.pm = 1
  196. }else {
  197. qdata.pm = 0
  198. }
  199. }else if(that.type == 9) {
  200. status = 9
  201. qdata.category = 'pass'
  202. if(item.state == 1) {
  203. qdata.pm = 1
  204. }else {
  205. qdata.pm = 0
  206. }
  207. }else if(that.type == 10) {
  208. status = 10
  209. qdata.category = 'integral'
  210. if(item.state == 1) {
  211. qdata.pm = 1
  212. }else {
  213. qdata.pm = 0
  214. }
  215. }else if(that.type == 11) {
  216. status = 11
  217. qdata.category = 'freeze_points'
  218. if(item.state == 1) {
  219. qdata.pm = 1
  220. }else {
  221. qdata.pm = 0
  222. }
  223. }else if(that.type == 5) {
  224. status = 5
  225. qdata.category = 'contribute'
  226. if(item.state == 1) {
  227. qdata.pm = 1
  228. }else {
  229. qdata.pm = 0
  230. }
  231. }else if(that.type == 6) {
  232. status = 6
  233. qdata.category = 'dividend_points'
  234. if(item.state == 1) {
  235. qdata.pm = 1
  236. }else {
  237. qdata.pm = 0
  238. }
  239. }else if(that.type == 7) {
  240. status = 7
  241. qdata.category = 'dividend_amount'
  242. if(item.state == 1) {
  243. qdata.pm = 1
  244. }else {
  245. qdata.pm = 0
  246. }
  247. }else if(that.type == 13) {
  248. status = 13
  249. qdata.category = 'recommend'
  250. if(item.state == 1) {
  251. qdata.pm = 1
  252. }else {
  253. qdata.pm = 0
  254. }
  255. }
  256. }
  257. spreadCommission(qdata,status).then(({data})=> {
  258. if(data.length > 0) {
  259. let arr = []
  260. data.forEach(item => {
  261. arr = arr.concat(item.list)
  262. console.log(arr);
  263. })
  264. item.orderList = item.orderList.concat(arr);
  265. item.page++;
  266. if (item.limit == data.length) {
  267. item.loadingType = 'more';
  268. return;
  269. } else {
  270. item.loadingType = 'noMore';
  271. }
  272. // uni.hideLoading();
  273. }else {
  274. item.loadingType = 'noMore'
  275. }
  276. that.$set(item, 'loaded', true);
  277. })
  278. }
  279. }
  280. }
  281. </script>
  282. <style lang="scss" scoped>
  283. .navbar {
  284. display: flex;
  285. height: 40px;
  286. padding: 0 5px;
  287. background: #fff;
  288. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  289. position: relative;
  290. z-index: 10;
  291. .nav-item {
  292. flex: 1;
  293. display: flex;
  294. justify-content: center;
  295. align-items: center;
  296. height: 100%;
  297. font-size: 15px;
  298. color: $font-color-dark;
  299. position: relative;
  300. &.current {
  301. color: #000;
  302. font-weight: bold;
  303. &:after {
  304. content: '';
  305. position: absolute;
  306. left: 50%;
  307. bottom: 0;
  308. transform: translateX(-50%);
  309. width: 44px;
  310. height: 0;
  311. border-bottom: 2px solid #FF4C4C;
  312. }
  313. }
  314. }
  315. }
  316. .swiper-box {
  317. .order-item {
  318. padding: 20rpx 30rpx;
  319. line-height: 1.5;
  320. .title-box {
  321. .title {
  322. font-size: $font-lg;
  323. color: $font-color-base;
  324. }
  325. .time {
  326. font-size: $font-base;
  327. color: $font-color-light;
  328. }
  329. }
  330. .money {
  331. color: rgba(239, 58, 85, 1);
  332. font-size: $font-lg;
  333. }
  334. }
  335. }
  336. .list-scroll-content {
  337. background-color: #ffffff;
  338. height: 100%;
  339. }
  340. .content-money {
  341. position: relative;
  342. height: 480rpx;
  343. .content-bg {
  344. position: absolute;
  345. top: 0;
  346. left: 0;
  347. right: 0;
  348. width: 750rpx;
  349. height: 480rpx;
  350. image {
  351. width: 100%;
  352. height: 100%;
  353. }
  354. }
  355. .body-title {
  356. height: 80rpx;
  357. text-align: center;
  358. font-size: 35rpx;
  359. position: relative;
  360. .header {
  361. position: absolute;
  362. left: 0;
  363. top: 0;
  364. width: 100%;
  365. font-size: 36rpx;
  366. font-family: PingFang SC;
  367. font-weight: bold;
  368. color: #fffeff;
  369. height: 80rpx;
  370. font-size: 36rpx;
  371. font-weight: 700;
  372. z-index: 9;
  373. display: flex;
  374. justify-content: center;
  375. align-items: center;
  376. }
  377. .goback-box {
  378. position: absolute;
  379. left: 18rpx;
  380. top: 0;
  381. height: 80rpx;
  382. display: flex;
  383. align-items: center;
  384. }
  385. .goback {
  386. z-index: 100;
  387. width: 34rpx;
  388. height: 34rpx;
  389. }
  390. }
  391. }
  392. .money-box {
  393. position: relative;
  394. z-index: 2;
  395. padding-top: 70rpx;
  396. color: #ffffff;
  397. text-align: center;
  398. .money {
  399. font-size: 72rpx;
  400. font-family: PingFang SC;
  401. font-weight: bold;
  402. color: #ffffff;
  403. }
  404. .text {
  405. font-size: 30rpx;
  406. }
  407. }
  408. .moneybtn-box {
  409. display: flex;
  410. justify-content: space-between;
  411. position: relative;
  412. z-index: 2;
  413. color: #ffffff;
  414. padding: 50rpx 50rpx 20rpx;
  415. font-size: 30rpx;
  416. font-family: PingFang SC;
  417. font-weight: bold;
  418. color: #ffffff;
  419. }
  420. </style>