index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <div class="squrt"></div>
  5. 机构列表
  6. </h2>
  7. <div class="m-core">
  8. <save-form
  9. :inline="true"
  10. class="searchForm"
  11. ref="searchForm"
  12. @submit="search"
  13. @reset="reset"
  14. :saveKey="'platformServiceManager'"
  15. :model.sync="searchForm"
  16. >
  17. <el-form-item :rules="[]">
  18. <el-input v-model="searchForm.search" placeholder="机构编号/名称/电话"></el-input>
  19. </el-form-item>
  20. <el-form-item prop="createTimer">
  21. <el-date-picker
  22. v-model.trim="searchForm.createTimer"
  23. type="daterange"
  24. value-format="yyyy-MM-dd"
  25. range-separator="至"
  26. start-placeholder="开始时间"
  27. end-placeholder="结束时间"
  28. :picker-options="{ firstDayOfWeek: 1 }"
  29. ></el-date-picker>
  30. </el-form-item>
  31. <el-form-item prop="createdName">
  32. <el-input v-model="searchForm.createdName" placeholder="请输入添加人"></el-input>
  33. </el-form-item>
  34. <el-form-item prop="payState">
  35. <el-select
  36. v-model.trim="searchForm.payState"
  37. filterable
  38. placeholder="请选择支付状态"
  39. clearable
  40. >
  41. <el-option label="未缴费" :value="0"></el-option>
  42. <el-option label="已缴费" :value="1"></el-option>
  43. </el-select>
  44. </el-form-item>
  45. <el-form-item prop="state">
  46. <el-select
  47. v-model.trim="searchForm.state"
  48. filterable
  49. placeholder="请选择机构状态"
  50. clearable
  51. >
  52. <!-- <el-option label="草稿" :value="0"></el-option> -->
  53. <el-option label="启动" :value="1"></el-option>
  54. <el-option label="停用" :value="2"></el-option>
  55. </el-select>
  56. </el-form-item>
  57. <el-form-item>
  58. <el-button native-type="submit" type="danger">搜索</el-button>
  59. <el-button native-type="reset" type="primary">重置</el-button>
  60. </el-form-item>
  61. </save-form>
  62. <el-button style="margin-bottom: 20px;" type="primary" v-permission="'tenantInfo/add'" @click="openService('create')" icon="el-icon-plus">新增机构</el-button>
  63. <!-- 列表 -->
  64. <div class="tableWrap">
  65. <el-table
  66. :data="tableList"
  67. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  68. >
  69. <el-table-column align="center" prop="id" label="机构编号">
  70. </el-table-column>
  71. <el-table-column align="center" label="机构名称" prop="name">
  72. </el-table-column>
  73. <el-table-column align="center" label="联系人" prop="contacts">
  74. </el-table-column>
  75. <el-table-column align="center" label="联系人电话" prop="phone">
  76. </el-table-column>
  77. <el-table-column align="center" label="服务" prop="serveName">
  78. </el-table-column>
  79. <el-table-column align="center" label="人数" prop="studentUpLimit">
  80. <template slot-scope="scope">
  81. {{ scope.row.studentCount }}/{{ scope.row.studentUpLimit }}
  82. </template>
  83. </el-table-column>
  84. <el-table-column align="center" label="有效期到期时间" prop="expireDate">
  85. <template slot-scope="scope">
  86. {{ scope.row.expireDate | formatTimer }}
  87. </template>
  88. </el-table-column>
  89. <!-- <el-table-column align="center" label="网络教室剩余时长" prop="productName">
  90. </el-table-column> -->
  91. <el-table-column align="center" label="缴费状态" prop="payState">
  92. <template slot-scope="scope">
  93. {{ scope.row.payState | organPayState }}
  94. </template>
  95. </el-table-column>
  96. <el-table-column align="center" label="添加人" prop="createdName">
  97. </el-table-column>
  98. <el-table-column align="center" label="机构状态" prop="state">
  99. <template slot-scope="scope">
  100. {{ scope.row.state | organState }}
  101. </template>
  102. </el-table-column>
  103. <el-table-column align="center" label="操作">
  104. <template slot-scope="scope">
  105. <el-button
  106. @click="openService('look', scope.row)"
  107. v-permission="'tenantInfo/info'"
  108. type="text"
  109. >查看</el-button>
  110. <el-button
  111. @click="openService('update', scope.row)"
  112. v-permission="'tenantInfo/update'"
  113. type="text"
  114. >修改</el-button>
  115. <el-button
  116. @click="changeOrgan(scope.row)"
  117. v-permission="scope.row.state == 1 ? 'tenantInfo/opsState/stop' : 'tenantInfo/opsState/open'"
  118. type="text"
  119. >{{ scope.row.state == 1 ? '停用' : '启用' }}</el-button>
  120. <el-button
  121. v-if="scope.row.payState != 1"
  122. @click="onQrCode(scope.row)"
  123. type="text"
  124. >缴费二维码</el-button>
  125. </template>
  126. </el-table-column>
  127. </el-table>
  128. <pagination
  129. :saveKey="'platformServiceManager'"
  130. sync
  131. :total.sync="pageInfo.total"
  132. :page.sync="pageInfo.page"
  133. :limit.sync="pageInfo.limit"
  134. :page-sizes="pageInfo.page_size"
  135. @pagination="getList"
  136. />
  137. </div>
  138. </div>
  139. <qr-code v-model="qrcodeStatus" title="机构缴费二维码" :codeUrl="codeUrl" />
  140. </div>
  141. </template>
  142. <script>
  143. import pagination from "@/components/Pagination/index";
  144. import QrCode from "@/components/QrCode/index";
  145. import { tenantInfoQueryPage , tenantInfoOpsState } from "./api";
  146. import { getTimes } from "@/utils";
  147. import { vaildTeachingUrl } from "@/utils/validate";
  148. const initSearch = {
  149. search: null,
  150. state: null,
  151. createTimer: [],
  152. payState: null,
  153. createdName: null,
  154. };
  155. export default {
  156. components: { pagination, QrCode },
  157. data() {
  158. return {
  159. tableList: [],
  160. pageInfo: {
  161. // 分页规则
  162. limit: 10, // 限制显示条数
  163. page: 1, // 当前页
  164. total: 0, // 总条数
  165. page_size: [10, 20, 40, 50], // 选择限制显示条数
  166. },
  167. searchForm: { ...initSearch },
  168. qrcodeStatus: false,
  169. codeUrl: null,
  170. };
  171. },
  172. mounted() {
  173. this.getList();
  174. },
  175. methods: {
  176. async getList() {
  177. try {
  178. let { createTimer, ...reset } = this.searchForm;
  179. const res = await tenantInfoQueryPage({
  180. ...reset,
  181. ...getTimes(createTimer, ["startDate", "endDate"], "YYYY-MM-DD"),
  182. page: this.pageInfo.page,
  183. rows: this.pageInfo.limit,
  184. });
  185. this.pageInfo.total = res.data.total;
  186. this.tableList = res.data.rows;
  187. } catch (e) {}
  188. },
  189. search() {
  190. this.pageInfo.page = 1;
  191. this.$refs.searchForm.save(this.searchForm);
  192. this.$refs.searchForm.save(this.pageInfo, "page");
  193. this.getList();
  194. },
  195. reset() {
  196. this.searchForm = { ...initSearch };
  197. this.search();
  198. },
  199. onQrCode(row) {
  200. // 生成报名二维码
  201. this.qrcodeStatus = true;
  202. this.codeUrl = vaildTeachingUrl() + "/#/tenantPay/" + row.id;
  203. },
  204. changeOrgan(row) {
  205. const stateStr = row.state == 1 ? '停用' : '启用'
  206. const state = row.state == 1 ? 2 : 1
  207. this.$confirm(`是否${stateStr}?`, "提示", {
  208. confirmButtonText: "确定",
  209. cancelButtonText: "取消",
  210. type: "warning",
  211. }).then( async() => {
  212. try{
  213. await tenantInfoOpsState({ id: row.id, state})
  214. this.$message.success(stateStr + '成功')
  215. this.getList()
  216. }catch{}
  217. });
  218. },
  219. openService(type, row) {
  220. let tagTitle = '创建'
  221. if(type == 'update') {
  222. tagTitle ='修改'
  223. } else if(type == 'look') {
  224. tagTitle = '查看'
  225. }
  226. this.$router.push({
  227. path: '/platformManager/organOperation',
  228. query: {
  229. type: type,
  230. id: row?.id || null
  231. }
  232. }, (route) => {
  233. route.meta.title = tagTitle + '机构'
  234. })
  235. },
  236. // async delService(row) {
  237. // this.$confirm("是否删除?", "提示", {
  238. // confirmButtonText: "确定",
  239. // cancelButtonText: "取消",
  240. // type: "warning",
  241. // }).then( async() => {
  242. // try{
  243. // await platformServeDelete({ id:row.id})
  244. // this.$message.success('删除成功')
  245. // this.getList()
  246. // }catch{}
  247. // });
  248. // },
  249. },
  250. };
  251. </script>
  252. <style lang="scss" scoped>
  253. .courseMask .el-dialog__body {
  254. padding-bottom: 0;
  255. }
  256. </style>