mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-08-06 10:57:26 +08:00
Merge branch 'vue3'
This commit is contained in:
@@ -116,28 +116,6 @@
|
||||
<el-button type="primary" :loading="submitLoading" @click="saveCategoryBrand">提交</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
v-model="modalSpecVisible"
|
||||
:title="modalSpecTitle"
|
||||
width="500px"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-form ref="specForm" :model="specForm" label-width="100px">
|
||||
<el-select v-model="specForm.categorySpecs" multiple style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in specifications"
|
||||
:key="item.id"
|
||||
:label="item.specName"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="modalSpecVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="submitLoading" @click="saveCategorySpec">提交</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
@@ -148,12 +126,9 @@ import {
|
||||
disableCategory,
|
||||
getBrandListData,
|
||||
getCategoryBrandListData,
|
||||
getCategorySpecListData,
|
||||
getCategoryTree,
|
||||
getSpecificationList,
|
||||
insertCategory,
|
||||
saveCategoryBrand,
|
||||
saveCategorySpec,
|
||||
updateCategory,
|
||||
} from "@/api/goods";
|
||||
import uploadPicInput from "@/components/lili/upload-pic-input";
|
||||
@@ -171,18 +146,14 @@ export default {
|
||||
categoryList: [],
|
||||
loading: false,
|
||||
brands: [],
|
||||
specifications: [],
|
||||
categoryId: "",
|
||||
categorySpecs: [],
|
||||
modalType: 0,
|
||||
modalVisible: false,
|
||||
modalBrandVisible: false,
|
||||
modalSpecVisible: false,
|
||||
modalTitle: "",
|
||||
showParent: false,
|
||||
parentTitle: "",
|
||||
modalBrandTitle: "",
|
||||
modalSpecTitle: "",
|
||||
formAdd: {
|
||||
parentId: "",
|
||||
name: "",
|
||||
@@ -196,9 +167,6 @@ export default {
|
||||
categoryBrands: [],
|
||||
},
|
||||
brandWay: [],
|
||||
specForm: {
|
||||
categorySpecs: [],
|
||||
},
|
||||
formValidate: {
|
||||
commissionRate: [regular.REQUIRED, regular.INTEGER],
|
||||
name: [regular.REQUIRED, regular.VARCHAR20],
|
||||
@@ -245,20 +213,12 @@ export default {
|
||||
init() {
|
||||
this.getAllList();
|
||||
this.getBrandList();
|
||||
this.getSpecList();
|
||||
},
|
||||
getBrandList() {
|
||||
getBrandListData().then((res) => {
|
||||
this.brandWay = res;
|
||||
});
|
||||
},
|
||||
getSpecList() {
|
||||
getSpecificationList().then((res) => {
|
||||
if (res.length != 0) {
|
||||
this.specifications = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
brandOperation(v) {
|
||||
getCategoryBrandListData(v.id).then((res) => {
|
||||
this.categoryId = v.id;
|
||||
@@ -267,23 +227,6 @@ export default {
|
||||
this.modalBrandVisible = true;
|
||||
});
|
||||
},
|
||||
specOperation(v) {
|
||||
getCategorySpecListData(v.id).then((res) => {
|
||||
this.categoryId = v.id;
|
||||
this.modalSpecTitle = "规格关联";
|
||||
this.specForm.categorySpecs = res.map((item) => item.id);
|
||||
this.modalSpecVisible = true;
|
||||
});
|
||||
},
|
||||
saveCategorySpec() {
|
||||
saveCategorySpec(this.categoryId, this.specForm).then((res) => {
|
||||
this.submitLoading = false;
|
||||
if (res.success) {
|
||||
ElMessage.success("操作成功");
|
||||
this.modalSpecVisible = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
saveCategoryBrand() {
|
||||
saveCategoryBrand(this.categoryId, this.brandForm).then((res) => {
|
||||
this.submitLoading = false;
|
||||
|
||||
@@ -137,6 +137,13 @@ export default {
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
code: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入物流公司编码",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
},
|
||||
submitLoading: false,
|
||||
data: [],
|
||||
@@ -192,10 +199,12 @@ export default {
|
||||
|
||||
if (this.modalTitle === "添加") {
|
||||
const payload = {
|
||||
...this.form,
|
||||
name: this.form.name,
|
||||
code: this.form.code,
|
||||
disabled: this.form.disabled,
|
||||
standBy: normalizeStandBy(this.form.standBy),
|
||||
formItems: this.form.formItems,
|
||||
};
|
||||
delete payload.id;
|
||||
addLogistics(payload).then((res) => {
|
||||
this.submitLoading = false;
|
||||
if (res.success) {
|
||||
|
||||
@@ -200,15 +200,21 @@ export default {
|
||||
submitLoading: false,
|
||||
selectCouponList: [],
|
||||
formRule: {
|
||||
promotionName: [{ required: true, message: "活动名称不能为空", trigger: "blur" }],
|
||||
promotionName: [{ required: true, message: "活动名称不能为空" }],
|
||||
rangeTime: [
|
||||
{
|
||||
type: "array",
|
||||
required: true,
|
||||
message: "请选择活动有效期",
|
||||
validator: (rule, value, callback) => {
|
||||
if (!value || !Array.isArray(value) || value.length !== 2 || !value[0] || !value[1]) {
|
||||
callback(new Error("请选择活动有效期"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
description: [{ required: true, message: "请输入范围描述" }],
|
||||
},
|
||||
};
|
||||
},
|
||||
@@ -297,6 +303,7 @@ export default {
|
||||
this.showCouponSelect = true;
|
||||
},
|
||||
handleSubmit() {
|
||||
// 自动发券只能全用户发送:如有自动发券且非全用户,提示并强制切换
|
||||
if (
|
||||
this.form.couponActivityType === "AUTO_COUPON" &&
|
||||
this.form.activityScope !== "ALL"
|
||||
@@ -326,15 +333,16 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
// 统一取时间逻辑
|
||||
const [start, end] = this.form.rangeTime;
|
||||
const startDate = start instanceof Date ? start : new Date(start);
|
||||
const endDate = end instanceof Date ? end : new Date(end);
|
||||
this.form.startTime = this.$filters.unixToDate(startDate.getTime() / 1000);
|
||||
this.form.endTime = this.$filters.unixToDate(endDate.getTime() / 1000);
|
||||
|
||||
const params = JSON.parse(JSON.stringify(this.form));
|
||||
params.startTime = this.$filters.unixToDate(startDate.getTime() / 1000);
|
||||
params.endTime = this.$filters.unixToDate(endDate.getTime() / 1000);
|
||||
delete params.rangeTime;
|
||||
delete params.id;
|
||||
|
||||
this.submitLoading = true;
|
||||
saveActivityCoupon(params).then((res) => {
|
||||
this.submitLoading = false;
|
||||
|
||||
@@ -68,10 +68,10 @@
|
||||
v-model="form.rangeTime"
|
||||
type="datetimerange"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
:disabled-date="disabledDate"
|
||||
placeholder="请选择"
|
||||
:disabled-date="options.disabledDate"
|
||||
/>
|
||||
</el-form-item>
|
||||
<div>
|
||||
@@ -153,9 +153,21 @@ export default {
|
||||
{ required: true, message: "请输入最高可砍金额" },
|
||||
{ validator: checkHighestPrice },
|
||||
],
|
||||
rangeTime: [{ required: true, message: "请选择活动时间" }],
|
||||
rangeTime: [
|
||||
{
|
||||
type: "array",
|
||||
required: true,
|
||||
message: "请选择活动时间",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
stock: [{ required: true, message: "请输入活动库存" }],
|
||||
},
|
||||
options: {
|
||||
disabledDate(date) {
|
||||
return date && date.valueOf() < Date.now() - 86400000;
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
async mounted() {
|
||||
@@ -165,9 +177,6 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
disabledDate(date) {
|
||||
return date && date.getTime() < Date.now() - 86400000;
|
||||
},
|
||||
getKanJiaActivityGoods() {
|
||||
getKanJiaActivityGoodsById(this.id).then((res) => {
|
||||
this.form = res.result;
|
||||
@@ -176,58 +185,62 @@ export default {
|
||||
},
|
||||
handleSubmit() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
const params = JSON.parse(JSON.stringify(this.form));
|
||||
if (!this.form.rangeTime || this.form.rangeTime.length !== 2) {
|
||||
this.$Message.error("请选择活动时间");
|
||||
return;
|
||||
}
|
||||
params.startTime = this.form.rangeTime[0];
|
||||
params.endTime = this.form.rangeTime[1];
|
||||
delete params.rangeTime;
|
||||
|
||||
if (params.stock <= 0 || params.stock > params.goodsSku.quantity) {
|
||||
this.$Message.error("活动库存不能为0且不能超过商品库存");
|
||||
return;
|
||||
}
|
||||
if (!regular.money.test(params.settlementPrice)) {
|
||||
this.$Message.error("结算价格金额格式不正确");
|
||||
return;
|
||||
}
|
||||
if (params.settlementPrice < 0 || params.settlementPrice > params.price) {
|
||||
this.$Message.error("结算价格金额不能为0且不能超过商品价格");
|
||||
return;
|
||||
}
|
||||
if (!regular.money.test(params.highestPrice)) {
|
||||
this.$Message.error("最高可砍金额格式错误");
|
||||
return;
|
||||
}
|
||||
if (params.highestPrice <= 0 || params.highestPrice > params.price) {
|
||||
this.$Message.error("最高可砍金额不能为0且不能超过商品价格");
|
||||
return;
|
||||
}
|
||||
if (!regular.money.test(params.lowestPrice)) {
|
||||
this.$Message.error("最低可砍金额格式错误");
|
||||
return;
|
||||
}
|
||||
if (params.lowestPrice <= 0 || params.lowestPrice > params.price) {
|
||||
this.$Message.error("最低可砍金额不能为0");
|
||||
return;
|
||||
}
|
||||
if (params.lowestPrice > params.highestPrice) {
|
||||
this.$Message.error("最低砍价金额不能大于最高砍价金额");
|
||||
return;
|
||||
}
|
||||
|
||||
this.submitLoading = true;
|
||||
editKanJiaActivityGoods(params).then((res) => {
|
||||
this.submitLoading = false;
|
||||
if (res.success) {
|
||||
this.$Message.success("砍价活动修改成功");
|
||||
this.closeCurrentPage();
|
||||
}
|
||||
});
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const params = JSON.parse(JSON.stringify(this.form));
|
||||
const [start, end] = this.form.rangeTime || [];
|
||||
if (!start || !end) {
|
||||
this.$Message.error("请选择活动时间");
|
||||
return;
|
||||
}
|
||||
const startDate = start instanceof Date ? start : new Date(start);
|
||||
const endDate = end instanceof Date ? end : new Date(end);
|
||||
params.startTime = this.$filters.unixToDate(startDate.getTime() / 1000);
|
||||
params.endTime = this.$filters.unixToDate(endDate.getTime() / 1000);
|
||||
delete params.rangeTime;
|
||||
|
||||
if (params.stock <= 0 || params.stock > params.goodsSku.quantity) {
|
||||
this.$Message.error("活动库存不能为0且不能超过商品库存");
|
||||
return;
|
||||
}
|
||||
if (!regular.money.test(params.settlementPrice)) {
|
||||
this.$Message.error("结算价格金额格式不正确");
|
||||
return;
|
||||
}
|
||||
if (params.settlementPrice < 0 || params.settlementPrice > params.price) {
|
||||
this.$Message.error("结算价格金额不能为0且不能超过商品价格");
|
||||
return;
|
||||
}
|
||||
if (!regular.money.test(params.highestPrice)) {
|
||||
this.$Message.error("最高可砍金额格式错误");
|
||||
return;
|
||||
}
|
||||
if (params.highestPrice <= 0 || params.highestPrice > params.price) {
|
||||
this.$Message.error("最高可砍金额不能为0且不能超过商品价格");
|
||||
return;
|
||||
}
|
||||
if (!regular.money.test(params.lowestPrice)) {
|
||||
this.$Message.error("最低可砍金额格式错误");
|
||||
return;
|
||||
}
|
||||
if (params.lowestPrice <= 0 || params.lowestPrice > params.price) {
|
||||
this.$Message.error("最低可砍金额不能为0");
|
||||
return;
|
||||
}
|
||||
if (params.lowestPrice > params.highestPrice) {
|
||||
this.$Message.error("最低砍价金额不能大于最高砍价金额");
|
||||
return;
|
||||
}
|
||||
|
||||
this.submitLoading = true;
|
||||
editKanJiaActivityGoods(params).then((res) => {
|
||||
this.submitLoading = false;
|
||||
if (res.success) {
|
||||
this.$Message.success("砍价活动修改成功");
|
||||
this.closeCurrentPage();
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
closeCurrentPage() {
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
<el-form-item label="用户名" prop="username">
|
||||
<el-input v-model="form.username" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item label="昵称" prop="username">
|
||||
<el-form-item label="昵称" prop="nickName">
|
||||
<el-input v-model="form.nickName" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="modalType == 0" label="密码" prop="password" :error="errorPass">
|
||||
@@ -178,9 +178,12 @@ export default {
|
||||
modalTitle: "",
|
||||
form: {
|
||||
username: "",
|
||||
nickName: "",
|
||||
password: "",
|
||||
mobile: "",
|
||||
email: "",
|
||||
sex: "",
|
||||
avatar: "",
|
||||
description: "",
|
||||
roles: [],
|
||||
departmentId: 0,
|
||||
departmentTitle: "",
|
||||
@@ -285,18 +288,30 @@ export default {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.modalType == 0) {
|
||||
const params = JSON.parse(JSON.stringify(this.form));
|
||||
delete params.id;
|
||||
delete params.status;
|
||||
if (params.password == "" || params.password == undefined) {
|
||||
if (this.form.password == "" || this.form.password == undefined) {
|
||||
this.errorPass = "密码不能为空";
|
||||
return;
|
||||
}
|
||||
if (params.password.length < 6) {
|
||||
if (this.form.password.length < 6) {
|
||||
this.errorPass = "密码长度不得少于6位";
|
||||
return;
|
||||
}
|
||||
params.password = this.md5(params.password);
|
||||
if (Array.isArray(this.form.roles) && this.form.roles.length > 9) {
|
||||
ElMessage.warning("角色最多选择9个");
|
||||
return;
|
||||
}
|
||||
const params = {
|
||||
username: this.form.username,
|
||||
password: this.form.password,
|
||||
nickName: this.form.nickName,
|
||||
mobile: this.form.mobile,
|
||||
email: this.form.email,
|
||||
avatar: this.form.avatar,
|
||||
description: this.form.description,
|
||||
departmentId: this.form.departmentId,
|
||||
roles: this.form.roles,
|
||||
};
|
||||
this.errorPass = "";
|
||||
this.submitLoading = true;
|
||||
addUser(params).then((res) => {
|
||||
this.submitLoading = false;
|
||||
@@ -325,9 +340,12 @@ export default {
|
||||
this.modalTitle = "添加用户";
|
||||
this.form = {
|
||||
username: "",
|
||||
nickName: "",
|
||||
password: "",
|
||||
mobile: "",
|
||||
email: "",
|
||||
sex: "",
|
||||
avatar: "",
|
||||
description: "",
|
||||
roles: [],
|
||||
departmentId: 0,
|
||||
departmentTitle: "",
|
||||
|
||||
Reference in New Issue
Block a user