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.

317 lines
8.0 KiB

8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
  1. <template>
  2. <view class="pageBg">
  3. <view class="pageBgImg pad">
  4. <view class="status_bar"></view>
  5. <view class="" style="height: 44rpx;"></view>
  6. <view class="searchBox">
  7. <searchRow placeholder="搜索学员姓名、学员手机号" @searchFn="searchFn"></searchRow>
  8. </view>
  9. <view class="card">
  10. <view class="myClass">
  11. <view class="leftTxt">我的排课</view>
  12. <view class="leftBtn" @click="$goPage('/pages/recordEntry/operate/mySchedule/mySchedule')">去管理</view>
  13. </view>
  14. </view>
  15. </view>
  16. <div class="pad">
  17. <view class="tabs">
  18. <view class="tab" v-for="(item,index) in tabArr" :key="index" :class="{active: params.status==item.id}"
  19. @click="changeTab(item)">{{ item.text }}</view>
  20. </view>
  21. <view class="screen_row">
  22. <view class="selectItem" @click="showSubject=true">
  23. <view class="text oneRowText">{{screen.subject}}</view>
  24. <view class="downIcon">
  25. <u-icon name="arrow-down"></u-icon>
  26. </view>
  27. </view>
  28. <view class="selectItem" @click="showCar=true">
  29. <view class="text oneRowText">{{screen.car}}</view>
  30. <view class="downIcon">
  31. <u-icon name="arrow-down"></u-icon>
  32. </view>
  33. </view>
  34. <view class="selectItem" @click="showDatePicker=true">
  35. <view class="text">{{screen.timer}}</view>
  36. <view class="downIcon">
  37. <u-icon name="arrow-down"></u-icon>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="list" v-if="list.length">
  42. <view class="card" v-for="(item,index) in list" :key="index">
  43. <appointItem-operate @click.native="$goPage('/pages/recordEntry/operate/detail/detail?id='+item.id)" :item="item"/>
  44. </view>
  45. </view>
  46. <!-- <nodata v-if="!list.length"></nodata> -->
  47. <view v-if="list.length">
  48. <u-loadmore :status="status" />
  49. </view>
  50. <nodata v-if="!list.length&&status=='nomore'"></nodata>
  51. <UserTab name ='实操训练'></UserTab>
  52. </div>
  53. <u-calendar :show="showDatePicker" ref="calendar" @confirm="confirmDatePicker" @close="cancelDate" :minDate="minDate" :maxDate="maxDate"></u-calendar>
  54. <u-picker :show="showCar" :columns="carColumns" keyName="licnum" @confirm="confirmCar" @cancel="showCar=false" :closeOnClickOverlay="true" @close="showCar=false"></u-picker>
  55. <u-picker :show="showSubject" :columns="subjectTxt" keyName="lab" @confirm="confirmSubject" @cancel="showSubject=false" :closeOnClickOverlay="true" @close="showSubject=false"></u-picker>
  56. </view>
  57. </template>
  58. <script>
  59. import { bookingMasterPage, carPage} from '@/config/api.js'
  60. export default {
  61. data() {
  62. return {
  63. tabArr: [{
  64. text: '未签到',
  65. id: 0
  66. },
  67. {
  68. text: '已签到',
  69. id: 1
  70. },
  71. {
  72. text: '已签退',
  73. id: 2
  74. },
  75. ],//状态:0:未签到,1:已签到,2:已签退,3:已过期,9:已取消,示例值(2)
  76. currentTab: 1,
  77. screen: {
  78. subject: '训练科目',
  79. car: '预约车辆',
  80. timer: '预约时间'
  81. },
  82. status: 'loading',
  83. subjectTxt: [
  84. [
  85. {lab: '不限', id: 0},
  86. {lab: '科目二', id: 2},
  87. {lab: '科目三', id: 3},
  88. ]
  89. ],
  90. // :0:不限;2:科目二;3:科目三
  91. showDatePicker: false,
  92. showCar: false,
  93. showSubject: false,
  94. carColumns: [],
  95. params: {
  96. pageNo: 1,
  97. pageSize: 20,
  98. status: 0,
  99. carNumber: '',
  100. bookingTime: []
  101. },
  102. list: [],
  103. minDate: 0,
  104. maxDate: 0,
  105. }
  106. },
  107. onLoad() {
  108. console.log('我的页面')
  109. this.params.coachId = this.vuex_coachId
  110. this.carPageFn()
  111. // this.bookingMasterPageFn()
  112. let nowTime = new Date()*1
  113. // 一个月的时间戳
  114. const oneMonthMilliseconds = 30 * 24 * 60 * 60 * 1000;
  115. this.minDate = parseInt( nowTime - oneMonthMilliseconds )
  116. this.maxDate = parseInt( nowTime + oneMonthMilliseconds )
  117. },
  118. onShow() {
  119. uni.hideTabBar();
  120. this.initList()
  121. },
  122. onPullDownRefresh() {
  123. this.initList()
  124. },
  125. onReachBottom() {
  126. if(this.list<this.total) {
  127. this.initList()
  128. }
  129. },
  130. methods: {
  131. searchFn(val) {
  132. // isPhone = this. uni.$u.test.mobile(this.FormData.phone)
  133. if(/^\d+$/.test(val)) {
  134. // 电话搜索
  135. if( !this.$u.test.mobile(val)) return this.$u.toast('请输入正确的电话号码')
  136. this.params.studentName = ''
  137. this.params.studentPhone = val
  138. }else {
  139. // 学员姓名搜索
  140. this.params.studentPhone = ''
  141. this.params.studentName = val
  142. }
  143. this.status = 'loading'
  144. this.list = []
  145. this.params.pageNo = 1
  146. this.bookingMasterPageFn()
  147. },
  148. cancelDate() {
  149. this.showDatePicker=false
  150. this.params.bookingStartTime = ''
  151. this.params.bookingEndTime = ''
  152. this.screen.timer = '预约时间'
  153. this.initList()
  154. },
  155. async initList() {
  156. this.status = 'loading'
  157. this.list = []
  158. this.params.pageNo = 1
  159. this.params.studentName = ''
  160. this.params.studentPhone = ''
  161. this.bookingMasterPageFn()
  162. },
  163. async bookingMasterPageFn() {
  164. console.log(this.params)
  165. let obj = Object.assign({},this.params)
  166. console.log(obj.carNumber)
  167. if(obj.carNumber=='不限') delete obj.carNumber
  168. const {data: res } = await bookingMasterPage(obj)
  169. // uni.$u.http.get('/api/admin-api/business/booking/master/page', this.params ).then(res => {
  170. // console.log(res)
  171. // }).catch(err => {
  172. // })
  173. this.params.pageNo ++
  174. this.list.push(...res.list)
  175. this.total = res.total
  176. if(this.list.length>=this.total) this.status = 'nomore'
  177. console.log(res)
  178. },
  179. changeTab(item) {
  180. if(item.id==this.params.status) return
  181. this.params.status = item.id
  182. this.initList()
  183. },
  184. confirmDatePicker(val) {
  185. this.showDatePicker = false
  186. this.screen.timer = val[0]
  187. this.params.bookingStartTime = this.screen.timer+ ' 00:00:00'
  188. this.params.bookingEndTime = this.screen.timer+ ' 23:59:59'
  189. // this.params.bookingTime = [startTimer, bookingEndTimer]
  190. this.initList()
  191. },
  192. confirmCar(val) {
  193. let item = val.value[0]
  194. this.screen.car = item.licnum
  195. this.params.carNumber = item.licnum
  196. this.showCar = false
  197. this.initList()
  198. },
  199. confirmSubject(val) {
  200. let item = val.value[0]
  201. this.screen.subject = item.lab
  202. this.params.subject = item.id
  203. this.initList()
  204. this.showSubject = false
  205. },
  206. async carPageFn() {
  207. let obj = {
  208. pageNo: 1,
  209. pageSize: 40,
  210. schoolId: this.vuex_schoolId,
  211. coachId: this.vuex_coachId
  212. }
  213. const {data: res} = await carPage(obj)
  214. res.list.unshift({licnum: '不限', id: 0})
  215. this.carColumns = [res.list]
  216. },
  217. }
  218. }
  219. </script>
  220. <style lang="scss" scoped>
  221. .pageBg {
  222. padding-bottom: 100rpx;
  223. .pageBgImg {
  224. height: 100%;
  225. padding-bottom: 30rpx;
  226. }
  227. .searchBox {
  228. padding: 24rpx 0;
  229. }
  230. .card {
  231. padding: 0 28rpx;
  232. margin-bottom: 20rpx;
  233. .myClass {
  234. height: 108rpx;
  235. display: flex;
  236. justify-content: space-between;
  237. padding: 0 10rpx;
  238. align-items: center;
  239. .leftTxt {
  240. font-size: 32rpx;
  241. font-weight: 500;
  242. }
  243. .leftBtn {
  244. width: 192rpx;
  245. height: 60rpx;
  246. background: $themC; border-radius: 8rpx;
  247. line-height: 60rpx;
  248. text-align: center;
  249. font-weight: 500;
  250. color: #FFFFFF;
  251. }
  252. }
  253. }
  254. .tabs {
  255. height: 72rpx;
  256. background: #FFFFFF;
  257. border-radius: 16rpx;
  258. display: flex;
  259. line-height: 72rpx;
  260. text-align: center;
  261. color: #ADADAD;
  262. margin: -24rpx 0 24rpx 0;
  263. .tab {
  264. flex: 1;
  265. text-align: center;
  266. &.active {
  267. background: rgba(25, 137, 250, 0.1);
  268. border: 2rpx solid #1989FA;
  269. color: $themC;
  270. border-radius: 16rpx;
  271. }
  272. }
  273. }
  274. .screen_row {
  275. display: flex;
  276. margin-bottom: 24rpx;
  277. width: 100%;
  278. justify-content: space-between;
  279. .selectItem {
  280. display: flex;
  281. padding: 0 18rpx;
  282. border: 2rpx solid rgba(25,137,250,0.3);
  283. height: 60rpx;
  284. border-radius: 16rpx;
  285. background-color: #FFFFFF;
  286. line-height: 60rpx;
  287. align-items: center;
  288. width: 29%;
  289. .text {
  290. color: $themC;
  291. flex: 1;
  292. white-space: nowrap;
  293. text-align: center;
  294. }
  295. .downIcon {
  296. width: 24rpx;
  297. }
  298. }
  299. }
  300. .list {
  301. .card {
  302. appointitem-operate {}
  303. }
  304. }
  305. }
  306. </style>