代客下单修改,登录页面修改,部分页面调整,请求封装调整

This commit is contained in:
2025-11-27 18:02:28 +08:00
parent f9cc02e93f
commit 3bb09ef0b1
45 changed files with 4934 additions and 1054 deletions

View File

@@ -11,11 +11,13 @@
<view>
<up-icon
name="shopping-cart-fill"
size="20"
color="rgb(102,102,102)"
size="50rpx"
color="#666"
></up-icon>
</view>
<view class="u-m-l-10"> 已选菜品({{ goodsNumber }}) </view>
<view class="u-m-l-10 font-700 color-333 u-font-32">
已选菜品({{ goodsNumber }})
</view>
</view>
<view
class="u-flex"
@@ -30,13 +32,6 @@
</view>
<view class="u-m-l-10"> 清空点餐 </view>
</view>
<view class="u-flex">
<view>合计:</view>
<view class="u-m-l-10 color-red font-bold allPrice">{{
allPrice
}}</view>
<view class=""></view>
</view>
</view>
<scroll-view
scroll-y="true"
@@ -54,10 +49,10 @@
{{ index + 1 }}
</view>
<view class="">
<view>
<text>{{ item.name }}</text>
<text class="limit" v-if="item.is_time_discount"></text>
</view>
<view>
<text>{{ item.name }}</text>
<text class="limit" v-if="item.is_time_discount"></text>
</view>
<view class="u-m-t-10 u-font-24 color-666">{{
item.specInfo || ""
}}</view>
@@ -182,7 +177,9 @@
v-if="v.is_time_discount || v.isTimeDiscount"
>
<view class="font-bold red u-m-r-32"
>{{ returnLimitPrice({...v,number:v.num,salePrice:v.price}) }}</view
>{{
returnLimitPrice({ ...v, number: v.num, salePrice: v.price })
}}</view
>
<view class="u-m-l-30 u-m-r-30 color-333">
X{{ v.num.toFixed(2) }}
@@ -203,18 +200,41 @@
</view>
</view>
</scroll-view>
<view
class="u-row-between bottom u-flex"
class="bottom"
style="position: absolute; left: 0; bottom: 0; background-color: #fff"
>
<view class="u-flex" @click="hideGoods">
<view>
<up-icon name="arrow-left" size="14" color="#333"></up-icon>
</view>
<view class="u-m-l-10"> 返回 </view>
<view class="u-flex u-p-32 border-bottom u-row-right u-font-32">
<view class="color-000">合计</view>
<view class="u-m-l-10 color-red font-bold allPrice"
>{{ allPrice }}</view
>
</view>
<view class="u-flex luodan" @click="toConfimOrder">
<view>落单</view>
<view
class="u-row-between u-flex"
style="padding: 32rpx 52rpx 64rpx 52rpx"
>
<view class="u-flex" @click="hideGoods">
<view>
<up-icon name="arrow-left" size="14" color="#666"></up-icon>
</view>
<view class="u-m-l-20"> 返回 </view>
</view>
<view class="u-flex">
<text class="color-333 u-m-r-20"
>上菜方式{{ returnServingStyleName(subStatus) }}</text
>
<up-icon
name="edit-pen-fill"
color="#666"
size="36rpx"
@click="servingStyleModalShow = true"
></up-icon>
</view>
<view class="u-flex luodan" @click="toConfimOrder">
<view>落单</view>
</view>
</view>
</view>
</view>
@@ -263,10 +283,41 @@
:ref="setModel"
name="remark"
></one-remark>
<ServingStyleModal
v-model="servingStyleModalShow"
@confirm="servingStyleConfirm"
></ServingStyleModal>
<!-- 下单确认 -->
<Modal
v-model="orderConfirmModalShow"
title="下单确认"
confirmText="确定"
@confirm="workerConfirm"
>
<view class="u-p-40 u-font-32 color-333">
<view class="u-flex">
<text class="font-bold">员工名称</text>
<text class="u-m-l-52 color-666">{{
accountStore.shopStaff.name
}}</text>
</view>
<view class="u-flex u-m-t-44">
<text class="font-bold u-m-r-52">员工账号</text>
<up-input
v-model="form.workerAccount"
placeholder="请输入员工账号"
></up-input>
</view>
</view>
</Modal>
</view>
</template>
<script setup>
import Modal from "@/components/my-components/modal.vue";
import ServingStyleModal from "/pagesCreateOrder/index/components/serving-style.modal.vue";
import go from "@/commons/utils/go.js";
import infoBox from "@/commons/utils/infoBox.js";
import oneRemark from "/pagesCreateOrder/confirm-order/components/remark";
@@ -280,9 +331,25 @@ import * as Api from "@/http/yskApi/Instead.js";
import { computed, ref, onMounted, reactive, watch, inject } from "vue";
import BigNumber from "bignumber.js";
import { limitTimeDiscount } from "../../../http/yskApi/limitTimeDiscount";
import { number } from "uview-plus/libs/function/test";
import { servingStyles, returnServingStyleName } from "@/data/index.js";
import { createOrder, getHistoryOrder } from "@/http/api/order.js";
const form = reactive({
workerAccount: "",
});
//下单确认
const orderConfirmModalShow = ref(false);
//上菜方式
const subStatus = ref(servingStyles[0].value);
const servingStyleModalShow = ref(false);
function servingStyleConfirm(e) {
subStatus.value = e;
servingStyleModalShow.value = false;
}
const yskUtils = inject("yskUtils");
const accountStore = inject("accountStore");
const shopInfo = uni.getStorageSync("shopInfo");
let shopList = ref();
@@ -341,6 +408,12 @@ const props = defineProps({
type: [String, Number],
default: "",
},
orderInfo: {
type: Object,
default: () => {
return {};
},
},
});
function returnLimitPrice(data) {
const price = yskUtils.limitUtils.returnPrice({
@@ -350,12 +423,12 @@ function returnLimitPrice(data) {
shopUserInfo: null,
idKey: "product_id",
});
return price
return price;
}
function returnLimitTotalPrice(data) {
console.log('returnLimitTotalPrice',data)
const price = yskUtils.limitUtils.returnPrice({
function returnLimitTotalPrice(data) {
console.log("returnLimitTotalPrice", data);
const price = yskUtils.limitUtils.returnPrice({
goods: data,
shopInfo: shopInfo,
limitTimeDiscountRes: props.limitTimeDiscount,
@@ -370,6 +443,7 @@ const edmits = defineEmits([
"updateNumber",
"updateSafeBottom",
"updateCart",
"updateCartRemark",
]);
const modal = reactive({
key: "",
@@ -380,15 +454,23 @@ const modal = reactive({
let allHistoryOrder = ref([]);
const allPrice = computed(() => {
let cartPrice = props.data.reduce((prve, cur) => {
let price = (cur.is_time_discount? returnLimitPrice(cur) : cur.lowPrice) * cur.number
let price =
(cur.is_time_discount ? returnLimitPrice(cur) : cur.lowPrice) *
cur.number;
return BigNumber(prve).plus(price);
}, 0);
let historyOrderPrice = allHistoryOrder.value.reduce((prve, cur) => {
let price = (cur.isTimeDiscount? returnLimitPrice({...cur,salePrice:cur.price}) : cur.price)* (cur.num - cur.returnNum)
return BigNumber(prve).plus(price);
let price =
(cur.isTimeDiscount
? returnLimitPrice({ ...cur, salePrice: cur.price })
: cur.price) *
(cur.num - cur.returnNum);
return BigNumber(prve).plus(price);
}, 0);
return BigNumber(cartPrice).plus(historyOrderPrice).decimalPlaces(2, BigNumber.ROUND_UP)
.toNumber();
return BigNumber(cartPrice)
.plus(historyOrderPrice)
.decimalPlaces(2, BigNumber.ROUND_UP)
.toNumber();
});
const models = new Map();
const modelData = reactive({
@@ -432,16 +514,13 @@ function confirmModelConfirm() {
//单品备注确认
async function goodsOneRemarkConfirm(e) {
const cart = props.data[modelData.selIndex];
await Api.$updateCart({
cartId: cart.id,
productId: cart.productId,
skuId: cart.skuId,
tableId: props.table.tableId,
note: e.remark,
num: cart.number, // 0会删除此商品
edmits("updateCartRemark", {
remark: e.remark,
index: modelData.selIndex,
goods: cart,
});
edmits("updateCart");
}
// 清空购物车
function setModalShow(key = "show", show = true, type = "", title = "") {
if (title) {
@@ -496,11 +575,45 @@ function getshopsInfo() {
// const findCategory = layoutData.category.list.find(v => v.shopId == goods.shop_id)
}
function toConfimOrder() {
if (props.data.length <= 0&& props.historyOrder.length<=0) {
return infoBox.showToast("还没有选择商品");
async function workerConfirm() {
//debugger
// form.workerAccount=18888888888
if (!form.workerAccount) {
return infoBox.showToast("请输入服务员账号");
}
if (form.workerAccount != accountStore.staffUserName) {
return infoBox.showToast("请输入当前登录员工账号");
}
let newOldRes = null;
if (props.data.length >= 1) {
newOldRes = await createOrder({
shopId: uni.getStorageSync("shopId"), //店铺Id
userId: "", //用户Id
tableCode: props.table.tableCode, //台桌编码
dineMode: "dine-in", //用餐模式 堂食 dine-in 外带 take-out 外卖 take-away
remark: "", //备注
seatNum: 0, //用餐人数
packFee: 0, //打包费
originAmount: 0, //订单原金额(不包含打包费+餐位费)
placeNum: 1, //当前订单下单次数
waitCall: 0, //是否等叫 0 否 1 等叫
vipPrice: false, //是否使用会员价
limitRate: null,
subStatus: subStatus.value,
});
if (!newOldRes) {
return infoBox.showToast("创建订单失败");
}
}
form.workerAccount = "";
go.to("PAGES_TABLE_ORDER", {
orderId: newOldRes ? newOldRes.id : props.orderInfo.id,
});
orderConfirmModalShow.value = false;
hideGoods();
return;
if (props.table.id) {
const { id, name, maxCapacity, status, type } = props.table;
go.to("PAGES_CONFIRM_ORDER", {
@@ -522,6 +635,12 @@ function toConfimOrder() {
}
hideGoods();
}
function toConfimOrder() {
if (props.data.length <= 0 && props.historyOrder.length <= 0) {
return infoBox.showToast("还没有选择商品");
}
orderConfirmModalShow.value = true;
}
const goodsNumber = computed(() => {
let result = 0;
@@ -638,10 +757,10 @@ $car-top: -16rpx;
.luodan {
background-color: $my-main-color;
padding: 10px 30px;
border-radius: 4px;
padding: 18rpx 33px;
border-radius: 16rpx;
color: #fff;
font-size: 16px;
font-size: 40rpx;
font-weight: bold;
}
@@ -676,7 +795,6 @@ $car-top: -16rpx;
}
.bottom {
padding: 14px 20px;
border-top: 1px solid #eee;
width: 100%;
font-size: 16px;
@@ -783,17 +901,17 @@ $car-top: -16rpx;
color: #999;
text-decoration: line-through;
}
.limit{
background-color: #cc5617;
margin-left: 10rpx;
padding: 2rpx 10rpx;
white-space: nowrap;
text-align: center;
position: absolute;
font-weight: 400;
font-size: 24rpx;
color: #ffffff;
border-radius: 14rpx;
color: #fff;
.limit {
background-color: #cc5617;
margin-left: 10rpx;
padding: 2rpx 10rpx;
white-space: nowrap;
text-align: center;
position: absolute;
font-weight: 400;
font-size: 24rpx;
color: #ffffff;
border-radius: 14rpx;
color: #fff;
}
</style>
</style>

View File

@@ -173,16 +173,16 @@
</template>
</view>
<view class="bg-fff u-p-20 w-full">
<view class="u-flex u-row-between u-font-16">
<view>{{ data.name }}</view>
<view class="u-flex u-row-between ">
<view class="u-font-40">{{ data.name }}</view>
<view class="u-flex" v-if="is_time_discount">
<view class="font-bold u-m-t-16">
<view class="font-bold u-m-t-16 u-font-40">
¥{{ limitPrice }}
</view>
<view class="u-m-t-16 old-price"> ¥{{ data.lowPrice }} </view>
</view>
<view class="font-bold u-m-t-16" v-else> ¥{{ data.lowPrice }} </view>
<view class="font-bold u-m-t-16 u-font-40" v-else> ¥{{ data.lowPrice }} </view>
</view>
</view>
</view>
@@ -290,7 +290,6 @@ const is_time_discount = computed(() => {
null,
"id"
);
console.log("isCanuse", isCanuse,props.data);
return isCanuse;
});
@@ -375,8 +374,8 @@ function emitEvent(emitName) {
<style lang="scss" scoped>
.icon {
width: 60rpx;
height: 60rpx;
width: 94rpx;
height: 94rpx;
}
.icon-btn {
@@ -384,11 +383,12 @@ function emitEvent(emitName) {
}
.btn {
background: #eb4f4f;
border-radius: 100rpx;
background: #FE4F1E;
border-radius: 16rpx;
font-size: 32rpx;
font-weight: bold;
padding: 0 50rpx;
padding: 16rpx 44rpx;
line-height: normal;
color: #fff;
}
@@ -434,17 +434,17 @@ function emitEvent(emitName) {
z-index: 2;
}
.limit-discount {
background-color: #cc5617;
padding: 10rpx 20rpx;
background-color: #FEB41E;
padding: 16rpx 44rpx;
white-space: nowrap;
text-align: center;
position: absolute;
top: 0;
left: 0;
font-weight: 400;
font-size: 28rpx;
font-weight: 700;
font-size: 32rpx;
color: #ffffff;
border-radius: 20rpx 0rpx 20rpx 0rpx;
border-radius: 16rpx 0rpx 16rpx 0rpx;
z-index: 9;
color: #fff;
}

View File

@@ -0,0 +1,125 @@
<template>
<view>
<up-popup :show="show" mode="center">
<view class="popup-content">
<view class="top u-flex u-row-between">
<text class="font-bold u-font-32 color-333">{{ title }}</text>
<up-icon size="18" name="close" @click="show = false"></up-icon>
</view>
<up-line></up-line>
<scroll-view style="max-height: 50vh" :scroll-y="true">
<view class="u-flex servingStyles">
<view
v-for="(item, index) in servingStyles"
:key="index"
@click="servingSel = item.value"
:class="[servingSel == item.value ? 'active' : '']"
class="item tranistion"
>
<text>{{ item.name }}</text>
</view>
</view>
</scroll-view>
<up-line></up-line>
<view class="bottom u-row-right">
<view
class="btn success"
@click="confirm"
:class="[btnShape]"
>{{ confirmText }}</view
>
</view>
</view>
</up-popup>
</view>
</template>
<script setup>
import { servingStyles } from "@/data/index.js";
import { ref } from "vue";
const props = defineProps({
title: {
type: String,
default: "上菜方式",
},
confirmText: {
type: String,
default: "确定",
},
cancelText: {
type: String,
default: "取消",
},
btnShape: {
type: String,
default: "round",
},
});
const servingSel =defineModel("servingSel",{
type: String,
default: servingStyles[0].value,
});
const show = defineModel({
type: Boolean,
default: false,
});
const emits = defineEmits(["close", "confirm"]);
function close() {
show.value = false;
emits("close");
}
function confirm() {
emits("confirm", servingSel.value);
}
</script>
<style lang="scss">
.popup-content {
background: #fff;
width: 640rpx;
border-radius: 18rpx;
}
.top {
padding: 40rpx 48rpx;
}
.bottom {
padding: 48rpx 52rpx;
display: flex;
gap: 50rpx;
.btn {
text-align: center;
padding: 18rpx 60rpx;
font-size: 32rpx;
border: 2rpx solid transparent;
border-radius: 8rpx;
&.success {
background-color: $my-main-color;
color: #fff;
}
&.cancel {
border-color: #d9d9d9;
box-shadow: 0 4rpx 0 0 #00000005;
}
}
}
.servingStyles {
display: flex;
flex-wrap: wrap;
justify-content: center;
padding: 38rpx;
gap: 26rpx;
.item {
padding: 14rpx 38rpx;
border-radius: 16rpx;
border: 2rpx solid $my-main-color;
color: $my-main-color;
font-size: 28rpx;
&.active {
background-color: $my-main-color;
color: #fff;
}
}
}
</style>

View File

@@ -6,6 +6,14 @@
<template v-else>
<view class="fixed top bg-fff u-flex u-flex-row">
<template v-if="true">
<view
class="u-flex u-font-32 u-p-l-58"
style="padding-right: 100rpx"
@click="uni.navigateBack()"
>
<up-icon name="arrow-left" size="32rpx" color="#333"></up-icon>
<text class="u-m-l-20">返回</text>
</view>
<view class="u-flex-1 u-flex u-flex-row" style="overflow-x: scroll">
<!-- 顶部左侧 -->
<scroll-view
@@ -33,13 +41,13 @@
</scroll-view>
</view>
<!-- 顶部右侧 选择桌台什么的 -->
<view class="search-box u-flex u-col-center color-666">
<view class="search-box u-flex u-col-center color-333 u-font-32">
<!-- <view style="display: flex;align-items: center;">
<view :class="[lvhong?'lvstyle':'hongstyle']">
</view><text style="margin: 0 6px;">状态</text>
</view> -->
<view class="u-flex u-col-center" @click="chooseTable">
<view class="u-flex u-col-center">
<view class="u-flex u-col-center u-m-r-22">
<image
src="/pagesCreateOrder/static/images/icon-table.svg"
mode=""
@@ -51,7 +59,7 @@
<text class="font-bold u-m-r-4 no-wrap">
{{ data.table.name }}
</text>
<view
<!-- <view
class="u-flex"
@click.stop="resetTable"
style="margin-left: 6px"
@@ -62,42 +70,46 @@
bold=""
:size="24"
></up-icon>
</view>
</view> -->
</view>
<text class="no-wrap" v-else>选择桌</text>
<text class="no-wrap" v-else></text>
</view>
</view>
<view
class="u-flex u-col-center"
@click="toOrder"
style="margin-left: 20px"
style="margin-left: 74rpx"
>
<view class="u-flex">
<up-icon name="order" size="24"></up-icon>
<image
src="/static/iconImg/order.svg"
style="width: 40rpx; height: 40rpx"
/>
</view>
<view class="u-m-r-12">已点订单</view>
<view class="u-m-l-22">已点订单</view>
</view>
<view
style="margin-left: 74rpx"
class="u-flex u-col-center"
@click="changePop('search', true)"
>
<view class="u-flex">
<view class="u-flex u-m-r-22">
<up-icon name="search" size="24"></up-icon>
</view>
<view class="">搜索</view>
</view>
<view class="u-flex u-col-center u-m-l-10">
<!-- <view class="u-flex u-col-center u-m-l-10" @click="loginShow"> -->
<view class="u-flex">
<up-icon name="account" size="24"></up-icon>
</view>
<view>{{ data.userInfo.shopName }}</view>
<!-- <view style="color: #aaa;font-size: 12px;">切换</view> -->
<view
class="color-333 u-font-32 font-700"
style="margin-left: 87px"
>{{ accountStore.shopStaff.name }}</view
>
</view>
<view class="u-flex u-col-center u-m-l-10" @click="loginShowOut">
<view class="u-flex u-col-center u-m-l-38" @click="loginShowOut">
<view class="u-flex">
<!-- <up-icon name="account" size="24"></up-icon> -->
</view>
@@ -226,6 +238,7 @@
@updateSafeBottom="updateSafeBottom"
:instance="instance"
@updateCart="getCart"
@updateCartRemark="updateCartRemark"
:sysInfo="sysInfo"
:isCreateOrderToDetail="isCreateOrderToDetail"
@updateNumber="carsNumberChange"
@@ -235,6 +248,7 @@
:data="cars"
:orderInfo="data.orderInfo"
:historyOrder="data.historyOrder"
:tableCode="data.table.tableCode"
@clear="cleaCart"
></my-car>
</view>
@@ -295,7 +309,9 @@
import _ from "lodash";
import * as Api from "@/http/yskApi/Instead.js";
import * as limitTimeDiscountApi from "@/http/yskApi/limitTimeDiscount.js";
import * as padApi from "@/http/yskApi/pad.js";
import {
$table,
$choseTable,
@@ -347,6 +363,13 @@ import { getNowCart } from "@/pagesCreateOrder/util.js";
// import yskUtils from "ysk-utils";
import yskUtils from "@/lib/index";
provide("yskUtils", yskUtils);
import {useAccountStore} from '@/stores/account'
const accountStore = useAccountStore()
provide("accountStore", accountStore);
import {
$productCategory,
$layoutpage,
@@ -450,6 +473,7 @@ const layoutArr = {
};
const tabsEle = reactive({
scrollWidth: 0,
scroViewllLeft: 0,
tabsItems: [],
scrollLeft: 0,
});
@@ -494,7 +518,6 @@ function onMessage() {
data.isGoodsAdd = true;
// 如果是商品库存不足起售数量
if (msg.type == "no_suit_num") {
// cartItem = getNowCart(msg.data, cartArr)
cartControls([], "del");
}
return;
@@ -602,15 +625,15 @@ function delCart(id) {
* 获取订单详情
*/
async function getHistoryOrderDetail() {
if(shopInfo.registerType=='before'){
return
if (shopInfo.registerType == "before") {
return;
}
data.historyOrder = [];
let res = await getHistoryOrder({
tableCode: data.table.tableCode,
});
data.orderInfo = res.data;
if (res.data) {
data.orderInfo = res;
if (res) {
data.historyOrder = Object.entries(data.orderInfo.detailMap).map(
([key, value]) => ({
info: value,
@@ -1018,10 +1041,13 @@ function changeCategorySel(index) {
function setTabsCurrentPosition(position = "center") {
const index = layoutData.category.sel;
console.log(tabsEle.tabsItems[index]);
console.log(tabsEle.scroViewllLeft);
tabsEle.scrollLeft =
tabsEle.tabsItems[index].left -
tabsEle.scrollWidth / 2 +
tabsEle.tabsItems[index].width / 2;
tabsEle.tabsItems[index].width / 2 -
tabsEle.scroViewllLeft;
}
const shopInfo = uni.getStorageSync("shopInfo");
@@ -1042,13 +1068,13 @@ async function getGoodsData(max = 6, isGetPrve = false) {
try {
const res2 = await $productCategory(pageData.id);
layoutData.list[layoutData.current + i * fuhao] = {
...res2.data,
padLayoutCode: res2.data.padLayoutCode
? res2.data.padLayoutCode
: res2.data.productList.length <= 4
? layoutArr[res2.data.productList.length]
...res2,
padLayoutCode: res2.padLayoutCode
? res2.padLayoutCode
: res2.productList.length <= 4
? layoutArr[res2.productList.length]
: "6-grid",
productList: res2.data.productList.map((v) => {
productList: res2.productList.map((v) => {
v.salePrice = v.lowPrice;
const findGoodsInCar = cars.find((cars) => {
return cars.productId == v.id;
@@ -1140,16 +1166,15 @@ async function init() {
if (option.type == "add") {
setTabBar($category, $originGoods, []);
}
// shopInfo.value = uni.getStorageSync('shopInfo').data
let shopInfo = await getShopInfo({
id: uni.getStorageSync("shopInfo").id,
});
uni.setStorageSync("shopInfo", shopInfo.data);
uni.setStorageSync("shopInfo", shopInfo);
// 获取布局
// const getLayoutData = await getLayout({})
// 获取分类数据-获取商品分类
const categoryRes = await getCategory();
$category = categoryRes.data;
$category = categoryRes;
let arr = [];
for (let i = 0; i < $category.length; i++) {
@@ -1166,8 +1191,8 @@ async function init() {
// }
// })
const content =
res.data.records.length > 0
? res.data.records
res.records.length > 0
? res.records
: [
{
productCategoryId: $category[i].id,
@@ -1194,7 +1219,7 @@ async function init() {
});
getLayoutGoodsInit();
// 获取商品数据
const { data: goodsRes } = await getGoods();
const goodsRes = await getGoods();
const goods = goodsRes.filter((v) => {
let isShow = true;
if (v.type != "sku") {
@@ -1218,11 +1243,13 @@ function categoryEleInit() {
rect: true,
}).then((res) => {
tabsEle.scrollWidth = res.width;
tabsEle.scroViewllLeft = res.left;
});
for (let i in layoutData.category.list) {
getElRect("u-tab-item" + i, instance.value, {
rect: true,
}).then((res) => {
console.log(res);
tabsEle.tabsItems[i] = {
width: res.width,
left: res.left,
@@ -1317,9 +1344,11 @@ function chooseTable() {
// setTimeout(() => {
// changeCategorySel(0)
// }, 500)
go.to("PAGES_CHOOSE_TABLE", {
...data.table,
});
go.to("PAGES_INDEX_CHOOSE_TABLE");
// go.to("PAGES_CHOOSE_TABLE", {
// ...data.table,
// });
}
async function confirmModelConfirm(isCancel = false) {
@@ -1682,6 +1711,21 @@ function editCart(par, operate_type) {
}
const $cacheGoods = {};
//修改购物车商品备注
function updateCartRemark(e) {
let { remark, index, goods } = e;
cars[index].note = remark;
let params = {
number: e.num,
id: e.goods.id,
product_id: e.goods.product_id,
sku_id: e.goods.sku_id,
is_temporary: e.goods.is_temporary,
remark: remark,
};
editCart(params, "edit");
}
//购物车商品数量改变
async function carsNumberChange(e) {
if (!data.isGoodsAdd) {
@@ -1909,7 +1953,7 @@ async function onSelTable() {
data.masterId = masterId;
const cartRes = await getCart();
cars.length = 0;
const cartArr = getNowCart(cartRes.data);
const cartArr = getNowCart(cartRes);
for (let i in cartArr) {
cars.push(cartArr[i]);
}
@@ -1973,7 +2017,7 @@ let sysInfo = ref({
const limitTimeDiscountRes = ref(null);
async function getLimit() {
const res = await limitTimeDiscountApi.limitTimeDiscount();
limitTimeDiscountRes.value = res.data;
limitTimeDiscountRes.value = res;
if (data.table.tableCode) {
data.limitTimeDiscount = limitTimeDiscountRes.value;
@@ -1990,11 +2034,22 @@ async function getLimit() {
console.log("limitTimeDiscount", data.limitTimeDiscount);
}
}
async function getTableDetail() {
let res = await $returnTableDetail({
tableCode: data.table.tableCode,
});
console.log(res, "getTableDetail");
if(res){
data.table = res;
}
}
onLoad(async (opt) => {
sysInfo.value = uni.getSystemInfoSync();
uni.hideTabBar();
// option = opt
Object.assign(data.table, opt);
await getTableDetail();
await getLimit();
if (opt.useType) {
uni.setStorageSync("useType", opt.useType);
@@ -2034,7 +2089,7 @@ onLoad(async (opt) => {
// right: 0;
// top: 0;
// bottom: 0;
padding-right: 30rpx;
padding-right: 58rpx;
background-color: #fff;
white-space: nowrap;
}
@@ -2109,7 +2164,7 @@ $u-main-color: $my-main-color;
}
.u-tab-item {
padding: 10px 16px;
padding: 28rpx 20rpx;
box-sizing: border-box;
display: flex;
align-items: center;
@@ -2118,6 +2173,7 @@ $u-main-color: $my-main-color;
color: #444;
font-weight: 400;
line-height: 1;
margin-right: 56rpx;
}
.u-tab-item-active {