gzdetail.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  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. {{yg_detail.reward || '0'}}
  12. </view>
  13. <view class="top-tit">
  14. 当前提成
  15. </view>
  16. <view class="top-btn">
  17. <view class="left" @click="goPage('/pagesS/yg/txxq')">
  18. 提现记录
  19. </view>
  20. <view class="center">
  21. </view>
  22. <view class="right" @click="goPage('/pagesS/yg/gztq?id=' + id)">
  23. 提成提现
  24. </view>
  25. </view>
  26. </view>
  27. <view class="sz-wrap">
  28. <view class="sz-item">
  29. <view class="sz-tit">
  30. 累计收入
  31. </view>
  32. <view class="sz-val">
  33. {{sr|| '0'}}
  34. </view>
  35. </view>
  36. <view class="jg">
  37. </view>
  38. <view class="sz-item">
  39. <view class="sz-tit">
  40. 累计支出
  41. </view>
  42. <view class="sz-val">
  43. {{zc || '0'}}
  44. </view>
  45. </view>
  46. </view>
  47. <view class="navbar">
  48. <view v-for="(item, index) in navlist" :key="index" class="nav-item"
  49. :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.title }}</view>
  50. </view>
  51. <swiper :current="tabCurrentIndex" :style="{ height: height }" class="swiper-box" duration="300" disable-touch>
  52. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navlist" :key="tabIndex">
  53. <scroll-view scroll-y="true" class="list-scroll-content" @scrolltolower="loadData"
  54. :style="{ height: height }">
  55. <!-- 空白页 -->
  56. <u-empty text="暂无数据" mode="list" v-if="tabItem.loaded && tabItem.list.length == 0"></u-empty>
  57. <!-- 订单列表 -->
  58. <view class="order-item" v-for="(item, index) in tabItem.list" :key="index">
  59. <view class="title-box">
  60. <view class="title">
  61. <!-- <text>{{ item.mark }}</text> -->
  62. {{item.title}}
  63. </view>
  64. <view class="time">
  65. <!-- <text>{{ item.create_time }}</text> -->
  66. {{$utils.formatDate(item.createTime)}}
  67. </view>
  68. </view>
  69. <view class="money">
  70. <!-- <view>{{ (item.pm == 0 ? '-' : '+') + item.number }}</view> -->
  71. {{tabCurrentIndex == 0? '+': '-'}}{{item.amount || '0'}}
  72. </view>
  73. </view>
  74. <u-loadmore :status="tabItem.loadingType" v-if="tabItem.loaded && tabItem.list.length > 0"/>
  75. </scroll-view>
  76. </swiper-item>
  77. </swiper>
  78. </view>
  79. </template>
  80. <script>
  81. export default {
  82. data() {
  83. return {
  84. showdate: '',
  85. tabCurrentIndex: 0,
  86. height: '',
  87. id: '',
  88. navlist: [{
  89. status: 5,
  90. title: '收入',
  91. list: [],
  92. page: 1,
  93. pageSize: 10,
  94. loaded: false,
  95. loadingType: 'loadmore'
  96. },
  97. {
  98. status: 4,
  99. title: '扣除',
  100. list: [],
  101. page: 1,
  102. pageSize: 10,
  103. loaded: false,
  104. loadingType: 'loadmore'
  105. }
  106. ],
  107. star: '',
  108. end: '',
  109. sr: '',
  110. zc: '',
  111. yg_detail: {}
  112. }
  113. },
  114. onLoad(opt) {
  115. if (opt.id) {
  116. this.id = opt.id
  117. }else {
  118. this.id = this.$store.state.userInfo.staffId
  119. }
  120. },
  121. onShow() {
  122. this.getTime()
  123. this.getYgdetail()
  124. },
  125. onReachBottom() {
  126. },
  127. onReady() {
  128. var _this = this;
  129. uni.getSystemInfo({
  130. success: resu => {
  131. const query = uni.createSelectorQuery();
  132. query.select('.swiper-box').boundingClientRect();
  133. query.exec(function(res) {
  134. _this.height = resu.windowHeight - res[0].top + 'px';
  135. console.log('打印页面的剩余高度', _this.height);
  136. });
  137. },
  138. fail: res => {}
  139. });
  140. },
  141. methods: {
  142. //顶部tab点击
  143. tabClick(index) {
  144. this.tabCurrentIndex = index;
  145. this.loadData('tab')
  146. },
  147. // 选择年月
  148. bindDateChange(e) {
  149. let time = e.detail.value.split('-')
  150. this.showdate = time[0] + '年' + time[1] + '月'
  151. this.star = this.getFirstDayOfMonth(time[0],time[1])
  152. this.end = this.getLastDayOfMonth(time[0],time[1])
  153. this.loadData('reload')
  154. },
  155. // 获取当前年月
  156. getTime() {
  157. let date = new Date()
  158. this.showdate = date.getFullYear() + '年' + (date.getMonth() + 1) + '月'
  159. // console.log(this.getFirstDayOfMonth(date.getFullYear(),date.getMonth() + 1),'开始时间')
  160. // console.log(this.getLastDayOfMonth(date.getFullYear(),date.getMonth() + 1))
  161. this.star = this.getFirstDayOfMonth(date.getFullYear(),date.getMonth() + 1)
  162. this.end = this.getLastDayOfMonth(date.getFullYear(),date.getMonth() + 1)
  163. this.loadData('reload')
  164. },
  165. // 获取数据
  166. loadData(type) {
  167. let that = this
  168. let index = that.tabCurrentIndex
  169. let item = that.navlist[index]
  170. if (type == 'reload' || type == 'tab') {
  171. item.loaded = false
  172. item.loadingType = 'loadmore'
  173. item.page = 1
  174. item.list = []
  175. }
  176. if (item.loadingType == 'loading' || item.loadingType == 'nomore') {
  177. return
  178. }
  179. item.loadingType = 'loading'
  180. that.$u.api.getYgTc({
  181. staffId: that.id,
  182. type: item.status,
  183. page: item.page,
  184. pageSize: item.pageSize,
  185. star: that.star,
  186. end: that.end //搜索结束时间
  187. }).then(res => {
  188. item.list = item.list.concat(res.data)
  189. item.page++
  190. that.sr = res.sr
  191. that.zc = res.zc
  192. if (item.pageSize == res.data.length) {
  193. item.loadingType = 'loadmore'
  194. } else {
  195. item.loadingType = 'nomore'
  196. }
  197. item.loaded = true
  198. })
  199. },
  200. getFirstDayOfMonth(year, month) {
  201. // return new Date(year, month-1, 1);
  202. let data = new Date(year, month - 1, 1);
  203. return data.getTime()/1000
  204. // return (
  205. // data.getFullYear() +
  206. // "-" +
  207. // (data.getMonth() + 1 > 9 ?
  208. // data.getMonth() + 1 :
  209. // "0" + (data.getMonth() + 1)) +
  210. // "-" +
  211. // (data.getDate() > 9 ? data.getDate() : "0" + data.getDate())
  212. // );
  213. },
  214. //结束日期
  215. getLastDayOfMonth(year, month) {
  216. let data = new Date(year, month, 0);
  217. console.log('结束',data.getTime())
  218. return data.getTime()/1000
  219. // return (
  220. // data.getFullYear() +
  221. // "-" +
  222. // (data.getMonth() + 1 > 9 ?
  223. // data.getMonth() + 1 :
  224. // "0" + (data.getMonth() + 1)) +
  225. // "-" +
  226. // (data.getDate() > 9 ? data.getDate() : "0" + data.getDate())
  227. // );
  228. },
  229. getYgdetail() {
  230. this.$u.api.getYgdetail({
  231. request_id: this.id
  232. }).then(({data})=> {
  233. this.yg_detail = data
  234. uni.setNavigationBarTitle({
  235. title: this.yg_detail.staffName + '的提成'
  236. })
  237. })
  238. }
  239. }
  240. }
  241. </script>
  242. <style lang="scss">
  243. .user-top {
  244. width: 100%;
  245. height: 400rpx;
  246. background-color: #4075d6;
  247. display: flex;
  248. flex-direction: column;
  249. justify-content: center;
  250. align-items: center;
  251. padding-bottom: 60rpx;
  252. // position: relative;
  253. .top-tit {
  254. font-size: 30rpx;
  255. font-weight: bold;
  256. color: #FFFFFF;
  257. }
  258. .top-val {
  259. font-size: 72rpx;
  260. font-weight: 500;
  261. color: #FFFFFF;
  262. }
  263. .select-time {
  264. position: absolute;
  265. top: 30rpx;
  266. right: 30rpx;
  267. font-size: 26rpx;
  268. font-weight: 500;
  269. color: #fff;
  270. display: flex;
  271. align-items: center;
  272. image {
  273. width: 17rpx;
  274. margin-left: 10rpx;
  275. }
  276. }
  277. }
  278. .sz-wrap {
  279. width: 670rpx;
  280. height: 186rpx;
  281. background: #FFFFFF;
  282. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  283. border-radius: 20rpx;
  284. margin: -90rpx auto 20rpx;
  285. display: flex;
  286. justify-content: center;
  287. align-items: center;
  288. .jg {
  289. width: 2rpx;
  290. height: 74rpx;
  291. background: #DCDFE6;
  292. }
  293. .sz-item {
  294. width: 330rpx;
  295. height: 100%;
  296. display: flex;
  297. flex-direction: column;
  298. align-items: center;
  299. justify-content: center;
  300. font-size: 30rpx;
  301. font-weight: bold;
  302. .sz-tit {
  303. color: #999999;
  304. }
  305. .sz-val {
  306. margin-top: 30rpx;
  307. color: #181818;
  308. }
  309. }
  310. }
  311. .navbar {
  312. margin-top: 20rpx;
  313. display: flex;
  314. height: 88rpx;
  315. padding: 0 5px;
  316. background: #fff;
  317. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  318. position: relative;
  319. z-index: 10;
  320. .nav-item {
  321. flex: 1;
  322. display: flex;
  323. justify-content: center;
  324. align-items: center;
  325. height: 100%;
  326. font-size: 15px;
  327. color: #999999;
  328. position: relative;
  329. &.current {
  330. color: #000;
  331. &:after {
  332. content: '';
  333. position: absolute;
  334. left: 50%;
  335. bottom: 0;
  336. transform: translateX(-50%);
  337. width: 44px;
  338. height: 0;
  339. border-bottom: 2px solid #fe5b38;
  340. }
  341. }
  342. }
  343. }
  344. //列表
  345. .swiper-box {
  346. .order-item:last-child {
  347. margin-bottom: 60rpx;
  348. }
  349. .order-item {
  350. width: 100%;
  351. // background-color: red;
  352. padding: 20rpx 30rpx;
  353. line-height: 1.5;
  354. display: flex;
  355. align-items: center;
  356. .title-box {
  357. flex-grow: 1;
  358. padding-right: 50rpx;
  359. .title {
  360. font-size: 30rpx;
  361. color: #333333;
  362. }
  363. .time {
  364. font-size: 26rpx;
  365. color: #AEAEAE;
  366. }
  367. }
  368. .money {
  369. color: #fd5b23;
  370. font-size: 26rpx;
  371. text-align: right;
  372. .status {
  373. color: #AEAEAE;
  374. }
  375. }
  376. }
  377. }
  378. .list-scroll-content {
  379. background: #ffffff;
  380. height: 100%;
  381. }
  382. .top-btn {
  383. margin-top: 20rpx;
  384. width: 100%;
  385. display: flex;
  386. justify-content: space-between;
  387. padding: 0 50rpx;
  388. font-size: 30rpx;
  389. font-weight: bold;
  390. color: #FFFFFF;
  391. .right {
  392. text-align: right;
  393. }
  394. .left {
  395. text-align: left;
  396. }
  397. .center {
  398. text-align: center;
  399. }
  400. view {
  401. width: 33.3%;
  402. }
  403. }
  404. </style>