balanceSetting.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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">
  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 {queryBalancePaymentParam, updateBalancePaymentParam } from '@/api/shelf.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. this.status = "loading"
  67. queryBalancePaymentParam({}).then(res => {
  68. if (res.code == 200 || res.status == 204 || res.status == 200) {
  69. const list = res.data || []
  70. list.forEach(item=>{
  71. const st = item.storeParamList&&item.storeParamList[0]&&item.storeParamList[0]
  72. item.show = st && st.paramValue
  73. item.paramCode = st && st.paramCode
  74. item.paramName = st && st.paramName
  75. item.status = st && st.status
  76. item.id = st && st.id
  77. })
  78. if(_this.pageNo>1){
  79. _this.list = _this.list.concat(list)
  80. }else{
  81. _this.list = list
  82. }
  83. _this.total = list.length || 0
  84. } else {
  85. _this.list = []
  86. _this.total = 0
  87. _this.noDataText = res.message
  88. }
  89. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  90. })
  91. },
  92. // scroll-view到底部加载更多
  93. onreachBottom() {
  94. if(this.list.length < this.total){
  95. this.pageNo += 1
  96. this.getRow()
  97. }else{
  98. this.status = "nomore"
  99. }
  100. },
  101. changeShow(e,item){
  102. console.log(e,item)
  103. uni.showLoading({
  104. title: '加载中'
  105. })
  106. const userId = item.userId
  107. const shelf = this.$store.state.vuex_storeShelf
  108. updateBalancePaymentParam({id:item.id,'userId':userId,'paramValue':e,paramCode: item.paramCode,paramName:item.paramName,status:item.status}).then(res=>{
  109. uni.hideLoading()
  110. if(res.status == 200){
  111. item.show = e
  112. uni.$emit("refashHome")
  113. }else{
  114. item.show = !e ? 1 : 0
  115. }
  116. this.list.splice()
  117. uni.showToast({
  118. title: res.message,
  119. icon: 'none'
  120. })
  121. })
  122. }
  123. }
  124. }
  125. </script>
  126. <style lang="less">
  127. .page-body{
  128. height: 100vh;
  129. padding:0;
  130. }
  131. .scroll-list{
  132. .check-order-list{
  133. background: #ffffff;
  134. padding: 10upx 20upx;
  135. margin: 0 25rpx 25rpx 25rpx;
  136. border-radius: 20upx;
  137. box-shadow: 1px 1px 3px #EEEEEE;
  138. > view{
  139. padding: 0.5rem;
  140. .u-name{
  141. font-size: 32rpx;
  142. }
  143. .u-mobile{
  144. color: #666;
  145. }
  146. }
  147. }
  148. .set-item {
  149. ::v-deep .u-radio__label{
  150. flex: 1;
  151. }
  152. }
  153. }
  154. </style>