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.

302 lines
7.7 KiB

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