order.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. <template>
  2. <div class="order">
  3. <!-- <header>
  4. <van-icon name="arrow-left" />
  5. 缴费详情
  6. <van-dropdown-menu>
  7. <van-dropdown-item @change="onChange" v-model="voicyPart" :options="voicyPartList" />
  8. </van-dropdown-menu>
  9. </header> -->
  10. <van-nav-bar
  11. title="缴费详情"
  12. right-text="按钮"
  13. fixed
  14. :left-arrow="plat == 'manager' ? true : false"
  15. z-index="999"
  16. :style="{ paddingTop: headTop + 'px' }"
  17. @click-left="onClickLeft"
  18. >
  19. <template #right>
  20. <van-dropdown-menu z-index="999" active-color="#01C1B5">
  21. <van-dropdown-item @change="onChange" v-model="voicyPart" :options="voicyPartList" />
  22. </van-dropdown-menu>
  23. </template>
  24. </van-nav-bar>
  25. <h2 :style="{ marginTop: (46 + headTop) + 'px' }">{{musicGroupName}}</h2>
  26. <van-tabs color="#01C1B5" @change="onTabChange">
  27. <van-tab title="缴费信息" name="1">
  28. <div class="table">
  29. <div class="title">
  30. <span></span>
  31. <span>姓名</span>
  32. <span>声部</span>
  33. <span>支付金额</span>
  34. <span>到账时间</span>
  35. </div>
  36. <div class="content">
  37. <div v-for="(data, index) in dataList" :key="data.id">
  38. <!-- <div> -->
  39. <span> {{ ++index }} </span>
  40. <span> {{ data.userName }} </span>
  41. <span> {{ data.subjectName }} </span>
  42. <span> {{ data.paymentAmount }} </span>
  43. <span> {{ data.payTime }} </span>
  44. </div>
  45. <p style="padding: 8px 8px 20px">缴费总额:{{ (amountCount).toFixed(2) }}元</p>
  46. </div>
  47. </div>
  48. </van-tab>
  49. <van-tab title="报名信息" name="2">
  50. <div class="table">
  51. <div class="title">
  52. <span></span>
  53. <span>姓名</span>
  54. <span>班级</span>
  55. <span>声部</span>
  56. <span>备注</span>
  57. <span>调剂</span>
  58. </div>
  59. <div class="content">
  60. <div v-for="(data, index) in studentList" :key="data.id">
  61. <!-- <div> -->
  62. <span> {{ ++index }} </span>
  63. <span> {{ data.userName }} </span>
  64. <span> {{ data.currentClass }} </span>
  65. <span> {{ data.subjectName }} </span>
  66. <span> {{ data.remark }} </span>
  67. <span><van-button
  68. :disabled="data.paymentStatus == 2 ? true : false"
  69. round
  70. @click = "adjust(data)"
  71. type = "danger"
  72. size = "small">调剂</van-button> </span>
  73. </div>
  74. </div>
  75. </div>
  76. <van-action-sheet
  77. v-model="adjustStatus"
  78. :actions="couresList"
  79. cancel-text="取消"
  80. @cancel="adjustStatus = false"
  81. @select="adjustSelect" />
  82. </van-tab>
  83. <van-tab title="数据统计" name="3">
  84. <van-cell class="countInfo" title="报名总人数" :value="config.regNum + '人'"></van-cell>
  85. <van-cell class="countInfo" title="缴费总人数" :value="config.payNum + '人'"></van-cell>
  86. <van-cell class="countInfo" title="家长会当日缴费人数" :value="config.firstDayPayNum + '人'"></van-cell>
  87. <van-cell class="countInfo" :value="config.payScale + '%'">
  88. <template #title>
  89. <div style="display: flex;align-items: center;">家长会当日缴费人数占比
  90. <van-icon name="question-o" @click="onTip" style="padding-left: .05rem;" />
  91. </div>
  92. </template>
  93. </van-cell>
  94. <div style="width: 100%;overflow-x: auto;">
  95. <div class="table" style="width: 145%;">
  96. <van-row style="border: 1px solid #eaeaea">
  97. <van-col span="1">&nbsp;</van-col>
  98. <van-col span="3">学员编号</van-col>
  99. <van-col span="2">姓名</van-col>
  100. <van-col span="2">声部</van-col>
  101. <van-col span="4">
  102. <div style="display: flex;align-items: center;justify-content: center;" @click="onChangeSort('1')">
  103. 预报名时间
  104. <div>
  105. <i class="box box-up" :class="[orderByPerRegister == 'ASC' ? 'active' : null]" style="margin-bottom: .02rem;"></i>
  106. <i class="box box-down" :class="[orderByPerRegister == 'DESC' ? 'active' : null]"></i>
  107. </div>
  108. </div>
  109. </van-col>
  110. <van-col span="4">预报名时间差</van-col>
  111. <van-col span="4">
  112. <div style="display: flex;align-items: center;justify-content: center;" @click="onChangeSort('2')">
  113. 缴费时间
  114. <div>
  115. <i class="box box-up" :class="[orderByPayTime == 'ASC' ? 'active' : null]" style="margin-bottom: .02rem;"></i>
  116. <i class="box box-down" :class="[orderByPayTime == 'DESC' ? 'active' : null]"></i>
  117. </div>
  118. </div>
  119. </van-col>
  120. <van-col span="4">缴费时间差</van-col>
  121. </van-row>
  122. <van-row v-for="(data, index) in countList" :key="data.id" style="border: 1px solid #ebedf0">
  123. <van-col span="1">{{ ++index }}</van-col>
  124. <van-col span="3">{{ data.userId }}</van-col>
  125. <van-col span="2">{{ data.studentName }}</van-col>
  126. <van-col span="2">{{ data.actualSubjectName }}</van-col>
  127. <van-col span="4">{{ data.perRegisterTime }}</van-col>
  128. <van-col span="4">{{ data.perRegIntervalStr }}</van-col>
  129. <van-col span="4">{{ data.payTime }}</van-col>
  130. <van-col span="4">{{ data.payIntervalStr }}</van-col>
  131. </van-row>
  132. </div>
  133. </div>
  134. </van-tab>
  135. </van-tabs>
  136. </div>
  137. </template>
  138. <script>
  139. import { queryStudentApply, querySubByMusicGroupId, getRegisterOrPreList, updateSubject } from '@/api/teacher'
  140. import setLoading from '@/utils/loading'
  141. import cleanDeep from 'clean-deep'
  142. export default {
  143. name: 'order',
  144. data() {
  145. let query = this.$route.query
  146. return {
  147. headTop: query.headTop || 0, // 头部高度,为了处理教务端兼容
  148. musicGroupId: query.musicGroupId,
  149. musicGroupName: query.musicGroupName,
  150. plat: query.plat,
  151. dataList: {}, // 订单列表
  152. amountCount: 0, // 总额
  153. studentList: {}, // 学生列表
  154. couresList: [],
  155. countList: [],
  156. voicyPart: 0,
  157. voicyPartList: [{
  158. text: '全部声部',
  159. value: 0
  160. }],
  161. adjustStatus: false, //
  162. changeStudent: null, // 修改的学生对象
  163. orderByPerRegister: null, // 预报名时间排序状态
  164. orderByPayTime: null, // 缴费时间排序状态
  165. config: {
  166. regNum: 0,
  167. firstDayPayNum: 0,
  168. payScale: 0,
  169. payNum: 0
  170. }
  171. }
  172. },
  173. async mounted() {
  174. window.localStorage.removeItem('userInfo') // 删除用户信息
  175. window.localStorage.removeItem('Authorization') // 删除用户信息
  176. setLoading(true)
  177. await querySubByMusicGroupId({ musicGroupId: this.musicGroupId }).then(res => {
  178. let result = res.data
  179. if(result.code == 200) {
  180. result.data.forEach(r => {
  181. this.voicyPartList.push({
  182. text: r.name,
  183. value: r.id
  184. })
  185. this.couresList.push({
  186. name: r.name,
  187. id: r.id
  188. })
  189. })
  190. }
  191. })
  192. setLoading(false)
  193. // 获取订单信息
  194. await this.getOrderList()
  195. // await this.getOrderStudentList()
  196. // await this.getRegisterOrPreList()
  197. },
  198. methods: {
  199. onClickLeft() {
  200. window.history.go(-1)
  201. },
  202. adjust(item) {
  203. // 开始调剂
  204. if(item.paymentStatus != 2) {
  205. this.adjustStatus = true
  206. this.changeStudent = item
  207. }
  208. },
  209. adjustSelect(item) { // 修改专业
  210. updateSubject({
  211. musicGroupId: this.musicGroupId,
  212. subId: item.id,
  213. userId: this.changeStudent.userId
  214. }).then(res => {
  215. let result = res.data
  216. if(result.code == 200) {
  217. this.$toast('修改成功')
  218. this.adjustStatus = false
  219. this.getOrderStudentList()
  220. } else {
  221. this.$toast(result.msg)
  222. }
  223. })
  224. },
  225. async getOrderList() {
  226. setLoading(true)
  227. // 获取订单信息
  228. await queryStudentApply({
  229. musicGroupId: this.musicGroupId,
  230. rows: 9999,
  231. subjectId: this.voicyPart ? this.voicyPart : '',
  232. paymentStatus: 2,
  233. page: 1
  234. }).then(res => {
  235. let result = res.data
  236. this.amountCount = 0
  237. if(result.code == 200) {
  238. this.dataList = result.data.rows
  239. result.data.rows.forEach(item => {
  240. this.amountCount += item.paymentAmount
  241. })
  242. }
  243. }).catch(() => {
  244. setLoading(false)
  245. })
  246. setLoading(false)
  247. },
  248. async getOrderStudentList() {
  249. setLoading(true)
  250. // 获取订单信息
  251. await queryStudentApply({
  252. musicGroupId: this.musicGroupId,
  253. rows: 9999,
  254. subjectId: this.voicyPart ? this.voicyPart : '',
  255. page: 1
  256. }).then(res => {
  257. let result = res.data
  258. if(result.code == 200) {
  259. this.studentList = result.data.rows
  260. }
  261. }).catch(() => {
  262. setLoading(false)
  263. })
  264. setLoading(false)
  265. },
  266. async getRegisterOrPreList() {
  267. setLoading(true)
  268. // 获取订单信息
  269. await getRegisterOrPreList(cleanDeep({
  270. musicGroupId: this.musicGroupId,
  271. rows: 9999,
  272. subjectId: this.voicyPart ? this.voicyPart : '',
  273. orderByPerRegister: this.orderByPerRegister,
  274. orderByPayTime: this.orderByPayTime,
  275. page: 1
  276. })).then(res => {
  277. let result = res.data
  278. if(result.code == 200) {
  279. let tempDate = result.data
  280. let scale = 0
  281. if(tempDate.payNum > 0) {
  282. scale = ((tempDate.firstDayPayNum / tempDate.payNum) * 100)
  283. }
  284. this.config = {
  285. regNum: tempDate.regNum,
  286. firstDayPayNum: tempDate.firstDayPayNum,
  287. payScale: (scale).toFixed(2),
  288. payNum: tempDate.payNum
  289. }
  290. this.countList = tempDate.rows
  291. }
  292. }).catch(() => {
  293. setLoading(false)
  294. })
  295. setLoading(false)
  296. },
  297. onChange() {
  298. // 切换声部时
  299. // let subId = value ? value : ''
  300. this.getOrderList(this.voicyPart)
  301. this.getOrderStudentList(this.voicyPart)
  302. this.getRegisterOrPreList(this.voicyPart)
  303. },
  304. onTabChange(name) {
  305. if(name == 1) {
  306. this.dataList = []
  307. this.getOrderList()
  308. } else if(name == 2) {
  309. this.studentList = []
  310. this.getOrderStudentList()
  311. } else if(name == 3) {
  312. this.config = {
  313. regNum: 0,
  314. firstDayPayNum: 0,
  315. payScale: 0,
  316. payNum: 0
  317. }
  318. this.countList = []
  319. this.getRegisterOrPreList()
  320. }
  321. },
  322. onTip() {
  323. this.$dialog.alert({
  324. message: '家长会当日缴费人数 / 缴费总人数',
  325. }).then(() => {
  326. // on close
  327. });
  328. },
  329. async onChangeSort(sort) {
  330. if(sort == 1) {
  331. this.orderByPayTime = null
  332. if(this.orderByPerRegister == 'ASC') {
  333. this.orderByPerRegister = 'DESC'
  334. } else if(this.orderByPerRegister == 'DESC') {
  335. this.orderByPerRegister = null
  336. } else {
  337. this.orderByPerRegister = 'ASC'
  338. }
  339. } else if(sort == 2) {
  340. this.orderByPerRegister = null
  341. if(this.orderByPayTime == 'ASC') {
  342. this.orderByPayTime = 'DESC'
  343. } else if(this.orderByPayTime == 'DESC') {
  344. this.orderByPayTime = null
  345. } else {
  346. this.orderByPayTime = 'ASC'
  347. }
  348. }
  349. await this.getRegisterOrPreList()
  350. }
  351. }
  352. }
  353. </script>
  354. <style lang="less" scoped>
  355. .order {
  356. background: #fff;
  357. // min-height: 100vh;
  358. }
  359. header {
  360. height: .40rem;
  361. line-height: .40rem;
  362. color: #fff;
  363. font-size: .17rem;
  364. background: #01C1B5;
  365. box-shadow: 0px 1px 8px 0px rgba(0,0,0,0.07);
  366. text-align: center;
  367. }
  368. h2 {
  369. font-size: .16rem;
  370. color: #000;
  371. padding: .1rem 0;
  372. text-align: center;
  373. background: #fff;
  374. }
  375. .table {
  376. .title {
  377. display: flex;
  378. align-items: center;
  379. text-align: center;
  380. border-bottom: 1px solid #eaeaea;
  381. }
  382. span {
  383. flex: 1;
  384. padding: .08rem 0;
  385. font-size: .14rem;
  386. &:first-child {
  387. width: .3rem;
  388. flex: inherit;
  389. }
  390. }
  391. .content > div{
  392. width: 100%;
  393. display: flex;
  394. align-items: center;
  395. text-align: center;
  396. &:nth-child(2n+2) {
  397. background: #eaeaea;
  398. }
  399. }
  400. }
  401. /deep/.van-dropdown-menu {
  402. height: 46px;
  403. // position: absolute;
  404. // right: .15rem;
  405. background: #fff;
  406. // top: 0;
  407. .van-dropdown-menu__bar {
  408. height: 46px;
  409. background: #fff;
  410. box-shadow: none;
  411. }
  412. .van-dropdown-menu__title {
  413. color: #000;
  414. }
  415. &::after {
  416. border: 0;
  417. }
  418. }
  419. /deep/.van-nav-bar {
  420. background: #fff;
  421. .van-icon {
  422. font-size: .18rem;
  423. color: #000;
  424. }
  425. .van-nav-bar__title {
  426. color: #000;
  427. font-size: 18px;
  428. }
  429. }
  430. /deep/.van-col {
  431. font-size: 0.14rem;
  432. text-align: center;
  433. padding: .08rem 0;
  434. }
  435. /deep/.van-row {
  436. &:nth-child(2n+3) {
  437. background: #eaeaea;
  438. }
  439. }
  440. .box {
  441. display: flex;
  442. flex-direction: row;
  443. align-items: center;
  444. margin-left: .02rem;
  445. }
  446. .box-up {
  447. width: 0;
  448. height: 0;
  449. border-left: 4px solid transparent;
  450. border-right: 4px solid transparent;
  451. border-bottom: 6px solid #ccc;
  452. &.active {
  453. border-bottom-color: #01C1B5;
  454. }
  455. }
  456. .box-down {
  457. width: 0;
  458. height: 0;
  459. border-left: 4px solid transparent;
  460. border-right: 4px solid transparent;
  461. border-top: 6px solid #ccc;
  462. &.active {
  463. border-top-color: #01C1B5;
  464. }
  465. }
  466. .countInfo {
  467. /deep/.van-cell__title {
  468. flex: 1 auto;
  469. }
  470. /deep/.van-cell__value {
  471. color: #01C1B5;
  472. }
  473. }
  474. </style>