kechengBind.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <view class="admin-jiazheng-list">
  3. <view class="icon-title-navBar-box">
  4. <view @click="goUpPage" class="nav-bar-icon"></view>
  5. <text class="nav-bar-title">家政人员</text>
  6. </view>
  7. <v-tabs v-model="current" :tabs="tabs" :scroll="false" @change="changeTab" field="name"
  8. class="admin-tab-box"></v-tabs>
  9. <uni-list v-if="current ==0" class="jz-scroll-view">
  10. <uni-list-item v-for="item in list" class="jz-list-item-box">
  11. <template v-slot:body>
  12. <view class="card-head-row">
  13. <button type="default" class="phone-green-btn bz-tel-btn" @click.stop="toAdd(item)">添加</button>
  14. </view>
  15. <view @click="lookUserInfo(item)" class="card-body-row">
  16. <view class="card-img-box">
  17. <img :src="item.pic" v-if="item.pic">
  18. <icon class="phone-default-userImg" v-else></icon>
  19. </view>
  20. <view class="body-content-row">
  21. <view class="content-text-row">
  22. <view> {{item.name}}</view>
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. </uni-list-item>
  28. </uni-list>
  29. <uni-list v-if="current ==1" class="jz-scroll-view">
  30. <uni-list-item v-for="item in listYx" class="jz-list-item-box">
  31. <template v-slot:body>
  32. <view class="card-head-row">
  33. <button type="default" class="phone-green-btn bz-tel-btn"
  34. @click.stop="toDelete(item)">删除</button>
  35. </view>
  36. <view @click="lookUserInfo(item)" class="card-body-row">
  37. <view class="card-img-box">
  38. <img :src="item.pic" v-if="item.pic">
  39. <icon class="phone-default-userImg" v-else></icon>
  40. </view>
  41. <view class="body-content-row">
  42. <view class="content-text-row">
  43. <view> {{item.name}}</view>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. </uni-list-item>
  49. </uni-list>
  50. <common-dialog ref="commonDialogRef" :title="deleteTitle" :content="deleteConcent"
  51. @confirm-btn="deleteQuerenBtn"></common-dialog>
  52. </view>
  53. </template>
  54. <script>
  55. import {
  56. ref
  57. } from "vue";
  58. import {
  59. kcSelectList,
  60. jiazhengKcList,
  61. jiazhengKcAdd,
  62. jiazhengKcDelete
  63. } from "@/api/jiazheng.js";
  64. import commonDialog from '@/components/dialog/commonDialog.vue';
  65. export default {
  66. data() {
  67. return {
  68. kcClassifyId: 0,
  69. id: '',
  70. current: 0,
  71. list: [],
  72. listYx: [],
  73. deleteTitle :'删除',
  74. kcId :'',
  75. deleteConcent :'你确定要执行这个操作吗',
  76. tabs: [{
  77. id: 1,
  78. name: '未绑定课程',
  79. },
  80. {
  81. id: 2,
  82. name: '已绑定课程',
  83. },
  84. ],
  85. }
  86. },
  87. components: {
  88. commonDialog,
  89. },
  90. onLoad(options) {
  91. this.id = options.id
  92. this.getList()
  93. },
  94. methods: {
  95. toAdd(data) {
  96. let req = {
  97. kcIds: [data.kcId],
  98. id: this.id
  99. }
  100. jiazhengKcAdd(req).then(res => {
  101. if (res.code == 0) {
  102. this.getList()
  103. uni.showToast({
  104. title: '添加成功',
  105. icon: 'success'
  106. });
  107. } else {
  108. uni.showToast({
  109. title: '添加失败',
  110. icon: 'success'
  111. });
  112. return false
  113. }
  114. })
  115. },
  116. deleteQuerenBtn(){
  117. let req = {
  118. kcId: this.kcId,
  119. id: this.id
  120. }
  121. jiazhengKcDelete(req).then(res => {
  122. if (res.code == 0) {
  123. this.getYxList()
  124. uni.showToast({
  125. title: '删除成功',
  126. icon: 'success'
  127. });
  128. } else {
  129. uni.showToast({
  130. title: '删除失败',
  131. icon: 'success'
  132. });
  133. return false
  134. }
  135. })
  136. },
  137. toDelete(data) {
  138. this.kcId = data.kcId
  139. this.$refs.commonDialogRef.handleShow();
  140. },
  141. changeTab(data) {
  142. this.current = data
  143. if (this.current == 0) {
  144. this.getList()
  145. } else {
  146. this.getYxList()
  147. }
  148. console.log('data', data);
  149. },
  150. goUpPage() {
  151. uni.redirectTo({
  152. url: "/pages/admin/Jiazheng/index"
  153. })
  154. },
  155. getList() {
  156. let req = {
  157. id: this.id,
  158. "kcClassifyId": this.kcClassifyId,
  159. }
  160. kcSelectList(req).then(res => {
  161. if (res.code == 0) {
  162. this.list = res.data
  163. } else {
  164. return false
  165. }
  166. })
  167. },
  168. getYxList() {
  169. let req = {
  170. id: this.id,
  171. }
  172. jiazhengKcList(req).then(res => {
  173. if (res.code == 0) {
  174. this.listYx = res.data
  175. } else {
  176. return false
  177. }
  178. })
  179. }
  180. }
  181. }
  182. </script>