Commit 88349b33 authored by mengwenhao's avatar mengwenhao

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

parent 2d942d83
......@@ -63,7 +63,6 @@
show-word-limit
v-if="$route.params.operation === 'EDIT'"
v-model="goodsObj.goods_name"
@blur="checkSameName"
></el-input>
<span v-else>{{ goodsObj.goods_name }}</span>
</el-form-item>
......@@ -620,9 +619,9 @@ export default {
computed: {
// 审核状态
status () {
if (this.goodsObj.status === 0) {
if (this.goodsObj.audit_status === 0) {
return "待审核";
} else if (this.goodsObj.status === 1) {
} else if (this.goodsObj.audit_status === 1) {
return "审核通过";
} else {
return "审核驳回";
......@@ -648,6 +647,11 @@ export default {
val.rule_start_time,
val.rule_end_time
);
},
rejectVisible (val) {
if (!val) {
this.rejectReason.reason = "";
}
}
},
......@@ -809,13 +813,11 @@ export default {
for (let i = 0; i < fileList.length; i++) {
if (fileList[i].uid == file.uid) {
storageList.splice(i, 1);
};
};
}
}
console.log(storageList);
},
// 格式化日期
formatDate (startTime, endTime) {
const nowTime = new Date();
......@@ -881,6 +883,23 @@ export default {
latitude, // 纬度
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);
if (res.code !== 0) return this.$message.error(res.reason);
this.$message.success("添加门店成功!");
......@@ -923,10 +942,9 @@ export default {
if (res.code !== 0) return this.$message.error(res.reason);
if (res.result.can_use) {
this.isGoodsNameRepeat = true;
this.$message.success("名称未被占用,请继续填写表单");
} else {
this.isGoodsNameRepeat = false;
return this.$message.error("名称被占用,换个名称试试吧~~~");
return this.$message.error("商品名称被占用");
}
},
......@@ -942,7 +960,6 @@ export default {
introduceSuccess (res) {
this.uploadPicture(res, this.introduceUploadList);
},
// 商品介绍图删除后的钩子
intrRemove (file, fileList) {
this.deletePicture(file, fileList, this.introduceUploadList);
......@@ -1090,43 +1107,50 @@ export default {
};
console.log(query);
this.checkSameName();
// 必填校验
if (!this.goodsObj.goods_spu_id) {
return this.$message.error("未传入商品id");
}
};
if (!query.category_1_id || !query.category_2_id) {
return this.$message.error("请选择商品分类");
}
};
if (!query.goods_name) {
return this.$message.error("请填写商品名称");
}
};
if (!this.isGoodsNameRepeat) {
return this.$message.error("商品名称被占用,请重新更换商品名称");
}
};
if (!query.expiration_time) {
return this.$message.error("过期时间未填写,请填写后再提交");
}
};
if (!query.rule_limit) {
return this.$message.error("请填写单人可购买上限");
}
};
if (!query.rule_desc) {
return this.$message.error("请填写使用规则描述");
}
};
if (!query.rule_refund) {
return this.$message.error("请填写退款规则");
}
};
if (!query.inventory_add) {
return this.$message.error("请填写库存剩余量");
}
};
if (!query.original_price) {
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) {
return this.$message.error("请填写现价(保留两位小数)");
}
};
if (!query.sub_shop_ids) {
return this.$message.error("请填写门店id");
}
};
const res = await editGoods(query);
if (res.code !== 0) {
......
......@@ -17,6 +17,7 @@
<!-- 所属分类 -->
<el-form-item label="所属分类">
<el-cascader
v-model="searchProps.classValue"
@change="handleTypeChange"
:options="labelOptions"
:props="cascaderProps"
......@@ -32,8 +33,8 @@
<el-form-item label="生活号名称">
<el-input v-model="searchProps.life_account_name"></el-input>
</el-form-item>
<!-- 商品状态 -->
<el-form-item label="商品状态">
<!-- 审核状态 -->
<el-form-item label="审核状态">
<el-select
v-model="audit_status"
multiple
......@@ -166,7 +167,6 @@
>
<template #default="scope">
<el-button
v-if="scope.row.audit_status == 2 || scope.row.online_status == 2 || scope.row.online_status == 1"
type="text"
@click="goDetail(`EDIT`, scope.row.goods_spu_id)"
>编辑</el-button>
......@@ -178,7 +178,7 @@
>审核</el-button>
<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="您确定要上架该商品吗?"
cancelButtonType="default"
@confirm="changeGoodsState('GROUNDING', scope.row.goods_spu_id)"
......@@ -189,7 +189,7 @@
</el-popconfirm>
<el-popconfirm
v-if="scope.row.online_status == 1"
v-if="scope.row.audit_status == 1 || scope.row.online_status == 1"
title="您确定要下架该商品吗?"
cancelButtonType="default"
@confirm="
......@@ -262,14 +262,15 @@ export default {
category_2_id: "", // 二级分类id
life_account_id: "",
life_account_name: "",
audit_status: "", // 商品状态
online_status: "" // 上架状态
audit_status: "", // 审核状态
online_status: "", // 上架状态
classValue: ""
},
// 级联选择器
labelOptions: [],
// 商品状态
// 审核状态
stateOption: [
{ value: 0, label: "待审核" },
{ value: 1, label: "审核通过" },
......@@ -333,7 +334,7 @@ export default {
this.searchProps.category_1_id = this.getVal(val, 0);
this.searchProps.category_2_id = this.getVal(val, 1);
},
// 商品状态赋值
// 审核状态赋值
handleStatusChange (val) {
this.searchProps.audit_status = this.getValue(val);
},
......@@ -348,7 +349,7 @@ export default {
},
// 重置表单
resetList () {
(this.searchProps = {
this.searchProps = {
page: 1, // 页码
page_size: 20, // 页数大小
goods_spu_id: "", // 后台商品id
......@@ -357,9 +358,12 @@ export default {
category_2_id: "", // 二级分类id
life_account_id: "",
life_account_name: "",
audit_status: "", // 商品状态
online_status: "" // 上架状态
}),
audit_status: "", // 审核状态
online_status: "", // 上架状态
classValue: ""
};
this.audit_status = [];
this.onlineStatus = [];
this.getCommodityList();
},
// 上架/下架操作
......
<template>
<layout>
<el-card class="container" style="width: 100%; height: 100%">
<el-card
class="container"
style="width: 100%; height: 100%"
>
<div class="retail">
<el-form inline :model="retailActivitie" ref="retailActivitie">
<el-form
inline
:model="retailActivitie"
ref="retailActivitie"
>
<!-- 查询 -->
<el-row>
<el-form-item label="分销活动id" prop="marketing_id">
<el-form-item
label="分销活动id"
prop="marketing_id"
>
<!-- :rules="[{ type: 'number', message: '活动id必须为数字值' }]" -->
<el-input
onkeyup="value=value.replace(/[^\d]/g,'')"
......@@ -34,7 +44,10 @@
</el-form-item>
<!-- 按钮操作 -->
<el-form-item class="search_button">
<el-button type="primary" @click="toSearch">搜索</el-button>
<el-button
type="primary"
@click="toSearch"
>搜索</el-button>
<el-button @click="reset('retailActivitie')">重置</el-button>
</el-form-item>
</el-row>
......@@ -42,10 +55,14 @@
type="primary"
style="margin-bottom: 10px"
@click="createDtb"
>创建分销活动</el-button
>
>创建分销活动</el-button>
<!-- Tab -->
<el-table :data="tableData" type="index" align="center" border>
<el-table
:data="tableData"
type="index"
align="center"
border
>
<el-table-column
align="center"
prop="marketing_id"
......@@ -77,11 +94,13 @@
label="二级分销金额"
>
</el-table-column>
<el-table-column align="center" prop="online_status" label="状态">
<template #default="scope">
<span
:style="{ color: scope.row.online_status == 3 ? 'red' : '' }"
<el-table-column
align="center"
prop="online_status"
label="状态"
>
<template #default="scope">
<span :style="{ color: scope.row.online_status == 3 ? 'red' : '' }">
{{
scope.row.online_status == 2
? "关闭"
......@@ -98,9 +117,17 @@
label="创建人"
>
</el-table-column>
<el-table-column align="center" prop="create_time" label="创建时间">
<el-table-column
align="center"
prop="create_time"
label="创建时间"
>
</el-table-column>
<el-table-column align="center" prop="update_time" label="更新时间">
<el-table-column
align="center"
prop="update_time"
label="更新时间"
>
</el-table-column>
<el-table-column
align="center"
......@@ -108,14 +135,17 @@
label="分销到期时间"
>
</el-table-column>
<el-table-column fixed="right" align="center" label="操作">
<el-table-column
fixed="right"
align="center"
label="操作"
>
<template #default="scope">
<el-button
@click="handleClick(scope.row)"
type="text"
size="mini"
>查看</el-button
>
>查看</el-button>
<el-button
type="text"
size="mini"
......@@ -135,8 +165,7 @@
scope.row.online_status !== 3
"
@click.stop="handelEnable(scope.row, 1)"
>启用</el-button
>
>启用</el-button>
</template>
</el-table-column>
</el-table>
......@@ -183,7 +212,10 @@
:disabled="shopStart !== 0"
></el-input>
</el-form-item>
<el-form-item label="一级佣金:" prop="first_commission_value">
<el-form-item
label="一级佣金:"
prop="first_commission_value"
>
<el-input
v-model.number="ruleForm.first_commission_value"
:disabled="shopStart !== 0"
......@@ -191,7 +223,10 @@
<template #append>%</template>
</el-input>
</el-form-item>
<el-form-item label="二级佣金: " prop="second_commission_value">
<el-form-item
label="二级佣金: "
prop="second_commission_value"
>
<el-input
v-model.number="ruleForm.second_commission_value"
:disabled="shopStart !== 0"
......@@ -222,7 +257,10 @@
ref="ruleIdForm"
size="mini"
>
<div class="queryBox" v-show="shopStart == 0">
<div
class="queryBox"
v-show="shopStart == 0"
>
<el-form-item label="关联商品:"> </el-form-item>
<el-form-item label="商品id:">
<el-input
......@@ -241,8 +279,7 @@
size="mini"
style="margin-bottom: 30px"
@click="findProducts"
>查询</el-button
>
>查询</el-button>
</div>
<div :class="shopStart == 0 ? 'newTab' : 'readTab'">
<el-table
......@@ -255,7 +292,10 @@
style="width: 100%"
@selection-change="selectGoodsChange"
>
<el-table-column align="center" type="selection">
<el-table-column
align="center"
type="selection"
>
</el-table-column>
<el-table-column
align="center"
......@@ -289,7 +329,11 @@
</div>
<template #footer>
<span class="dialog-footer">
<el-button type="primary" @click="cancel" style="width: 150px">{{
<el-button
type="primary"
@click="cancel"
style="width: 150px"
>{{
shopStart == 0 ? "取消" : "返回"
}}</el-button>
<el-button
......@@ -297,13 +341,13 @@
@click="addList"
style="width: 150px"
v-if="shopStart == 0"
>确 定</el-button
>
>确 定</el-button>
</span>
</template>
</el-dialog>
</template>
<script>
import Layout from "../layout/index.vue"
import {
getMarketingList,
getFindGoodsList,
......@@ -313,7 +357,7 @@ import {
} from "@/service/Goods/goods";
import { ElMessage } from "element-plus";
// 开启关闭防抖
function debounce(callback, delay) {
function debounce (callback, delay) {
let timer = null;
return function (...args) {
if (timer) {
......@@ -327,11 +371,14 @@ function debounce(callback, delay) {
}
export default {
name: "GoodsRetail",
data() {
components: {
Layout
},
data () {
var commission = (rule, value, callback) => {
if(this.ruleForm.first_commission_value + this.ruleForm.second_commission_value > 50 || value > 50) {
if (this.ruleForm.first_commission_value + this.ruleForm.second_commission_value > 50 || value > 50) {
callback(new Error("一级佣金与二级佣金之和不可大于50%"));
}else {
} else {
callback();
}
};
......@@ -409,7 +456,7 @@ export default {
},
methods: {
// 查看详情列表
async handleClick(row) {
async handleClick (row) {
this.dialogFormVisible = true;
this.shopStart = 1;
this.disabled = true;
......@@ -425,13 +472,13 @@ export default {
}
},
// 页码变化
handleCurrentChange(e) {
handleCurrentChange (e) {
this.retailActivitie.page = e;
this.getMarketingList();
},
// 营销活动列表
async getMarketingList() {
async getMarketingList () {
try {
const res = await getMarketingList(this.retailActivitie);
this.tableData = res.result;
......@@ -459,12 +506,12 @@ export default {
}
}, 300),
// 创建分销活动
createDtb() {
createDtb () {
this.dialogFormVisible = true;
this.shopStart = 0;
},
// 重置
reset(retailActivitie) {
reset (retailActivitie) {
(this.retailActivitie = {
marketing_id: "",
marketing_name: "",
......@@ -477,11 +524,11 @@ export default {
this.getMarketingList({});
},
// 搜索
toSearch() {
toSearch () {
this.getMarketingList();
console.log(this.retailActivitie);
},
selectTime(e) {
selectTime (e) {
let date = new Date();
if (e && e[1] < date) {
ElMessage(`'活动结束时间不能早于当前时间'`);
......@@ -489,9 +536,9 @@ export default {
}
},
// 获取时间格式
formatTime(date) {
formatTime (date) {
// 封装函数判断是否要在目标前边加 ’0‘
function getStr(target) {
function getStr (target) {
return ("" + target).length === 1 ? "0" + target : target;
}
// 获取月
......@@ -512,7 +559,7 @@ export default {
return timeStr;
},
// 查询商品列表
async findProducts() {
async findProducts () {
// 获取参数
const { goods_sku_id, life_account_id } = this.ruleIdForm;
let [start_time, end_time] = this.timeSelect;
......@@ -541,10 +588,10 @@ export default {
ElMessage.error("请求查询商品列表失败");
}
},
selectGoodsChange(e) {
selectGoodsChange (e) {
this.ruleForm.goods_sku_id = e.map((item) => item.goods_sku_id);
},
async getAllList() {
async getAllList () {
let all = await getMarketingList({
page: 1,
page_size: this.retailActivitie.count
......@@ -552,7 +599,7 @@ export default {
this.allList = all.result;
},
// 添加活动列表
async addList() {
async addList () {
this.$refs.ruleForm.validate(async (valid) => {
if (valid) {
console.log(this.ruleForm.goods_sku_id);
......@@ -606,7 +653,7 @@ export default {
},
// 清空
resetDate() {
resetDate () {
(this.ruleForm = {
marketing_name: "",
first_commission_value: "",
......@@ -625,13 +672,13 @@ export default {
});
},
// 取消
cancel() {
cancel () {
this.dialogFormVisible = false;
this.resetDate();
this.getMarketingList();
}
},
created() {
created () {
this.getMarketingList();
this.getAllList();
}
......@@ -642,8 +689,6 @@ export default {
display: flex;
width: 100%;
height: 100%;
.retail {
}
.but_one {
margin-left: 10px;
}
......
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