新增商品状态售罄,增加删除的库存限制

This commit is contained in:
gyq
2025-04-16 18:31:12 +08:00
parent 0a0f672a02
commit 694cb154a6
12 changed files with 137 additions and 27 deletions

View File

@@ -1,5 +1,5 @@
<template>
<el-dialog :title="goods.name" width="600" v-model="dialogVisible">
<el-dialog :title="goods.name" width="600" v-model="dialogVisible" top="5vh">
<div class="header">选择规格</div>
<div v-loading="loading">
<div class="row" v-for="(item, index) in goods.selectSpec" :key="index">
@@ -14,9 +14,9 @@
</div>
<div class="footer">
<div class="info">
<span>库存:{{ stockNumber }}</span>
<template v-if="goodsInfo.id">
<!-- <span>库存:{{ goodsInfo.stockNumber }}</span> -->
<span>¥{{ goodsInfo.salePrice }}</span>
<span class="price">¥{{ formatDecimal(+goodsInfo.salePrice) }}</span>
</template>
</div>
<div class="btn_wrap">
@@ -25,12 +25,12 @@
</div>
<div class="btn">
<el-button type="primary" style="width: 100%;"
:disabled="!goodsInfo.id || !+goodsInfo.isGrounding || !!+goodsInfo.isPauseSale"
:disabled="!goodsInfo.id || !+goodsInfo.isGrounding || !!+goodsInfo.isSoldStock"
@click="submitSku">
<template v-if="goodsInfo.id && !+goodsInfo.isGrounding">
未上架
</template>
<template v-if="goodsInfo.id && +goodsInfo.isPauseSale">
<template v-if="goodsInfo.id && +goodsInfo.isSoldStock">
已售罄
</template>
<template v-if="(+goodsInfo.isGrounding && !+goodsInfo.isPauseSale) || !goodsInfo.id">
@@ -45,20 +45,19 @@
<script setup>
import { ref } from 'vue'
const emit = defineEmits(['success'])
import { formatDecimal } from '@/utils/index.js'
const emit = defineEmits(['success'])
const type = ref('shop')
const dialogVisible = ref(false)
const goods = ref({})
const selectedSkuNum = ref(0)
const selectedSkuTag = ref('')
const goodsInfo = ref({})
const loading = ref(false)
const selecSkuArray = ref([])
const stockNumber = ref(0)
// 确认选择规格
function submitSku() {
@@ -164,6 +163,7 @@ async function queryProductSkuAjax() {
// 显示规格
function show(item, t = 'shop') {
stockNumber.value = item.stockNumber
type.value = t
let arr = []
for (let val in item.selectSpecInfo) {
@@ -250,6 +250,10 @@ defineExpose({
align-items: center;
justify-content: space-between;
font-size: 20px;
.price {
color: var(--el-color-danger);
}
}
.btn_wrap {