洛阳学员端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

186 lines
4.3 KiB

10 months ago
  1. <template>
  2. <view class="pageBgImg">
  3. <topNavbar title="我的订单"></topNavbar>
  4. <view class="pad">
  5. <view class="searcBox">
  6. <searchRow placeholder="搜索" @searchFn="searchFn"/>
  7. </view>
  8. <view class="tabs">
  9. <view class="tab" v-for="(item,index) in tabList" :key="index" :class="{active: params.orderStatus==item.id}" @click="changeTab(item)">{{ item.text }}</view>
  10. </view>
  11. <view class="navs">
  12. <view class="nav" v-for="(item,index) in navList" :key="index" :class="{active: params.orderType==item.id}" @click="changeNav(item)">{{ item.text }}</view>
  13. </view>
  14. <view class="recordTotal"> <text v-if="total">{{total}}条记录</text></view>
  15. <view class="tabCon">
  16. <view class="card" v-for="(item,index) in list" :key="index" @click="goDetail(item)">
  17. <opera :item="item"></opera>
  18. </view>
  19. </view>
  20. <view style="padding-bottom: 20rpx;" v-if="list.length>2">
  21. <u-loadmore :status="status" />
  22. </view>
  23. <nodata v-if="!list.length&&status=='nomore'"></nodata>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import opera from './comp/opera'
  29. import { applyOrderPage, refundPage } from '@/config/api.js'
  30. export default {
  31. components: { opera },
  32. data() {
  33. return {
  34. tabList: [
  35. {text: '已付',id: 1},
  36. {text: '待付',id: 0},
  37. {text: '退款',id: 3},
  38. ],//0:待支付,1:已支付,-1:已取消,2:支付失败
  39. navList: [
  40. {text: '全部', id: 0},
  41. {text: '学费', id: 1},
  42. {text: '考场模拟费', id: 3}
  43. ],//1:驾校培训费用,2:理科培训费用,3:考场适应性费用,4:额外学时购买
  44. params: {
  45. pageNo: 1,
  46. pageSize: 20,
  47. orderStatus: 1,
  48. orderType: 0,
  49. sercheValue: ''
  50. },
  51. list: [],
  52. total: 0,
  53. status: 'loading'
  54. }
  55. },
  56. onLoad() {
  57. this.params.studentId = this.studentId
  58. this.applyOrderPageFn()
  59. },
  60. onPullDownRefresh() {
  61. this.initList()
  62. },
  63. onReachBottom() {
  64. if(this.total>this.list.length) {
  65. this.applyOrderPageFn()
  66. }
  67. },
  68. methods: {
  69. goDetail(item) {
  70. if(this.params.orderStatus==3) {
  71. this.$goPage('/pages/mineEntry/myOrder/detail/detail?refundId='+ item.id+'&orderId='+item.orderId)
  72. }else {
  73. this.$goPage('/pages/mineEntry/myOrder/detail/detail?orderId='+ item.orderId)
  74. }
  75. },
  76. searchFn(val) {
  77. this.params.sercheValue = val
  78. this.initList()
  79. },
  80. changeTab(item) {
  81. this.params.orderStatus = item.id
  82. this.initList()
  83. },
  84. changeNav(item) {
  85. this.params.orderType = item.id
  86. this.initList()
  87. },
  88. initList() {
  89. this.params.pageNo = 1
  90. this.list = []
  91. this.status = 'loading'
  92. this.applyOrderPageFn()
  93. },
  94. async applyOrderPageFn() {
  95. let obj = Object.assign({},this.params)
  96. if(obj.orderType==0) delete obj.orderType
  97. if(!obj.sercheValue) delete obj.sercheValue
  98. if(this.params.orderStatus==3) {
  99. delete obj.orderStatus
  100. if(obj.orderType) {
  101. obj.feeType = obj.orderType
  102. delete obj.orderType
  103. }
  104. var {data: res} = await refundPage(obj)
  105. }else {
  106. var {data: res} = await applyOrderPage(obj)
  107. }
  108. this.list.push(...res.list)
  109. this.params.pageNo ++
  110. this.total = res.total
  111. if(this.total==this.list.length) {
  112. this.status = 'nomore'
  113. }
  114. uni.stopPullDownRefresh()
  115. }
  116. }
  117. }
  118. </script>
  119. <style lang="scss" scoped>
  120. .searcBox {
  121. margin: 0 0 20rpx 0;
  122. }
  123. .card {
  124. padding: 0 24rpx;
  125. margin-bottom: 20rpx;
  126. }
  127. .tabs {
  128. display: flex;
  129. width: 100%;
  130. height: 72rpx;
  131. background: #FFFFFF;
  132. border-radius: 16rpx;
  133. margin-top: 20rpx;
  134. .tab {
  135. flex: 1;
  136. text-align: center;
  137. line-height: 72rpx;
  138. color: #ADADAD;
  139. &.active {
  140. background: rgba(25,137,250,0.1);
  141. border-radius: 16rpx;
  142. border: 2rpx solid #1989FA;
  143. color: $themC;
  144. font-weight: 600;
  145. }
  146. }
  147. }
  148. .navs {
  149. display: flex;
  150. justify-content: space-between;
  151. color: #fff;
  152. font-size: 28rpx;
  153. padding: 10rpx 30rpx 24rpx 30rpx;
  154. color: $themC;
  155. .nav {
  156. height: 80rpx;
  157. line-height: 80rpx;
  158. padding: 0 20rpx;
  159. &.active {
  160. font-weight: 500;
  161. position: relative;
  162. &::before {
  163. position: absolute;
  164. left: 50%;
  165. transform: translateX(-50%);
  166. bottom: 6rpx;
  167. content: '';
  168. width: 56rpx;
  169. height: 6rpx;
  170. background: $themC;
  171. border-radius: 3rpx;
  172. }
  173. }
  174. }
  175. }
  176. .recordTotal {
  177. font-size: 24rpx;
  178. padding: 0rpx 0 28rpx 0;
  179. text-align: right;
  180. }
  181. </style>