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.

318 lines
8.1 KiB

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