detailsList.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <view class="container">
  3. <!-- 头部信息 -->
  4. <view class="margin-top padding" style="background: #FFFFFF;border-radius: 20upx;">
  5. <text class="section-title">行程信息</text>
  6. <view style="height: 80rpx; border-bottom: 1rpx #e4e7ed solid; line-height: 80rpx; display: flex;position: relative;">
  7. <view style="width: 10rpx; height: 10rpx; background: #00c18a; border-radius: 5rpx; position: absolute; top: 50%; margin-top: -5rpx;"></view>
  8. <view style="margin-left: 30rpx;">{{ busInfo.startStation }}</view>
  9. </view>
  10. <view style="height: 80rpx; border-bottom: 1rpx #e4e7ed solid; line-height: 80rpx; display: flex; position: relative;">
  11. <view style="width: 10rpx; height: 10rpx; background: #f56c6c; border-radius: 5rpx; position: absolute; top: 50%; margin-top: -5rpx;"></view>
  12. <view style="margin-left: 30rpx;">{{ busInfo.endStation }}</view>
  13. </view>
  14. <view class="route-info">
  15. <text class="sub-title">途径站点 (3个)</text>
  16. <view class="station-list">
  17. <view class="station-item" v-for="(station, index) in stations" :key="index">
  18. <text class="station-name">{{ station.name }}</text>
  19. <text class="station-time">{{ station.time }}</text>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. <!-- 乘车人信息 -->
  25. <view class="margin-top padding" style="background: #FFFFFF;border-radius: 20upx;">
  26. <view class="flex" style="justify-content: space-between;">
  27. <text class="section-title">乘车人</text>
  28. <text style="font-size: 24rpx;" @click="goNav('/my/classes/adddetailsList?type=add')">+ 新增乘车人</text>
  29. </view>
  30. <view v-if="selectdata.length > 0">
  31. <view class="flex align-center" style="padding: 15rpx 30rpx;" v-for="(item, index) in selectdata" :key="index">
  32. <!-- 显示头像 -->
  33. <view>
  34. <image v-if="globalImages" :src="globalImages + 'images/order/chengcheren.png'" style="width: 70rpx;height: 70rpx;" mode=""></image>
  35. </view>
  36. <!-- 显示姓名和身份证号 -->
  37. <view style="margin-left: 30rpx; line-height: 40rpx;">
  38. <view>{{ item.name }}</view>
  39. <view style="color: #999;">{{ item.idCard }}</view>
  40. </view>
  41. </view>
  42. </view>
  43. <view v-else style="width: 100%; display: flex; justify-content: center;margin: 30rpx;">
  44. <image v-if="globalImages" :src="globalImages + 'images/kong.png'" style="width: 230rpx;height: 180rpx;" mode=""></image>
  45. </view>
  46. <view class="section" style="margin-top: 20rpx;">
  47. <text class="section-title">联系人手机</text>
  48. <view class="phone">138****1234</view>
  49. </view>
  50. </view>
  51. <!-- 座位选择 -->
  52. <view class="margin-top padding" style="background: #FFFFFF;border-radius: 20upx; margin-top: 20rpx;">
  53. <text class="section-title">座位选择</text>
  54. <view class="seat-options">
  55. <view class="seat-item" :class="{active: seatType === 'single'}">
  56. <text>单座</text>
  57. </view>
  58. <view class="seat-item active">
  59. <text>多座</text>
  60. </view>
  61. <view class="seat-item" :class="{active: seatType === 'charter'}">
  62. <text>包车</text>
  63. </view>
  64. </view>
  65. <view class="section">
  66. <text class="section-title">司机位置</text>
  67. <view class="driver-grid">
  68. <view v-for="num in 11" :key="num" class="driver-seat" :class="{
  69. selected: selectedSeat === num,
  70. disabled: num > 6
  71. }">
  72. <text>{{ num }}</text>
  73. </view>
  74. </view>
  75. <view class="seat-status">
  76. <text>37 / 62 可选 已选 不可选</text>
  77. </view>
  78. </view>
  79. </view>
  80. <!-- 附加服务 -->
  81. <view class="margin-top padding" style="background: #FFFFFF;border-radius: 20upx;">
  82. <text class="section-title">附加服务</text>
  83. <view >
  84. <view>备注</view>
  85. <view style="color: #999;font-size: 24rpx;">如有特殊要求请说明</view>
  86. </view>
  87. <view class="service-item">
  88. <view class="">
  89. <view>携带宠物</view>
  90. <view style="color: #999;font-size: 24rpx;">需提前告知司机</view>
  91. </view>
  92. <view class="">
  93. 123123
  94. </view>
  95. </view>
  96. <view class="service-item">
  97. <view class="">
  98. <view>使用优惠券</view>
  99. </view>
  100. <view style="color: #999;font-size: 24rpx;">
  101. 选择优惠券<text class="arrow" style="margin-left: 10rpx;">></text>
  102. </view>
  103. </view>
  104. </view>
  105. <!-- 底部操作栏 -->
  106. <view class="footer">
  107. <button class="submit-btn">提交订单</button>
  108. </view>
  109. </view>
  110. </template>
  111. <script>
  112. import { waitForGlobalImages } from '@/utils/globalImageLoader'
  113. export default {
  114. data() {
  115. return {
  116. busInfo: {}, // 存储接收到的班车数据
  117. stations: [{
  118. name: '合肥南站',
  119. time: '08:30'
  120. },
  121. {
  122. name: '嘉兴南站',
  123. time: '09:05'
  124. },
  125. {
  126. name: '上海虹桥',
  127. time: '09:35'
  128. }
  129. ],
  130. seatType: 'multiple',
  131. selectedSeat: 2,
  132. globalImages: '',
  133. selectdata: [],
  134. }
  135. },
  136. onLoad(options) {
  137. waitForGlobalImages().then((path) => {
  138. console.log('✅ 全局图片路径:', path)
  139. this.globalImages = path
  140. })
  141. // 方式1:通过本地存储获取
  142. const busData = uni.getStorageSync('selectedBus')
  143. this.busInfo = busData
  144. console.log('本地存储数据:', busData, this.busInfo)
  145. this.fetchPassengerList(); // 初始化加载一次
  146. uni.$on('refreshPassengerList', () => {
  147. this.fetchPassengerList(); // 被添加页通知时刷新
  148. });
  149. },
  150. onUnload() {
  151. uni.$off('refreshPassengerList'); // 销毁监听,避免重复绑定
  152. },
  153. methods: {
  154. fetchPassengerList() {
  155. this.$Request.getT('/app/passenger/selectList').then(res => {
  156. if (res.code === 0) {
  157. this.selectdata = res.data;
  158. }
  159. });
  160. },
  161. goNav(url) {
  162. // #ifdef MP-WEIXIN
  163. if (uni.getStorageSync('sendorderMsg')) {
  164. uni.requestSubscribeMessage({
  165. tmplIds: this.arr,
  166. success(re) {
  167. // console.log(re,'**********')
  168. var datas = JSON.stringify(re);
  169. if (datas.indexOf("accept") != -1) {
  170. console.log(re)
  171. }
  172. },
  173. fail: (res) => {
  174. console.log(res)
  175. }
  176. })
  177. }
  178. // #endif
  179. let token = this.$queue.getData("token");
  180. if (token) {
  181. uni.navigateTo({
  182. url: url
  183. })
  184. } else {
  185. this.bindlogin();
  186. }
  187. }
  188. }
  189. }
  190. </script>
  191. <style scoped>
  192. .container {
  193. margin: 30rpx;
  194. min-height: 100vh;
  195. padding-bottom: 120rpx;
  196. }
  197. .sub-title {
  198. font-size: 28rpx;
  199. height: 100rpx;
  200. line-height: 100rpx;
  201. }
  202. .station-list {
  203. }
  204. .station-item {
  205. display: flex;
  206. justify-content: space-between;
  207. padding: 10rpx 0;
  208. }
  209. .station-item:last-child {
  210. border-bottom: none;
  211. }
  212. .divider {
  213. height: 20rpx;
  214. background: #f8f8f8;
  215. margin: 40rpx -30rpx;
  216. }
  217. .section {
  218. margin-bottom: 40rpx;
  219. }
  220. .section-title {
  221. font-size: 32rpx;
  222. color: #333;
  223. margin-bottom: 30rpx;
  224. display: block;
  225. }
  226. .phone {
  227. height: 80rpx;
  228. background: #f5f5f5;
  229. line-height: 80rpx;
  230. font-size: 32rpx;
  231. color: #333;
  232. border-radius: 14rpx;
  233. border: 1rpx solid #e4e7ed;
  234. padding-left: 20rpx;
  235. }
  236. .seat-options {
  237. display: flex;
  238. gap: 20rpx;
  239. }
  240. .seat-item {
  241. border: 1rpx solid #ddd;
  242. padding: 12rpx 30rpx;
  243. border-radius: 8rpx;
  244. font-size: 28rpx;
  245. }
  246. .seat-item.active {
  247. border-color: #fe6b01;
  248. background: #fff5f0;
  249. color: #fe6b01;
  250. }
  251. .driver-grid {
  252. display: grid;
  253. grid-template-columns: repeat(5, 1fr);
  254. gap: 20rpx;
  255. }
  256. .driver-seat {
  257. border: 1rpx solid #ddd;
  258. border-radius: 8rpx;
  259. aspect-ratio: 1;
  260. display: flex;
  261. align-items: center;
  262. justify-content: center;
  263. font-size: 28rpx;
  264. }
  265. .driver-seat.selected {
  266. border-color: #fe6b01;
  267. background: #fff5f0;
  268. color: #fe6b01;
  269. }
  270. .driver-seat.disabled {
  271. background: #f8f8f8;
  272. color: #ccc;
  273. border-color: #eee;
  274. }
  275. .seat-status {
  276. margin-top: 30rpx;
  277. color: #999;
  278. font-size: 24rpx;
  279. }
  280. .service-item {
  281. display: flex;
  282. justify-content: space-between;
  283. padding: 30rpx 0;
  284. font-size: 32rpx;
  285. }
  286. .arrow {
  287. font-size: 32rpx;
  288. }
  289. .footer {
  290. position: fixed;
  291. bottom: 0;
  292. left: 0;
  293. right: 0;
  294. background: #fff;
  295. padding: 20rpx 30rpx;
  296. box-shadow: 0 -4rpx 10rpx rgba(0, 0, 0, 0.05);
  297. }
  298. .submit-btn {
  299. background: #fe6b01;
  300. color: #fff;
  301. border-radius: 50rpx;
  302. font-size: 32rpx;
  303. height: 80rpx;
  304. line-height: 80rpx;
  305. }
  306. </style>