对接购物车

This commit is contained in:
gyq
2025-02-26 18:06:37 +08:00
parent 44144c5ac7
commit d3ed4ec8e6
27 changed files with 2589 additions and 1629 deletions

View File

@@ -92,10 +92,9 @@ import { formatDecimal } from '@/utils/index.js'
import settleAccount from "@/views/home/components/settleAccount.vue";
import { ElMessage } from 'element-plus'
import { clearTable } from '@/api/table.js'
import { useShop } from '@/store/shop.js'
const shopStore = useShop()
import { useGoods } from "@/store/goods.js";
const goodsStore = useGoods()
const router = useRouter()
const global = useGlobal()
const store = useUser()
@@ -146,7 +145,7 @@ function showPayHandle() {
// 显示就就餐人数
function showPeopleNumHandle() {
if (shopStore.info.isTableFee == 1) {
if (store.shopInfo.isTableFee == 1) {
orderDownHandle()
} else {
showPeopleNum.value = true
@@ -215,8 +214,14 @@ function orderDownHandle() {
// return
// }
// }
// 直接点单
global.setOrderTable({
if (!props.tableInfo.tableCode) {
ElMessage.error('请绑定桌码后操作')
return
}
// 选择完人数后跳转首页
goodsStore.selectTable({
...props.tableInfo,
num: peopleNum.value
})

View File

@@ -14,7 +14,7 @@
</div>
<div class="tab_container">
<div class="tab_head">
<el-radio-group v-model="area" @change="queryShopTableAjax">
<el-radio-group v-model="area" @change="shopTableAjax">
<el-radio-button label="全部" value=""></el-radio-button>
<el-radio-button :label="item.name" :value="item.id" v-for="item in areaList"
:key="item.id"></el-radio-button>
@@ -62,6 +62,7 @@
<script setup>
import { queryShopArea, queryShopTable } from '@/api/table'
import { shopArea, shopTable } from "@/api/account.js";
import countCard from '@/views/table/components/countCard.vue'
import tableInfo from '@/views/table/components/tableInfo.vue'
@@ -107,7 +108,7 @@ const slectTable = ref('')
// 切换类型
function tabChange(item, index) {
tabActive.value = index
queryShopTableAjax()
shopTableAjax()
}
// 计算当前的时间差
@@ -118,7 +119,7 @@ function countTime(t) {
// 支付成功,刷新状态
async function paySuccess() {
await queryShopTableAjax()
await shopTableAjax()
slectTableHandle(tableItemActive.value, tableList.value[tableItemActive.value])
}
@@ -140,29 +141,29 @@ function slectTableClose() {
}
// 获取台桌区域
async function queryShopAreaAjax() {
async function shopAreaAjax() {
try {
const res = await queryShopArea({
shopId: store.userInfo.shopId
const res = await shopArea({
page: 1,
size: 500
})
areaList.value = res
areaList.value = res.records
} catch (error) {
console.log(error)
}
}
// 获取台桌列表
async function queryShopTableAjax() {
async function shopTableAjax() {
try {
loading.value = true
const res = await queryShopTable({
shopId: store.userInfo.shopId,
const res = await shopTable({
areaId: area.value,
tableCode: '',
name: '',
status: tabAreas.value[tabActive.value].type,
page: 1,
pageSize: 500
})
tableList.value = res.list
tableList.value = res.records
setTimeout(() => {
loading.value = false
}, 500)
@@ -173,8 +174,8 @@ async function queryShopTableAjax() {
}
onMounted(() => {
queryShopAreaAjax()
queryShopTableAjax()
shopAreaAjax()
shopTableAjax()
})
</script>