代客下单修改,登录页面修改,部分页面调整,请求封装调整
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
125
pagesCreateOrder/index/components/serving-style.modal.vue
Normal file
125
pagesCreateOrder/index/components/serving-style.modal.vue
Normal 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>
|
||||
Reference in New Issue
Block a user