Commit a61881ec authored by 华国豪's avatar 华国豪 🙄

no message

parent 0b3c075e
<style>
.height_auto.el-select .el-input {
height: auto;
}
.CommodityType ._addUpload_box {
display: block;
margin: 10px 0 0;
}
.CommodityType ._addUpload_box img {
height: 15px;
display: block;
margin-right: 25px;
}
.CommodityType ._addUpload_box > div.el-upload {
float: left;
width: 138px;
height: 92px;
border: 1px dashed rgba(210, 210, 210, 1);
border-radius: 2px;
cursor: pointer;
margin-bottom: 10px;
padding: 5px;
margin-right: 10px;
position: relative;
}
.CommodityType ._addUpload_box .icon-guanbi1 {
font-size: 12px;
color: white;
display: inline-block;
margin-left: 15px;
position: absolute;
left: 9px;
top: -5px;
background-color: #f56c6c;
border-radius: 50%;
height: 15px;
width: 15px;
text-align: center;
line-height: 15px;
}
.CommodityType ._addUpload_box > div:hover {
background-color: #f5f5f5;
}
.CommodityType .el-upload-dragger {
font-size: 28px;
color: #8c939d;
width: 126px;
height: 80px;
line-height: 41px;
text-align: center;
}
.CommodityType .bg_color_delete{
background-color: #ee4454;
border-color: #ee4454;
}
</style>
<template>
<div class="flexOne CommodityType">
<div class="query-box">
<ul class>
<li>
<input type="button" @click="getList" class="hollowFixedBtn" value="查询">
<input
type="button"
@click="outerVisible = true,dialogTitle='新增商品活动', addMsg.reqType = 'add',resetInfo()"
class="normalBtn"
:value="$t('pub.addBtn')"
>
</li>
</ul>
</div>
<div class="clearfix"></div>
<table class="singeRowTable" border="0" cellspacing="0" cellpadding="0" v-loading="loading">
<tr>
<th width="120px">活动编号</th>
<th>活动名称</th>
<th>活动图片</th>
<th>活动描述</th>
<th>创建时间</th>
<th>操作</th>
</tr>
<tr v-for="item in dataList">
<td>{{item.id}}</td>
<td>{{item.name}}</td>
<td>
<img :src="item.images" alt>
</td>
<td>{{item.descrip}}</td>
<td>{{item.createTime.replace('T', ' ')}}</td>
<td>
<el-tooltip
class="item"
effect="dark"
:content="$t('active.ld_editInfo')"
placement="top"
>
<el-button
type="primary"
icon="el-icon-edit"
circle
@click="outerVisible=true,dialogTitle='修改商品活动',updateData(item)"
></el-button>
</el-tooltip>
<!-- <el-tooltip class="item" effect="dark" content="删除" placement="top">
<el-button type="primary" class="bg_color_delete" icon="el-icon-delete" circle @click="Delete(item)"></el-button>
</el-tooltip> -->
</td>
</tr>
</table>
<div class="noDataNotice" v-if="dataList.length<1">
<i class="iconfont icon-kong"></i>
<p>{{$t("active.ld_noData")}}</p>
</div>
<el-dialog
custom-class="w400"
:title="dialogTitle"
:visible.sync="outerVisible"
center
:before-close="closeChangeMachie"
>
<el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="130px">
<el-form-item label="商品活动名称" prop="name">
<el-input v-model="addMsg.name" class="w217"/>
</el-form-item>
<el-form-item label="活动介绍" prop="descrip">
<el-input type="textarea" v-model="addMsg.descrip" class="w217"></el-input>
</el-form-item>
<el-form-item label="商品活动图标">
<div class="_addUpload_box">
<div class="_pic_upload">
<template v-if="addMsg.images!==''">
<div>
<div
style="width:100%;height:100%;overflow: hidden;display: flex;align-items: center;"
>
<img :src="addMsg.images">
<span
style="font-size:12px; color:#666666;cursor: pointer;line-height: 20px;"
@click="addMsg.images=''"
>重新上传</span>
</div>
</div>
</template>
<el-upload
v-else
drag
:http-request="uploadFileBtn"
:multiple="false"
:show-file-list="false"
action
>
<i class="el-icon-plus avatar-uploader-icon"></i>
<div class="el-upload__text">{{$t("active.ld_djscwj")}}</div>
</el-upload>
</div>
</div>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<button
class="hollowFixedBtn"
@click="outerVisible = false, resetForm('addMsg')"
>{{$t('pub.cancelBtn')}}</button> &nbsp;
<button class="normalBtn" @click="submitForm('addMsg')">{{$t('pub.saveBtn')}}</button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
//请求
msg: {
state: -1,
name: ""
},
addMsg: {
descrip: "",
name: "",
images: "",
id: 0
},
rules: {
name: [
{ required: true, message: "请输入名称", trigger: "blur" }
],
descrip: [
{ required: true, message: "请输入描述", trigger: "blur" }
]
},
loading: false,
outerVisible: false,
dialogTitle: "",
dataList: [],
awardRelationList: [],
jurisdictionsList: []
};
},
mounted() {
this.getList();
},
filters: {},
methods: {
// 删除
Delete(item) {
this.$confirm("是否删除"+ item.name+"? 删除后不可恢复", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
this.apiJavaPost(
"/api/IntegralManager/goodsTypeManager",
{ reqType: 'delete', id: item.id },
res => {
if (res.data.resultCode == 1) {
this.Success(res.data.message);
this.getList();
} else {
this.Error(res.data.message);
}
},
err => {}
);
})
.catch(() => {});
},
//上传图片
uploadFileBtn(file) {
//上传
if (file.file.size > 1024 * 1024 * 10) {
this.$message.warning(this.$t("tips.wjdxbncgsz"));
return;
}
// 1 文档 2 数据 3 图片
let typeArr = [{ stringArr: "GIF|JPG|JPEG|PNG|BMP", type: 3 }];
let ft = file.file.name
.substring(file.file.name.lastIndexOf(".") + 1, file.file.name.length)
.toUpperCase();
let fileTypeNumber = 2;
let typeOk = false;
typeArr.forEach(x => {
if (x.stringArr.indexOf(ft) != "-1") {
fileTypeNumber = x.type;
typeOk = true;
}
});
if (!typeOk) return this.$message.error(this.$t("tips.qsctpian"));
let newArr = [];
newArr.push(file.file);
let path = "/Upload/activity/";
this.$message.info(this.$t("tips.shangchuanzhong"));
this.UploadSelfFileT(path, newArr, x => {
let fileSize =
file.file.size < 1024
? file.file.size
: (file.file.size / 1024).toFixed(0);
this.addMsg.images = this.domainManager().ViittoFileUrl + x.data.FilePath;
this.$message.success(this.$t("tips.scchenggong"));
this.$forceUpdate();
});
},
//获取数据
getList() {
this.loading = true;
this.apiJavaPost(
"/api/IntegralManager/getGoodsSeries",
{},
res => {
this.loading = false;
console.log(res);
if (res.data.resultCode === 1) {
this.dataList = res.data.data;
console.log(this.dataList, "datalist");
} else {
this.Error(res.data.message);
}
},
null
);
},
//提交
submitForm(addMsg) {
//提交创建、修改表单
this.$refs[addMsg].validate(valid => {
if (valid) {
this.addAward();
} else {
return false;
}
});
},
//提交添加
addAward() {
if (this.addMsg.images === "") return this.Error("请上传图片");
this.apiJavaPost(
"/api/IntegralManager/AddGoodsSeries",
this.addMsg,
res => {
if (res.data.resultCode === 1) {
this.Success(res.data.message);
this.outerVisible = false;
this.getList();
} else {
this.Error(res.data.message);
}
},
null
);
},
//修改信息
updateData(item) {
this.outerVisible = true;
this.addMsg.id = item.id;
this.addMsg.name = item.name;
this.addMsg.descrip = item.descrip;
this.addMsg.images = item.images;
},
//重置信息
resetInfo() {
var newMsg = {
name: "",
descrip: '',
images: "",
id: 0
};
this.addMsg = newMsg;
},
closeChangeMachie(done) {
//弹出框关闭初始化弹框内表单
done();
this.resetForm("addMsg");
},
resetForm(formName) {
this.$refs[formName].resetFields();
}
}
};
</script>
\ No newline at end of file
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