order-alist.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <view class="page-container">
  3. <!-- 导航栏 -->
  4. <u-navbar :autoBack="true" :placeholder="true" :border-bottom="false">
  5. <view class="navbar-title">团餐订单</view>
  6. <view slot="right" class="navbar-right">
  7. <text class="nav-btn" @click="goToDetail">订单明细</text>
  8. <text class="nav-btn manage-btn" @click="toggleManageMode">{{ isManaging ? '退出管理' : '批量管理' }}</text>
  9. </view>
  10. </u-navbar>
  11. <!-- 搜索框 -->
  12. <view class="search-bar">
  13. <u-search bg-color="#F7F8FC" placeholder="请输入套餐名称或团长名" search-icon-color="#999"
  14. :showAction="true" actionText="搜索"
  15. :actionStyle="{
  16. width: 'auto',
  17. color: '#333',
  18. padding: '0 20rpx',
  19. borderLeft: '1rpx solid #DDDDDD'
  20. }"
  21. ></u-search>
  22. </view>
  23. <!-- 状态Tabs -->
  24. <u-tabs :list="statusTabs"
  25. :current="currentStatusTab"
  26. inactive-color="#666666"
  27. :bar-style="{
  28. bottom: '20rpx',
  29. background: 'linear-gradient(90deg, #82BCFF 0%, rgba(130,188,255,0) 100%)'
  30. }"
  31. :active-item-style="{
  32. fontWeight: '500',
  33. fontSize: '32rpx',
  34. color: '#000000',
  35. }"
  36. @change="onTabChange"
  37. ></u-tabs>
  38. <!-- 订单列表 -->
  39. <scroll-view scroll-y class="order-scroll-view" :style="{ paddingBottom: isManaging ? '120rpx' : '0' }">
  40. <u-checkbox-group v-model="selectedOrders" placement="column">
  41. <view class="order-card" v-for="item in filteredOrders" :key="item.id">
  42. <u-image width="100rpx" height="100rpx" border-radius="12rpx" :src="item.image" mode="aspectFill"></u-image>
  43. <view class="order-info">
  44. <view class="order-title">{{ item.title }}</view>
  45. <view class="order-line">
  46. <view class="leader-name">团长姓名{{ item.leaderName }}</view>
  47. <view class="quantity-tag">团购数量{{ item.quantity }}</view>
  48. </view>
  49. </view>
  50. <view class="order-actions" v-if="isManaging">
  51. <u-checkbox :name="item.id" shape="circle" v-model="item.checked"></u-checkbox>
  52. </view>
  53. </view>
  54. </u-checkbox-group>
  55. </scroll-view>
  56. <!-- 批量操作底部栏 -->
  57. <view class="footer-bar" v-if="isManaging">
  58. <u-checkbox-group v-model="isAllSelected" placement="row">
  59. <u-checkbox name="all" shape="circle" v-model="isAllSelected" @change="selectAll">全选</u-checkbox>
  60. </u-checkbox-group>
  61. <view class="action-buttons">
  62. <u-button type="primary" @click="handleBatchAction">出餐</u-button>
  63. </view>
  64. </view>
  65. <Tabbar />
  66. </view>
  67. </template>
  68. <script>
  69. import Tabbar from '@/pages/groupMeal/tabbar/index.vue';
  70. export default {
  71. components: {
  72. Tabbar
  73. },
  74. data() {
  75. return {
  76. isManaging: false,
  77. statusTabs: [{ name: '待出餐' }, { name: '已出餐' }],
  78. currentStatusTab: 0,
  79. allOrders: [
  80. // 模拟订单数据
  81. { id: 1, status: 0, title: '套餐名称套餐名称套餐名称', leaderName: 'b', quantity: 20, image: '/static/demo/goods1.png' },
  82. { id: 2, status: 0, title: '套餐名称套餐名称套餐名称', leaderName: 'a', quantity: 20, image: '/static/demo/goods2.png' },
  83. { id: 3, status: 0, title: '套餐名称套餐名称套餐名称', leaderName: 'b', quantity: 20, image: '/static/demo/goods3.png' },
  84. { id: 4, status: 1, title: '已出餐套餐', leaderName: 'c', quantity: 15, image: '/static/demo/goods1.png' },
  85. ],
  86. selectedOrders: [],
  87. isAllSelected: false,
  88. };
  89. },
  90. computed: {
  91. filteredOrders() {
  92. return this.allOrders.filter(order => order.status === this.currentStatusTab);
  93. }
  94. },
  95. methods: {
  96. goToDetail() {
  97. uni.navigateTo({
  98. url: '/pages/groupMeal/orders/order-blist'
  99. });
  100. },
  101. toggleManageMode() {
  102. this.isManaging = !this.isManaging;
  103. this.selectedOrders = [];
  104. this.isAllSelected = false;
  105. },
  106. onTabChange(e) {
  107. this.currentStatusTab = e;
  108. this.selectedOrders = [];
  109. this.isAllSelected = false;
  110. },
  111. selectAll(e) {
  112. if (e.value) {
  113. this.selectedOrders = this.filteredOrders.map(order => order.id);
  114. } else {
  115. this.selectedOrders = [];
  116. }
  117. this.filteredOrders.forEach(item => {
  118. item.checked = e.value;
  119. });
  120. },
  121. handleBatchAction() {
  122. if (this.selectedOrders.length === 0) {
  123. this.$tip.toast("请先选择订单")
  124. return;
  125. }
  126. console.log('批量出餐的订单ID:', this.selectedOrders);
  127. this.$tip.success("操作成功")
  128. }
  129. }
  130. };
  131. </script>
  132. <style lang="scss" scoped>
  133. .page-container {
  134. height: 100vh;
  135. display: flex;
  136. flex-direction: column;
  137. .navbar-title {
  138. font-weight: 500;
  139. font-size: 36rpx;
  140. color: #333333;
  141. }
  142. .navbar-right {
  143. padding: 0 24rpx;
  144. display: flex;
  145. align-items: center;
  146. .nav-btn {
  147. font-weight: 500;
  148. font-size: 28rpx;
  149. color: #333333;
  150. }
  151. .manage-btn {
  152. margin-left: 24rpx;
  153. }
  154. }
  155. .search-bar {
  156. padding: 12rpx 32rpx;
  157. background-color: #fff;
  158. .u-search {
  159. border-radius: 8rpx;
  160. background-color: #F7F8FC;
  161. }
  162. }
  163. .order-scroll-view {
  164. flex: 1;
  165. background-color: #fff;
  166. .u-checkbox-group {
  167. width: 100%;
  168. }
  169. .order-card {
  170. width: 100%;
  171. padding: 24rpx;
  172. display: flex;
  173. align-items: center;
  174. border-bottom: 1rpx solid #f0f0f0;
  175. .order-info {
  176. flex: 1;
  177. margin: 0 20rpx;
  178. .order-title {
  179. font-size: 28rpx;
  180. font-weight: 500;
  181. color: #303133;
  182. font-weight: bold;
  183. display: -webkit-box;
  184. -webkit-line-clamp: 1;
  185. -webkit-box-orient: vertical;
  186. overflow: hidden;
  187. }
  188. .order-line {
  189. margin-top: 8rpx;
  190. display: flex;
  191. align-items: center;
  192. }
  193. .leader-name {
  194. width: 70%;
  195. font-weight: 400;
  196. font-size: 26rpx;
  197. color: #666666;
  198. }
  199. .quantity-tag {
  200. font-size: 26rpx;
  201. color: #FD4912;
  202. }
  203. }
  204. .order-actions {
  205. }
  206. }
  207. }
  208. }
  209. .footer-bar {
  210. bottom: 50px;
  211. padding-bottom: 20px;
  212. .action-buttons {
  213. display: flex;
  214. gap: 20rpx;
  215. ::v-deep .u-btn {
  216. height: 69rpx;
  217. border-radius: 49rpx;
  218. }
  219. }
  220. }
  221. </style>