list.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <view class="phone-list-page phone-banzheng-page">
  3. <view class="phone-navBar-box">
  4. <view @click="goUpPage" class="nav-bar-icon"></view>
  5. <text class="nav-bar-title">子账号管理</text>
  6. <uni-icons class="nav-bar-right-icon" type="search" size="22" color="#666" @click="searchBtn"></uni-icons>
  7. </view>
  8. <view class="banzheng-search-box">
  9. <view class="select-item-box">
  10. </view>
  11. <view class="filter-btn" @click="handleAddZizhanghao">新增</view>
  12. </view>
  13. <!-- 课程列表 -->
  14. <scroll-view scroll-y="true" refresher-enabled="true" :refresher-triggered="data.loading"
  15. :refresher-threshold="50" refresher-background="transparent" @refresherrefresh="onRefresh"
  16. class="phone-scroll-saixuan-view">
  17. <uni-list>
  18. <uni-list-item v-for="item in data.list" class="banzheng-list-item-box">
  19. <template v-slot:body>
  20. <view>
  21. <view class="banzheng-list-card-box">
  22. <view>家政公司: {{item.jzName}}</view>
  23. <view>姓名:{{item.realName}}</view>
  24. <view>手机:{{item.userName}}</view>
  25. </view>
  26. <view>
  27. <button @click="handleEditor(item)">编辑</button>
  28. <button @click="handleDelete(item)">删除</button>
  29. <button @click="handleReset(item)">重置密码</button>
  30. </view>
  31. </view>
  32. </template>
  33. </uni-list-item>
  34. <uni-load-more :status="data.state" @click="getMore(0)" :contentText="data.contentText"></uni-load-more>
  35. </uni-list>
  36. </scroll-view>
  37. <!-- 页面底端 -->
  38. <customTabbarClientVue :current-tab="0"></customTabbarClientVue>
  39. <!-- 搜索 -->
  40. <search-dialog ref="searchDialogRef" @search-btn="dialogSearchBtn"
  41. @reset-search="dialogSearchReset"></search-dialog>
  42. <!-- 删除子账号 -->
  43. <common-dialog ref="commonDialogRef" :title="deleteTitle" :content="deleteConcent"
  44. @confirm-btn="deleteQuerenBtn"></common-dialog>
  45. <!-- 新增子账号 -->
  46. <addUserDlVue ref="addUserRef" title="新增" @confirm-btn="onAddSuccess"></addUserDlVue>
  47. <!-- 更新子账号 -->
  48. <editorUserDlVue ref="editorUserRef" title="编辑" @confirm-btn="onUpdateSuccess"></editorUserDlVue>
  49. <!-- 更新密码 -->
  50. <resetPasswordVue ref="resetPasswordRef"></resetPasswordVue>
  51. </view>
  52. </template>
  53. <script setup>
  54. import searchDialog from "@/pages/admin/banzheng/search.vue";
  55. import commonDialog from '@/components/dialog/commonDialog.vue';
  56. import customTabbarClientVue from "@/components/custom-tabbar/custom-tabbar-admin.vue";
  57. import addUserDlVue from "./components/addUserDl.vue";
  58. import editorUserDlVue from "./components/editorUserDl.vue";
  59. import resetPasswordVue from "./components/resetPassword.vue";
  60. import {
  61. reactive,
  62. ref
  63. } from "vue";
  64. import {
  65. onLoad
  66. } from "@dcloudio/uni-app"
  67. import {
  68. getUserGuanliList,
  69. getUserGuanliDelete
  70. } from "@/api/zizhanghao.js"
  71. const data = reactive({
  72. list: [], // 办证列表
  73. loading: false,
  74. page: 0,
  75. size: 10,
  76. state: 'more',
  77. contentText: {
  78. contentdown: '查看更多',
  79. contentrefresh: '加载中',
  80. contentnomore: '没有更多'
  81. },
  82. userName: '', // 手机号
  83. realName: '', // 姓名
  84. })
  85. const deleteTitle = ref('删除')
  86. const deleteConcent = ref('你确定要执行这个操作吗')
  87. const deletUserId = ref(null)
  88. const addUserRef = ref(null)
  89. const editorUserRef = ref(null)
  90. const commonDialogRef = ref(null)
  91. const resetPasswordRef = ref(null)
  92. const searchDialogRef = ref(null)
  93. function goUpPage() {
  94. uni.redirectTo({
  95. url: '/pages/admin/ShouYe/shouye'
  96. })
  97. }
  98. function handleEditor(item) {
  99. editorUserRef.value.handleShow(item.userId);
  100. }
  101. function handleDelete(item) {
  102. deletUserId.value = item.userId;
  103. commonDialogRef.value.handleShow();
  104. }
  105. function handleReset(item) {
  106. resetPasswordRef.value.handleShow(item.userId)
  107. }
  108. function onAddSuccess() {
  109. data.page = 0;
  110. refreshData();
  111. }
  112. function onUpdateSuccess() {
  113. data.page = 0;
  114. refreshData();
  115. }
  116. function handleAddZizhanghao() {
  117. addUserRef.value.handleShow()
  118. }
  119. function searchBtn() {
  120. searchDialogRef.value.handleShow();
  121. }
  122. function refreshData() {
  123. const opt = {
  124. realName: data.realName, // 姓名
  125. userName: data.userName, // 手机号
  126. page: 1,
  127. size: 10, // 固定查询10条
  128. }
  129. data.list = [];
  130. // 数学
  131. data.state = 'loading';
  132. data.page++;
  133. opt.page = data.page;
  134. getUserGuanliList(opt).then(res => {
  135. data.list = data.list.concat(res.data.data);
  136. data.loading = false;
  137. if (res.data.total > data.list.length) {
  138. data.state = 'more';
  139. data.loading = false;
  140. } else {
  141. data.state = 'no-more';
  142. data.loading = false;
  143. }
  144. }).catch(err => {
  145. data.state = 'more';
  146. data.loading = false;
  147. })
  148. }
  149. function getMore() {
  150. const opt = {
  151. realName: data.realName, // 姓名
  152. userName: data.userName, // 手机号
  153. page: 1,
  154. size: 10, // 固定查询10条
  155. }
  156. if (data.state == 'no-more') return;
  157. data.state = 'loading';
  158. data.page++;
  159. opt.page = data.page;
  160. getUserGuanliList(opt).then(res => {
  161. data.list = data.list.concat(res.data.data);
  162. data.loading = false;
  163. if (res.data.total > data.list.length) {
  164. data.state = 'more';
  165. data.loading = false;
  166. } else {
  167. data.state = 'no-more';
  168. data.loading = false;
  169. }
  170. }).catch(err => {
  171. data.state = 'more';
  172. data.loading = false;
  173. })
  174. }
  175. function onRefresh() {
  176. data.page = 0;
  177. data.list = [];
  178. data.loading = true;
  179. refreshData();
  180. }
  181. function dialogSearchBtn(name, searchData) {
  182. switch (name) {
  183. case '姓名':
  184. dialogSearchReset();
  185. data.realName = searchData.value;
  186. break;
  187. case '手机号':
  188. data.userName = searchData.value;
  189. break;
  190. }
  191. data.page = 0;
  192. refreshData();
  193. }
  194. function dialogSearchReset() {
  195. data.userName = '';
  196. data.realName = '';
  197. }
  198. function deleteQuerenBtn() {
  199. getUserGuanliDelete({
  200. userId: deletUserId.value
  201. }).then(res => {
  202. if (res.code == 0) {
  203. uni.showToast({
  204. title: '成功'
  205. })
  206. data.page = 0;
  207. refreshData();
  208. } else {
  209. uni.showToast({
  210. title: '失败'
  211. })
  212. }
  213. })
  214. }
  215. onLoad(() => {
  216. getMore()
  217. })
  218. </script>
  219. <style>
  220. </style>