对接订单列表接口
This commit is contained in:
@@ -14,8 +14,7 @@
|
||||
</el-icon>
|
||||
<el-text class="t">选择会员</el-text>
|
||||
</div>
|
||||
<div class="select_user" @click="quickCashHandle"
|
||||
v-if="!global.orderMemberInfo.telephone && !global.tableInfo.id">
|
||||
<div class="select_user" @click="quickCashHandle">
|
||||
<div class="left">
|
||||
<el-icon class="icon" style="color: var(--el-color-warning);">
|
||||
<WalletFilled />
|
||||
@@ -23,7 +22,7 @@
|
||||
<el-text class="t">快捷收银</el-text>
|
||||
</div>
|
||||
</div>
|
||||
<div class="select_user" v-else @click="clearMember">
|
||||
<!-- <div class="select_user">
|
||||
<div class="left">
|
||||
<el-icon class="icon">
|
||||
<UserFilled />
|
||||
@@ -41,7 +40,7 @@
|
||||
<el-icon class="arrow">
|
||||
<Close />
|
||||
</el-icon>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="shop_operation">
|
||||
<div class="shop_list">
|
||||
@@ -56,125 +55,19 @@
|
||||
</el-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item" :class="{ active: item.active }" v-for="(item, index) in goodsStore.cartList" :key="item.id"
|
||||
@click="selectCartItemHandle(index)">
|
||||
<div class="name_wrap">
|
||||
<span>{{ item.product_name }}</span>
|
||||
<template v-if="item.is_gift">
|
||||
<div class="price">
|
||||
<span class="dis" v-if="item.is_temporary">
|
||||
¥{{ formatDecimal(+item.discount_sale_amount, 2, true) }}
|
||||
</span>
|
||||
<span class="dis" v-else>
|
||||
¥{{ formatDecimal(+item.lowPrice, 2, true) }}
|
||||
</span>
|
||||
<span v-if="item.discount_sale_amount">
|
||||
¥0.00
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="price" v-if="item.is_temporary">
|
||||
<span>
|
||||
¥{{ formatDecimal(+item.discount_sale_amount, 2, true) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="price" v-else>
|
||||
<template v-if="+item.discount_sale_amount">
|
||||
<span class="dis">
|
||||
¥{{ formatDecimal(item.lowPrice, 2, true) }}
|
||||
</span>
|
||||
<span>
|
||||
¥{{ formatDecimal(+item.discount_sale_amount, 2, true) }}
|
||||
</span>
|
||||
</template>
|
||||
<span v-else>
|
||||
¥{{ formatDecimal(+item.lowPrice, 2, true) }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="sku_list" v-if="item.sku_name">
|
||||
<div class="tag" v-for="item in item.sku_name.split(',')">
|
||||
{{ item }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="grooup_wrap" v-if="item.goods_type == 'package'">
|
||||
{{ item.group_type == 0 ? '固定套餐:' : '自选套餐:' }}
|
||||
<span>{{ item.group_text }}</span>
|
||||
</div>
|
||||
<div class="num">
|
||||
<div class="left">
|
||||
<div class="icon_item zen" v-if="item.is_gift">
|
||||
<span class="t">赠</span>
|
||||
</div>
|
||||
<div class="icon_item bao" v-if="item.is_pack">
|
||||
<span class="t">包</span>
|
||||
</div>
|
||||
<!-- <div class="icon_item tui" v-if="item.status == 'return'">
|
||||
<span class="t">退</span>
|
||||
</div> -->
|
||||
<div class="icon_item lin" v-if="item.is_temporary == 1">
|
||||
<span class="t">临</span>
|
||||
</div>
|
||||
<div class="icon_item zhe" v-if="item.discount_sale_amount > 0 && !item.is_temporary">
|
||||
<span class="t">折</span>
|
||||
</div>
|
||||
<div class="icon_item chu" v-if="item.is_print == 0">
|
||||
<span class="t">免厨打印</span>
|
||||
</div>
|
||||
</div>
|
||||
<el-text class="t">x{{ formatDecimal(+item.number, 2, true) }}</el-text>
|
||||
</div>
|
||||
<div>
|
||||
<CartItem :item="item" :index="index" v-for="(item, index) in goodsStore.cartList" :key="item.id" />
|
||||
</div>
|
||||
<template v-for="(arr, index) in goodsStore.orderList" :key="index">
|
||||
<el-divider v-if="arr.placeNum">{{ `第${arr.placeNum}次下单` }}</el-divider>
|
||||
<div class="item" :class="{ active: item.active }" :key="item.id" v-for="(item, i) in arr.info"
|
||||
@click="selectCartItemHandle(item, index, i)">
|
||||
<div class="name_wrap">
|
||||
<span>{{ item.name }}</span>
|
||||
<div class="price">
|
||||
<span :class="{ dis: item.discountSaleAmount }">¥{{ item.salePrice }}</span>
|
||||
<span v-if="item.discountSaleAmount">
|
||||
¥{{ formatDecimal(item.salePrice - item.discountSaleAmount, 2, true) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sku_list" v-if="item.skuName">
|
||||
<div class="tag" v-for="item in item.skuName.split(',')">
|
||||
{{ item }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="grooup_wrap" v-if="item.proGroupInfo">
|
||||
{{ item.groupType == 0 ? '固定套餐:' : '自选套餐:' }}
|
||||
<span>{{JSON.parse(item.proGroupInfo).map(item => item.proName).join('、')}}</span>
|
||||
</div>
|
||||
<div class="num">
|
||||
<div class="left">
|
||||
<div class="icon_item zen" v-if="item.is_gift" @click="giftPackHandle('isGift', item)">
|
||||
<span class="t">赠</span>
|
||||
</div>
|
||||
<div class="icon_item bao" v-if="item.is_pack" @click="giftPackHandle('isPack', item)">
|
||||
<span class="t">包</span>
|
||||
</div>
|
||||
<div class="icon_item tui" v-if="item.status == 'return'">
|
||||
<span class="t">退</span>
|
||||
</div>
|
||||
<div class="icon_item lin" v-if="item.isTemporary == 1">
|
||||
<span class="t">临</span>
|
||||
</div>
|
||||
<div class="icon_item zhe" v-if="item.discountSaleAmount">
|
||||
<span class="t">折</span>
|
||||
</div>
|
||||
<div class="icon_item chu" v-if="item.isPrint == 0">
|
||||
<span class="t">免厨打印</span>
|
||||
</div>
|
||||
</div>
|
||||
<el-text class="t">X{{ formatDecimal(item.number, 2, true) }}</el-text>
|
||||
</div>
|
||||
<div class="empty" v-if="!goodsStore.cartList.length">
|
||||
<el-empty description="请选择商品" />
|
||||
</div>
|
||||
<div class="order_list_wrap">
|
||||
<div class="order_title" v-if="goodsStore.orderList.length">历史下单</div>
|
||||
<div class="order_list_item" v-for="(arr, index) in goodsStore.orderList" :key="index">
|
||||
<div class="order_num">{{ `第${arr.orderNum}次下单` }}</div>
|
||||
<CartItem type="order" :border="false" :item="item" :index="index" :i="i" :key="item.id"
|
||||
v-for="(item, i) in arr.goods" />
|
||||
</div>
|
||||
</template>
|
||||
<div class="empty">
|
||||
<el-empty description="请选择商品" v-if="!goodsStore.cartList.length" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- 购物车操作栏 -->
|
||||
@@ -183,48 +76,44 @@
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div class="top">
|
||||
<div class="left" @click="allSelectedHandle" v-if="store.shopInfo.eatModel == 'take-out'">
|
||||
<div class="selected">
|
||||
<div class="selected_round" v-if="!allSelected"></div>
|
||||
<el-icon class="icon" v-else>
|
||||
<CircleCheckFilled />
|
||||
</el-icon>
|
||||
</div>
|
||||
<el-text class="t">打包(¥{{ cartInfo.packAmount || 0 }})</el-text>
|
||||
</div>
|
||||
<div class="left" v-else></div>
|
||||
<div class="num-wrap">
|
||||
<div class="num_wrap_top">
|
||||
共<el-text>
|
||||
{{ goodsStore.cartInfo.total }}件
|
||||
</el-text>,¥{{ formatDecimal(goodsStore.cartInfo.totalAmount || 0) }}
|
||||
<div class="left" @click="allSelectedHandle" v-if="store.shopInfo.eatModel.includes('take-out')">
|
||||
<div class="selected">
|
||||
<div class="selected_round" v-if="!allSelected"></div>
|
||||
<el-icon class="icon" v-else>
|
||||
<CircleCheckFilled />
|
||||
</el-icon>
|
||||
</div>
|
||||
<el-text class="t">外带</el-text>
|
||||
</div>
|
||||
<div class="left" v-else></div>
|
||||
<div class="right">
|
||||
共<el-text>
|
||||
{{ goodsStore.cartInfo.total }}件
|
||||
</el-text>,¥{{ formatDecimal(goodsStore.cartInfo.totalAmount || 0) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="num_wrap_btm">
|
||||
<span v-if="goodsStore.cartInfo.gifNumberAmount">赠送:{{ formatDecimal(goodsStore.cartInfo.gifNumberAmount
|
||||
|| 0, 2, true)
|
||||
}}元</span>
|
||||
<span v-if="goodsStore.cartInfo.gifNumberAmount && goodsStore.cartInfo.saleNumberAmount">,</span>
|
||||
<span v-if="goodsStore.cartInfo.saleNumberAmount">改价优惠:{{
|
||||
formatDecimal(goodsStore.cartInfo.saleNumberAmount
|
||||
|| 0, 2, true)
|
||||
}}元</span>
|
||||
{{ goodsStore.cartInfo.discountInfo }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btm">
|
||||
<el-button icon="Edit" @click="remarkRef.show()"></el-button>
|
||||
<div class="button">
|
||||
<div class="btn" v-if="store.shopInfo.registerType == 'restaurant'">
|
||||
<el-button type="primary" style="width: 100%;" :disabled="!cartList.length" v-loading="createOrderLoading"
|
||||
@click="createOrderHandle(0)">
|
||||
<div class="btn" v-if="store.shopInfo.registerType == 'after'">
|
||||
<el-button type="primary" style="width: 100%;" :disabled="!goodsStore.cartList.length"
|
||||
v-loading="createOrderLoading" @click="createOrderHandle(0)">
|
||||
<template v-if="!createOrderLoading">
|
||||
仅下单</template>
|
||||
<template v-else>下单中...</template>
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="btn" v-if="store.shopInfo.registerType != 'restaurant' || goodsStore.cartList.length">
|
||||
<el-button type="primary" style="width: 100%;" :disabled="!goodsStore.cartList.length"
|
||||
v-loading="createOrderLoading" @click="createOrderHandle(1)">
|
||||
<div class="btn">
|
||||
<el-button type="primary" style="width: 100%;"
|
||||
:disabled="!goodsStore.cartList.length && !goodsStore.orderList.length" v-loading="createOrderLoading"
|
||||
@click="createOrderHandle(1)">
|
||||
<template v-if="!createOrderLoading">
|
||||
去结算</template>
|
||||
<template v-else>下单中...</template>
|
||||
@@ -257,8 +146,6 @@
|
||||
<pendingCartModal ref="pendingCartModalRef" @select="pendingCartHandle" />
|
||||
<!-- 检查版本升级 -->
|
||||
<updateDialog />
|
||||
<!-- 合并/转桌 -->
|
||||
<tableMerging ref="tableMergingRef" @success="" />
|
||||
<!-- 选择会员 -->
|
||||
<SelectVipUser ref="SelectVipUserRef" />
|
||||
</template>
|
||||
@@ -282,6 +169,7 @@ import settleAccount from "@/views/home/components/settleAccount.vue";
|
||||
import fastCashier from "@/views/home/components/fastCashier.vue";
|
||||
import pendingCartModal from "@/views/home/components/pendingCartModal.vue";
|
||||
import tableMerging from '@/views/home/components/tableMerging.vue'
|
||||
import CartItem from './components/cartItem.vue'
|
||||
import useStorage from '@/utils/useStorage'
|
||||
import { formatDecimal } from '@/utils/index.js'
|
||||
import { useGoods } from '@/store/goods.js'
|
||||
@@ -294,8 +182,6 @@ import goods from "@/views/home/components/goods.vue";
|
||||
import member from "@/views/member/index.vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
import TableMerging from "./components/tableMerging.vue";
|
||||
|
||||
const SelectVipUserRef = ref(null)
|
||||
|
||||
|
||||
@@ -340,27 +226,42 @@ async function quickCashHandle() {
|
||||
}
|
||||
}
|
||||
|
||||
// 生成订单
|
||||
// 生成订单 t=0 先下单后结算 t=1直接结算
|
||||
async function createOrderHandle(t = 0) {
|
||||
try {
|
||||
createOrderLoading.value = true;
|
||||
const res = await createOrder({
|
||||
orderId: goodsStore.orderList.length ? goodsStore.orderList[0].id : '', // 订单id
|
||||
shopId: store.shopInfo.id, // 店铺id
|
||||
seatNum: goodsStore.tableInfo.num || 0, // 用餐人数
|
||||
packFee: 0, // 打包费
|
||||
originAmount: formatDecimal(goodsStore.cartInfo.totalAmount, 2, true), // 订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
tableCode: goodsStore.cartList[0].table_code, // 台桌号
|
||||
dineMode: store.shopInfo.eatModel, // 用餐方式
|
||||
remark: remark.value, // 备注
|
||||
placeNumplaceNum: goodsStore.orderList.length, // 下单次数
|
||||
waitCall: 0,//是否叫号
|
||||
userId: '', // 会员用户id
|
||||
vipPrice: 0, // 会员价
|
||||
})
|
||||
if (goodsStore.cartList.length) {
|
||||
const data = {
|
||||
orderId: goodsStore.orderListInfo.id || '', // 订单id
|
||||
shopId: store.shopInfo.id, // 店铺id
|
||||
seatNum: goodsStore.tableInfo.num || 0, // 用餐人数
|
||||
seatAmount: goodsStore.cartInfo.tableFee, // 餐位费
|
||||
packFee: goodsStore.cartInfo.packFee, // 打包费
|
||||
originAmount: formatDecimal(+goodsStore.cartInfo.totalAmount, 2, true), // 订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
tableCode: goodsStore.cartList[0].table_code, // 台桌号
|
||||
dineMode: allSelected.value ? store.shopInfo.eatModel.split(',')[1] : store.shopInfo.eatModel.split(',')[0], // 用餐方式
|
||||
remark: remark.value, // 备注
|
||||
placeNum: (goodsStore.orderListInfo.placeNum || 0) + 1, // 下单次数
|
||||
waitCall: 0,//是否叫号
|
||||
userId: '', // 会员用户id
|
||||
vipPrice: 0, // 会员价
|
||||
}
|
||||
|
||||
goodsStore.orderInfo = res
|
||||
settleAccountRef.value.show()
|
||||
createOrderLoading.value = true;
|
||||
const res = await createOrder(data)
|
||||
// 设置订单信息
|
||||
goodsStore.orderListInfo = res
|
||||
|
||||
if (t == 1) {
|
||||
settleAccountRef.value.show(t)
|
||||
} else {
|
||||
goodsStore.historyOrderAjax(res.tableCode)
|
||||
}
|
||||
|
||||
// 订单已生成,清除购物车
|
||||
goodsStore.clearCart()
|
||||
} else {
|
||||
settleAccountRef.value.show(t)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
@@ -400,13 +301,7 @@ function giftPackHandle(key, item) {
|
||||
|
||||
// 打包全选
|
||||
const allSelectedHandle = async () => {
|
||||
if (!cartList.value.length) return;
|
||||
allSelected.value = !allSelected.value;
|
||||
await packall({
|
||||
shopId: store.userInfo.shopId,
|
||||
status: allSelected.value,
|
||||
});
|
||||
// 这里需要更新购物车
|
||||
};
|
||||
|
||||
// 购物车选中
|
||||
@@ -428,6 +323,29 @@ function showTableMerging() {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.order_list_wrap {
|
||||
.order_list_item {
|
||||
&:not(:last-child) {
|
||||
border-bottom: 1px solid #ececec;
|
||||
}
|
||||
}
|
||||
|
||||
.order_title {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
padding: 10px 0;
|
||||
border-top: 1px solid #ececec;
|
||||
}
|
||||
|
||||
.order_num {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
padding: var(--el-font-size-base) var(--el-font-size-base) 0;
|
||||
}
|
||||
}
|
||||
|
||||
.cart_wrap {
|
||||
flex: 1.5;
|
||||
height: 100%;
|
||||
@@ -460,6 +378,7 @@ function showTableMerging() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.number {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
@@ -690,37 +609,6 @@ function showTableMerging() {
|
||||
padding: 10px var(--el-font-size-base);
|
||||
border-top: 1px solid #ececec;
|
||||
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.selected {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
top: 1px;
|
||||
|
||||
.icon {
|
||||
display: block;
|
||||
font-size: var(--el-font-size-base);
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
.selected_round {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
}
|
||||
|
||||
.t {
|
||||
margin-left: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
.num-wrap {
|
||||
height: 40px;
|
||||
display: flex;
|
||||
@@ -729,7 +617,39 @@ function showTableMerging() {
|
||||
.num_wrap_top {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.selected {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
top: 1px;
|
||||
|
||||
.icon {
|
||||
display: block;
|
||||
font-size: var(--el-font-size-base);
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
.selected_round {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
}
|
||||
|
||||
.t {
|
||||
margin-left: 6px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.num_wrap_btm {
|
||||
@@ -741,11 +661,6 @@ function showTableMerging() {
|
||||
}
|
||||
}
|
||||
|
||||
.top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.btm {
|
||||
$h: 70px;
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user