更新代码

This commit is contained in:
GaoHao 2025-02-07 14:56:53 +08:00
parent 0740c3f349
commit 7519ffced3
12 changed files with 391 additions and 97 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) { export function $returnTableDetail(data) {
return request({ return request({

View File

@ -2,7 +2,7 @@
"name" : "银收客", "name" : "银收客",
"appid" : "__UNI__02A31D8", "appid" : "__UNI__02A31D8",
"description" : "", "description" : "",
"versionName" : "1.0.2", "versionName" : "1.0.0",
"versionCode" : 100, "versionCode" : 100,
"transformPx" : false, "transformPx" : false,
"app-plus" : { "app-plus" : {

View File

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

View File

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

View File

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

View File

@ -109,7 +109,7 @@
</view> </view>
</uni-forms> </uni-forms>
<view class="agreement-policy"> <view class="agreement-policy">
<JeepayCheckbox v-model:checked="vdata.isSelectedAgreement" /> <JeepayCheckbox v-model:checked="vdata.isSelectedAgreement" />
同意 同意
@ -117,8 +117,8 @@
<text></text> <text></text>
<text class="policy" @click="toPrivacy">隐私政策</text> <text class="policy" @click="toPrivacy">隐私政策</text>
</view> </view>
<!-- <view class="agreement-policy"> <!-- <view class="agreement-policy">
<JeepayCheckbox v-model:checked="vdata.isSelectedAgreement" /> <JeepayCheckbox v-model:checked="vdata.isSelectedAgreement" />
同意 同意
@ -173,6 +173,7 @@
import timer from '@/commons/utils/timer.js' import timer from '@/commons/utils/timer.js'
import formUtil from '@/commons/utils/formUtil.js' import formUtil from '@/commons/utils/formUtil.js'
import EnvChangeTips from './components/EnvChangeTips.vue' import EnvChangeTips from './components/EnvChangeTips.vue'
import dayjs from 'dayjs' //
import { import {
getExtStoreId getExtStoreId
} from "@/commons/utils/versionManage.js" } from "@/commons/utils/versionManage.js"
@ -249,7 +250,7 @@
}) })
// #ifdef H5 // #ifdef H5
vdata.formData.username = '17792050546' vdata.formData.username = '17792050546'
vdata.formData.pwd = 'sy666888' vdata.formData.pwd = 'qwer1234'
// #endif // #endif
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
// vdata.formData.username = '15699991111' // vdata.formData.username = '15699991111'
@ -258,11 +259,11 @@
function accountTypeChange(e) { function accountTypeChange(e) {
// #ifdef H5 // #ifdef H5
if(e==1){ if (e == 1) {
vdata.formData.merchantName = '18049104914' vdata.formData.merchantName = '18049104914'
vdata.formData.username = '13666666666' vdata.formData.username = '13666666666'
vdata.formData.pwd = '123456' vdata.formData.pwd = '123456'
}else{ } else {
vdata.formData.pwd = 'qwer1234' vdata.formData.pwd = 'qwer1234'
} }
// #endif // #endif
@ -301,6 +302,7 @@
} }
function loginFunc() { function loginFunc() {
// //
formUtil.validate(loginFormRef.value).then(() => { formUtil.validate(loginFormRef.value).then(() => {
if (!vdata.isSelectedAgreement) { if (!vdata.isSelectedAgreement) {
@ -375,11 +377,21 @@
storageManage.shopId(loginBizData.shopId) storageManage.shopId(loginBizData.shopId)
storageManage.shopUserId(loginBizData.user.user.id) storageManage.shopUserId(loginBizData.user.user.id)
storageManage.userInfo(loginBizData) storageManage.userInfo(loginBizData)
var time1 = new Date();
var time2 = new Date(loginBizData.expireDate);
let les = (time1.getTime() - time2.getTime()) / 86400000;
uni.showToast({
title: '店铺账号有限期至' + loginBizData.expireDate + ',店铺账号到期剩余' + Math.abs(les.toFixed(0)) + '天!',
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,14 @@
</view> </view>
</view> </view>
</template> </template>
<!-- <template v-if="goods.list[0].tableId&&goods.list[0].orderId">
<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> </template>
<view class="block"> <view class="block">
@ -367,6 +375,11 @@
return Number(n).toFixed(2) return Number(n).toFixed(2)
} }
function rotatingTables() {
uni.navigateTo({
url: '/pagesCreateOrder/confirm-order/rotatingTables?item='+JSON.stringify(goods.list),
})
}
// //
async function discountconfirm(form) { async function discountconfirm(form) {
if (form.discountMoney != '.') { if (form.discountMoney != '.') {
@ -451,7 +464,7 @@
skuId skuId
} }
par[key] = !item[key] par[key] = !item[key]
const res = await Api.$updateCart(par) const res = await Api.$updateCart(par)
goods.list[index][key] = returnBoolean(res[key]) goods.list[index][key] = returnBoolean(res[key])
@ -618,10 +631,10 @@
}, 0) }, 0)
return goodsTotalPrice - allPrice.value return goodsTotalPrice - allPrice.value
} else { } else {
console.log(discountSaleAmount.value,'优惠金额') console.log(discountSaleAmount.value, '优惠金额')
return (discountSaleAmount.value) return (discountSaleAmount.value)
} }
console.log(discountSaleAmount.value,'优惠金额1') console.log(discountSaleAmount.value, '优惠金额1')
return (goodsTotalPrice + discountSaleAmount.value * 1).toFixed(2) return (goodsTotalPrice + discountSaleAmount.value * 1).toFixed(2)
}) })

View File

@ -0,0 +1,207 @@
<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" v-if="datas.tableList.length">
<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">
<radio :value="item.tableId" /> {{item.name}}
</view>
</label>
</radio-group>
<view v-else>
暂无数据
</view>
</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">
<template v-if="item.status=='unpaid'">
<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.cartId" />
<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>
</template>
</label>
</checkbox-group>
</view>
<my-button shape="circle" @tap="confirm">确定</my-button>
</view>
</template>
<script setup>
import {
reactive,
defineProps
} from 'vue';
import {
onLoad,
onShow
} 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
},
tableId: {
type: String
}
})
onLoad((opt) => {
datas.item = JSON.parse(opt.item)
})
onShow(() => {
gettableList()
})
async function confirm() {
//
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
})
if (res) {
uni.navigateBack({
delta: 2
})
}
} else {
uni.showToast({
title: '请选择菜品或桌号!',
icon: 'none'
});
}
} 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
})
if (res) {
uni.navigateBack({
delta: 2
})
}
}
} else {
uni.showToast({
title: '请选择菜品或桌号!',
icon: 'none'
});
}
}
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
})
let arr = []
res.content.forEach((ele) => {
if (ele.status == 'using' && props.tableId != ele.tableId) {
arr.push(ele)
}
});
datas.tableList = arr
}
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>

