gzdetail.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <template>
  2. <view class="content">
  3. <view class="user-top">
  4. <view class="select-time">
  5. <picker mode="date" @change="bindDateChange" fields="month">
  6. <view class="uni-input">{{showdate}}</view>
  7. </picker>
  8. <image src="../../static/img/downjian.png" mode="widthFix"></image>
  9. </view>
  10. <view class="top-val">
  11. 300
  12. </view>
  13. <view class="top-tit">
  14. 本月收入
  15. </view>
  16. </view>
  17. <view class="sz-wrap">
  18. <view class="sz-item">
  19. <view class="sz-tit">
  20. 上月收入
  21. </view>
  22. <view class="sz-val">
  23. 200
  24. </view>
  25. </view>
  26. <view class="jg">
  27. </view>
  28. <view class="sz-item">
  29. <view class="sz-tit">
  30. 累计收入
  31. </view>
  32. <view class="sz-val">
  33. 200
  34. </view>
  35. </view>
  36. </view>
  37. <view class="navbar">
  38. <view v-for="(item, index) in navlist" :key="index" class="nav-item"
  39. :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.title }}</view>
  40. </view>
  41. <swiper :current="tabCurrentIndex" :style="{ height: height }" class="swiper-box" duration="300" disable-touch>
  42. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navlist" :key="tabIndex">
  43. <scroll-view scroll-y="true" class="list-scroll-content" @scrolltolower="loadData" :style="{ height: height }">
  44. <!-- 空白页 -->
  45. <u-empty text="暂无数据" mode="list" v-if="tabItem.loaded && tabItem.list.length == 0"></u-empty>
  46. <!-- 订单列表 -->
  47. <view class="order-item" v-for="(item, index) in tabItem.list" :key="index">
  48. <view class="title-box">
  49. <view class="title">
  50. <!-- <text>{{ item.mark }}</text> -->
  51. 全勤奖励全勤奖励全勤奖励全勤奖励全勤奖励全勤
  52. </view>
  53. <view class="time">
  54. <!-- <text>{{ item.create_time }}</text> -->
  55. 2022-12-1 09:30
  56. </view>
  57. </view>
  58. <view class="money">
  59. <!-- <view>{{ (item.pm == 0 ? '-' : '+') + item.number }}</view> -->
  60. +200
  61. </view>
  62. </view>
  63. <u-loadmore :status="tabItem.loadingType" />
  64. </scroll-view>
  65. </swiper-item>
  66. </swiper>
  67. </view>
  68. </template>
  69. <script>
  70. export default {
  71. data() {
  72. return {
  73. showdate: '',
  74. tabCurrentIndex: 0,
  75. height: '',
  76. id: '',
  77. navlist: [{
  78. status: 0,
  79. title: '收入',
  80. list: [],
  81. page: 1,
  82. limit: 10,
  83. loaded: false,
  84. loadingType: 'loadmore'
  85. },
  86. {
  87. status: 1,
  88. title: '扣除',
  89. list: [],
  90. page: 1,
  91. limit: 10,
  92. loaded: false,
  93. loadingType: 'loadmore'
  94. }
  95. ]
  96. }
  97. },
  98. onLoad(opt) {
  99. if (opt.id) {
  100. this.id = opt.id
  101. }
  102. if (opt.name) {
  103. uni.setNavigationBarTitle({
  104. title: opt.name + '的工资'
  105. })
  106. }
  107. this.getTime()
  108. },
  109. onShow() {
  110. },
  111. onReachBottom() {
  112. },
  113. onReady() {
  114. var _this = this;
  115. uni.getSystemInfo({
  116. success: resu => {
  117. const query = uni.createSelectorQuery();
  118. query.select('.swiper-box').boundingClientRect();
  119. query.exec(function(res) {
  120. _this.height = resu.windowHeight - res[0].top + 'px';
  121. console.log('打印页面的剩余高度', _this.height);
  122. });
  123. },
  124. fail: res => {}
  125. });
  126. },
  127. methods: {
  128. //顶部tab点击
  129. tabClick(index) {
  130. this.tabCurrentIndex = index;
  131. this.loadData('tab')
  132. },
  133. // 选择年月
  134. bindDateChange(e) {
  135. let time = e.detail.value.split('-')
  136. this.showdate = time[0] + '年' + time[1] + '月'
  137. this.loadData('reload')
  138. },
  139. // 获取当前年月
  140. getTime() {
  141. let date = new Date()
  142. this.showdate = date.getFullYear() + '年' + (date.getMonth() + 1) + '月'
  143. this.loadData()
  144. },
  145. // 获取数据
  146. loadData(type) {
  147. let that = this
  148. let index = that.tabCurrentIndex
  149. let item = that.navlist[index]
  150. if (type == 'reload') {
  151. item.loaded = false
  152. item.loadingType = 'more'
  153. item.page = 1
  154. item.list = []
  155. }
  156. if (type == 'tab' && item.loaded) {
  157. return
  158. }
  159. if (item.loadingType == 'loading' || item.loadingType == 'noMore') {
  160. return
  161. }
  162. item.loadingType = 'loading'
  163. },
  164. }
  165. }
  166. </script>
  167. <style lang="scss">
  168. .user-top {
  169. width: 100%;
  170. height: 400rpx;
  171. background-color: #4075d6;
  172. display: flex;
  173. flex-direction: column;
  174. justify-content: center;
  175. align-items: center;
  176. padding-bottom: 60rpx;
  177. // position: relative;
  178. .top-tit {
  179. font-size: 30rpx;
  180. font-weight: bold;
  181. color: #FFFFFF;
  182. }
  183. .top-val {
  184. font-size: 72rpx;
  185. font-weight: 500;
  186. color: #FFFFFF;
  187. }
  188. .select-time {
  189. position: absolute;
  190. top: 30rpx;
  191. right: 30rpx;
  192. font-size: 26rpx;
  193. font-weight: 500;
  194. color: #fff;
  195. display: flex;
  196. align-items: center;
  197. image {
  198. width: 17rpx;
  199. margin-left: 10rpx;
  200. }
  201. }
  202. }
  203. .sz-wrap {
  204. width: 670rpx;
  205. height: 186rpx;
  206. background: #FFFFFF;
  207. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  208. border-radius: 20rpx;
  209. margin: -90rpx auto 20rpx;
  210. display: flex;
  211. justify-content: center;
  212. align-items: center;
  213. .jg {
  214. width: 2rpx;
  215. height: 74rpx;
  216. background: #DCDFE6;
  217. }
  218. .sz-item {
  219. width: 330rpx;
  220. height: 100%;
  221. display: flex;
  222. flex-direction: column;
  223. align-items: center;
  224. justify-content: center;
  225. font-size: 30rpx;
  226. font-weight: bold;
  227. .sz-tit {
  228. color: #999999;
  229. }
  230. .sz-val {
  231. margin-top: 30rpx;
  232. color: #181818;
  233. }
  234. }
  235. }
  236. .navbar {
  237. margin-top: 20rpx;
  238. display: flex;
  239. height: 88rpx;
  240. padding: 0 5px;
  241. background: #fff;
  242. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  243. position: relative;
  244. z-index: 10;
  245. .nav-item {
  246. flex: 1;
  247. display: flex;
  248. justify-content: center;
  249. align-items: center;
  250. height: 100%;
  251. font-size: 15px;
  252. color: #999999;
  253. position: relative;
  254. &.current {
  255. color: #000;
  256. &:after {
  257. content: '';
  258. position: absolute;
  259. left: 50%;
  260. bottom: 0;
  261. transform: translateX(-50%);
  262. width: 44px;
  263. height: 0;
  264. border-bottom: 2px solid #fe5b38;
  265. }
  266. }
  267. }
  268. }
  269. //列表
  270. .swiper-box {
  271. .order-item:last-child {
  272. margin-bottom: 60rpx;
  273. }
  274. .order-item {
  275. width: 100%;
  276. // background-color: red;
  277. padding: 20rpx 30rpx;
  278. line-height: 1.5;
  279. display: flex;
  280. align-items: center;
  281. .title-box {
  282. flex-grow: 1;
  283. padding-right: 50rpx;
  284. .title {
  285. font-size: 30rpx;
  286. color: #333333;
  287. }
  288. .time {
  289. font-size: 26rpx;
  290. color: #AEAEAE;
  291. }
  292. }
  293. .money {
  294. color: #fd5b23;
  295. font-size: 26rpx;
  296. text-align: right;
  297. .status {
  298. color: #AEAEAE;
  299. }
  300. }
  301. }
  302. }
  303. .list-scroll-content {
  304. background: #ffffff;
  305. height: 100%;
  306. }
  307. </style>