敢为人鲜小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

493 lines
11 KiB

5 months ago
5 months ago
5 months ago
1 month ago
1 month ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
1 month ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
3 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
  1. <template>
  2. <view class="page">
  3. <!-- 导航栏 -->
  4. <navbar title=" " bgColor="#019245" color="#fff" />
  5. <!-- 搜索框 -->
  6. <view style="background-color: #fff; padding: 12rpx 20rpx 0rpx; ">
  7. <uv-search placeholder="搜索商品名" v-model="keyword" :showAction="false" actionText="" height="80rpx" animation
  8. bgColor="#F5F5F5" inputAlign="center" color="#000" placeholderColor="#979797"
  9. searchIconSize="50rpx"></uv-search>
  10. </view>
  11. <!-- 订单筛选 -->
  12. <view class="tabs">
  13. <uv-tabs :list="tabs" :activeStyle="{ color: '#019245'}" lineColor="#019245" :scrollable="false"
  14. :inactiveStyle="{color: 'black'}" lineHeight="6rpx" lineWidth="55rpx" :current="current"
  15. @click="clickTabs" />
  16. </view>
  17. <!-- 团餐列表 -->
  18. <view class="group-meal-list" v-if="identity">
  19. <view class="meal-item" v-for="(meal, index) in mealList" :key="meal.id">
  20. <view class="meal-name">{{ meal.title }}</view>
  21. <view class="meal-price">本单佣金合计: <text class="price-value">¥{{ levelInfo.amount || '0.00' }}</text>
  22. </view>
  23. <view class="meal-action">
  24. <button class="order-btn" @tap="viewOrder(meal)">查看订单</button>
  25. </view>
  26. </view>
  27. <view style="margin-top: 200rpx; min-width: 700rpx;">
  28. <uv-empty mode="order" v-if="mealList.length == 0" />
  29. </view>
  30. </view>
  31. <!-- 订单列表 -->
  32. <view class="order-list" v-else>
  33. <OrderItem v-for="(order, index) in orderList" :key="order.id" :order="order" @cancel="handleCancelOrder"
  34. @pick="handlePickOrder" @pay="handlePayOrder" @click="goToOrderDetail(order)" />
  35. <view style="margin-top: 200rpx; min-width: 700rpx;">
  36. <uv-empty mode="order" v-if="orderList.length == 0" />
  37. </view>
  38. </view>
  39. <!-- <view class="list">
  40. <view class="item" v-for="(item, index) in list" @tap="toOrderDetail(item.id)" :key="index">
  41. <view class="content" :key="index" v-for="(good, index) in item.commonOrderSkuList">
  42. <view class="top">
  43. <view class="service">
  44. {{ good.title }}
  45. </view>
  46. <view class="status">
  47. <text> {{ tabs[Number(item.state) + 1].name }}</text>
  48. </view>
  49. </view>
  50. <view class="main">
  51. <view class="left">
  52. <image mode="aspectFill" :src="good.image && good.image.split(',')[0]"></image>
  53. </view>
  54. <view class="right">
  55. <view class="text-hidden-1">
  56. 客户姓名{{item.name}}
  57. </view>
  58. <view class="text-hidden-1">
  59. 下单时间{{item.createTime}}
  60. </view>
  61. <view class="text-hidden-1">
  62. 联系电话{{item.phone}}
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. <view class="bottom">
  68. <view class="price">
  69. <text class="total-title">总价格</text>
  70. <text class="unit"></text>
  71. <text class="num">{{item.price}}</text>
  72. <text class="c-unit"></text>
  73. </view>
  74. <view @tap.stop="toPayOrder(item)" class="btn" v-if="item.state == 0">
  75. 立即付款
  76. </view>
  77. <view @tap.stop="cancelOrder(item)" class="btn" v-if="item.state == 0">
  78. 取消订单
  79. </view>
  80. <view class="btn" @tap.stop="confirmOrder(item)" v-if="item.state == 2">
  81. 确认收货
  82. </view>
  83. <view @tap.stop="$refs.customerServicePopup.open()" class="btn" v-if="item.state > 0">
  84. 联系客服
  85. </view>
  86. </view>
  87. </view>
  88. <view style="
  89. margin-top: 20rpx;
  90. min-width: 700rpx;">
  91. <uv-empty mode="list" v-if="list.length == 0"></uv-empty>
  92. </view>
  93. </view> -->
  94. <customerServicePopup ref="customerServicePopup" />
  95. <tabber select="order" />
  96. </view>
  97. </template>
  98. <script>
  99. import {
  100. mapGetters
  101. } from 'vuex'
  102. import mixinsList from '@/mixins/list.js'
  103. import mixinsOrder from '@/mixins/order.js'
  104. import tabber from '@/components/base/tabbar.vue'
  105. import customerServicePopup from '@/components/config/customerServicePopup.vue'
  106. import OrderItem from '@/components/order/OrderItem.vue'
  107. export default {
  108. mixins: [mixinsList, mixinsOrder],
  109. components: {
  110. tabber,
  111. customerServicePopup,
  112. OrderItem
  113. },
  114. computed: {
  115. orderList() {
  116. return this.memberOrderList.filter(order => order.status == this.current)
  117. },
  118. mealList() {
  119. return this.leaderOrderList.filter(order => order.status == this.current)
  120. },
  121. tabs() {
  122. return this.identity ? this.tabMeal : this.tabOrder
  123. }
  124. },
  125. data() {
  126. return {
  127. keyword: '',
  128. tabOrder: [{
  129. name: '待支付'
  130. },
  131. {
  132. name: '待出餐'
  133. },
  134. {
  135. name: '送餐中'
  136. },
  137. {
  138. name: '待取餐'
  139. },
  140. {
  141. name: '已完成'
  142. }
  143. ],
  144. tabMeal: [{
  145. name: '待出餐'
  146. },
  147. {
  148. name: '已出餐'
  149. },
  150. {
  151. name: '待取餐'
  152. },
  153. {
  154. name: '已完成'
  155. }
  156. ],
  157. current: 0,
  158. memberOrderList: [],
  159. leaderOrderList: [],
  160. identity: uni.getStorageSync('identity')
  161. }
  162. },
  163. onLoad(args) {
  164. this.getData()
  165. },
  166. methods: {
  167. getData() {
  168. uni.showLoading({
  169. title: '加载中'
  170. })
  171. if (!this.identity) {
  172. this.$api('queryMemberOrderList', {}, res => {
  173. uni.hideLoading()
  174. if (res.code == 200) {
  175. this.memberOrderList = res.result.records
  176. }
  177. })
  178. }
  179. else {
  180. this.$api('queryLeaderOrderList', {}, res => {
  181. uni.hideLoading()
  182. if (res.code == 200) {
  183. this.leaderOrderList = res.result.records
  184. }
  185. })
  186. }
  187. },
  188. //点击tab栏
  189. clickTabs({
  190. index
  191. }) {
  192. if (index == 0) {
  193. delete this.queryParams.state
  194. } else {
  195. this.queryParams.state = index - 1
  196. }
  197. this.current = index
  198. },
  199. // 跳转到新订单详情页
  200. goToOrderDetail(order) {
  201. if (order.status === 'completed') {
  202. this.$utils.navigateTo({
  203. url: '/pages_order/order/newOrderDetail?id=' + order.id + '&status=' + order.status
  204. })
  205. } else {
  206. this.$utils.navigateTo({
  207. url: '/pages_order/order/newOrderDetail?id=' + order.id + '&status=' + order.status_dictText
  208. })
  209. }
  210. },
  211. // 查看团餐订单
  212. viewOrder(meal) {
  213. this.$utils.navigateTo({
  214. url: '/pages_order/order/groupMealDetail?id=' + meal.id + '&status=' + meal.status
  215. })
  216. },
  217. // 根据状态筛选订单
  218. // filterOrdersByStatus(index) {
  219. // this.loadMockOrders() // 先重置数据
  220. // // if (index === 0) return // 全部订单不需要筛选
  221. // const targetStatus = this.statusMap[index]
  222. // if (targetStatus) {
  223. // this.orderList = this.orderList.filter(order => order.status === targetStatus)
  224. // this.groupMeals = this.groupMeals.filter(meal => meal.status === targetStatus)
  225. // }
  226. // },
  227. // // 处理取消订单
  228. // handleCancelOrder(orderId) {
  229. // uni.showModal({
  230. // title: '提示',
  231. // content: '确定要取消订单吗?',
  232. // confirmColor: '#019245',
  233. // success: (res) => {
  234. // if (res.confirm) {
  235. // // 模拟取消订单API调用
  236. // uni.showToast({
  237. // title: '订单已取消',
  238. // icon: 'success'
  239. // })
  240. // // 更新订单状态
  241. // const orderIndex = this.orderList.findIndex(item => item.id === orderId)
  242. // if (orderIndex !== -1) {
  243. // this.orderList[orderIndex].status = 'canceled'
  244. // // 如果当前标签页不是全部或已取消,则移除该订单
  245. // if (this.current !== 0 && this.current !== 5) {
  246. // this.orderList.splice(orderIndex, 1)
  247. // }
  248. // }
  249. // }
  250. // }
  251. // })
  252. // },
  253. // 处理支付订单
  254. // handlePayOrder(orderId) {
  255. // uni.showToast({
  256. // title: '正在跳转支付...',
  257. // icon: 'loading'
  258. // })
  259. // // 模拟支付操作,实际项目中应调用支付API
  260. // setTimeout(() => {
  261. // uni.hideToast()
  262. // this.$api('payOrder', {
  263. // orderId: orderId,
  264. // payType: 0
  265. // }, res => {
  266. // if (res.code == 200) {
  267. // uni.showToast({
  268. // title: '支付成功',
  269. // icon: 'success'
  270. // })
  271. // }
  272. // })
  273. // // 更新订单状态
  274. // const orderIndex = this.orderList.findIndex(item => item.id === orderId)
  275. // if (orderIndex !== -1) {
  276. // this.orderList[orderIndex].status = 'processing'
  277. // // 如果当前标签页不是全部或待发货,则移除该订单
  278. // if (this.current !== 0 && this.current !== 2) {
  279. // this.orderList.splice(orderIndex, 1)
  280. // }
  281. // }
  282. // }, 1500)
  283. // },
  284. // 处理取餐完成
  285. // handlePickOrder(order) {
  286. // uni.showModal( {
  287. // title: '提示',
  288. // content: '确定取餐完成?',
  289. // confirmColor: '#019245',
  290. // success: (res) => {
  291. // if (res.confirm) {
  292. // // order.status_dictText = '已完成',
  293. // this.$api('updateMemberOrderStatus', { id: order.id, status: 3 }, res => {
  294. // if (res.code === 200) {
  295. // this.clickTabs({
  296. // index: 3
  297. // })
  298. // }
  299. // })
  300. // uni.showToast({
  301. // title: '取餐完成',
  302. // icon: 'success',
  303. // duration: 2000
  304. // })
  305. // }
  306. // }
  307. // })
  308. // }
  309. }
  310. }
  311. </script>
  312. <style scoped lang="scss">
  313. .page {}
  314. .tabs {
  315. background: #fff;
  316. padding-bottom: 4rpx;
  317. }
  318. .order-list {
  319. padding: 0 20rpx;
  320. // position: relative;
  321. }
  322. /* 团餐列表样式 */
  323. .group-meal-list {
  324. padding: 20rpx;
  325. }
  326. .meal-item {
  327. display: flex;
  328. justify-content: space-between;
  329. align-items: center;
  330. padding: 30rpx 20rpx;
  331. background-color: #fff;
  332. margin-bottom: 20rpx;
  333. border-radius: 10rpx;
  334. }
  335. .meal-info {
  336. flex: 1;
  337. }
  338. .meal-name {
  339. font-size: 32rpx;
  340. font-weight: 500;
  341. margin-bottom: 10rpx;
  342. }
  343. .meal-price {
  344. font-size: 28rpx;
  345. color: $uni-color;
  346. background-color: #ECFEF4;
  347. padding: 10rpx 20rpx;
  348. border-radius: 10rpx;
  349. }
  350. .price-value {
  351. margin-left: 10rpx;
  352. font-weight: 500;
  353. }
  354. .meal-action {
  355. margin-left: 20rpx;
  356. }
  357. .order-btn {
  358. background-color: $uni-color;
  359. color: #fff;
  360. font-size: 28rpx;
  361. padding: 10rpx 30rpx;
  362. border-radius: 30rpx;
  363. line-height: 1.5;
  364. min-width: 160rpx;
  365. }
  366. .list {
  367. .item {
  368. width: calc(100% - 40rpx);
  369. background-color: #fff;
  370. margin: 20rpx;
  371. box-sizing: border-box;
  372. border-radius: 16rpx;
  373. padding: 30rpx;
  374. .content {
  375. .top {
  376. display: flex;
  377. justify-content: space-between;
  378. align-items: center;
  379. font-size: 34rpx;
  380. .status {
  381. font-weight: 600;
  382. color: #FFAC2F;
  383. flex-shrink: 0;
  384. margin-left: 20rpx;
  385. }
  386. }
  387. .main {
  388. display: flex;
  389. margin: 20rpx 0rpx;
  390. .left {
  391. display: flex;
  392. align-items: center;
  393. justify-content: center;
  394. width: 180rpx;
  395. height: 180rpx;
  396. image {
  397. width: 95%;
  398. height: 95%;
  399. border-radius: 10rpx;
  400. }
  401. }
  402. .right {
  403. display: flex;
  404. flex-direction: column;
  405. justify-content: space-between;
  406. width: calc(100% - 200rpx);
  407. color: #777;
  408. font-size: 26rpx;
  409. padding: 30rpx 20rpx;
  410. box-sizing: border-box;
  411. margin-left: 20rpx;
  412. border-radius: 10rpx;
  413. background-color: #F8F8F8;
  414. }
  415. }
  416. }
  417. .bottom {
  418. display: flex;
  419. justify-content: space-between;
  420. font-size: 25rpx;
  421. .price {
  422. .total-title {}
  423. .num {
  424. font-size: 36rpx;
  425. }
  426. .num,
  427. .unit,
  428. .c-unit {
  429. color: $uni-color;
  430. }
  431. }
  432. .btn {
  433. border: 1px solid #C7C7C7;
  434. padding: 10rpx 20rpx;
  435. border-radius: 40rpx;
  436. color: #575757;
  437. }
  438. }
  439. }
  440. }
  441. </style>