Commit e1a1b079 authored by 黄奎's avatar 黄奎

页面修改

parent 74013aab
...@@ -2,59 +2,43 @@ ...@@ -2,59 +2,43 @@
<div class="SpeTemplate"> <div class="SpeTemplate">
<div class="head-title"> <div class="head-title">
规格模板 规格模板
<el-button @click="openDig" style="float:right;margin-top: -5px;margin-left:20px;" size="small" type="primary">新增模板管理</el-button> <el-button @click="openDig" style="float:right;margin-top: -5px;margin-left:20px;" size="small" type="primary">
新增模板管理</el-button>
</div> </div>
<div class="content"> <div class="content">
<div> <div>
<div class="searchInput" style="width:250px"> <div class="searchInput" style="width:250px">
<el-input style="display:inline-block;width:225px;height:30px" <el-input style="display:inline-block;width:225px;height:30px" placeholder="请输入规格名搜索"
placeholder="请输入规格名搜索" @keyup.enter.native="msg.pageIndex=1,getList()" v-model="msg.Name" @clear="msg.pageIndex=1,getList()"
@keyup.enter.native="msg.pageIndex=1,getList()" size="small" clearable>
v-model="msg.Name"
@clear="msg.pageIndex=1,getList()"
size="small"
clearable>
</el-input> </el-input>
<span @click="msg.pageIndex=1,getList()" class="el-icon-search" style="color:#979dad;font-size:14px;position:relative;top:1px"></span> <span @click="msg.pageIndex=1,getList()" class="el-icon-search"
style="color:#979dad;font-size:14px;position:relative;top:1px"></span>
</div> </div>
</div> </div>
<el-table <el-table :data="tableData" v-loading="loading" border style="width: 100%;margin:20px 0">
:data="tableData" <el-table-column prop="Name" width="300" label="规格名">
v-loading="loading"
border
style="width: 100%;margin:20px 0">
<el-table-column
prop="Name"
width="300"
label="规格名">
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="address" label="规格值">
prop="address"
label="规格值">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag size="small" v-for="(item,index) in scope.row.SpecList" :key="index" style="margin:0 5px" type="info">{{item}}</el-tag> <el-tag size="small" v-for="(item,index) in scope.row.SpecList" :key="index" style="margin:0 5px"
type="info">{{item}}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="address" width="200" label="操作">
prop="address"
width="200"
label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<img @click="Edit(scope.row)" style="width:32px;height:32px" src="../../assets/img/userman/edit.png" alt=""> <img @click="Edit(scope.row)" style="width:32px;height:32px" src="../../assets/img/userman/edit.png" alt="">
<img @click="Delete(scope.row)" style="width:32px;height:32px;margin:0 10px" src="../../assets/img/userman/del.png" alt=""> <img @click="Delete(scope.row)" style="width:32px;height:32px;margin:0 10px"
src="../../assets/img/userman/del.png" alt="">
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination style="text-align:right" <el-pagination style="text-align:right" background @current-change="handleCurrentChange" :page-size="msg.pageSize"
background layout="prev, pager, next" :total="total">
@current-change="handleCurrentChange"
:page-size="msg.pageSize"
layout="prev, pager, next"
:total="total">
</el-pagination> </el-pagination>
</div> </div>
<!-- 新增规格模板 --> <!-- 新增规格模板 -->
<el-dialog custom-class="attr-template" title="充值" :visible.sync="ggmbDig" width="960px"> <el-dialog custom-class="attr-template" title="规格" :visible.sync="ggmbDig" width="960px">
<el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="100px"> <el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="100px">
<el-form-item label="规格名" prop="Name"> <el-form-item label="规格名" prop="Name">
<el-input size="small" v-model="addMsg.Name" style="width:330px"></el-input> <el-input size="small" v-model="addMsg.Name" style="width:330px"></el-input>
...@@ -79,51 +63,55 @@ ...@@ -79,51 +63,55 @@
</template> </template>
<script> <script>
export default { export default {
name: "SpeTemplate", name: "SpeTemplate",
data(){ data() {
return{ return {
ggmbDig:false, ggmbDig: false,
msg:{ msg: {
pageIndex:1, pageIndex: 1,
pageSize:15, pageSize: 15,
Name:'', Name: '',
Id:0, Id: 0,
Content:'', Content: '',
}, },
total:0, total: 0,
tableData:[ tableData: [{
{Name:'11'} Name: '11'
], }],
loading:false, loading: false,
addMsg:{ addMsg: {
Id:0, Id: 0,
Name:'', Name: '',
SpecList:[], SpecList: [],
}, },
rules:{ rules: {
SpecList: [], SpecList: [],
Name: [ Name: [{
{ required: true, message: '规格名不能为空', trigger: 'blur' } required: true,
], message: '规格名不能为空',
trigger: 'blur'
}],
}, },
SpecList:[], SpecList: [],
} }
}, },
created(){ created() {
this.getList(); this.getList();
}, },
methods:{ methods: {
Delete(item){ Delete(item) {
let that=this; let that = this;
that.$confirm('是否删除?', '提示', { that.$confirm('是否删除?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.apipost('/api/product/DelProductSpecificationInfo',{SpecificationId:item.Id}, this.apipost('/api/product/DelProductSpecificationInfo', {
SpecificationId: item.Id
},
res => { res => {
if (res.data.resultCode === 1) { if (res.data.resultCode === 1) {
this.getList(); this.getList();
...@@ -139,53 +127,55 @@ export default { ...@@ -139,53 +127,55 @@ export default {
}); });
}, },
Edit(row){ Edit(row) {
this.addMsg=row; this.addMsg = row;
this.SpecList=[]; this.SpecList = [];
row.SpecList.forEach(item=>{ row.SpecList.forEach(item => {
let obj={ let obj = {
num:item num: item
} }
this.SpecList.push(obj) this.SpecList.push(obj)
}) })
this.ggmbDig=true; this.ggmbDig = true;
}, },
deleteGgz(item,index){ deleteGgz(item, index) {
this.SpecList.splice(index,1); this.SpecList.splice(index, 1);
}, },
addGgz(){ addGgz() {
let obj={num:''} let obj = {
num: ''
}
this.SpecList.push(obj); this.SpecList.push(obj);
}, },
openDig(){ openDig() {
this.addMsg={ this.addMsg = {
Id:0, Id: 0,
Name:'', Name: '',
SpecList:[], SpecList: [],
} }
this.SpecList=[]; this.SpecList = [];
this.ggmbDig=true; this.ggmbDig = true;
}, },
submitForm(formName){ submitForm(formName) {
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
for(let i=0;i<this.SpecList.length;i++){ for (let i = 0; i < this.SpecList.length; i++) {
if(this.SpecList[i].num==""){ if (this.SpecList[i].num == "") {
this.Error("规格值不能为空"); this.Error("规格值不能为空");
return; return;
} }
} }
this.addMsg.SpecList=[]; this.addMsg.SpecList = [];
this.SpecList.forEach(item=>{ this.SpecList.forEach(item => {
this.addMsg.SpecList.push(item.num); this.addMsg.SpecList.push(item.num);
}) })
this.apipost('/api/product/SetProductSpecificationInfo',this.addMsg, this.apipost('/api/product/SetProductSpecificationInfo', this.addMsg,
res => { res => {
if (res.data.resultCode === 1) { if (res.data.resultCode === 1) {
this.getList(); this.getList();
this.Success(res.data.message) this.Success(res.data.message)
this.ggmbDig=false; this.ggmbDig = false;
} else { } else {
this.Error(res.data.message); this.Error(res.data.message);
...@@ -202,60 +192,68 @@ export default { ...@@ -202,60 +192,68 @@ export default {
this.msg.pageIndex = val; this.msg.pageIndex = val;
this.getList(); this.getList();
}, },
getList(){ getList() {
this.loading=true; this.loading = true;
this.apipost("/api/product/GetProductSpecificationPageList", this.msg, res => { this.apipost("/api/product/GetProductSpecificationPageList", this.msg, res => {
this.loading=false; this.loading = false;
if(res.data.resultCode==1){ if (res.data.resultCode == 1) {
this.total=res.data.data.count; this.total = res.data.data.count;
let pageData=res.data.data.pageData; let pageData = res.data.data.pageData;
this.tableData=pageData; this.tableData = pageData;
} }
}) })
}, },
}, },
}; };
</script> </script>
<style> <style>
.attr-template .attr-list { .attr-template .attr-list {
display: inline-block; display: inline-block;
margin-right: 10px; margin-right: 10px;
margin-bottom: 10px; margin-bottom: 10px;
position: relative; position: relative;
cursor: move; cursor: move;
} }
.attr-template .close {
.attr-template .close {
position: absolute; position: absolute;
top: -4px; top: -4px;
right: -4px; right: -4px;
font-size: 16px; font-size: 16px;
cursor: pointer; cursor: pointer;
background: #ffffff; background: #ffffff;
} }
.SpeTemplate .content .searchInput{
.SpeTemplate .content .searchInput {
border: 1px solid #DCDFE6; border: 1px solid #DCDFE6;
border-radius: 4px; border-radius: 4px;
} }
.SpeTemplate .content .searchInput .el-input__inner{
border:none;outline:none; .SpeTemplate .content .searchInput .el-input__inner {
border: none;
outline: none;
height: 30px; height: 30px;
line-height: 30px; line-height: 30px;
} }
.SpeTemplate .content .searchInput{
.SpeTemplate .content .searchInput {
line-height: normal; line-height: normal;
display: inline-table; display: inline-table;
width: 100%; width: 100%;
border-collapse: separate; border-collapse: separate;
border-spacing: 0; border-spacing: 0;
width:250px; width: 250px;
margin-right: 20px; margin-right: 20px;
} }
.SpeTemplate .content{
.SpeTemplate .content {
background: #fff; background: #fff;
margin-top:10px; margin-top: 10px;
padding: 20px; padding: 20px;
box-sizing: border-box; box-sizing: border-box;
} }
</style> </style>
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