优化商品库存耗材
This commit is contained in:
@@ -433,7 +433,6 @@ export default {
|
||||
}
|
||||
|
||||
console.log('tuikuan===', arr);
|
||||
return
|
||||
|
||||
this.$refs.refReturnMoney.open(arr, this.detail);
|
||||
},
|
||||
|
||||
@@ -4,11 +4,7 @@
|
||||
<div class="u-flex u-col-top" v-if="goodsList && goodsList.length">
|
||||
<span class="u-m-0">退款商品</span>
|
||||
<div class="u-p-l-20 goods-list">
|
||||
<div
|
||||
class="u-flex u-font-12 goods-list-item"
|
||||
v-for="(goods, index) in goodsList"
|
||||
:key="index"
|
||||
>
|
||||
<div class="u-flex u-font-12 goods-list-item" v-for="(goods, index) in goodsList" :key="index">
|
||||
<span class="">
|
||||
{{ goods.productName }}
|
||||
</span>
|
||||
@@ -35,12 +31,7 @@
|
||||
<div class="flex u-row-between">
|
||||
<span class="color-red">退款金额</span>
|
||||
<div class="u-flex u-flex-1 u-p-l-20">
|
||||
<el-input-number
|
||||
type="number"
|
||||
v-model="number"
|
||||
:min="min"
|
||||
:max="canReturnMoney"
|
||||
></el-input-number>
|
||||
<el-input-number type="number" v-model="number" :min="min" :max="canReturnMoney"></el-input-number>
|
||||
<span class="u-m-l-10">可退{{ canReturnMoney }}元</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -73,13 +64,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>
|
||||
@@ -94,16 +80,22 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
<safe-password ref="refPassword" @confirm="pwdConfirm"></safe-password>
|
||||
<!-- 退款退菜推库存的操作弹窗 -->
|
||||
<refundConsModal ref="refundConsModalRef" :list="refundList" @success="refundConsModalSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
<script>
|
||||
import { ElMessage } from "element-plus";
|
||||
import safePassword from "./password.vue";
|
||||
import { useUserStore } from "@/store/modules/user";
|
||||
import { useCartsStore } from "@/store/modules/carts";
|
||||
import categoryApi from "@/api/product/productclassification";
|
||||
import refundConsModal from "@/components/refundConsModal.vue";
|
||||
const shopUser = useUserStore();
|
||||
export default {
|
||||
components: {
|
||||
safePassword,
|
||||
refundConsModal
|
||||
},
|
||||
props: {
|
||||
modal: {
|
||||
@@ -135,6 +127,8 @@ export default {
|
||||
goods: {
|
||||
productId: -999,
|
||||
},
|
||||
refundList: [],
|
||||
refundStock: ''
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -196,18 +190,26 @@ export default {
|
||||
.join(",");
|
||||
const note = selTag + (this.note.length > 0 ? "," + this.note : "");
|
||||
console.log(note);
|
||||
this.$emit("confirm", {
|
||||
|
||||
const data = {
|
||||
refundAmount: this.number,
|
||||
cash: this.cash,
|
||||
refundReason: note,
|
||||
refundDetails: this.goodsList.map((v) => {
|
||||
return { id: v.id, num: v.num };
|
||||
return { id: v.id, num: v.selNumber };
|
||||
}),
|
||||
...e,
|
||||
});
|
||||
refundStock: this.refundStock
|
||||
}
|
||||
this.$emit("confirm", data);
|
||||
this.close();
|
||||
},
|
||||
confirm() {
|
||||
// 退款推库存的操作
|
||||
refundConsModalSuccess(e) {
|
||||
this.refundStock = e
|
||||
this.emitTuikuan()
|
||||
},
|
||||
async confirm() {
|
||||
const selTag = this.tags
|
||||
.filter((item) => item.checked)
|
||||
.map((item) => item.label)
|
||||
@@ -220,14 +222,58 @@ export default {
|
||||
this.$refs.refPassword.open();
|
||||
return;
|
||||
}
|
||||
|
||||
// 在这里给订单的商品补全库存信息 start
|
||||
const carts = useCartsStore();
|
||||
let categorys = JSON.parse(localStorage.getItem('categorys'))
|
||||
let shopInfo = JSON.parse(localStorage.getItem('userInfo'))
|
||||
|
||||
if (!categorys) {
|
||||
categorys = await categoryApi.getList({})
|
||||
}
|
||||
|
||||
this.goodsList.forEach(item => {
|
||||
carts.goods.forEach(val => {
|
||||
if (item.productId == val.id) {
|
||||
if (shopInfo.refundMode == 1) {
|
||||
// 跟随分类退款模式
|
||||
categorys.forEach(v => {
|
||||
if (val.categoryId == v.id) {
|
||||
item.refundMode = v.refundMode
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// 跟随商品退款模式及
|
||||
item.refundMode = val.refundMode
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
console.log('this.goodsList===', this.goodsList);
|
||||
// 在这里给订单的商品补全库存信息 end
|
||||
|
||||
this.goodsList.forEach(item => {
|
||||
if (item.refundMode == 3) {
|
||||
this.refundList.push({
|
||||
name: item.productName,
|
||||
num: item.selNumber
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
if (this.refundList.length > 0) {
|
||||
this.$refs.refundConsModalRef.show()
|
||||
return
|
||||
}
|
||||
|
||||
this.emitTuikuan();
|
||||
},
|
||||
},
|
||||
mounted() {},
|
||||
mounted() { },
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-tag) {
|
||||
margin-top: 10px;
|
||||
margin-right: 10px;
|
||||
@@ -237,6 +283,7 @@ export default {
|
||||
line-height: 35px;
|
||||
height: 35px;
|
||||
}
|
||||
|
||||
.tags {
|
||||
.tag {
|
||||
margin: 10px 10px 0 0;
|
||||
@@ -246,6 +293,7 @@ export default {
|
||||
font-size: 14px;
|
||||
color: #000;
|
||||
cursor: pointer;
|
||||
|
||||
&.active {
|
||||
color: #1890ff;
|
||||
background: #e8f4ff;
|
||||
@@ -253,14 +301,17 @@ 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;
|
||||
}
|
||||
|
||||
.goods-list-item {
|
||||
height: 24px;
|
||||
line-height: 24px;
|
||||
@@ -268,6 +319,7 @@ export default {
|
||||
border-radius: 3px;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.goods-list-item:not(:first-child) {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user