member.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <My_listbox ref="List" @getlist="getList">
  3. <view style="height: 10px;" />
  4. <user-list :list="list" @onClick="onClick" />
  5. </My_listbox>
  6. </template>
  7. <script>
  8. import userList from "../../components/userList"
  9. export default {
  10. components: { userList },
  11. data() {
  12. return {
  13. list: [],
  14. "content": {
  15. "sa_storeid": 0,
  16. "pageNumber": 1,
  17. "pageSize": 20
  18. }
  19. }
  20. },
  21. onLoad(options) {
  22. uni.setNavigationBarTitle({
  23. title: options.title || '添加门店成员',
  24. });
  25. this.content.sa_storeid = options.id;
  26. this.getList(true);
  27. },
  28. onUnload() {
  29. this.$Http.uploadUserList && this.$Http.uploadUserList()
  30. },
  31. methods: {
  32. getList(init = false) {
  33. if (this.paging(this.content, init)) return;
  34. this.$Http.basic({
  35. "id": "20240410142002",
  36. content: this.content
  37. }).then(res => {
  38. this.$refs.List.RefreshToComplete()
  39. console.log("获取可添加人员列表", res)
  40. if (this.cutoff(res.msg)) return;
  41. this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
  42. this.content = this.$refs.List.paging(this.content, res)
  43. })
  44. },
  45. onClick(item) {
  46. let that = this;
  47. uni.showModal({
  48. title: "提示",
  49. content: `是否确定添加“${item.name}”至门店人员中?`,
  50. success: ({ confirm }) => {
  51. if (confirm) that.$Http.basic({
  52. "id": "20240410153502",
  53. "content": {
  54. "sa_storeid": that.content.sa_storeid,
  55. "sys_enterprise_hrids": [item.sys_enterprise_hrid]
  56. }
  57. }).then(res => {
  58. console.log("添加成员", res)
  59. if (that.cutoff(res.msg, '添加成功!')) return;
  60. that.onInsert()
  61. })
  62. },
  63. })
  64. },
  65. onInsert() {
  66. if (this.content.pageNumber && this.content.pageNumber >= 2) {
  67. let content = this.paging(this.content, true, true)
  68. this.$Http.basic({
  69. "id": "20240410142002",
  70. content
  71. }).then(res => {
  72. console.log("更新人员列表", res)
  73. if (this.cutoff(res.msg)) return;
  74. this.list = res.data;
  75. this.$refs.List.paging(content, res, true)
  76. })
  77. }
  78. },
  79. },
  80. }
  81. </script>
  82. <style lang="scss"></style>