优化商品库存耗材
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
</div>
|
||||
<div class="status" v-if="
|
||||
item.isSoldStock ||
|
||||
item.isSoldOut ||
|
||||
!item.isSale ||
|
||||
!item.isSaleTime ||
|
||||
(item.isStock && item.stockNumber * 1 <= 0)
|
||||
@@ -37,8 +38,8 @@
|
||||
ElMessage.error('该商品不在可售时间内') ||
|
||||
isProductAvailable(item.days, item.startTime, item.endTime)
|
||||
" v-else-if="!item.isSaleTime" iconClass="no-sale" color="#fff" size="60"></svg-icon>
|
||||
<svg-icon @click="ElMessage.error('该商品已售罄')" v-else-if="item.isSoldStock" iconClass="shouqing" color="#fff"
|
||||
size="60"></svg-icon>
|
||||
<svg-icon @click="ElMessage.error('该商品已售罄')" v-else-if="item.isSoldStock || item.isSoldOut" iconClass="shouqing"
|
||||
color="#fff" size="60"></svg-icon>
|
||||
<svg-icon @click="ElMessage.error('库存不足')" v-else-if="item.isStock && item.stockNumber * 1 <= 0"
|
||||
iconClass="stock_null" color="#fff" size="60"></svg-icon>
|
||||
</div>
|
||||
|
||||
@@ -41,13 +41,8 @@
|
||||
</div>
|
||||
|
||||
<div class="u-flex u-flex-wrap tags">
|
||||
<div
|
||||
class="tag"
|
||||
v-for="(tag, index) in tags"
|
||||
@click="changeSel(tag)"
|
||||
:key="index"
|
||||
:class="{ active: tag.checked }"
|
||||
>
|
||||
<div class="tag" v-for="(tag, index) in tags" @click="changeSel(tag)" :key="index"
|
||||
:class="{ active: tag.checked }">
|
||||
{{ tag.label }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -64,10 +59,15 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 退款退菜推库存的操作弹窗 -->
|
||||
<refundConsModal ref="refundConsModalRef" :list="refundList" @success="refundConsModalSuccess" />
|
||||
</template>
|
||||
<script>
|
||||
<script>
|
||||
import { ElMessage } from "element-plus";
|
||||
import { useCartsStore } from '@/store/modules/carts'
|
||||
import refundConsModal from "@/components/refundConsModal.vue";
|
||||
export default {
|
||||
components: { refundConsModal },
|
||||
props: {
|
||||
modal: {
|
||||
type: Boolean,
|
||||
@@ -90,6 +90,9 @@ export default {
|
||||
goods: {
|
||||
productId: -999,
|
||||
},
|
||||
refundList: [],
|
||||
refundStock: '',
|
||||
note: ''
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -132,34 +135,79 @@ export default {
|
||||
this.show = false;
|
||||
this.number = 1;
|
||||
},
|
||||
// 选择退库存模式后
|
||||
refundConsModalSuccess(e) {
|
||||
this.refundStock = e
|
||||
this.refundNext()
|
||||
},
|
||||
refundNext() {
|
||||
this.$emit("confirm", {
|
||||
refundReason: this.note,
|
||||
refundAmount: 0,
|
||||
refundDetails: [{ id: this.goods.id, num: this.number, returnAmount: 0 }],
|
||||
refundStock: this.refundStock
|
||||
});
|
||||
this.close();
|
||||
},
|
||||
// 确认退菜
|
||||
confirm() {
|
||||
const selTag = this.tags
|
||||
.filter((item) => item.checked)
|
||||
.map((item) => item.label)
|
||||
.join(",");
|
||||
const note = selTag + (this.note.length > 0 ? "," + this.note : "");
|
||||
console.log(note);
|
||||
if (!note) {
|
||||
this.note = selTag + (this.note.length > 0 ? "," + this.note : "");
|
||||
|
||||
if (!this.note) {
|
||||
return ElMessage.error("请输入退菜原因");
|
||||
}
|
||||
this.$emit("confirm", {
|
||||
refundReason: note,
|
||||
refundAmount: 0,
|
||||
refundDetails: [{ id: this.goods.id, num: this.number, returnAmount: 0 }],
|
||||
});
|
||||
this.close();
|
||||
|
||||
const carts = useCartsStore();
|
||||
let categorys = JSON.parse(localStorage.getItem('categorys'))
|
||||
let shopInfo = JSON.parse(localStorage.getItem('userInfo'))
|
||||
|
||||
// 在这里给订单的商品补全库存信息 start
|
||||
carts.goods.forEach(val => {
|
||||
if (this.goods.productId == val.id) {
|
||||
if (shopInfo.refundMode == 1) {
|
||||
// 跟随分类退款模式
|
||||
categorys.forEach(v => {
|
||||
if (val.categoryId == v.id) {
|
||||
this.goods.refundMode = v.refundMode
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// 跟随商品退款模式及
|
||||
this.goods.refundMode = val.refundMode
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
console.log('this.goods===', this.goods);
|
||||
if (this.goods.refundMode == 3) {
|
||||
this.refundList = [
|
||||
{
|
||||
name: this.goods.product_name,
|
||||
num: this.number
|
||||
}
|
||||
]
|
||||
this.$refs.refundConsModalRef.show()
|
||||
return
|
||||
}
|
||||
// 在这里给订单的商品补全库存信息 end
|
||||
this.refundNext()
|
||||
},
|
||||
},
|
||||
mounted() {},
|
||||
mounted() { },
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-dialog__body) {
|
||||
margin-bottom: 14px;
|
||||
margin-top: 14px;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
:deep(.el-tag) {
|
||||
margin-top: 10px;
|
||||
margin-right: 10px;
|
||||
@@ -169,6 +217,7 @@ export default {
|
||||
line-height: 35px;
|
||||
height: 35px;
|
||||
}
|
||||
|
||||
.tags {
|
||||
.tag {
|
||||
margin: 10px 10px 0 0;
|
||||
@@ -178,6 +227,7 @@ export default {
|
||||
font-size: 14px;
|
||||
color: #000;
|
||||
cursor: pointer;
|
||||
|
||||
&.active {
|
||||
color: #1890ff;
|
||||
background: #e8f4ff;
|
||||
@@ -185,10 +235,12 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.number-box .el-input__inner::-webkit-inner-spin-button) {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
:deep(.number-box .el-input__inner::-webkit-outer-spin-button) {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
|
||||
@@ -665,6 +665,7 @@ function getCategoryList() {
|
||||
size: 200,
|
||||
})
|
||||
.then((res) => {
|
||||
localStorage.setItem('categorys', JSON.stringify(res))
|
||||
res.unshift({ name: "全部", id: "" });
|
||||
category.list = res;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user