This commit is contained in:
mkm 2024-09-14 17:47:51 +08:00
parent 0067b9c1d4
commit 0f162f5ca1
4 changed files with 44 additions and 26 deletions

View File

@ -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'

View File

@ -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 = () => {
<div class="shop-info-left">
<el-image loading="lazy" :src="form.image"></el-image>
</div>
<div class="shop-info-right">
<div class="shop-info-right" style="width: 100%;display: inline-block;">
<div class="shop-info-right-top">{{ form.store_name }}</div>
<div>
<div v-for="(item, index) in form.attr_value" :key="index" style="display: inline-block;">
<div class="shop-info-right-price" v-if="priceKey.off_activity == 1">
<span class="unit-name">商户价:</span> ¥<span>{{ form[priceKey.price] }}</span>
<span class="unit-name" v-if="form.unit_name">/{{ form.unit_name }}</span>
<span class="unit-name">商户价:</span> ¥<span>{{ item[priceKey.price] }}</span>
<span class="unit-name" v-if="item.unit_name">/{{ item.unit_name }}</span>
</div>
<div class="shop-info-right-price" v-if="priceKey.off_activity == 1">
<span class="unit-name">原价: </span> <span class="unit-name del">¥{{ form[priceKey.op_price]
<span class="unit-name">原价: </span> <span class="unit-name del">¥{{ item[priceKey.op_price]
}}
/{{ form.unit_name }}</span>
/{{ item.unit_name }}</span>
</div>
<div class="shop-info-right-price" v-else>
¥<span>{{ form[priceKey.price] }}</span>
<span class="unit-name">/{{ form.unit_name }}</span>
</div>
<!-- <div class="shop-info-right-price">
¥<span>{{ form[priceKey.price] }}</span>
<span class="unit-name">/{{ form.unit_name }}</span>
</div> -->
<el-check-tag v-else style="margin-right: 10px;" :checked="checked[item.id]" @change="onChange(item)" > {{ item.sku_name }}
¥<span>{{ item[priceKey.price] }}</span>
<span>/{{ item.unit_name }}</span>
</el-check-tag>
</div>
</div>
</div>
<div class="shop-sku">
@ -92,8 +106,7 @@ const close = () => {
<el-input-number ref="inputRef" v-model="form.cart_num"
:placeholder="`请输入数量(默认为${+form.batch > 0 ? form.batch : '1'})`"
:min="+form.batch > 0 ? +form.batch : 0.1" step-strictly :step="0.1" style="width: 20rem"
:precision="2"
size="large" />
:precision="2" size="large" />
</div>
</div>
</div>

View File

@ -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);

View File

@ -99,11 +99,16 @@ const cartAddInfo = (item, change = "") => {
});
};
const changeItem = (item, change) => {
cartAddInfo(item)
return
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) => {