Commit f1049b05 authored by 黄媛媛's avatar 黄媛媛

解决冲突

parents 54880c12 f2515d09
......@@ -15,10 +15,12 @@
"dependencies": {
"axios": "^0.19.2",
"cos-js-sdk-v5": "^0.5.26",
"echarts": "^4.8.0",
"element-ui": "^2.13.1",
"js-md5": "^0.7.3",
"vue": "^2.5.2",
"vue-router": "^3.0.1"
"vue-router": "^3.0.1",
"vuedraggable": "^2.23.2"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
......
......@@ -6,7 +6,7 @@
<div class="hoindexImgdiv">
<img src="../assets/img/logo.png" alt="" style="height:30px">
</div>
<div class="hoindexRight">
<div class="hoindexRight" style="cursor:pointer;">
<el-dropdown>
<span class="el-dropdown-link" style="color:#fff;font-size:16px">
<i class="iconfont icon-iconzh1"></i>
......
......@@ -5,145 +5,139 @@
</div>
<div class="content">
<el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="150px" style="width:60%">
<el-form-item label="分类">
<template v-if="addMsg.CategoryList && addMsg.CategoryList.length>0">
<el-tag type="warning" style="margin-right:10px;" @close="exitCheck(item,index)"
v-for="(item,index) in addMsg.CategoryList" :key="index" closable>
{{item.CategoryName}}
</el-tag>
</template>
<el-button type="primary" @click="flDig=true,keepCategoryList=addMsg.CategoryList"
style="margin:0 10px;" size="small">选择分类</el-button>
</el-form-item>
<!-- <el-form-item label="分销名称" prop="Name">
<el-form-item label="分类">
<template v-if="addMsg.CategoryList && addMsg.CategoryList.length>0">
<el-tag type="warning" style="margin-right:10px;" @close="exitCheck(item,index)"
v-for="(item,index) in addMsg.CategoryList" :key="index" closable>
{{item.CategoryName}}
</el-tag>
</template>
<el-button type="primary" @click="flDig=true,keepCategoryList=addMsg.CategoryList" style="margin:0 10px;"
size="small">选择分类</el-button>
</el-form-item>
<!-- <el-form-item label="分销名称" prop="Name">
<el-input v-model="addMsg.Name" size="small"></el-input>
</el-form-item> -->
<el-form-item label="等级">
<el-button @click="gradeDig=true" size="small" type="primary" style="margin-bottom:10px">选择等级</el-button>
<el-table
:data="addMsg.RatioList"
border
style="width: 100%">
<el-table-column
prop="GradeName"
label="名称">
</el-table-column>
<el-table-column
prop="address"
label="比例">
<template slot-scope="scope">
<el-input @input="inputVal(scope.row)" type="number" min="1" v-model="scope.row.CommissionRatio" size="small" placeholder="请输入">
<el-button slot="append">%</el-button>
</el-input>
</template>
</el-table-column>
<el-table-column
width="80px"
prop="address"
label="操作">
<template slot-scope="scope">
<el-tooltip class="item" effect="dark" content="删除" placement="top">
<img @click="Delete(scope.row,scope.$index)" style="width:32px;height:32px;margin:0 10px" src="../../assets/img/userman/del.png" alt="">
</el-tooltip>
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-form-item label="返佣小数类型" prop="DecimalType">
<el-radio v-model="addMsg.DecimalType" :label="1">整数</el-radio>
<el-radio v-model="addMsg.DecimalType" :label="2">保留2位小数</el-radio>
</el-form-item>
<el-form-item label="是否启用" prop="Enabled">
<el-radio v-model="addMsg.Enabled" :label="1"></el-radio>
<el-radio v-model="addMsg.Enabled" :label="2"></el-radio>
</el-form-item>
</el-form>
<el-form-item label="等级">
<el-button @click="gradeDig=true" size="small" type="primary" style="margin-bottom:10px">选择等级</el-button>
<el-table :data="addMsg.RatioList" border style="width: 100%">
<el-table-column prop="GradeName" label="名称">
</el-table-column>
<el-table-column prop="address" label="比例">
<template slot-scope="scope">
<el-input @input="inputVal(scope.row)" type="number" min="1" v-model="scope.row.CommissionRatio"
size="small" placeholder="请输入">
<el-button slot="append">%</el-button>
</el-input>
</template>
</el-table-column>
<el-table-column width="80px" prop="address" label="操作">
<template slot-scope="scope">
<el-tooltip class="item" effect="dark" content="删除" placement="top">
<img @click="Delete(scope.row,scope.$index)" style="width:32px;height:32px;margin:0 10px"
src="../../assets/img/userman/del.png" alt="">
</el-tooltip>
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-form-item label="返佣小数类型" prop="DecimalType">
<el-radio v-model="addMsg.DecimalType" :label="1">整数</el-radio>
<el-radio v-model="addMsg.DecimalType" :label="2">保留2位小数</el-radio>
</el-form-item>
<el-form-item label="是否启用" prop="Enabled">
<el-radio v-model="addMsg.Enabled" :label="1"></el-radio>
<el-radio v-model="addMsg.Enabled" :label="2"></el-radio>
</el-form-item>
</el-form>
</div>
<div style="margin-top:20px">
<el-button size="small" type="primary" @click="Save('addMsg')">保存</el-button>
<el-button size="small" type="primary" @click="Save('addMsg')">保存</el-button>
</div>
<!-- 选择分类 -->
<el-dialog custom-class="app-add-cat" title="选择分类" :visible.sync="flDig" width="1100px">
<el-row>
<el-col :span="8" style="padding:0 10px;box-sizing:border-box">
<h3 style="padding:15px 0">一级分类</h3>
<div class="app-goods-cat-list active">
<el-checkbox-group v-model="NewCategoryList" @change="handleCheckChange">
<div v-for="(item,index) in fenleiData" :key="index" flex="dir:left box:first" class="cat-item">
<el-checkbox :label="item.Id">
<span style="display: none;">{{item.Name}}</span>
</el-checkbox>
<div flex="box:last cross:center">
<span>{{item.Name}}</span>
<i v-if="item.ChildList.length>0" @click="getChild2(item.ChildList)" class="el-icon-arrow-right"></i>
</div>
</div>
</el-checkbox-group>
<el-row>
<el-col :span="8" style="padding:0 10px;box-sizing:border-box">
<h3 style="padding:15px 0">一级分类</h3>
<div class="app-goods-cat-list active">
<el-checkbox-group v-model="NewCategoryList" @change="handleCheckChange">
<div v-for="(item,index) in fenleiData" :key="index" flex="dir:left box:first" class="cat-item">
<el-checkbox :label="item.Id">
<span style="display: none;">{{item.Name}}</span>
</el-checkbox>
<div flex="box:last cross:center">
<span>{{item.Name}}</span>
<i v-if="item.ChildList.length>0" @click="getChild2(item.ChildList)" class="el-icon-arrow-right"></i>
</div>
</el-col>
<el-col v-show="childList2.length>0" :span="8" style="padding:0 10px;box-sizing:border-box">
<h3 style="padding:15px 0">二级分类</h3>
<div class="app-goods-cat-list active">
<el-checkbox-group v-model="NewCategoryList" @change="handleCheckChange">
<div v-for="(item,index) in childList2" :key="index" flex="dir:left box:first" class="cat-item">
<el-checkbox :label="item.Id">
<span style="display: none;">{{item.Name}}</span>
</el-checkbox>
<div flex="box:last cross:center">
<span>{{item.Name}}</span>
<i v-if="item.ChildList.length>0" @click="getChild3(item.ChildList)" class="el-icon-arrow-right"></i>
</div>
</div>
</el-checkbox-group>
</div>
</el-checkbox-group>
</div>
</el-col>
<el-col v-show="childList2.length>0" :span="8" style="padding:0 10px;box-sizing:border-box">
<h3 style="padding:15px 0">二级分类</h3>
<div class="app-goods-cat-list active">
<el-checkbox-group v-model="NewCategoryList" @change="handleCheckChange">
<div v-for="(item,index) in childList2" :key="index" flex="dir:left box:first" class="cat-item">
<el-checkbox :label="item.Id">
<span style="display: none;">{{item.Name}}</span>
</el-checkbox>
<div flex="box:last cross:center">
<span>{{item.Name}}</span>
<i v-if="item.ChildList.length>0" @click="getChild3(item.ChildList)" class="el-icon-arrow-right"></i>
</div>
</el-col>
<el-col v-show="childList3.length>0" :span="8" style="padding:0 10px;box-sizing:border-box">
<h3 style="padding:15px 0">三级分类</h3>
<div class="app-goods-cat-list active">
<el-checkbox-group v-model="NewCategoryList" @change="handleCheckChange">
<div v-for="(item,index) in childList3" :key="index" flex="dir:left box:first" class="cat-item">
<el-checkbox :label="item.Id">
<span style="display: none;">{{item.Name}}</span>
</el-checkbox>
<div flex="box:last cross:center">
<span>{{item.Name}}</span>
<i class="el-icon-arrow-right"></i>
</div>
</div>
</el-checkbox-group>
</div>
</el-checkbox-group>
</div>
</el-col>
<el-col v-show="childList3.length>0" :span="8" style="padding:0 10px;box-sizing:border-box">
<h3 style="padding:15px 0">三级分类</h3>
<div class="app-goods-cat-list active">
<el-checkbox-group v-model="NewCategoryList" @change="handleCheckChange">
<div v-for="(item,index) in childList3" :key="index" flex="dir:left box:first" class="cat-item">
<el-checkbox :label="item.Id">
<span style="display: none;">{{item.Name}}</span>
</el-checkbox>
<div flex="box:last cross:center">
<span>{{item.Name}}</span>
<i class="el-icon-arrow-right"></i>
</div>
</el-col>
</el-row>
<div class="tag-box">
<el-tag @close="exitCheck(item)" v-for="(item,index) in addMsg.CategoryList" :key="index" type="warning"
closable style="margin-right:5px">{{item.Name}}</el-tag>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="flDig=false,addMsg.CategoryList=keepCategoryList,ExitCateList()">取 消</el-button>
<el-button @click="flDig = false" size="small" type="primary">确 定</el-button>
</span>
</div>
</el-checkbox-group>
</div>
</el-col>
</el-row>
<div class="tag-box">
<el-tag @close="exitCheck(item)" v-for="(item,index) in addMsg.CategoryList" :key="index" type="warning"
closable style="margin-right:5px">{{item.Name}}</el-tag>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="flDig=false,addMsg.CategoryList=keepCategoryList,ExitCateList()">取 消</el-button>
<el-button @click="flDig = false" size="small" type="primary">确 定</el-button>
</span>
</el-dialog>
<!-- 选择等级 -->
<el-dialog title="选择等级" :visible.sync="gradeDig" width="510px">
<div style="box-sizing: border-box;background-color: #F3F5F6;width: 100%;padding-left: 20px;height: 50px;line-height: 50px;">
<el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选
</el-checkbox>
</div>
<div style="margin: 15px 0;"></div>
<div style="padding: 10px 25px 20px;">
<el-checkbox-group v-model="checkedCities" @change="handleCheckedCitiesChange">
<el-checkbox style="margin-bottom:10px;width:110px" v-for="city in cities" :label="city.Id" :key="city.GradeName">
{{city.GradeName}}</el-checkbox>
</el-checkbox-group>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="gradeDig = false">取 消</el-button>
<el-button size="small" type="primary" @click="chooseGrade">确 定</el-button>
</span>
<div
style="box-sizing: border-box;background-color: #F3F5F6;width: 100%;padding-left: 20px;height: 50px;line-height: 50px;">
<el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选
</el-checkbox>
</div>
<div style="margin: 15px 0;"></div>
<div style="padding: 10px 25px 20px;">
<el-checkbox-group v-model="checkedCities" @change="handleCheckedCitiesChange">
<el-checkbox style="margin-bottom:10px;width:110px" v-for="city in cities" :label="city.Id"
:key="city.GradeName">
{{city.GradeName}}</el-checkbox>
</el-checkbox-group>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="gradeDig = false">取 消</el-button>
<el-button size="small" type="primary" @click="chooseGrade">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
......@@ -156,15 +150,15 @@
cities: [],
cityOptions: [],
isIndeterminate: true,
gradeDig:false,
flDig:false,
gradeDig: false,
flDig: false,
addMsg: {
Id: 0,
DecimalType: 2,
Name: '',
Enabled:2,
RatioList:[],
CategoryList:[],
Id: 0,
DecimalType: 2,
Name: '',
Enabled: 2,
RatioList: [],
CategoryList: [],
},
rules: {
Name: [{
......@@ -172,233 +166,226 @@
message: '请输入分销名称',
trigger: 'blur'
}],
DecimalType: [
{ required: true, message: '请选择类型', trigger: 'change' }
],
Enabled: [
{ required: true, message: '请选择是否启用', trigger: 'change' }
],
DecimalType: [{
required: true,
message: '请选择类型',
trigger: 'change'
}],
Enabled: [{
required: true,
message: '请选择是否启用',
trigger: 'change'
}],
},
GradeId: '',
loading: false,
gradeList: [],
fenleiData:[],
fenleiData: [],
checkList: [],
childList2: [],
childList3: [],
keepCategoryList: [],
HpGradeList:[],
NewCategoryList:[],
HpGradeList: [],
NewCategoryList: [],
};
},
created() {
this.getTree();
this.getHpDistributorGrade();
},
methods: {
inputVal(row){
if(Number(row.CommissionRatio)<0){
row.CommissionRatio=1;
}
if(Number(row.CommissionRatio)>100){
row.CommissionRatio=100;
}
},
Delete(item,index){
this.addMsg.RatioList.splice(index, 1);
this.checkedCities.forEach((list,k)=>{
if(list==item.GradeId){
this.checkedCities.splice(k, 1);
}
})
},
chooseGrade(){
let arr=[];
this.addMsg.RatioList=[];
this.cities.forEach(item=>{
this.checkedCities.forEach(list=>{
if(item.Id==list){
let Obj={
Grade:item.Grade,
GradeId:item.Id,
CommissionRatio:'',
GradeName:item.GradeName,
}
arr.push(Obj);
}
})
})
let list=arr.sort(this.compareGrade("Grade",true));
this.addMsg.RatioList=list;
this.gradeDig=false;
},
compareGrade(property,desc) {
return function (a, b) {
var value1 = a[property];
var value2 = b[property];
if(desc==true){
// 升序排列
return value1 - value2;
}else{
// 降序排列
return value2 - value1;
}
}
},
handleCheckAllChange(val) {
this.checkedCities = val ? this.cityOptions : [];
this.isIndeterminate = false;
},
handleCheckedCitiesChange(value) {
let checkedCount = value.length;
this.checkAll = checkedCount === this.cities.length;
this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length;
},
Save(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
if(this.addMsg.RatioList.length==0){
this.Error("请选择返佣等级!");
return;
}
this.apipost("/api/user/SetHpDistributorInfo", this.addMsg, res => {
if (res.data.resultCode == 1) {
this.CommonJump('PeaceDistribution');
} else {
this.Error(res.data.message);
}
})
} else {
return false;
inputVal(row) {
if (Number(row.CommissionRatio) < 0) {
row.CommissionRatio = 1;
}
if (Number(row.CommissionRatio) > 100) {
row.CommissionRatio = 100;
}
},
Delete(item, index) {
this.addMsg.RatioList.splice(index, 1);
this.checkedCities.forEach((list, k) => {
if (list == item.GradeId) {
this.checkedCities.splice(k, 1);
}
})
},
chooseGrade() {
let arr = [];
this.addMsg.RatioList = [];
this.cities.forEach(item => {
this.checkedCities.forEach(list => {
if (item.Id == list) {
let Obj = {
Grade: item.Grade,
GradeId: item.Id,
CommissionRatio: '',
GradeName: item.GradeName,
}
arr.push(Obj);
}
});
},
ExitCateList(){
this.NewCategoryList=[];
this.addMsg.CategoryList.forEach(item=>{
item.Name=item.CategoryName;
this.NewCategoryList.push(item.CategoryId)
})
},
handleCheckChange() {
this.addMsg.CategoryList=[];
this.NewCategoryList.forEach(list=>{
this.fenleiData.forEach(item => {
if(list==item.Id){
item.CategoryId=item.Id;
this.addMsg.CategoryList.push(item)
}
item.ChildList.forEach(item2=>{
if(list==item2.Id){
item2.CategoryId=item2.Id;
this.addMsg.CategoryList.push(item2)
}
item2.ChildList.forEach(item3=>{
if(list==item3.Id){
item3.CategoryId=item3.Id;
this.addMsg.CategoryList.push(item3)
}
})
})
})
})
})
})
console.log("this.addMsg.CategoryList",this.addMsg.CategoryList)
},
exitCheck(item, index) {
this.addMsg.CategoryList.forEach((list, k) => {
if (list.Id == item.Id) {
this.addMsg.CategoryList.splice(k, 1);
let list = arr.sort(this.compareGrade("Grade", true));
this.addMsg.RatioList = list;
this.gradeDig = false;
},
compareGrade(property, desc) {
return function (a, b) {
var value1 = a[property];
var value2 = b[property];
if (desc == true) {
// 升序排列
return value1 - value2;
} else {
// 降序排列
return value2 - value1;
}
}
},
handleCheckAllChange(val) {
this.checkedCities = val ? this.cityOptions : [];
this.isIndeterminate = false;
},
handleCheckedCitiesChange(value) {
let checkedCount = value.length;
this.checkAll = checkedCount === this.cities.length;
this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length;
},
Save(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
if (this.addMsg.RatioList.length == 0) {
this.Error("请选择返佣等级!");
return;
}
this.apipost("/api/user/SetHpDistributorInfo", this.addMsg, res => {
if (res.data.resultCode == 1) {
this.CommonJump('PeaceDistribution');
} else {
this.Error(res.data.message);
}
})
this.ExitCateList();
},
getChild3(ChildList) {
this.childList3 = ChildList;
},
getChild2(ChildList) {
this.childList2 = ChildList;
},
getTree() {
let msg1 = {
Id: 0,
Name: '',
Tier: 0,
ParentId: 0,
Enabled: 1,
IsShow: 1,
}
this.apipost("/api/product/GetProductCategoryTreeList", msg1, res => {
if (res.data.resultCode == 1) {
let pageData = res.data.data;
this.fenleiData = pageData;
this.fenleiData.forEach(item => {
item.CategoryName = item.Name;
item.ChildList.forEach(item2=>{
item2.CategoryName = item2.Name;
item2.ChildList.forEach(item3=>{
item3.CategoryName = item3.Name;
})
})
})
} else {
return false;
}
});
},
ExitCateList() {
this.NewCategoryList = [];
this.addMsg.CategoryList.forEach(item => {
item.Name = item.CategoryName;
this.NewCategoryList.push(item.CategoryId)
})
},
handleCheckChange() {
this.addMsg.CategoryList = [];
this.NewCategoryList.forEach(list => {
this.fenleiData.forEach(item => {
if (list == item.Id) {
item.CategoryId = item.Id;
this.addMsg.CategoryList.push(item)
}
})
},
getHpDistributorGrade() {
this.cityOptions = [];
this.apipost("/api/user/GetHpDistributorGradeList", {}, res => {
this.cities = res.data.data;
let data = res.data.data;
data.forEach(item => {
this.cityOptions.push(item.Id)
})
if (this.$route.query.UserId) {
this.GradeId = this.$route.query.UserId;
this.getData()
item.ChildList.forEach(item2 => {
if (list == item2.Id) {
item2.CategoryId = item2.Id;
this.addMsg.CategoryList.push(item2)
}
item2.ChildList.forEach(item3 => {
if (list == item3.Id) {
item3.CategoryId = item3.Id;
this.addMsg.CategoryList.push(item3)
}
})
})
},
getData() {
this.loading = true;
this.apipost("/api/user/GetHpdistributorInfo", {
CommissionId: this.GradeId
}, res => {
this.loading = false;
this.addMsg = res.data.data;
this.NewCategoryList=[];
this.addMsg.CategoryList.forEach(item=>{
item.Name=item.CategoryName;
this.NewCategoryList.push(item.CategoryId)
})
})
},
exitCheck(item, index) {
this.addMsg.CategoryList.forEach((list, k) => {
if (list.Id == item.Id) {
this.addMsg.CategoryList.splice(k, 1);
}
})
this.ExitCateList();
},
getChild3(ChildList) {
this.childList3 = ChildList;
},
getChild2(ChildList) {
this.childList2 = ChildList;
},
getTree() {
let msg1 = {
Id: 0,
Name: '',
Tier: 0,
ParentId: 0,
Enabled: 1,
IsShow: 1,
}
this.apipost("/api/product/GetProductCategoryTreeList", msg1, res => {
if (res.data.resultCode == 1) {
let pageData = res.data.data;
this.fenleiData = pageData;
this.fenleiData.forEach(item => {
item.CategoryName = item.Name;
item.ChildList.forEach(item2 => {
item2.CategoryName = item2.Name;
item2.ChildList.forEach(item3 => {
item3.CategoryName = item3.Name;
})
this.checkedCities=[];
this.addMsg.RatioList.forEach(item=>{
this.cities.forEach(list=>{
if(item.GradeId==list.Id){
this.checkedCities.push(list.Id);
}
})
})
//
})
})
},
}
})
},
getHpDistributorGrade() {
this.cityOptions = [];
this.apipost("/api/user/GetHpDistributorGradeList", {}, res => {
this.cities = res.data.data;
let data = res.data.data;
data.forEach(item => {
this.cityOptions.push(item.Id)
})
if (this.$route.query.UserId) {
this.GradeId = this.$route.query.UserId;
this.getData()
}
})
},
getData() {
this.loading = true;
this.apipost("/api/user/GetHpdistributorInfo", {
CommissionId: this.GradeId
}, res => {
this.loading = false;
this.addMsg = res.data.data;
this.NewCategoryList = [];
this.addMsg.CategoryList.forEach(item => {
item.Name = item.CategoryName;
this.NewCategoryList.push(item.CategoryId)
})
this.checkedCities = [];
this.addMsg.RatioList.forEach(item => {
this.cities.forEach(list => {
if (item.GradeId == list.Id) {
this.checkedCities.push(list.Id);
}
})
})
})
},
},
mounted() {
}
};
</script>
<style>
.app-add-cat .el-checkbox-group {
.app-add-cat .el-checkbox-group {
font-size: 14px !important;
}
......@@ -435,6 +422,7 @@
overflow: scroll;
height: 400px;
}
.usersListEdit .tip {
margin-left: 10px;
display: inline-block;
......
......@@ -57,13 +57,15 @@
margin-bottom: 10px;
position: relative;
}
.diy-rubik .layout .rubik .delete {
position: absolute;
right: -16px;
top: -16px;
padding: 8px;
z-index: 14;
position: absolute;
right: -16px;
top: -16px;
padding: 8px;
z-index: 14;
}
</style>
<template>
<div :class="{'active':rubData.isCked}">
......@@ -89,13 +91,12 @@
icon="el-icon-close" circle @click.stop="deleteRubik(index)"></el-button>
</template>
<span v-if="!rubData.data.list[index].pic_url">{{rubikSize(index)}}</span>
<img v-else :src="getIconLink(rubData.data.list[index].pic_url)"
style="width: 100%;visibility: hidden;">
<img v-else :src="getIconLink(rubData.data.list[index].pic_url)" style="width: 100%;visibility: hidden;">
</div>
<div class="rubik" :style="emptyStyle(index)" v-if="rubData.data.style == 8" :key="index"></div>
<img v-if="rubData.data.list[index].pic_url && rubData.data.style == 0"
:src="getIconLink(rubData.data.list[index].pic_url)"
:key="index" style="width: 100%;visibility: hidden;display: block">
:src="getIconLink(rubData.data.list[index].pic_url)" :key="index"
style="width: 100%;visibility: hidden;display: block">
</template>
</div>
</div>
......@@ -131,7 +132,7 @@
</el-input>
</el-form-item>
</template>
<template v-if="!rubData.data.list[rubik]">
<template v-if="rubData.data.list&&!rubData.data.list[rubik]">
<el-form-item label="图片上传">
<span>请先在左边选择图片位置</span>
</el-form-item>
......@@ -140,17 +141,17 @@
<el-card shadow="never">
<el-form-item label="图片上传">
<el-button size="mini" @click="choicImg=true">选择图片</el-button>
<div flex style="flex-wrap: wrap;" v-if="rubData.data.list[rubik].pic_url">
<div flex style="flex-wrap: wrap;" v-if="rubData.data.list&&rubData.data.list[rubik].pic_url">
<div flex="main:center cross:center" class="app-gallery-item"
style="height: 100px; width: 100px;">
<img
:src="getIconLink(rubData.data.list[rubik].pic_url)"
style="width:100%;height:100%;">
<img :src="getIconLink(rubData.data.list[rubik].pic_url)" style="width:100%;height:100%;">
</div>
</div>
</el-form-item>
<el-form-item label="选择链接">
<el-input size="small" v-model="rubData.data.list[rubik].link.name" :disabled="true">
<el-input size="small" v-if="rubData.data.list&&rubData.data.list.length>0
&& rubData.data.list[rubik].link && rubData.data.list[rubik].link.length>0" v-model="
rubData.data.list[rubik].link[0].PageName" :disabled="true">
<template slot="append">
<el-button @click="isShowLink=true">选择链接</el-button>
</template>
......@@ -210,7 +211,7 @@
x: 0,
y: 0,
}, ],
icon: this.domainManager().ImageUrl+'/Static/rubik-0.png',
icon: this.domainManager().ImageUrl + '/Static/rubik-0.png',
},
{
name: '2张图',
......@@ -230,7 +231,7 @@
y: 0,
},
],
icon: this.domainManager().ImageUrl+'/Static/rubik-1.png',
icon: this.domainManager().ImageUrl + '/Static/rubik-1.png',
},
{
name: '3张图',
......@@ -256,7 +257,7 @@
y: 6,
},
],
icon: this.domainManager().ImageUrl+'/Static/rubik-2.png',
icon: this.domainManager().ImageUrl + '/Static/rubik-2.png',
},
{
name: '4张图',
......@@ -288,7 +289,7 @@
y: 12,
},
],
icon: this.domainManager().ImageUrl+'/Static/rubik-3.png',
icon: this.domainManager().ImageUrl + '/Static/rubik-3.png',
},
{
name: '2张图平分',
......@@ -308,7 +309,7 @@
y: 0,
},
],
icon: this.domainManager().ImageUrl+'/Static/rubik-4.png',
icon: this.domainManager().ImageUrl + '/Static/rubik-4.png',
},
{
name: '3张图平分',
......@@ -334,7 +335,7 @@
y: 0,
},
],
icon: this.domainManager().ImageUrl+'/Static/rubik-5.png',
icon: this.domainManager().ImageUrl + '/Static/rubik-5.png',
},
{
name: '4张图左右平分',
......@@ -366,7 +367,7 @@
y: 0,
},
],
icon: this.domainManager().ImageUrl+'/Static/rubik-6.png',
icon: this.domainManager().ImageUrl + '/Static/rubik-6.png',
},
{
name: '4张图上下平分',
......@@ -398,7 +399,7 @@
y: 62,
},
],
icon: this.domainManager().ImageUrl+'/Static/rubik-7.png',
icon: this.domainManager().ImageUrl + '/Static/rubik-7.png',
},
{
name: '自定义魔方',
......@@ -437,7 +438,7 @@
y: 93,
},
],
icon: this.domainManager().ImageUrl+'/Static/rubik-8.png',
icon: this.domainManager().ImageUrl + '/Static/rubik-8.png',
},
]
};
......@@ -467,7 +468,9 @@
} else {
if (index === 0) {
this.rubData.data.height = 'auto';
return `height: ${this.rubData.data.list[0].pic_url ? 'auto' : '360px'}`;
if (this.rubData.data.list && this.rubData.data.list.length > 0) {
return `height: ${this.rubData.data.list[0].pic_url ? 'auto' : '360px'}`;
}
}
return `height: ${this.style_list[index] ? this.style_list[index].height : 360}px`;
}
......@@ -525,7 +528,12 @@
}
let style = JSON.parse(JSON.stringify(this.style_list[index]));
for (let i in style.list) {
style.list[i].link = {};
style.list[i].link = [{
PageUrl: '',
IsParameter: 0,
ParameterValue: '',
PageName: ''
}];
}
this.rubData.data.height = style.height;
this.rubData.data.w = style.w;
......@@ -706,7 +714,10 @@
if (this.rubData.data.list.length <= 0) {
return '';
}
this.rubData.data.list[this.rubik].link.name = obj.PageName;
this.rubData.data.list[this.rubik].link[0].PageUrl = obj.PageUrl;
this.rubData.data.list[this.rubik].link[0].IsParameter = obj.IsParameter;
this.rubData.data.list[this.rubik].link[0].ParameterValue = obj.ParameterValue;
this.rubData.data.list[this.rubik].link[0].PageName = obj.PageName;
this.isShowLink = false;
},
......
......@@ -137,7 +137,7 @@
border: none;
border-radius: 0;
position: absolute;
margin-left: 0!important;
margin-left: 0 !important;
}
.diy-search>div {
......@@ -159,17 +159,20 @@
justify-content: center;
background: #fff;
}
.bgMsg_Div div{
.bgMsg_Div div {
height: 50px;
width: 50px;
margin-bottom: 10px;
cursor: pointer;
background-color: #F5F7F9;
}
.bgMsg_Div .active{
.bgMsg_Div .active {
background-color: #E6F4FF;
border: 2px dashed #5CB3FD;
}
</style>
<template>
<div class="templateEdit">
......@@ -203,7 +206,7 @@
<div class="mobile-framework" style="height:705px;">
<div class="mobile-framework-header"></div>
<div class="mobile-framework-body"
:style="'background-color:'+ bgMsg.data.backgroundColor+';background-image:url('+getIconLink(bgMsg.data.backgroundPicUrl)+');background-size:'+bgMsg.data.backgroundWidth+'% '+bgMsg.data.backgroundHeight+'%;background-repeat:'+repeat+';background-position:'+position">
:style="'background-color:'+ bgMsg.data.backgroundColor+';background-image:url('+getIconLink(bgMsg.data.backgroundPicUrl)+');background-size:'+bgMsg.data.backgroundWidth+'% '+bgMsg.data.backgroundHeight+'%;background-repeat:'+repeat+';background-position:'+position">
<!-- 为空的样式开始 -->
<div v-if="dataList.length==0" flex="main:center cross:center"
style="height: 200px; color: rgb(173, 177, 184); text-align: center;">
......@@ -288,54 +291,57 @@
</div>
<!-- 背景设置 -->
<el-dialog title="背景设置" :visible.sync="bgVisible" width="950px">
<el-form label-width="100px">
<el-form-item label="背景颜色">
<div flex="dir:left cross:center">
<el-color-picker size="small" v-model="bgMsg.data.backgroundColor"></el-color-picker>
<el-input size="small" style="width: 80px;margin-right: 25px;" v-model="bgMsg.data.backgroundColor"></el-input>
</div>
</el-form-item>
<el-form-item label="背景图片">
<el-switch v-model="bgMsg.data.showImg" @change="showBackground"></el-switch>
<slot name="about"></slot>
</el-form-item>
<el-form-item v-if="bgMsg.data.showImg" label="上传背景">
<div class="zk_pic_box" @click="choicImg=true" flex="main:center cross:center"
:style="{backgroundImage:'url(' + getIconLink(bgMsg.data.backgroundPicUrl) + ')'}">
<i v-if="bgMsg.data.backgroundPicUrl==''" class="el-icon-picture-outline"></i>
<el-button type="danger" v-if="bgMsg.data.backgroundPicUrl!=''" class="image-delete" size="mini"
icon="el-icon-close" @click.stop="bgMsg.data.backgroundPicUrl=''" circle></el-button>
</div>
</el-form-item>
<el-form-item v-if="bgMsg.data.showImg" label="图片位置">
<div class="bgMsg_Div" flex="main:justify wrap:wrap" style="width:170px;height:180px;">
<div @click="choose(1,'top left')" :class="bgMsg.data.position==1?'active':''"></div>
<div @click="choose(2,'top center')" :class="bgMsg.data.position==2?'active':''"></div>
<div @click="choose(3,'top right')" :class="bgMsg.data.position==3?'active':''"></div>
<div @click="choose(4,'center left')" :class="bgMsg.data.position==4?'active':''"></div>
<div @click="choose(5,'center center')" :class="bgMsg.data.position==5?'active':''"></div>
<div @click="choose(6,'center right')" :class="bgMsg.data.position==6?'active':''"></div>
<div @click="choose(7,'bottom left')" :class="bgMsg.data.position==7?'active':''"></div>
<div @click="choose(8,'bottom center')" :class="bgMsg.data.position==8?'active':''"></div>
<div @click="choose(9,'bottom right')" :class="bgMsg.data.position==9?'active':''"></div>
</div>
</el-form-item>
<el-form-item v-if="bgMsg.data.showImg" label="填充方式">
<el-radio-group v-model="bgMsg.data.mode" @change="changeMode">
<el-radio :label="1">充满</el-radio>
<el-radio :label="2">左右平铺</el-radio>
<el-radio :label="3">上下平铺</el-radio>
<el-radio :label="4">平铺满</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="bgMsg.data.showImg && bgMsg.data.mode != 1" label="背景图宽">
<el-slider v-model="bgMsg.data.backgroundWidth" :show-input-controls="false" style="float: left;width: 95%" :max="100" show-input></el-slider>
<div style="float: right">%</div>
</el-form-item>
<el-form-item v-if="bgMsg.data.showImg && bgMsg.data.mode != 1" label="背景图高">
<el-slider v-model="bgMsg.data.backgroundHeight" :show-input-controls="false" style="float: left;width: 95%" :max="100" show-input></el-slider>
<div style="float: right">%</div>
</el-form-item>
<el-form label-width="100px">
<el-form-item label="背景颜色">
<div flex="dir:left cross:center">
<el-color-picker size="small" v-model="bgMsg.data.backgroundColor"></el-color-picker>
<el-input size="small" style="width: 80px;margin-right: 25px;" v-model="bgMsg.data.backgroundColor">
</el-input>
</div>
</el-form-item>
<el-form-item label="背景图片">
<el-switch v-model="bgMsg.data.showImg" @change="showBackground"></el-switch>
<slot name="about"></slot>
</el-form-item>
<el-form-item v-if="bgMsg.data.showImg" label="上传背景">
<div class="zk_pic_box" @click="choicImg=true" flex="main:center cross:center"
:style="{backgroundImage:'url(' + getIconLink(bgMsg.data.backgroundPicUrl) + ')'}">
<i v-if="bgMsg.data.backgroundPicUrl==''" class="el-icon-picture-outline"></i>
<el-button type="danger" v-if="bgMsg.data.backgroundPicUrl!=''" class="image-delete" size="mini"
icon="el-icon-close" @click.stop="bgMsg.data.backgroundPicUrl=''" circle></el-button>
</div>
</el-form-item>
<el-form-item v-if="bgMsg.data.showImg" label="图片位置">
<div class="bgMsg_Div" flex="main:justify wrap:wrap" style="width:170px;height:180px;">
<div @click="choose(1,'top left')" :class="bgMsg.data.position==1?'active':''"></div>
<div @click="choose(2,'top center')" :class="bgMsg.data.position==2?'active':''"></div>
<div @click="choose(3,'top right')" :class="bgMsg.data.position==3?'active':''"></div>
<div @click="choose(4,'center left')" :class="bgMsg.data.position==4?'active':''"></div>
<div @click="choose(5,'center center')" :class="bgMsg.data.position==5?'active':''"></div>
<div @click="choose(6,'center right')" :class="bgMsg.data.position==6?'active':''"></div>
<div @click="choose(7,'bottom left')" :class="bgMsg.data.position==7?'active':''"></div>
<div @click="choose(8,'bottom center')" :class="bgMsg.data.position==8?'active':''"></div>
<div @click="choose(9,'bottom right')" :class="bgMsg.data.position==9?'active':''"></div>
</div>
</el-form-item>
<el-form-item v-if="bgMsg.data.showImg" label="填充方式">
<el-radio-group v-model="bgMsg.data.mode" @change="changeMode">
<el-radio :label="1">充满</el-radio>
<el-radio :label="2">左右平铺</el-radio>
<el-radio :label="3">上下平铺</el-radio>
<el-radio :label="4">平铺满</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="bgMsg.data.showImg && bgMsg.data.mode != 1" label="背景图宽">
<el-slider v-model="bgMsg.data.backgroundWidth" :show-input-controls="false" style="float: left;width: 95%"
:max="100" show-input></el-slider>
<div style="float: right">%</div>
</el-form-item>
<el-form-item v-if="bgMsg.data.showImg && bgMsg.data.mode != 1" label="背景图高">
<el-slider v-model="bgMsg.data.backgroundHeight" :show-input-controls="false" style="float: left;width: 95%"
:max="100" show-input></el-slider>
<div style="float: right">%</div>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="bgVisible = false">取 消</el-button>
......@@ -407,7 +413,7 @@
repeat: 'no-repeat',
choicImg: false,
//左侧组件列表
bgVisible:false,
bgVisible: false,
allComponents: [],
dataList: [],
};
......@@ -455,44 +461,44 @@
this.bgMsg.data.backgroundPicUrl = msg.url;
this.choicImg = false;
},
choose(num,position) {
this.bgMsg.data.position = num;
this.position = position;
choose(num, position) {
this.bgMsg.data.position = num;
this.position = position;
},
//点击设置背景
SetBgInfo(){
SetBgInfo() {
this.dataList.push(this.bgMsg);
this.bgVisible=false;
this.bgVisible = false;
},
showBackground(e) {
if(!e) {
this.bgMsg.data.backgroundPicUrl += '临时放置'
}else {
this.bgMsg.data.backgroundPicUrl = this.bgMsg.data.backgroundPicUrl.replace('临时放置','')
}
if(this.bgMsg.data.mode == 2) {
this.repeat = 'repeat-x'
}else if(this.bgMsg.data.mode == 3) {
this.repeat = 'repeat-y'
}else if(this.bgMsg.data.mode == 4) {
this.repeat = 'repeat'
}else if(this.bgMsg.data.mode == 1) {
this.repeat = 'no-repeat';
this.bgMsg.data.backgroundHeight = 100;
this.bgMsg.data.backgroundWidth = 100;
}
if (!e) {
this.bgMsg.data.backgroundPicUrl += '临时放置'
} else {
this.bgMsg.data.backgroundPicUrl = this.bgMsg.data.backgroundPicUrl.replace('临时放置', '')
}
if (this.bgMsg.data.mode == 2) {
this.repeat = 'repeat-x'
} else if (this.bgMsg.data.mode == 3) {
this.repeat = 'repeat-y'
} else if (this.bgMsg.data.mode == 4) {
this.repeat = 'repeat'
} else if (this.bgMsg.data.mode == 1) {
this.repeat = 'no-repeat';
this.bgMsg.data.backgroundHeight = 100;
this.bgMsg.data.backgroundWidth = 100;
}
},
changeMode(e){
if(e == 2) {
this.repeat = 'repeat-x'
}else if(e == 3) {
this.repeat = 'repeat-y'
}else if(e == 4) {
this.repeat = 'repeat'
}else if(e == 1) {
this.repeat = 'no-repeat';
this.bgMsg.data.backgroundHeight = 100;
this.bgMsg.data.backgroundWidth = 100;
changeMode(e) {
if (e == 2) {
this.repeat = 'repeat-x'
} else if (e == 3) {
this.repeat = 'repeat-y'
} else if (e == 4) {
this.repeat = 'repeat'
} else if (e == 1) {
this.repeat = 'no-repeat';
this.bgMsg.data.backgroundHeight = 100;
this.bgMsg.data.backgroundWidth = 100;
}
},
//获取左侧菜单
......@@ -569,10 +575,10 @@
data: {
name: '公告', //公告名称
content: '', //公告内容
icon: this.domainManager().ImageUrl+'/Static/icon-notice.png', //公告图标
icon: this.domainManager().ImageUrl + '/Static/icon-notice.png', //公告图标
textColor: '#ffffff', //文字颜色
background: '#f67f79', //背景颜色
headerUrl: this.domainManager().ImageUrl+'/Static/icon-notice-title.png', //头部图片
headerUrl: this.domainManager().ImageUrl + '/Static/icon-notice-title.png', //头部图片
btnColor: '#ff4544', //按钮颜色
btnWidth: 500, //按钮宽度
btnHeight: 80, //按钮高度
......@@ -589,13 +595,13 @@
Id: 'topic',
isCked: false,
data: {
style: 'normal',//专题样式
count: 1,//显示行数
logo_1: this.domainManager().ImageUrl+'/Static/icon-topic-1.png',//logo(1行)
logo_2: this.domainManager().ImageUrl+'/Static/icon-topic-2.png',//logo(2行)
icon: this.domainManager().ImageUrl+'/Static/icon-topic-r.png',//专题标签
style: 'normal', //专题样式
count: 1, //显示行数
logo_1: this.domainManager().ImageUrl + '/Static/icon-topic-1.png', //logo(1行)
logo_2: this.domainManager().ImageUrl + '/Static/icon-topic-2.png', //logo(2行)
icon: this.domainManager().ImageUrl + '/Static/icon-topic-r.png', //专题标签
list: [],
cat_show: false,//是否显示分类
cat_show: false, //是否显示分类
topic_list: []
}
}
......@@ -696,8 +702,8 @@
Id: 'store',
isCked: false,
data: {
navPicUrl: this.domainManager().ImageUrl+'/Static/nav-icon.png', //导航图标
scorePicUrl: this.domainManager().ImageUrl+'/Static/score-icon.png', //评分图标
navPicUrl: this.domainManager().ImageUrl + '/Static/nav-icon.png', //导航图标
scorePicUrl: this.domainManager().ImageUrl + '/Static/score-icon.png', //评分图标
showName: true, //显示门店名称
showScore: true, //显示评分
showTel: true, //显示电话
......@@ -726,7 +732,7 @@
Id: 'check-in',
isCked: false,
data: {
backgroundPicUrl: this.domainManager().ImageUrl+'/Static/check-in-default-bg.png', //背景图
backgroundPicUrl: this.domainManager().ImageUrl + '/Static/check-in-default-bg.png', //背景图
showText: true, //显示文字
textPosition: 'left', //文字位置
textColor: '#ffffff', //文本颜色
......@@ -757,31 +763,31 @@
navs: [{
url: '',
openType: 'navigate',
picUrl: this.domainManager().ImageUrl+'/Static/user-order-dfk.png',
picUrl: this.domainManager().ImageUrl + '/Static/user-order-dfk.png',
text: '待付款',
},
{
url: '',
openType: 'navigate',
picUrl: this.domainManager().ImageUrl+'/Static/user-order-dfh.png',
picUrl: this.domainManager().ImageUrl + '/Static/user-order-dfh.png',
text: '待发货',
},
{
url: '',
openType: 'navigate',
picUrl: this.domainManager().ImageUrl+'/Static/user-order-dsh.png',
picUrl: this.domainManager().ImageUrl + '/Static/user-order-dsh.png',
text: '待收货',
},
{
url: '',
openType: 'navigate',
picUrl: this.domainManager().ImageUrl+'/Static/user-order-ywc.png',
picUrl: this.domainManager().ImageUrl + '/Static/user-order-ywc.png',
text: '待评价',
},
{
url: '',
openType: 'navigate',
picUrl: this.domainManager().ImageUrl+'/Static/user-order-sh.png',
picUrl: this.domainManager().ImageUrl + '/Static/user-order-sh.png',
text: '售后',
},
],
......@@ -839,8 +845,8 @@
isCked: false,
data: {
textColor: '#ffffff', //字体颜色
receiveBg: this.domainManager().ImageUrl+'/Static/icon-coupon-no.png', //不可领取
unclaimedBg: this.domainManager().ImageUrl+'/Static/icon-coupon-index.png', //可领取
receiveBg: this.domainManager().ImageUrl + '/Static/icon-coupon-no.png', //不可领取
unclaimedBg: this.domainManager().ImageUrl + '/Static/icon-coupon-index.png', //可领取
showImg: false,
backgroundColor: '#fff', //背景颜色
backgroundPicUrl: '',
......@@ -971,7 +977,7 @@
showCoupon: true,
showGoods: true,
couponColor: '#ffffff',
couponPicUrl: this.domainManager().ImageUrl+'/Static/coupon-background.png',
couponPicUrl: this.domainManager().ImageUrl + '/Static/coupon-background.png',
buttonColor: '#ff4544',
list: [],
listStyle: 1,
......@@ -1065,8 +1071,8 @@
background: '#FFFFFF', //背景色
usePluginConfig: true, //使用插件配置
top_bottom_padding: 0, //上下间距
buy_bg: this.domainManager().ImageUrl+'/Static/buy_bg.png', //未购买用户默认背景图
renew_bg: this.domainManager().ImageUrl+'/Static/buy_bg.png', //未购买用户背景图
buy_bg: this.domainManager().ImageUrl + '/Static/buy_bg.png', //未购买用户默认背景图
renew_bg: this.domainManager().ImageUrl + '/Static/buy_bg.png', //未购买用户背景图
buy_big_color: '', //未购买用户-大标题字体颜色
buy_small_color: '', //未购买用户-小标题背景颜色
buy_btn_color: '', //未购买用户-按钮文字颜色
......@@ -1231,7 +1237,22 @@
getItem(item) {
this.dataList.forEach(x => {
x.isCked = false;
})
if (item.Id == "rubik") {
if (item.data.list && item.data.list.length > 0) {
item.data.list.forEach(subItem => {
if (subItem.link && subItem.link.length == 0) {
subItem.link.push({
PageUrl: '',
IsParameter: 0,
ParameterValue: '',
PageName: ''
})
}
})
}
}
item.isCked = true;
},
//点击保存
......@@ -1263,10 +1284,10 @@
if (jsonData.ComponentDataList) {
this.dataList = jsonData.ComponentDataList;
}
if(jsonData.ComponentDataList){
jsonData.ComponentDataList.forEach(x=>{
if(x.Id=='background'){
this.bgMsg=x;
if (jsonData.ComponentDataList) {
jsonData.ComponentDataList.forEach(x => {
if (x.Id == 'background') {
this.bgMsg = x;
}
})
}
......
......@@ -50,6 +50,9 @@
</template>
</el-table-column>
</el-table>
<el-pagination style="text-align:right" background @current-change="handleCurrentChange" :page-size="qMsg.pageSize"
layout="prev, pager, next" :total="total">
</el-pagination>
</div>
</div>
</template>
......@@ -60,7 +63,7 @@
dataList: [],
qMsg: {
pageIndex: 1,
pageSize: 20,
pageSize: 15,
},
total: 0
};
......@@ -69,6 +72,10 @@
},
methods: {
handleCurrentChange(val) {
this.qMsg.pageIndex = val;
this.getList();
},
getList() {
this.apipost("/api/Template/GetMiniTemplatePageList", this.qMsg, res => {
if (res.data.resultCode == 1) {
......@@ -106,4 +113,5 @@
this.getList();
}
};
</script>
\ No newline at end of file
</script>
<template>
<div class="templateMarket">
<template>
<div class="head-title">
模板市场
<div class="template_comheader">
<div>
<span>模板市场</span>
<el-button type="primary" size="small" @click="CommonJump('templateMarketManage',{})">模板市场管理</el-button>
</div>
<div class="content">
<div style="padding:0 20px;margin-bottom:20px;">
<el-select size="small" style="width:150px;">
<el-option label="全部模板" :value="1"> </el-option>
<el-option label="已拥有模板" :value="2"> </el-option>
<el-option label="未拥有模板" :value="3"> </el-option>
</el-select>
</div>
<div class="template_MarketList">
<div class="Market_List" v-for="(item,index) in dataList" :key="index">
<div class="MarketInner">
<div flex="dir:top cross:center main:center" class="dialog-img">
<div class="choose-btn market_useBtn">加载模板</div>
<div class="choose-btn" @click="getImgSrc(item)">预览模板</div>
</div>
<div class="show-img" :style="{backgroundImage:'url('+item.pics[0]+')'}">
</div>
<div class="Market_Info">
<div flex="dir:top main:center">
<div flex="main:justify">
<div class="item-name">{{item.name}}</div>
</div>
<div>
<div flex="cross:center main:justify">
<div class="price">
{{item.price}}
</div>
<button type="button" class="el-button el-button--primary el-button--mini">
<span>加载</span>
</button>
</div>
<div class="content">
<div class="template_MarketList">
<div class="Market_List" v-for="(item,index) in dataList" :key="index">
<div class="MarketInner">
<div flex="dir:top cross:center main:center" class="dialog-img">
<div class="choose-btn market_useBtn" @click="LoadTemplate(item)">加载模板</div>
<div class="choose-btn" @click="getImgSrc(item)">预览模板</div>
</div>
<div class="show-img" :style="{backgroundImage:'url('+item.Pics+')'}">
</div>
<div class="Market_Info">
<div flex="dir:top main:center">
<div flex="main:justify">
<div class="item-name">{{item.Name}}</div>
</div>
<div>
<div flex="cross:center main:justify">
<div class="price">
{{item.Price}}
</div>
<button type="button" class="el-button el-button--primary el-button--mini">
<span @click="LoadTemplate(item)">加载</span>
</button>
</div>
</div>
</div>
......@@ -42,8 +36,7 @@
</div>
</div>
</div>
</template>
</div>
<el-dialog title="手机端预览" :visible.sync="viewDialog" width="600px">
<div class="MarketView" ref="MarketView">
<img :src="imgUrl" alt="" style="width: 375px;">
......@@ -53,7 +46,6 @@
<el-button type="primary" @click="viewDialog = false" size="small">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
......@@ -63,582 +55,14 @@
//预览弹窗
viewDialog: false,
imgUrl: '',
dataList: [{
"id": 40,
"name": "618年中盛典-2",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/35120f94cf467eb8874aa67afe0b12c4.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.1",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "618年中盛典-2",
"cloud_price": "0.00"
},
{
"id": 39,
"name": "618年中盛典",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/3dec44461189a8c99b157e426ec98aa4.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.1",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "618年中盛典",
"cloud_price": "0.00"
},
{
"id": 38,
"name": "51劳动节-2",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/a65509e5cee18c6dda134cde50009892.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.1",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "51劳动节-2",
"cloud_price": "0.00"
},
{
"id": 37,
"name": "51劳动节",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/fdce3d73af8165e0f5652187213950e3.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.1",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "51劳动节",
"cloud_price": "0.00"
},
{
"id": 36,
"name": "妇女节2",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/df3307934c25cfbf1ae2c1046037d8bc.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.1",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "妇女节2",
"cloud_price": "0.00"
},
{
"id": 35,
"name": "妇女节",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/be4f913235be3ca1b7a4b4d34bb45216.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.1",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "妇女节",
"cloud_price": "0.00"
},
{
"id": 34,
"name": "情人节模板2",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/a0dadedd1a511bfa59fa63497a8c974d.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.1",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "情人节模板2",
"cloud_price": "0.00"
},
{
"id": 33,
"name": "春节模板2",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/2022fc32d157bbdacae989174c75d583.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.1",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "春节模板2",
"cloud_price": "0.00"
},
{
"id": 31,
"name": "元宵节模板2",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/5f8c2f51b4a9160decb00bed2277952f.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.1",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "元宵节模板2",
"cloud_price": "0.00"
},
{
"id": 30,
"name": "情人节模板",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/615112ec2dc3e3b0b8aaa9b0b93bd4f0.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.1",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "情人节模板",
"cloud_price": "0.00"
},
{
"id": 29,
"name": "元宵节模板",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/a5c397ade39f0e76c784d46078f0ea20.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.1",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "元宵节模板",
"cloud_price": "0.00"
},
{
"id": 28,
"name": "春节模板",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/2be7b8bd21b5b89c1008bcbfbd6fc876.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.1",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "春节模板",
"cloud_price": "0.00"
},
{
"id": 19,
"name": "超市3",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/63f989c9f7b9663e6ab9de13c03056b6.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.1",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "超市3",
"cloud_price": "0.00"
},
{
"id": 18,
"name": "超市2",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/81ecb3a4ec8e8248da0e7f7a027bafd2.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.1",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "超市2",
"cloud_price": "0.00"
},
{
"id": 17,
"name": "超市1",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/3bddad82d6c63870596334e318777fa5.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.1",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "超市1",
"cloud_price": "0.00"
},
{
"id": 16,
"name": "美妆2",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/dc9370e6666b5cb588d81c1b22c72151.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.1",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "美妆2",
"cloud_price": "0.00"
},
{
"id": 15,
"name": "美妆1",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/9d24aec77b45951b50343f3bc9708cd9.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.1",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "美妆1",
"cloud_price": "0.00"
},
{
"id": 14,
"name": "生鲜2",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/7b516ba8fce669badea52aa2452dc3db.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.2",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "生鲜2",
"cloud_price": "0.00"
},
{
"id": 13,
"name": "生鲜1",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/3d6b77eb7d512537c8e03e86c1e052f5.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.1",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "生鲜1",
"cloud_price": "0.00"
},
{
"id": 10,
"name": "服饰3",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/2e86a1ad42ac8ea8b5f9c8e1131e2cc2.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.1",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "服饰3",
"cloud_price": "0.00"
},
{
"id": 9,
"name": "服饰2",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/7e96634708ed70371f9fbcd3dcba0bb4.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.1",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "服饰2",
"cloud_price": "0.00"
},
{
"id": 8,
"name": "服饰1",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/42d68cee10e3fa8af2c23ab81241e14e.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.1",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "服饰1",
"cloud_price": "0.00"
},
{
"id": 7,
"name": "双十二",
"pics": [
"http://auth-zjhejiang-com.oss-cn-hangzhou.aliyuncs.com/uploads/versions/d66b72d485ceed26d358e8f142dec60f.png"
],
"price": "0.00",
"user_id": 8,
"type": "diy",
"version": "0.0.1",
"is_buy": 0,
"user": {
"id": 8,
"name": "程基恩"
},
"order": "",
"is_use": true,
"is_show": 0,
"use": true,
"template": {
"data": true
},
"cloud_name": "双十二",
"cloud_price": "0.00"
}
],
dataList: [],
qMsg: {
pageIndex: 1,
pageSize: 15,
IsUse: 1,
IsShow: 1,
},
total: 0,
};
},
components: {
......@@ -650,15 +74,48 @@
methods: {
getImgSrc(item) {
this.viewDialog = true;
this.imgUrl = item.pics[0];
this.imgUrl = item.Pics;
},
//关闭
closeDialog() {
this.viewDialog = false;
this.$refs.MarketView.scrollTop = 0;
},
handleCurrentChange(val) {
this.qMsg.pageIndex = val;
this.getList();
},
getList() {
this.apipost("/api/Template/GetTemplateMarketPageListModule", this.qMsg, res => {
if (res.data.resultCode == 1) {
this.dataList = res.data.data.pageData;
this.total = res.data.data.count;
} else {
this.Info(res.data.message);
}
})
},
//加载模板
LoadTemplate(item) {
var that = this;
that.apipost("/api/Template/LoadTemplateMarket", {
Id: item.Id
}, res => {
if (res.data.resultCode == 1) {
that.Confirm("是否前往编辑新模板?", function () {
that.CommonJump('templateEdit', {
Id: res.data.data.Id
});
});
} else {
that.Info(res.data.message);
}
})
}
},
mounted() {}
mounted() {
this.getList();
}
};
</script>
......@@ -670,6 +127,13 @@
box-sizing: border-box;
}
.templateMarket .template_comheader>div {
display: flex;
justify-content: space-between;
align-items: center;
flex-direction: row;
}
.templateMarket .template_MarketList {
display: flex;
flex-direction: row;
......
<style>
.templateMarketManage .template_comheader {
padding: 13px 20px;
border-bottom: 1px solid #EBEEF5;
-webkit-box-sizing: border-box;
box-sizing: border-box;
background: #fff;
}
.templateMarketManage .template_comheader>div {
display: flex;
justify-content: space-between;
align-items: center;
flex-direction: row;
}
.templateMarketManage .temp_content {
margin-top: 10px;
background: #fff;
padding: 20px;
}
.templateMarketManage .temp_imgStyle {
display: inline-block;
margin-right: 10px;
}
</style>
<template>
<div class="templateMarketManage">
<div class="template_comheader">
<div>
<span>模板市场管理</span>
<el-button type="primary" size="small" @click="CommonJump('templateMarket',{})">模板市场</el-button>
<el-button type="primary" size="small" @click="isShow=true,clearMsg()">新增</el-button>
</div>
</div>
<div class="temp_content">
<el-table :data="dataList" border style="width: 100%">
<el-table-column prop="Id" label="编号" width="100"></el-table-column>
<el-table-column prop="Name" label="模板名称"></el-table-column>
<el-table-column label="封面图" width="200">
<template slot-scope="scope">
<img :src="scope.row.Pics" style="width:180px;height:150px;">
</template>
</el-table-column>
<el-table-column label="启用/禁用" width="100">
<template slot-scope="scope">
<el-switch v-model="scope.row.IsUse" active-color="#409EFF" :active-value="1" :inactive-value="0"
@change="updateIsUse(scope.row)">
</el-switch>
</template>
</el-table-column>
<el-table-column label="显示/隐藏" width="100">
<template slot-scope="scope">
<el-switch v-model="scope.row.IsShow" active-color="#409EFF" :active-value="1" :inactive-value="0"
@change="updateIsShow(scope.row)">
</el-switch>
</template>
</el-table-column>
<el-table-column prop="SortNum" label="排序" width="180"></el-table-column>
<el-table-column prop="CreateByName" label="操作人" width="150"></el-table-column>
<el-table-column prop="CreateDateStr" label="创建时间" width="180"></el-table-column>
<el-table-column label="操作" width="180">
<template slot-scope="scope">
<el-tooltip class="item" effect="dark" content="编辑" placement="top">
<img src="../../assets/img/setup/edit.png" alt="" class="temp_imgStyle" @click="EditeMarket(scope.row)">
</el-tooltip>
<el-tooltip class="item" effect="dark" content="删除" placement="top">
<img src="../../assets/img/setup/del.png" alt="" class="temp_imgStyle" @click="DeleteMarket(scope.row)">
</el-tooltip>
</template>
</el-table-column>
</el-table>
<el-pagination style="text-align:right" background @current-change="handleCurrentChange"
:page-size="qMsg.pageSize" layout="prev, pager, next" :total="total">
</el-pagination>
</div>
<!-- 新增修改模板市场 -->
<el-dialog title="模板市场" :visible.sync="isShow" width="700px">
<div class="content">
<el-form label-width="120px" style="padding:0 20px;">
<el-form-item label="模板名称">
<el-input v-model="PostMsg.Name" class="w400" size="small" maxlength="20" placeholder="请输入模板名称" />
</el-form-item>
<el-form-item label="封面图">
<el-input type="text" v-model="PostMsg.Pics" size="small" class="w400" placeholder="请输入选择封面图" />
</el-form-item>
<el-form-item label="价格">
<el-input type="text" v-model="PostMsg.Price" size="small" class="w400"
@keyup.native="checkPrice(PostMsg,'Price')" placeholder="请输入价格" />
</el-form-item>
<el-form-item label="启用/禁用">
<el-switch v-model="PostMsg.IsUse" active-color="#409EFF" :active-value="1" :inactive-value="0"></el-switch>
</el-form-item>
<el-form-item label="显示/隐藏">
<el-switch v-model="PostMsg.IsShow" active-color="#409EFF" :active-value="1" :inactive-value="0">
</el-switch>
</el-form-item>
<el-form-item label="排序">
<el-input type="text" v-model="PostMsg.SortNum" size="small" class="w400"
@keyup.native="checkInteger(PostMsg,'SortNum')" placeholder="请输入排序" />
</el-form-item>
<el-form-item label="模板内容">
<el-input type="textarea" :rows="5" v-model="PostMsg.TemplateData" size="small" class="w400"
placeholder="请输入模板内容" />
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="isShow = false,clearMsg()">取消</el-button>
<el-button size="small" type="primary" @click="SaveMarket()">保存</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
isShow: false,
dataList: [],
qMsg: {
pageIndex: 1,
pageSize: 15,
IsUse:-1,
IsShow:-1,
},
total: 0,
//添加修改
PostMsg: {
Id: 0, //编号
Name: "", //模板名称
Pics: "", //封面图
Price: 0.00, //价格
IsUse: 1, //是否使用(0-禁用,1-使用)
IsShow: 1, //是否显示(0-不显示,1-显示)
TemplateData: "", //模板数据
SortNum: 0, //排序
}
};
},
created() {
},
methods: {
handleCurrentChange(val) {
this.qMsg.pageIndex = val;
this.getList();
},
//清空数据
clearMsg() {
this.PostMsg.Id = 0;
this.PostMsg.Name = "";
this.PostMsg.Pics = "";
this.PostMsg.Price = 0;
this.PostMsg.IsUse = 1;
this.PostMsg.IsShow = 1;
this.PostMsg.TemplateData = "";
this.PostMsg.SortNum = 0;
},
getList() {
this.apipost("/api/Template/GetTemplateMarketPageListModule", this.qMsg, res => {
if (res.data.resultCode == 1) {
this.dataList = res.data.data.pageData;
this.total = res.data.data.count;
} else {
this.Info(res.data.message);
}
})
},
//保存模板市场数据
SaveMarket() {
this.apipost("/api/Template/SetTemplateMarket", this.PostMsg, res => {
if (res.data.resultCode == 1) {
this.isShow=false;
this.Success(res.data.message);
this.getList();
this.clearMsg();
} else {
this.Info(res.data.message);
}
})
},
//修改模板市场
EditeMarket(item) {
this.apipost("/api/Template/GetTemplateMarket", {
Id: item.Id,
}, res => {
if (res.data.resultCode == 1) {
this.PostMsg = res.data.data;
this.isShow = true;
} else {
this.Info(res.data.message);
}
})
},
//删除模板市场
DeleteMarket(item) {
let that = this;
that.Confirm("是否删除?", function () {
that.apipost("/api/Template/RemoveTemplateMarket", {
Id: item.Id,
}, res => {
if (res.data.resultCode == 1) {
that.Success(res.data.message);
that.getList();
} else {
that.Info(res.data.message);
}
})
});
},
//更新是否使用
updateIsUse(item) {
this.apipost("/api/Template/UpdateTemplateMarketIsUse", {
Id: item.Id,
IsUse: item.IsUse
}, res => {
if (res.data.resultCode == 1) {
this.Success(res.data.message);
this.getList();
} else {
this.Info(res.data.message);
}
})
},
//更新是否显示
updateIsShow(item) {
this.apipost("/api/Template/UpdateTemplateMarketIsShow", {
Id: item.Id,
IsShow: item.IsShow
}, res => {
if (res.data.resultCode == 1) {
this.Success(res.data.message);
this.getList();
} else {
this.Info(res.data.message);
}
})
}
},
mounted() {
this.getList();
}
};
</script>
import md5 from 'js-md5'
export default {
install(Vue, options) {
Vue.prototype.md5 = md5;
//消息成功提示
Vue.prototype.Success = function (msg) {
this.$message({
message: msg,
duration: 2000,
type: "success"
});
},
//错误提示
Vue.prototype.Error = function (msg) {
this.$message({
message: msg,
duration: 2000,
type: "error"
});
},
install(Vue, options) {
Vue.prototype.md5 = md5;
//消息成功提示
Vue.prototype.Success = function(msg) {
this.$message({
message: msg,
duration: 2000,
type: "success"
});
},
//错误提示
Vue.prototype.Error = function(msg) {
this.$message({
message: msg,
duration: 2000,
type: "error"
});
},
//一般提示
Vue.prototype.Info = function (msg) {
this.$message({
message: msg,
duration: 2000,
type: "info"
});
},
//警告提示
Vue.prototype.Warning = function (msg) {
this.$message({
message: msg,
duration: 2000,
type: "warning"
});
},
//Confirm
Vue.prototype.Confirm = function (msg, callback) {
this.$confirm(msg, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
if (typeof callback === 'function') {
callback();
//一般提示
Vue.prototype.Info = function(msg) {
this.$message({
message: msg,
duration: 2000,
type: "info"
});
},
//警告提示
Vue.prototype.Warning = function(msg) {
this.$message({
message: msg,
duration: 2000,
type: "warning"
});
},
//Confirm
Vue.prototype.Confirm = function(msg, callback) {
this.$confirm(msg, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
if (typeof callback === 'function') {
callback();
}
})
.catch(() => {
this.Info("已取消操作");
});
},
//域名管理对象
Vue.prototype.domainManager = function() {
let domainUrl = '';
domainUrl = "https://mallapi.oytour.com";
//domainUrl = "https://localhost:5001";
let locationName = window.location.hostname;
if (locationName.indexOf('testmall.oytour') !== -1) {
domainUrl = "https://mallapi.oytour.com";
} else if (locationName.indexOf('oytour') !== -1) {
domainUrl = "https://mallapi.oytour.com";
}
var obj = {
//主地址npm
DomainUrl: domainUrl,
//常用提交数据URL
PostUrl: domainUrl + "/api/common/post",
ImageUrl: 'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com',
UploadFileUrl: domainUrl + '/api/File/LocalFileUploadImport',
UploadBlob: domainUrl + '/api/File/UploadBlob',
};
return obj;
},
//浏览器缓存
Vue.prototype.getLocalStorage = function() {
var localStorageData = window.localStorage["mall_userInfo"];
if (localStorageData !== undefined && localStorageData != 'undefined') {
return JSON.parse(localStorageData);
} else {
return null;
}
},
//验证只能输入2位小数【负数:isMinus传true】
Vue.prototype.checkPrice = function(item, filed, isMinus) {
var value = "" + item[filed]; //转字符串
var t = value.charAt(0);
value = value.replace(/[^\d.]/g, ""); //清除“数字”和“.”以外的字符
value = value.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
value = value
.replace(".", "$#$")
.replace(/\./g, "")
.replace("$#$", ".");
value = value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
//如果第一位是负号,则允许添加 如果不允许添加负号 可以把这块注释掉
//是否允许负数
if (isMinus && t == '-') {
value = '-' + value;
}
item[filed] = value;
}
})
.catch(() => {
this.Info("已取消操作");
});
},
//域名管理对象
Vue.prototype.domainManager = function () {
let domainUrl = '';
domainUrl = "http://192.168.2.214:8200";
domainUrl = "https://localhost:5001";
let locationName = window.location.hostname;
if (locationName.indexOf('testmall.oytour') !== -1) {
domainUrl = "http://mallapi.oytour.com";
} else if (locationName.indexOf('oytour') !== -1) {
domainUrl = "http://mallapi.oytour.com";
}
var obj = {
//主地址npm
DomainUrl: domainUrl,
//常用提交数据URL
PostUrl: domainUrl + "/api/common/post",
ImageUrl: 'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com',
UploadFileUrl: domainUrl + '/api/File/LocalFileUploadImport',
UploadBlob: domainUrl + '/api/File/UploadBlob',
};
return obj;
},
//浏览器缓存
Vue.prototype.getLocalStorage = function () {
var localStorageData = window.localStorage["mall_userInfo"];
if (localStorageData !== undefined && localStorageData != 'undefined') {
return JSON.parse(localStorageData);
} else {
return null;
}
},
//验证只能输入2位小数【负数:isMinus传true】
Vue.prototype.checkPrice = function (item, filed, isMinus) {
var value = "" + item[filed]; //转字符串
var t = value.charAt(0);
value = value.replace(/[^\d.]/g, ""); //清除“数字”和“.”以外的字符
value = value.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
value = value
.replace(".", "$#$")
.replace(/\./g, "")
.replace("$#$", ".");
value = value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
//如果第一位是负号,则允许添加 如果不允许添加负号 可以把这块注释掉
//是否允许负数
if (isMinus && t == '-') {
value = '-' + value;
}
item[filed] = value;
}
//验证只能输入整数【负数:isMinus传true】
Vue.prototype.checkInteger = function (item, filed, isMinus) {
var value = "" + item[filed]; //转字符串
var t = value.charAt(0);
value = value.replace(this.$commonUtils.Regex.isInteger, "");
//是否允许负数
if (isMinus && t == '-') {
value = '-' + value;
}
item[filed] = value;
},
//是否是线上环境【发布时修改为true】
Vue.prototype.isOnline = function () {
return process.env.NODE_ENV !== 'development';
},
//文件类型数组
Vue.prototype.FileType = function () {
var fileTypeJson = {
//主地址npm
UserImg: "User", //用户相图片
//常用提交数据URL
GoodsImg: "Goods", //素材相关文件
SetImg: "Set", //用户相图片
};
return fileTypeJson;
},
//上传文件到云存储
Vue.prototype.UploadFileToTencent = function (path, fileObj, callback) {
//获取文件扩展名
var filename = fileObj.name;
var index = filename.lastIndexOf(".");
var suffix = filename.substr(index);
var timestamp1 = Date.parse(new Date());
let str = '';
if (this.isOnline()) {
str = "/Test"
}
var newFileName = str + '/Upload/' + path + "/" + timestamp1 + "" + suffix;
var uploadMsg = {
Bucket: "viitto-1301420277",
Region: "ap-chengdu",
/* 存储桶所在地域,必须字段 */
SecretId: "AKIDDPnbIzi8C1eqEOPP8dw6MNAg9H9ldDKd",
SecretKey: "PdcLtOjslUzNFYdU4OSI1fKtdHpFT2Ob",
};
var COS = require('cos-js-sdk-v5');
var cos = new COS({
SecretId: uploadMsg.SecretId,
SecretKey: uploadMsg.SecretKey,
});
cos.putObject({
Bucket: uploadMsg.Bucket,
Region: uploadMsg.Region, //存储桶所在地域,必须字段
Key: newFileName, //文件名
StorageClass: 'STANDARD',
Body: fileObj, // 上传文件对象
onProgress: function (progressData) {}
}, function (err, data) {
if (data && data.statusCode == 200) {
var uploadResult = {
resultCode: 1,
FileName: fileObj.name,
FileUrl: "http://" + data.Location
//验证只能输入整数【负数:isMinus传true】
Vue.prototype.checkInteger = function(item, filed, isMinus) {
var value = "" + item[filed]; //转字符串
var t = value.charAt(0);
value = value.replace(this.$commonUtils.Regex.isInteger, "");
//是否允许负数
if (isMinus && t == '-') {
value = '-' + value;
}
item[filed] = value;
},
//是否是线上环境【发布时修改为true】
Vue.prototype.isOnline = function() {
return process.env.NODE_ENV !== 'development';
},
//文件类型数组
Vue.prototype.FileType = function() {
var fileTypeJson = {
//主地址npm
UserImg: "User", //用户相图片
//常用提交数据URL
GoodsImg: "Goods", //素材相关文件
SetImg: "Set", //用户相图片
};
return fileTypeJson;
},
//上传文件到云存储
Vue.prototype.UploadFileToTencent = function(path, fileObj, callback) {
//获取文件扩展名
var filename = fileObj.name;
var index = filename.lastIndexOf(".");
var suffix = filename.substr(index);
var timestamp1 = Date.parse(new Date());
let str = '';
if (this.isOnline()) {
str = "/Test"
}
var newFileName = str + '/Upload/' + path + "/" + timestamp1 + "" + suffix;
var uploadMsg = {
Bucket: "viitto-1301420277",
Region: "ap-chengdu",
/* 存储桶所在地域,必须字段 */
SecretId: "AKIDDPnbIzi8C1eqEOPP8dw6MNAg9H9ldDKd",
SecretKey: "PdcLtOjslUzNFYdU4OSI1fKtdHpFT2Ob",
};
var COS = require('cos-js-sdk-v5');
var cos = new COS({
SecretId: uploadMsg.SecretId,
SecretKey: uploadMsg.SecretKey,
});
cos.putObject({
Bucket: uploadMsg.Bucket,
Region: uploadMsg.Region, //存储桶所在地域,必须字段
Key: newFileName, //文件名
StorageClass: 'STANDARD',
Body: fileObj, // 上传文件对象
onProgress: function(progressData) {}
}, function(err, data) {
if (data && data.statusCode == 200) {
var uploadResult = {
resultCode: 1,
FileName: fileObj.name,
FileUrl: "http://" + data.Location
}
if (callback) {
callback(uploadResult);
}
} else {
/*上传文件异常*/
console.log(err || data);
}
});
},
//公用跳转
Vue.prototype.CommonJump = function(path, obj) {
this.$router.push({
name: path,
query: obj
});
}
if (callback) {
callback(uploadResult);
//公用判断图片地址 判断是否包含http
Vue.prototype.getIconLink = function(url) {
let str = ''
if (url && url != '') {
if (url.indexOf('http') != -1) {
str = url
} else {
str = this.domainManager().ImageUrl + url;
}
return str;
}
}
//HTTP提交数据
Vue.prototype.apipost = function(cmd, msg, successCall, faildCall, isOnline) {
var apiurl = this.domainManager().DomainUrl + cmd;
var postData = this.GetPostData(cmd, msg, "");
this.$http.post(apiurl, postData, {
headers: {
'Content-Type': 'application/json',
'Referer-Viitto': this.$route.path
}
})
.then(res => {
if (res.data.resultCode == 10000 || res.data.resultCode == 10001) {
this.$router.push({
path: '/login'
});
} else if (res.resultCode == 10005) {
this.$router.go(-1);
} else {
successCall(res);
}
}, faildCall)
}
//获取请求参数
Vue.prototype.GetPostData = function(cmd, msg, newCmd) {
if (msg == null || msg == "") {
msg = {}
}
var timestamp = (new Date()).valueOf();
if (!localStorage.mall_userInfo && localStorage.mall_userInfo != "" &&
this.$route.path.toLowerCase() != "/login" &&
this.$route.path.toLowerCase() != "/register" &&
this.$route.path.toLowerCase() != "/forgetpassword"
) {
this.$router.push({
path: '/login'
})
}
var token = "";
var key = "";
var MallBaseId = "0"; //小程序ID
var TenantId = "0"; //商户Id
var EmpId = 0; //员工编号【员工登录时使用】
if (this.getLocalStorage() != null) {
token = this.getLocalStorage().Token;
key = this.getLocalStorage().SecretKey;
MallBaseId = this.getLocalStorage().MallBaseId;
TenantId = this.getLocalStorage().TenantId;
EmpId = this.getLocalStorage().EmpId;
}
var encodeMsg = encodeURIComponent(JSON.stringify(msg)).toLowerCase();
var md5Str = md5(`cmd=${cmd}&msg=${encodeMsg}&timestamp=${timestamp}&token=${token}&key=${key}`);
let tempLanguage = 0;
if (localStorage.language && localStorage.language != '') {
if (localStorage.language == "zh-TW") {
tempLanguage = 1;
} else if (localStorage.language == "Japanese") {
tempLanguage = 2;
}
}
var cmdStr = "";
if (newCmd) {
cmdStr = newCmd;
}
var postData = {
msg: msg,
timestamp: timestamp,
token: token,
sign: md5Str,
languageId: tempLanguage,
cmd: cmdStr,
MallBaseId: MallBaseId,
TenantId: TenantId,
EmpId: EmpId,
}
return postData
},
//文件下载
Vue.prototype.GetLocalFile = function(cmd, msg, fileName, newCmd, successCall) {
var apiurl = this.domainManager().DomainUrl + cmd;
var postData = this.GetPostData(cmd, msg, newCmd);
this.$http.post(apiurl, postData, {
responseType: 'arraybuffer'
}).then((res) => {
let blob = new Blob([res.data], {
type: "application/vnd.ms-excel"
})
let url = URL.createObjectURL(blob);
let link = document.createElement('a');
link.href = url;
link.setAttribute("download", fileName);
document.body.appendChild(link);
link.click();
successCall(res);
}).catch(function(res) {});
}
} else {
/*上传文件异常*/
console.log(err || data);
}
});
},
//公用跳转
Vue.prototype.CommonJump = function (path, obj) {
this.$router.push({
name: path,
query: obj
});
}
//公用判断图片地址 判断是否包含http
Vue.prototype.getIconLink = function (url) {
let str = ''
if (url && url != '') {
if (url.indexOf('http') != -1) {
str = url
} else {
str = this.domainManager().ImageUrl + url;
}
return str;
}
}
//HTTP提交数据
Vue.prototype.apipost = function (cmd, msg, successCall, faildCall, isOnline) {
var apiurl = this.domainManager().DomainUrl + cmd;
var postData = this.GetPostData(cmd, msg, "");
this.$http.post(apiurl, postData, {
headers: {
'Content-Type': 'application/json',
'Referer-Viitto': this.$route.path
}
})
.then(res => {
if (res.data.resultCode == 10000 || res.data.resultCode == 10001) {
this.$router.push({
path: '/login'
});
} else if (res.resultCode == 10005) {
this.$router.go(-1);
} else {
successCall(res);
}
}, faildCall)
}
//获取请求参数
Vue.prototype.GetPostData = function (cmd, msg, newCmd) {
if (msg == null || msg == "") {
msg = {}
}
var timestamp = (new Date()).valueOf();
if (!localStorage.mall_userInfo && localStorage.mall_userInfo != "" &&
this.$route.path.toLowerCase() != "/login" &&
this.$route.path.toLowerCase() != "/register" &&
this.$route.path.toLowerCase() != "/forgetpassword"
) {
this.$router.push({
path: '/login'
})
}
var token = "";
var key = "";
var MallBaseId = "0"; //小程序ID
var TenantId = "0"; //商户Id
var EmpId = 0; //员工编号【员工登录时使用】
if (this.getLocalStorage() != null) {
token = this.getLocalStorage().Token;
key = this.getLocalStorage().SecretKey;
MallBaseId = this.getLocalStorage().MallBaseId;
TenantId = this.getLocalStorage().TenantId;
EmpId = this.getLocalStorage().EmpId;
}
var encodeMsg = encodeURIComponent(JSON.stringify(msg)).toLowerCase();
var md5Str = md5(`cmd=${cmd}&msg=${encodeMsg}&timestamp=${timestamp}&token=${token}&key=${key}`);
let tempLanguage = 0;
if (localStorage.language && localStorage.language != '') {
if (localStorage.language == "zh-TW") {
tempLanguage = 1;
} else if (localStorage.language == "Japanese") {
tempLanguage = 2;
}
}
var cmdStr = "";
if (newCmd) {
cmdStr = newCmd;
}
var postData = {
msg: msg,
timestamp: timestamp,
token: token,
sign: md5Str,
languageId: tempLanguage,
cmd: cmdStr,
MallBaseId: MallBaseId,
TenantId: TenantId,
EmpId: EmpId,
}
return postData
},
//文件下载
Vue.prototype.GetLocalFile = function (cmd, msg, fileName, newCmd, successCall) {
var apiurl = this.domainManager().DomainUrl + cmd;
var postData = this.GetPostData(cmd, msg, newCmd);
this.$http.post(apiurl, postData, {
responseType: 'arraybuffer'
}).then((res) => {
let blob = new Blob([res.data], {
type: "application/vnd.ms-excel"
})
let url = URL.createObjectURL(blob);
let link = document.createElement('a');
link.href = url;
link.setAttribute("download", fileName);
document.body.appendChild(link);
link.click();
successCall(res);
}).catch(function (res) {});
}
}
}
}
\ No newline at end of file
......@@ -91,14 +91,18 @@ export default new Router({
path: '/CustomPage',
name: 'CustomPage',
component: resolve => require(['@/components/sallCenter/CustomPage'], resolve),
},{ //授权页面
}, { //授权页面
path: '/authorization',
name: 'authorization',
component: resolve => require(['@/components/sallCenter/authorization'], resolve),
},{ //模板市场
}, { //模板市场
path: '/templateMarket',
name: 'templateMarket',
component: resolve => require(['@/components/sallCenter/templateMarket'], resolve),
}, { //模板市场管理页面
path: '/templateMarketManage',
name: 'templateMarketManage',
component: resolve => require(['@/components/sallCenter/templateMarketManage'], resolve),
}]
},
{
......@@ -273,7 +277,7 @@ export default new Router({
name: 'bulkImport',
component: resolve => require(['@/components/CommodityMan/bulkImport'], resolve),
},
// 商品管理 淘宝CSV
{
path: '/taoBaoCSV',
......@@ -299,36 +303,36 @@ export default new Router({
component: resolve => require(['@/components/orderMan/afterSalesOrder'], resolve),
},
// 订单管理 售后订单详情
        {
          path: '/salesOrderDetails',
          name: 'salesOrderDetails',
          component: resolve => require(['@/components/orderMan/salesOrderDetails'], resolve),
        },
        // 订单管理 评价模板
        {
          path: '/evaluationTemplate',
          name: 'evaluationTemplate',
          component: resolve => require(['@/components/orderMan/evaluationTemplate'], resolve),
        },
        // 订单管理 评价管理
        {
          path: '/evaluationMan',
          name: 'evaluationMan',
          component: resolve => require(['@/components/orderMan/evaluationMan'], resolve),
        },
{
path: '/salesOrderDetails',
name: 'salesOrderDetails',
component: resolve => require(['@/components/orderMan/salesOrderDetails'], resolve),
},
// 订单管理 评价模板
{
path: '/evaluationTemplate',
name: 'evaluationTemplate',
component: resolve => require(['@/components/orderMan/evaluationTemplate'], resolve),
},
// 订单管理 评价管理
{
path: '/evaluationMan',
name: 'evaluationMan',
component: resolve => require(['@/components/orderMan/evaluationMan'], resolve),
},
// 订单管理 客户评价
        {
          path: '/customerEvaluation',
          name: 'customerEvaluation',
          component: resolve => require(['@/components/orderMan/customerEvaluation'], resolve),
        },
{
path: '/customerEvaluation',
name: 'customerEvaluation',
component: resolve => require(['@/components/orderMan/customerEvaluation'], resolve),
},
// 订单管理 批量发货
        {
          path: '/BulkShipment',
          name: 'BulkShipment',
          component: resolve => require(['@/components/orderMan/BulkShipment'], resolve),
        },
{
path: '/BulkShipment',
name: 'BulkShipment',
component: resolve => require(['@/components/orderMan/BulkShipment'], resolve),
},
//设置 基础设置
{
path: '/basicSetUp',
......
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