Merge branch 'ymf' of https://e.coding.net/g-cphe0354/cashier_front/cashier_admin_app into test
This commit is contained in:
74
commons/goodsData.js
Normal file
74
commons/goodsData.js
Normal 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,
|
||||
}
|
||||
@@ -30,5 +30,9 @@ export const $status = {
|
||||
cleaning: {
|
||||
label: "待清台",
|
||||
type: "#FAAD14",
|
||||
},
|
||||
unbind: {
|
||||
label: "未绑定",
|
||||
type: "rgb(221,221,221)",
|
||||
}
|
||||
}
|
||||
@@ -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){
|
||||
|
||||
@@ -24,3 +24,27 @@ export function $bind(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
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -130,7 +130,7 @@
|
||||
"quickapp" : {},
|
||||
/* 快应用特有相关 */
|
||||
"mp-weixin" : {
|
||||
"appid" : "wxcbff1cfb27c1066c",
|
||||
"appid" : "wxcf0fe8cdba153fd6",
|
||||
"setting" : {
|
||||
"urlCheck" : false,
|
||||
"minified" : true,
|
||||
|
||||
@@ -930,7 +930,7 @@
|
||||
import {
|
||||
$types,
|
||||
$defaultSku
|
||||
} from '../goodsData.js'
|
||||
} from '@/commons/goodsData.js'
|
||||
import {
|
||||
$getProductDetail,
|
||||
$tbShopCategory,
|
||||
|
||||
@@ -546,7 +546,7 @@
|
||||
import {
|
||||
$types,
|
||||
$defaultSku
|
||||
} from '../goodsData.js'
|
||||
} from '@/commons/goodsData.js'
|
||||
import {
|
||||
$getProductDetail,
|
||||
$tbShopCategory,
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -78,7 +78,8 @@
|
||||
import listItem from './components/list-item';
|
||||
import {
|
||||
$pageData
|
||||
} from '../goodsData.js'
|
||||
} from '@/commons/goodsData.js'
|
||||
|
||||
import {
|
||||
computed,
|
||||
reactive,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 => {
|
||||
|
||||
@@ -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>
|
||||
@@ -55,10 +55,17 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="u-m-t-30 u-flex u-flex-wrap u-row-between">
|
||||
<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()
|
||||
})
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
<view class="list ">
|
||||
<view class=" bg-fff box bg-fff">
|
||||
<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">
|
||||
@@ -45,6 +46,11 @@
|
||||
</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>
|
||||
@@ -95,9 +101,12 @@
|
||||
}, 100)
|
||||
}
|
||||
let searchValue = ref('')
|
||||
function search(){
|
||||
|
||||
function search() {
|
||||
query.page=1
|
||||
getTable()
|
||||
}
|
||||
|
||||
function chooseTable(index, item) {
|
||||
if (item.status == 'closed') {
|
||||
return uni.showToast({
|
||||
@@ -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,14 +159,14 @@
|
||||
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'
|
||||
})
|
||||
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)
|
||||
@@ -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 => {
|
||||
@@ -202,6 +216,7 @@
|
||||
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;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
@@ -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,6 +16,7 @@
|
||||
<view>不选择用户</view>
|
||||
<my-radio v-model="nouser" :size="18" border-color="#d1d1d1" @change="chooseUser"></my-radio>
|
||||
</view>
|
||||
<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)">
|
||||
@@ -42,6 +44,16 @@
|
||||
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,11 +66,13 @@
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
reactive,onBeforeMount,
|
||||
reactive,
|
||||
onBeforeMount,
|
||||
ref
|
||||
} from 'vue';
|
||||
let nouser = ref(false)
|
||||
let timer = null
|
||||
|
||||
function emitChooser(data) {
|
||||
uni.$emit('choose-user', data)
|
||||
timer = setTimeout(() => {
|
||||
@@ -68,6 +82,7 @@
|
||||
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,
|
||||
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(() => {
|
||||
|
||||
@@ -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||''}}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
})
|
||||
|
||||
|
||||
@@ -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,7 +181,41 @@
|
||||
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() {
|
||||
@@ -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,
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -698,6 +758,7 @@
|
||||
|
||||
|
||||
let selGoods = ref({})
|
||||
|
||||
function chooseGuige(foodsindex, index) {
|
||||
if (!canAddGoods()) {
|
||||
return infoBox.showToast('请先选择桌台', 0.5).then(res => {
|
||||
@@ -812,6 +873,7 @@
|
||||
function searchGoodsUpdate(goodsItem, goodsIndex, isAdd) {
|
||||
goodsUpdate(goodsItem.goodsIndex, goodsItem.index, isAdd, goodsIndex)
|
||||
}
|
||||
|
||||
function setSearchGoods(index, chooseNumber) {
|
||||
if (index !== undefined) {
|
||||
searchResult.value[index].chooseNumber = chooseNumber
|
||||
@@ -1231,10 +1293,12 @@
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
::v-deep .uni-searchbar {
|
||||
padding-top: 12px !important;
|
||||
padding-bottom: 16px !important;
|
||||
}
|
||||
|
||||
.right-box {
|
||||
width: 572rpx;
|
||||
// background-color: rgb(250, 250, 250);
|
||||
@@ -1258,6 +1322,7 @@
|
||||
.item-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: bold;
|
||||
|
||||
&.active {
|
||||
color: $my-main-color;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,12 @@
|
||||
<my-button plain shape="circle" :width="160" :height="56" @click="tuikuan">退款</my-button>
|
||||
</template>
|
||||
</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>¥{{data.totalAmount}}</view>
|
||||
<view class="price-min-width">¥{{data.totalAmount}}</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
@@ -22,14 +23,32 @@
|
||||
<view class="line-th ">{{data.name||'餐位费'}}</view>
|
||||
<view class="tag yitui u-m-l-10">已退</view>
|
||||
</view>
|
||||
<view class="line-th">x{{data.number}}</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,
|
||||
@@ -37,24 +56,47 @@
|
||||
},
|
||||
orderInfo: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
default: () => {
|
||||
return {
|
||||
detailList: []
|
||||
}
|
||||
}
|
||||
},
|
||||
table: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
})
|
||||
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] || ''
|
||||
}
|
||||
|
||||
function tuikuan() {
|
||||
emits('tuikuan', props.data)
|
||||
}
|
||||
|
||||
function tuicai() {
|
||||
emits('tuicai', props.data)
|
||||
}
|
||||
@@ -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>
|
||||
@@ -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"
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -30,8 +30,9 @@
|
||||
<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 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">
|
||||
@@ -40,12 +41,31 @@
|
||||
</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 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>
|
||||
</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,8 +98,15 @@
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return{
|
||||
packFee:0,
|
||||
seatInfo:{
|
||||
productName:'客座费',
|
||||
priceAmount:0
|
||||
},
|
||||
detailList: []
|
||||
}
|
||||
}
|
||||
},
|
||||
index: {
|
||||
type: [String, Number],
|
||||
@@ -91,7 +118,14 @@
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user