money.vue 7.2 KB

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