profit.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <image src="../../static/img/centerbg.png" mode="" class="bg"></image>
  5. <view class="money-box flex">
  6. <view class="money-item">
  7. <view class="money">{{ spend }}</view>
  8. <view class="text">{{ $t('foo.dqyzfk') }}</view>
  9. </view>
  10. <view class="money-item">
  11. <view class="money">{{ income }}</view>
  12. <view class="text">{{ $t('foo.dqszfk')}}</view>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="navbar">
  17. <view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  18. </view>
  19. <swiper :current="tabCurrentIndex" :style="{ height: maxheight }" class="swiper-box" duration="300" @change="changeTab">
  20. <swiper-item class="tab-content">
  21. <scroll-view scroll-y="true" class="list-scroll-content" @scrolltolower="loadData">
  22. <!-- 空白页 -->
  23. <!-- <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty> -->
  24. <!-- 订单列表 -->
  25. <view class="apply-box" v-for="item in navList[0].orderList">
  26. <view class="box-top">
  27. <view class="left flex">
  28. <image :src="userInfo.avatar" mode="" class="user-img"></image>
  29. <view class="user-info">
  30. <view class="user-name clamp">{{ userInfo.nickname }}</view>
  31. <view class="user-phone">{{ userInfo.mobile }}</view>
  32. </view>
  33. </view>
  34. <view class="right">
  35. <view class="user-name clamp">¥{{ item.money * 1 }}</view>
  36. <view class="user-phone">{{ item.time }}</view>
  37. </view>
  38. </view>
  39. <view class="apply-info flex">
  40. <view class="img-wrap"><image :src="imgitem" mode="" class="upimg" v-for="imgitem in item.imagelist"></image></view>
  41. <view class="btn-wrap">{{ item.status == '1' ? $t('hea.ytg') : item.status == '0' ? $t('hea.dsh') : $t('hea.wtg') }}</view>
  42. </view>
  43. </view>
  44. <uni-load-more :status="navList[0].loadingType"></uni-load-more>
  45. </scroll-view>
  46. </swiper-item>
  47. <swiper-item class="tab-content">
  48. <scroll-view scroll-y="true" class="list-scroll-content" @scrolltolower="loadData">
  49. <!-- 空白页 -->
  50. <!-- <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty> -->
  51. <!-- 订单列表 -->
  52. <view class="apply-box" v-for="item in navList[1].orderList">
  53. <view class="box-top">
  54. <view class="left flex">
  55. <image :src="item.user_info.avatar" mode="" class="user-img"></image>
  56. <view class="user-info">
  57. <view class="user-name clamp">{{ item.user_info.nickname }}</view>
  58. <view class="user-phone">{{ item.user_info.mobile }}</view>
  59. </view>
  60. </view>
  61. <view class="right">
  62. <view class="user-name clamp">¥{{ item.money * 1 }}</view>
  63. <view class="user-phone">{{ item.time }}</view>
  64. </view>
  65. </view>
  66. <view class="apply-info flex">
  67. <view class="img-wrap"><image :src="imgitem" mode="" class="upimg" v-for="imgitem in item.imagelist"></image></view>
  68. <view class="btn-wrap">{{ item.status == '1' ? $t('hea.ytg') : item.status == '0' ? $t('hea.dsh') : $t('hea.wtg') }}</view>
  69. </view>
  70. </view>
  71. <uni-load-more :status="navList[1].loadingType"></uni-load-more>
  72. </scroll-view>
  73. </swiper-item>
  74. </swiper>
  75. </view>
  76. </template>
  77. <script>
  78. import { getApplyList, getMyList } from '@/api/apply.js';
  79. import { mapState, mapMutations } from 'vuex';
  80. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  81. import empty from '@/components/empty';
  82. import { getTime } from '@/utils/rocessor.js';
  83. export default {
  84. components: {
  85. empty,
  86. uniLoadMore
  87. },
  88. computed: {
  89. ...mapState(['lang']),
  90. ...mapState('user', ['hasLogin', 'userInfo', 'baseURL', 'urlFile'])
  91. },
  92. onReady(res) {
  93. var obj = this;
  94. uni.getSystemInfo({
  95. success: resu => {
  96. const query = uni.createSelectorQuery();
  97. query.select('.swiper-box').boundingClientRect();
  98. query.exec(function(res) {
  99. console.log(res, 'ddddddddddddd');
  100. obj.maxheight = resu.windowHeight - res[0].top + 'px';
  101. console.log('打印页面的剩余高度', obj.maxheight);
  102. });
  103. },
  104. fail: res => {}
  105. });
  106. },
  107. data() {
  108. return {
  109. // 头部图高度
  110. maxheight: '',
  111. tabCurrentIndex: 0,
  112. navList: [
  113. {
  114. state: 0,
  115. text: this.$t('foo.yzfk'),
  116. loadingType: 'more',
  117. orderList: [],
  118. page: 1, //当前页面
  119. limit: 10 //每次信息条数
  120. },
  121. {
  122. state: 1,
  123. text: this.$t('foo.syzfk'),
  124. loadingType: 'more',
  125. orderList: [],
  126. page: 1, //当前页面
  127. limit: 10 //每次信息条数
  128. }
  129. ],
  130. spend: '', //援助金额
  131. income: '' //受援助金额
  132. };
  133. },
  134. onLoad(options) {},
  135. watch: {
  136. lang(val) {
  137. this.$set(this.navList[0], 'text', this.$t('foo.yzfk'));
  138. this.$set(this.navList[1], 'text', this.$t('foo.syzfk'));
  139. }
  140. },
  141. onShow() {
  142. uni.setNavigationBarTitle({
  143. title:this.$t('foo.syzx')
  144. })
  145. this.spend = this.userInfo.spend;
  146. this.income = this.userInfo.income;
  147. this.loadData();
  148. },
  149. methods: {
  150. navto(e) {
  151. uni.navigateTo({
  152. url: e
  153. });
  154. },
  155. async loadData(source) {
  156. //这里时将订单挂载到tab列表下
  157. let index = this.tabCurrentIndex;
  158. let navItem = this.navList[index];
  159. let state = navItem.state;
  160. if (source === 'tabChange' && navItem.loaded === true) {
  161. //tab切换只有第一次需要加载数据
  162. return;
  163. }
  164. if (navItem.loadingType === 'loading') {
  165. //防止重复加载
  166. return;
  167. }
  168. //修改当前对象状态为加载中
  169. navItem.loadingType = 'loading';
  170. console.log(state, '123321');
  171. if (state == 1) {
  172. getApplyList({
  173. page: navItem.page,
  174. limit: navItem.limit,
  175. status: 8
  176. })
  177. .then(({ data }) => {
  178. data.list.forEach(e => {
  179. console.log(e);
  180. e.time = getTime(e.updatetime);
  181. if (e.voucherimages) {
  182. e.imagelist = e.voucherimages.split(',');
  183. }
  184. });
  185. if (data.list.length > 0) {
  186. navItem.orderList = navItem.orderList.concat(data.list);
  187. console.log(navItem.orderList);
  188. navItem.page++;
  189. }
  190. //判断是否还有数据, 有改为more, 没有改为noMore
  191. if (navItem.limit == data.list.length) {
  192. navItem.loadingType = 'more';
  193. return;
  194. } else {
  195. navItem.loadingType = 'noMore';
  196. }
  197. uni.hideLoading();
  198. this.$set(navItem, 'loaded', true);
  199. })
  200. .catch(e => {
  201. console.log(e);
  202. });
  203. } else {
  204. getMyList({ page: navItem.page, limit: navItem.limit })
  205. .then(({ data }) => {
  206. if (data.list.length > 0) {
  207. data.list.forEach(e => {
  208. console.log(e);
  209. e.time = getTime(e.updatetime);
  210. if (e.voucherimages) {
  211. e.imagelist = e.voucherimages.split(',');
  212. }
  213. });
  214. navItem.orderList = navItem.orderList.concat(data.list);
  215. console.log(navItem.orderList);
  216. navItem.page++;
  217. }
  218. //判断是否还有数据, 有改为more, 没有改为noMore
  219. if (navItem.limit == data.list.length) {
  220. navItem.loadingType = 'more';
  221. return;
  222. } else {
  223. navItem.loadingType = 'noMore';
  224. }
  225. uni.hideLoading();
  226. this.$set(navItem, 'loaded', true);
  227. })
  228. .catch(e => {
  229. console.log(e);
  230. });
  231. }
  232. },
  233. //swiper 切换
  234. changeTab(e) {
  235. this.tabCurrentIndex = e.target.current;
  236. this.loadData('tabChange');
  237. },
  238. //顶部tab点击
  239. tabClick(index) {
  240. this.tabCurrentIndex = index;
  241. }
  242. }
  243. };
  244. </script>
  245. <style lang="scss">
  246. page {
  247. background: #000;
  248. height: 100%;
  249. }
  250. .content-money {
  251. height: 430rpx;
  252. padding-bottom: 30rpx;
  253. background: $page-color-base;
  254. position: relative;
  255. .bg {
  256. position: absolute;
  257. width: 100%;
  258. height: 430rpx;
  259. }
  260. .moneyTx {
  261. position: absolute;
  262. top: 150rpx;
  263. right: 0rpx;
  264. width: 150rpx;
  265. padding: 10rpx 30rpx;
  266. border: 2px solid #ffffff;
  267. border-top-left-radius: 99rpx;
  268. border-bottom-left-radius: 99rpx;
  269. color: #ffffff;
  270. line-height: 1;
  271. font-size: $font-base;
  272. }
  273. .buttom-box {
  274. background-color: #ffffff;
  275. text-align: center;
  276. margin: 0 30rpx;
  277. padding: 20rpx 0;
  278. border-radius: $border-radius-sm;
  279. margin-top: -60rpx;
  280. .buttom {
  281. font-size: $font-lg;
  282. flex-grow: 1;
  283. }
  284. .interval {
  285. width: 2px;
  286. height: 60rpx;
  287. background-color: #eeeeee;
  288. }
  289. .icon {
  290. height: 50rpx;
  291. width: 48rpx;
  292. margin: 0 auto;
  293. .icon-img {
  294. width: 100%;
  295. height: 100%;
  296. }
  297. }
  298. }
  299. }
  300. .money-box {
  301. // background-color: $base-color;
  302. padding-top: var(--status-bar-height);
  303. height: 368rpx;
  304. color: #fad6b0;
  305. text-align: center;
  306. position: relative;
  307. align-items: center;
  308. .money-item {
  309. width: 50%;
  310. }
  311. .text {
  312. font-size: $font-sm;
  313. }
  314. .money {
  315. padding-top: 147rpx;
  316. font-size: 47px;
  317. font-family: PingFang SC;
  318. font-weight: bold;
  319. text {
  320. font-size: 24px;
  321. }
  322. }
  323. }
  324. .navbar {
  325. display: flex;
  326. height: 40px;
  327. padding: 0 5px;
  328. background: #000;
  329. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  330. position: relative;
  331. z-index: 10;
  332. .nav-item {
  333. flex: 1;
  334. display: flex;
  335. justify-content: center;
  336. align-items: center;
  337. height: 100%;
  338. font-size: 15px;
  339. color: #999999;
  340. position: relative;
  341. overflow: hidden;
  342. &.current {
  343. color: $base-color;
  344. &:after {
  345. content: '';
  346. position: absolute;
  347. left: 50%;
  348. bottom: 0;
  349. transform: translateX(-50%);
  350. width: 44px;
  351. height: 0;
  352. border-bottom: 2px solid $base-color;
  353. }
  354. }
  355. }
  356. }
  357. //列表
  358. .swiper-box {
  359. padding-top: 10rpx;
  360. .apply-box {
  361. height: 317rpx;
  362. width: 702rpx;
  363. // background-color: red;
  364. margin: 0 auto;
  365. border-bottom: 1px solid #6c6a68;
  366. padding-top: 30rpx;
  367. .box-top {
  368. height: 80rpx;
  369. // background-color: #bfa;
  370. display: flex;
  371. justify-content: space-between;
  372. .left {
  373. justify-content: flex-start;
  374. }
  375. .right {
  376. text-align: right;
  377. }
  378. .user-img {
  379. width: 80rpx;
  380. height: 80rpx;
  381. background-color: #eee;
  382. margin-right: 20rpx;
  383. flex-shrink: 0;
  384. border-radius: 50%;
  385. }
  386. .user-name {
  387. max-width: 500rpx;
  388. font-size: 30rpx;
  389. font-family: PingFang SC;
  390. font-weight: 500;
  391. color: #ffffff;
  392. }
  393. .user-phone {
  394. padding-top: 10rpx;
  395. font-size: 22rpx;
  396. font-family: PingFang SC;
  397. font-weight: 400;
  398. color: #ffffff;
  399. }
  400. }
  401. .apply-info {
  402. padding: 25rpx 0 0 100rpx;
  403. justify-content: space-between;
  404. .img-wrap {
  405. .upimg {
  406. width: 153rpx;
  407. height: 152rpx;
  408. border-radius: 10rpx;
  409. background-color: #999;
  410. margin-left: 10rpx;
  411. }
  412. }
  413. .btn-wrap {
  414. align-self: flex-end;
  415. color: #fad6b0;
  416. font-size: 24rpx;
  417. font-family: PingFang SC;
  418. font-weight: 500;
  419. color: #fad6b0;
  420. .btn {
  421. width: 98rpx;
  422. line-height: 47rpx;
  423. text-align: center;
  424. }
  425. .btn-reject {
  426. border: 1px solid #fad6b0;
  427. border-radius: 5rpx;
  428. color: #fad6b0;
  429. }
  430. .btn-pass {
  431. background: linear-gradient(-74deg, #ce9c6d, #ffecd6);
  432. border-image: linear-gradient(115deg, #feebd5, #ffffff, #e1ad7d) 1 1;
  433. box-shadow: 3rpx 4rpx 5rpx 0rpx rgba(151, 118, 74, 0.5);
  434. border-radius: 5rpx;
  435. color: #874b19;
  436. margin-left: 10rpx;
  437. }
  438. }
  439. }
  440. }
  441. }
  442. .list-scroll-content {
  443. height: 100%;
  444. }
  445. .content {
  446. height: 100%;
  447. .empty-content {
  448. background-color: #ffffff;
  449. }
  450. }
  451. </style>