Commit 88349b33 authored by mengwenhao's avatar mengwenhao

fix:商品详情-门店表单更改

parent 2d942d83
...@@ -63,7 +63,6 @@ ...@@ -63,7 +63,6 @@
show-word-limit show-word-limit
v-if="$route.params.operation === 'EDIT'" v-if="$route.params.operation === 'EDIT'"
v-model="goodsObj.goods_name" v-model="goodsObj.goods_name"
@blur="checkSameName"
></el-input> ></el-input>
<span v-else>{{ goodsObj.goods_name }}</span> <span v-else>{{ goodsObj.goods_name }}</span>
</el-form-item> </el-form-item>
...@@ -620,9 +619,9 @@ export default { ...@@ -620,9 +619,9 @@ export default {
computed: { computed: {
// 审核状态 // 审核状态
status () { status () {
if (this.goodsObj.status === 0) { if (this.goodsObj.audit_status === 0) {
return "待审核"; return "待审核";
} else if (this.goodsObj.status === 1) { } else if (this.goodsObj.audit_status === 1) {
return "审核通过"; return "审核通过";
} else { } else {
return "审核驳回"; return "审核驳回";
...@@ -648,6 +647,11 @@ export default { ...@@ -648,6 +647,11 @@ export default {
val.rule_start_time, val.rule_start_time,
val.rule_end_time val.rule_end_time
); );
},
rejectVisible (val) {
if (!val) {
this.rejectReason.reason = "";
}
} }
}, },
...@@ -809,13 +813,11 @@ export default { ...@@ -809,13 +813,11 @@ export default {
for (let i = 0; i < fileList.length; i++) { for (let i = 0; i < fileList.length; i++) {
if (fileList[i].uid == file.uid) { if (fileList[i].uid == file.uid) {
storageList.splice(i, 1); storageList.splice(i, 1);
}; }
}; }
console.log(storageList); console.log(storageList);
}, },
// 格式化日期 // 格式化日期
formatDate (startTime, endTime) { formatDate (startTime, endTime) {
const nowTime = new Date(); const nowTime = new Date();
...@@ -881,6 +883,23 @@ export default { ...@@ -881,6 +883,23 @@ export default {
latitude, // 纬度 latitude, // 纬度
address: this.shopForm.address address: this.shopForm.address
}; };
if (!query.shop_name) {
return this.$message.error("请填写门店名称");
};
if (!query.address) {
return this.$message.error("请填写门店地址");
};
if (!query.phone) {
return this.$message.error("请填写联系电话");
}
if (!query.longitude || !query.latitude) {
return this.$message.error("请填写地理定位");
};
if (!/([0-9]{3,4}-)?[0-9]{7,8}/.test(query.phone) && !/^[1][3,4,5,7,8,9][0-9]{9}$/.test(query.phone)) {
return this.$message.error("联系电话格式不正确");
};
const res = await postAddShop(query); const res = await postAddShop(query);
if (res.code !== 0) return this.$message.error(res.reason); if (res.code !== 0) return this.$message.error(res.reason);
this.$message.success("添加门店成功!"); this.$message.success("添加门店成功!");
...@@ -923,10 +942,9 @@ export default { ...@@ -923,10 +942,9 @@ export default {
if (res.code !== 0) return this.$message.error(res.reason); if (res.code !== 0) return this.$message.error(res.reason);
if (res.result.can_use) { if (res.result.can_use) {
this.isGoodsNameRepeat = true; this.isGoodsNameRepeat = true;
this.$message.success("名称未被占用,请继续填写表单");
} else { } else {
this.isGoodsNameRepeat = false; this.isGoodsNameRepeat = false;
return this.$message.error("名称被占用,换个名称试试吧~~~"); return this.$message.error("商品名称被占用");
} }
}, },
...@@ -942,7 +960,6 @@ export default { ...@@ -942,7 +960,6 @@ export default {
introduceSuccess (res) { introduceSuccess (res) {
this.uploadPicture(res, this.introduceUploadList); this.uploadPicture(res, this.introduceUploadList);
}, },
// 商品介绍图删除后的钩子 // 商品介绍图删除后的钩子
intrRemove (file, fileList) { intrRemove (file, fileList) {
this.deletePicture(file, fileList, this.introduceUploadList); this.deletePicture(file, fileList, this.introduceUploadList);
...@@ -1090,43 +1107,50 @@ export default { ...@@ -1090,43 +1107,50 @@ export default {
}; };
console.log(query); console.log(query);
this.checkSameName();
// 必填校验 // 必填校验
if (!this.goodsObj.goods_spu_id) { if (!this.goodsObj.goods_spu_id) {
return this.$message.error("未传入商品id"); return this.$message.error("未传入商品id");
} };
if (!query.category_1_id || !query.category_2_id) { if (!query.category_1_id || !query.category_2_id) {
return this.$message.error("请选择商品分类"); return this.$message.error("请选择商品分类");
} };
if (!query.goods_name) { if (!query.goods_name) {
return this.$message.error("请填写商品名称"); return this.$message.error("请填写商品名称");
} };
if (!this.isGoodsNameRepeat) { if (!this.isGoodsNameRepeat) {
return this.$message.error("商品名称被占用,请重新更换商品名称"); return this.$message.error("商品名称被占用,请重新更换商品名称");
} };
if (!query.expiration_time) { if (!query.expiration_time) {
return this.$message.error("过期时间未填写,请填写后再提交"); return this.$message.error("过期时间未填写,请填写后再提交");
} };
if (!query.rule_limit) { if (!query.rule_limit) {
return this.$message.error("请填写单人可购买上限"); return this.$message.error("请填写单人可购买上限");
} };
if (!query.rule_desc) { if (!query.rule_desc) {
return this.$message.error("请填写使用规则描述"); return this.$message.error("请填写使用规则描述");
} };
if (!query.rule_refund) { if (!query.rule_refund) {
return this.$message.error("请填写退款规则"); return this.$message.error("请填写退款规则");
} };
if (!query.inventory_add) { if (!query.inventory_add) {
return this.$message.error("请填写库存剩余量"); return this.$message.error("请填写库存剩余量");
} };
if (!query.original_price) { if (!query.original_price) {
return this.$message.error("请填写原价(保留两位小数)"); return this.$message.error("请填写原价(保留两位小数)");
} };
if (typeof query.original_price !== "number") {
return this.$message.error("原价价格必须为数字");
};
if (typeof query.price !== "number") {
return this.$message.error("售价价格必须为数字格式");
};
if (!query.price) { if (!query.price) {
return this.$message.error("请填写现价(保留两位小数)"); return this.$message.error("请填写现价(保留两位小数)");
} };
if (!query.sub_shop_ids) { if (!query.sub_shop_ids) {
return this.$message.error("请填写门店id"); return this.$message.error("请填写门店id");
} };
const res = await editGoods(query); const res = await editGoods(query);
if (res.code !== 0) { if (res.code !== 0) {
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<!-- 所属分类 --> <!-- 所属分类 -->
<el-form-item label="所属分类"> <el-form-item label="所属分类">
<el-cascader <el-cascader
v-model="searchProps.classValue"
@change="handleTypeChange" @change="handleTypeChange"
:options="labelOptions" :options="labelOptions"
:props="cascaderProps" :props="cascaderProps"
...@@ -32,8 +33,8 @@ ...@@ -32,8 +33,8 @@
<el-form-item label="生活号名称"> <el-form-item label="生活号名称">
<el-input v-model="searchProps.life_account_name"></el-input> <el-input v-model="searchProps.life_account_name"></el-input>
</el-form-item> </el-form-item>
<!-- 商品状态 --> <!-- 审核状态 -->
<el-form-item label="商品状态"> <el-form-item label="审核状态">
<el-select <el-select
v-model="audit_status" v-model="audit_status"
multiple multiple
...@@ -166,7 +167,6 @@ ...@@ -166,7 +167,6 @@
> >
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-if="scope.row.audit_status == 2 || scope.row.online_status == 2 || scope.row.online_status == 1"
type="text" type="text"
@click="goDetail(`EDIT`, scope.row.goods_spu_id)" @click="goDetail(`EDIT`, scope.row.goods_spu_id)"
>编辑</el-button> >编辑</el-button>
...@@ -178,7 +178,7 @@ ...@@ -178,7 +178,7 @@
>审核</el-button> >审核</el-button>
<el-popconfirm <el-popconfirm
v-if="scope.row.audit_status != 2 && scope.row.audit_status != 0 && (scope.row.online_status == 2 || scope.row.online_status == 0)" v-if="scope.row.online_status == 2 "
title="您确定要上架该商品吗?" title="您确定要上架该商品吗?"
cancelButtonType="default" cancelButtonType="default"
@confirm="changeGoodsState('GROUNDING', scope.row.goods_spu_id)" @confirm="changeGoodsState('GROUNDING', scope.row.goods_spu_id)"
...@@ -189,7 +189,7 @@ ...@@ -189,7 +189,7 @@
</el-popconfirm> </el-popconfirm>
<el-popconfirm <el-popconfirm
v-if="scope.row.online_status == 1" v-if="scope.row.audit_status == 1 || scope.row.online_status == 1"
title="您确定要下架该商品吗?" title="您确定要下架该商品吗?"
cancelButtonType="default" cancelButtonType="default"
@confirm=" @confirm="
...@@ -262,14 +262,15 @@ export default { ...@@ -262,14 +262,15 @@ export default {
category_2_id: "", // 二级分类id category_2_id: "", // 二级分类id
life_account_id: "", life_account_id: "",
life_account_name: "", life_account_name: "",
audit_status: "", // 商品状态 audit_status: "", // 审核状态
online_status: "" // 上架状态 online_status: "", // 上架状态
classValue: ""
}, },
// 级联选择器 // 级联选择器
labelOptions: [], labelOptions: [],
// 商品状态 // 审核状态
stateOption: [ stateOption: [
{ value: 0, label: "待审核" }, { value: 0, label: "待审核" },
{ value: 1, label: "审核通过" }, { value: 1, label: "审核通过" },
...@@ -333,7 +334,7 @@ export default { ...@@ -333,7 +334,7 @@ export default {
this.searchProps.category_1_id = this.getVal(val, 0); this.searchProps.category_1_id = this.getVal(val, 0);
this.searchProps.category_2_id = this.getVal(val, 1); this.searchProps.category_2_id = this.getVal(val, 1);
}, },
// 商品状态赋值 // 审核状态赋值
handleStatusChange (val) { handleStatusChange (val) {
this.searchProps.audit_status = this.getValue(val); this.searchProps.audit_status = this.getValue(val);
}, },
...@@ -348,7 +349,7 @@ export default { ...@@ -348,7 +349,7 @@ export default {
}, },
// 重置表单 // 重置表单
resetList () { resetList () {
(this.searchProps = { this.searchProps = {
page: 1, // 页码 page: 1, // 页码
page_size: 20, // 页数大小 page_size: 20, // 页数大小
goods_spu_id: "", // 后台商品id goods_spu_id: "", // 后台商品id
...@@ -357,10 +358,13 @@ export default { ...@@ -357,10 +358,13 @@ export default {
category_2_id: "", // 二级分类id category_2_id: "", // 二级分类id
life_account_id: "", life_account_id: "",
life_account_name: "", life_account_name: "",
audit_status: "", // 商品状态 audit_status: "", // 审核状态
online_status: "" // 上架状态 online_status: "", // 上架状态
}), classValue: ""
this.getCommodityList(); };
this.audit_status = [];
this.onlineStatus = [];
this.getCommodityList();
}, },
// 上架/下架操作 // 上架/下架操作
async changeGoodsState (state, spuId) { async changeGoodsState (state, spuId) {
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment