index.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. <template>
  2. <view class="page">
  3. <!-- 搜索和筛选区域 -->
  4. <view class="search-section">
  5. <view class="search-box">
  6. <uni-icons type="search" size="18" color="#999999"></uni-icons>
  7. <input class="search-input" placeholder="搜客户姓名" placeholder-style="color: #999999"
  8. v-model="searchKeyword" @input="handleSearch" />
  9. <text class="search-box-text">搜索</text>
  10. </view>
  11. <view class="filter-btn" @click="handleFilter">
  12. <uni-icons type="settings" size="18" color="#323232"></uni-icons>
  13. <text class="filter-text">筛选</text>
  14. </view>
  15. </view>
  16. <!-- 订单标签页 -->
  17. <view class="order-tabs">
  18. <view v-for="tab in tabList" :key="tab.key" class="tab-item" :class="{ 'active': activeTab === tab.key }"
  19. @click="switchTab(tab.key)">
  20. <text class="tab-text">{{ tab.label }}({{ tab.count }})</text>
  21. </view>
  22. </view>
  23. <!-- 订单列表-->
  24. <order-list :orders="filteredOrders" :order-info-fields="orderInfoFields" @delete="handleDelete"
  25. @message="handleMessage"></order-list>
  26. <!-- 订单筛选弹窗 -->
  27. <orderFilter ref="orderFilter" @confirmOrder="confirmOrder"></orderFilter>
  28. <!-- 底部导航栏 -->
  29. <bar-navigasi-handap></bar-navigasi-handap>
  30. </view>
  31. </template>
  32. <script>
  33. import BarNavigasiHandap from "@/components/barNavigasiHandap.vue"
  34. import OrderList from "./components/order.vue"
  35. // 订单筛选弹窗
  36. import orderFilter from "./components/orderFilter.vue"
  37. export default {
  38. components: {
  39. BarNavigasiHandap,
  40. OrderList,
  41. orderFilter
  42. },
  43. data() {
  44. return {
  45. activeTab: 'all', // 当前选中的标签页
  46. searchKeyword: '', // 搜索关键词
  47. // 标签页配置
  48. tabList: [{
  49. key: 'all',
  50. label: '全部订单',
  51. count: 2
  52. },
  53. {
  54. key: 'progress',
  55. label: '进行中',
  56. count: 0
  57. },
  58. {
  59. key: 'completed',
  60. label: '已完成',
  61. count: 0
  62. }
  63. ],
  64. // 订单信息字段配置
  65. orderInfoFields: [{
  66. key: 'orderNo',
  67. label: '订单编号'
  68. },
  69. {
  70. key: 'phone',
  71. label: '联系电话'
  72. },
  73. {
  74. key: 'serviceFee',
  75. label: '服务费用'
  76. },
  77. {
  78. key: 'orderTime',
  79. label: '下单时间'
  80. },
  81. {
  82. key: 'payTime',
  83. label: '支付时间'
  84. },
  85. {
  86. key: 'commissionRate',
  87. label: '佣金比例'
  88. }
  89. ],
  90. // 订单列表数据
  91. orders: [{
  92. id: 1,
  93. customerName: '张明明',
  94. avatar: '/static/images/profile.jpg',
  95. validDate: '2025-11-07',
  96. status: 'progress',
  97. orderNo: 'LAW2023071500123',
  98. phone: '13877092066',
  99. serviceFee: '¥200/次',
  100. orderTime: '2025-11-11 11:11:11',
  101. payTime: '2025-11-11 11:11:11',
  102. commissionRate: '3%',
  103. revenue: 280
  104. },
  105. {
  106. id: 2,
  107. customerName: '张明明',
  108. avatar: '/static/images/profile.jpg',
  109. validDate: '2025-11-07',
  110. status: 'completed',
  111. orderNo: 'LAW2023071500123',
  112. phone: '13877092066',
  113. serviceFee: '¥200/次',
  114. orderTime: '2025-11-11 11:11:11',
  115. payTime: '2025-11-11 11:11:11',
  116. commissionRate: '3%',
  117. revenue: 280
  118. },
  119. {
  120. id: 3,
  121. customerName: '张明明',
  122. avatar: '/static/images/profile.jpg',
  123. validDate: '2025-11-07',
  124. status: 'completed',
  125. orderNo: 'LAW2023071500123',
  126. phone: '13877092066',
  127. serviceFee: '¥200/次',
  128. orderTime: '2025-11-11 11:11:11',
  129. payTime: '2025-11-11 11:11:11',
  130. commissionRate: '3%',
  131. revenue: 280
  132. }
  133. ]
  134. }
  135. },
  136. computed: {
  137. /**
  138. * 过滤后的订单列表
  139. */
  140. filteredOrders() {
  141. let result = this.orders
  142. // 根据标签页筛选
  143. if (this.activeTab !== 'all') {
  144. result = result.filter(order => order.status === this.activeTab)
  145. }
  146. // 根据搜索关键词筛选
  147. if (this.searchKeyword.trim()) {
  148. const keyword = this.searchKeyword.trim().toLowerCase()
  149. result = result.filter(order =>
  150. order.customerName.toLowerCase().includes(keyword) ||
  151. order.orderNo.toLowerCase().includes(keyword) ||
  152. order.phone.includes(keyword)
  153. )
  154. }
  155. return result
  156. }
  157. },
  158. methods: {
  159. /**
  160. * 切换标签页
  161. */
  162. switchTab(tab) {
  163. if (this.activeTab === tab) return
  164. this.activeTab = tab
  165. this.updateTabCount()
  166. },
  167. /**
  168. * 更新标签页数量
  169. */
  170. updateTabCount() {
  171. this.tabList.forEach(tab => {
  172. if (tab.key === 'all') {
  173. tab.count = this.orders.length
  174. } else {
  175. tab.count = this.orders.filter(order => order.status === tab.key).length
  176. }
  177. })
  178. },
  179. handleSearch() {
  180. // 搜索逻辑已在 computed 中处理
  181. },
  182. // 打开日期筛选弹窗
  183. handleFilter() {
  184. this.$refs.orderFilter.open()
  185. },
  186. handleMessage(order) {
  187. },
  188. handleDelete(order) {
  189. const index = this.orders.findIndex(item => item.id === order.id)
  190. if (index > -1) {
  191. this.orders.splice(index, 1)
  192. this.updateTabCount()
  193. uni.showToast({
  194. title: '删除成功',
  195. icon: 'success'
  196. })
  197. }
  198. },
  199. confirmOrder(data) {
  200. console.log(data, '筛选日期')
  201. }
  202. },
  203. onLoad() {
  204. // 页面加载时更新标签页数量
  205. this.updateTabCount()
  206. }
  207. }
  208. </script>
  209. <style scoped>
  210. .page {
  211. padding-top: calc(var(--status-bar-height) + 20rpx);
  212. padding-bottom: calc(16rpx + env(safe-area-inset-bottom));
  213. background: linear-gradient(180deg, rgba(40, 86, 199, 0.3) 0%, rgba(255, 255, 255, 0) 100%);
  214. min-height: 100vh;
  215. box-sizing: border-box;
  216. }
  217. /* 搜索区域 */
  218. .search-section {
  219. display: flex;
  220. align-items: center;
  221. padding: 0 30rpx 24rpx;
  222. gap: 20rpx;
  223. }
  224. .search-box {
  225. flex: 1;
  226. display: flex;
  227. align-items: center;
  228. background-color: #F5F5F5;
  229. border-radius: 38rpx;
  230. padding: 20rpx 24rpx;
  231. gap: 12rpx;
  232. }
  233. .search-input {
  234. flex: 1;
  235. font-size: 28rpx;
  236. color: #323232;
  237. }
  238. .search-box-text {
  239. font-weight: 400;
  240. font-size: 27rpx;
  241. color: #151515;
  242. }
  243. .filter-btn {
  244. display: flex;
  245. align-items: center;
  246. gap: 8rpx;
  247. padding: 20rpx 24rpx;
  248. }
  249. .filter-text {
  250. font-size: 28rpx;
  251. color: #323232;
  252. }
  253. /* 订单标签页 */
  254. .order-tabs {
  255. display: flex;
  256. justify-content: space-around;
  257. width: 100%;
  258. }
  259. .tab-item {
  260. padding: 24rpx 0;
  261. position: relative;
  262. cursor: pointer;
  263. }
  264. .tab-item.active {
  265. font-weight: 600;
  266. }
  267. .tab-text {
  268. font-size: 28rpx;
  269. color: #8D8D8D;
  270. transition: color 0.3s;
  271. }
  272. .tab-item.active .tab-text {
  273. color: #323232;
  274. }
  275. </style>