更新代码
This commit is contained in:
@@ -112,6 +112,14 @@
|
||||
</view>
|
||||
</view>
|
||||
</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>
|
||||
|
||||
<view class="block">
|
||||
@@ -367,6 +375,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 +464,7 @@
|
||||
skuId
|
||||
}
|
||||
par[key] = !item[key]
|
||||
|
||||
|
||||
|
||||
const res = await Api.$updateCart(par)
|
||||
goods.list[index][key] = returnBoolean(res[key])
|
||||
@@ -618,10 +631,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)
|
||||
})
|
||||
|
||||
|
||||
207
pagesCreateOrder/confirm-order/rotatingTables.vue
Normal file
207
pagesCreateOrder/confirm-order/rotatingTables.vue
Normal 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>
|
||||
|
||||
{{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>
|
||||
Reference in New Issue
Block a user