Commit 04ab9b86 authored by 华国豪's avatar 华国豪 🙄

no message

parent 991f7ffc
<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.icon" alt>
</td>
<td>{{item.state === 1 ? '正常' : '禁用'}}</td>
<td>{{item.updateTime.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="state">
<el-select filterable v-model="addMsg.state">
<el-option label="显示" :value="1"></el-option>
<el-option label="不显示" :value="0"></el-option>
</el-select>
</el-form-item>
<el-form-item label="商品类型图标">
<div class="_addUpload_box">
<div class="_pic_upload">
<template v-if="addMsg.icon!==''">
<div>
<div
style="width:100%;height:100%;overflow: hidden;display: flex;align-items: center;"
>
<img :src="addMsg.icon">
<span
style="font-size:12px; color:#666666;cursor: pointer;line-height: 20px;"
@click="addMsg.icon=''"
>重新上传</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: {
reqType: "add",
name: "",
state: 1,
icon: "",
id: 0
},
rules: {
memberLevel: [
{ required: true, message: "请输入会员等级", trigger: "blur" }
],
name: [
{ 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.icon = this.domainManager().ViittoFileUrl + x.data.FilePath;
this.$message.success(this.$t("tips.scchenggong"));
this.$forceUpdate();
});
},
//获取数据
getList() {
this.loading = true;
this.apiJavaPost(
"/api/IntegralManager/goodsTypeManager",
{ reqType: "find" },
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.icon === "") return this.Error("请上传icon");
this.apiJavaPost(
"/api/IntegralManager/goodsTypeManager",
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.reqType = "update";
this.addMsg.id = item.id;
this.addMsg.name = item.name;
this.addMsg.state = item.state;
this.addMsg.icon = item.icon;
},
//重置信息
resetInfo() {
var newMsg = {
reqType: "add",
name: "",
state: 1,
icon: "",
id: 0
};
this.addMsg = newMsg;
},
closeChangeMachie(done) {
//弹出框关闭初始化弹框内表单
done();
this.resetForm("addMsg");
},
resetForm(formName) {
this.$refs[formName].resetFields();
}
}
};
</script>
\ No newline at end of file
<style>
.height_auto.el-select .el-input{
height: auto
}
</style>
<template>
<div class="flexOne">
<div class="query-box">
<ul class="user_time_picker">
<li>
<span>
<em>商品名称</em>
<el-input v-model="msg.name" @keyup.enter.native="getList"></el-input>
</span>
</li>
<li>
<span>
<em>商品类型</em>
<el-select filterable v-model="msg.type">
<el-option label="不限" value="" key="0"></el-option>
<el-option v-for="item in GoodsTypeList" :label="item.name" :value="item.id" :key="item.id"></el-option>
</el-select>
</span>
</li>
<li>
<span>
<em>状态</em>
<el-select filterable v-model="msg.state">
<el-option label="上架" :value="1"></el-option>
<el-option label="下架" :value="0"></el-option>
<el-option label="删除" :value="-1"></el-option>
</el-select>
</span>
</li>
<li>
<span>
<em>热门商品</em>
<el-select filterable v-model="msg.ishot">
<el-option label="热门" value="Y"></el-option>
<el-option label="非热门" value="N"></el-option>
</el-select>
</span>
</li>
<li>
<input type="button" @click="getList" class="hollowFixedBtn" value="查询">
<input type="button" @click="addIntegralMall('addIntegralMall', '', '新增商品')" 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='80'>商品编号</th>
<th>商品名称</th>
<th>购买等级要求</th>
<th>价格</th>
<th>市场价</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>{{item.isReqRate === -1 ? '不限' : `${item.isReqRate}级`}}</td>
<td>{{item.price}}{{item.priceUnit === 1 ? '人民币' : '积分'}}</td>
<td>{{item.marketPrice}}</td>
<td>{{item.quota === 0 ? '不限购' : `限购${item.quota}次`}}</td>
<td>{{item.logistic}}</td>
<td>{{item.ishot === 'Y' ? '热门' : '非热门'}}</td>
<td>{{item.state === 1 ? '上架' : item.state === 0 ? '下架' : '删除'}}</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="addIntegralMall('addIntegralMall', 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>
</div>
</template>
<script>
export default {
data() {
return {
//请求
msg: {
pageSize: 15,
pageIndex: 1,
state: 1,
name: '',
type: '',
ishot: 'Y'
},
loading:false,
dataList:[],
GoodsTypeList: [],
};
},
mounted() {
this.getList();
this.getGoodsTypeManager();
},
filters: {
},
methods: {
addIntegralMall: function( path, obj, tab){
localStorage.editIntegralMall = JSON.stringify(obj);
this.$router.push({ name: path,query:{blank: 'y', tab: tab} })
},
getGoodsTypeManager() {
this.apiJavaPost(
"/api/IntegralManager/goodsTypeManager",
{ reqType: "find" },
res => {
if (res.data.resultCode === 1) {
this.GoodsTypeList = res.data.data;
} else {
this.Error(res.data.message);
}
},
null
);
},
//获取数据
getList() {
this.loading = true;
this.apiJavaPost("/api/IntegralManager/getGoodsPageList", this.msg, res => {
this.loading = false;
if (res.data.resultCode === 1) {
this.dataList = res.data.data.pageData;
} else {
this.Error(res.data.message)
}
}, null);
},
}
};
</script>
\ No newline at end of file
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