优化商品列表

This commit is contained in:
gyq 2024-10-08 15:25:33 +08:00
parent df3546c378
commit 477906d4c5
2 changed files with 60 additions and 5 deletions

View File

@ -770,3 +770,12 @@ export function tbProductStockDetailStock(data) {
data
});
}
// 商品库存记录列表
export function stockWarnLine(data) {
return request({
url: `/api/stock/warnLine`,
method: "PUT",
data
});
}

View File

@ -19,6 +19,7 @@
<el-col :span="6">
<el-button type="primary" @click="queryHandle">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
<el-button @click="showStockWarningHandle">库存预警{{ warnLine }}</el-button>
</el-col>
</el-row>
</div>
@ -42,7 +43,7 @@
<div class="info">
<div class="row">
<span>现有数量</span>
<span @click="showStockHistory('stockNumber')">{{ countInfo.stockNumber || 0 }}</span>
<span class="link" @click="showStockHistory('stockNumber')">{{ countInfo.stockNumber || 0 }}</span>
</div>
</div>
</div>
@ -56,8 +57,15 @@
<span class="link" @click="showStockHistory('addCountNumber')">{{ countInfo.addCountNumber || 0 }}</span>
</div>
<div class="row">
<span>手动增加</span>
<span class="link" @click="showStockHistory('addNumber')">{{ countInfo.addNumber || 0 }}</span>
<div class="row">
<span>手动增加</span>
<span class="link" @click="showStockHistory('addNumber')">{{ countInfo.addNumber || 0 }}</span>
</div>
<div class="line"></div>
<div class="row">
<span>退货</span>
<span class="link" @click="showStockHistory('refundNumber')">{{ countInfo.refundNumber || 0 }}</span>
</div>
</div>
</div>
</div>
@ -215,6 +223,18 @@
<el-button type="primary" :loading="editorFormLoading" @click="editorConfirmChange"> </el-button>
</span>
</el-dialog>
<!-- 库存预警值 -->
<el-dialog title="修改库存预警" :visible.sync="showStockWarning" :show-close="false" width="300px">
<el-form :model="editorForm">
<el-form-item label="库存预警">
<el-input-number v-model="warnLine" :min="0" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="showStockWarning = false"> </el-button>
<el-button type="primary" :loading="warnLineLoading" @click="stockWarnLineConfirm"> </el-button>
</span>
</el-dialog>
</div>
</template>
@ -224,7 +244,7 @@ import dayjs from 'dayjs'
import settings from '@/settings'
import BindCons from './components/bindCons.vue'
import StockHistory from './components/stockHistory.vue'
import { tbProductListV2, tbShopCategoryGet, tbProductDelete, tbProductIsHot, upProSort, updateProductData, tbProductStockDetailStockCount } from '@/api/shop'
import { tbProductListV2, tbShopCategoryGet, tbProductDelete, tbProductIsHot, upProSort, updateProductData, tbProductStockDetailStockCount, stockWarnLine } from '@/api/shop'
export default {
components: {
BindCons,
@ -264,7 +284,10 @@ export default {
key: '',
value: ''
},
countInfo: {}
countInfo: {},
showStockWarning: false, //
warnLineLoading: false,
warnLine: 0
}
},
async mounted() {
@ -285,6 +308,26 @@ export default {
this.tbProductStockDetailStockCount()
},
methods: {
// 线
showStockWarningHandle() {
this.showStockWarning = true
},
// 线
async stockWarnLineConfirm() {
try {
this.warnLineLoading = true
const res = await stockWarnLine({
shopId: localStorage.getItem('shopId'),
warnLine: this.warnLine
})
this.warnLineLoading = false
this.showStockWarning = false
this.$message.success('修改成功')
} catch (error) {
this.warnLineLoading = false
console.log(error);
}
},
//
showStockHistory(key) {
this.$refs.stockHistory.show(key)
@ -440,6 +483,8 @@ export default {
sort: this.tableData.sort
})
this.warnLine = res.warnLine
res.content.map(item => {
item.key = item.id
item.skuList.map(val => {
@ -497,6 +542,7 @@ export default {
.data_wrap {
display: flex;
justify-content: space-between;
padding: 0 60px;
.item {
display: flex;