代客下单修改,增加线上店铺装修页面
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
</div>
|
||||
<div
|
||||
class="isSeatFee img u-line-1 u-flex u-col-center u-row-center"
|
||||
v-else-if="!item.product_id"
|
||||
v-else-if="item.is_temporary"
|
||||
>
|
||||
<span>临时菜</span>
|
||||
</div>
|
||||
@@ -25,7 +25,7 @@
|
||||
<div class="good-info u-p-t-6">
|
||||
<div class="flex lh-16">
|
||||
<div class="name" :class="{ 'free-price': item.status === 'return' }">
|
||||
{{ item.name }}
|
||||
{{ item.name || item.product_name }}
|
||||
</div>
|
||||
<span class="good_info_discount" v-if="item.is_gift">赠</span>
|
||||
</div>
|
||||
@@ -177,6 +177,9 @@ const vipAllPrice = computed(() => {
|
||||
return 0;
|
||||
});
|
||||
const allPrice = computed(() => {
|
||||
if (props.item.discount_sale_amount * 1 != 0) {
|
||||
return props.item.number * props.item.discount_sale_amount;
|
||||
}
|
||||
return props.item.number * props.item.salePrice;
|
||||
});
|
||||
|
||||
@@ -199,7 +202,7 @@ const emits = defineEmits([
|
||||
"itemClick",
|
||||
]);
|
||||
function editNote() {
|
||||
emits("editNote", props.index);
|
||||
emits("editNote");
|
||||
}
|
||||
//购物车商品输入框数量改变
|
||||
function cartGoodsNumberChange(newval) {
|
||||
|
||||
@@ -8,18 +8,22 @@
|
||||
@changeNumber="changeNumber"
|
||||
:selCart="carts.selCart"
|
||||
@itemClick="itemClick(item)"
|
||||
@editNote="editNote"
|
||||
></carts-item>
|
||||
</div>
|
||||
<!-- 赠菜 -->
|
||||
<div class="cart-title"><span>以下是优惠菜品</span></div>
|
||||
<div class="cart-title" v-if="carts.giftList.length > 0"><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)"
|
||||
@editNote="editNote"
|
||||
></carts-item>
|
||||
</div>
|
||||
|
||||
<el-empty image-size="60" v-if="carts.isEmpty" description="点餐列表为空" />
|
||||
</div>
|
||||
<div class="bottom">
|
||||
<div class="yiyouhui">{{ carts.yiyouhui }}</div>
|
||||
@@ -54,6 +58,11 @@ const props = defineProps({
|
||||
},
|
||||
});
|
||||
|
||||
const emits = defineEmits(["editNote"]);
|
||||
function editNote() {
|
||||
emits("editNote");
|
||||
}
|
||||
|
||||
const selCartId = ref(null);
|
||||
|
||||
const carts = useCartsStore();
|
||||
|
||||
@@ -37,12 +37,12 @@ const controls = ref([
|
||||
{ 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: "changePriceClick", disabled: false, per: "cart" },
|
||||
{ label: "等叫", key: "is_wait_call", disabled: false, per: "cart" },
|
||||
{ label: "整单等叫", key: "", disabled: false, per: "all-wating" },
|
||||
]);
|
||||
|
||||
const emits = defineEmits(["noteClick"]);
|
||||
const emits = defineEmits(["noteClick", "changePriceClick", "packClick"]);
|
||||
function controlsClick(item) {
|
||||
switch (item.key) {
|
||||
case "is_gift":
|
||||
@@ -57,8 +57,8 @@ function controlsClick(item) {
|
||||
case "del":
|
||||
carts.del(carts.selCart);
|
||||
break;
|
||||
case "save":
|
||||
carts.saveCart();
|
||||
case "changePriceClick":
|
||||
emits("changePriceClick", carts.selCart);
|
||||
break;
|
||||
case "one-note":
|
||||
emits("noteClick", true);
|
||||
@@ -66,8 +66,8 @@ function controlsClick(item) {
|
||||
case "all-note":
|
||||
emits("noteClick", false);
|
||||
break;
|
||||
case "order":
|
||||
carts.order();
|
||||
case "is_wait_call":
|
||||
carts.updateTag("is_wait_call", carts.selCart.is_wait_call ? 0 : 1);
|
||||
break;
|
||||
case "all-wating":
|
||||
carts.allWating();
|
||||
@@ -96,6 +96,9 @@ function returnLabel(item) {
|
||||
if (item.key == "is_print") {
|
||||
return carts.selCart.is_print ? "免厨打" : "打印";
|
||||
}
|
||||
if (item.key == "is_wait_call") {
|
||||
return carts.selCart.is_wait_call ? "取消等叫" : "等叫";
|
||||
}
|
||||
return item.label;
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<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>
|
||||
<el-button type="primary" style="width: 100%" @click="confirm">确 定</el-button>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
@@ -87,6 +87,7 @@ function open(data) {
|
||||
}
|
||||
function close() {
|
||||
show.value = false;
|
||||
number.value = 1;
|
||||
resetData();
|
||||
}
|
||||
const skuName = computed(() => {
|
||||
@@ -110,6 +111,27 @@ const skuData = computed(() => {
|
||||
});
|
||||
});
|
||||
|
||||
watch(
|
||||
() => skuData.value,
|
||||
(newval) => {
|
||||
if (newval) {
|
||||
number.value = newval.suitNum;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const emits = defineEmits(["confirm"]);
|
||||
function confirm() {
|
||||
if (skuData.value) {
|
||||
emits("confirm", {
|
||||
sku_id: skuData.value.id,
|
||||
product_id: goods.value.id,
|
||||
number: number.value,
|
||||
});
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({ open, close });
|
||||
</script>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<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 class="weight" v-if="item.type == 'weight'">称重</span>
|
||||
<span>{{ item.name }}</span>
|
||||
</div>
|
||||
<div class="">¥{{ item.lowPrice }}</div>
|
||||
@@ -47,4 +47,14 @@ const props = defineProps({
|
||||
background-color: rgba(46, 46, 46, 0.38);
|
||||
}
|
||||
}
|
||||
.weight {
|
||||
height: 15px;
|
||||
background: linear-gradient(124deg, rgb(115, 201, 105) 6%, rgb(39, 146, 27) 93%);
|
||||
border-radius: 2px;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
line-height: 15px;
|
||||
padding: 0px 2px;
|
||||
margin-right: 2px;
|
||||
}
|
||||
</style>
|
||||
138
src/views/tool/Instead/components/popup-cart-changePrice.vue
Normal file
138
src/views/tool/Instead/components/popup-cart-changePrice.vue
Normal file
@@ -0,0 +1,138 @@
|
||||
<template>
|
||||
<el-dialog title="单品改价" width="410px" v-model="show" @close="reset" :modal="modal">
|
||||
<div class="u-m-t-30 u-flex">
|
||||
<div class="no-wrap u-m-r-20">价格更改为</div>
|
||||
<el-input
|
||||
:min="min"
|
||||
placeholder="请输入更改后的价格"
|
||||
v-model="price"
|
||||
@blur="checkPrice"
|
||||
type="number"
|
||||
>
|
||||
<template #append>元</template>
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="u-m-t-16">
|
||||
<span class="color-red">*</span>
|
||||
<span>当前单品单价:{{ originPrice }}元</span>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<div>
|
||||
<el-button size="medium" @click="close">取消</el-button>
|
||||
<el-button size="medium" type="primary" @click="confirm">确定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { ElMessage } from "element-plus";
|
||||
export default {
|
||||
props: {
|
||||
modal: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
vipUser: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
isVip: false,
|
||||
};
|
||||
},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
min: 0,
|
||||
originPrice: "",
|
||||
price: "",
|
||||
show: false,
|
||||
goods: {
|
||||
productId: -999,
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isSeatFee() {
|
||||
return returnIsSeatFee(this.goods);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
checkPrice() {
|
||||
if (this.price < 0) {
|
||||
this.price = 0;
|
||||
}
|
||||
},
|
||||
changeSel(item) {
|
||||
item.checked = !item.checked;
|
||||
},
|
||||
reset() {
|
||||
this.price = "";
|
||||
},
|
||||
open(item) {
|
||||
console.log(item);
|
||||
this.show = true;
|
||||
const price = item.discount_sale_amount * 1 || item.salePrice * 1;
|
||||
this.price = price;
|
||||
this.originPrice = price;
|
||||
},
|
||||
close() {
|
||||
this.show = false;
|
||||
this.price = "";
|
||||
this.originPrice = "";
|
||||
},
|
||||
async confirm() {
|
||||
if (this.price < 0) {
|
||||
return ElMessage.error("价格不能小于0");
|
||||
}
|
||||
this.$emit("confirm", this.price);
|
||||
this.close();
|
||||
// this.$emit("confirm", { note: note, num: this.number });
|
||||
},
|
||||
},
|
||||
mounted() {},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-dialog__body) {
|
||||
margin-bottom: 14px;
|
||||
margin-top: 14px;
|
||||
padding: 0 20px;
|
||||
}
|
||||
:deep(.el-tag) {
|
||||
margin-top: 10px;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 5px;
|
||||
cursor: pointer;
|
||||
font-size: 15px;
|
||||
line-height: 35px;
|
||||
height: 35px;
|
||||
}
|
||||
.tags {
|
||||
.tag {
|
||||
margin: 10px 10px 0 0;
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 4px;
|
||||
padding: 10px 13px;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
cursor: pointer;
|
||||
&.active {
|
||||
color: #1890ff;
|
||||
background: #e8f4ff;
|
||||
border-color: #a3d3ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
:deep(.el-dialog__body) {
|
||||
color: #333;
|
||||
}
|
||||
:deep(input::-webkit-outer-spin-button) {
|
||||
-webkit-appearance: none !important;
|
||||
}
|
||||
:deep(input::-webkit-inner-spin-button) {
|
||||
-webkit-appearance: none !important;
|
||||
}
|
||||
</style>
|
||||
111
src/views/tool/Instead/components/popup-linshiCai.vue
Normal file
111
src/views/tool/Instead/components/popup-linshiCai.vue
Normal file
@@ -0,0 +1,111 @@
|
||||
<template>
|
||||
<el-dialog title="添加临时菜" width="410px" v-model="show" @close="reset">
|
||||
<div>
|
||||
<div>将临时菜添加至购物车,不会影响总商品库</div>
|
||||
<div class="u-m-t-16">
|
||||
<el-form ref="form" :model="form" label-width="80px" :rules="rules">
|
||||
<el-form-item label="菜品名称" prop="product_name">
|
||||
<el-input v-model="form.product_name" placeholder="请输入菜品名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="价格" prop="discount_sale_amount">
|
||||
<el-input v-model="form.discount_sale_amount" placeholder="请输入价格" type="number">
|
||||
<template #append>元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="下单数量" prop="number">
|
||||
<el-input v-model="form.number" placeholder="请输入下单数量" type="number"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div>
|
||||
<el-button size="medium" @click="close">取消</el-button>
|
||||
<el-button size="medium" type="primary" @click="confirm">确定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { ElMessage } from "element-plus";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
rules: {
|
||||
product_name: [{ required: true, message: "请输入菜品名称", trigger: "blur" }],
|
||||
discount_sale_amount: [{ required: true, message: "请输入菜品价格", trigger: "blur" }],
|
||||
number: [{ required: true, message: "请输入下单数量", trigger: "blur" }],
|
||||
},
|
||||
form: {
|
||||
product_name: "",
|
||||
discount_sale_amount: "",
|
||||
number: 1,
|
||||
remark: "",
|
||||
},
|
||||
category: [],
|
||||
units: [],
|
||||
option: {},
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
reset() {
|
||||
this.$refs.form.resetFields();
|
||||
},
|
||||
|
||||
open(opt) {
|
||||
this.show = true;
|
||||
this.option = opt;
|
||||
},
|
||||
close() {
|
||||
this.show = false;
|
||||
},
|
||||
async submit() {
|
||||
this.$emit("confirm", this.form);
|
||||
this.close();
|
||||
},
|
||||
confirm() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
console.log(valid);
|
||||
if (this.form.discount_sale_amount * 1 <= 0 || this.form.discount_sale_amount * 1 <= 0) {
|
||||
return ElMessage.error("价格和数量必须大于0");
|
||||
}
|
||||
this.submit();
|
||||
} else {
|
||||
console.log("error submit!!");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .el-dialog__body {
|
||||
margin-bottom: 14px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
::v-deep .el-form-item__label {
|
||||
text-align: left;
|
||||
}
|
||||
input[type="number"]::-webkit-inner-spin-button,
|
||||
input[type="number"]::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
::v-deep .el-input__inner::-webkit-inner-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
::v-deep .el-input__inner::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -6,12 +6,43 @@
|
||||
<span class="title">代客下单</span>
|
||||
<div class="u-m-l-20 flex">
|
||||
<el-button type="primary">选择用户</el-button>
|
||||
<el-button>选择桌号</el-button>
|
||||
<el-popover placement="right" width="333" trigger="click" v-model="tableShow">
|
||||
<el-input
|
||||
placeholder="请输入内容"
|
||||
prefix-icon="search"
|
||||
v-model="tableSearchText"
|
||||
@input="tablesearchInput"
|
||||
></el-input>
|
||||
<div style="max-height: 398px; overflow-y: scroll" class="u-m-t-12">
|
||||
<div
|
||||
class="u-flex u-row-between u-p-t-8 table-item u-p-b-8 u-p-r-30"
|
||||
v-for="(item, index) in tableList"
|
||||
:key="index"
|
||||
@click="tableClick(item, index)"
|
||||
>
|
||||
<span>{{ item.name }}</span>
|
||||
<span :style="{ color: returnTableColor(item.status) }">
|
||||
{{ returnTableLabel(item.status) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="color-999 u-p-30 u-text-center" v-if="!tableList.length">
|
||||
无可用桌台
|
||||
</div>
|
||||
</div>
|
||||
<template #reference>
|
||||
<el-button>选择桌号</el-button>
|
||||
</template>
|
||||
</el-popover>
|
||||
<el-button type="warning">扫码验券</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<el-input placeholder="请输入商品名称" v-model="keywords" clearable>
|
||||
<el-input
|
||||
placeholder="请输入商品名称"
|
||||
v-model="goods.query.name"
|
||||
clearable
|
||||
@change="getGoods"
|
||||
>
|
||||
<template #suffix>
|
||||
<el-icon class="el-input__icon"><search /></el-icon>
|
||||
</template>
|
||||
@@ -43,13 +74,18 @@
|
||||
<a @click="clearCarts" style="color: #1890ff">清空</a>
|
||||
</div>
|
||||
<cartsList
|
||||
@editNote="showNote(true)"
|
||||
:goodsMapisFinish="goodsMapisFinish"
|
||||
:goodsList="goods.list"
|
||||
ref="refCart"
|
||||
></cartsList>
|
||||
</div>
|
||||
<div class="center">
|
||||
<Controls @noteClick="showNote" @packClick="showPack" />
|
||||
<Controls
|
||||
@noteClick="showNote"
|
||||
@packClick="showPack"
|
||||
@changePriceClick="showChangePrice"
|
||||
/>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="flex categoty u-col-center">
|
||||
@@ -73,17 +109,20 @@
|
||||
>
|
||||
<el-tag
|
||||
size="large"
|
||||
type="primary"
|
||||
:type="goods.query.categoryId === item.id ? 'primary' : 'info'"
|
||||
effect="dark"
|
||||
v-if="goods.query.categoryId === item.id"
|
||||
>
|
||||
{{ item.name }}
|
||||
</el-tag>
|
||||
<el-tag size="large" type="info" v-else effect="plain">{{ item.name }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="goods.list.length <= 0" class="no-goods">未找到相关商品</div>
|
||||
<div class="goods-list">
|
||||
<div class="lingshicai" @click="showaddLingShiCai">
|
||||
<el-icon size="26"><Plus /></el-icon>
|
||||
<div class="u-m-t-10">临时菜</div>
|
||||
</div>
|
||||
<GoodsItem
|
||||
:item="item"
|
||||
@click="goodsClick(item)"
|
||||
@@ -95,20 +134,81 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<dialogGoodsSel ref="refSelSku"></dialogGoodsSel>
|
||||
<dialogGoodsSel ref="refSelSku" @confirm="skuSelConfirm"></dialogGoodsSel>
|
||||
<note ref="refNote" @confirm="noteConfirm"></note>
|
||||
<pack ref="refPack" @confirm="packConfirm"></pack>
|
||||
<addLingShiCai ref="refAddLingShiCai" @confirm="addLingShiCaiConfirm"></addLingShiCai>
|
||||
<changePrice ref="refChangePrice" @confirm="changePriceConfirm"></changePrice>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import Controls from "./components/control.vue";
|
||||
import note from "./components/note.vue";
|
||||
import pack from "./components/pack.vue";
|
||||
import changePrice from "./components/popup-cart-changePrice.vue";
|
||||
import addLingShiCai from "./components/popup-linshiCai.vue";
|
||||
import GoodsItem from "./components/goods-item.vue";
|
||||
import dialogGoodsSel from "./components/dialog-goods-sel.vue";
|
||||
import cartsList from "./components/carts/list.vue";
|
||||
import categoryApi from "@/api/product/productclassification";
|
||||
import productApi from "@/api/product/index";
|
||||
import tableApi from "@/api/account/table";
|
||||
import $status from "@/views/tool/table/status.js";
|
||||
|
||||
//桌台
|
||||
const tableSearchText = ref("");
|
||||
const tableList = ref([]);
|
||||
function getTableList() {
|
||||
tableApi.getList({ page: 1, size: 999 }).then((res) => {
|
||||
tableList.value = res.records;
|
||||
});
|
||||
}
|
||||
//返回台桌状态颜色
|
||||
function returnTableColor(key) {
|
||||
const item = $status[key];
|
||||
return item ? item.type : "";
|
||||
}
|
||||
//返回台桌状态
|
||||
function returnTableLabel(key) {
|
||||
const item = $status[key];
|
||||
return item ? item.label : "";
|
||||
}
|
||||
function tableClick(item) {
|
||||
console.log(item);
|
||||
}
|
||||
|
||||
//临时菜
|
||||
const refAddLingShiCai = ref();
|
||||
function showaddLingShiCai() {
|
||||
refAddLingShiCai.value.open();
|
||||
}
|
||||
function addLingShiCaiConfirm(data) {
|
||||
refCart.value.carts.add({
|
||||
sku_id: "-999",
|
||||
product_id: "-999",
|
||||
is_temporary: 1,
|
||||
sku_name: 1,
|
||||
number: 1,
|
||||
is_pack: 0,
|
||||
is_gift: 0,
|
||||
discount_sale_amount: 0,
|
||||
discount_sale_note: "",
|
||||
is_print: 0,
|
||||
is_wait_call: 0,
|
||||
product_name: "",
|
||||
remark: "",
|
||||
...data,
|
||||
});
|
||||
}
|
||||
//单品改价
|
||||
const refChangePrice = ref();
|
||||
function showChangePrice(cart) {
|
||||
refChangePrice.value.open(cart);
|
||||
}
|
||||
function changePriceConfirm(discount_sale_amount) {
|
||||
refCart.value.carts.updateTag("discount_sale_amount", discount_sale_amount);
|
||||
}
|
||||
|
||||
//打包
|
||||
const refPack = ref();
|
||||
function showPack(packNumber, max) {
|
||||
@@ -151,7 +251,9 @@ const category = reactive({
|
||||
function toggleShowAll() {
|
||||
category.showAll = !category.showAll;
|
||||
}
|
||||
function changeCategoryId() {}
|
||||
function changeCategoryId(category) {
|
||||
goods.query.categoryId = category.id;
|
||||
}
|
||||
|
||||
function getCategoryList() {
|
||||
categoryApi
|
||||
@@ -160,6 +262,7 @@ function getCategoryList() {
|
||||
size: 200,
|
||||
})
|
||||
.then((res) => {
|
||||
res.unshift({ name: "全部", id: "" });
|
||||
category.list = res;
|
||||
});
|
||||
}
|
||||
@@ -171,23 +274,20 @@ const goods = reactive({
|
||||
list: [],
|
||||
query: {
|
||||
categoryId: "",
|
||||
keywords: "",
|
||||
name: "",
|
||||
},
|
||||
});
|
||||
|
||||
let goodsMapisFinish = ref(false);
|
||||
|
||||
function getGoods() {
|
||||
productApi
|
||||
.getPage({
|
||||
page: 1,
|
||||
size: 200,
|
||||
...goods.query,
|
||||
})
|
||||
.then((res) => {
|
||||
goods.list = res.records;
|
||||
goodsMapisFinish.value = true;
|
||||
});
|
||||
async function getGoods() {
|
||||
const res = await productApi.getPage({
|
||||
page: 1,
|
||||
size: 200,
|
||||
...goods.query,
|
||||
});
|
||||
goods.list = res.records;
|
||||
goodsMapisFinish.value = true;
|
||||
}
|
||||
|
||||
function goodsClick(item) {
|
||||
@@ -213,6 +313,31 @@ function goodsClick(item) {
|
||||
refSelSku.value.open(item);
|
||||
}
|
||||
}
|
||||
|
||||
// 多规格选择确认
|
||||
function skuSelConfirm(item) {
|
||||
console.log(item);
|
||||
const listItem = refCart.value.carts.list.find(
|
||||
(v) => v.product_id == item.product_id && v.sku_id == item.sku_id
|
||||
);
|
||||
if (listItem) {
|
||||
refCart.value.carts.update({ ...listItem, ...item });
|
||||
} else {
|
||||
refCart.value.carts.add({
|
||||
is_pack: 0,
|
||||
is_gift: 0,
|
||||
is_temporary: 0,
|
||||
discount_sale_amount: 0,
|
||||
discount_sale_note: "",
|
||||
is_print: 0,
|
||||
is_wait_call: 0,
|
||||
product_name: "",
|
||||
remark: "",
|
||||
...item,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//购物车
|
||||
const refCart = ref(null);
|
||||
function clearCarts() {
|
||||
@@ -236,7 +361,14 @@ function addCarts(item) {
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => goods.query.categoryId,
|
||||
(newval) => {
|
||||
getGoods();
|
||||
}
|
||||
);
|
||||
function init() {
|
||||
getTableList();
|
||||
getCategoryList();
|
||||
getGoods();
|
||||
}
|
||||
@@ -348,6 +480,7 @@ $pl: 30px;
|
||||
background-color: #f7f7fa;
|
||||
z-index: 1;
|
||||
padding-top: 14px;
|
||||
padding-right: 81px;
|
||||
|
||||
.show_more_btn {
|
||||
padding: 0 10px;
|
||||
@@ -400,4 +533,34 @@ $pl: 30px;
|
||||
padding-left: $pl;
|
||||
}
|
||||
}
|
||||
.lingshicai {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 4px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border: 1px solid #dddfe6;
|
||||
color: #999;
|
||||
}
|
||||
:deep(.el-tag--dark.el-tag--info) {
|
||||
background-color: #fff;
|
||||
color: #000;
|
||||
border: 1px solid #dcdfe6;
|
||||
}
|
||||
.table-item {
|
||||
cursor: pointer;
|
||||
transition: 0.2s ease-in-out;
|
||||
|
||||
&:hover {
|
||||
background: #f4f9ff;
|
||||
}
|
||||
}
|
||||
.no-goods {
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user