detail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <template>
  2. <div>
  3. <el-form
  4. :inline="true"
  5. :model="searchForm"
  6. ref="searchForm"
  7. @submit.native.prevent="search"
  8. @reset.native.prevent="onReSet"
  9. >
  10. <el-form-item prop="search">
  11. <el-input
  12. v-model.trim="searchForm.search"
  13. clearable
  14. @keyup.enter.native="search"
  15. placeholder="学生姓名或手机号"
  16. ></el-input>
  17. </el-form-item>
  18. <el-form-item prop="subjectId">
  19. <el-select
  20. v-model.trim="searchForm.subjectId"
  21. filterable
  22. clearable
  23. placeholder="请选择声部"
  24. @change="changeSound"
  25. >
  26. <el-option
  27. v-for="(item, i) in soundList"
  28. :key="i"
  29. :label="item.text"
  30. :value="item.value"
  31. ></el-option>
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item prop="specification">
  35. <el-select
  36. v-model.trim="searchForm.specification"
  37. filterable
  38. clearable
  39. placeholder="请选择品牌型号"
  40. :disabled="!searchForm.subjectId"
  41. >
  42. <el-option
  43. v-for="(item, index) in branchList"
  44. :key="index"
  45. :label="item.name"
  46. :value="item.id"
  47. ></el-option>
  48. </el-select>
  49. </el-form-item>
  50. <!-- <el-form-item prop="hasYesFirstAnswer">
  51. <el-select
  52. v-model.trim="searchForm.hasYesFirstAnswer"
  53. filterable
  54. clearable
  55. placeholder="请选择是否参加市赛"
  56. >
  57. <el-option label="是" :value="1"></el-option>
  58. <el-option label="否" :value="0"></el-option>
  59. </el-select>
  60. </el-form-item> -->
  61. <el-form-item prop="hasInstrumentsId">
  62. <el-select
  63. v-model.trim="searchForm.hasInstrumentsId"
  64. filterable
  65. clearable
  66. placeholder="请选择是置换乐器"
  67. >
  68. <el-option label="是" :value="true"></el-option>
  69. <el-option label="否" :value="false"></el-option>
  70. </el-select>
  71. </el-form-item>
  72. <el-form-item>
  73. <el-button native-type="submit" type="primary">搜索</el-button>
  74. <el-button native-type="reset" type="danger">重置</el-button>
  75. </el-form-item>
  76. </el-form>
  77. <div class="tableWrap">
  78. <el-table
  79. style="width: 100% !important"
  80. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  81. :data="tableList"
  82. max-height="500"
  83. >
  84. <el-table-column
  85. align="center"
  86. prop="userId"
  87. label="学员编号"
  88. ></el-table-column>
  89. <el-table-column
  90. align="center"
  91. prop="userName"
  92. label="学员姓名"
  93. ></el-table-column>
  94. <el-table-column
  95. align="center"
  96. prop="mobileNo"
  97. label="联系电话"
  98. ></el-table-column>
  99. <el-table-column align="center" prop="actualAmount" label="现金支付">
  100. <template slot-scope="scope">
  101. <div>
  102. {{ scope.row.actualAmount | moneyFormat }}
  103. </div>
  104. </template>
  105. </el-table-column>
  106. <el-table-column align="center" prop="balance" label="余额支付">
  107. <template slot-scope="scope">
  108. <div>
  109. {{ scope.row.balance | moneyFormat }}
  110. </div>
  111. </template>
  112. </el-table-column>
  113. <el-table-column align="center" label="是否置换">
  114. <template slot-scope="scope">
  115. {{ scope.row.instrumentsId ? "是" : "否" }}
  116. </template>
  117. </el-table-column>
  118. <el-table-column
  119. align="center"
  120. prop="subjectName"
  121. label="声部"
  122. ></el-table-column>
  123. <el-table-column align="center" prop="studentId" label="品牌型号">
  124. <template slot-scope="scope">
  125. <div>{{ scope.row.brand }}{{ scope.row.specification }}</div>
  126. </template>
  127. </el-table-column>
  128. <el-table-column align="center" prop="payStatus" label="是否开启缴费">
  129. <template slot-scope="scope">
  130. <div>
  131. {{ scope.row.openFlag | openFlagStatus }}
  132. </div>
  133. </template>
  134. </el-table-column>
  135. <el-table-column align="center" prop="payStatus" label="缴费状态">
  136. <template slot-scope="scope">
  137. <div>
  138. {{ scope.row.payStatus | replacementInsFilter }}
  139. </div>
  140. </template>
  141. </el-table-column>
  142. <el-table-column align="center" label="其他建议">
  143. <template slot-scope="scope">
  144. <Tooltip
  145. :content="
  146. scope.row.otherSuggestion ? scope.row.otherSuggestion : ''
  147. "
  148. />
  149. </template>
  150. </el-table-column>
  151. <el-table-column
  152. align="center"
  153. prop="studentId"
  154. label="操作"
  155. width="150px"
  156. >
  157. <template slot-scope="scope">
  158. <div>
  159. <el-button
  160. type="text"
  161. @click="openFlagMusic(scope.row)"
  162. v-if="
  163. scope.row.openFlag == 0 &&
  164. scope.row.instrumentsId &&
  165. permission('replacementInstrumentActivity/updateOpenFlag')
  166. "
  167. >开启缴费</el-button
  168. >
  169. <el-button
  170. type="text"
  171. @click="resetMusic(scope.row)"
  172. v-if="
  173. permission('replacementInstrumentActivity/update') &&
  174. scope.row.payStatus == 0
  175. "
  176. >修改</el-button
  177. >
  178. </div>
  179. </template>
  180. </el-table-column>
  181. </el-table>
  182. <pagination
  183. :total="rules.total"
  184. :page.sync="rules.page"
  185. :limit.sync="rules.limit"
  186. :page-sizes="rules.page_size"
  187. @pagination="getList"
  188. />
  189. </div>
  190. <el-dialog
  191. title="修改信息"
  192. :visible.sync="dialogVisible"
  193. width="600px"
  194. append-to-body
  195. v-if="dialogVisible"
  196. >
  197. <resetInfo
  198. @close="close"
  199. :detail="resetRow"
  200. ref="resetInfo"
  201. @getList="getList"
  202. />
  203. <div slot="footer">
  204. <el-button @click="dialogVisible = false">取 消</el-button>
  205. <el-button type="primary" @click="updateInfo">确认修改</el-button>
  206. </div>
  207. </el-dialog>
  208. </div>
  209. </template>
  210. <script>
  211. import pagination from "@/components/Pagination/index";
  212. import resetInfo from "./resetInfo";
  213. import {
  214. getInstrumentSoundList,
  215. getInstrumentActivityList,
  216. updateOpenFlag,
  217. } from "../api";
  218. import ItemVue from "@/layout/components/Sidebar/Item.vue";
  219. import Tooltip from "@/components/Tooltip/index";
  220. import { permission } from "@/utils/directivePage";
  221. const soundList = [
  222. { text: "长笛", value: 2 },
  223. { text: "单簧管", value: 4 },
  224. { text: "萨克斯", value: 5 },
  225. { text: "小号", value: 12 },
  226. { text: "圆号", value: 13 },
  227. { text: "长号", value: 14 },
  228. { text: "上低音号", value: 15 },
  229. { text: "大号", value: 17 },
  230. { text: "打击乐", value: 23 },
  231. ];
  232. export default {
  233. components: { pagination, resetInfo, Tooltip },
  234. props: ["detail"],
  235. data() {
  236. return {
  237. searchForm: {
  238. cooperationId: "",
  239. specification: "",
  240. search: "",
  241. subjectId: "",
  242. hasYesFirstAnswer: "",
  243. hasInstrumentsId: "",
  244. },
  245. tableList: [],
  246. rules: {
  247. // 分页规则
  248. limit: 10, // 限制显示条数
  249. page: 1, // 当前页
  250. total: 0, // 总条数
  251. page_size: [10, 20, 40, 50], // 选择限制显示条数
  252. },
  253. dialogVisible: false,
  254. branchList: [],
  255. resetRow: null,
  256. soundList: soundList,
  257. };
  258. },
  259. mounted() {
  260. this.init();
  261. },
  262. methods: {
  263. async init() {
  264. this.searchForm.cooperationId = this.detail.id;
  265. await this.$store.dispatch("setSubjects");
  266. this.getList();
  267. },
  268. async getList() {
  269. try {
  270. const res = await getInstrumentActivityList({
  271. ...this.searchForm,
  272. page: this.rules.page,
  273. rows: this.rules.limit,
  274. });
  275. let temp = res.data.rows || [];
  276. temp.forEach((item) => {
  277. let questionResult = item.questionResult.split("");
  278. item.question1 = questionResult[0] == 1 ? "是" : "否";
  279. });
  280. this.tableList = temp;
  281. this.rules.total = res.data.total;
  282. } catch (e) {}
  283. },
  284. search() {
  285. this.rules.page = 1;
  286. this.getList();
  287. },
  288. openFlagMusic(row) {
  289. // 开启缴费
  290. this.$confirm("您是否开启缴费?", "提示", {
  291. confirmButtonText: "确定",
  292. cancelButtonText: "取消",
  293. type: "warning",
  294. }).then(async () => {
  295. try {
  296. await updateOpenFlag({
  297. Id: row.id,
  298. openFlag: 1,
  299. });
  300. this.$message.success("开启成功");
  301. this.getList();
  302. } catch {
  303. //
  304. }
  305. });
  306. },
  307. onReSet() {
  308. this.$refs.searchForm.resetFields();
  309. this.searchForm.cooperationId = this.detail.id;
  310. this.search();
  311. },
  312. resetMusic(row) {
  313. this.resetRow = row;
  314. this.dialogVisible = true;
  315. },
  316. close() {
  317. this.dialogVisible = false;
  318. },
  319. async changeSound(val) {
  320. this.searchForm.brand = "";
  321. if (val) {
  322. try {
  323. const res = await getInstrumentSoundList({
  324. subjectId: val,
  325. page: 1,
  326. rows: 999,
  327. });
  328. this.branchList = res.data.rows.map((item) => {
  329. return {
  330. name: item.brand + item.specification,
  331. id: item.specification,
  332. };
  333. });
  334. console.log(res);
  335. } catch (e) {
  336. console.log(e);
  337. }
  338. }
  339. },
  340. updateInfo() {
  341. this.$refs.resetInfo.submited();
  342. },
  343. permission(str, parent) {
  344. return permission(str, parent);
  345. },
  346. },
  347. filters: {
  348. openFlagStatus(val) {
  349. let template = ["否", "是"];
  350. return template[val];
  351. },
  352. },
  353. };
  354. </script>
  355. <style lang="less" scoped>
  356. /deep/.el-table th {
  357. background: #edeef0;
  358. }
  359. </style>