|
|
@ -13,138 +13,59 @@ |
|
|
|
<!-- 订单筛选 --> |
|
|
|
<view class="tabs"> |
|
|
|
<uv-tabs :list="tabs" :activeStyle="{ color: '#019245'}" lineColor="#019245" :scrollable="false" |
|
|
|
:inactiveStyle="{color: 'black'}" lineHeight="6rpx" lineWidth="55rpx" :current="current" |
|
|
|
:inactiveStyle="{color: 'black'}" lineHeight="6rpx" lineWidth="55rpx" :current="status" |
|
|
|
@click="clickTabs" /> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 团餐列表 --> |
|
|
|
<view class="group-meal-list" v-if="identity"> |
|
|
|
<view class="meal-item" v-for="(meal, index) in mealList" :key="meal.id"> |
|
|
|
<view class="meal-item" v-for="(meal, index) in leaderOrderList" :key="meal.id"> |
|
|
|
<view class="meal-name">{{ meal.title }}</view> |
|
|
|
<view class="meal-price">本单佣金合计: <text class="price-value">¥{{ levelInfo.amount || '0.00' }}</text> |
|
|
|
<view class="meal-price">本单佣金合计: <text class="price-value">¥{{ (meal.commission || 0).toFixed(2) || 0.00 }}</text> |
|
|
|
</view> |
|
|
|
<view class="meal-action"> |
|
|
|
<button class="order-btn" @tap="viewOrder(meal)">查看订单</button> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view style="margin-top: 200rpx; min-width: 700rpx;"> |
|
|
|
<uv-empty mode="order" v-if="mealList.length == 0" /> |
|
|
|
<uv-empty mode="order" v-if="leaderOrderList.length == 0" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 订单列表 --> |
|
|
|
<view class="order-list" v-else> |
|
|
|
<OrderItem v-for="(order, index) in orderList" :key="order.id" :order="order" |
|
|
|
<OrderItem v-for="(order, index) in memberOrderList" :key="order.id" :order="order" |
|
|
|
@cancel="handleCancelOrder(order.id)" @pick="handlePickOrder(order.id)" @pay="goToOrderDetail(order)" |
|
|
|
@click="goToOrderDetail(order)" /> |
|
|
|
<view style="margin-top: 200rpx; min-width: 700rpx;"> |
|
|
|
<uv-empty mode="order" v-if="orderList.length == 0" /> |
|
|
|
<uv-empty mode="order" v-if="memberOrderList.length == 0" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- <view class="list"> |
|
|
|
<view class="item" v-for="(item, index) in list" @tap="toOrderDetail(item.id)" :key="index"> |
|
|
|
<view class="content" :key="index" v-for="(good, index) in item.commonOrderSkuList"> |
|
|
|
<view class="top"> |
|
|
|
<view class="service"> |
|
|
|
{{ good.title }} |
|
|
|
</view> |
|
|
|
<view class="status"> |
|
|
|
<text> {{ tabs[Number(item.state) + 1].name }}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="main"> |
|
|
|
<view class="left"> |
|
|
|
<image mode="aspectFill" :src="good.image && good.image.split(',')[0]"></image> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="right"> |
|
|
|
<view class="text-hidden-1"> |
|
|
|
客户姓名:{{item.name}} |
|
|
|
</view> |
|
|
|
<view class="text-hidden-1"> |
|
|
|
下单时间:{{item.createTime}} |
|
|
|
</view> |
|
|
|
<view class="text-hidden-1"> |
|
|
|
联系电话:{{item.phone}} |
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="bottom"> |
|
|
|
<view class="price"> |
|
|
|
<text class="total-title">总价格:</text> |
|
|
|
<text class="unit">¥</text> |
|
|
|
<text class="num">{{item.price}}</text> |
|
|
|
<text class="c-unit">元</text> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view @tap.stop="toPayOrder(item)" class="btn" v-if="item.state == 0"> |
|
|
|
立即付款 |
|
|
|
</view> |
|
|
|
|
|
|
|
<view @tap.stop="cancelOrder(item)" class="btn" v-if="item.state == 0"> |
|
|
|
取消订单 |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="btn" @tap.stop="confirmOrder(item)" v-if="item.state == 2"> |
|
|
|
确认收货 |
|
|
|
</view> |
|
|
|
|
|
|
|
<view @tap.stop="$refs.customerServicePopup.open()" class="btn" v-if="item.state > 0"> |
|
|
|
联系客服 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
<view style=" |
|
|
|
margin-top: 20rpx; |
|
|
|
min-width: 700rpx;"> |
|
|
|
<uv-empty mode="list" v-if="list.length == 0"></uv-empty> |
|
|
|
</view> |
|
|
|
</view> --> |
|
|
|
|
|
|
|
<customerServicePopup ref="customerServicePopup" /> |
|
|
|
|
|
|
|
<tabber select="order" /> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { |
|
|
|
mapGetters |
|
|
|
} from 'vuex' |
|
|
|
import mixinsList from '@/mixins/list.js' |
|
|
|
import mixinsOrder from '@/mixins/order.js' |
|
|
|
import tabber from '@/components/base/tabbar.vue' |
|
|
|
import customerServicePopup from '@/components/config/customerServicePopup.vue' |
|
|
|
import OrderItem from '@/components/order/OrderItem.vue' |
|
|
|
|
|
|
|
export default { |
|
|
|
mixins: [mixinsList, mixinsOrder], |
|
|
|
mixins: [mixinsList], |
|
|
|
components: { |
|
|
|
tabber, |
|
|
|
customerServicePopup, |
|
|
|
OrderItem |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
orderList() { |
|
|
|
return this.memberOrderList.filter(order => order.status == this.current) |
|
|
|
}, |
|
|
|
mealList() { |
|
|
|
return this.leaderOrderList.filter(order => order.status == this.current) |
|
|
|
}, |
|
|
|
tabs() { |
|
|
|
return this.identity ? this.tabMeal : this.tabOrder |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
keyword: '', |
|
|
|
title: '', |
|
|
|
tabOrder: [{ |
|
|
|
name: '待支付' |
|
|
|
}, |
|
|
@ -174,97 +95,61 @@ |
|
|
|
name: '已完成' |
|
|
|
} |
|
|
|
], |
|
|
|
current: 0, |
|
|
|
status: 0, |
|
|
|
memberOrderList: [], |
|
|
|
leaderOrderList: [], |
|
|
|
identity: uni.getStorageSync('identity') |
|
|
|
identity: uni.getStorageSync('identity'), |
|
|
|
mixinsListApi: '', |
|
|
|
mixinsListKey: '', |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(args) { |
|
|
|
this.getData() |
|
|
|
onLoad(args) { |
|
|
|
// 这里需要做热更新 |
|
|
|
this.mixinsListApi = this.identity ? 'queryLeaderOrderList' : 'queryMemberOrderList', |
|
|
|
this.mixinsListKey = this.identity ? 'leaderOrderList' : 'memberOrderList' |
|
|
|
|
|
|
|
// 检查是否有tabIndex参数,如果有则自动切换到对应tab |
|
|
|
if (args.tabIndex !== undefined) { |
|
|
|
const index = parseInt(args.tabIndex) |
|
|
|
if (!isNaN(index) && index >= 0 && index < this.tabs.length) { |
|
|
|
this.current = index |
|
|
|
// 更新查询参数 |
|
|
|
// if (index == 0) { |
|
|
|
// delete this.queryParams.state |
|
|
|
// } else { |
|
|
|
// this.queryParams.state = index - 1 |
|
|
|
// } |
|
|
|
this.status = index |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
methods: { |
|
|
|
handleSearch() { |
|
|
|
this.$api('queryMemberOrderList', { |
|
|
|
title: this.keyword |
|
|
|
}, res => { |
|
|
|
if (res.code == 200) { |
|
|
|
this.memberOrderList = res.result.records |
|
|
|
} |
|
|
|
}) |
|
|
|
this.title = this.keyword |
|
|
|
this.getData() |
|
|
|
this.keyword = '' |
|
|
|
this.title = '' |
|
|
|
}, |
|
|
|
getData() { |
|
|
|
uni.showLoading({ |
|
|
|
title: '加载中' |
|
|
|
}) |
|
|
|
if (!this.identity) { |
|
|
|
this.$api('queryMemberOrderList', {}, res => { |
|
|
|
uni.hideLoading() |
|
|
|
if (res.code == 200) { |
|
|
|
this.memberOrderList = res.result.records |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
else { |
|
|
|
this.$api('queryLeaderOrderList', {}, res => { |
|
|
|
uni.hideLoading() |
|
|
|
if (res.code == 200) { |
|
|
|
this.leaderOrderList = res.result.records |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
beforeGetData() { |
|
|
|
const params = { |
|
|
|
status: this.status, |
|
|
|
title: this.title || '' |
|
|
|
} |
|
|
|
return params |
|
|
|
}, |
|
|
|
//点击tab栏 |
|
|
|
clickTabs({ |
|
|
|
index |
|
|
|
}) { |
|
|
|
this.current = index |
|
|
|
this.status = index |
|
|
|
this.getData() |
|
|
|
}, |
|
|
|
// 跳转到新订单详情页 |
|
|
|
goToOrderDetail(order) { |
|
|
|
if (order.status === 'completed') { |
|
|
|
this.$utils.navigateTo({ |
|
|
|
url: '/pages_order/order/newOrderDetail?id=' + order.id + '&status=' + order.status |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.$utils.navigateTo({ |
|
|
|
url: '/pages_order/order/newOrderDetail?id=' + order.id + '&status=' + order.status_dictText |
|
|
|
}) |
|
|
|
} |
|
|
|
this.$utils.navigateTo({ |
|
|
|
url: '/pages_order/order/newOrderDetail?id=' + order.id |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 查看团餐订单 |
|
|
|
viewOrder(meal) { |
|
|
|
this.$utils.navigateTo({ |
|
|
|
url: '/pages_order/order/groupMealDetail?id=' + meal.id + '&status=' + meal.status |
|
|
|
url: '/pages_order/order/groupMealDetail?id=' + meal.id |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 根据状态筛选订单 |
|
|
|
// filterOrdersByStatus(index) { |
|
|
|
// this.loadMockOrders() // 先重置数据 |
|
|
|
|
|
|
|
// // if (index === 0) return // 全部订单不需要筛选 |
|
|
|
// const targetStatus = this.statusMap[index] |
|
|
|
// if (targetStatus) { |
|
|
|
// this.orderList = this.orderList.filter(order => order.status === targetStatus) |
|
|
|
// this.groupMeals = this.groupMeals.filter(meal => meal.status === targetStatus) |
|
|
|
// } |
|
|
|
// }, |
|
|
|
// // 处理取消订单 |
|
|
|
handleCancelOrder(orderId) { |
|
|
|
uni.showModal({ |
|
|
@ -290,41 +175,6 @@ |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 处理支付订单 |
|
|
|
// handlePayOrder(orderId) { |
|
|
|
// uni.showToast({ |
|
|
|
// title: '正在跳转支付...', |
|
|
|
// icon: 'loading' |
|
|
|
// }) |
|
|
|
|
|
|
|
// // 模拟支付操作,实际项目中应调用支付API |
|
|
|
// setTimeout(() => { |
|
|
|
// uni.hideToast() |
|
|
|
|
|
|
|
// this.$api('payOrder', { |
|
|
|
// orderId: orderId, |
|
|
|
// payType: 0 |
|
|
|
// }, res => { |
|
|
|
// if (res.code == 200) { |
|
|
|
// uni.showToast({ |
|
|
|
// title: '支付成功', |
|
|
|
// icon: 'success' |
|
|
|
// }) |
|
|
|
// } |
|
|
|
// }) |
|
|
|
|
|
|
|
// // 更新订单状态 |
|
|
|
// const orderIndex = this.orderList.findIndex(item => item.id === orderId) |
|
|
|
// if (orderIndex !== -1) { |
|
|
|
// this.orderList[orderIndex].status = 'processing' |
|
|
|
|
|
|
|
// // 如果当前标签页不是全部或待发货,则移除该订单 |
|
|
|
// if (this.current !== 0 && this.current !== 2) { |
|
|
|
// this.orderList.splice(orderIndex, 1) |
|
|
|
// } |
|
|
|
// } |
|
|
|
// }, 1500) |
|
|
|
// }, |
|
|
|
// 处理取餐完成 |
|
|
|
handlePickOrder(orderId) { |
|
|
|
uni.showModal( { |
|
|
|