View File

@ -116,6 +116,7 @@
} }
function close() { function close() {
datas.selectNumber = 0
model.value.close() model.value.close()
} }
const instance = getCurrentInstance(); const instance = getCurrentInstance();

View File

@ -4,6 +4,13 @@
<text class="">桌号</text> <text class="">桌号</text>
<text class="">{{orderInfo.tableName||""}}</text> <text class="">{{orderInfo.tableName||""}}</text>
</view> </view>
<view class=" font-bold u-p-b-32 border-bottom u-m-b-24" v-if="orderInfo.tableName&&orderInfo.status=='unpaid'">
<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>
</view>
<view class=" color-999 border-bottom u-p-b-24"> <view class=" color-999 border-bottom u-p-b-24">
<text></text> <text></text>
<text class="color-333 "> {{goodsNumber}}</text> <text class="color-333 "> {{goodsNumber}}</text>
@ -180,7 +187,7 @@
<text class="font-bold u-font-32">{{orderInfo.amount}}</text> <text class="font-bold u-font-32">{{orderInfo.amount}}</text>
</view> </view>
</template> </template>
</view> </view>
<!-- <view class="u-flex u-row-between u-m-t-20" v-if="orderInfo.status=='closed'"> <!-- <view class="u-flex u-row-between u-m-t-20" v-if="orderInfo.status=='closed'">
<view></view> <view></view>
@ -347,57 +354,58 @@
} }
const canTuiKuanPrice = computed(() => { const canTuiKuanPrice = computed(() => {
const goodsTotal= props.data.reduce((prve, cur) => { const goodsTotal = props.data.reduce((prve, cur) => {
// const curTotal=cur.info.filter(v=>!v.userCouponId).reduce((a,b)=>{ // const curTotal=cur.info.filter(v=>!v.userCouponId).reduce((a,b)=>{
// return a+b.priceAmount*1 // return a+b.priceAmount*1
// },0) // },0)
const curTotal = cur.info.filter(v => !isTui(v)&& !v.userCouponId) const curTotal = cur.info.filter(v => !isTui(v) && !v.userCouponId)
.reduce((a, b) => { .reduce((a, b) => {
return a + b.priceAmount * 1 return a + b.priceAmount * 1
}, 0) }, 0)
return prve + curTotal return prve + curTotal
}, 0) }, 0)
console.log(goodsTotal); console.log(goodsTotal);
console.log(seatFeePrice.value); console.log(seatFeePrice.value);
return (goodsTotal+seatFeePrice.value*1).toFixed(2) return (goodsTotal + seatFeePrice.value * 1).toFixed(2)
}) })
const TuiKuanPrice = computed(() => { const TuiKuanPrice = computed(() => {
return props.data.reduce((prve, cur) => {
// const curTotal=cur.info.filter(v=>!v.userCouponId).reduce((a,b)=>{
// return a+b.priceAmount*1
// },0)
const curTotal = cur.info.filter(v => isTui(v)&&!v.userCouponId)
.reduce((a, b) => {
return a + b.priceAmount * 1
}, 0)
return prve + curTotal
}, 0)
})
const noTuiKuanPrice=computed(()=>{
return props.data.reduce((prve, cur) => { return props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => !isTui(v)&&!v.userCouponId) // const curTotal=cur.info.filter(v=>!v.userCouponId).reduce((a,b)=>{
// return a+b.priceAmount*1
// },0)
const curTotal = cur.info.filter(v => isTui(v) && !v.userCouponId)
.reduce((a, b) => { .reduce((a, b) => {
return a + b.priceAmount * 1 return a + b.priceAmount * 1
}, 0) }, 0)
return prve + curTotal return prve + curTotal
}, 0) }, 0)
}) })
const cantuiSeatFee=computed(()=>{ const noTuiKuanPrice = computed(() => {
let seatFee=props.orderInfo.seatInfo?(props.orderInfo.seatInfo.priceAmount):0 return props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => !isTui(v) && !v.userCouponId)
.reduce((a, b) => {
return a + b.priceAmount * 1
}, 0)
return prve + curTotal
}, 0)
})
const cantuiSeatFee = computed(() => {
let seatFee = props.orderInfo.seatInfo ? (props.orderInfo.seatInfo.priceAmount) : 0
const bili = Math.floor((seatFee / canTuiKuanPrice.value) * 100) / 100 const bili = Math.floor((seatFee / canTuiKuanPrice.value) * 100) / 100
seatFee= Math.floor((props.orderInfo.amount-props.orderInfo.refundAmount) * bili * 100) / 100 seatFee = Math.floor((props.orderInfo.amount - props.orderInfo.refundAmount) * bili * 100) / 100
return seatFee return seatFee
}) })
function returnCanTuiMoney(item) { function returnCanTuiMoney(item) {
return props.orderInfo.status == 'unpaid'? item.priceAmount: item.canReturnAmount return props.orderInfo.status == 'unpaid' ? item.priceAmount : item.priceAmount
if (props.orderInfo.status == 'unpaid') { if (props.orderInfo.status == 'unpaid') {
return returnTotalMoney(item) return returnTotalMoney(item)
} else { } else {
if(props.orderInfo.pointsDiscountAmount>0||props.orderInfo.fullCouponDiscountAmount>0){ if (props.orderInfo.pointsDiscountAmount > 0 || props.orderInfo.fullCouponDiscountAmount > 0) {
return item.canReturnAmount return item.canReturnAmount
// const bili=Math.floor((item.priceAmount/canTuiKuanPrice.value )*100)/100 // const bili=Math.floor((item.priceAmount/canTuiKuanPrice.value )*100)/100
// return Math.floor((allPrice.value)*bili*100)/100 // return Math.floor((allPrice.value)*bili*100)/100
}else{ } else {
return item.priceAmount return item.priceAmount
} }
} }
@ -419,7 +427,7 @@
if (res) { if (res) {
emits('tuikuan', { emits('tuikuan', {
...item, ...item,
priceAmount: item.canReturnAmount priceAmount: item.priceAmount
}, index) }, index)
} }
}) })
@ -503,8 +511,8 @@
}) })
const youhuiAllPrice = computed(() => { const youhuiAllPrice = computed(() => {
const n= props.orderInfo.originAmount-props.orderInfo.amount+vipDiscountPrice.value*1 const n = props.orderInfo.originAmount - props.orderInfo.amount + vipDiscountPrice.value * 1
return (n<0?0:n).toFixed(2) return (n < 0 ? 0 : n).toFixed(2)
// if(props.orderInfo.status!='unpaid'){ // if(props.orderInfo.status!='unpaid'){
// const seatfee=(props.orderInfo.amount==0&&allPrice.value==0)?seatFeePrice.value:0 // const seatfee=(props.orderInfo.amount==0&&allPrice.value==0)?seatFeePrice.value:0
// return (goodsOriginAllPrice.value-allPrice.value+seatfee*1).toFixed(2) // return (goodsOriginAllPrice.value-allPrice.value+seatfee*1).toFixed(2)
@ -528,26 +536,53 @@
}) })
const allPrice = computed(() => { const allPrice = computed(() => {
const goodsPrice = props.data.reduce((prve, cur) => { const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.reduce((a, const curTotal = cur.info.reduce((a,
b) => { b) => {
return a +(props.orderInfo.status == 'unpaid'?b.priceAmount:b.canReturnAmount*1) return a + (b.status == 'unpaid' ? b.priceAmount : b.status == 'return' ? 0 : b
.priceAmount * 1)
}, 0) }, 0)
return prve + curTotal return prve + curTotal
}, 0) }, 0)
return goodsPrice.toFixed(2) return goodsPrice.toFixed(2)
if (props.orderInfo.status == 'unpaid') { if (props.orderInfo.status == 'unpaid') {
const n = goodsOriginAllPrice.value - youhuiAllPrice.value const n = goodsOriginAllPrice.value - youhuiAllPrice.value
return (n < 0 ? 0 : n).toFixed(2) return (n < 0 ? 0 : n).toFixed(2)
} }
const returnAmount=props.orderInfo.seatInfo&&props.orderInfo.seatInfo.returnAmount?props.orderInfo.seatInfo.returnAmount:0 const returnAmount = props.orderInfo.seatInfo && props.orderInfo.seatInfo.returnAmount ? props.orderInfo
const canReturnAmount=props.orderInfo.seatInfo&&props.orderInfo.seatInfo.canReturnAmount?props.orderInfo.seatInfo.canReturnAmount:0 .seatInfo.returnAmount : 0
const total=props.orderInfo.amount-(returnAmount?returnAmount:canReturnAmount) const canReturnAmount = props.orderInfo.seatInfo && props.orderInfo.seatInfo.canReturnAmount ? props
return (total<=0?0:total).toFixed(2) .orderInfo.seatInfo.canReturnAmount : 0
const total = props.orderInfo.amount - (returnAmount ? returnAmount : canReturnAmount)
return (total <= 0 ? 0 : total).toFixed(2)
}) })
function rotatingTables() {
let arr = []
props.data.forEach(ele => {
ele.info.forEach(res => {
// coverImg
res.coverImg = res.productImg
// name
res.name = res.productName
// salePrice
res.salePrice = res.price
// number
res.number = res.num
res.masterId = props.orderInfo.masterId
res.useType = props.orderInfo.useType
res.tableId = props.orderInfo.tableId
arr.push(res)
})
})
uni.navigateTo({
url: '/pagesCreateOrder/confirm-order/rotatingTables?item=' + JSON.stringify(arr) + '&tableId=' + props
.orderInfo.tableId
})
}
const goodsNumber = computed(() => { const goodsNumber = computed(() => {
let result = 0 let result = 0
result = props.data.reduce((a, b) => { result = props.data.reduce((a, b) => {

View File

@ -6,22 +6,23 @@
{{data.productName}} {{data.productName}}
</view> </view>
<view class="u-flex u-m-t-32" :class="{'gray':data.productId=='-999'}"> <view class="u-flex u-m-t-32" :class="{'gray':data.productId=='-999'}">
<up-number-box :min="1" :max="data.num" :buttonSize="44" v-model="number" integer :disabled="data.productId=='-999'"> <up-number-box :min="0" :max="data.num" :buttonSize="44" v-model="number" integer
:disabled="data.productId=='-999'">
<template #minus> <template #minus>
<view class="minus number-box-btn"> <view class="minus number-box-btn">
</view> </view>
</template> </template>
<template #input> <template #input>
<view class="u-flex-1 u-row-center u-text-center input"> <view class="u-flex-1 u-row-center u-text-center input">
<up-input <up-input :disabled="data.productId=='-999'" @change="parseIntNumber($event,false)"
:disabled="data.productId=='-999'" @blur="parseIntNumber($event,true)" v-model="number" border="none"
@change="parseIntNumber($event,false)" @blur="parseIntNumber($event,true)" type="number"></up-input>
v-model="number" border="none" type="number"></up-input>
</view> </view>
</template> </template>
<template #plus> <template #plus>
<view class="plus number-box-btn"> <view class="plus number-box-btn">
<up-icon v-if="data.productId=='-999'" name="plus" color="#ccc" size="16" bold></up-icon> <up-icon v-if="data.productId=='-999'" name="plus" color="#ccc" size="16"
bold></up-icon>
<up-icon v-else name="plus" color="#999" size="16" bold></up-icon> <up-icon v-else name="plus" color="#999" size="16" bold></up-icon>
</view> </view>
</template> </template>
@ -50,8 +51,7 @@
<view class="u-p-t-18 u-p-l-30 u-p-r-30 u-p-b-10"> <view class="u-p-t-18 u-p-l-30 u-p-r-30 u-p-b-10">
<my-button box-shadow shape="circle" @tap="confirm">确认退菜</my-button> <my-button box-shadow shape="circle" @tap="confirm">确认退菜</my-button>
<view class="u-m-t-10"> <view class="u-m-t-10">
<my-button @tap="onModelClose" shape="circle" bgColor="#fff" type="cancel" <my-button @tap="onModelClose" shape="circle" bgColor="#fff" type="cancel" box-shadow>取消</my-button>
box-shadow>取消</my-button>
</view> </view>
</view> </view>
@ -71,7 +71,7 @@
type: Object, type: Object,
default: () => { default: () => {
return { return {
productId:'-999' productId: '-999'
} }
} }
}, },
@ -86,7 +86,7 @@
const emits = defineEmits(['update:show', 'confirm']) const emits = defineEmits(['update:show', 'confirm'])
let model = ref(null) let model = ref(null)
let modelShow = ref(props.show) let modelShow = ref(props.show)
let number = ref(1) let number = ref(0)
const tags = ref([{ const tags = ref([{
label: "点错", label: "点错",
checked: false checked: false
@ -103,16 +103,18 @@
let timer = null let timer = null
function parseIntNumber(val, isNow) { function parseIntNumber(val, isNow) {
console.log(val); let newval = val * 1
let newval = parseInt(val)
if (newval > props.data.num) { if (newval > props.data.num) {
newval = props.data.num newval = props.data.num
} }
if (newval < 1) { //
newval = 1 if (props.data.isWeight != 1) {
if (newval < 1) {
newval = 1
}
} }
if (isNow) { if (isNow) {
number.value = parseInt(newval) number.value = newval * 1
return return
} }
timer = setTimeout(() => { timer = setTimeout(() => {
@ -138,10 +140,10 @@
function toggleModelShow(show) { function toggleModelShow(show) {
modelShow.value = show ? true : false modelShow.value = show ? true : false
} }
function onModelClose() { function onModelClose() {
number.value=1 number.value = 1
modelShow.value = false modelShow.value = false
} }
@ -151,17 +153,17 @@
function open() { function open() {
model.value.open() model.value.open()
if(props.data.productId=='-999'){ if (props.data.productId == '-999') {
number.value=props.data.num number.value = props.data.num
} }
} }
function close() { function close() {
model.value.close() model.value.close()
tags.value.map(v=>{ tags.value.map(v => {
v.checked=false v.checked = false
}) })
form.note='' form.note = ''
} }
function confirm() { function confirm() {
@ -206,12 +208,14 @@
::v-deep .uni-input-input { ::v-deep .uni-input-input {
text-align: center; text-align: center;
} }
.gray{
.minus::after{ .gray {
.minus::after {
border-color: #ccc; border-color: #ccc;
} }
} }
.minus { .minus {
&::after { &::after {
content: ''; content: '';

View File

@ -94,7 +94,7 @@
} }
async function onSeatFeeTuiKuan(seatFee) { async function onSeatFeeTuiKuan(seatFee) {
console.log(seatFee); console.log(seatFee,'调试1');
const canTuikuan=await hasTuiKuan() const canTuikuan=await hasTuiKuan()
if(!canTuikuan){ if(!canTuikuan){
return return
@ -124,19 +124,22 @@
} }
function onTuiCai(goods, index) { function onTuiCai(goods, index) {
console.log(goods);
tuicai.show = true tuicai.show = true
tuicai.selGoods = goods tuicai.selGoods = goods
} }
async function tuicaiConfirm(e) { async function tuicaiConfirm(e) {
console.log(tuicai.selGoods);
const res = await Api.$returnCart({ const res = await Api.$returnCart({
...e, ...e,
cartId: tuicai.selGoods.hasOwnProperty('cartId') ? tuicai.selGoods.cartId : tuicai.selGoods.id, cartId: tuicai.selGoods.hasOwnProperty('cartId') ? tuicai.selGoods.cartId : tuicai.selGoods.id,
tableId: orderDetail.info.tableId, tableId: orderDetail.info.tableId,
}) })
tuicai.show = false tuicai.show = false
if(res){
go.back()
}else{
init() init()
}
} }
@ -171,7 +174,7 @@
if(!canTuikuan){ if(!canTuikuan){
return return
} }
console.log(goods); console.log(goods,'debug');
const { const {
id, id,
productId, productId,
@ -307,6 +310,7 @@
})) }))
console.log(orderDetail.goodsList); console.log(orderDetail.goodsList);
} }
console.log(res,'debug121')
orderDetail.info = res orderDetail.info = res
} }