userControl.vue 5.6 KB

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