This commit is contained in:
GaoHao
2025-03-10 17:26:39 +08:00
parent 490c513f48
commit cc97b6acca
26 changed files with 258 additions and 305 deletions

View File

@@ -33,7 +33,7 @@
<view class="u-m-t-24 border discount u-relative u-flex input-box">
<view class="u-flex-1">
<input @input="discountMoneyInput" v-model="form.discountMoney" type="digit"
placeholder-class="placeholder-class" placeholder="减8.55元请输入8.55" />
placeholder-class="placeholder-class" placeholder="请输入最终优惠金额" />
</view>
<view class="color-999 u-p-l-48 u-p-r-48 u-flex u-row-center u-col-center">
<view></view>

View File

@@ -302,7 +302,7 @@
import { getNowCart } from '@/pagesCreateOrder/util.js'
import { getShopInfo } from '@/api/shop.js'
import { getShopTableDetail } from '@/api/table.js'
import { getProductList } from '@/api/product.js'
import { getProductPage } from '@/api/product.js'
import { createOrder,getHistoryOrder } from '@/api/order.js'
import { number } from 'uview-plus/libs/function/test';
@@ -568,7 +568,7 @@
* 获取商品列表
*/
function getGoods() {
return getProductList({
return getProductPage({
page: 1,
size: 300
},'product', false)
@@ -871,15 +871,16 @@
let vipPrice = isVip.value ? 1 : 0
let placeNum = pageData.shopInfo.registerType == 'after'&&pageData.orderInfo ? pageData.orderInfo.placeNum + 1 : 1;
let originAmount = goodsPrice.value*1+youhui.value*1
let par = {
shopId: pageData.shopInfo.id, //店铺Id
userId: pageData.user.userId, //用户Id
tableCode: pageData.table.tableCode, //台桌编码
dineMode: pageData.eatTypes.active, //用餐模式 堂食 dine-in 外带 take-out 外卖 take-away
remark: pageData.form.note, //备注
seatNum: 0, //用餐人数
seatNum: 0, //用餐人数
packFee: $packFee.value, //打包费
originAmount: goodsPrice.value, //订单原金额(包含打包费+餐位费) 不含折扣价格
originAmount: originAmount, //订单原金额(包含打包费+餐位费) 不含折扣价格
placeNum: placeNum, //当前订单下单次数
waitCall: 0, //是否等叫 0 否 1 等叫
vipPrice: vipPrice, //是否使用会员价

View File

@@ -10,7 +10,7 @@
<view class="u-font-32 font-bold u-m-t-16">
{{data.lowPrice}}
</view>
<template v-if="data.type=='weigh'">
<template v-if="data.type=='weight'">
<view class="btnweigh">称重</view>
</template>
</view>
@@ -21,7 +21,7 @@
</template>
<template v-else>
<view class="u-flex icon-btn">
<view class="u-flex" @tap.stop="emitEvent(data.type=='weigh'?'tapweigh':'add')">
<view class="u-flex" @tap.stop="emitEvent(data.type=='weight'?'tapweigh':'add')">
<image src="/pagesCreateOrder/static/images/icon-add.svg" class="icon" mode=""></image>
</view>
<template v-if="data.chooseNumber">

View File

@@ -178,7 +178,7 @@
},
table: {
id: ""
id: "",
},
socketData: {
type:'onboc',
@@ -218,6 +218,9 @@
if (JSON.stringify(opt) == '{}') {
isCreateOrderToDetail.value = true
}
if(uni.getStorageSync("table_code")){
data.table.tableCode = uni.getStorageSync("table_code")
}
init()
xiadanClick()
})
@@ -273,7 +276,7 @@
$category = categoryRes.records
// 获取商品数据
const goodsRes = await getGoods()
const goods = goodsRes.records.filter((v) => {
const goods = goodsRes.filter((v) => {
let isShow = true;
if (v.type != "sku") {
isShow = v.skuList.length >= 1;
@@ -326,23 +329,28 @@
cars.length = 0
data.isCars = true;
console.log("购物车信息onboc_init===",msg)
if( !data.table.tableCode ){
data.table.tableCode = msg.table_code
uni.setStorageSync("table_code",msg.table_code)
}
msg.data.map(item=>{
cartItem = getNowCart(item,cartArr)
cartControls(cartItem,'add')
})
uni.hideLoading()
break;
case 'onboc_add':
case 'add':
cartItem = getNowCart(msg.data,cartArr)
cartControls(cartItem,'add')
infoBox.showToast('添加成功')
infoBox.showToast('操作成功')
break;
case 'onboc_edit':
case 'edit':
cartItem = getNowCart(msg.data,cartArr)
cartControls(cartItem,'edit')
infoBox.showToast('添加成功')
infoBox.showToast('操作成功')
break;
case 'onboc_del':
case 'del':
@@ -390,6 +398,7 @@
*/
function editCart (par,operate_type) {
console.log('购物车添加菜品',par)
console.log("data.table==",data.table)
if( !data.isGoodsAdd ){ return; }
let params = {
...data.socketData,
@@ -437,10 +446,7 @@
*/
function getGoods() {
const showLoading = data.tabbar.length <= 0 ? true : false
return getProductList({
page: 1,
size: 300
},'product', showLoading)
return getProductList({},'product', showLoading)
}
/**
@@ -511,8 +517,9 @@
}
if( cars.length > 0){
websocketUtil.send(JSON.stringify(params))
} else{
initCart()
}
// initCart()
return;
}
if (item.status == "unbind") {
@@ -569,7 +576,7 @@
}
// 不影响之前的代码 称重number单独处理
if ($goods.type == 'weigh' && showCurrentInput) {
if ($goods.type == 'weight' && showCurrentInput) {
number = cartItem.number * 1 + Number(showCurrentInput)
}
@@ -583,7 +590,7 @@
setSearchGoods(searchGoodsIndex, number)
} else {
// 不影响之前的代码 称重suit单独处理
if ($goods.type == 'weigh' && showCurrentInput) {
if ($goods.type == 'weight' && showCurrentInput) {
suitNum = showCurrentInput
}
// 套餐和单规格
@@ -652,22 +659,32 @@
if( !data.isGoodsAdd ){ return; }
let $sku;
let $goods;
data.tabbar.map(tabbarItem=>{
if(tabbarItem.foods.find(v => v.id == e.goods.product_id)){
$goods = !e.goods.product_id ? undefined : tabbarItem.foods.find(v => v.id == e.goods.product_id)
if( e.goods.is_temporary != 1){
data.tabbar.map(tabbarItem=>{
if(tabbarItem.foods.find(v => v.id == e.goods.product_id)){
$goods = !e.goods.product_id ? undefined : tabbarItem.foods.find(v => v.id == e.goods.product_id)
}
})
if( $goods.type != 'package'){
//临时菜没有skuList
$sku = !e.goods.product_id ? { suitNum: 1 } : $goods.skuList.find(v => v.id == e.goods.sku_id)
} else {
$sku = !e.goods.product_id ? { suitNum: 1 } : $goods.skuList.find(v => v.id == e.goods.sku_id)
}
if (e.num === 0 || e.num < $sku.suitNum) {
//移除
delCart(e.goods.id)
return
}
})
if( $goods.type != 'package'){
//临时菜没有skuList
$sku = !e.goods.product_id ? { suitNum: 1 } : $goods.skuList.find(v => v.id == e.goods.sku_id)
} else {
$sku = !e.goods.product_id ? { suitNum: 1 } : $goods.skuList.find(v => v.id == e.goods.sku_id)
}
if (e.num === 0 || e.num < $sku.suitNum) {
//移除
delCart(e.goods.id)
return
if (e.num === 0) {
//移除
delCart(e.goods.id)
return
}
}
editCart({
number: e.num,
id: e.goods.id,
@@ -684,44 +701,14 @@
*/
async function taocanConfirm(d, item) {
console.log(d)
let carGoods = null;
cars.some(item=>{
if(item.product_id == data.goodsData.id){
let arr = []
JSON.parse(item.pro_group_info).some((v,i)=>{
if( JSON.stringify(v.selectData) == JSON.stringify(d[i].selectData) ){
arr.push(v)
}
})
if( arr.length == d.length ) {
carGoods = item
return carGoods;
}
}
})
if (carGoods) {
//更新
let newNumber = carGoods.number * 1 + 1
editCart({
id: carGoods.id,
number: newNumber,
product_id: carGoods.product_id,
sku_id: carGoods.sku_id,
},'edit')
data.isGoodsAdd = false;
} else {
//添加
editCart({
number: item.skuList[0].suitNum,
product_id: item.id,
sku_id: item.skuList[0].id,
pro_group_info: JSON.stringify(d),
},'add')
data.isGoodsAdd = false;
}
//添加
editCart({
number: item.skuList[0].suitNum,
product_id: item.id,
sku_id: item.skuList[0].id,
pro_group_info: JSON.stringify(d),
},'add')
data.isGoodsAdd = false;
}
const instance = getCurrentInstance();
@@ -1310,7 +1297,7 @@
uni.$on('add:cashCai', async (data) => {
console.log('add:cashCai',data);
$originGoods.push(data)
data.isGoodsAdd = false;
})
}