增加代客下单页面
This commit is contained in:
465
src/views/tool/Instead/components/carts/item.vue
Normal file
465
src/views/tool/Instead/components/carts/item.vue
Normal file
@@ -0,0 +1,465 @@
|
||||
<template>
|
||||
<div class="flex order-item u-m-b-14 relative" :class="[isActive]" @click="itemClick">
|
||||
<div class="absolute status-box">
|
||||
<span class="pack" v-if="item.pack_number * 1 > 0">
|
||||
包
|
||||
<span class="number">{{ item.pack_number * 1 }}</span>
|
||||
</span>
|
||||
<span class="da" v-if="item.is_print || item.is_print === null">打</span>
|
||||
<span class="isWaitCall" v-if="item.is_wait_call">等</span>
|
||||
<span class="tui" v-if="item.status === 'return'">退</span>
|
||||
</div>
|
||||
<div class="flex u-col-top">
|
||||
<div class="img">
|
||||
<div class="isSeatFee img u-line-1 u-flex u-col-center u-row-center" v-if="isSeatFee">
|
||||
<span>{{ item.name }}</span>
|
||||
</div>
|
||||
<div
|
||||
class="isSeatFee img u-line-1 u-flex u-col-center u-row-center"
|
||||
v-else-if="!item.product_id"
|
||||
>
|
||||
<span>临时菜</span>
|
||||
</div>
|
||||
<img v-else :src="item.coverImg" class="" alt="" />
|
||||
</div>
|
||||
<div class="good-info u-p-t-6">
|
||||
<div class="flex lh-16">
|
||||
<div class="name" :class="{ 'free-price': item.status === 'return' }">
|
||||
{{ item.name }}
|
||||
</div>
|
||||
<span class="good_info_discount" v-if="item.is_gift">赠</span>
|
||||
</div>
|
||||
<div v-if="item.typeEnum == 'weight'" class="specSnap">
|
||||
¥{{ currentPrice }}/{{ item.unit }}
|
||||
</div>
|
||||
<div v-if="item.specSnap" class="specSnap">
|
||||
{{ item.specSnap }}
|
||||
</div>
|
||||
<div v-if="item.proGroupInfo" class="specSnapss">
|
||||
<span>{{ item.groupType == 0 ? "固定套餐" : "可选套餐" }}:</span>
|
||||
<span v-for="(a, b) in proGroupInfo" :key="a.proId">
|
||||
{{ b == 0 ? "" : "," }}{{ a.proName }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="" v-if="placeNum == 0">
|
||||
<div class="note" v-if="item.remark">备注:{{ item.remark }}</div>
|
||||
<div class="note flex" v-else>
|
||||
<span>备注:</span>
|
||||
<el-icon @click="editNote" color="#999"><EditPen /></el-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="note" v-if="placeNum != 0 && item.note">备注:{{ item.remark || "" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 10px"></div>
|
||||
<div class="flex u-p-t-6">
|
||||
<div class="order-number-box u-font-12">
|
||||
<div class="" v-if="isSeatFee">X{{ item.totalNumber }}</div>
|
||||
<div class="" v-else>X{{ item.number }}</div>
|
||||
<div class="absolute" v-if="canChangeNumber">
|
||||
<div class="order-input-number">
|
||||
<el-icon color="#d8d8d8" size="22" @click="changeOrderNumber(-1)"><Remove /></el-icon>
|
||||
|
||||
<div style="width: 60px; margin: 0 4px" class="number-box">
|
||||
<el-input
|
||||
:min="0"
|
||||
type="number"
|
||||
@input="cartGoodsNumberInput"
|
||||
@change="cartGoodsNumberChange"
|
||||
v-model="number"
|
||||
placeholder="0"
|
||||
></el-input>
|
||||
</div>
|
||||
<el-icon color="#22bf64" size="22" @click="changeOrderNumber(1)">
|
||||
<CirclePlusFilled />
|
||||
</el-icon>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="color-333 total-price">
|
||||
<template v-if="item.is_gift || item.status == 'return'">
|
||||
<div>¥0</div>
|
||||
<div class="free-price">
|
||||
<span v-if="isSeatFee">¥{{ item.totalAmount }}</span>
|
||||
<span v-else>¥{{ isShowVipPrice ? vipAllPrice : allPrice }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="item.discountSaleAmount">
|
||||
<div>¥{{ discountNewPrice }}</div>
|
||||
<div class="free-price">
|
||||
<span>¥{{ isShowVipPrice ? vipAllPrice : allPrice }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div v-if="isSeatFee">¥{{ item.totalAmount }}</div>
|
||||
<div v-else>
|
||||
<div v-if="isShowVipPrice && vipAllPrice != allPrice">¥{{ vipAllPrice }}</div>
|
||||
<div
|
||||
:class="{
|
||||
'free-price': isShowVipPrice && vipAllPrice != allPrice,
|
||||
}"
|
||||
>
|
||||
<span>¥{{ allPrice }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
isShowVipPrice: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
//是否是餐位费
|
||||
isSeatFee: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
//是否是历史订单商品
|
||||
isOld: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
//第几次下单 1以及以上为历史订单 0为当前购物车
|
||||
placeNum: {
|
||||
type: [String, Number],
|
||||
default: 0,
|
||||
},
|
||||
selPlaceNum: {
|
||||
type: [String, Number],
|
||||
default: -1,
|
||||
},
|
||||
//是否允许改变数量
|
||||
canChangeNumber: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
item: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
number: 0,
|
||||
};
|
||||
},
|
||||
},
|
||||
selCart: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
id: "",
|
||||
};
|
||||
},
|
||||
},
|
||||
index: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
|
||||
let number = ref(0);
|
||||
|
||||
const currentPrice = computed(() => {
|
||||
return 0;
|
||||
});
|
||||
const proGroupInfo = computed(() => {
|
||||
return JSON.parse(props.item.proGroupInfo);
|
||||
});
|
||||
const discountNewPrice = computed(() => {
|
||||
return 0;
|
||||
});
|
||||
const vipAllPrice = computed(() => {
|
||||
return 0;
|
||||
});
|
||||
const allPrice = computed(() => {
|
||||
return props.item.number * props.item.salePrice;
|
||||
});
|
||||
|
||||
const isActive = computed(() => {
|
||||
return props.item.id == props.selCart.id ? "active" : "";
|
||||
});
|
||||
watch(
|
||||
() => props.item.number,
|
||||
(newval) => {
|
||||
console.log(newval);
|
||||
number.value = newval;
|
||||
}
|
||||
);
|
||||
|
||||
const emits = defineEmits([
|
||||
"editNote",
|
||||
"cartGoodsNumberChange",
|
||||
"cartGoodsNumberInput",
|
||||
"changeNumber",
|
||||
"itemClick",
|
||||
]);
|
||||
function editNote() {
|
||||
emits("editNote", props.index);
|
||||
}
|
||||
//购物车商品输入框数量改变
|
||||
function cartGoodsNumberChange(newval) {
|
||||
if (newval <= 0) {
|
||||
item.number = 1;
|
||||
}
|
||||
newval = `${newval}`.split(".")[0] * 1;
|
||||
number.value = newval;
|
||||
changeOrderNumber(newval - props.item.number);
|
||||
}
|
||||
//购物车商品输入框数量输入
|
||||
function cartGoodsNumberInput(newval) {
|
||||
if (newval <= 0) {
|
||||
return (number.value = 1);
|
||||
}
|
||||
newval = `${newval}`.split(".")[0] * 1;
|
||||
number.value = newval;
|
||||
}
|
||||
function changeOrderNumber(step) {
|
||||
emits("changeNumber", step, props.item);
|
||||
}
|
||||
function itemClick() {
|
||||
emits("itemClick");
|
||||
}
|
||||
onMounted(() => {
|
||||
number.value = props.item.number;
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .number-box .el-input__inner {
|
||||
border: none;
|
||||
}
|
||||
|
||||
::v-deep .el-button--text {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
::v-deep .number-box .el-input__inner {
|
||||
border: none;
|
||||
padding: 0 4px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.isSeatFee {
|
||||
background: #3f9eff;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.icon-remove {
|
||||
border: 1px solid #d8d8d8;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 50%;
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 10px;
|
||||
height: 1px;
|
||||
background: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.icon-add {
|
||||
color: rgb(34, 191, 100);
|
||||
font-size: 22px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.flex.order-item {
|
||||
padding: 4px;
|
||||
border-radius: 2px;
|
||||
display: flex;
|
||||
overflow: visible;
|
||||
cursor: pointer;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
transition: all 0.3s;
|
||||
|
||||
.status-box {
|
||||
width: 18px;
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
right: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
|
||||
> span {
|
||||
display: block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 4px 0 4px 0;
|
||||
font-size: 12px;
|
||||
line-height: 17px;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.isWaitCall {
|
||||
background: #d3adf7;
|
||||
}
|
||||
|
||||
.pack {
|
||||
background: #35ac6a;
|
||||
.number {
|
||||
background: #f56c6c;
|
||||
color: #fff;
|
||||
position: absolute;
|
||||
left: -7px;
|
||||
top: -7px;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
text-align: center;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.da {
|
||||
background: #35ac6a;
|
||||
}
|
||||
|
||||
.tui {
|
||||
background: #ac4735;
|
||||
}
|
||||
|
||||
&.active {
|
||||
background-color: rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.total-price {
|
||||
width: 94px;
|
||||
font-size: 16px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.good-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
min-width: 70px;
|
||||
|
||||
.specSnap {
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
.specSnapss {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
margin-top: 3px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
|
||||
.specSnap {
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
margin-top: 3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.name {
|
||||
font-size: 13px;
|
||||
text-align: left;
|
||||
color: #212121;
|
||||
overflow: hidden;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 59px;
|
||||
height: 59px;
|
||||
position: relative;
|
||||
margin-right: 10px;
|
||||
|
||||
img {
|
||||
width: 59px;
|
||||
height: 59px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.note {
|
||||
max-width: 70%;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
text-align: left;
|
||||
color: #999;
|
||||
margin-top: 5px;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.order-number-box {
|
||||
position: relative;
|
||||
|
||||
.absolute {
|
||||
width: 60px;
|
||||
height: 40px;
|
||||
right: -38px;
|
||||
top: -14px;
|
||||
position: absolute;
|
||||
|
||||
.order-input-number {
|
||||
position: absolute;
|
||||
right: -6px;
|
||||
top: 0;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
display: none;
|
||||
background-color: #fff;
|
||||
border: 1px solid #e4e7ed;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.06);
|
||||
padding: 9px 6px;
|
||||
background-color: #fff;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
&:hover .order-input-number {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.good_info_discount {
|
||||
height: 16px;
|
||||
padding: 0 3px;
|
||||
color: #ff3f3f;
|
||||
background-color: rgba(255, 63, 63, 0.1);
|
||||
border-radius: 2px;
|
||||
margin-left: 6px;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
::v-deep .order-input-number .el-input__inner::-webkit-inner-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
::v-deep .order-input-number .el-input__inner::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
146
src/views/tool/Instead/components/carts/list.vue
Normal file
146
src/views/tool/Instead/components/carts/list.vue
Normal file
@@ -0,0 +1,146 @@
|
||||
<template>
|
||||
<div class="list">
|
||||
<div class="carts">
|
||||
<!-- 当前购物车 -->
|
||||
<div v-for="(item, index) in carts.list" :key="index">
|
||||
<carts-item
|
||||
:item="item"
|
||||
@changeNumber="changeNumber"
|
||||
:selCart="carts.selCart"
|
||||
@itemClick="itemClick(item)"
|
||||
></carts-item>
|
||||
</div>
|
||||
<!-- 赠菜 -->
|
||||
<div class="cart-title"><span>以下是优惠菜品</span></div>
|
||||
<div v-for="(item, index) in carts.giftList" :key="index">
|
||||
<carts-item
|
||||
:item="item"
|
||||
@changeNumber="changeNumber"
|
||||
:selCart="carts.selCart"
|
||||
@itemClick="itemClick(item)"
|
||||
></carts-item>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom">
|
||||
<div class="yiyouhui">{{ carts.yiyouhui }}</div>
|
||||
<div class="u-flex u-row-between">
|
||||
<el-link type="primary">打印制作单</el-link>
|
||||
<div>
|
||||
<span class="totalNumber">共{{ carts.totalNumber }}件</span>
|
||||
<span class="totalPrice">¥{{ carts.payMoney }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<el-button type="primary">微信/支付宝</el-button>
|
||||
<el-button type="primary">现金</el-button>
|
||||
<el-button type="primary">更多支付</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import cartsItem from "./item.vue";
|
||||
import { useCartsStore } from "@/store/modules/carts";
|
||||
|
||||
const props = defineProps({
|
||||
goodsList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
goodsMapisFinish: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const selCartId = ref(null);
|
||||
|
||||
const carts = useCartsStore();
|
||||
const goodsMap = {};
|
||||
watch(
|
||||
() => props.goodsMapisFinish,
|
||||
(newval) => {
|
||||
if (newval) {
|
||||
for (let goods of props.goodsList) {
|
||||
goodsMap[goods.id] = goods;
|
||||
}
|
||||
carts.init({}, goodsMap);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
function itemClick(item) {
|
||||
carts.changeSelCart(item);
|
||||
}
|
||||
|
||||
function changeNumber(step, item) {
|
||||
carts.changeNumber(step * 1, item);
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
carts,
|
||||
});
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.list {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.totalNumber {
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
}
|
||||
.totalPrice {
|
||||
font-size: 18px;
|
||||
color: #000;
|
||||
}
|
||||
.bottom {
|
||||
position: relative;
|
||||
padding-top: 14px;
|
||||
border-top: 1px solid #ebebeb;
|
||||
.yiyouhui {
|
||||
text-align: right;
|
||||
color: #c12a2a;
|
||||
font-size: 13px;
|
||||
line-height: 16px;
|
||||
top: 14px;
|
||||
}
|
||||
}
|
||||
:deep(.btn-group) {
|
||||
display: flex;
|
||||
margin-top: 20px;
|
||||
.el-button {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
.carts {
|
||||
height: calc(100% - 120px);
|
||||
overflow-y: scroll;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
/* 修改垂直滚动条 */
|
||||
.carts::-webkit-scrollbar {
|
||||
width: 0; /* 修改宽度 */
|
||||
}
|
||||
|
||||
/* 修改滚动条轨道背景色 */
|
||||
.carts::-webkit-scrollbar-track {
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
.cart-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 12px;
|
||||
color: rgba(0, 0, 0, 0.4);
|
||||
&::after {
|
||||
content: "";
|
||||
flex: 1;
|
||||
height: 1px;
|
||||
background-color: #ebebeb;
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
143
src/views/tool/Instead/components/control.vue
Normal file
143
src/views/tool/Instead/components/control.vue
Normal file
@@ -0,0 +1,143 @@
|
||||
<template>
|
||||
<div class="controls">
|
||||
<div class="input-number">
|
||||
<div class="reduce">
|
||||
<el-icon @click="carts.changeNumber(-1, carts.selCart)"><Minus /></el-icon>
|
||||
</div>
|
||||
<span class="text">{{ carts.selCart.number || 1 }}</span>
|
||||
<div class="add">
|
||||
<el-icon @click="carts.changeNumber(1, carts.selCart)"><Plus /></el-icon>
|
||||
</div>
|
||||
</div>
|
||||
<el-button
|
||||
v-for="(item, index) in controls"
|
||||
:key="index"
|
||||
v-bund="item"
|
||||
:disabled="btnDisabled(item)"
|
||||
@click="controlsClick(item)"
|
||||
>
|
||||
{{ returnLabel(item) }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const number = ref(1);
|
||||
import { useCartsStore } from "@/store/modules/carts";
|
||||
const carts = useCartsStore();
|
||||
|
||||
const controls = ref([
|
||||
{ label: "规格", key: "", disabled: false, per: "sku" },
|
||||
{ label: "赠送", key: "is_gift", disabled: false, per: "cart" },
|
||||
{ label: "打包", key: "is_pack", disabled: false, per: "cart" },
|
||||
{ label: "删除", key: "del", disabled: false, per: "cart" },
|
||||
{ label: "存单", key: "", disabled: false, per: "save" },
|
||||
{ label: "取单", key: "", disabled: false },
|
||||
{ label: "单品备注", key: "one-note", disabled: false, per: "one-note" },
|
||||
{ label: "整单备注", key: "all-note", disabled: false, per: "all-note" },
|
||||
{ label: "退菜", key: "", disabled: false, per: "order" },
|
||||
{ label: "免厨打", key: "is_print", disabled: false, per: "cart" },
|
||||
{ label: "单品改价", key: "", disabled: false, per: "cart" },
|
||||
{ label: "等叫", key: "", disabled: false, per: "cart" },
|
||||
{ label: "整单等叫", key: "", disabled: false, per: "all-wating" },
|
||||
]);
|
||||
|
||||
const emits = defineEmits(["noteClick"]);
|
||||
function controlsClick(item) {
|
||||
switch (item.key) {
|
||||
case "is_gift":
|
||||
carts.updateTag("is_gift", carts.selCart.is_gift ? 0 : 1);
|
||||
break;
|
||||
case "is_pack":
|
||||
emits("packClick", carts.selCart.pack_number, carts.selCart.number);
|
||||
break;
|
||||
case "is_print":
|
||||
carts.updateTag("is_print", carts.selCart.is_print ? 0 : 1);
|
||||
break;
|
||||
case "del":
|
||||
carts.del(carts.selCart);
|
||||
break;
|
||||
case "save":
|
||||
carts.saveCart();
|
||||
break;
|
||||
case "one-note":
|
||||
emits("noteClick", true);
|
||||
break;
|
||||
case "all-note":
|
||||
emits("noteClick", false);
|
||||
break;
|
||||
case "order":
|
||||
carts.order();
|
||||
break;
|
||||
case "all-wating":
|
||||
carts.allWating();
|
||||
break;
|
||||
}
|
||||
}
|
||||
const perList = computed(() => {
|
||||
if (!carts.selCart.id) {
|
||||
return ["all-wating", "all-note"];
|
||||
}
|
||||
if (carts.selCart.id) {
|
||||
return ["cart", "save", "one-note", "all-note", "all-wating"];
|
||||
}
|
||||
});
|
||||
|
||||
function btnDisabled(item) {
|
||||
return !perList.value.includes(item.per);
|
||||
}
|
||||
function returnLabel(item) {
|
||||
if (item.key == "is_gift") {
|
||||
return carts.selCart.is_gift ? "取消赠送" : "赠送";
|
||||
}
|
||||
if (item.key == "is_pack") {
|
||||
return carts.selCart.is_pack ? "取消打包" : "打包";
|
||||
}
|
||||
if (item.key == "is_print") {
|
||||
return carts.selCart.is_print ? "免厨打" : "打印";
|
||||
}
|
||||
return item.label;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
$gap: 10px;
|
||||
.controls {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
flex-direction: column;
|
||||
width: 106px;
|
||||
padding: 14px 10px;
|
||||
background-color: #f7f7fa;
|
||||
}
|
||||
.el-button + .el-button {
|
||||
margin-top: $gap;
|
||||
margin-left: 0;
|
||||
}
|
||||
.input-number {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fff;
|
||||
border: 1px solid #dcdfe6;
|
||||
margin-bottom: $gap;
|
||||
cursor: pointer;
|
||||
.reduce,
|
||||
.text,
|
||||
.add {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 38px;
|
||||
}
|
||||
.text {
|
||||
height: 48px;
|
||||
font-size: 30px;
|
||||
border-top: 1px solid #dcdfe6;
|
||||
border-bottom: 1px solid #dcdfe6;
|
||||
}
|
||||
.reduce {
|
||||
}
|
||||
.add {
|
||||
}
|
||||
}
|
||||
</style>
|
||||
147
src/views/tool/Instead/components/dialog-goods-sel.vue
Normal file
147
src/views/tool/Instead/components/dialog-goods-sel.vue
Normal file
@@ -0,0 +1,147 @@
|
||||
<template>
|
||||
<!-- 选择规格 -->
|
||||
<el-dialog width="410px" :title="goods.name" v-model="show" @close="close">
|
||||
<div class="tag-group">
|
||||
<div class="tag-item" v-for="(item, key) in goods.selectSpecInfo" :key="key">
|
||||
<div class="tag-name">{{ key }}</div>
|
||||
<div>
|
||||
<span style="margin: 0 10px 10px 0" v-for="(val, valIndex) in item.list" :key="valIndex">
|
||||
<el-button
|
||||
plain
|
||||
:type="val === item.sel ? 'primary' : ''"
|
||||
:disabled="val.disabled"
|
||||
@click="changeSkuSel(key, val)"
|
||||
>
|
||||
{{ val }}
|
||||
</el-button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<template v-if="skuData">
|
||||
<div class="u-flex u-row-between">
|
||||
<div>
|
||||
<div class="price">¥ {{ skuData.salePrice }}</div>
|
||||
<div class="sku-group-text">
|
||||
<span>{{ skuName }}</span>
|
||||
<span>库存:{{ 0 }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="u-flex">
|
||||
<el-input-number v-model="number" :min="skuData.suitNum"></el-input-number>
|
||||
</div>
|
||||
</div>
|
||||
<div class="u-flex" style="margin-top: 14px">
|
||||
<el-button v-if="!skuData.isGrounding" disabled style="width: 100%">已下架</el-button>
|
||||
<template v-else>
|
||||
<el-button type="primary" style="width: 100%">确 定</el-button>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<div v-else>
|
||||
<el-button type="primary" style="width: 100%" disabled>确 定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup >
|
||||
let show = ref(false);
|
||||
// const props = defineProps({
|
||||
// goods: {
|
||||
// type: Object,
|
||||
// default: () => ({}),
|
||||
// },
|
||||
// });
|
||||
|
||||
let number = ref(1);
|
||||
|
||||
const defaultGoods = { selectSpecInfo: {}, skuList: [] };
|
||||
let goods = ref({ ...defaultGoods });
|
||||
|
||||
function resetData() {
|
||||
goods.value = { ...defaultGoods };
|
||||
}
|
||||
|
||||
function changeSkuSel(key, val) {
|
||||
console.log(key, val);
|
||||
goods.value.selectSpecInfo[key].sel = val;
|
||||
}
|
||||
|
||||
function open(data) {
|
||||
show.value = true;
|
||||
if (data) {
|
||||
let selectSpecInfo = {};
|
||||
for (let i in data.selectSpecInfo) {
|
||||
if (data.selectSpecInfo[i].length > 0) {
|
||||
selectSpecInfo[i] = {
|
||||
list: data.selectSpecInfo[i],
|
||||
sel: "",
|
||||
disabled: false,
|
||||
};
|
||||
}
|
||||
}
|
||||
goods.value = { ...data, selectSpecInfo };
|
||||
console.log(goods.value);
|
||||
}
|
||||
}
|
||||
function close() {
|
||||
show.value = false;
|
||||
resetData();
|
||||
}
|
||||
const skuName = computed(() => {
|
||||
if (goods.value.selectSpecInfo) {
|
||||
let sku = [];
|
||||
for (let i in goods.value.selectSpecInfo) {
|
||||
sku.push(goods.value.selectSpecInfo[i].sel);
|
||||
}
|
||||
return sku.join(",");
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
|
||||
const skuData = computed(() => {
|
||||
if (goods.value.skuList.length <= 0) {
|
||||
return undefined;
|
||||
}
|
||||
return goods.value.skuList.find((item) => {
|
||||
return item.specInfo === skuName.value;
|
||||
});
|
||||
});
|
||||
|
||||
defineExpose({ open, close });
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.tag-group {
|
||||
margin-top: 10px;
|
||||
|
||||
.tag-item {
|
||||
margin-bottom: 20px;
|
||||
|
||||
.tag-name {
|
||||
margin-bottom: 10px;
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
.price {
|
||||
font-size: 18px;
|
||||
text-align: left;
|
||||
color: #ff5152;
|
||||
font-weight: 600;
|
||||
}
|
||||
.sku-group-text {
|
||||
text-align: left;
|
||||
color: #666;
|
||||
font-size: 11px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
::v-deep .number-box .el-input__inner {
|
||||
border: none;
|
||||
padding: 0 4px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
50
src/views/tool/Instead/components/goods-item.vue
Normal file
50
src/views/tool/Instead/components/goods-item.vue
Normal file
@@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<div class="goods-item">
|
||||
<el-image v-if="item.coverImg" class="goods-image" :src="item.coverImg" fit="cover"></el-image>
|
||||
<div class="info">
|
||||
<div class="name u-flex u-flex-wrap">
|
||||
<span class="weight" v-if="item.type == 'weigh'">称重</span>
|
||||
<span>{{ item.name }}</span>
|
||||
</div>
|
||||
<div class="">¥{{ item.lowPrice }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
index: Number,
|
||||
active: Boolean,
|
||||
select: Function,
|
||||
});
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.goods-item {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 4px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
.goods-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.info {
|
||||
position: absolute;
|
||||
box-sizing: border-box;
|
||||
padding: 8px;
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
background-color: rgba(46, 46, 46, 0.38);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
96
src/views/tool/Instead/components/note.vue
Normal file
96
src/views/tool/Instead/components/note.vue
Normal file
@@ -0,0 +1,96 @@
|
||||
<template>
|
||||
<el-dialog :title="title" width="410px" v-model="show" @close="reset">
|
||||
<el-input :rows="6" type="textarea" v-model="note" placeholder="请输入备注"></el-input>
|
||||
<div>
|
||||
<el-tag
|
||||
v-for="(tag, index) in tags"
|
||||
@click="addNote(tag)"
|
||||
size="medium"
|
||||
:key="index"
|
||||
closable
|
||||
@close="delTag(index)"
|
||||
type="primary"
|
||||
>
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button size="medium" @click="close">取消</el-button>
|
||||
<el-button size="medium" type="primary" @click="confirm">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup>
|
||||
let show = ref(false);
|
||||
let tags = ref([]);
|
||||
let note = ref("");
|
||||
let title = ref("整单备注(提交订单时生效)");
|
||||
let isOne = ref(false);
|
||||
watch(
|
||||
() => tags.length,
|
||||
() => {
|
||||
localStorage.setItem("tags", JSON.stringify(tags.value));
|
||||
}
|
||||
);
|
||||
|
||||
function reset() {
|
||||
note.value = "";
|
||||
}
|
||||
function delTag(index) {
|
||||
this.tags.splice(index, 1);
|
||||
}
|
||||
function addNote(tag) {
|
||||
if (!note.value) {
|
||||
return (note.value = tag);
|
||||
}
|
||||
note.value = tag + "," + note.value;
|
||||
}
|
||||
function open(remark, isOneNote) {
|
||||
isOne.value = isOneNote;
|
||||
title.value = isOneNote ? "整单备注(提交订单时生效)" : "单品备注(提交订单时生效)";
|
||||
show.value = true;
|
||||
note.value = remark ? remark : "";
|
||||
const tags = localStorage.getItem("tags");
|
||||
console.log(tags);
|
||||
this.tags = tags ? JSON.parse(tags) : ["免香菜", "不要辣", "不要葱"];
|
||||
}
|
||||
function close() {
|
||||
show.value = false;
|
||||
}
|
||||
const emits = defineEmits(["confirm"]);
|
||||
function confirm() {
|
||||
const originTags = [...tags.value];
|
||||
if (note.value) {
|
||||
if (originTags >= 10) {
|
||||
originTags.shift();
|
||||
}
|
||||
if (note.value.length <= 16) {
|
||||
const newTags = new Set([note.value, ...originTags]);
|
||||
localStorage.setItem("tags", JSON.stringify([...newTags]));
|
||||
}
|
||||
}
|
||||
emits("confirm", note.value, isOne.value);
|
||||
close();
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
close,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .el-dialog__body {
|
||||
margin-bottom: 14px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
::v-deep .el-tag {
|
||||
margin-top: 10px;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 5px;
|
||||
cursor: pointer;
|
||||
font-size: 15px;
|
||||
line-height: 35px;
|
||||
height: 35px;
|
||||
}
|
||||
</style>
|
||||
60
src/views/tool/Instead/components/pack.vue
Normal file
60
src/views/tool/Instead/components/pack.vue
Normal file
@@ -0,0 +1,60 @@
|
||||
<template>
|
||||
<el-dialog title="修改打包数量" width="410px" v-model="show" @close="reset">
|
||||
<el-input-number
|
||||
:min="0"
|
||||
:max="max"
|
||||
type="number"
|
||||
v-model="number"
|
||||
placeholder="请输入打包数量"
|
||||
></el-input-number>
|
||||
<template #footer>
|
||||
<el-button size="medium" @click="close">取消</el-button>
|
||||
<el-button size="medium" type="primary" @click="confirm">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup>
|
||||
let show = ref(false);
|
||||
let number = ref(0);
|
||||
const max = ref(0);
|
||||
function reset() {
|
||||
max.value = 0;
|
||||
number.value = 0;
|
||||
}
|
||||
|
||||
function open(packNumber, maxNumber) {
|
||||
show.value = true;
|
||||
max.value = maxNumber || 0;
|
||||
number.value = packNumber || 0;
|
||||
}
|
||||
function close() {
|
||||
show.value = false;
|
||||
reset();
|
||||
}
|
||||
const emits = defineEmits(["confirm"]);
|
||||
function confirm() {
|
||||
emits("confirm", number.value);
|
||||
close();
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
close,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .el-dialog__body {
|
||||
margin-bottom: 14px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
::v-deep .el-tag {
|
||||
margin-top: 10px;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 5px;
|
||||
cursor: pointer;
|
||||
font-size: 15px;
|
||||
line-height: 35px;
|
||||
height: 35px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user