index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <container title="店铺管理">
  3. <template v-slot:btn>
  4. <el-button type="primary" @click="handelEdit('')"
  5. >添加店铺</el-button
  6. >
  7. <el-button @click="batchDel">批量删除</el-button>
  8. </template>
  9. <search-box-new
  10. :formData="formData"
  11. :formList="formList"
  12. @search="search"
  13. @init="init"
  14. />
  15. <table-list
  16. ref="tableList"
  17. :tableSets="tableSet"
  18. :tableData="tableData"
  19. :navText="navText"
  20. rowKey="id"
  21. :loading="loading"
  22. >
  23. <template slot="status" slot-scope="props">
  24. <el-switch
  25. v-model="props.scope.row.status"
  26. active-color="#13ce66"
  27. inactive-color="#ff4949"
  28. :active-value="1"
  29. :inactive-value="0"
  30. @change="statusChange($event, props.scope.row)"
  31. >
  32. </el-switch>
  33. </template>
  34. <template slot="btn" slot-scope="props">
  35. <el-button type="text" @click="handelEdit(props.scope.row.storeId)"
  36. >编辑</el-button
  37. >
  38. <el-button type="text" @click="handelDel(props.scope.row.storeId)"
  39. >删除</el-button
  40. >
  41. </template>
  42. </table-list>
  43. <pagination
  44. :total="total"
  45. :pageSize.sync="formData.pageSize"
  46. :currentPage.sync="formData.pageNum"
  47. @search="search"
  48. />
  49. <Store-set-dlg
  50. :storeId="storeId"
  51. :dialogVisible.sync="dialogVisible"
  52. ></Store-set-dlg>
  53. </container>
  54. </template>
  55. <script>
  56. import StoreSetDlg from "./components/StoreSetDlg.vue";
  57. import { getStoreList } from "../../api/store/index";
  58. export default {
  59. name: "SaasMemberRecord",
  60. data() {
  61. return {
  62. loading: false,
  63. navText: {
  64. index: 0,
  65. num: true,
  66. choice: true,
  67. addHide: true,
  68. openCheckMore: true,
  69. custom: false,
  70. },
  71. formData: {},
  72. tableSet: [
  73. {
  74. label: "店铺简称",
  75. prop: "storeName",
  76. },
  77. {
  78. label: "店铺地址",
  79. prop: "address",
  80. },
  81. {
  82. label: "启动状态",
  83. prop: "status",
  84. scope: "solt",
  85. soltName: "status",
  86. },
  87. {
  88. label: "创建时间",
  89. prop: "createTime",
  90. scope: "aTimeList",
  91. },
  92. ],
  93. tableData: [],
  94. total: 0,
  95. formList: [
  96. {
  97. prop: "storeName",
  98. placeholder: "请输入店铺简称",
  99. },
  100. ],
  101. dialogVisible: false,
  102. storeId: "",
  103. };
  104. },
  105. mounted() {
  106. this.init();
  107. },
  108. methods: {
  109. init() {
  110. this.search(2);
  111. },
  112. search(v) {
  113. if (v === 2) {
  114. this.formData = {
  115. pageSize: 10,
  116. pageNum: 1,
  117. storeName: undefined,
  118. };
  119. }
  120. this.loading = true;
  121. getStoreList(this.formData)
  122. .then((res) => {
  123. this.tableData = res.rows;
  124. this.total = res.total;
  125. })
  126. .finally(() => {
  127. this.loading = false;
  128. });
  129. },
  130. del(id) {
  131. this.$confirm("确定删除吗?", "提示", {
  132. confirmButtonText: "确定",
  133. cancelButtonText: "取消",
  134. type: "warning",
  135. })
  136. .then(() => {})
  137. .catch(() => {});
  138. },
  139. handelEdit(storeId) {
  140. this.storeId = storeId;
  141. this.dialogVisible = true;
  142. },
  143. batchDel() {
  144. let len = this.$refs.tableList.allCheckData.length;
  145. if (!len) {
  146. return this.$message.warning("请先勾选店员");
  147. }
  148. this.$confirm(`此操作将永久删除所勾选的${len}条店员, 是否继续?`, "提示", {
  149. confirmButtonText: "确定",
  150. cancelButtonText: "取消",
  151. type: "warning",
  152. })
  153. .then(() => {
  154. const ids = this.$refs.tableList.allCheckData.map(
  155. (item) => item.moduleExamId
  156. );
  157. moduleVolumeBatchDel({
  158. status: -1,
  159. ids,
  160. }).then((res) => {
  161. this.$message.success("批量删除成功");
  162. this.$refs.tableList.clearMoreActive();
  163. this.search(1);
  164. });
  165. })
  166. .catch(() => {});
  167. },
  168. statusChange(e, row) {
  169. // this.$api
  170. // .editmallstore({ storeId: row.storeId, status: e })
  171. // .then((res) => {
  172. // this.$message.success("操作成功");
  173. // row.status = e;
  174. // })
  175. // .catch(() => {
  176. // return (row.status = e ? 0 : 1);
  177. // });
  178. },
  179. },
  180. components: { StoreSetDlg },
  181. };
  182. </script>
  183. <style lang="scss" scoped></style>