index.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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. <el-button
  126. v-if="scope.row.payState === 1 && $helpers.permission('tenantContractRecord/queryPage')"
  127. @click="onDownloadProtocol(scope.row)"
  128. type="text"
  129. >下载协议</el-button>
  130. </template>
  131. </el-table-column>
  132. </el-table>
  133. <pagination
  134. :saveKey="'platformServiceManager'"
  135. sync
  136. :total.sync="pageInfo.total"
  137. :page.sync="pageInfo.page"
  138. :limit.sync="pageInfo.limit"
  139. :page-sizes="pageInfo.page_size"
  140. @pagination="getList"
  141. />
  142. </div>
  143. </div>
  144. <qr-code v-model="qrcodeStatus" title="机构缴费二维码" :codeUrl="codeUrl" />
  145. <el-dialog title="协议下载" :visible.sync="protocolVisible" width="650px">
  146. <protocol-model v-if="protocolVisible" @close="protocolVisible = false" :protocolVersions="protocolVersions" />
  147. </el-dialog>
  148. </div>
  149. </template>
  150. <script>
  151. import pagination from "@/components/Pagination/index";
  152. import QrCode from "@/components/QrCode/index";
  153. import protocolModel from '@/views/studentManager/modals/protocolModel';
  154. import { tenantInfoQueryPage , tenantInfoOpsState, tenantContractRecordList } from "./api";
  155. import { getTimes } from "@/utils";
  156. import { vaildTeachingUrl } from "@/utils/validate";
  157. const initSearch = {
  158. search: null,
  159. state: null,
  160. createTimer: [],
  161. payState: null,
  162. createdName: null,
  163. };
  164. export default {
  165. components: { pagination, QrCode, protocolModel },
  166. data() {
  167. return {
  168. tableList: [],
  169. pageInfo: {
  170. // 分页规则
  171. limit: 10, // 限制显示条数
  172. page: 1, // 当前页
  173. total: 0, // 总条数
  174. page_size: [10, 20, 40, 50], // 选择限制显示条数
  175. },
  176. searchForm: { ...initSearch },
  177. qrcodeStatus: false,
  178. codeUrl: null,
  179. protocolVisible: false,
  180. protocolVersions: [],
  181. };
  182. },
  183. mounted() {
  184. this.getList();
  185. },
  186. methods: {
  187. async getList() {
  188. try {
  189. let { createTimer, ...reset } = this.searchForm;
  190. const res = await tenantInfoQueryPage({
  191. ...reset,
  192. ...getTimes(createTimer, ["startDate", "endDate"], "YYYY-MM-DD"),
  193. page: this.pageInfo.page,
  194. rows: this.pageInfo.limit,
  195. });
  196. this.pageInfo.total = res.data.total;
  197. this.tableList = res.data.rows;
  198. } catch (e) {}
  199. },
  200. search() {
  201. this.pageInfo.page = 1;
  202. this.$refs.searchForm.save(this.searchForm);
  203. this.$refs.searchForm.save(this.pageInfo, "page");
  204. this.getList();
  205. },
  206. reset() {
  207. this.searchForm = { ...initSearch };
  208. this.search();
  209. },
  210. async onDownloadProtocol(item) {
  211. try {
  212. const res = await tenantContractRecordList({ tenantId: item.id })
  213. console.log(res)
  214. this.protocolVersions = res.data?.rows || [];
  215. this.protocolVisible = true;
  216. } catch(e) {
  217. //
  218. console.log(e)
  219. }
  220. // window.location.href = item.url;
  221. },
  222. onQrCode(row) {
  223. // 生成报名二维码
  224. this.qrcodeStatus = true;
  225. this.codeUrl = vaildTeachingUrl() + "/#/tenantPay/" + row.id;
  226. },
  227. changeOrgan(row) {
  228. const stateStr = row.state == 1 ? '停用' : '启用'
  229. const state = row.state == 1 ? 2 : 1
  230. this.$confirm(`是否${stateStr}?`, "提示", {
  231. confirmButtonText: "确定",
  232. cancelButtonText: "取消",
  233. type: "warning",
  234. }).then( async() => {
  235. try{
  236. await tenantInfoOpsState({ id: row.id, state})
  237. this.$message.success(stateStr + '成功')
  238. this.getList()
  239. }catch{}
  240. });
  241. },
  242. openService(type, row) {
  243. let tagTitle = '创建'
  244. if(type == 'update') {
  245. tagTitle ='修改'
  246. } else if(type == 'look') {
  247. tagTitle = '查看'
  248. }
  249. this.$router.push({
  250. path: '/platformManager/organOperation',
  251. query: {
  252. type: type,
  253. id: row?.id || null
  254. }
  255. }, (route) => {
  256. route.meta.title = tagTitle + '机构'
  257. })
  258. },
  259. // async delService(row) {
  260. // this.$confirm("是否删除?", "提示", {
  261. // confirmButtonText: "确定",
  262. // cancelButtonText: "取消",
  263. // type: "warning",
  264. // }).then( async() => {
  265. // try{
  266. // await platformServeDelete({ id:row.id})
  267. // this.$message.success('删除成功')
  268. // this.getList()
  269. // }catch{}
  270. // });
  271. // },
  272. },
  273. };
  274. </script>
  275. <style lang="scss" scoped>
  276. .courseMask .el-dialog__body {
  277. padding-bottom: 0;
  278. }
  279. </style>