list.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <template>
  2. <view class="container">
  3. <!-- 可滚动日期选择 -->
  4. <view class="date-section">
  5. <view class="title">选择日期</view>
  6. <scroll-view class="date-scroll" scroll-x>
  7. <view class="date-container">
  8. <view v-for="(date, index) in dates" :key="index" class="date-item" :class="{ selected: selectedModule === index }" @click="selectModule(index)">
  9. <text class="date-num" :class="{ selected: selectedModule === index }">{{ date.text }}</text>
  10. <text class="date-text" :class="{ selected: selectedModule === index }">{{ date.num }}</text>
  11. </view>
  12. </view>
  13. </scroll-view>
  14. </view>
  15. <!-- 班车列表 -->
  16. <view class="bus-section">
  17. <view class="title">选择班车</view>
  18. <view class="bus-list">
  19. <view v-for="(bus, index) in buses" :key="index" class="bus-item">
  20. <view class="time-row">
  21. <view>
  22. <text class="time">{{ bus.time }}</text>
  23. <text class="duration">{{ bus.duration }}</text>
  24. </view>
  25. <view style="color: #f56c6c;font-size: 24rpx;">¥<text
  26. style="font-size: 38rpx; font-weight: bold;">{{ bus.points }}</text>起</view>
  27. </view>
  28. <view class="station-row">
  29. <text class="station">{{ bus.startStation }}</text>
  30. <view class="arrow-box">
  31. <text class="arrow">→</text>
  32. </view>
  33. <text class="station">{{ bus.endStation }}</text>
  34. </view>
  35. <view class="action-row" style="padding-top: 20rpx;">
  36. <view>
  37. <text class="status">{{ bus.status }}</text>
  38. <text class="remaining">{{ bus.remaining }}</text>
  39. </view>
  40. <view>
  41. <button type="primary" style="background: #fe6b01;" size="mini" class="feedback-submit"
  42. @click="goNav('/my/classes/detailsList', bus)">订票</button>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <!-- 底部操作栏 -->
  49. <view class="action-bar">
  50. <text class="action-item">上下站</text>
  51. <text class="action-item">人数车型</text>
  52. <text class="action-item">时间段</text>
  53. <text class="action-item">候补车</text>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. export default {
  59. data() {
  60. return {
  61. selectedModule: 0,
  62. dates: [{
  63. num: '今天',
  64. text: '13'
  65. },
  66. {
  67. num: '明天',
  68. text: '14'
  69. },
  70. {
  71. num: '后天',
  72. text: '15'
  73. },
  74. {
  75. num: '周三',
  76. text: '1'
  77. },
  78. {
  79. num: '周四',
  80. text: '2'
  81. },
  82. {
  83. num: '周五',
  84. text: '3'
  85. },
  86. {
  87. num: '周六',
  88. text: '4'
  89. }
  90. ],
  91. buses: [{
  92. time: '08:30',
  93. duration: '预计3小时52分',
  94. startStation: '合肥南站',
  95. points: '128',
  96. endStation: '上海虹桥',
  97. status: '暂停本吧',
  98. remaining: '剩余12条'
  99. },
  100. {
  101. time: '09:45',
  102. duration: '预计4小时15分',
  103. startStation: '南京南站',
  104. points: '96',
  105. endStation: '杭州东站',
  106. status: '正常发车',
  107. remaining: '剩余5条'
  108. },
  109. {
  110. time: '10:20',
  111. duration: '预计2小时30分',
  112. startStation: '北京西站',
  113. points: '156',
  114. endStation: '天津站',
  115. status: '即将满员',
  116. remaining: '剩余3条'
  117. },
  118. // 可继续添加更多数据...
  119. ]
  120. }
  121. },
  122. methods: {
  123. selectModule(module) {
  124. this.selectedModule = module;
  125. },
  126. goNav(url, busData) { // 添加busData参数
  127. // 保存数据到本地临时存储
  128. uni.setStorageSync('selectedBus', busData)
  129. // 原有登录验证逻辑
  130. let token = this.$queue.getData("token");
  131. if (token) {
  132. uni.navigateTo({
  133. url: url,
  134. success: function(res) {
  135. // 通过eventChannel发送数据
  136. res.eventChannel.emit('acceptBusData', { data: busData })
  137. }
  138. })
  139. } else {
  140. this.bindlogin();
  141. }
  142. },
  143. }
  144. }
  145. </script>
  146. <style scoped>
  147. .container {
  148. padding: 0 30rpx;
  149. /* background: #fff; */
  150. }
  151. .selected {
  152. background: #fe6b01 !important;
  153. color: #fff !important;
  154. }
  155. .title {
  156. font-size: 33rpx;
  157. font-family: PingFang SC;
  158. color: #333333;
  159. }
  160. /* 状态栏 */
  161. .status-bar {
  162. font-size: 34rpx;
  163. color: #000;
  164. text-align: center;
  165. padding: 20rpx 0;
  166. border-bottom: 1rpx solid #eee;
  167. }
  168. /* 主标题 */
  169. .page-title {
  170. font-size: 36rpx;
  171. font-weight: bold;
  172. color: #333;
  173. padding: 30rpx 0;
  174. border-bottom: 1rpx solid #eee;
  175. }
  176. /* 日期选择 */
  177. .date-section {
  178. padding: 30rpx 0;
  179. }
  180. .date-scroll {
  181. width: 100%;
  182. white-space: nowrap;
  183. margin: 20rpx 0;
  184. }
  185. .date-container {
  186. display: inline-flex;
  187. gap: 30rpx;
  188. }
  189. .date-item {
  190. display: flex;
  191. flex-direction: column;
  192. align-items: center;
  193. width: 130rpx;
  194. height: 130rpx;
  195. background: #fee8d9;
  196. padding: 30rpx;
  197. border-radius: 12rpx;
  198. }
  199. .date-num {
  200. font-size: 34rpx;
  201. color: #333;
  202. font-weight: bold;
  203. }
  204. .date-text {
  205. font-size: 24rpx;
  206. color: #666;
  207. margin-top: 8rpx;
  208. }
  209. /* 班车列表 */
  210. .bus-item {
  211. padding: 30rpx;
  212. margin: 20rpx 0;
  213. background: #fff;
  214. border-radius: 16rpx;
  215. }
  216. .time-row {
  217. display: flex;
  218. align-items: baseline;
  219. margin-bottom: 20rpx;
  220. justify-content: space-between;
  221. }
  222. .time {
  223. font-size: 44rpx;
  224. color: #333;
  225. margin-right: 30rpx;
  226. }
  227. .duration {
  228. font-size: 24rpx;
  229. color: #999999;
  230. }
  231. .station-row {
  232. display: flex;
  233. align-items: center;
  234. margin-bottom: 25rpx;
  235. justify-content: space-between;
  236. }
  237. .station {
  238. font-size: 30rpx;
  239. color: #333;
  240. }
  241. .arrow-box {
  242. margin: 0 20rpx;
  243. display: flex;
  244. flex-direction: column;
  245. align-items: center;
  246. }
  247. .arrow {
  248. font-size: 40rpx;
  249. color: #fe6b01;
  250. }
  251. .points {
  252. font-size: 24rpx;
  253. color: #999;
  254. }
  255. .action-row {
  256. display: flex;
  257. justify-content: space-between;
  258. align-content: center;
  259. }
  260. .status {
  261. font-size: 28rpx;
  262. color: #fe6b01;
  263. padding: 10rpx 20rpx;
  264. border: 1px #fe6b01 solid;
  265. border-radius: 8rpx;
  266. background: #fee8d9;
  267. margin-right: 20rpx;
  268. }
  269. .remaining {
  270. font-size: 28rpx;
  271. color: #00c18a;
  272. padding: 10rpx 20rpx;
  273. border: 1px #00c18a solid;
  274. border-radius: 8rpx;
  275. background: #e8fbf6;
  276. }
  277. /* 底部操作栏 */
  278. .action-bar {
  279. position: fixed;
  280. bottom: 0;
  281. left: 0;
  282. right: 0;
  283. height: 100rpx;
  284. background: #fff;
  285. display: flex;
  286. justify-content: space-around;
  287. align-items: center;
  288. border-top: 1rpx solid #eee;
  289. margin: 0 30rpx;
  290. border-radius: 14rpx;
  291. }
  292. .action-item {
  293. font-size: 28rpx;
  294. color: #666;
  295. }
  296. </style>