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.

164 lines
4.0 KiB

7 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. this.$emit('confirmClass', val, this.form)
  83. },
  84. // 教练车
  85. async carPageFn() {
  86. let obj = {
  87. pageNo: 1,
  88. pageSize: 40,
  89. schoolId: this.vuex_schoolId,
  90. coachId: this.vuex_coachId
  91. }
  92. const {data: res} = await carPage(obj)
  93. console.log(res.list)
  94. this.radioData2 = res.list.map(item=>{
  95. let obj = {
  96. name: item.licnum,
  97. id: item.licnum
  98. }
  99. return obj
  100. })
  101. console.log(this.radioData2)
  102. // this.carColumns = [res.list]
  103. },
  104. // 选择训练场地
  105. changeSite(val) {
  106. let item = val.value[0]
  107. this.form.address = item.address
  108. this.form.seq = item.seq
  109. this.form.area = item.area
  110. this.form.siteName = item.name
  111. this.form.siteId = item.id
  112. this.showSite = false
  113. },
  114. // 获取训练场地
  115. async trainingSiteListFn() {
  116. let obj = {
  117. pageNo: 1,
  118. pageSize: 100,
  119. schoolId: this.vuex_userInfo.user.schoolId
  120. }
  121. const {data: res} = await trainingSiteList(obj)
  122. this.siteColumns = [ res ]
  123. console.log(res)
  124. },
  125. changeRadio(e,val) {
  126. console.log(e)
  127. console.log(val)
  128. }
  129. }
  130. }
  131. </script>
  132. <style lang="scss" scoped>
  133. .box {
  134. padding: 28rpx;
  135. width: 638rpx;
  136. .item {
  137. .lab {
  138. font-size: 30rpx;
  139. margin-bottom: 38rpx;
  140. }
  141. .val {
  142. margin-bottom: 56rpx;
  143. }
  144. }
  145. .btn_row {
  146. display: flex;
  147. justify-content: space-between;
  148. padding: 0 30rpx;
  149. .btnBorder {
  150. }
  151. .btn {width: 47%;}
  152. .btnBg {
  153. }
  154. }
  155. }
  156. </style>