并转桌子

This commit is contained in:
duan 2024-12-12 17:25:16 +08:00
parent 6d8284e78f
commit 06e17a74b3
7 changed files with 241 additions and 23 deletions

View File

@ -24,6 +24,17 @@ export function $bind(data) {
}
});
}
// 转/并桌
export function tableswitch(data) {
return request({
url: '/api/place/switch',
method: "put",
data: {
shopId: uni.getStorageSync('shopId'),
...data
}
});
}
//获取台桌详情状态
export function $returnTableDetail(data) {
return request({

View File

@ -51,6 +51,9 @@
} from 'vue';
import color from '@/commons/color.js';
import go from '@/commons/utils/go.js';
import {
onLoad,
} from '@dcloudio/uni-app';
import {
tbShopPurveyorput
} from '@/http/yskApi/requestAll.js';
@ -62,17 +65,15 @@
type: String
}
})
onMounted(() => {
datas.form = JSON.parse(props.item)
onLoad((d)=>{
datas.form = JSON.parse(d.item)
})
function sumbit() {
tbShopPurveyorput({
shopId: uni.getStorageSync("shopId"),
...datas.form
}).then(res => {
// go.to('PAGES_SUPPLIER')
go.back()
})
}

View File

@ -11,7 +11,7 @@
<!-- 不需要label, 需要修改 label-width="0" -->
<uni-forms ref="loginFormRef" label-width="0" :model="vdata.formData" :rules="rules">
<view >
<view>
<uni-forms-item name="username">
<uni-easyinput class='jeepay-easyinput' placeholder="请输入登录名/手机号"
v-model="vdata.formData.username" :clearable="false">
@ -29,7 +29,8 @@
</template>
<template #suffixIcon>
<view class='show-tips' @tap="vdata.isShowPwd = !vdata.isShowPwd ">
{{ vdata.isShowPwd ? '隐藏' : '显示' }}</view>
{{ vdata.isShowPwd ? '隐藏' : '显示' }}
</view>
</template>
</uni-easyinput>
</uni-forms-item>
@ -55,7 +56,6 @@
</view>
</template>
<script setup>
import {
login
} from '@/http/businessApiManger.js';
@ -107,12 +107,11 @@
function loginFunc() {
//
formUtil.validate(loginFormRef.value).then(() => {
login(vdata.formData).then((res) => {
console.log(res);
useStorage.set('token', res.data.token);
useStorage.set('userInfo', res.data.user);
uni.showToast({

View File

@ -630,6 +630,13 @@
"navigationBarTitleText": "确认订单"
}
},
{
"pageId": "PAGES_ROTATING_TABLES",
"path": "confirm-order/rotatingTables",
"style": {
"navigationBarTitleText": "转桌/并桌"
}
},
{
"pageId": "PAGES_CHOOSE_TABLE",
"path": "choose-table/choose-table",

View File

@ -109,7 +109,7 @@
</view>
</uni-forms>
<view class="agreement-policy">
<JeepayCheckbox v-model:checked="vdata.isSelectedAgreement" />
同意
@ -117,8 +117,8 @@
<text></text>
<text class="policy" @click="toPrivacy">隐私政策</text>
</view>
<!-- <view class="agreement-policy">
<JeepayCheckbox v-model:checked="vdata.isSelectedAgreement" />
同意
@ -249,7 +249,7 @@
})
// #ifdef H5
vdata.formData.username = '17792050546'
vdata.formData.pwd = 'sy666888'
vdata.formData.pwd = 'qwer1234'
// #endif
// #ifdef MP-WEIXIN
// vdata.formData.username = '15699991111'
@ -258,11 +258,11 @@
function accountTypeChange(e) {
// #ifdef H5
if(e==1){
if (e == 1) {
vdata.formData.merchantName = '18049104914'
vdata.formData.username = '13666666666'
vdata.formData.pwd = '123456'
}else{
} else {
vdata.formData.pwd = 'qwer1234'
}
// #endif
@ -301,6 +301,7 @@
}
function loginFunc() {
//
formUtil.validate(loginFormRef.value).then(() => {
if (!vdata.isSelectedAgreement) {
@ -375,11 +376,17 @@
storageManage.shopId(loginBizData.shopId)
storageManage.shopUserId(loginBizData.user.user.id)
storageManage.userInfo(loginBizData)
uni.showToast({
title: loginBizData.expireDate + '后到期',
icon: 'none'
});
setTimeout(() => {
//
go.to("PAGES_INDEX", {
isGetCid: true
}, go.GO_TYPE_RELAUNCH)
}, 1000)
//
go.to("PAGES_INDEX", {
isGetCid: true
}, go.GO_TYPE_RELAUNCH)
}
//

View File

@ -112,6 +112,15 @@
</view>
</view>
</template>
<template v-if="goods.list[0].tableId">
<!-- 不免餐位费 -->
<view class="block" @tap="rotatingTables"
style="display: flex;align-items: center;justify-content: space-between;">
<view>转桌/并桌</view>
<uni-icons type="right" color="#999" size="16"></uni-icons>
</view>
</template>
</template>
<view class="block">
@ -367,6 +376,11 @@
return Number(n).toFixed(2)
}
function rotatingTables() {
uni.navigateTo({
url: '/pagesCreateOrder/confirm-order/rotatingTables?item='+JSON.stringify(goods.list),
})
}
//
async function discountconfirm(form) {
if (form.discountMoney != '.') {
@ -451,7 +465,7 @@
skuId
}
par[key] = !item[key]
const res = await Api.$updateCart(par)
goods.list[index][key] = returnBoolean(res[key])
@ -618,10 +632,10 @@
}, 0)
return goodsTotalPrice - allPrice.value
} else {
console.log(discountSaleAmount.value,'优惠金额')
console.log(discountSaleAmount.value, '优惠金额')
return (discountSaleAmount.value)
}
console.log(discountSaleAmount.value,'优惠金额1')
console.log(discountSaleAmount.value, '优惠金额1')
return (goodsTotalPrice + discountSaleAmount.value * 1).toFixed(2)
})

View File

@ -0,0 +1,179 @@
<template>
<view style="padding: 20rpx;">
<view class="uni-padding-wrap uni-common-mt">
<uni-segmented-control :current="datas.current" :values=" ['转桌', '并桌']" style-type="button"
active-color="#007aff" @clickItem="onClickItem" />
</view>
<view class="u-m-t-48">
请选择其他桌
</view>
<view class="uni-list">
<radio-group @change="radioChange">
<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in datas.tableList" :key="index">
<view class="u-m-t-48 u-m-b-48" v-if="item.status=='using'">
<radio :value="item" /> {{item.name}}
</view>
</label>
</radio-group>
</view>
<view class="uni-list" v-if="datas.current==0">
<view class="u-m-t-48">
请选择需要转桌的菜品
</view>
<checkbox-group @change="checkboxChange">
<label class="uni-list-cell uni-list-cell-pd" v-for="(item,index) in datas.item" :key="index">
<view class="u-flex u-m-t-48 u-m-b-48" style="justify-content: space-between;align-items: center;">
<view class="u-flex">
<checkbox :value="item.id" />
<image class="img" v-if="item.coverImg" :src="item.coverImg" mode=""></image>
&nbsp;&nbsp;
{{item.name}}
</view>
<view class="">
<view class=" u-relative">
<template v-if="item.isGift">
<text class="line-th color-999">{{formatPrice(item.salePrice*item.number) }}</text>
<view class="u-absolute" style="right: 0;bottom: 100%;">
<text class="font-bold">0</text>
</view>
</template>
<template v-else>
<template v-if="isVip&&item.memberPrice&&item.memberPrice*1!=item.salePrice*1">
<text
class="line-th color-999">{{formatPrice(item.salePrice*item.number) }}</text>
<view class="u-absolute" style="right: 0;bottom: 100%;">
<text
class="font-bold">{{formatPrice(item.memberPrice*item.number) }}</text>
</view>
</template>
<template v-else>
<view class="font-bold">
<text></text>
<text class="">{{formatPrice(item.salePrice*item.number) }}</text>
</view>
</template>
</template>
</view>
<view class="color-999 u-text-right u-font-24 u-m-t-12">×{{item.number}}</view>
</view>
<!-- <text class=" color-999">{{formatPrice(item.salePrice*item.number) }}</text> -->
</view>
</label>
</checkbox-group>
</view>
<my-button shape="circle" @tap="confirm">确定</my-button>
</view>
</template>
<script setup>
import {
reactive,
defineProps
} from 'vue';
import {
onLoad,
} from '@dcloudio/uni-app';
import go from '@/commons/utils/go.js';
import {
$table,
tableswitch
} from '@/http/yskApi/table.js'
let datas = reactive({
current: 0,
item: "",
//
tableList: [],
//
selecttableList: '',
//
changeTable: []
})
const props = defineProps({
item: {
type: Array
},
})
onLoad((opt) => {
// console.log(JSON.parse(opt.item) ,'1')
gettableList()
datas.item = JSON.parse(opt.item)
})
async function confirm() {
console.log(datas.selecttableList, 'debug')
console.log(datas.item, 'debug2')
//
if (datas.selecttableList) {
if (datas.current == 0) {
//
if (datas.changeTable.length) {
let res = await tableswitch({
masterId: datas.item[0].masterId,
useType: datas.item[0].useType,
cartIds: datas.changeTable,
currentTableId: datas.item[0].tableId,
targetTableId: datas.selecttableList.tableId
})
if (res) {
go.back()
}
}
} else {
let res = await tableswitch({
masterId: datas.item[0].masterId,
useType: datas.item[0].useType,
isFull: true,
currentTableId: datas.item[0].tableId,
targetTableId: datas.selecttableList.tableId
})
if (res) {
go.back()
}
}
}
}
function radioChange(d) {
datas.selecttableList = d.detail.value
}
// /
function onClickItem(e) {
if (datas.current !== e.currentIndex) {
datas.current = e.currentIndex
}
}
//
async function gettableList() {
const res = await $table.get({
page: 1,
size: 999
})
datas.tableList = res.content
}
function formatPrice(n) {
return Number(n).toFixed(2)
}
function checkboxChange(e) {
datas.changeTable = e.detail.value
}
</script>
<style scoped lang="scss">
.goods {
// padding-bottom: 30rpx;
border-bottom: 1px dashed #E5E5E5;
.item {}
}
.img {
width: 84rpx;
height: 84rpx;
border-radius: 8rpx 8rpx 8rpx 8rpx;
}
</style>