sporadicList.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <div class="squrt"></div>
  5. 零星收费
  6. </h2>
  7. <div class="m-core">
  8. <!-- v-permission="'sporadicChargeInfo/add'" -->
  9. <div class="newBand"
  10. v-permission="'sporadicChargeInfo/add'"
  11. @click="newVisible">新增公用收费</div>
  12. <div class="newBand"
  13. v-permission="'sporadicChargeInfo/add'"
  14. @click="newVisible1">新增个人收费</div>
  15. <el-form :inline="true"
  16. :model="searchForm">
  17. <el-form-item>
  18. <el-input placeholder="标题或学生姓名"
  19. v-model.trim="searchForm.search"></el-input>
  20. </el-form-item>
  21. <el-form-item>
  22. <el-select v-model.trim="searchForm.organId"
  23. placeholder='请选择分部'
  24. clearable
  25. filterable>
  26. <el-option v-for='(item,index) in organList'
  27. :key="index"
  28. :value="item.id"
  29. :label="item.name"></el-option>
  30. </el-select>
  31. </el-form-item>
  32. <el-form-item>
  33. <el-select v-model.trim="searchForm.chargeType"
  34. placeholder='请选择收费类型'
  35. clearable>
  36. <el-option v-for="item in orderType"
  37. :key="item.value"
  38. :label="item.label"
  39. :value="item.value"></el-option>
  40. </el-select>
  41. </el-form-item>
  42. <el-form-item>
  43. <el-select v-model.trim="searchForm.openFlag"
  44. placeholder='收费状态'
  45. clearable>
  46. <el-option label="关闭"
  47. value="1"></el-option>
  48. <el-option label="开启"
  49. value="0"></el-option>
  50. </el-select>
  51. </el-form-item>
  52. <el-form-item>
  53. <el-select v-model.trim="searchForm.type"
  54. placeholder='请选择订单类型'
  55. clearable>
  56. <el-option label="个人"
  57. value="personal"></el-option>
  58. <el-option label="公用"
  59. value="common"></el-option>
  60. </el-select>
  61. </el-form-item>
  62. <el-form-item>
  63. <el-button type="danger"
  64. @click="search">搜索</el-button>
  65. <el-button @click="onReSet"
  66. type="primary">重置</el-button>
  67. <el-button @click="exportSporad"
  68. v-permission="'export/sporadicChargeInfo'"
  69. style=" background: #14928a; border:1px solid #14928a;color:#fff">导出</el-button>
  70. </el-form-item>
  71. </el-form>
  72. <div class="tableWrap">
  73. <el-table :data='tableList'
  74. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  75. <el-table-column align='center'
  76. label="分部"
  77. prop="organName">
  78. </el-table-column>
  79. <el-table-column align='center'
  80. label="收费类型">
  81. <template slot-scope="scope">
  82. <div>
  83. {{ scope.row.chargeType | chargeTypeFilter }}
  84. </div>
  85. </template>
  86. </el-table-column>
  87. <el-table-column align='center'
  88. label="标题"
  89. prop="title">
  90. </el-table-column>
  91. <el-table-column align='center'
  92. label="收费状态">
  93. <template slot-scope="scope">
  94. <div>
  95. {{ scope.row.openFlag?'关闭':'开启'}}
  96. </div>
  97. </template>
  98. </el-table-column>
  99. <el-table-column align='center'
  100. label="金额"
  101. prop="amount">
  102. <template slot-scope="scope">
  103. <div>
  104. {{scope.row.amount | moneyFormat}}
  105. </div>
  106. </template>
  107. </el-table-column>
  108. <el-table-column align='center'
  109. label="时间">
  110. <template slot-scope="scope">
  111. <div>
  112. {{ scope.row.createTime | formatTimer }}
  113. </div>
  114. </template>
  115. </el-table-column>
  116. <el-table-column align='center'
  117. label="学生姓名"
  118. prop="userName">
  119. <template slot-scope="scope">
  120. {{ scope.row.userName || '-' }}
  121. </template>
  122. </el-table-column>
  123. <el-table-column align='center'
  124. label="订单类型">
  125. <template slot-scope="scope">
  126. {{ scope.row.userId ? '个人' : '公用' }}
  127. </template>
  128. </el-table-column>
  129. <el-table-column align='center'
  130. label="创建人"
  131. prop="operatorName">
  132. </el-table-column>
  133. <el-table-column align='center'
  134. label="操作">
  135. <template slot-scope="scope">
  136. <div>
  137. <el-button type="text" v-if="scope.row.chargeType == 12" key="update"
  138. v-permission="'sporadicChargeInfo/update'"
  139. @click="lookVisible(scope.row)">修改</el-button>
  140. <el-button type="text" v-else key="update"
  141. v-permission="'sporadicChargeInfo/look'"
  142. @click="lookVisible(scope.row)">查看</el-button>
  143. <el-button type="text"
  144. v-permission="'sporadicChargeInfo/delete'"
  145. @click="removeItem(scope.row)">删除</el-button>
  146. <el-button type="text"
  147. v-if="scope.row.openFlag"
  148. v-permission="'sporadicChargeInfo/updateOpenFlag'"
  149. @click="setSporadic(scope.row)">开启</el-button>
  150. <el-button type="text"
  151. v-else
  152. v-permission="'sporadicChargeInfo/updateOpenFlag'"
  153. @click="setSporadic(scope.row)">关闭</el-button>
  154. </div>
  155. </template>
  156. </el-table-column>
  157. </el-table>
  158. <pagination :total="pageInfo.total"
  159. :page.sync="pageInfo.page"
  160. :limit.sync="pageInfo.limit"
  161. :page-sizes="pageInfo.page_size"
  162. @pagination="getList" />
  163. </div>
  164. </div>
  165. <el-dialog :title="title"
  166. :visible.sync="zeroVisible"
  167. @close="onFormClose('maskForm')"
  168. width="650px">
  169. <el-form :model='maskForm'
  170. :rules="maskRules"
  171. label-width="100px"
  172. label-position="right"
  173. :inline="true"
  174. ref="maskForm">
  175. <el-form-item label="标题"
  176. prop="title">
  177. <el-input v-model.trim="maskForm.title"
  178. :disabled='!isNew'></el-input>
  179. </el-form-item>
  180. <el-form-item label="收费类型"
  181. prop="type">
  182. <el-select v-model.trim="maskForm.type"
  183. :disabled='!isNew'
  184. clearable
  185. filterable>
  186. <el-option v-for="item in orderType1"
  187. :key="item.value"
  188. :label="item.label"
  189. :value="item.value"></el-option>
  190. </el-select>
  191. </el-form-item>
  192. <el-form-item label="金额"
  193. prop='money'>
  194. <el-input v-model.trim="maskForm.money"
  195. type="number"
  196. @mousewheel.native.prevent
  197. :disabled='!isNew'></el-input>
  198. </el-form-item>
  199. <el-form-item label="缴费人数"
  200. prop="maxNum"
  201. :rules="[{ required: true, validator: validMaxNum, trigger: 'blur' }]"
  202. v-if="maskForm.type == 12">
  203. <el-input v-model.trim="maskForm.maxNum"
  204. type="number"
  205. @mousewheel.native.prevent></el-input>
  206. </el-form-item>
  207. <el-form-item label="减免金额"
  208. v-if="maskForm.type == 6"
  209. prop='money'>
  210. <el-input v-model.trim="maskForm.subMoney"
  211. type="number"
  212. @mousewheel.native.prevent
  213. :disabled='!isNew'></el-input>
  214. </el-form-item>
  215. <el-form-item label="分部"
  216. prop="organId">
  217. <el-select v-model.trim="maskForm.organId"
  218. :disabled='!isNew'
  219. clearable
  220. @change="onMusicGroupChange"
  221. filterable>
  222. <el-option v-for='(item,index) in organList'
  223. :key="index"
  224. :value="item.id"
  225. :label="item.name"></el-option>
  226. </el-select>
  227. </el-form-item>
  228. <el-form-item label="所属乐团"
  229. v-if="maskForm.type != 12"
  230. prop="musicGroupId">
  231. <el-select v-model.trim="maskForm.musicGroupId"
  232. :disabled='!isNew || !maskForm.organId'
  233. clearable
  234. filterable>
  235. <el-option v-for='item in maskMusicList'
  236. :key="item.musicGroupId"
  237. :value="item.musicGroupId"
  238. :label="item.musicGroupName"></el-option>
  239. </el-select>
  240. </el-form-item>
  241. <el-form-item label="查看链接"
  242. v-if="!isNew">
  243. <el-input style='width:400px !important'
  244. :disabled='!isNew'
  245. v-model.trim="maskForm.code"></el-input>
  246. <el-button type='danger'
  247. @click="qrcodeStatus = true">二维码</el-button>
  248. </el-form-item>
  249. <el-form-item label="收费详情"
  250. prop="desc">
  251. <el-input type='textarea'
  252. :disabled='!isNew'
  253. v-model.trim="maskForm.desc"
  254. style="width:490px"
  255. :autosize="{minRows: 5}"></el-input>
  256. </el-form-item>
  257. </el-form>
  258. <span slot="footer"
  259. class="dialog-footer">
  260. <el-button @click="zeroVisible = false">取 消</el-button>
  261. <el-button type="primary"
  262. v-if="isNew"
  263. @click="addZero">确 定</el-button>
  264. <el-button v-if="!isNew"
  265. type="primary"
  266. @click="updateZero">确定</el-button>
  267. </span>
  268. </el-dialog>
  269. <el-dialog :title="title1"
  270. :visible.sync="zeroVisible1"
  271. @close="onFormClose('maskForm1')"
  272. width="650px">
  273. <el-form :model='maskForm1'
  274. :rules="maskRules1"
  275. label-width="100px"
  276. label-position="right"
  277. :inline="true"
  278. ref="maskForm1">
  279. <el-form-item label="标题"
  280. prop="title">
  281. <el-input v-model.trim="maskForm1.title"
  282. :disabled='!isNew1'></el-input>
  283. </el-form-item>
  284. <el-form-item label="收费类型"
  285. prop="type">
  286. <el-select v-model.trim="maskForm1.type"
  287. :disabled='!isNew1'
  288. clearable
  289. filterable>
  290. <template v-for="item in orderType1">
  291. <el-option v-if="item.value != 12"
  292. :key="item.value"
  293. :label="item.label"
  294. :value="item.value"></el-option>
  295. </template>
  296. </el-select>
  297. </el-form-item>
  298. <el-form-item label="学员编号"
  299. prop='studentId'>
  300. <el-input v-model.trim="maskForm1.studentId"
  301. @blur="onStudentChange"
  302. type="number"
  303. maxlength="10"
  304. @mousewheel.native.prevent
  305. :disabled='!isNew1'></el-input>
  306. </el-form-item>
  307. <el-form-item label="金额"
  308. prop='money'>
  309. <el-input v-model.trim="maskForm1.money"
  310. type="number"
  311. @mousewheel.native.prevent
  312. :disabled='!isNew1'></el-input>
  313. </el-form-item>
  314. <el-form-item label="学员姓名"
  315. prop='studentName'>
  316. <el-input v-model.trim="maskForm1.studentName"
  317. :disabled='true'></el-input>
  318. </el-form-item>
  319. <el-form-item label="所属乐团"
  320. prop="musicGroupId">
  321. <el-select v-model.trim="maskForm1.musicGroupId"
  322. :disabled='!isNew1'
  323. clearable
  324. filterable>
  325. <el-option v-for='(item,index) in maskMusicList1'
  326. :key="index"
  327. :value="item.musicGroupId"
  328. :label="item.musicGroupName"></el-option>
  329. </el-select>
  330. </el-form-item>
  331. <el-form-item label="查看链接"
  332. v-if="!isNew1">
  333. <el-input style='width:400px !important'
  334. :disabled='!isNew1'
  335. v-model.trim="maskForm1.code"></el-input>
  336. <el-button type='danger'
  337. @click="qrcodeStatus = true">二维码</el-button>
  338. </el-form-item>
  339. <el-form-item label="收费详情"
  340. prop="desc">
  341. <el-input type='textarea'
  342. :disabled='!isNew1'
  343. v-model.trim="maskForm1.desc"
  344. style="width:490px"
  345. :autosize="{minRows: 5}"></el-input>
  346. </el-form-item>
  347. </el-form>
  348. <span slot="footer"
  349. class="dialog-footer">
  350. <el-button @click="zeroVisible1 = false">取 消</el-button>
  351. <el-button type="primary"
  352. v-if="isNew1"
  353. @click="addZero1">确 定</el-button>
  354. <el-button v-if="!isNew1"
  355. type="primary"
  356. @click="zeroVisible1 = false">确定</el-button>
  357. </span>
  358. </el-dialog>
  359. <el-dialog :visible.sync="qrcodeStatus"
  360. center
  361. width="300px">
  362. <div class="right-code">
  363. <h2 class="title">缴费链接</h2>
  364. <vue-qr :text="qrCodeUrl"
  365. style="width: 100%"
  366. :margin="0"></vue-qr>
  367. <!-- <div id="qrcode"
  368. class="qrcode code"
  369. ref="qrCodeUrl"></div> -->
  370. <!-- <p class="code-url"
  371. v-if="codeUrl2">{{ codeUrl2 }}</p> -->
  372. </div>
  373. </el-dialog>
  374. </div>
  375. </template>
  376. <script>
  377. import { getEmployeeOrgan } from '@/api/buildTeam'
  378. import pagination from '@/components/Pagination/index'
  379. import { vaildStudentUrl } from '@/utils/validate'
  380. import cleanDeep from 'clean-deep'
  381. import { addZero, getZero, updateZero, removeZero, getBasic, updateOpenFlag, queryOrganMusicInfos, queryUserMusicInfos } from '@/api/zeroManager'
  382. import axios from 'axios'
  383. import qs from 'qs'
  384. import {
  385. getToken
  386. } from '@/utils/auth'
  387. import load from '@/utils/loading'
  388. // import QRCode from 'qrcodejs2'
  389. import vueQr from 'vue-qr'
  390. let validMaxNum = (rule, value, callback) => {
  391. if (value == '' && typeof value == 'string' || value == null) {
  392. callback(new Error('请输入缴费人数'))
  393. } else if (value < 0) {
  394. callback(new Error('输入缴费人数必须大于0'))
  395. } else {
  396. callback()
  397. }
  398. }
  399. export default {
  400. name: 'sporadicList',
  401. components: { pagination, vueQr },
  402. data () {
  403. return {
  404. validMaxNum: validMaxNum,
  405. zeroVisible: false,
  406. qrCodeUrl: null,
  407. searchForm: {
  408. organId: null,
  409. chargeType: null,
  410. type: null,
  411. search: null,
  412. openFlag: null
  413. },
  414. tableList: [],
  415. organList: [],
  416. orderType: [
  417. { label: '考级', value: 1 },
  418. { label: '声部更改', value: 2 },
  419. { label: '乐器更换', value: 3 },
  420. { label: '配件销售', value: 4 },
  421. { label: '维修费', value: 5 },
  422. { label: '福袋活动', value: 6 },
  423. { label: '双十一活动', value: 12 },
  424. { label: '上门费', value: 7 },
  425. { label: '账户充值', value: 9 },
  426. { label: '乐保服务', value: 10 },
  427. { label: '其它', value: 11 }
  428. ],
  429. orderType1: [
  430. { label: '考级', value: 1 },
  431. { label: '声部更改', value: 2 },
  432. // { label: '乐器更换', value: 3 },
  433. // { label: '配件销售', value: 4 },
  434. { label: '双十一活动', value: 12 },
  435. { label: '上门费', value: 7 },
  436. { label: '账户充值', value: 9 },
  437. { label: '乐保服务', value: 10 },
  438. ],
  439. maskForm: {
  440. organId: '',
  441. type: '',
  442. money: '',
  443. desc: '',
  444. title: '',
  445. code: '',
  446. musicGroupId: '',
  447. maxNum: null,
  448. subMoney: ''
  449. },
  450. maskMusicList: [],
  451. maskRules: {
  452. organId: [{ required: true, message: '请选择分部', trigger: 'change' }],
  453. // musicGroupId: [{ required: true, message: '请选择所属乐团', trigger: 'change' }],
  454. type: [{ required: true, message: '请选择收费类型', trigger: 'change' }],
  455. money: [{ required: true, message: '请输入收费金额', trigger: 'change' }],
  456. title: [{ required: true, message: '请输入标题名称', trigger: 'change' }],
  457. desc: [{ required: true, message: '请输入收费详情' }]
  458. },
  459. pageInfo: {
  460. // 分页规则
  461. limit: 10, // 限制显示条数
  462. page: 1, // 当前页
  463. total: 0, // 总条数
  464. page_size: [10, 20, 40, 50] // 选择限制显示条数
  465. },
  466. isNew: false,
  467. title: '新增收费',
  468. qrcodeStatus: false,
  469. qrcodes: true,
  470. activeRow: null,
  471. title1: '新增收费',
  472. activeRow1: null,
  473. zeroVisible1: false,
  474. maskForm1: {
  475. type: null,
  476. money: null,
  477. desc: null,
  478. title: null,
  479. code: null,
  480. musicGroupId: null,
  481. studentId: null,
  482. studentName: null,
  483. },
  484. isNew1: false,
  485. maskMusicList1: [],
  486. maskRules1: {
  487. organId: [{ required: true, message: '请选择分部', trigger: 'change' }],
  488. // musicGroupId: [{ required: true, message: '请选择所属乐团', trigger: 'change' }],
  489. type: [{ required: true, message: '请选择收费类型', trigger: 'change' }],
  490. money: [{ required: true, message: '请输入收费金额', trigger: 'change' }],
  491. title: [{ required: true, message: '请输入标题名称', trigger: 'change' }],
  492. studentId: [{ required: true, message: '请输入学员编号', trigger: 'blur' }],
  493. desc: [{ required: true, message: '请输入收费详情' }]
  494. },
  495. }
  496. }, mounted () {
  497. getEmployeeOrgan().then(res => {
  498. if (res.code == 200) {
  499. this.organList = res.data;
  500. }
  501. })
  502. this.getList();
  503. },
  504. methods: {
  505. search () {
  506. this.pageInfo.page = 1;
  507. this.getList()
  508. },
  509. onReSet () {
  510. this.searchForm = {
  511. organId: null,
  512. chargeType: null,
  513. type: null,
  514. search: null
  515. }
  516. },
  517. getList () {
  518. let searchForm = this.searchForm
  519. let params = {
  520. organId: searchForm.organId ? searchForm.organId : null,
  521. chargeType: searchForm.chargeType ? searchForm.chargeType : null,
  522. type: searchForm.type ? searchForm.type : null,
  523. search: searchForm.search ? searchForm.search : null,
  524. openFlag: searchForm.openFlag ? searchForm.openFlag * 1 : null,
  525. page: this.pageInfo.page,
  526. rows: this.pageInfo.limit
  527. }
  528. getZero(params).then(res => {
  529. if (res.code == 200) {
  530. this.tableList = res.data.rows
  531. this.pageInfo.total = res.data.total
  532. }
  533. })
  534. },
  535. onFormClose (formName) { // 关闭弹窗重置验证
  536. if (formName == 'maskForm') {
  537. this.maskForm = {
  538. organId: null,
  539. musicGroupId: null,
  540. type: null,
  541. money: null,
  542. maxNum: null,
  543. desc: null,
  544. title: null,
  545. code: null
  546. }
  547. } else if (formName == 'maskForm1') {
  548. this.maskForm1 = {
  549. type: null,
  550. musicGroupId: null,
  551. money: null,
  552. desc: null,
  553. title: null,
  554. code: null,
  555. studentId: null,
  556. studentName: null,
  557. }
  558. }
  559. if (this.$refs[formName]) {
  560. this.$refs[formName].resetFields()
  561. }
  562. },
  563. newVisible () {
  564. this.isNew = true;
  565. this.zeroVisible = true;
  566. this.title = '新增公用收费'
  567. },
  568. newVisible1 () {
  569. this.isNew1 = true;
  570. this.zeroVisible1 = true;
  571. this.title1 = '新增个人收费'
  572. },
  573. lookVisible (row) {
  574. let maskForm = null
  575. if (row.userId) {
  576. maskForm = this.maskForm1
  577. this.isNew1 = false;
  578. this.zeroVisible1 = true;
  579. this.title1 = '查看个人收费'
  580. let url = vaildStudentUrl() + `/#/sporadicPay?id=${row.id}&userId=${row.userId}`
  581. this.qrCodeUrl = url
  582. maskForm.code = url
  583. maskForm.studentId = row.userId
  584. maskForm.studentName = row.userName
  585. } else {
  586. maskForm = this.maskForm
  587. this.isNew = false;
  588. this.zeroVisible = true;
  589. this.title = '查看公用收费'
  590. let url = vaildStudentUrl() + `/#/sporadicLogin?id=${row.id}`
  591. this.qrCodeUrl = url
  592. maskForm.code = url
  593. }
  594. maskForm.type = parseInt(row.chargeType)
  595. maskForm.id = row.id
  596. maskForm.desc = row.detail
  597. maskForm.title = row.title
  598. maskForm.organId = row.organId
  599. maskForm.money = row.amount
  600. maskForm.subMoney = row.discountAmount
  601. maskForm.maxNum = row.maxNum
  602. maskForm.musicGroupId = row.musicGroupId ? row.musicGroupId : null
  603. if (row.userId) {
  604. queryUserMusicInfos({ userId: row.userId }).then(studentInfo => {
  605. if (studentInfo.code == 200) {
  606. this.maskMusicList1 = studentInfo.data
  607. }
  608. })
  609. } else {
  610. this.onMusicGroupChange(true)
  611. }
  612. },
  613. onMusicGroupChange (status) {
  614. let maskForm = this.maskForm
  615. if (!maskForm.organId) {
  616. return
  617. }
  618. if (!status) {
  619. maskForm.musicGroupId = null // 重置可能已经选中的乐团
  620. }
  621. queryOrganMusicInfos({ organId: maskForm.organId }).then(res => {
  622. if (res.code == 200) {
  623. this.maskMusicList = res.data
  624. }
  625. })
  626. },
  627. updateZero() {
  628. let maskForm = this.maskForm
  629. if(maskForm.type != 12) {
  630. this.zeroVisible = false
  631. return
  632. }
  633. this.$refs['maskForm'].validate(item => {
  634. if(item) {
  635. updateZero(cleanDeep({ id: maskForm.id, maxNum: maskForm.maxNum })).then(res => {
  636. if (res.code == 200) {
  637. this.$message.success('更新成功')
  638. this.zeroVisible = false;
  639. this.getList()
  640. }
  641. })
  642. }
  643. })
  644. },
  645. addZero () {
  646. this.$refs['maskForm'].validate(item => {
  647. if (item) {
  648. let obj = {
  649. chargeType: this.maskForm.type,
  650. detail: this.maskForm.desc,
  651. title: this.maskForm.title,
  652. organId: this.maskForm.organId,
  653. amount: this.maskForm.money,
  654. musicGroupId: this.maskForm.musicGroupId,
  655. discountAmount: this.maskForm.subMoney,
  656. maxNum: this.maskForm.maxNum
  657. }
  658. addZero(obj).then(res => {
  659. if (res.code == 200) {
  660. this.$message.success('新增成功')
  661. this.zeroVisible = false;
  662. this.getList()
  663. }
  664. })
  665. }
  666. })
  667. },
  668. addZero1 () {
  669. this.$refs['maskForm1'].validate(item => {
  670. if (item) {
  671. let maskForm1 = this.maskForm1
  672. if (!maskForm1.studentName) {
  673. this.$message.error('学员信息不存在')
  674. return
  675. }
  676. let obj = {
  677. chargeType: maskForm1.type,
  678. detail: maskForm1.desc,
  679. title: maskForm1.title,
  680. musicGroupId: this.maskForm1.musicGroupId,
  681. userId: maskForm1.studentId,
  682. amount: maskForm1.money
  683. }
  684. addZero(obj).then(res => {
  685. if (res.code == 200) {
  686. this.$message.success('新增成功')
  687. this.zeroVisible1 = false;
  688. this.getList()
  689. }
  690. })
  691. }
  692. })
  693. },
  694. async onStudentChange () {
  695. let studentId = this.maskForm1.studentId
  696. // 判断学生编号是否存在
  697. if (!studentId) {
  698. return
  699. }
  700. if (studentId.length > 10) {
  701. this.$message.error('学员编号不合法')
  702. return
  703. }
  704. await getBasic({ userId: studentId }).then(res => {
  705. if (res.code == 200) {
  706. if (res.data) {
  707. this.maskForm1.studentName = res.data.name
  708. queryUserMusicInfos({ userId: studentId }).then(studentInfo => {
  709. if (studentInfo.code == 200) {
  710. this.maskMusicList1 = studentInfo.data
  711. }
  712. })
  713. } else {
  714. this.maskForm1.studentName = null
  715. }
  716. }
  717. })
  718. },
  719. removeItem (row) {
  720. this.$confirm('是否删除该收费', '提示', {
  721. confirmButtonText: '确定',
  722. cancelButtonText: '取消',
  723. type: 'warning'
  724. }).then(() => {
  725. removeZero({ id: row.id }).then(res => {
  726. if (res.code == 200) {
  727. this.$message.success('删除成功')
  728. this.zeroVisible = false;
  729. this.getList()
  730. }
  731. })
  732. }).catch(() => {
  733. });
  734. },
  735. setSporadic (row) {
  736. // openFlag
  737. let str = ''
  738. let openFlag = ''
  739. if (row.openFlag) {
  740. // 关闭=>开启 1是关闭
  741. openFlag = 0;
  742. str = '开启'
  743. } else {
  744. // 开启=>关闭 0是开启
  745. openFlag = 1;
  746. str = '关闭'
  747. }
  748. this.$confirm(`是否${str}该收费`, '提示', {
  749. confirmButtonText: '确定',
  750. cancelButtonText: '取消',
  751. type: 'warning'
  752. }).then(() => {
  753. updateOpenFlag({ sporadicId: row.id, openFlag }).then(res => {
  754. if (res.code == 200) {
  755. this.$message.success(`${str}成功`)
  756. this.getList()
  757. }
  758. })
  759. }).catch(() => {
  760. });
  761. },
  762. exportSporad () {
  763. let url = '/api-web/export/sporadicChargeInfo'
  764. let data = this.searchForm
  765. const options = {
  766. method: 'get',
  767. headers: {
  768. 'Authorization': getToken()
  769. },
  770. params: data,
  771. url,
  772. responseType: 'blob'
  773. }
  774. this.$confirm('您确定导出零星缴费列表', '提示', {
  775. confirmButtonText: '确定',
  776. cancelButtonText: '取消',
  777. type: 'warning'
  778. }).then(() => {
  779. load.startLoading()
  780. axios(options).then(res => {
  781. let blob = new Blob([res.data], {
  782. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  783. type: 'application/vnd.ms-excel;charset=utf-8'
  784. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  785. })
  786. let text = (new Response(blob)).text()
  787. text.then(res => {
  788. // 判断是否报错
  789. if (res.indexOf('code') != -1) {
  790. let json = JSON.parse(res)
  791. this.$message.error(json.msg)
  792. } else {
  793. let objectUrl = URL.createObjectURL(blob)
  794. let link = document.createElement("a")
  795. let nowTime = new Date()
  796. let ymd = nowTime.getFullYear() + '' + (nowTime.getMonth() + 1) + '' + nowTime.getDate()
  797. let fname = ymd + '零星缴费' //下载文件的名字
  798. link.href = objectUrl
  799. link.setAttribute("download", fname)
  800. document.body.appendChild(link)
  801. link.click()
  802. }
  803. })
  804. load.endLoading();
  805. }).catch(error => {
  806. this.$message.error('导出数据失败,请联系管理员');
  807. load.endLoading();
  808. })
  809. }).catch(() => { })
  810. }
  811. },
  812. watch: {
  813. zeroVisible (val) {
  814. if (!val) {
  815. this.maskForm = {
  816. organId: '',
  817. type: '',
  818. money: '',
  819. desc: '',
  820. title: '',
  821. maxNum: null,
  822. code: ''
  823. }
  824. // this.$refs['maskForm'].resetFields()
  825. // console.log(this.$refs['zeroForm'].resetFields)
  826. }
  827. },
  828. },
  829. filters: {
  830. chargeTypeFilter (val) {
  831. let template = {
  832. '1': '考级',
  833. '2': '声部更改',
  834. '3': '乐器更换',
  835. '4': '配件销售',
  836. '5': '维修费',
  837. '6': '福袋活动',
  838. '7': '上门费',
  839. '9': '账户充值',
  840. '10': '乐保服务',
  841. '11': '其它',
  842. '12': '双十一活动'
  843. }
  844. return template[val]
  845. }
  846. }
  847. }
  848. </script>
  849. <style lang="scss" scoped>
  850. .right-code {
  851. // width: 50%;
  852. // float: left;
  853. .title {
  854. font-size: 18px;
  855. text-align: center;
  856. padding-bottom: 8px;
  857. }
  858. }
  859. .newBand {
  860. display: inline-block;
  861. }
  862. .el-input {
  863. width: 180px !important;
  864. }
  865. </style>