money.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <template>
  2. <view class="center">
  3. <!-- #ifdef APP -->
  4. <view class="app">
  5. </view>
  6. <!-- #endif -->
  7. <view class="top">
  8. <image class="top-bg" src="../../static/img/order99.png" mode=""></image>
  9. <view class="top-font">余额(元)</view>
  10. <view class="num">{{ userInfo.now_money || '0.00' }}</view>
  11. </view>
  12. <view class="navbar">
  13. <view class="navbar-item" @click="navTo('/pages/money/qudou')">
  14. <view class="navbar-font">
  15. <image class="navbar-image" src="../../static/img/been.png" mode=""></image>
  16. <view class="font">趣豆</view>
  17. </view>
  18. <view class="navbar-num">{{ userInfo.integral || '0.00' }}</view>
  19. </view>
  20. <view class="vvv"></view>
  21. <view class="navbar-item">
  22. <view class="navbar-font" @click="navTo('/pages/user/mygs')">
  23. <image class="navbar-image" src="../../static/money/m03.png" mode=""></image>
  24. <view class="font">我的收益</view>
  25. </view>
  26. <view class="navbar-num">{{ userInfo.profit > 0 ? userInfo.profit : '0' }}</view>
  27. </view>
  28. <view class="vvv"></view>
  29. <view class="navbar-item">
  30. <view class="navbar-font" @click="navTo('/pages/user/myAppointment')">
  31. <image class="navbar-image" src="../../static/money/m04.png" mode=""></image>
  32. <view class="font">广告值</view>
  33. </view>
  34. <view class="navbar-num">{{ userInfo.anticipate }}</view>
  35. </view>
  36. </view>
  37. <view class="content-box">
  38. <view class="content-title">
  39. <view class="title-left">
  40. <image src="../../static/money/m02.png" mode=""></image>
  41. <text>现金余额明细</text>
  42. </view>
  43. <view class="title-right">
  44. <view @tap="handleTap('picker')">{{ title }}</view>
  45. <lb-picker ref="picker" v-model="value" mode="selector" :list="typeList" :dataset="{ name: 'type' }" @confirm="handleConfirm"></lb-picker>
  46. <image src="../../static/money/m01.png" mode=""></image>
  47. </view>
  48. </view>
  49. <scroll-view scroll-y="true" class="scroll-list" :style="{ height: height }" @scrolltolower="loadData()">
  50. <view class="list" v-for="(item, index) in list" :style="{ background: index % 2 == 0 ? '#F9F9F9' : '#fff' }">
  51. <view class="list-box">
  52. <view class="list-left">
  53. <view class="top1">{{ item.title }}</view>
  54. <view class="bottom">{{ item.add_time }}</view>
  55. </view>
  56. <view class="list-right" :style="{ color: index % 2 == 0 ? '#ff0000' : '#000000' }">{{ item.pm == 1 ? '+' : '-' }}{{ item.number }}</view>
  57. </view>
  58. </view>
  59. </scroll-view>
  60. </view>
  61. <u-tabbar activeColor="#f42b4e" v-model="current" :list="tabbar" :mid-button="true"></u-tabbar>
  62. </view>
  63. </template>
  64. <script>
  65. import { getUserInfo } from '@/api/user.js';
  66. import { tabbar } from '@/utils/tabbar.js';
  67. import { mapState, mapMutations } from 'vuex';
  68. import LbPicker from '@/components/lb-picker';
  69. import { spreadCommission, userBalance } from '@/api/wallet.js';
  70. export default {
  71. components: {
  72. LbPicker
  73. },
  74. onReady(res) {
  75. var _this = this;
  76. uni.getSystemInfo({
  77. success: resu => {
  78. const query = uni.createSelectorQuery();
  79. query.select('.scroll-list').boundingClientRect();
  80. query.exec(function(res) {
  81. console.log(res, 'ddddddddddddd');
  82. _this.height = resu.windowHeight - res[0].top + 'px';
  83. console.log('打印页面的剩余高度', _this.height);
  84. });
  85. },
  86. fail: res => {}
  87. });
  88. },
  89. data() {
  90. return {
  91. height: '',
  92. current: 3,
  93. tabbar: tabbar,
  94. list: [],
  95. typeList: [{ title: '收入', type: 2 }, { title: '支出', type: 1 }],
  96. type: 2,
  97. title: '收入',
  98. value: '',
  99. page: 1,
  100. limit: 10,
  101. loadingType: 'more'
  102. };
  103. },
  104. computed: {
  105. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  106. },
  107. onLoad() {
  108. this.upData();
  109. this.loadData();
  110. },
  111. onReachBottom() {
  112. this.loadData();
  113. },
  114. methods: {
  115. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  116. upData() {
  117. getUserInfo({})
  118. .then(({ data }) => {
  119. this.setUserInfo(data);
  120. })
  121. .catch(e => {
  122. console.log(e);
  123. });
  124. },
  125. loadData() {
  126. const obj = this;
  127. if (obj.loadingType == 'nomore' || obj.loadingType == 'loading') {
  128. return;
  129. }
  130. obj.loadingType = 'loading';
  131. spreadCommission({ page: obj.page, limit: obj.limit }, obj.type).then(({ data }) => {
  132. if (data == '') {
  133. return;
  134. } else {
  135. obj.list = obj.list.concat(data[0].list);
  136. if (data[0].list.length == obj.limit) {
  137. obj.page++;
  138. } else {
  139. obj.loadingType == 'nomore';
  140. }
  141. }
  142. });
  143. },
  144. navTo(url) {
  145. uni.navigateTo({
  146. url
  147. });
  148. },
  149. handleConfirm(e) {
  150. console.log(e);
  151. this.title = e.item.title;
  152. this.type = e.item.type;
  153. this.page = 1;
  154. (this.limit = 10), (this.loadingType = 'more'), (this.list = []);
  155. this.loadData();
  156. },
  157. handleTap(name) {
  158. this.$refs[name].show();
  159. }
  160. }
  161. };
  162. </script>
  163. <style lang="less">
  164. .app{
  165. width: 100%;height: 80rpx;
  166. background: #fff;
  167. }
  168. .center {
  169. height: 100%;
  170. width: 100%;
  171. height: auto;
  172. min-height: 100%;
  173. background: #ffffff;
  174. }
  175. .top {
  176. margin: 20rpx auto 0;
  177. position: relative;
  178. width: 700rpx;
  179. height: 200rpx;
  180. padding: 54rpx 40rpx;
  181. .top-bg {
  182. position: absolute;
  183. top: 0;
  184. left: 0;
  185. right: 0;
  186. width: 700rpx;
  187. height: 200rpx;
  188. border-radius: 25rpx;
  189. }
  190. .top-font {
  191. position: relative;
  192. z-index: 2;
  193. font-size: 32rpx;
  194. font-family: PingFang SC;
  195. font-weight: bold;
  196. color: #ffffff;
  197. line-height: 1;
  198. }
  199. .num {
  200. line-height: 1;
  201. position: relative;
  202. z-index: 2;
  203. margin-top: 24rpx;
  204. font-size: 48rpx;
  205. font-family: PingFang SC;
  206. font-weight: bold;
  207. color: #ffffff;
  208. }
  209. }
  210. .navbar {
  211. display: flex;
  212. justify-content: space-around;
  213. width: 700rpx;
  214. background: #ffffff;
  215. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  216. border-radius: 20rpx;
  217. margin: 40rpx auto 0;
  218. padding: 40rpx 0 50rpx;
  219. .vvv {
  220. width: 2rpx;
  221. height: 74rpx;
  222. background: #dcdcdc;
  223. }
  224. .navbar-item {
  225. display: flex;
  226. flex-direction: column;
  227. align-items: center;
  228. .navbar-font {
  229. margin-bottom: 10rpx;
  230. display: flex;
  231. justify-content: center;
  232. align-items: center;
  233. image {
  234. margin-right: 10rpx;
  235. width: 40rpx;
  236. height: 40rpx;
  237. }
  238. .font {
  239. font-size: 30rpx;
  240. font-weight: bold;
  241. color: #0c1732;
  242. }
  243. }
  244. .navbar-num {
  245. font-size: 34rpx;
  246. font-weight: bold;
  247. color: #0c1732;
  248. }
  249. }
  250. }
  251. .content-box {
  252. margin: 0 30rpx;
  253. .content-title {
  254. margin: 50rpx 0;
  255. display: flex;
  256. justify-content: space-between;
  257. align-items: center;
  258. .title-left {
  259. image {
  260. width: 8rpx;
  261. height: 30rpx;
  262. margin-right: 10rpx;
  263. }
  264. text {
  265. font-size: 34rpx;
  266. font-weight: bold;
  267. color: #0c1732;
  268. }
  269. }
  270. .title-right {
  271. font-size: 30rpx;
  272. font-weight: 500;
  273. color: #0c1732;
  274. display: flex;
  275. align-items: center;
  276. image {
  277. margin-left: 10rpx;
  278. width: 17rpx;
  279. height: 12rpx;
  280. }
  281. }
  282. }
  283. }
  284. .list {
  285. display: flex;
  286. justify-content: space-between;
  287. align-items: center;
  288. .list-box {
  289. width: 700rpx;
  290. height: 143rpx;
  291. width: 100%;
  292. display: flex;
  293. border-radius: 10rpx;
  294. justify-content: space-between;
  295. align-items: center;
  296. margin: 0 30rpx;
  297. .list-left {
  298. height: 143rpx;
  299. display: flex;
  300. flex-direction: column;
  301. justify-content: space-around;
  302. .top1 {
  303. font-size: 30rpx;
  304. font-weight: bold;
  305. color: #0c1732;
  306. }
  307. .bottom {
  308. font-size: 26rpx;
  309. font-weight: 500;
  310. color: #999999;
  311. }
  312. }
  313. .list-right {
  314. font-size: 36rpx;
  315. font-weight: bold;
  316. color: #ea453c;
  317. }
  318. }
  319. }
  320. </style>