From 0f162f5ca1915b06c3fc4e1fdb60cf1c191b1bed Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 14 Sep 2024 17:47:51 +0800 Subject: [PATCH] 1 --- .env.development | 8 ++--- src/views/saleHome/component/pupop.vue | 45 +++++++++++++++++--------- src/views/saleHome/component/shop.vue | 2 +- src/views/saleHome/index.vue | 15 ++++++--- 4 files changed, 44 insertions(+), 26 deletions(-) diff --git a/.env.development b/.env.development index e060f13..fa6873c 100644 --- a/.env.development +++ b/.env.development @@ -4,11 +4,11 @@ VITE_NOW_TYPE = 'dist' # VITE_PUSH_URL = 'wss://ceshi-multi-store.lihaink.cn/pull' # VITE_BASE_URL = 'https://ceshi-multi-store.lihaink.cn' -# VITE_PUSH_URL = 'ws://192.168.1.22:8787' -# VITE_BASE_URL = 'http://192.168.1.22:8545' +VITE_PUSH_URL = 'ws://192.168.1.22:8787' +VITE_BASE_URL = 'http://192.168.1.22:8545' - VITE_PUSH_URL ='wss://test-multi-store.lihaink.cn/pull' - VITE_BASE_URL = 'https://test-multi-store.lihaink.cn' +# VITE_PUSH_URL ='wss://test-multi-store.lihaink.cn/pull' +# VITE_BASE_URL = 'https://test-multi-store.lihaink.cn' # VITE_PUSH_URL ='wss://multi-store.lihaink.cn/pull' # VITE_BASE_URL = 'https://multi-store.lihaink.cn' \ No newline at end of file diff --git a/src/views/saleHome/component/pupop.vue b/src/views/saleHome/component/pupop.vue index e1e8f81..14b8d23 100644 --- a/src/views/saleHome/component/pupop.vue +++ b/src/views/saleHome/component/pupop.vue @@ -3,6 +3,7 @@ import { ref, onMounted, onUnmounted, nextTick } from "vue"; import { ElMessage } from "element-plus"; import { getAttrValue } from "@/api/shop.js"; import mitt from "@/utils/mitt.js"; +import { forEach } from "lodash"; const dialogVisible = ref(false); const inputRef = ref(null); @@ -20,10 +21,14 @@ const show = (e) => { const form = ref({}); const loading = ref(false); +const checked = ref([]); const mode = ref("add"); const setForm = (data, type = "add") => { mode.value = type; form.value = JSON.parse(JSON.stringify(data)); + form.value.attr_value.map((item) => { + checked.value[item.id]=false; + }) }; const emit = defineEmits(["changeItem"]); @@ -33,6 +38,16 @@ const changeItem = () => { emit("changeItem", form.value); dialogVisible.value = false; }; +const onChange=(e)=>{ + checked.value.forEach((item,index)=>{ + if(index!=e.id){ + checked.value[index]=false + }else{ + checked.value[e.id]=true + } + }) + console.log(e) +} defineExpose({ show, @@ -63,27 +78,26 @@ const close = () => {
-
+
{{ form.store_name }}
-
+
- 商户价: ¥{{ form[priceKey.price] }} - /{{ form.unit_name }} + 商户价: ¥{{ item[priceKey.price] }} + /{{ item.unit_name }}
- 原价: ¥{{ form[priceKey.op_price] + 原价: ¥{{ item[priceKey.op_price] }} - /{{ form.unit_name }} + /{{ item.unit_name }}
-
- ¥{{ form[priceKey.price] }} - /{{ form.unit_name }} -
- + {{ item.sku_name }} + ¥{{ item[priceKey.price] }} + /{{ item.unit_name }} + + +
+
@@ -92,8 +106,7 @@ const close = () => { + :precision="2" size="large" />
diff --git a/src/views/saleHome/component/shop.vue b/src/views/saleHome/component/shop.vue index fcb4819..186bfac 100644 --- a/src/views/saleHome/component/shop.vue +++ b/src/views/saleHome/component/shop.vue @@ -34,7 +34,7 @@ const loadMore = () => { const changeItem = (item) => { if (item.is_lack == 1) return ElMessage.warning("该商品缺货中,请购买其他商品"); - emit("changeItem", { product_id: item.product_id, cart_num: item.batch }); + emit("changeItem", item); // if (item.is_used == 0) return ElMessage.error("该商品已被平台关闭"); // if (item.stock == 0) return ElMessage.warning("该商品无库存"); // emit("changeItem", item); diff --git a/src/views/saleHome/index.vue b/src/views/saleHome/index.vue index eeeee5d..51c5630 100644 --- a/src/views/saleHome/index.vue +++ b/src/views/saleHome/index.vue @@ -99,11 +99,16 @@ const cartAddInfo = (item, change = "") => { }); }; -const changeItem = (item, change) => { - cartAddInfo(item) - return - pupopRef.value.setForm(item, "add"); - pupopRef.value.show(true); +const changeItem = (item) => { + // cartAddInfo(item) + // return + if(item.attr_value.length>1){ + pupopRef.value.setForm(item, "add"); + pupopRef.value.show(true); + }else{ + cartAddInfo(item) + } + }; const editPupop = (item) => {