|
|
@@ -77,7 +77,13 @@
|
|
|
<view class="m">合计金额 ¥<text class="v">{{ group.copiesAmount }}</text></view>
|
|
|
<view class="n">共 {{ group.copies }} 份</view>
|
|
|
</view>
|
|
|
- <u-button v-if="currentStatusTab === 0" type="primary" size="small" text="出餐"></u-button>
|
|
|
+ <u-button
|
|
|
+ v-if="currentStatusTab === 0"
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ text="出餐"
|
|
|
+ @click="handleOrderReady(group)"
|
|
|
+ ></u-button>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
@@ -156,6 +162,52 @@ export default {
|
|
|
this.$refs.listScroll.downCallback();
|
|
|
});
|
|
|
},
|
|
|
+ getOrderReadyIds(group) {
|
|
|
+ let ids = [];
|
|
|
+ (group.orderChildren || []).forEach(item => {
|
|
|
+ const orderIds = item.merchantOrderIds || item.merchantOrderId || item.orderId || item.userOrderId;
|
|
|
+ if (Array.isArray(orderIds)) {
|
|
|
+ ids = ids.concat(orderIds);
|
|
|
+ } else if (orderIds) {
|
|
|
+ ids = ids.concat(String(orderIds).split(','));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return ids.filter(Boolean);
|
|
|
+ },
|
|
|
+ handleOrderReady(group) {
|
|
|
+ const orderIds = this.getOrderReadyIds(group);
|
|
|
+ if (!orderIds.length) {
|
|
|
+ this.$tip.toast('未获取到订单信息');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '是否确认已经出餐?',
|
|
|
+ success: (modalRes) => {
|
|
|
+ if (!modalRes.confirm) return;
|
|
|
+ let params = {
|
|
|
+ orderId: orderIds.join()
|
|
|
+ };
|
|
|
+ this.$http.get('/groupmeal/merchantPackageOrder/orderReady', {params}).then(res => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'success',
|
|
|
+ title: res.data.message
|
|
|
+ });
|
|
|
+ this.currentStatusTab = 1;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.listScroll.downCallback();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: res.data.message
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
onClick(item) {
|
|
|
if (this.currentStatusTab == 2) {
|
|
|
let params = {
|