index.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <template>
  2. <div>
  3. <ListPage :column="listPageData.tableColumn" :tableApi="listPageData.tableApi" :isSelect="listPageData.isSelect"
  4. :scopeBtns="listPageData.scopeBtns" :searchBtns="listPageData.searchBtns" ref="userTableRef"
  5. v-if="options && options.length > 0" :tabList="tabList" tabsearchKey="appStatus" />
  6. <DialogForm ref="dialogFormRef" :title="title" :column="dialogData.column" @submit="submitForm" />
  7. </div>
  8. </template>
  9. <script setup>
  10. import { ref } from 'vue';
  11. import ListPage from '@/views/components/ListPage/index.vue';
  12. import { list, approval } from "@/api/staff/volunteer.js";
  13. import { getTreeList } from "@/api/staff/price.js";
  14. import DialogForm from '@/views/components/DialogForm/index.vue';
  15. const { proxy } = getCurrentInstance();
  16. const { volunteer_app_status } = proxy.useDict("volunteer_app_status");
  17. const options = ref([]);
  18. const userTableRef = ref();
  19. const dialogFormRef = ref(null);
  20. const listPageData = reactive({
  21. tableColumn: [
  22. {
  23. label: '注册时间',
  24. prop: 'createTime',
  25. type: 'date',
  26. isSearch: false,
  27. keys: ['start', 'end'],
  28. width: '180px'
  29. },
  30. {
  31. label: '姓名',
  32. prop: 'name',
  33. type: 'input',
  34. isSearch: true,
  35. },
  36. {
  37. label: '服务项目',
  38. prop: 'businessManagementId',
  39. type: 'cascader',
  40. isSearch: true,
  41. tableProp: 'businessTierName',
  42. options: options,
  43. props: { label: 'businessName', value: 'id', checkStrictly: true },
  44. },
  45. // {
  46. // label: '项目类别',
  47. // prop: 'projectTypeName',
  48. // },
  49. // {
  50. // label: '科目',
  51. // prop: 'projectTypeName',
  52. // },
  53. {
  54. label: '手机号',
  55. prop: 'phonenumber',
  56. type: 'input',
  57. isSearch: true
  58. },
  59. {
  60. label: '家庭地址',
  61. prop: 'address',
  62. },
  63. {
  64. label: '服务图片',
  65. prop: 'volunteerPicture',
  66. type: 'img',
  67. },
  68. {
  69. label: '身份证件',
  70. prop: ['idCardPictureFront','idCardPictureBack'],
  71. type: 'img',
  72. },
  73. {
  74. label: '资质证书',
  75. prop: 'certificationPicture',
  76. type: 'img',
  77. },
  78. {
  79. label: '个人简介',
  80. prop: 'skillDescribe',
  81. width: '400px',
  82. },
  83. {
  84. label: '审核状态',
  85. prop: 'appStatus',
  86. type: 'dict',
  87. dict: volunteer_app_status
  88. },
  89. ],
  90. searchBtns: [
  91. // {
  92. // label: '批量删除',
  93. // func: () => {
  94. // const ids = userTableRef.value.ids;
  95. // console.log('批量删除', ids)
  96. // handleDelete(ids);
  97. // },
  98. // key: 'deletes',
  99. // hasPermi: ['manage:delete'],
  100. // type: 'danger'
  101. // },
  102. ],
  103. tableApi: list,//接口地址
  104. isSelect: false,//是否勾选
  105. scopeBtns: [
  106. {
  107. label: '审核',
  108. type: 'primary',
  109. hasPermi: ['manage:examine'],
  110. key: 'examine',
  111. func: (row) => {
  112. console.log(row)
  113. openDialog(row, 'examine')
  114. },
  115. show: (row) => {
  116. return row.appStatus == 1
  117. }
  118. },
  119. {
  120. label: '查看详情',
  121. type: 'primary',
  122. hasPermi: ['manage:details'],
  123. key: 'details',
  124. func: (row) => {
  125. console.log(row)
  126. openDialog(row)
  127. }
  128. },
  129. // {
  130. // label: '删除',
  131. // type: 'danger',
  132. // hasPermi: ['manage:delete'],
  133. // key: 'delete',
  134. // func: (row) => {
  135. // console.log(row)
  136. // handleDelete([row.id])
  137. // }
  138. // }
  139. ]
  140. })
  141. const dialogData = reactive({
  142. title: '',
  143. column: [
  144. {
  145. label: '姓名',
  146. prop: 'name',
  147. type: 'text',
  148. },
  149. {
  150. label: '年龄',
  151. prop: 'age',
  152. type: 'text',
  153. },
  154. {
  155. label: '电话',
  156. prop: 'phonenumber',
  157. type: 'text',
  158. },
  159. {
  160. label: '家庭地址',
  161. prop: 'address',
  162. type: 'text',
  163. },
  164. {
  165. label: '服务项目/类别',
  166. prop: 'businessTierName',
  167. type: 'text',
  168. // options: options,
  169. // props: { label: 'businessName', value: 'id', checkStrictly: true },
  170. },
  171. {
  172. label: '服务时长',
  173. prop: 'businessDuration',
  174. type: 'text',
  175. dese: '分钟'
  176. },
  177. {
  178. label: '服务价格',
  179. prop: 'businessPrice',
  180. type: 'text',
  181. dese: '元'
  182. },
  183. {
  184. label: '服务图片',
  185. prop: 'volunteerPicture',
  186. type: 'img',
  187. },
  188. {
  189. label: '身份证件',
  190. prop: ['idCardPictureFront','idCardPictureBack'],
  191. type: 'img',
  192. },
  193. {
  194. label: '职业证书',
  195. prop: 'certificationPicture',
  196. type: 'img',
  197. },
  198. {
  199. label: '个人简介',
  200. prop: 'skillDescribe',
  201. type: 'text',
  202. },
  203. {
  204. label: '审核状态',
  205. prop: 'appStatus',
  206. type: 'radio',
  207. rules: [
  208. { required: true, message: '请选择审核状态', trigger: 'blur' }
  209. ],
  210. options: [
  211. {
  212. label: '通过',
  213. value: '2'
  214. },
  215. {
  216. label: '不通过',
  217. value: '3'
  218. }
  219. ]
  220. },
  221. {
  222. label: '驳回原因',
  223. prop: 'rejectReason',
  224. type: 'textarea',
  225. rules: [
  226. { required: true, message: '请填写驳回原因', trigger: 'blur' }
  227. ],
  228. show: (form) => {
  229. console.log('驳回原因', form);
  230. return form.appStatus === '3'
  231. }
  232. },
  233. ]
  234. })
  235. const { title } = toRefs(dialogData);
  236. const parentId = ref(0);
  237. const tabList = [
  238. {
  239. title: '已通过',
  240. name: '2',
  241. },
  242. {
  243. title: '待审核',
  244. name: '1',
  245. },
  246. ]
  247. const openDialog = (data, type) => {
  248. const row = JSON.parse(JSON.stringify(data));
  249. try {
  250. const disabledData = {
  251. name: true,
  252. age: true,
  253. phonenumber: true,
  254. address: true,
  255. skillDescribe: true,
  256. businessTierName: true,
  257. businessDuration: true,
  258. businessPrice: true
  259. }
  260. if (type) {
  261. //审核
  262. title.value = '审核'
  263. row.appStatus = '';
  264. } else {
  265. disabledData['appStatus'] = true;
  266. disabledData['rejectReason'] = true;
  267. //查看详情
  268. title.value = '查看详情'
  269. }
  270. dialogFormRef.value.initForm(row, disabledData)
  271. } catch (error) {
  272. console.log('error', error);
  273. } finally {
  274. console.log('dialogFormRef.value', dialogFormRef.value);
  275. dialogFormRef.value.handleDialog(true);
  276. }
  277. }
  278. const submitForm = async (parmas) => {
  279. try {
  280. console.log('submit', parmas);
  281. if (title.value === '审核') {
  282. const res = await approval({
  283. volunteerInfoId: parmas.volunteerInfoId,
  284. appStatus: parmas.appStatus,
  285. rejectReason: parmas.rejectReason
  286. })
  287. if (res.code === 200) {
  288. proxy.$modal.msgSuccess("审核成功");
  289. userTableRef.value.resetForm();
  290. dialogFormRef.value.handleDialog(false);
  291. return;
  292. }
  293. proxy.$modal.msgSuccess(res.msg);
  294. }
  295. } catch (error) {
  296. console.log('error', error);
  297. }
  298. }
  299. const getTreeListData = async () => {
  300. try {
  301. const res = await getTreeList({ parentId: parentId.value });
  302. console.log('res', res);
  303. options.value = res.data;
  304. } catch (error) {
  305. }
  306. }
  307. getTreeListData();
  308. </script>
  309. <style lang='scss' scoped></style>