paymentRecords.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <template>
  2. <view>
  3. <u-navbar title="缴费记录"></u-navbar>
  4. <view class="screen">
  5. <view class="date" @click="show = true">
  6. <view class="text">
  7. {{year}}年
  8. </view>
  9. <view class="icon">
  10. <u-icon name="arrow-down-fill" color="#999999" size="10"></u-icon>
  11. </view>
  12. </view>
  13. <u-line color="#999999" direction="col" length="40" margin="auto" />
  14. <view class="course" @click="courseShow = true">
  15. <view class="text">
  16. {{studentName}}
  17. </view>
  18. <view class="icon">
  19. <u-icon name="arrow-down-fill" color="#999999" size="10"></u-icon>
  20. </view>
  21. </view>
  22. </view>
  23. <u-picker mode="time" v-model="show" :params="params" :defaultTime="defaultTime" @confirm="confirm">
  24. </u-picker>
  25. <u-select v-model="courseShow" mode="single-column" :list="studentList" @confirm="courseConfirm"></u-select>
  26. <view class="main">
  27. <view class="item" v-for="(item,index) in paymentList" :key="index"
  28. @click="gotoUrl('pages/youth/course/paymentDetail?id=' + item.billNum + '&studentId=' + item.studentId)">
  29. <view class="date">
  30. {{item.buyTime}}
  31. </view>
  32. <view class="infos">
  33. <view class="picture">
  34. <img v-if="item.posterUrl != null" :src="item.posterUrl" alt="">
  35. <img v-else src="../../../assets/img/picture1.png" alt="">
  36. </view>
  37. <view class="course">
  38. <view class="name">
  39. {{item.className}}
  40. </view>
  41. <view class="season-hour">
  42. <view class="season">
  43. {{item.packageName}}
  44. </view>
  45. <!-- <view class="hour">
  46. {{item.buyTime}}课时
  47. </view> -->
  48. </view>
  49. </view>
  50. <view class="price">
  51. {{item.realPay!=null ? item.realPay.toFixed(2) : ''}}
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. <!-- <u-divider v-if="paymentList.length == recordsTotal && recordsTotal != 0" style="margin-top: 10px">没有更多数据了
  57. </u-divider> -->
  58. </view>
  59. </template>
  60. <script>
  61. import * as courseApi from '@/apis/youth/course.js'
  62. import * as mineApi from '@/apis/youth/mine.js'
  63. export default {
  64. data() {
  65. return {
  66. courseName: '全部课程',
  67. courseShow: false,
  68. courseList: [],
  69. courseId: '',
  70. pageNum: 1,
  71. pageSize: 5,
  72. recordsTotal: 0,
  73. paymentList: [],
  74. studentId: '',
  75. year: '',
  76. defaultTime: '',
  77. params: {
  78. year: true,
  79. month: false,
  80. day: false,
  81. hour: false,
  82. minute: false,
  83. second: false,
  84. timestamp: true
  85. },
  86. show: false,
  87. studentId: '',
  88. studentName: '全部',
  89. studentList: []
  90. }
  91. },
  92. onReady() {
  93. var date = new Date();
  94. this.year = date.getFullYear();
  95. // this.studentId = this.carhelp.getStudentId().studentId;
  96. // this.getLoadMyBuyLog();
  97. // this.getCourseList();
  98. this.getStudentList();
  99. },
  100. // onReachBottom() {
  101. // if (this.paymentList.length < this.recordsTotal) {
  102. // this.myLoadmore();
  103. // }
  104. // },
  105. methods: {
  106. courseConfirm(e) {
  107. this.studentId = e[0].value;
  108. this.studentName = e[0].label;
  109. if(this.studentName == '全部') {
  110. this.getStudentList();
  111. } else {
  112. this.getLoadMyBuyLog();
  113. }
  114. },
  115. getStudentList() {
  116. this.studentList = [];
  117. uni.showLoading({
  118. title: "加载中",
  119. mask: true,
  120. })
  121. mineApi.studentList().then((res) => {
  122. uni.hideLoading();
  123. var list = res.data.studentList;
  124. var list2 = [];
  125. this.studentList.push({
  126. value: '',
  127. label: '全部'
  128. });
  129. for (var i = 0; i < list.length; i++) {
  130. this.studentList.push({
  131. value: list[i].studentId,
  132. label: list[i].studentName
  133. })
  134. this.studentId = list[i].studentId;
  135. this.getLoadMyBuyLog();
  136. }
  137. }).catch(error => {
  138. uni.showToast({
  139. title: error,
  140. icon: "none"
  141. })
  142. })
  143. },
  144. getCourseList() {
  145. this.courseList = [];
  146. uni.showLoading({
  147. title: "加载中",
  148. mask: true,
  149. })
  150. courseApi.loadMyBuyCourseNames({
  151. studentId: this.studentId
  152. }).then((res) => {
  153. uni.hideLoading();
  154. var list = res.data;
  155. this.courseList.push({
  156. value: '',
  157. label: '全部'
  158. });
  159. for (var i = 0; i < list.length; i++) {
  160. this.courseList.push({
  161. value: list[i].courseId,
  162. label: list[i].courseName
  163. });
  164. }
  165. }).catch(error => {
  166. uni.showToast({
  167. title: error,
  168. icon: "none"
  169. })
  170. })
  171. },
  172. // myLoadmore() {
  173. // this.pageNum += 1;
  174. // this.getLoadMyBuyLog()
  175. // },
  176. confirm(params) {
  177. this.year = params.year;
  178. this.getLoadMyBuyLog();
  179. },
  180. getLoadMyBuyLog() {
  181. this.paymentList = [];
  182. uni.showLoading({
  183. title: "加载中",
  184. mask: true,
  185. })
  186. // if (bl) {
  187. // this.paymentList = [];
  188. // this.pageNum = 1;
  189. // }
  190. courseApi.loadMyBuyLog({
  191. studentId: this.studentId,
  192. year: this.year,
  193. courseId: this.courseId,
  194. pageNum: 1,
  195. pageSize: 1000
  196. }).then((res) => {
  197. uni.hideLoading();
  198. // this.paymentList = [
  199. // ...this.paymentList,
  200. // ...res.data.data
  201. // ];
  202. // this.recordsTotal = res.data.recordsTotal;
  203. var list = res.data.data;
  204. for (var i = 0; i < list.length; i++) {
  205. this.paymentList.push(list[i]);
  206. }
  207. // this.paymentList = res.data.data;
  208. }).catch(error => {
  209. uni.showToast({
  210. title: error,
  211. icon: "none"
  212. })
  213. })
  214. },
  215. }
  216. }
  217. </script>
  218. <style lang="scss" scoped>
  219. .screen {
  220. background-color: #fff;
  221. display: flex;
  222. justify-content: space-between;
  223. text-align: center;
  224. height: 44px;
  225. line-height: 44px;
  226. position:fixed;
  227. top: 88rpx;
  228. left: 0;
  229. right: 0;
  230. z-index: 999;
  231. .date {
  232. flex: 1;
  233. display: flex;
  234. align-items: center;
  235. justify-content: center;
  236. .text {
  237. margin-right: 8rpx;
  238. }
  239. }
  240. .course {
  241. display: flex;
  242. flex: 1;
  243. align-items: center;
  244. justify-content: center;
  245. .text {
  246. margin-right: 8rpx;
  247. }
  248. }
  249. }
  250. .main {
  251. margin-top:88rpx;
  252. .item {
  253. .date {
  254. padding: 24rpx 32rpx;
  255. color: rgba(119, 119, 119, 1);
  256. }
  257. .infos {
  258. background-color: #fff;
  259. padding: 24rpx 36rpx;
  260. display: flex;
  261. align-items: center;
  262. .picture {
  263. width: 92rpx;
  264. height: 92rpx;
  265. img {
  266. width: 100%;
  267. height: 100%;
  268. }
  269. }
  270. .course {
  271. margin-left: 24rpx;
  272. .name {
  273. color: rgba(51, 51, 51, 1);
  274. font-size: 16px;
  275. font-weight: bold;
  276. }
  277. .season-hour {
  278. display: flex;
  279. color: rgba(119, 119, 119, 1);
  280. margin-top: 8rpx;
  281. .hour {
  282. margin-left: 8rpx;
  283. }
  284. }
  285. }
  286. .price {
  287. color: rgba(16, 16, 16, 1);
  288. font-size: 18px;
  289. font-weight: bold;
  290. margin-left: auto;
  291. }
  292. }
  293. }
  294. }
  295. </style>