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.

165 lines
4.0 KiB

8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
  1. <template>
  2. <view class="box">
  3. <view class="item">
  4. <view class="lab">我的场地</view>
  5. <view class="val" style="display: flex;" @click="showSite=true">
  6. <mySelect :value="form.siteName" placeholder="请选择您的场地"/>
  7. <u-icon name="arrow-down" :size="12" :color="'#ADADAD'" style="margin-left: 12rpx;"></u-icon>
  8. </view>
  9. </view>
  10. <view class="item">
  11. <view class="lab">科目类型</view>
  12. <view class="val">
  13. <myRadio :radioData="radioData1" :value="form.subject" @changeRadio="(val)=>{form.subject=val}"/>
  14. </view>
  15. </view>
  16. <view class="item">
  17. <view class="lab">我的教练车</view>
  18. <view class="val">
  19. <myRadio :radioData="radioData2" :value="form.carNumber" @changeRadio="(val)=>{form.carNumber=val}"/>
  20. </view>
  21. </view>
  22. <view class="item">
  23. <view class="lab">可约人数</view>
  24. <view class="val">
  25. <myRadio :radioData="radioData3" :value="form.appointmentSumCount" @changeRadio="(val)=>{form.appointmentSumCount=val}"/>
  26. </view>
  27. </view>
  28. <!-- <view class="item">
  29. <view class="lab">开放范围</view>
  30. <view class="val">
  31. <myRadio :radioData="radioData4" :value="form.openRange" @changeRadio="(val)=>{form.openRange=val}"/>
  32. </view>
  33. </view> -->
  34. <view class="btn_row">
  35. <view class="btnBorder btn" @click="confirmPopup(0)">取消</view>
  36. <view class="btnBg btn" @click="confirmPopup(1)">确认</view>
  37. </view>
  38. <u-picker :show="showSite" :columns="siteColumns" keyName="name" @confirm="changeSite" @cancel="showSite=false" ></u-picker>
  39. </view>
  40. </template>
  41. <script>
  42. import { trainingSiteList, carPage } from '@/config/api.js'
  43. export default {
  44. data() {
  45. return {
  46. showSite: false,
  47. siteColumns: [],
  48. // scheduleClassCreateByTime
  49. radioData1: [
  50. {name: '不限', id: 0},
  51. {name: '科目二', id: 2},
  52. {name: '科目三', id: 3},
  53. ],
  54. // 0:不限;2:科目二;3:科目三
  55. radioData2: [],
  56. radioData3: [
  57. {name: '1人', id: 1},
  58. {name: '2人', id: 2},
  59. {name: '3人', id: 3},
  60. {name: '4人', id: 4},
  61. ],
  62. radioData4: [
  63. {name: '我的学员', id: 0},
  64. {name: '本校学员', id: 1}
  65. ],//开放范围:0:自己的学员;1:绑定的驾校的学员
  66. form: {
  67. siteName: '',
  68. openRange: 0,
  69. appointmentSumCount: 1,
  70. carNumber: '',
  71. subject: 0
  72. }
  73. }
  74. },
  75. created() {
  76. this.trainingSiteListFn()
  77. this.carPageFn()
  78. },
  79. methods: {
  80. confirmPopup(val) {
  81. if(val==1&&!this.form.siteName) return this.$u.toast('请选择场地')
  82. if(val==1&&!this.form.carNumber) return this.$u.toast('请选择教练车')
  83. this.$emit('confirmClass', val, this.form)
  84. },
  85. // 教练车
  86. async carPageFn() {
  87. let obj = {
  88. pageNo: 1,
  89. pageSize: 40,
  90. schoolId: this.vuex_schoolId,
  91. coachId: this.vuex_coachId
  92. }
  93. const {data: res} = await carPage(obj)
  94. console.log(res.list)
  95. this.radioData2 = res.list.map(item=>{
  96. let obj = {
  97. name: item.licnum,
  98. id: item.licnum
  99. }
  100. return obj
  101. })
  102. console.log(this.radioData2)
  103. // this.carColumns = [res.list]
  104. },
  105. // 选择训练场地
  106. changeSite(val) {
  107. let item = val.value[0]
  108. this.form.address = item.address
  109. this.form.seq = item.seq
  110. this.form.area = item.area
  111. this.form.siteName = item.name
  112. this.form.siteId = item.id
  113. this.showSite = false
  114. },
  115. // 获取训练场地
  116. async trainingSiteListFn() {
  117. let obj = {
  118. pageNo: 1,
  119. pageSize: 100,
  120. schoolId: this.vuex_userInfo.schoolId
  121. }
  122. const {data: res} = await trainingSiteList(obj)
  123. this.siteColumns = [ res ]
  124. console.log(res)
  125. },
  126. changeRadio(e,val) {
  127. console.log(e)
  128. console.log(val)
  129. }
  130. }
  131. }
  132. </script>
  133. <style lang="scss" scoped>
  134. .box {
  135. padding: 28rpx;
  136. width: 638rpx;
  137. .item {
  138. .lab {
  139. font-size: 30rpx;
  140. margin-bottom: 38rpx;
  141. }
  142. .val {
  143. margin-bottom: 56rpx;
  144. }
  145. }
  146. .btn_row {
  147. display: flex;
  148. justify-content: space-between;
  149. padding: 0 30rpx;
  150. .btnBorder {
  151. }
  152. .btn {width: 47%;}
  153. .btnBg {
  154. }
  155. }
  156. }
  157. </style>