This commit is contained in:
2024-10-28 09:23:22 +08:00
23 changed files with 538 additions and 226 deletions

74
commons/goodsData.js Normal file
View File

@@ -0,0 +1,74 @@
import dayjs from "dayjs";
export const $types = [{
title: "计量商品",
desc: '单价购买',
value: 'normal'
},
{
title: "多规格",
desc: '多种不同规格',
value: 'sku'
},
{
title: "套餐组合",
desc: '选择多种组合',
value: 'group'
},
{
title: "称重商品",
desc: '按重量售卖',
value: 'weight'
},
{
title: "时价商品",
desc: '收银端可更改价格',
value: 'currentPrice'
}
]
// 商品默认sku
export const $defaultSku = {
salePrice: '',
memberPrice: '',
costPrice: '',
originPrice: '',
// stockNumber: '',
firstShared: '',
suit: 1,
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}`,
}
// 库存记录筛选类型
export const $invoicingType = [{
text: '全部',
value: ''
},
{
text: '供应商入库',
value: 'purveyor'
},
{
text: '供应商退货',
value: 'reject'
},
{
text: '其他入库',
value: 'purchase'
},
{
text: '其他出库',
value: 'other-out'
}
]
// 页面常用数据
export const $pageData = {
query: {
page: 0,
size: 10
},
totalElements: 0,
list: [],
hasAjax: false,
}

View File

@@ -30,5 +30,9 @@ export const $status = {
cleaning: {
label: "待清台",
type: "#FAAD14",
}
},
unbind: {
label: "未绑定",
type: "rgb(221,221,221)",
}
}

View File

@@ -15,6 +15,7 @@ import {
} from '@/commons/utils/encryptUtil.js'
import infoBox from "@/commons/utils/infoBox.js"
import go from '@/commons/utils/go.js';
import { reject } from 'lodash';
// 测试服
let baseUrl = 'https://admintestpapi.sxczgkj.cn'
@@ -127,8 +128,9 @@ function commonsProcess(showLoading, httpReqCallback) {
}).catch(res => {
if(res.status==401){
storageManage.token(null, true)
infoBox.showErrorToast('请登录').then(() => {
go.to("PAGES_LOGIN", {}, go.GO_TYPE_RELAUNCH)
infoBox.showErrorToast(res.message||'请登录').then(() => {
uni.redirectTo({url: '/pages/login/index'})
reject()
})
}
// if(res.status==400){
@@ -138,9 +140,7 @@ function commonsProcess(showLoading, httpReqCallback) {
// })
// }
if(res.status==500){
storageManage.token(null, true)
infoBox.showErrorToast('请登录').then(() => {
go.to("PAGES_LOGIN", {}, go.GO_TYPE_RELAUNCH)
infoBox.showErrorToast(res.message||'服务器异常').then(() => {
})
}
// if(res&&res.msg){

View File

@@ -1,6 +1,6 @@
// 桌台管理
import http from './http.js'
const request=http.request
const request = http.request
import $API from '@/http/classApi.js'
import appConfig from '@/config/appConfig.js'
import {
@@ -9,9 +9,9 @@ import {
import infoBox from '@/commons/utils/infoBox.js'
/* 台桌区域 */
export const $tableArea=new $API('/api/tbShopArea',http.req)
export const $tableArea = new $API('/api/tbShopArea', http.req)
/* 台桌 */
export const $table=new $API('/api/tbShopTable',http.req)
export const $table = new $API('/api/tbShopTable', http.req)
/* 绑定 */
// export const $bind=new $API('/api/tbShopTable/bind',http.req)
export function $bind(data) {
@@ -23,4 +23,28 @@ export function $bind(data) {
...data
}
});
}
//获取台桌详情状态
export function $returnTableDetail(data) {
return request({
url: '/api/tbShopTable/state',
method: "get",
params: {
shopId: uni.getStorageSync('shopId'),
...data
}
});
}
// 选择台桌
export function $choseTable(data) {
return request({
url: '/api/place/choseTable',
method: "put",
data: {
shopId: uni.getStorageSync('shopId'),
...data
}
});
}

View File

@@ -130,7 +130,7 @@
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "wxcbff1cfb27c1066c",
"appid" : "wxcf0fe8cdba153fd6",
"setting" : {
"urlCheck" : false,
"minified" : true,

View File

@@ -930,7 +930,7 @@
import {
$types,
$defaultSku
} from '../goodsData.js'
} from '@/commons/goodsData.js'
import {
$getProductDetail,
$tbShopCategory,

View File

@@ -546,7 +546,7 @@
import {
$types,
$defaultSku
} from '../goodsData.js'
} from '@/commons/goodsData.js'
import {
$getProductDetail,
$tbShopCategory,

View File

@@ -183,8 +183,9 @@
import go from '@/commons/utils/go.js';
import color from '@/commons/color.js';
import {
$types,
$defaultSku
} from '../goodsData.js'
} from '@/commons/goodsData.js'
import {
$productSpec
} from '@/http/yskApi/goods.js';

View File

@@ -78,7 +78,8 @@
import listItem from './components/list-item';
import {
$pageData
} from '../goodsData.js'
} from '@/commons/goodsData.js'
import {
computed,
reactive,

View File

@@ -93,8 +93,9 @@
$getProductDetail,
$getProductStockDetail,$getProductStockDetailSum
} from '@/http/yskApi/goods.js'
import {$invoicingType} from '../goodsData.js'
import {
$invoicingType
} from '@/commons/goodsData.js'
const search = reactive({
keyword: '',
show: false

View File

@@ -1,6 +1,6 @@
import {
$types
} from '@/pageProduct/goodsData.js'
} from '@/commons/goodsData.js'
export function returnSkuSnap(goods) {
const selectSpec = typeof goods.selectSpec === 'string' ? JSON.parse(goods.selectSpec) : goods.selectSpec
let result = selectSpec.map(v => {

View File

@@ -22,7 +22,7 @@
<input v-model="search.keyword" @confirm="searchConfirm" type="text"
placeholder-style="font-size:28rpx;" placeholder="搜索" />
</view>
<view @tap.stop="hideSearch" v-if="search.show">取消</view>
<view @tap.stop="clearSearch" v-if="search.show">取消</view>
</view>
</view>
<view :style="{height:times.show?timesHeight:0}" class="tranistion status overflow-hide">
@@ -34,7 +34,7 @@
<view :style="{height: status.bottomHeight+'px'}"></view>
</view>
<view :style="{height:status.show?statusHeight:0}" class="tranistion status overflow-hide">
<view @tap="changestatusActive(index)" class="u-flex u-p-l-30 lh30 u-p-r-30 u-row-between"
<view @tap="changestatusActive(index,item)" class="u-flex u-p-l-30 lh30 u-p-r-30 u-row-between"
v-for="(item,index) in status.list" :key="index">
<view>{{item.label}}</view>
<uni-icons v-if="status.active===index" type="checkmarkempty" :color="color.ColorMain"></uni-icons>
@@ -54,11 +54,18 @@
</view>
</view>
</view>
<view class="u-m-t-30 u-flex u-flex-wrap u-row-between">
<view class="u-m-b-30" v-for="(item,index) in tables.list" :key="index">
<table-item @bind="unBind" @update="getTable" :areaMap="areaMap" @more="moreShow(item)" :data="item"></table-item>
</view>
<view class="u-m-t-30 ">
<template v-if="tables.list.length">
<view class="u-flex u-flex-wrap u-row-between">
<view class="u-m-b-30" v-for="(item,index) in tables.list" :key="index">
<table-item @bind="unBind" @update="getTable" :areaMap="areaMap" @more="moreShow(item)" :data="item"></table-item>
</view>
</view>
<my-pagination :page="query.page" :totalElements="query.totalElements" :size="query.size"
@change="pageChange"></my-pagination>
</template>
<my-img-empty v-if="tables.hasAjax&&!tables.list.length" tips="未找到相关桌台"></my-img-empty>
</view>
</view>
@@ -239,12 +246,16 @@
function searchConfirm() {
hideSearch()
filterTableList()
query.page=1;
getTable()
// tables.list = tables.originList.filter((v) =>
// v.name.includes(search.keyword.trim())
// );
}
function clearSearch(){
search.keyword=''
hideSearch()
}
function hideSearch() {
search.show = false
maskHide()
@@ -372,10 +383,17 @@
mask.value.close()
}
const query = {
page: 0,
const query = reactive({
page: 1,
size: 10,
areaId: 0
areaId: 0,
totalElements:0
})
// 页数改变事件
function pageChange(page) {
console.log(page);
query.page = page
getTable()
}
const tables = reactive({
hasAjax: false,
@@ -392,12 +410,14 @@
query.areaId = item.id
}
async function getTable() {
let state=status.list[status.active].key
state=state?(state=='all'?'':state):''
const {
content
} = await $table.get(query)
content,total
} = await $table.get({...query,name:search.keyword,state})
tables.hasAjax = true
tables.originList = content
filterTableList()
query.totalElements=total||0
tables.list = content
}
const areaMap = ref({})
async function getArea() {
@@ -415,28 +435,19 @@
}
watch(() => tables.area.sel, (newval) => {
console.log(newval);
query.page = 0
query.page = 1
getTable()
})
watch(() => status.active, (newval) => {
query.page = 0
query.page = 1
// if (newval === 0) {
// return tables.list = tables.originList
// }
// tables.list = tables.originList.filter((v) => {
// return v.status == status.list[status.active].key
// });
filterTableList()
getTable()
})
function filterTableList() {
tables.list = tables.originList.filter((v) => {
console.log(status.list[status.active].key);
return (status.active == 0 ? true : v.status == status.list[status.active].key) && (
v.name.includes(search.keyword.trim())
)
});
}
watch(() => times.active, (newval) => {
setTimer()
})

View File

@@ -239,14 +239,10 @@
})
// #ifdef H5
// vdata.formData.username = '15699991111'
// vdata.formData.pwd = '123456'
vdata.formData.username = ''
vdata.formData.pwd = ''
vdata.formData.username = '17792050546'
vdata.formData.pwd = 'sy666888'
// #endif
// #ifdef MP-WEIXIN
vdata.formData.username = ''
vdata.formData.pwd = ''
// vdata.formData.username = '15699991111'
// vdata.formData.pwd = 'qwer1234'
// #endif

View File

@@ -4,7 +4,7 @@
<view class="search bg-fff u-flex u-col-center ">
<view class="u-flex-1">
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="输入桌号" @confirm="search"
v-model="searchValue">
v-model="searchValue">
</uni-search-bar>
</view>
<!-- <view class="u-flex">
@@ -24,27 +24,33 @@
<view class="list ">
<view class=" bg-fff box bg-fff">
<view class="u-flex item u-row-between" v-for="(item,index) in tables.list" :key="index"
@tap="chooseTable(index,item)">
<view class="u-flex">
<view class="">
<view class="u-flex">
<view>{{item.name}}</view>
<view class="line"></view>
<view>{{''}}</view>
<template v-if="tables.list.length">
<view class="u-flex item u-row-between" v-for="(item,index) in tables.list" :key="index"
@tap="chooseTable(index,item)">
<view class="u-flex">
<view class="">
<view class="u-flex">
<view>{{item.name}}</view>
<view class="line"></view>
<view>{{''}}</view>
</view>
<view class="color-999 u-font-24 u-m-t-12">
<text
:style="{color:returnStutasColor(item.status)}">{{returnStutasText(item.status)}}</text>
</view>
</view>
<view class="color-999 u-font-24 u-m-t-12">
<text
:style="{color:returnStutasColor(item.status)}">{{returnStutasText(item.status)}}</text>
</view>
<view class="my-radio u-font-28 u-flex color-333">
<view class="circle u-flex u-row-center" :class="{active:index==tables.selIndex}">
<uni-icons type="checkmarkempty" :size="16" color="#fff"></uni-icons>
</view>
</view>
</view>
<view class="my-radio u-font-28 u-flex color-333">
<view class="circle u-flex u-row-center" :class="{active:index==tables.selIndex}">
<uni-icons type="checkmarkempty" :size="16" color="#fff"></uni-icons>
</view>
</view>
</view>
<my-pagination :page="query.page" :totalElements="query.totalElements" :size="query.size"
@change="pageChange"></my-pagination>
</template>
<template v-if="tables.list.length<=0">
<my-img-empty tips="未找到相关的桌台"></my-img-empty>
</template>
@@ -94,10 +100,13 @@
uni.navigateBack()
}, 100)
}
let searchValue=ref('')
function search(){
let searchValue = ref('')
function search() {
query.page=1
getTable()
}
function chooseTable(index, item) {
if (item.status == 'closed') {
return uni.showToast({
@@ -109,7 +118,7 @@
nouser.value = true
return emitChooeTable()
} else {
tables.selIndex=index
tables.selIndex = index
emitChooeTable(item)
}
}
@@ -128,11 +137,20 @@
function areaChange(e) {
area.defaultCateIndex = e.detail.value
area.sel = area.list[e.detail.value]
query.page=1
getTable()
}
const query = {
page: 0,
size: 100,
areaId: 0
page: 1,
size: 10,
areaId: 0,
totalElements:0
}
// 页数改变事件
function pageChange(page) {
console.log(page);
query.page = page
getTable()
}
const tables = reactive({
hasAjax: false,
@@ -141,15 +159,15 @@
list: []
})
async function getTable() {
// let state=status.list[status.active].key
// state=state?(state=='all'?'':state):''
const areaId=area.list[area.defaultCateIndex].id
let {
content
} = await $table.get(query)
tables.hasAjax = true
content = content.filter(v =>{
// return v.status == 'idle'||(v.status=='using')
return v.status == 'idle'
})
console.log(content );
content,total
} = await $table.get({...query,areaId,name:searchValue.value,state:'idle'})
query.totalElements=total||0;
tables.hasAjax = true;
console.log(content);
tables.list = content
tables.selIndex = content.findIndex(v => v.tableId == option.tableId)
tables.originList = content
@@ -172,11 +190,7 @@
}
watch(() => area.sel, (newval) => {
if(!newval){
tables.list = tables.originList
return
}
tables.list = tables.originList.filter(v => v.areaId == newval.id)
getTable()
})
let option = {}
onLoad(opt => {
@@ -197,11 +211,12 @@
}
.my-radio {
.circle {
background: #FFFFFF;
width: 18px;
height: 18px;
&.active {
background-color: $my-main-color;
border-color: $my-main-color;
@@ -225,11 +240,14 @@
.scale7 {
transform: scale(0.7);
}
::v-deep .uni-searchbar{
padding: 0!important;
::v-deep .uni-searchbar {
padding: 0 !important;
}
.search {
padding: 20rpx 28rpx 20rpx 28rpx;
.icon-saoma {
margin-left: 20rpx;
width: 34rpx;
@@ -239,6 +257,7 @@
.list {
padding: 32rpx 24rpx;
.no-choose {
padding: 36rpx 30rpx 36rpx 24rpx;
}

View File

@@ -3,6 +3,7 @@
<view class="search bg-fff u-flex u-col-center ">
<view class="u-flex-1">
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="搜索" @confirm="search"
@clear="search"
v-model="query.name">
</uni-search-bar>
</view>
@@ -15,33 +16,44 @@
<view>不选择用户</view>
<my-radio v-model="nouser" :size="18" border-color="#d1d1d1" @change="chooseUser"></my-radio>
</view>
<view class="u-m-t-32 bg-fff box bg-fff">
<view class="u-flex item u-row-between" v-for="(item,index) in list" :key="index"
@tap="chooseUser(index,item)">
<view class="u-flex">
<view class="headimg u-flex u-row-center u-col-center">
<image v-if="item.headImg" :src="item.headImg" class="img" mode=""></image>
</view>
<view class="u-m-l-32">
<view>{{item.nickName}}</view>
<view class=" u-font-24 u-m-t-12 u-flex">
<text class="color-999" v-if="!item.isVip">非会员</text>
<text class="color-main" v-else>会员</text>
<view class="u-m-l-30 u-flex">
<text class="">余额</text>
<text class="color-main">{{item.amount}}</text>
</view>
<view class="u-m-l-30 u-flex">
<text class="">积分</text>
<text class="color-main">{{item.totalScore}}</text>
<template v-if="list.length>0">
<view class="u-m-t-32 bg-fff box bg-fff">
<view class="u-flex item u-row-between" v-for="(item,index) in list" :key="index"
@tap="chooseUser(index,item)">
<view class="u-flex">
<view class="headimg u-flex u-row-center u-col-center">
<image v-if="item.headImg" :src="item.headImg" class="img" mode=""></image>
</view>
<view class="u-m-l-32">
<view>{{item.nickName}}</view>
<view class=" u-font-24 u-m-t-12 u-flex">
<text class="color-999" v-if="!item.isVip">会员</text>
<text class="color-main" v-else>会员</text>
<view class="u-m-l-30 u-flex">
<text class="">余额</text>
<text class="color-main">{{item.amount}}</text>
</view>
<view class="u-m-l-30 u-flex">
<text class="">积分</text>
<text class="color-main">{{item.totalScore}}</text>
</view>
</view>
</view>
</view>
<my-radio @change="chooseUser(index,item)" v-model="item.checked" :size="18"
border-color="#d1d1d1"></my-radio>
</view>
<my-radio @change="chooseUser(index,item)" v-model="item.checked" :size="18"
border-color="#d1d1d1"></my-radio>
</view>
</view>
<view class="u-m-t-32">
<my-pagination :page="query.page" :totalElements="query.totalElements" :size="query.size"
@change="pageChange"></my-pagination>
</view>
</template>
<template v-if="hasAjax&&list.length<=0">
<my-img-empty tips="未找到相关用户"></my-img-empty>
</template>
</view>
@@ -54,20 +66,23 @@
onLoad
} from '@dcloudio/uni-app'
import {
reactive,onBeforeMount,
reactive,
onBeforeMount,
ref
} from 'vue';
let nouser = ref(false)
let timer=null
let timer = null
function emitChooser(data) {
uni.$emit('choose-user', data)
timer=setTimeout(() => {
timer = setTimeout(() => {
uni.navigateBack()
}, 100)
}
onBeforeMount(()=>{
onBeforeMount(() => {
clearInterval(timer)
})
function chooseUser(index, item) {
if (index === undefined || item === undefined) {
nouser.value = true
@@ -85,28 +100,38 @@
}
const query = reactive({
page: 0,
page: 1,
name: '',
size: 300,
isVip:1
totalElements: 0,
size: 10,
isVip: 1
})
const list = reactive([])
let hasAjax=ref(false)
async function getUser() {
const {
content
content,
totalElements
} = await Api.queryAllShopUser(query)
hasAjax.value=true
list.length=content.length
for (let i in content) {
list.push({
list[i]={
...content[i],
checked: false
})
}
}
query.totalElements = totalElements
console.log(list);
}
function pageChange(e) {
query.page=e
getUser()
}
function search() {
query.page = 0
list.length = 0
query.page = 1
getUser()
}
onLoad(() => {

View File

@@ -1,7 +1,7 @@
<template>
<view class="page-gray color-333 u-font-28">
<template v-if="true">
<view class="block u-p-t-32 u-p-b-32">
<view class="block u-p-t-32 u-p-b-32" v-if="table&&table.tableId">
<view>桌位号</view>
<view class="font-bold u-font-32 u-m-t-16">
{{table.name||''}}

View File

@@ -63,8 +63,9 @@
</view>
<up-modal title="提示" content="是否清空全部已添加的商品?" :show="modal.clear" showCancelButton closeOnClickOverlay @confirm="confirmModelConfirm"
@cancel="setModalShow('clear',false)" @close="setModalShow('clear',false)" width="300px"></up-modal>
<up-modal title="提示" content="是否清空全部已添加的商品?" :show="modal.clear" showCancelButton closeOnClickOverlay
@confirm="confirmModelConfirm" @cancel="setModalShow('clear',false)" @close="setModalShow('clear',false)"
width="300px"></up-modal>
</view>
</template>
@@ -114,7 +115,7 @@
})
const modal = reactive({
key: '',
clear:false
clear: false
})
function confirmModelConfirm() {
@@ -124,7 +125,7 @@
}
function setModalShow(key = 'show', show = true) {
if (key == 'clear'&&show&&props.data.length<=0) {
if (key == 'clear' && show && props.data.length <= 0) {
return infoBox.showToast('购物车是空的!')
}
modal.key = key
@@ -132,7 +133,7 @@
console.log(modal);
}
const edmits = defineEmits(['clear', 'updateNumber'])
@@ -163,6 +164,13 @@
status,
type
} = props.table
if (props.table.tableId == '') {
go.to('PAGES_CONFIRM_ORDER', {
masterId: props.masterId,
isCreateOrderToDetail: props.isCreateOrderToDetail ? 1 : 0
})
return
}
go.to('PAGES_CONFIRM_ORDER', {
masterId: props.masterId,
type,
@@ -200,7 +208,7 @@
}
function clear() {
setModalShow('clear',false)
setModalShow('clear', false)
edmits('clear')
hideGoods()
}

View File

@@ -53,6 +53,7 @@
toRefs,
watch
} from 'vue';
import util from '../util.js';
const props = defineProps({
img:{
type:Object,
@@ -99,7 +100,7 @@
}
return (
item.isPauseSale ||
(item.typeEnum !== "sku" && item.specList[0].stockNumber <= 0)
(item.typeEnum !== "sku" && item.isStock==1&& item.stockNumber <= 0)
);
})

View File

@@ -103,8 +103,8 @@
<list-goods-item :img="{width:'330rpx',height:'330rpx'}"
@chooseGuige="chooseGuige(goodsItem.goodsIndex,goodsItem.index)"
@add="searchGoodsUpdate(goodsItem,goodsIndex,true)"
@reduce="searchGoodsUpdate(goodsItem,goodsIndex,false)" :index="goodsItem.goodsIndex"
:data="goodsItem"></list-goods-item>
@reduce="searchGoodsUpdate(goodsItem,goodsIndex,false)"
:index="goodsItem.goodsIndex" :data="goodsItem"></list-goods-item>
</view>
</view>
@@ -122,20 +122,27 @@
</view>
<!-- 选择规格 -->
<guige-model @update-sku="updateSkuSel" @confirm="guigeConfirm" ref="chooseGuigeModel"
:goodsData="selGoods"
<guige-model @update-sku="updateSkuSel" @confirm="guigeConfirm" ref="chooseGuigeModel" :goodsData="selGoods"
:title="guigeModelData.title" :sku-map="guigeModelData.chooseGoods.skuMap"
:skus="guigeModelData.chooseGoods.skus"></guige-model>
<!-- 添加附加费 -->
<my-surcharge @confirm="surchargeConfirm" ref="surcharge" title="添加附加费"></my-surcharge>
</view>
</view>
<up-modal title="提示" content="该台桌购物车里有商品,是否清除该台桌里的商品?" :show="modal.clear" showCancelButton closeOnClickOverlay
@confirm="confirmModelConfirm" @cancel="confirmModelConfirm('cancel')" @close="setModalShow('clear',false)"
width="300px">
</up-modal>
</template>
<script setup>
import _ from 'lodash';
import * as Api from '@/http/yskApi/Instead.js'
import {
$table
$table,
$choseTable,
$returnTableDetail
} from '@/http/yskApi/table.js'
import {
$tbShopCategory
@@ -158,7 +165,8 @@
reactive,
ref,
nextTick,
watch,getCurrentInstance
watch,
getCurrentInstance
} from 'vue';
import myCar from './components/car'
import go from '@/commons/utils/go.js';
@@ -173,11 +181,45 @@
import {
tbShopInfo
} from '@/http/yskApi/user.js'
import {hasPermission} from '@/commons/utils/hasPermission.js'
import {
hasPermission
} from '@/commons/utils/hasPermission.js'
const modal = reactive({
key: '',
clear: false,
data: ''
})
async function confirmModelConfirm(isCancel = false) {
if (modal.key == 'clear') {
try {
await $choseTable({
masterId: data.masterId,
tableId: modal.data.tableId,
isClear: !isCancel ? true : false,
});
} catch (e) {
console.log(e)
//TODO handle the exception
}
data.table = modal.data;
setModalShow('clear', false, '')
}
}
function setModalShow(key = 'show', show = true, data) {
modal.key = key
modal[key] = show
modal.data = data
}
const instance = getCurrentInstance();
let canXiadan=ref(false)
async function xiadanClick(){
canXiadan.value=await hasPermission('允许下单')
let canXiadan = ref(false)
async function xiadanClick() {
canXiadan.value = await hasPermission('允许下单')
}
xiadanClick()
//临时菜
@@ -198,9 +240,9 @@
menuHeight: 0, // 左边菜单的高度
menuItemHeight: 0, // 左边菜单item的高度
itemId: '', // 栏目右边scroll-view用于滚动的id
tabbar: storageManage.cacheGoods()||[],
tabbar: storageManage.cacheGoods() || [],
menuItemPos: [],
arr: storageManage.cacheGoodsNode()||[],//左右联动布局节点信息
arr: storageManage.cacheGoodsNode() || [], //左右联动布局节点信息
scrollRightTop: 0, // 右边栏目scroll-view的滚动条高度
timer: null, // 定时器
topZhanwei: 136 + 24,
@@ -305,8 +347,8 @@
page: 0,
size: 300
}) {
const showLoading=data.tabbar.length<=0?true:false
return Api.getGoodsLists(par,showLoading)
const showLoading = data.tabbar.length <= 0 ? true : false
return Api.getGoodsLists(par, showLoading)
}
//获取购物车数据
async function getCart(par = {
@@ -333,9 +375,9 @@
}
//加入购物车
function addCart(par) {
if (!data.table.tableId) {
return infoBox.showToast('请先选择桌台!')
}
// if (!data.table.tableId) {
// return infoBox.showToast('请先选择桌台!')
// }
const submitPar = {
masterId: data.masterId,
tableId: data.table.tableId,
@@ -400,7 +442,7 @@
//获取桌台信息
async function getTableInfo() {
if(data.table.tableId){
if (data.table.tableId) {
const res = await $table.get({
qrcode: data.table.tableId
})
@@ -413,6 +455,8 @@
let $originGoods = []
let $category = []
async function init() {
const masterRes = await getMasterId()
data.masterId = masterRes.masterId
const shopInfo = await tbShopInfo()
$shop.value = shopInfo
const useType = data.table.status == 'using' ? data.table.useType : $returnUseType(shopInfo)
@@ -440,10 +484,7 @@
$originGoods = goods
if (!data.table.tableId) {
//无桌台
const {
masterId
} = await getMasterId()
data.masterId = masterId
setTabBar(category, goods, [])
return
}
@@ -509,9 +550,9 @@
}
function search() {
if(searchValue.value===''){
if (searchValue.value === '') {
isSearch.value = false
return
return
}
isSearch.value = true
searchResult.value = returnSearchGoods()
@@ -534,8 +575,27 @@
function watchChooseTable() {
uni.$off('choose-table')
uni.$on('choose-table', (tableData) => {
data.table = tableData
uni.$on('choose-table', async (item) => {
if (data.table.tableId || cars.length <= 0) {
data.table = item
return;
}
if (item.status != "idle") {
return infoBox.showToast('该台桌已在使用中')
}
const res = await $returnTableDetail({
tableId: item.tableId,
});
if (res.cartCount > 0) {
setModalShow('clear', true, item)
} else {
await $choseTable({
masterId: data.masterId,
tableId: item.tableId,
isClear:false
});
data.table = item
}
})
}
@@ -591,7 +651,7 @@
return prve;
}, {});
const canBudyGoods = specList
.filter((v) => util.isCanBuy(v,guigeModelData.chooseGoods.item))
.filter((v) => util.isCanBuy(v, guigeModelData.chooseGoods.item))
.sort((a, b) => {
const aNumber = a.specSnap.split(",").reduce((prve, cur) => {
return prve + skuMapNumber[cur];
@@ -680,7 +740,7 @@
prve[i] = matchArr
.filter((v) => v.specSnap.match(i))
.every((v) => {
return !util.isCanBuy(v,guigeModelData.chooseGoods.item)
return !util.isCanBuy(v, guigeModelData.chooseGoods.item)
});
}
}
@@ -695,9 +755,10 @@
}
}
}
let selGoods=ref({})
let selGoods = ref({})
function chooseGuige(foodsindex, index) {
if (!canAddGoods()) {
return infoBox.showToast('请先选择桌台', 0.5).then(res => {
@@ -705,7 +766,7 @@
})
}
const $goods = data.tabbar[index].foods[foodsindex]
selGoods.value=$goods
selGoods.value = $goods
guigeModelData.title = $goods.name
const specList = $goods.specList;
const tagSnap = JSON.parse($goods.skuResult.tagSnap)
@@ -809,15 +870,16 @@
return true
}
function searchGoodsUpdate(goodsItem,goodsIndex, isAdd) {
goodsUpdate(goodsItem.goodsIndex, goodsItem.index, isAdd,goodsIndex)
function searchGoodsUpdate(goodsItem, goodsIndex, isAdd) {
goodsUpdate(goodsItem.goodsIndex, goodsItem.index, isAdd, goodsIndex)
}
function setSearchGoods(index,chooseNumber){
if(index!==undefined){
searchResult.value[index].chooseNumber=chooseNumber
function setSearchGoods(index, chooseNumber) {
if (index !== undefined) {
searchResult.value[index].chooseNumber = chooseNumber
}
}
async function goodsUpdate(foodsindex, index, isAdd,searchGoodsIndex) {
async function goodsUpdate(foodsindex, index, isAdd, searchGoodsIndex) {
// if (!canAddGoods()) {
// return infoBox.showToast('请先选择桌台', 0.5).then(res => {
// chooseTable()
@@ -842,7 +904,7 @@
//移除
cars.splice(goodsInCarIndex, 1)
$goods.chooseNumber = 0
setSearchGoods(searchGoodsIndex,0)
setSearchGoods(searchGoodsIndex, 0)
return await removeCartGoods({
cartId
})
@@ -857,7 +919,7 @@
})
carGoods.number = number
$goods.chooseNumber = number
setSearchGoods(searchGoodsIndex,number)
setSearchGoods(searchGoodsIndex, number)
} else {
//增加
const num = suit
@@ -992,8 +1054,8 @@
if (!data.menuHeight) {
await getElRect('menu-scroll-view', 'menuHeight');
}
if(e.detail.scrollTop==0){
isTabClickOver=true
if (e.detail.scrollTop == 0) {
isTabClickOver = true
return swichMenu(0)
}
setTimeout(() => { // 节流
@@ -1231,10 +1293,12 @@
justify-content: center;
align-items: center;
}
::v-deep .uni-searchbar{
padding-top: 12px!important;
padding-bottom: 16px!important;
::v-deep .uni-searchbar {
padding-top: 12px !important;
padding-bottom: 16px !important;
}
.right-box {
width: 572rpx;
// background-color: rgb(250, 250, 250);
@@ -1258,7 +1322,8 @@
.item-title {
font-size: 26rpx;
font-weight: bold;
&.active{
&.active {
color: $my-main-color;
}
}

View File

@@ -2,61 +2,103 @@
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
<view class="u-flex u-row-between">
<view class="font-bold">附加费</view>
<template v-if="orderInfo.status=='unpaid'&&data.status!='return'">
<template v-if="orderInfo.status=='unpaid'&&data.status!='return'">
<my-button plain shape="circle" :width="160" :height="56" @click="tuicai">退菜</my-button>
</template>
<template v-if="orderInfo.status=='closed'&&data.status!='return'">
<my-button plain shape="circle" :width="160" :height="56" @click="tuikuan">退款</my-button>
</template>
</view>
<template v-if="data.status!='return'">
<view class="u-flex u-row-between u-m-t-24">
<view>{{data.name||'餐位费'}}</view>
<view>x{{data.number}}</view>
<view>{{data.totalAmount}}</view>
</view>
</template>
<template v-else>
<view class="u-flex u-row-between u-m-t-24 color-999">
<view class="u-flex">
<view class="line-th ">{{data.name||'餐位费'}}</view>
<view class="tag yitui u-m-l-10">已退</view>
<view>
<template v-if="data.status!='return'">
<view class="u-flex u-row-between u-m-t-24">
<view>{{data.name||'餐位费'}}</view>
<view>x{{data.number}}</view>
<view class="price-min-width">{{data.totalAmount}}</view>
</view>
<view class="line-th">x{{data.number}}</view>
<view class="line-th">{{data.totalAmount}}</view>
</view>
</template>
</template>
<template v-else>
<view class="u-flex u-row-between u-m-t-24 color-999">
<view class="u-flex">
<view class="line-th ">{{data.name||'餐位费'}}</view>
<view class="tag yitui u-m-l-10">已退</view>
</view>
<view class="line-th">x{{data.number||0}}</view>
<view class="line-th">{{data.totalAmount}}</view>
</view>
</template>
<!-- <view class="u-flex u-row-right u-m-t-24">
<template v-if="orderInfo.status=='unpaid'&&data.status!='return'">
<my-button plain shape="circle" :width="160" :height="56" @click="tuicai">退菜</my-button>
</template>
<template v-if="orderInfo.status=='closed'&&data.status!='return'">
<my-button plain shape="circle" :width="160" :height="56" @click="tuikuan">退款</my-button>
</template>
</view> -->
</view>
<view class="u-flex u-row-between u-m-t-24" v-if="packeFee>0">
<view>打包费</view>
<view>x{{packeNumbber}}</view>
<view class="price-min-width">{{packeFee}}</view>
</view>
</view>
</template>
<script setup>
import {
computed
} from 'vue'
const props = defineProps({
data: {
type: Object,
default: () => {}
},
orderInfo:{
orderInfo: {
type: Object,
default: () => {}
default: () => {
return {
detailList: []
}
}
},
table:{
table: {
type: Object,
default: () => {}
}
})
const statusMap={
unpaid:'未支付'
const packeNumbber = computed(() => {
if (!props.orderInfo.detailList) {
return 0
}
return props.orderInfo.detailList.reduce((prve, cur) => {
return prve + (cur.packAmount>0?cur.num:0)
}, 0)
})
const packeFee = computed(() => {
if (!props.orderInfo.detailList) {
return 0
}
return props.orderInfo.detailList.reduce((prve, cur) => {
return prve + cur.packAmount
}, 0).toFixed(2)
})
const statusMap = {
unpaid: '未支付'
}
const emits=defineEmits(['tuicai','tuikuan','printOrder'])
function returnStatus(status){
return statusMap[status]||''
const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
function returnStatus(status) {
return statusMap[status] || ''
}
function tuikuan(){
emits('tuikuan',props.data)
function tuikuan() {
emits('tuikuan', props.data)
}
function tuicai(){
emits('tuicai',props.data)
function tuicai() {
emits('tuicai', props.data)
}
</script>
@@ -65,9 +107,14 @@
padding: 0 6rpx;
border-radius: 8rpx;
font-size: 24rpx;
&.yitui {
background-color: rgb(188, 188, 188);
color: #fff;
}
}
.price-min-width{
min-width: 100rpx;
text-align: right;
}
</style>

View File

@@ -53,7 +53,7 @@
</view>
</view>
</view>
<template v-if="orderInfo.status=='unpaid'">
<template v-if="orderInfo.status=='unpaid'&&orderInfo.useType!='dine-in-before'">
<view class="u-flex u-row-right gap-20 u-m-t-24" v-if="item.status!='return'">
<!-- <my-button :height="60" color="#333" plain type="cancel" shape="circle">更多操作</my-button> -->
<my-button :width="128" :height="48" plain shape="circle"

View File

@@ -7,7 +7,8 @@
</view> -->
<goods-list @printOrder="onPrintOrder" @tuikuan="onTuikuan" :orderInfo="orderDetail.info"
:data="orderDetail.goodsList" :seatFee="orderDetail.seatFee" @tuicai="onTuiCai"></goods-list>
<template v-if="orderDetail.seatFee.totalNumber&&orderDetail.seatFee.totalAmount">
<!-- <template v-if="orderDetail.seatFee.totalNumber&&orderDetail.seatFee.totalAmount"> -->
<template v-if="true">
<extra-vue @tuicai="onSeatFeeTuicai" @tuikuan="onSeatFeeTuiKuan" :orderInfo="orderDetail.info"
:data="orderDetail.seatFee"></extra-vue>
</template>
@@ -16,7 +17,7 @@
<view style="height: 200rpx;"></view>
<view class="u-fixed bottom bg-fff ">
<view class="u-flex u-abso">
<template v-if="orderDetail.info.useType=='takeout'">
<template v-if="orderDetail.info.useType=='takeout'||!orderDetail.info.tableId||orderDetail.info.useType=='dine-in-before'">
<view class="u-flex-1" v-if="orderDetail.info.status=='unpaid'">
<my-button @tap="toPay" borderRadius="100rpx" shape="circle"
type="primary">结账</my-button>

View File

@@ -30,22 +30,42 @@
<view class="u-m-t-32">
<view class="u-font-32">{{goosZhonglei}}种商品{{goodsNumber}}</view>
<view class="border-bottom u-p-b-32">
<view class="u-flex u-row-between u-col-top u-m-t-32" v-for="(item,index) in data.detailList"
<view class="" v-for="(item,index) in data.detailList"
:key="index">
<view>
<view class=""> {{item.productName}}</view>
<view class="color-999 u-font-24 u-m-t-8">
{{item.productSkuName}}
<view class="u-flex u-row-between u-col-top u-m-t-32" v-if="item.productId!=-999">
<view>
<view class=""> {{item.productName}}</view>
<view class="color-999 u-font-24 u-m-t-8">
{{item.productSkuName}}
</view>
</view>
<view class="u-flex u-flex-1 u-row-right">
<view>×{{item.num}}</view>
<view class="u-text-right u-relative" :style="computedPriceStyle()">
<text :class="{'line-th':item.gift}">{{goodsPriceAmount(item)}}</text>
<view class="u-absolute" style="bottom: 100%;right: 0;" v-if="item.gift">
0
</view>
</view>
</view>
</view>
<view class="u-flex u-flex-1 u-row-right">
<view>×{{item.num}}</view>
<view class="u-text-right" :style="computedPriceStyle()">{{item.priceAmount}}</view>
</view>
</view>
</view>
</view>
<view class="border-bottom">
<view class="u-flex u-row-between u-m-t-32 u-col-top" v-if="data.packFee>0">
<view class="no-wrap u-m-r-32">打包费</view>
<view>{{data.packFee||0}}</view>
</view>
<view class="u-flex u-row-between u-m-t-32 u-p-b-32 u-col-top" v-if="data.seatInfo&&data.seatInfo.priceAmount>0">
<view class="no-wrap u-m-r-32">{{data.seatInfo.productName}}</view>
<view>{{data.seatInfo.priceAmount}}</view>
</view>
</view>
<view class="u-flex u-row-between border-bottom u-m-t-32 u-p-b-32 u-col-top">
<view class="no-wrap u-m-r-32">订单备注</view>
<view>{{data.remark||'无'}}</view>
@@ -78,7 +98,14 @@
data: {
type: Object,
default: () => {
detailList: []
return{
packFee:0,
seatInfo:{
productName:'客座费',
priceAmount:0
},
detailList: []
}
}
},
index: {
@@ -89,9 +116,16 @@
let $goodsMap = {}
let goosZhonglei = ref(0)
let goodsNumber = ref(0)
const priceSize = 9
function goodsPriceAmount(item){
return item.price*item.num
}
// const packeFee=computed(()=>{
// return props.data.detailList.reduce((prve,cur)=>{
// return prve+cur.packAmount
// },0).toFixed(2)
// })
function computedPriceStyle() {
const item = props.data.detailList.reduce((prev, current) => (`${prev.price}`.length > `${current.price}`
.length) ? prev : current)