shopShow.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view class="page-body scroll-list">
  3. <scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
  4. <view style="height: 20rpx;" ></view>
  5. <view
  6. class="check-order-list"
  7. v-for="(item,index) in list"
  8. :key="item.userId"
  9. >
  10. <view class="flex align_center justify_between" @click="editPerson(item)">
  11. <view class="u-name">
  12. <text style="margin-right: 0.5rem;">{{item.userName}}</text>
  13. </view>
  14. <view class="u-mobile">
  15. <text v-if="item.isManager == 1">门店负责人/ </text>
  16. <text v-if="item.isManager == 0 && item.roleName">{{item.roleName}} / </text>
  17. {{item.phone}}
  18. </view>
  19. </view>
  20. <view class="set-item flex align_center justify_between">
  21. 商城是否显示:
  22. <u-radio-group @change="e=>changeShow(e,item)" v-model="item.show" :width="150">
  23. <u-radio :name="1">是</u-radio>
  24. <u-radio :name="0">否</u-radio>
  25. </u-radio-group>
  26. </view>
  27. </view>
  28. <view style="padding:0 30upx 30upx;">
  29. <u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
  30. <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
  31. </view>
  32. </scroll-view>
  33. </view>
  34. </template>
  35. <script>
  36. import {getShopUserParamList, updateShopUserParam } from '@/api/bizParam.js'
  37. import moment from 'moment'
  38. export default{
  39. name:'personnel',
  40. data(){
  41. return{
  42. status: 'loading',
  43. noDataText: '暂无数据',
  44. // 查询条件
  45. pageNo: 1,
  46. pageSize: 1000,
  47. list: [],
  48. total: 0,
  49. }
  50. },
  51. onShow() {
  52. this.getRow(1)
  53. },
  54. computed:{
  55. userInfo(){
  56. return this.$store.state.vuex_userInfo
  57. },
  58. hasOnlyAdmin(){
  59. return this.list.length ==1 && this.list[0].isManager == 1 || this.list.length == 0
  60. }
  61. },
  62. methods:{
  63. // 查询列表
  64. getRow (pageNo) {
  65. let _this = this
  66. const shelf = this.$store.state.vuex_storeShelf
  67. let params = {
  68. shelfSn: shelf.shelfSn
  69. }
  70. this.status = "loading"
  71. getShopUserParamList(params).then(res => {
  72. if (res.code == 200 || res.status == 204 || res.status == 200) {
  73. const list = res.data || []
  74. list.forEach(item=>{
  75. item.show = item.paramMap && item.paramMap.mall_flag && item.paramMap.mall_flag.paramValue
  76. })
  77. if(_this.pageNo>1){
  78. _this.list = _this.list.concat(list)
  79. }else{
  80. _this.list = list
  81. }
  82. _this.total = list.length || 0
  83. } else {
  84. _this.list = []
  85. _this.total = 0
  86. _this.noDataText = res.message
  87. }
  88. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  89. })
  90. },
  91. // scroll-view到底部加载更多
  92. onreachBottom() {
  93. if(this.list.length < this.total){
  94. this.pageNo += 1
  95. this.getRow()
  96. }else{
  97. this.status = "nomore"
  98. }
  99. },
  100. changeShow(e,item){
  101. console.log(e,item)
  102. uni.showLoading({
  103. title: '加载中'
  104. })
  105. const userId = item.userId
  106. const shelf = this.$store.state.vuex_storeShelf
  107. updateShopUserParam({'userId':userId,'paramValue':e,shelfSn: shelf.shelfSn}).then(res=>{
  108. uni.hideLoading()
  109. if(res.status == 200){
  110. item.show = e
  111. uni.$emit("refashHome")
  112. }else{
  113. item.show = !e ? 1 : 0
  114. }
  115. this.list.splice()
  116. uni.showToast(res.message)
  117. })
  118. }
  119. }
  120. }
  121. </script>
  122. <style lang="less">
  123. .page-body{
  124. height: 100vh;
  125. padding:0;
  126. }
  127. .scroll-list{
  128. .check-order-list{
  129. background: #ffffff;
  130. padding: 10upx 20upx;
  131. margin: 0 25rpx 25rpx 25rpx;
  132. border-radius: 20upx;
  133. box-shadow: 1px 1px 3px #EEEEEE;
  134. > view{
  135. padding: 0.5rem;
  136. .u-name{
  137. font-size: 32rpx;
  138. }
  139. .u-mobile{
  140. color: #666;
  141. }
  142. }
  143. }
  144. .set-item {
  145. /deep/ .u-radio__label{
  146. flex: 1;
  147. }
  148. }
  149. }
  150. </style>