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.

315 lines
7.5 KiB

8 months ago
  1. <template>
  2. <view class="main">
  3. <view class="blueBg">
  4. <!-- <topNavbar title="预约记录"></topNavbar> -->
  5. <view class="pad">
  6. <view class="searchBox">
  7. <searchRow placeholder="搜索学员姓名、学员手机号" @searchFn="searchFn"></searchRow>
  8. </view>
  9. <view class="tabs">
  10. <view class="tab" @click="changeTab(0)" :class="{active: params.writtenoffStatus==0}">待核销</view>
  11. <view class="tab" @click="changeTab(1)" :class="{active: params.writtenoffStatus==1}">已核销</view>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="navs">
  16. <view class="nav" v-for="(item,index) in tabsList" :key="index" :class="{active: params.subject==item.id}" @click="changeNav(item)">{{ item.text }}</view>
  17. </view>
  18. <view class="pad">
  19. <view class="total_row">
  20. <view class="total"> <text v-if="total">{{total}}条记录</text></view>
  21. <view class="screen" @click="showDate=true">
  22. <view class="text"><text v-if="params.beginTime||params.trainType"></text> 筛选</view>
  23. <view class="icon">
  24. <image src="@/static/images/coach/screen.png" mode=""></image>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="card" @click="goPage" v-for="(item,index) in list" :key="index">
  29. <appointItem :item="item"/>
  30. </view>
  31. </view>
  32. <view style="padding-bottom: 100rpx;" v-if="list.length">
  33. <u-loadmore :status="status" />
  34. </view>
  35. <nodata v-if="!list.length&&status=='nomore'"></nodata>
  36. <UserTab name ='预约记录'></UserTab>
  37. <u-popup :show="showDate" mode="bottom" :round="20" :closeable="true" :closeOnClickOverlay="true">
  38. <view class="popupBox">
  39. <view class="pad">
  40. <view class="car">
  41. <view class="h1">车型</view>
  42. <view class="car_row">
  43. <view class="carItem" @click="screenCarFn('C1')" :class="{active: screen.trainType=='C1'}">C1</view>
  44. <view class="carItem" @click="screenCarFn('C2')" :class="{active: screen.trainType=='C2'}">C2</view>
  45. </view>
  46. </view>
  47. <view class="car">
  48. <view class="h1" >日期</view>
  49. <view class="car_row border" @click="showDatePicker=true">
  50. <mySelect placeholder="请选择日期" :value="screen.screenDate"></mySelect>
  51. <u-icon name="arrow-down" :size="12" :color="'#ADADAD'" style="margin-left: 12rpx;"></u-icon>
  52. </view>
  53. </view>
  54. <view class="btn_row">
  55. <view class="btnBorder btn" @click="resetScreen">重置</view>
  56. <view class="btnBg btn" @click="screenSearch">确定</view>
  57. </view>
  58. </view>
  59. </view>
  60. </u-popup>
  61. <u-datetime-picker
  62. :show="showDatePicker"
  63. mode="date"
  64. :closeOnClickOverlay="true"
  65. :minDate="1587524800000"
  66. @confirm="confirmDatePicker"
  67. @cancel="showDatePicker=false"
  68. @close="showDatePicker=false"
  69. ></u-datetime-picker>
  70. </view>
  71. </template>
  72. <script>
  73. import { examSimulationPages } from '@/config/api.js'
  74. export default {
  75. data() {
  76. return {
  77. tabsList: [
  78. {id: 0, text: '全部'},
  79. {id: 2, text: '科目二'},
  80. {id: 3, text: '科目三'},
  81. ],
  82. showDate: false,
  83. showDatePicker: false,
  84. params: {
  85. pageNo: 1,
  86. pageSize: 20,
  87. coachId: 0,
  88. writtenoffStatus: 0,
  89. subject: 0,
  90. studentName: '',
  91. studentPhone: ''
  92. },
  93. screen: {
  94. trainType: '',
  95. screenDate: ''
  96. },
  97. list: [],
  98. status: 'loading',
  99. total: 20
  100. }
  101. },
  102. created() {
  103. this.params.coachId = this.vuex_userInfo.user.coachId
  104. // this.params.deptId = this.vuex_userInfo.user.deptId
  105. // this.examSimulationPagesFn()
  106. this.initList()
  107. },
  108. methods: {
  109. async examSimulationPagesFn() {
  110. let obj = Object.assign({},this.params)
  111. if(obj.subject==0) delete obj.subject
  112. const {data: res} = await examSimulationPages(obj)
  113. this.params.pageNo ++
  114. this.total = res.total
  115. this.list.push(...res.list)
  116. if(this.list.length>=this.total) this.status = 'nomore'
  117. console.log(res)
  118. },
  119. initList() {
  120. this.status = 'loading'
  121. this.list = []
  122. this.params.pageNo = 1
  123. this.examSimulationPagesFn()
  124. },
  125. changeTab(num) {
  126. if(this.params.writtenoffStatus == num) return
  127. this.params.writtenoffStatus = num
  128. this.initList()
  129. },
  130. changeNav(item) {
  131. if(this.params.subject == item.id) return
  132. this.params.subject = item.id
  133. this.initList()
  134. },
  135. goPage() {
  136. this.$goPage('/pages/recordEntry/examine/examineRecord/detail/detail')
  137. },
  138. confirmDatePicker(val) {
  139. this.screen.screenDate = this.$u.timeFormat(val.value, 'yyyy-mm-dd')
  140. this.showDatePicker = false
  141. },
  142. // 选择筛选日期
  143. selectDateClick(val) {
  144. console.log(val)
  145. this.showDate = false
  146. },
  147. screenCarFn(trainType) {
  148. this.screen.trainType = trainType
  149. },
  150. resetScreen() {
  151. this.screen.trainType = ''
  152. this.screen.screenDate = ''
  153. },
  154. // 筛选搜索
  155. screenSearch() {
  156. this.params.trainType = this.screen.trainType
  157. if(!this.screen.screenDate) {
  158. this.params.beginTime = ''
  159. this.params.endTime = ''
  160. }else {
  161. this.params.beginTime = this.screen.screenDate + ' 00:00:00'
  162. this.params.endTime = this.screen.screenDate + ' 23:59:59'
  163. }
  164. this.showDate = false
  165. this.initList()
  166. },
  167. searchFn(val) {
  168. if(uni.$u.test.mobile(val)) {
  169. this.params.studentPhone = val
  170. this.params.studentName = ''
  171. }else {
  172. this.params.studentName = val
  173. this.params.studentPhone = ''
  174. }
  175. this.initList()
  176. }
  177. }
  178. }
  179. </script>
  180. <style lang="scss" scoped>
  181. .popupBox {
  182. padding-bottom: 30rpx;
  183. .btn_row {
  184. padding-top: 20rpx;
  185. display: flex;
  186. justify-content: space-between;
  187. .btn {
  188. width: 48%;
  189. }
  190. }
  191. .car {
  192. margin-bottom: 20rpx;
  193. .h1 {
  194. line-height: 100rpx;
  195. }
  196. .car_row {
  197. display: flex;
  198. &.border {
  199. width: 300rpx;
  200. line-height: 70rpx;
  201. border: 1rpx solid #d8d8d8;
  202. border-radius: 10rpx;
  203. padding: 0 16rpx;
  204. justify-content: space-between;
  205. }
  206. .carItem {
  207. width: 130rpx;
  208. background: #f3f3f3;
  209. border-radius: 8rpx;
  210. text-align: center;
  211. line-height: 60rpx;
  212. color: #333;
  213. margin-right: 58rpx;
  214. &.active {
  215. background: $themC;
  216. color: #fff;
  217. }
  218. }
  219. }
  220. }
  221. }
  222. .main {
  223. width: 100%;
  224. min-height: 100vh;
  225. background: #f3f3f3;
  226. .blueBg {
  227. background: #1989FA;
  228. padding: 140rpx 0 20rpx 0;
  229. }
  230. .total_row {
  231. display: flex;
  232. justify-content: space-between;
  233. height: 82rpx;
  234. align-items: center;
  235. .total {
  236. font-size: 24rpx;
  237. color: #686B73;
  238. text-align: right;
  239. line-height: 82rpx;
  240. }
  241. .screen {
  242. display: flex;align-items: center;
  243. color: $themC;
  244. margin-left: 8rpx;
  245. font-size: 28rpx;
  246. .icon {
  247. width: 24rpx;
  248. height: 24rpx;
  249. }
  250. }
  251. }
  252. .card {
  253. padding: 0 20rpx;
  254. }
  255. }
  256. .searchBox {
  257. padding: 24rpx 0 20rpx 0;
  258. }
  259. .tabs {
  260. display: flex;
  261. width: 100%;
  262. height: 72rpx;
  263. background: #FFFFFF;
  264. border-radius: 16rpx;
  265. .tab {
  266. flex: 1;
  267. text-align: center;
  268. line-height: 72rpx;
  269. color: #ADADAD;
  270. font-size: 28rpx;
  271. &.active {
  272. background: rgba(25,137,250,0.1);
  273. border-radius: 16rpx;
  274. border: 2rpx solid #1989FA;
  275. color: $themC;
  276. font-weight: 600;
  277. }
  278. }
  279. }
  280. .navs {
  281. display: flex;
  282. justify-content: space-between;
  283. color: #fff;
  284. font-size: 28rpx;
  285. padding: 0rpx 108rpx 0rpx 130rpx;
  286. color: $themC;
  287. background: #fff;
  288. height: 100rpx;
  289. .nav {
  290. line-height: 100rpx;
  291. &.active {
  292. font-weight: 500;
  293. position: relative;
  294. &::before {
  295. position: absolute;
  296. left: 50%;
  297. transform: translateX(-50%);
  298. bottom: 20rpx;
  299. content: '';
  300. width: 56rpx;
  301. height: 6rpx;
  302. background: $themC;
  303. border-radius: 3rpx;
  304. }
  305. }
  306. }
  307. }
  308. </style>