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

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

View File

@ -66,7 +66,7 @@ const close = () => {
<div class="shop-info-right"> <div class="shop-info-right">
<div class="shop-info-right-top">{{ form.store_name }}</div> <div class="shop-info-right-top">{{ form.store_name }}</div>
<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">活动价:</span> ¥<span>{{ form[priceKey.price] }}</span>
<span class="unit-name" v-if="form.unit_name">/{{ form.unit_name }}</span> <span class="unit-name" v-if="form.unit_name">/{{ form.unit_name }}</span>
</div> </div>
@ -78,6 +78,10 @@ const close = () => {
<div class="shop-info-right-price" v-else> <div class="shop-info-right-price" v-else>
¥<span>{{ form[priceKey.op_price] }}</span> ¥<span>{{ form[priceKey.op_price] }}</span>
<span class="unit-name">/{{ form.unit_name }}</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> </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)"> <div class="shop-item" v-for="(item, index) in storeList" :key="index" @click="changeItem(item)">
<el-image loading="lazy" :src="item.image"></el-image> <el-image loading="lazy" :src="item.image"></el-image>
<div class="shop-name">{{ item.store_name }}</div> <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">活动价:</span> ¥<span>{{ item[priceKey.price] }}</span>
<span class="unit-name" v-if="item.unit_name">/{{ item.unit_name }}</span> <span class="unit-name" v-if="item.unit_name">/{{ item.unit_name }}</span>
</div> </div>
@ -118,6 +118,10 @@ onUnmounted(() => {
<div class="shop-price" v-else> <div class="shop-price" v-else>
¥<span>{{ item[priceKey.op_price] }}</span> ¥<span>{{ item[priceKey.op_price] }}</span>
<span class="unit-name">/{{ item.unit_name }}</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>
<div class="no-stock-re" v-if="item.stock <= 0"> <div class="no-stock-re" v-if="item.stock <= 0">
<div> <div>

View File

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