更新了不同会员类型展示不同价格

This commit is contained in:
weipengfei 2024-07-09 16:36:53 +08:00
parent 38e3259be3
commit cc8d911e0e
4 changed files with 29 additions and 16 deletions

View File

@ -38,12 +38,24 @@ const deleteShop = (arr) => {
});
};
const userInfo = ref({
uid: ''
})
const setUser = (row) => {
userInfo.value = row;
userInfo.value.uid = row.id;
getList();
emit("getStoreList", {uid: row.id}, true);
}
const extend = ref({});
const getList = () => {
allPrice.value = 0;
costPrice.value = 0;
discounts.value = 0;
cartListApi().then((res) => {
cartListApi({
uid: userInfo.value.uid
}).then((res) => {
extend.value = res.data.extend;
list.value = res.data.lists || [];
// if (!extend.value?.pay_price) userInfo.value.uid = "";
@ -58,7 +70,7 @@ const getList = () => {
};
getList();
const emit = defineEmits(["goPay", "editAttr"]);
const emit = defineEmits(["goPay", "editAttr", "getStoreList"]);
const goPay = () => {
emit("goPay");
@ -104,14 +116,6 @@ const showPrice = (type = true) => {
priceRef.value.show(type, costPrice.value);
};
const userInfo = ref({
uid: ''
})
const setUser = (row) => {
userInfo.value = row;
userInfo.value.uid = row.id;
}
const is_storage = ref(false)
const resetView = () => {
@ -169,7 +173,7 @@ onUnmounted(() => {
}}</span></div>
<div>余额: <span style="color: #f70;">{{ userInfo.now_money }}</span></div>
</div>
<el-button style="margin-top:0.2rem;" link @click="userInfo.uid = ''">
<el-button style="margin-top:0.2rem;" link @click="setUser({id: ''})">
重置<el-icon>
<RefreshLeft />
</el-icon>

View File

@ -66,7 +66,7 @@ const close = () => {
<div class="shop-info-right">
<div class="shop-info-right-top">{{ form.store_name }}</div>
<div>
<div class="shop-info-right-price" v-if="priceKey.off_activity == 1">
<!-- <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>
</div>
@ -78,6 +78,10 @@ const close = () => {
<div class="shop-info-right-price" v-else>
¥<span>{{ form[priceKey.op_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>
</div>
</div>

View File

@ -107,7 +107,7 @@ onUnmounted(() => {
<div class="shop-item" v-for="(item, index) in storeList" :key="index" @click="changeItem(item)">
<el-image loading="lazy" :src="item.image"></el-image>
<div class="shop-name">{{ item.store_name }}</div>
<div class="shop-price" v-if="priceKey.off_activity == 1">
<!-- <div class="shop-price" v-if="priceKey.off_activity == 1">
<span class="unit-name">活动价:</span> ¥<span>{{ item[priceKey.price] }}</span>
<span class="unit-name" v-if="item.unit_name">/{{ item.unit_name }}</span>
</div>
@ -118,6 +118,10 @@ onUnmounted(() => {
<div class="shop-price" v-else>
¥<span>{{ item[priceKey.op_price] }}</span>
<span class="unit-name">/{{ item.unit_name }}</span>
</div> -->
<div class="shop-price">
¥<span>{{ item[priceKey.price] }}</span>
<span class="unit-name">/{{ item.unit_name }}</span>
</div>
<div class="no-stock-re" v-if="item.stock <= 0">
<div>

View File

@ -43,7 +43,7 @@ const getStoreList = (data = {}, reload = false) => {
...where.value,
...data,
};
console.log("===", data, where.value);
console.log("===", data, reload);
if (reload) {
storeList.value = [];
where.value.page_no = 1;
@ -87,10 +87,11 @@ function isAllDigits(str) {
}
const cartAddInfo = (item, change = "") => {
console.log(item, change);
// console.log(item, change);
let q = {
product_id: item.product_id,
cart_num: item.cart_num,
uid: where.value.uid || null
};
cartCreateApi(q).then((res) => {
orderRef.value.getList();
@ -218,7 +219,7 @@ onUnmounted(() => {
<template>
<div class="my-card">
<order ref="orderRef" @goPay="goPay" @editPupop="editPupop" />
<order ref="orderRef" @goPay="goPay" @editPupop="editPupop" @getStoreList="getStoreList" />
<padding />
<shop ref="shopRef" style="flex: 1" :storeList="storeList" :priceKey="priceKey" :loading="loading" @getStoreList="getStoreList"
@changeItem="changeItem" @loadMore="loadMore" />