order.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <template>
  2. <view class="safeArea">
  3. <view class="appointment">
  4. <view class="appointmentItem">
  5. <view class="title">考试地点:</view>
  6. <view class="place" @click="showAddress">
  7. <view class="name">{{addressName}}</view>
  8. <view><u-icon name="arrow-right" color="#999999" size="28"></u-icon></view>
  9. </view>
  10. </view>
  11. <view class="appointmentItem">
  12. <view class="title">考试时间:</view>
  13. <view class="main">
  14. <view v-for="(item,index) in list" class="item" :key="index" @click="choItem(index)">
  15. <view class="checkbox"><u-checkbox v-if="item.status===1" v-model="item.checked" shape="circle"></u-checkbox></view>
  16. <view class="box">
  17. <view :class="['time',{'active':item.checked},{'no':item.status!==1}]">{{item.time}}</view>
  18. <view class="statusInfo" v-if="item.status !==1">
  19. <template v-if="item.status===2">预约名额已满</template>
  20. <template v-if="item.status===3">此时段您已经有其他考试预约</template>
  21. </view>
  22. </view>
  23. <view class="num">已报:{{item.appoint}}/{{item.total}}</view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="btnMain">
  28. <view class="return">上一步</view>
  29. <view class="sure" @click="sureOppoint">确定预约</view>
  30. </view>
  31. </view>
  32. <!-- 弹框-->
  33. <u-popup v-model="address_show" mode="bottom" class="addModel">
  34. <view class="tipBox safeArea">
  35. <view class="line"></view>
  36. <view class="title">温馨提示</view>
  37. <u-line color="#EEEEEE" />
  38. <scroll-view class="addressList" :scroll-y="true">
  39. <view class="item" v-for="(item,index) in addressList" :key="index" @click="choAddress(index)">
  40. <u-checkbox class="checkbox" v-model="item.checked" shape="circle"></u-checkbox>
  41. <view :class="['address',{'active': item.checked}]">{{item.address}}</view>
  42. </view>
  43. </scroll-view>
  44. <u-line color="#EEEEEE" />
  45. <view class="btn" @click="sureAddress">确认</view>
  46. </view>
  47. </u-popup>
  48. </view>
  49. </template>
  50. <script>
  51. import { mapGetters } from 'vuex';
  52. export default {
  53. data() {
  54. return {
  55. address_show: false,
  56. addressName: '广州市天可区燕岭路建设大厦3楼',
  57. addressList:[{checked:true,address: '广州市天可区燕岭路建设大厦3楼'},{checked:false,address: '广州市海珠区广州塔3楼'},{checked:false,address: '深圳市企鹅大厦附近的写字楼'}],
  58. list: [{
  59. time: '2021/10/23 10:00 ~ 11:00',
  60. total: 100,
  61. appoint: 100,
  62. checked: true,
  63. status: 1, // 1:可报 2:预约名额已满 3:此时段您已经有其他考试预约
  64. },
  65. {
  66. time: '2021/10/23 10:00 ~ 11:00',
  67. total: 100,
  68. appoint: 20,
  69. status: 2,
  70. },
  71. {
  72. time: '2021/10/23 10:00 ~ 11:00',
  73. total: 100,
  74. appoint: 20,
  75. status: 3
  76. },
  77. {
  78. time: '2021/10/23 10:00 ~ 11:00',
  79. total: 100,
  80. appoint: 20,
  81. status: 1
  82. }
  83. ]
  84. };
  85. },
  86. onLoad(option) {},
  87. methods: {
  88. showAddress(){
  89. this.address_show = true
  90. },
  91. choAddress(index){
  92. this.addressList.forEach((item,idx)=>{
  93. item.checked = false
  94. this.$set(item, 'checked',false)
  95. if(idx === index){
  96. this.$set(item, 'checked',true)
  97. }
  98. })
  99. console.log(this.addressList)
  100. },
  101. sureAddress(){
  102. const index = this.addressList.findIndex(item => item.checked)
  103. this.addressName = this.addressList[index].address
  104. this.address_show = false
  105. },
  106. choItem(index){
  107. const item = this.list[index]
  108. if(item.status!==1){
  109. return
  110. }
  111. this.list.forEach((item,idx)=>{
  112. item.checked = false
  113. if(idx === index){
  114. item.checked = true
  115. }
  116. })
  117. },
  118. sureOppoint(){
  119. this.$navTo.togo('/pages2/order/confirm_list');
  120. }
  121. },
  122. };
  123. </script>
  124. <style >
  125. page{
  126. background-color: #EAEEF1;
  127. }
  128. .addModel .u-drawer-bottom{
  129. box-shadow: 0px 0px 16px 4px rgba(145, 156, 178, 0.1);
  130. border-radius: 32rpx 32rpx 0px 0px;
  131. }
  132. </style>
  133. <style scoped lang="scss">
  134. .appointment{
  135. padding:0 8rpx;
  136. .appointmentItem{
  137. margin: 24rpx 0 40rpx;
  138. .title{
  139. font-size: 30rpx;
  140. font-family: PingFang SC;
  141. font-weight: 500;
  142. color: #333333;
  143. line-height: 1;
  144. margin-bottom: 16rpx;
  145. padding-left: 24rpx;
  146. }
  147. .place{
  148. height: 80rpx;
  149. background: #FFFFFF;
  150. border-radius: 16rpx;
  151. display: flex;
  152. justify-content: space-between;
  153. align-items: center;
  154. padding: 0 24rpx;
  155. }
  156. }
  157. .main{
  158. background: #FFFFFF;
  159. border-radius: 16rpx;
  160. padding: 32rpx 16rpx;
  161. .item{
  162. display: flex;
  163. align-items: center;
  164. margin-bottom: 16rpx;
  165. font-size: 28rpx;
  166. font-family: PingFang SC;
  167. font-weight: 500;
  168. color: #333333;
  169. .statusInfo{
  170. font-size: 24rpx;
  171. font-family: PingFang SC;
  172. font-weight: 500;
  173. color: #FF3B30;
  174. padding-left:24rpx;
  175. }
  176. .checkbox {
  177. width:32rpx;
  178. height:32rpx;
  179. display: flex;
  180. align-items: center;
  181. }
  182. .time{
  183. width: 430rpx;
  184. height: 80rpx;
  185. line-height: 80rpx;
  186. background: #F5F5F5;
  187. border: 2rpx solid #F5F5F5;
  188. border-radius: 16rpx;
  189. font-size: 30rpx;
  190. font-family: PingFang SC;
  191. font-weight: bold;
  192. text-align: center;
  193. color: #333333;
  194. margin: 0 18rpx 0 8rpx;
  195. &.active{
  196. background: #EBF5FF;
  197. border: 2px solid #007AFF;
  198. }
  199. &.no{
  200. background: #FFDDDB;
  201. border: 2px solid #FFDDDB;
  202. }
  203. }
  204. }
  205. }
  206. .btnMain{
  207. display: flex;
  208. justify-content: center;
  209. text-align: center;
  210. .return{
  211. width: 200rpx;
  212. height: 80rpx;
  213. line-height: 80rpx;
  214. background: #F5F5F5;
  215. border-radius: 40rpx;
  216. font-size: 30rpx;
  217. font-family: PingFang SC;
  218. font-weight: bold;
  219. color: #007AFF;
  220. }
  221. .sure{
  222. width: 438rpx;
  223. height: 80rpx;
  224. line-height: 80rpx;
  225. background: #007AFF;
  226. border-radius: 40rpx;
  227. font-size: 30rpx;
  228. font-family: PingFang SC;
  229. font-weight: bold;
  230. color: #FFFFFF;
  231. margin-left:24rpx;
  232. }
  233. }
  234. }
  235. .tipBox{
  236. width: 100%;
  237. font-family: PingFang SC;
  238. .line{
  239. width: 80rpx;
  240. height: 8rpx;
  241. background: #999999;
  242. border-radius: 4rpx;
  243. margin: 8rpx auto;
  244. }
  245. .title{
  246. text-align: center;
  247. font-size: 24rpx;
  248. font-family: PingFang SC;
  249. font-weight: 500;
  250. color: #999999;
  251. margin: 15rpx 0;
  252. }
  253. .main{
  254. font-size: 30rpx;
  255. font-weight: 500;
  256. color: #666666;
  257. line-height: 48rpx;
  258. margin-bottom: 40rpx;
  259. }
  260. .addressList{
  261. height: 500rpx;
  262. .item{
  263. display: flex;
  264. align-items: center;
  265. padding: 0 24rpx;
  266. margin-bottom: 24rpx;
  267. .checkbox{
  268. width:32rpx;
  269. height:32rpx;
  270. display: flex;
  271. align-items: center;
  272. margin-right: 8rpx;
  273. }
  274. .address{
  275. width: 654rpx;
  276. height: 80rpx;
  277. line-height: 80rpx;
  278. background: #F5F5F5;
  279. border-radius: 16rpx;
  280. font-size: 30rpx;
  281. font-family: PingFang SC;
  282. font-weight: bold;
  283. color: #333333;
  284. padding: 0 24rpx;
  285. &.active{
  286. background: #EBF5FF;
  287. border: 2rpx solid #007AFF;
  288. }
  289. }
  290. }
  291. }
  292. .btn{
  293. width: 200rpx;
  294. height: 64rpx;
  295. line-height: 64rpx;
  296. background: linear-gradient(0deg, #015EEA, #00C0FA);
  297. border-radius: 32rpx;
  298. margin: 17rpx auto;
  299. font-size: 30rpx;
  300. font-family: PingFang SC;
  301. font-weight: 500;
  302. text-align: center;
  303. color: #FFFFFF;
  304. }
  305. }
  306. </style>