order.vue 16 KB

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