sporadicList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  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="
  12. newVisible">新增</div>
  13. <el-form :inline="true"
  14. :model="searchForm">
  15. <el-form-item label="分部">
  16. <el-select v-model="searchForm.organId"
  17. clearable
  18. filterable>
  19. <el-option v-for='(item,index) in organList'
  20. :key="index"
  21. :value="item.id"
  22. :label="item.name"></el-option>
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item label="收费类型">
  26. <el-select v-model="searchForm.type"
  27. clearable>
  28. <el-option label="考级"
  29. :value="1"></el-option>
  30. <el-option label="缴费"
  31. :value="2"></el-option>
  32. <el-option label="声部更改"
  33. :value="3"></el-option>
  34. <el-option label="乐器更换"
  35. :value="4"></el-option>
  36. </el-select>
  37. </el-form-item>
  38. <el-button type="danger"
  39. @click="search">搜索</el-button>
  40. </el-form-item>
  41. </el-form>
  42. <div class="tableWrap">
  43. <el-table :data='tableList'
  44. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  45. <el-table-column align='center'
  46. label="分部"
  47. prop="organName">
  48. </el-table-column>
  49. <el-table-column align='center'
  50. label="收费类型">
  51. <template slot-scope="scope">
  52. <div>
  53. {{ scope.row.chargeType | chargeTypeFilter }}
  54. </div>
  55. </template>
  56. </el-table-column>
  57. <el-table-column align='center'
  58. label="标题"
  59. prop="title">
  60. </el-table-column>
  61. <el-table-column align='center'
  62. label="金额"
  63. prop="amount">
  64. </el-table-column>
  65. <el-table-column align='center'
  66. label="时间">
  67. <template slot-scope="scope">
  68. <div>
  69. {{ scope.row.createTime | formatTimer }}
  70. </div>
  71. </template>
  72. </el-table-column>
  73. <el-table-column align='center'
  74. label="创建人"
  75. prop="operatorName">
  76. </el-table-column>
  77. <el-table-column align='center'
  78. label="操作">
  79. <template slot-scope="scope">
  80. <div>
  81. <el-button type="text"
  82. @click="lookVisible(scope.row)">查看</el-button>
  83. <el-button type="text"
  84. v-permission="'sporadicChargeInfo/delete'"
  85. @click="removeItem(scope.row)">删除</el-button>
  86. </div>
  87. </template>
  88. </el-table-column>
  89. </el-table>
  90. <pagination :total="pageInfo.total"
  91. :page.sync="pageInfo.page"
  92. :limit.sync="pageInfo.limit"
  93. :page-sizes="pageInfo.page_size"
  94. @pagination="getList" />
  95. </div>
  96. </div>
  97. <el-dialog :title="title"
  98. :visible.sync="zeroVisible"
  99. width="650px">
  100. <el-form :model='maskForm'
  101. :rules="maskRules"
  102. label-width="100px"
  103. label-position="right"
  104. :inline="true"
  105. ref="maskForm">
  106. <el-form-item label="标题"
  107. prop="title">
  108. <el-input v-model="maskForm.title"
  109. :disabled='!isNew'></el-input>
  110. </el-form-item>
  111. <el-form-item label="收费类型"
  112. prop="type">
  113. <el-select v-model="maskForm.type"
  114. :disabled='!isNew'
  115. clearable
  116. filterable>
  117. <el-option label="考级"
  118. :value="1"></el-option>
  119. <el-option label="缴费"
  120. :value="2"></el-option>
  121. <el-option label="声部更改"
  122. :value="3"></el-option>
  123. <el-option label="乐器更换"
  124. :value="4"></el-option>
  125. </el-select>
  126. </el-form-item>
  127. <el-form-item label="金额"
  128. prop='money'>
  129. <el-input v-model="maskForm.money"
  130. type="number"
  131. :disabled='!isNew'></el-input>
  132. </el-form-item>
  133. <el-form-item label="分部"
  134. prop="organId">
  135. <el-select v-model="maskForm.organId"
  136. :disabled='!isNew'
  137. clearable
  138. filterable>
  139. <el-option v-for='(item,index) in organList'
  140. :key="index"
  141. :value="item.id"
  142. :label="item.name"></el-option>
  143. </el-select>
  144. </el-form-item>
  145. <el-form-item label="查看链接"
  146. v-if="!isNew">
  147. <el-input style='width:400px'
  148. :disabled='!isNew'
  149. v-model="maskForm.code"></el-input>
  150. <el-button type='danger'
  151. @click="onCreateQRCode">二维码</el-button>
  152. </el-form-item>
  153. <el-form-item label="收费详情"
  154. prop="desc">
  155. <el-input type='textarea'
  156. :disabled='!isNew'
  157. v-model="maskForm.desc"
  158. style="width:490px"
  159. :autosize="{minRows: 5}"></el-input>
  160. </el-form-item>
  161. </el-form>
  162. <span slot="footer"
  163. class="dialog-footer">
  164. <el-button @click="zeroVisible = false">取 消</el-button>
  165. <el-button type="primary"
  166. v-if="isNew"
  167. @click="addZero">确 定</el-button>
  168. <el-button v-if="!isNew"
  169. type="primary"
  170. @click="zeroVisible = false">确定</el-button>
  171. </span>
  172. </el-dialog>
  173. <el-dialog :visible.sync="qrcodeStatus"
  174. center
  175. width="300px">
  176. <div class="right-code">
  177. <h2 class="title">缴费链接</h2>
  178. <div id="qrcode"
  179. class="qrcode code"
  180. ref="qrCodeUrl"></div>
  181. <!-- <p class="code-url"
  182. v-if="codeUrl2">{{ codeUrl2 }}</p> -->
  183. </div>
  184. </el-dialog>
  185. </div>
  186. </template>
  187. <script>
  188. import { getEmployeeOrgan } from '@/api/buildTeam'
  189. import pagination from '@/components/Pagination/index'
  190. import { vaildStudentUrl } from '@/utils/validate'
  191. import { addZero, getZero, removeZero } from '@/api/zeroManager'
  192. import QRCode from 'qrcodejs2'
  193. export default {
  194. components: { pagination },
  195. data () {
  196. return {
  197. zeroVisible: false,
  198. searchForm: {
  199. organId: null,
  200. type: null,
  201. },
  202. tableList: [{}],
  203. organList: [],
  204. maskForm: {
  205. organId: '',
  206. type: '',
  207. money: '',
  208. desc: '',
  209. title: '',
  210. code: ''
  211. },
  212. maskRules: {
  213. organId: [{ required: true, message: '请选择分部', trigger: 'change' }],
  214. type: [{ required: true, message: '请选择收费类型', trigger: 'change' }],
  215. money: [{ required: true, message: '请输入收费金额', trigger: 'change' }],
  216. title: [{ required: true, message: '请输入标题名称', trigger: 'change' }],
  217. },
  218. pageInfo: {
  219. // 分页规则
  220. limit: 10, // 限制显示条数
  221. page: 1, // 当前页
  222. total: 0, // 总条数
  223. page_size: [10, 20, 40, 50] // 选择限制显示条数
  224. },
  225. isNew: false,
  226. title: '新增收费',
  227. qrcodeStatus: false,
  228. qrcodes: true,
  229. activeRow: null
  230. }
  231. }, mounted () {
  232. getEmployeeOrgan().then(res => {
  233. if (res.code == 200) {
  234. this.organList = res.data;
  235. }
  236. })
  237. this.getList();
  238. },
  239. methods: {
  240. search () {
  241. this.pageInfo.page = 1;
  242. this.getList()
  243. },
  244. getList () {
  245. let chargeType, organId;
  246. this.searchForm.type ? chargeType = this.searchForm.type : chargeType = null
  247. this.searchForm.organId ? organId = this.searchForm.organId : organId = null
  248. getZero({ page: this.pageInfo.page, rows: this.pageInfo.limit, chargeType, organId }).then(res => {
  249. if (res.code == 200) {
  250. this.tableList = res.data.rows
  251. this.pageInfo.total = res.data.total
  252. }
  253. })
  254. },
  255. newVisible () {
  256. this.isNew = true;
  257. this.zeroVisible = true;
  258. this.title = '新增收费'
  259. },
  260. lookVisible (row) {
  261. this.isNew = false;
  262. this.zeroVisible = true;
  263. this.title = '查看收费'
  264. this.activeRow = row
  265. this.maskForm.code = vaildStudentUrl() + `/#/sporadicLogin?id=${this.activeRow.id}`
  266. this.maskForm.type = parseInt(row.chargeType)
  267. this.maskForm.desc = row.detail
  268. this.maskForm.title = row.title
  269. this.maskForm.organId = row.organId
  270. this.maskForm.money = row.amount
  271. // this.maskForm = {
  272. // code: vaildStudentUrl() + `/#/sporadicLogin?id=${this.activeRow.id}`,
  273. // type: parseInt(row.chargeType),
  274. // desc: row.detail,
  275. // title: row.title,
  276. // organId: row.organId,
  277. // money: row.amount
  278. // }
  279. },
  280. // look2Code () { },
  281. onCreateQRCode () { // 生成报名二维码
  282. this.qrcodeStatus = true
  283. // let id = this.$route.query.id
  284. // let teamName = this.$route.query.name
  285. setTimeout(() => {
  286. if (this.qrcodes) {
  287. this.qrcodes = false
  288. this.qrcode = new QRCode('qrcode', {
  289. width: 250,
  290. height: 250,
  291. colorDark: '#000000',
  292. colorLight: '#ffffff',
  293. correctLevel: QRCode.CorrectLevel.H
  294. })
  295. }
  296. // vaildStudentUrl() + `/#/sporadicLogin?id=${刷刷刷}`
  297. this.qrcode.clear();
  298. this.qrcode.makeCode(vaildStudentUrl() + `/#/sporadicLogin?id=${this.activeRow.id}`)
  299. // this.codeUrl = vaildStudentUrl() + '/#/login?musicGroupId=' + id
  300. }, 500)
  301. },
  302. addZero () {
  303. this.$refs['maskForm'].validate(item => {
  304. if (item) {
  305. let obj = {
  306. chargeType: this.maskForm.type,
  307. detail: this.maskForm.desc,
  308. title: this.maskForm.title,
  309. organId: this.maskForm.organId,
  310. amount: this.maskForm.money
  311. }
  312. addZero(obj).then(res => {
  313. if (res.code == 200) {
  314. this.$message.success('新增成功')
  315. this.zeroVisible = false;
  316. this.getList()
  317. }
  318. })
  319. }
  320. })
  321. },
  322. removeItem (row) {
  323. this.$confirm('是否删除该收费', '提示', {
  324. confirmButtonText: '确定',
  325. cancelButtonText: '取消',
  326. type: 'warning'
  327. }).then(() => {
  328. removeZero({ id: row.id }).then(res => {
  329. if (res.code == 200) {
  330. this.$message.success('删除成功')
  331. this.zeroVisible = false;
  332. this.getList()
  333. }
  334. })
  335. }).catch(() => {
  336. });
  337. }
  338. },
  339. watch: {
  340. zeroVisible (val) {
  341. if (!val) {
  342. this.maskForm = {
  343. organId: '',
  344. type: '',
  345. money: '',
  346. desc: '',
  347. title: '',
  348. code: ''
  349. }
  350. // this.$refs['maskForm'].resetFields()
  351. // console.log(this.$refs['zeroForm'].resetFields)
  352. }
  353. },
  354. },
  355. filters: {
  356. chargeTypeFilter (val) {
  357. let template = {
  358. '1': '考级',
  359. '2': '缴费',
  360. '3': '声部更改',
  361. '4': '乐器更换'
  362. }
  363. return template[val]
  364. }
  365. }
  366. }
  367. </script>
  368. <style lang="scss">
  369. .right-code {
  370. // width: 50%;
  371. // float: left;
  372. .title {
  373. font-size: 18px;
  374. text-align: center;
  375. padding-bottom: 8px;
  376. }
  377. }
  378. </style>