yjjl.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  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. {{userInfo.order_count || '0'}}
  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">
  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. <image src="https://api.junhailan.com/img/admin/ywc.png" mode="" class="logo" v-if="userInfo.order_count*1 >= item.number*1"></image>
  49. <image src="https://api.junhailan.com/img/admin/dwc.png" mode="" class="logo" v-else></image>
  50. <!-- <image src="" mode="" class="logo"></image> -->
  51. <view class="title-box">
  52. <view class="title">
  53. <!-- <text>{{ item.mark }}</text> -->
  54. {{item.name}}
  55. </view>
  56. <view class="time">
  57. <!-- <text>{{ item.create_time }}</text> -->
  58. <!-- 2022-12-1 09:30 -->
  59. 奖股权{{item.lj}}
  60. </view>
  61. </view>
  62. <view class="money">
  63. {{(userInfo.order_count*1 >= item.number*1 )? "已完成": '未完成'}}
  64. <!-- <view>{{ (item.pm == 0 ? '-' : '+') + 1500 }}</view>
  65. <image src="../../static/img/downright.png" mode=""></image> -->
  66. </view>
  67. </view>
  68. <u-loadmore :status="tabItem.loadingType" v-if="tabItem.loaded && tabItem.list.length > 0"/>
  69. </scroll-view>
  70. </swiper-item>
  71. </swiper>
  72. </view>
  73. </template>
  74. <script>
  75. export default {
  76. data() {
  77. return {
  78. userInfo: {},
  79. showdate: '',
  80. tabCurrentIndex: 0,
  81. height: '',
  82. id: '',
  83. navlist: [{
  84. status: 0,
  85. title: '收入',
  86. list: [],
  87. page: 1,
  88. pageSize: 1000,
  89. loaded: false,
  90. loadingType: 'loadmore'
  91. },
  92. {
  93. status: 1,
  94. title: '扣除',
  95. list: [],
  96. page: 1,
  97. pageSize: 1000,
  98. loaded: false,
  99. loadingType: 'loadmore'
  100. }
  101. ]
  102. }
  103. },
  104. onLoad(opt) {
  105. },
  106. onShow() {
  107. this.getCustomerInfo()
  108. },
  109. onReachBottom() {
  110. },
  111. onReady() {
  112. var _this = this;
  113. uni.getSystemInfo({
  114. success: resu => {
  115. const query = uni.createSelectorQuery();
  116. query.select('.swiper-box').boundingClientRect();
  117. query.exec(function(res) {
  118. _this.height = resu.windowHeight - res[0].top + 'px';
  119. console.log('打印页面的剩余高度', _this.height);
  120. });
  121. },
  122. fail: res => {}
  123. });
  124. },
  125. methods: {
  126. //顶部tab点击
  127. tabClick(index) {
  128. this.tabCurrentIndex = index;
  129. this.loadData('tab')
  130. },
  131. // 选择年月
  132. bindDateChange(e) {
  133. let time = e.detail.value.split('-')
  134. this.showdate = time[0] + '年' + time[1] + '月'
  135. this.loadData('reload')
  136. },
  137. // 获取当前年月
  138. getTime() {
  139. let date = new Date()
  140. this.showdate = date.getFullYear() + '年' + (date.getMonth() + 1) + '月'
  141. this.loadData()
  142. },
  143. // 获取数据
  144. loadData(type) {
  145. let that = this
  146. let index = that.tabCurrentIndex
  147. let item = that.navlist[index]
  148. if (type == 'reload') {
  149. item.loaded = false
  150. item.loadingType = 'more'
  151. item.page = 1
  152. item.list = []
  153. }
  154. if (type == 'tab' && item.loaded) {
  155. return
  156. }
  157. if (item.loadingType == 'loading' || item.loadingType == 'nomore') {
  158. return
  159. }
  160. item.loadingType = 'loading'
  161. this.$u.api.StaffLadder({
  162. page: item.page,
  163. pageSize: item.pageSize
  164. }).then(({data})=> {
  165. console.log(data,'返回');
  166. let arr = []
  167. let len = data.length - 1
  168. data.forEach((item,index) => {
  169. // arr.push(item.stock*1)
  170. // console.log(index);
  171. item.lj = 0
  172. for(let i = index;i<=len;i++) {
  173. item.lj = item.lj + data[i].stock*1
  174. }
  175. arr.push(item)
  176. console.log('item.lj:',item.lj);
  177. })
  178. console.log(data,arr,'arr+++');
  179. item.list = arr
  180. item.loaded = true
  181. item.loadingType = 'nomore'
  182. })
  183. },
  184. getCustomerInfo() {
  185. this.$u.api.getYgdetail({
  186. request_id: this.$store.state.userInfo.staffId
  187. }).then(({
  188. data
  189. }) => {
  190. this.userInfo = data
  191. console.log(data,'userInfo');
  192. this.loadData()
  193. })
  194. },
  195. }
  196. }
  197. </script>
  198. <style lang="scss">
  199. .user-top {
  200. width: 100%;
  201. height: 400rpx;
  202. background-color: #4075d6;
  203. display: flex;
  204. flex-direction: column;
  205. justify-content: center;
  206. align-items: center;
  207. padding-bottom: 60rpx;
  208. // position: relative;
  209. .top-tit {
  210. font-size: 30rpx;
  211. font-weight: bold;
  212. color: #FFFFFF;
  213. }
  214. .top-val {
  215. font-size: 72rpx;
  216. font-weight: 500;
  217. color: #FFFFFF;
  218. }
  219. .select-time {
  220. position: absolute;
  221. top: 30rpx;
  222. right: 30rpx;
  223. font-size: 26rpx;
  224. font-weight: 500;
  225. color: #fff;
  226. display: flex;
  227. align-items: center;
  228. image {
  229. width: 17rpx;
  230. margin-left: 10rpx;
  231. }
  232. }
  233. }
  234. .sz-wrap {
  235. width: 670rpx;
  236. height: 186rpx;
  237. background: #FFFFFF;
  238. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  239. border-radius: 20rpx;
  240. margin: -90rpx auto 20rpx;
  241. display: flex;
  242. justify-content: center;
  243. align-items: center;
  244. .jg {
  245. width: 2rpx;
  246. height: 74rpx;
  247. background: #DCDFE6;
  248. }
  249. .sz-item {
  250. width: 330rpx;
  251. height: 100%;
  252. display: flex;
  253. flex-direction: column;
  254. align-items: center;
  255. justify-content: center;
  256. font-size: 30rpx;
  257. font-weight: bold;
  258. .sz-tit {
  259. color: #999999;
  260. }
  261. .sz-val {
  262. margin-top: 30rpx;
  263. color: #181818;
  264. }
  265. }
  266. }
  267. .navbar {
  268. margin-top: 20rpx;
  269. display: flex;
  270. height: 88rpx;
  271. padding: 0 5px;
  272. background: #fff;
  273. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  274. position: relative;
  275. z-index: 10;
  276. .nav-item {
  277. flex: 1;
  278. display: flex;
  279. justify-content: center;
  280. align-items: center;
  281. height: 100%;
  282. font-size: 15px;
  283. color: #999999;
  284. position: relative;
  285. &.current {
  286. color: #000;
  287. &:after {
  288. content: '';
  289. position: absolute;
  290. left: 50%;
  291. bottom: 0;
  292. transform: translateX(-50%);
  293. width: 44px;
  294. height: 0;
  295. border-bottom: 2px solid #fe5b38;
  296. }
  297. }
  298. }
  299. }
  300. //列表
  301. .swiper-box {
  302. margin-top: 20rpx;
  303. padding: 0 20rpx;
  304. background-color: #fff;
  305. .order-item:last-child {
  306. margin-bottom: 60rpx;
  307. }
  308. .order-item {
  309. width: 100%;
  310. // background-color: red;
  311. padding: 20rpx 30rpx;
  312. line-height: 1.5;
  313. display: flex;
  314. align-items: center;
  315. border-bottom: 1rpx solid #F0F0F0;
  316. .logo {
  317. flex-shrink: 0;
  318. margin-right: 20rpx;
  319. width: 45rpx;
  320. height: 45rpx;
  321. border-radius: 50%;
  322. background-color: #eee;
  323. }
  324. .title-box {
  325. flex-grow: 1;
  326. padding-right: 50rpx;
  327. .title {
  328. font-size: 30rpx;
  329. color: #333333;
  330. }
  331. .time {
  332. font-size: 26rpx;
  333. color: #AEAEAE;
  334. }
  335. }
  336. .money {
  337. color: #AEAEAE;
  338. min-width: 150rpx;
  339. font-size: 26rpx;
  340. text-align: right;
  341. display: flex;
  342. align-items: center;
  343. justify-content: flex-end;
  344. image {
  345. width: 10rpx;
  346. height: 20rpx;
  347. margin-left: 15rpx;
  348. }
  349. .status {
  350. color: #AEAEAE;
  351. }
  352. }
  353. }
  354. }
  355. .list-scroll-content {
  356. background: #ffffff;
  357. height: 100%;
  358. }
  359. </style>