userControl.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <view class="user">
  3. <view class="fix">
  4. <view class="head_top">
  5. <view class="top"></view>
  6. <view class="head">
  7. <span class="cuIcon-back" @click="back"></span>
  8. <view class="case">
  9. 用户管理
  10. </view>
  11. </view>
  12. </view>
  13. <view class="type">
  14. <view class="type_item" v-for="(item,index) in user" :key="index" :class="currentIndex == index?'active':''"
  15. @click="change(item,index)">
  16. {{item.name}}
  17. <span>({{item.num}}) </span>
  18. </view>
  19. </view>
  20. </view>
  21. <mescroll-uni class="list" :fixed="false" ref="mescrollRef" @up="getNewList" @init="mescrollInit" :use="false"
  22. v-if="currentIndex == 0">
  23. </mescroll-uni>
  24. <mescroll-uni class="list" :fixed="false" ref="mescrollRef" @up="getAllList" @init="mescrollInit" :use="false"
  25. v-if="currentIndex == 1">
  26. <view class="item" v-for="(item,index) in allList" :key="index">
  27. <view class="img">
  28. <image :src="item.userAvatar?item.userAvatar:'/static/product/user.png'" mode=""></image>
  29. </view>
  30. <view class="right">
  31. {{item.nickName}}<br />
  32. <span>{{item.phone}}</span>
  33. </view>
  34. </view>
  35. </mescroll-uni>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. data() {
  41. return {
  42. user: [{
  43. name: '新客',
  44. num: '0'
  45. },
  46. {
  47. name: '合计',
  48. num: '0'
  49. }
  50. ],
  51. currentIndex: 0,
  52. upOption: {
  53. page: {
  54. num: 0,
  55. size: 10 // 每页数据的数量,默认10
  56. },
  57. noMoreSize: 5, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  58. empty: {
  59. tip: '暂无相关数据'
  60. }
  61. },
  62. newList: [],
  63. allList: []
  64. }
  65. },
  66. methods: {
  67. //返回
  68. back() {
  69. uni.navigateBack({
  70. delta: 1
  71. });
  72. },
  73. change(item, index) {
  74. this.currentIndex = index
  75. let page = {
  76. size: 10,
  77. num: 1,
  78. }
  79. this.currentIndex == 0 ?this.allList=[]:this.newList = []
  80. this.currentIndex == 0 ? this.getNewList(page) : this.getAllList(page)
  81. },
  82. mescrollInit(mescroll) {
  83. this.mescroll = mescroll;
  84. },
  85. getNewList(page) {
  86. let data = {
  87. type: 1,
  88. pageSize: page.size,
  89. pageNo: page.num,
  90. }
  91. this.$http.post('/newCustomer/list', data).then(res => {
  92. console.log(res)
  93. this.newList = this.newList.concat(res.data.result.records)
  94. this.mescroll.endSuccess(res.data.result.records.length, res.data.result.total);
  95. })
  96. },
  97. getAllList(page) {
  98. let data = {
  99. type: 2,
  100. pageSize: page.size,
  101. pageNo: page.num,
  102. }
  103. this.$http.post('/newCustomer/list', data).then(res => {
  104. this.allList = this.allList.concat(res.data.result.records)
  105. this.mescroll.endSuccess(res.data.result.records.length, res.data.result.total);
  106. })
  107. },
  108. getNum() {
  109. let data = {}
  110. this.$http.post('/newCustomer/count', data).then(res => {
  111. this.user[0].num = res.data.result.newCustomerCount
  112. this.user[1].num = res.data.result.totalCustomerCount
  113. })
  114. }
  115. },
  116. mounted() {
  117. this.mescroll.optDown.use = false
  118. this.getNum()
  119. // this.getList()
  120. },
  121. }
  122. </script>
  123. <style scoped lang="scss">
  124. .user {
  125. width: 100%;
  126. height: 100%;
  127. background: #F7F8FC;
  128. display: flex;
  129. flex-direction: column;
  130. justify-content: space-between;
  131. position: fixed;
  132. .fix {
  133. .head_top {
  134. // background: linear-gradient( 90deg, #DFF9FF 4%, #E6F8F8 67%, #DDF1FA 100%), linear-gradient( 0, #FFFFFF 0%, rgba(247,248,252,0) 100%);
  135. background:
  136. linear-gradient(360deg, #FFFFFF 0%, rgba(255, 255, 255, 0) 100%),
  137. linear-gradient(90deg, #DFF9FF 4%, #E6F8F8 67%, #DDF1FA 100%);
  138. /*#ifdef APP-PLUS*/
  139. .top {
  140. width: 100%;
  141. height: var(--status-bar-height);
  142. }
  143. /*#endif*/
  144. .head {
  145. width: 100%;
  146. height: 112rpx;
  147. padding: 20rpx;
  148. display: flex;
  149. align-items: center;
  150. position: relative;
  151. .cuIcon-back {
  152. font-size: 40rpx;
  153. margin-right: 40rpx;
  154. }
  155. .case {
  156. position: absolute;
  157. left: 50%;
  158. transform: translateX(-50%);
  159. font-size: 36rpx;
  160. font-weight: 600;
  161. }
  162. }
  163. }
  164. .type {
  165. display: flex;
  166. justify-content: space-around;
  167. align-items: center;
  168. height: 79rpx;
  169. border-top: 1px solid #EEEEEE;
  170. border-bottom: 1px solid #EEEEEE;
  171. .type_item {
  172. font-weight: normal;
  173. font-size: 28rpx;
  174. color: #666666;
  175. span{
  176. margin-left: 20rpx;
  177. }
  178. }
  179. .active {
  180. font-size: 28rpx;
  181. color: #333333;
  182. font-weight: 600;
  183. position: relative;
  184. }
  185. .active::after {
  186. content: "";
  187. position: absolute;
  188. bottom: -10rpx;
  189. left: 50%;
  190. transform: translateX(-50%);
  191. width: 44rpx;
  192. height: 6rpx;
  193. background-color: #2D88F4;
  194. border-radius: 7rpx;
  195. }
  196. }
  197. }
  198. .list {
  199. background-color: transparent;
  200. padding: 16rpx 32rpx;
  201. overflow-y: auto;
  202. .item {
  203. width: 100%;
  204. height: 128rpx;
  205. padding: 20rpx;
  206. background: #FFFFFF;
  207. border-radius: 16rpx;
  208. margin-bottom: 16rpx;
  209. display: flex;
  210. align-items: center;
  211. .img {
  212. margin-right: 16rpx;
  213. image {
  214. width: 80rpx;
  215. height: 80rpx;
  216. }
  217. }
  218. .right {
  219. font-size: 28rpx;
  220. color: #000000;
  221. font-weight: 600;
  222. height: 100%;
  223. display: flex;
  224. flex-direction: column;
  225. justify-content: space-between;
  226. span {
  227. font-size: 24rpx;
  228. color: #8A91A8;
  229. font-weight: 400;
  230. }
  231. }
  232. }
  233. }
  234. }
  235. </style>