index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <view>
  3. <!-- 状态栏高度 -->
  4. <view :style="{ height: `${statusBarHeight}px` }"></view>
  5. <!-- 导航栏 -->
  6. <view :style="{ height: `${navigationBarHeight}px`,lineHeight: `${navigationBarHeight}px`}" class="order-nav">订单
  7. </view>
  8. <!-- 进行中/历史订单 -->
  9. <view class="status-bar">
  10. <view>
  11. <text :class="isShow? 'status-true': 'status-false'" @click="statusClick">进行中</text>
  12. <text :class="!isShow? 'status-true': 'status-false'" @click="statusClick">历史订单</text>
  13. </view>
  14. </view>
  15. <view style="background-color: white;border-radius: 23rpx;margin: 10rpx 20rpx;padding-bottom: 40rpx;">
  16. <view class="container">
  17. <text class="left-text">韩式铁板蛋炒饭</text>
  18. <view class="right-group">
  19. <text style="color: #0FBA42;font-size: 23rpx;">制作中</text>
  20. <!-- <text style="color: #FF5500;font-size: 23rpx;">待取餐</text>
  21. <text style="color: #999999;font-size: 23rpx;">已完成</text>
  22. <text style="color: #999999;font-size: 23rpx;">已取消</text> -->
  23. <image src="/static/img/ic-yx.png" class="image" />
  24. </view>
  25. </view>
  26. <view class="scroll-container">
  27. <view class="item">
  28. <img src="/static/img/img8.png">
  29. <text>蛋炒饭x1</text>
  30. </view>
  31. </view>
  32. <view class="dashed-line"></view>
  33. <view style="text-align: right; font-size: 23rpx; color: #141414;padding-right: 20rpx;">
  34. 共2件,实付 ¥16.00元
  35. </view>
  36. <view class="container2">
  37. <text class="left-text2">商家正在备餐中</text>
  38. <view class="right-group">
  39. <image src="/static/img/ic-iphone1.png" class="image2" />
  40. <text style="color: #141414;font-size: 21rpx;">联系商家</text>
  41. <view style="display: inline-block; width: 2rpx; height: 42rpx;border: 2rpx solid #D5D6DC;"></view>
  42. <image src="/static/img/ic-message1.png" class="image2" />
  43. <text style="color: #141414;font-size: 21rpx;">留言</text>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
  51. let app = getApp();
  52. export default {
  53. data() {
  54. return {
  55. statusBarHeight: app.globalData.statusBarHeight,
  56. navigationBarHeight: 0,
  57. isShow: true,
  58. }
  59. },
  60. //下拉刷新
  61. onPullDownRefresh() {
  62. },
  63. onLoad(options) {
  64. let that = this;
  65. //首页数据加载
  66. // this.getIndexConfig();
  67. // #ifdef MP-WEIXIN
  68. // 获取微信胶囊的位置信息 width,height,top,right,left,bottom
  69. const custom = wx.getMenuButtonBoundingClientRect()
  70. // 导航栏高度(标题栏高度) = 胶囊高度 + (顶部距离 - 状态栏高度) * 2
  71. this.navigationBarHeight = custom.height + (custom.top - this.statusBarHeight) * 2
  72. // console.log("导航栏高度:"+this.globalData.navigationBarHeight)
  73. // #endif
  74. },
  75. onShow() {
  76. },
  77. methods: {
  78. statusClick() {
  79. this.isShow = !this.isShow;
  80. },
  81. },
  82. mounted() {
  83. },
  84. }
  85. </script>
  86. <style scoped>
  87. .order-nav {
  88. font-weight: 500;
  89. font-size: 35rpx;
  90. color: #FFFFFF;
  91. background-color: #FF6702;
  92. text-align: center;
  93. }
  94. .status-bar {
  95. background-color: #FF6702;
  96. text-align: center;
  97. padding: 20px 0 16rpx 0;
  98. }
  99. .status-bar view {
  100. display: inline-block;
  101. width: 385rpx;
  102. background: #EB5E00;
  103. border-radius: 37rpx;
  104. }
  105. .status-true {
  106. display: inline-block;
  107. width: 192rpx;
  108. padding: 10rpx 0;
  109. background-color: white;
  110. color: #FF6600;
  111. border-radius: 37rpx;
  112. }
  113. .status-false {
  114. display: inline-block;
  115. width: 192rpx;
  116. padding: 10rpx 0;
  117. color: #FFCBA9;
  118. border-radius: 37rpx;
  119. }
  120. .container {
  121. display: flex;
  122. justify-content: space-between;
  123. align-items: center;
  124. }
  125. .left-text {
  126. font-weight: 600;
  127. font-size: 27rpx;
  128. color: #141414;
  129. margin-left: 40rpx;
  130. }
  131. .right-group {
  132. display: flex;
  133. align-items: center;
  134. gap: 16rpx;
  135. }
  136. .image {
  137. width: 42rpx;
  138. height: 70rpx;
  139. margin-right: 20rpx;
  140. }
  141. .container2 {
  142. display: flex;
  143. justify-content: space-between;
  144. align-items: center;
  145. background-color: #F8F9FB;
  146. margin: 20rpx 20rpx 0 20rpx;
  147. padding: 20rpx 40rpx 20rpx 20rpx;
  148. }
  149. .left-text2 {
  150. font-weight: 600;
  151. color: #141414;
  152. font-size: 23rpx;
  153. margin-left: 0;
  154. }
  155. .image2 {
  156. width: 42rpx;
  157. height: 42rpx;
  158. }
  159. .scroll-container {
  160. display: flex;
  161. overflow-x: auto;
  162. /* 允许水平滚动 */
  163. white-space: nowrap;
  164. /* 防止项目换行 */
  165. padding: 8rpx 20rpx 20rpx 40rpx;
  166. /* 添加一些内边距 */
  167. -webkit-overflow-scrolling: touch;
  168. /* 在iOS上平滑滚动 */
  169. }
  170. .item {
  171. display: inline-flex;
  172. /* 或者使用 flex 但需要调整 */
  173. flex-direction: column;
  174. align-items: center;
  175. margin-right: 20rpx;
  176. /* 项目之间的间距 */
  177. flex: 0 0 auto;
  178. /* 防止项目伸缩 */
  179. }
  180. .item img {
  181. width: 115rpx;
  182. height: 115rpx;
  183. border-radius: 12rpx;
  184. /* 可选:圆形图片 */
  185. object-fit: cover;
  186. /* 保持图片比例 */
  187. }
  188. .item text {
  189. margin-top: 10rpx;
  190. /* 图片和文字之间的间距 */
  191. font-size: 21rpx;
  192. color: #141414;
  193. text-align: center;
  194. white-space: nowrap;
  195. /* 防止文字换行 */
  196. }
  197. .dashed-line {
  198. border-bottom: 2rpx dashed #D6D7DC;
  199. width: 90%;
  200. /* 确保宽度足够 */
  201. height: 2rpx;
  202. /* 控制线条高度 */
  203. margin: 0 40rpx 18rpx 40rpx;
  204. }
  205. </style>