vipers.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <view class="content">
  3. <view class="search">
  4. <u-search placeholder="请输入信息搜索会员" v-model="name" @custom="getData" @change="getData"></u-search>
  5. </view>
  6. <view class="card" v-for="(item,index) in dataList" :key="index">
  7. <view class="row">
  8. <view class="row half">
  9. <view class="name">
  10. 昵称
  11. </view>
  12. <view class="text">
  13. {{item.nickname}}
  14. </view>
  15. </view>
  16. <view class="row half">
  17. <view class="name">
  18. 手机号
  19. </view>
  20. <view class="text">
  21. {{item.mobile}}
  22. </view>
  23. </view>
  24. </view>
  25. <view class="row">
  26. <view class="row half">
  27. <view class="name">
  28. 会员等级
  29. </view>
  30. <view class="text">
  31. {{item.level_text}}
  32. </view>
  33. </view>
  34. <view class="row half" @click="eidt(item.id)">
  35. <view class="btn">
  36. 编辑
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <!-- 会员等级选择 -->
  42. <u-picker mode="selector" v-model="show" :range="level" range-key="cateName" title="设置会员等级" @confirm="set" @cancel="cancel"></u-picker>
  43. </view>
  44. </template>
  45. <script>
  46. export default {
  47. data() {
  48. return {
  49. show: false,
  50. level: [{
  51. cateName: '普通会员',
  52. id: 0
  53. },
  54. {
  55. cateName: '黄金会员',
  56. id: 1
  57. },
  58. {
  59. cateName: '铂金会员',
  60. id: 10
  61. },
  62. {
  63. cateName: '钻石会员',
  64. id: 20
  65. },
  66. ],
  67. dataList:[],
  68. name:"",
  69. userId:'',
  70. }
  71. },
  72. onLoad(){
  73. this.getData()
  74. },
  75. methods: {
  76. // 设置会员等级
  77. set(e){
  78. console.log(e,1111)
  79. let level = 0;
  80. if(e[0]=== 0){
  81. level = 0;
  82. }
  83. if(e[0]=== 1){
  84. level = 1;
  85. }
  86. if(e[0]=== 2){
  87. level = 10;
  88. }
  89. if(e[0]=== 3){
  90. level = 20;
  91. }
  92. this.request("/admin_user/setLevel",{user_id:this.userId,level:level},"GET").then(res=>{
  93. console.log(res)
  94. if(res.code === 1){
  95. this.$u.toast('操作成功')
  96. this.getData()
  97. }else{
  98. this.$u.toast(res.msg)
  99. }
  100. })
  101. },
  102. // 取消设置会员等级
  103. cancel(){
  104. this.userId = ""
  105. },
  106. // 获取数据列表
  107. getData(){
  108. this.request("/admin_user/list",{keyword:this.name},"GET").then(res=>{
  109. if(res.code === 1){
  110. this.dataList = res.data.data
  111. }
  112. })
  113. },
  114. // 点击编辑
  115. eidt(id) {
  116. this.show = true
  117. this .userId = id;
  118. }
  119. }
  120. }
  121. </script>
  122. <style lang="scss">
  123. .content {
  124. padding-top: 120rpx;
  125. }
  126. .search {
  127. padding: 30rpx;
  128. background-color: #FFFFFF;
  129. position: fixed;
  130. top: 0;
  131. width: 100vw;
  132. }
  133. .card {
  134. background-color: #FFFFFF;
  135. width: 93%;
  136. margin: 0 auto;
  137. margin-top: 40rpx;
  138. padding: 30rpx;
  139. border-radius: 30rpx;
  140. height: 150rpx;
  141. display: flex;
  142. flex-direction: column;
  143. align-items: center;
  144. justify-content: space-between;
  145. .half {
  146. width: 50%;
  147. justify-content: flex-start;
  148. .name {
  149. color: #999;
  150. }
  151. .text {
  152. text-indent: 1em;
  153. }
  154. .btn {
  155. width: 100%;
  156. display: flex;
  157. flex-direction: row;
  158. align-items: center;
  159. justify-content: flex-end;
  160. }
  161. }
  162. }
  163. </style>