商品列表修改,商品修改去掉库存相关东西,增加退菜是否退库存的选项,分类增加退菜是否退库存的选项,店铺增加退菜退库存模式配置,增加退款退菜是否退库存弹窗,增加购物车重复物品提示弹窗

This commit is contained in:
2026-04-11 15:31:57 +08:00
parent bc7b6d41f5
commit 2db9f6811a
15 changed files with 3002 additions and 2373 deletions

View File

@@ -3,7 +3,9 @@
<up-image :src="data.coverImg" mode="aspectFill" :width="img.width" :height="img.height"></up-image>
<view class="info u-flex u-row-between u-col-top u-flex-col">
<view class="limit-discount" v-if="is_time_discount">限时折扣</view>
<view class="nowStockerNumber" v-if="nowStockerNumber<=10">
剩余库存{{nowStockerNumber}}
</view>
<view>
<view>
<text class="up-line-1">{{ data.name }}</text>
@@ -32,7 +34,7 @@
<image src="/pagesCreateOrder/static/images/icon-reduce.svg" class="icon" mode="">
</image>
</view>
<view class="u-font-32" >
<view class="u-font-32">
{{ data.chooseNumber.toFixed(2) }}
</view>
@@ -56,7 +58,7 @@
<view class="isSellout" v-else-if="data.isSoldStock == 1">
<image class="isSellout_icon" src="/pagesCreateOrder/static/images/no-sold.svg" mode=""></image>
</view>
<view class="isSellout" v-else-if="data.isStock == 1 && data.stockNumber <= 0">
<view class="isSellout" v-else>
<image class="isSellout_icon" src="/pagesCreateOrder/static/images/no-stock.svg" mode=""></image>
</view>
</template>
@@ -107,6 +109,10 @@
return {};
},
},
consStockList: {
type: Array,
default:[]
}
});
//判断是否是时间折扣商品
@@ -156,12 +162,64 @@
return false;
}
return (
(item.isStock == 1 && item.stockNumber <= 0) ||
!consStockisFull(item) ||
item.isSoldStock == 1 ||
item.isSale == 0 ||
!isProductAvailable(item.days, item.startTime, item.endTime)
);
});
const stockNumber=computed(()=>{
})
// 1. 筛选匹配的耗材列表
const conslist=computed(()=>{
if(props.consStockList.length<=0){
return []
}
return props.consStockList.filter(v => {
return props.data.consList.find(i =>{
return i.consInfoId == v.consId
});
});
})
// 2. 找到 stockNumber 最小的那一项
const minConsItem=computed(()=>{
if(conslist.value.length<=0){
return null
}
return conslist.value.reduce((prev, current) => {
return prev.stockNumber < current.stockNumber ? prev : current;
});
})
// 3. 找到和 minItem 的 consId 一样的那个消耗配置项
const targetCons=computed(()=>{
if(!minConsItem.value){
return null
}
return props.data.consList.find(i => i.consInfoId == minConsItem.value.consId);
})
const nowStockerNumber=computed(()=>{
if(!targetCons.value||!minConsItem.value){
return 9999
}
return Math.floor(minConsItem.value.stockNumber/targetCons.value.surplusStock)
})
function consStockisFull(item) {
// 无数据直接返回 true或按你需求返回 false
if (!conslist.value.length) return true;
if(!minConsItem.value)return true;
if(!targetCons.value) return true;
// 4. 判断:最小库存 > 每份消耗库存 → 返回 true否则 false
if (nowStockerNumber.value>=1) {
return true;
} else {
return false;
}
}
// 判断商品是否在可售时间内
function isProductAvailable(sellDaysStr, startTimeStr, endTimeStr) {
// 将后端返回的字符串转换为数组
@@ -306,4 +364,14 @@
color: rgba(255, 255, 255, 0.8);
text-decoration: line-through;
}
.nowStockerNumber{
position: absolute;
left: 24rpx;
bottom: 80rpx;
background-color: rgba(255, 255, 255, .8);
color: red;
padding: 4rpx 8rpx;
font-size: 24rpx;
border-radius: 4rpx ;
}
</style>