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

update

parent cc8262ff
<template>
<div class="bulkImport">
<div class="head-title">
批量导入
<!-- <el-button style="float:right;margin-top: -5px;margin-left:20px;" size="small" type="primary">分类导入历史</el-button> -->
</div>
<div style="background:#fff;margin-top:10px;padding:20px">
<el-tabs v-model="activeName">
<el-tab-pane :dataId="0" label="商品导入" name="first"></el-tab-pane>
<!-- <el-tab-pane :dataId="1" label="分类导入" name="second"></el-tab-pane> -->
</el-tabs>
<div style="margin-top:20px;">
<el-steps style="width:900px;margin-left: 20px;" :active="activestep">
<el-step title="选择文件"></el-step>
<el-step title="导入数据"></el-step>
<el-step title="导入完成"></el-step>
</el-steps>
<el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="100px" style="margin-top: 30px;width: 600px;">
<el-form-item label="状态" prop="GoodsStatus" v-if="activeName=='first'">
<el-radio v-model="addMsg.GoodsStatus" :label="1">暂不上架</el-radio>
<el-radio v-model="addMsg.GoodsStatus" :label="2">立即上架</el-radio>
</el-form-item>
<el-form-item class="tooltiplabel" label="上传数据" prop="resource">
<el-tooltip class="item" effect="dark" content="仅支持上传csv,xls格式" placement="top"
style="position: absolute;left: -22px;top:12px">
<i class="el-tooltip el-icon-info"></i>
</el-tooltip>
<span>{{addMsg.FileName}}</span>
<el-upload
class="upload-demo"
ref="upload"
:action="importFileUrl"
:multiple="true"
:on-success="successUpload"
:show-file-list="false"
accept=".csv, .xlsx,.xls">
<span class="blue">选择本地文件</span>
</el-upload>
</el-form-item>
<el-form-item label="商品分类" prop="CategoryList" v-if="activeName=='first'">
<template v-if="CategoryList && CategoryList.length>0">
<el-tag type="warning" style="margin-right:10px;" @close="exitCheck(item,index)"
v-for="(item,index) in CategoryList" :key="index" closable>{{item.CategoryName}}</el-tag>
</template>
<el-button type="primary" @click="flDig=true,keepCategoryList=CategoryList"
style="margin:0 10px;" size="small">选择分类</el-button>
</el-form-item>
<el-form-item label="是否启用" v-if="activeName!='first'">
<el-switch
v-model="addMsg.Enabled"
active-color="#409EFF"
:active-value="1"
:inactive-value="0">
</el-switch>
</el-form-item>
<el-form-item label="是否显示" v-if="activeName!='first'">
<el-switch
v-model="addMsg.Enabled"
active-color="#409EFF"
:active-value="1"
:inactive-value="0">
</el-switch>
</el-form-item>
<el-form-item>
<el-button @click="save('addMsg')" type="primary" style="margin:0 10px;" size="small">一键导入</el-button>
</el-form-item>
</el-form>
</div>
</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="CategoryList" @change="handleCheckChange">
<div v-for="(item,index) in fenleiData" :key="index" flex="dir:left box:first" class="cat-item">
<el-checkbox :label="item">
<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>
</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="CategoryList" @change="handleCheckChange">
<div v-for="(item,index) in childList2" :key="index" flex="dir:left box:first" class="cat-item">
<el-checkbox :label="item">
<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-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="CategoryList" @change="handleCheckChange">
<div v-for="(item,index) in childList3" :key="index" flex="dir:left box:first" class="cat-item">
<el-checkbox :label="item">
<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-col>
</el-row>
<div class="tag-box">
<el-tag @close="exitCheck(item)" v-for="(item,index) in 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,CategoryList=keepCategoryList">取 消</el-button>
<el-button @click="flDig = false" size="small" type="primary">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
name: "bulkImport",
data(){
return{
activeName:"first",
activestep:0,
addMsg:{
FileName:'',
FilePath:'',
GoodsStatus:1,
CategoryList:[],
},
rules:{
GoodsStatus: [
{ required: true, message: '请选择', trigger: 'change' }
],
},
flDig:false,
fenleiData: [],
checkList: [],
childList2: [],
childList3: [],
CategoryList:[],
keepCategoryList: [],
importFileUrl: this.domainManager().UploadFileUrl,
dataId:0,
}
},
created(){
this.getTree();
},
methods:{
save(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
if(this.addMsg.FilePath==''){
this.Error("请上传文件");
return;
}
if(this.CategoryList.length==0){
this.Error("请选择商品分类");
return;
}
this.addMsg.CategoryList=[];
this.CategoryList.forEach(item=>{
this.addMsg.CategoryList.push(item.Id);
})
this.apipost("/api/product/SetGoodsBatchImport", this.addMsg, res => {
if (res.data.resultCode == 1) {
this.Success(res.data.message)
this.addMsg={
FileName:'',
FilePath:'',
GoodsStatus:1,
CategoryList:[],
}
this.CategoryList=[];
this.keepCategoryList=[];
this.activestep=3;
} else {
this.Error(res.data.message)
}
})
} else {
return false;
}
});
},
handleClick(val){
this.dataId=val.$attrs.dataId;
},
successUpload(file){
this.addMsg.FileName=file.data.Name;
this.addMsg.FilePath=file.data.Path;
this.activestep=1;
},
getChild3(ChildList) {
this.childList3 = ChildList;
},
getChild2(ChildList) {
this.childList2 = ChildList;
},
handleCheckChange() {
this.addMsg.CategoryList.forEach((item, k) => {
item.CategoryId = item.Id;
})
},
exitCheck(item, index) {
this.addMsg.CategoryList.forEach((list, k) => {
if (list.Id == item.Id) {
this.addMsg.CategoryList.splice(k, 1);
}
})
},
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;
})
})
})
}
})
},
},
};
</script>
<style>
.bulkImport .el-step__title.is-finish {
position: absolute;
left: -18px;
width: 200px;
}
.bulkImport .el-step__title.is-wait {
position: absolute;
left: -18px;
width: 200px;
}
.bulkImport .el-step__title.is-process {
position: absolute;
left: -18px;
}
.bulkImport .tooltiplabel .el-form-item__label{
padding-right:26px;
}
.app-add-cat .el-checkbox-group {
font-size: 14px !important;
}
.app-add-cat .el-checkbox {
margin-right: 0;
}
.app-add-cat .el-dialog__body {
padding: 10px 20px !important;
}
.app-add-cat .tag-box .tag-item {
margin-right: 5px;
}
.app-add-cat .tag-box {
margin: 20px 0;
}
.app-add-cat .app-goods-cat-list .active {
background: #FAFAFA;
}
.app-add-cat .app-goods-cat-list .cat-item {
cursor: pointer;
padding: 5px 10px;
}
.app-add-cat .app-goods-cat-list {
border: 1px solid #E8EAEE;
border-radius: 5px;
margin-top: -5px;
padding: 10px 0;
overflow: scroll;
height: 400px;
}
</style>
...@@ -464,7 +464,7 @@ ...@@ -464,7 +464,7 @@
</div> </div>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<UE :defaultMsg=defaultMsg :config=config ref="ue"></UE> <UE :defaultMsg="defaultMsg" :config=config ref="ue"></UE>
</el-col> </el-col>
</el-row> </el-row>
</el-card> </el-card>
...@@ -1017,9 +1017,11 @@ ...@@ -1017,9 +1017,11 @@
}; };
}, },
created() {}, created() {
},
mounted() { mounted() {
this.$refs.ue.InitData(); this.$refs.ue.loadUe();
if (this.$route.query.GoodsId) { if (this.$route.query.GoodsId) {
this.GoodsId = this.$route.query.GoodsId; this.GoodsId = this.$route.query.GoodsId;
this.getData() this.getData()
...@@ -1517,10 +1519,8 @@ ...@@ -1517,10 +1519,8 @@
// this.addMsg.CustomShareImagePath = this.domainManager().ImageUrl+msg.url; // this.addMsg.CustomShareImagePath = this.domainManager().ImageUrl+msg.url;
} }
if (this.imgType == 3) { if (this.imgType == 3) {
let imgListIndex1=this.imgListIndex1; let imgListIndex1=this.imgListIndex1;
let imgListIndex2=this.imgListIndex2; let imgListIndex2=this.imgListIndex2;
this.SpecificationList[imgListIndex1].SpecificationValueList[imgListIndex2].Image=this.domainManager().ImageUrl+msg.url; this.SpecificationList[imgListIndex1].SpecificationValueList[imgListIndex2].Image=this.domainManager().ImageUrl+msg.url;
} }
...@@ -1560,6 +1560,12 @@ ...@@ -1560,6 +1560,12 @@
this.fenleiData = pageData; this.fenleiData = pageData;
this.fenleiData.forEach(item => { this.fenleiData.forEach(item => {
item.CategoryName = item.Name; item.CategoryName = item.Name;
item.ChildList.forEach(item2=>{
item2.CategoryName = item2.Name;
item2.ChildList.forEach(item3=>{
item3.CategoryName = item3.Name;
})
})
}) })
} }
...@@ -1574,7 +1580,9 @@ ...@@ -1574,7 +1580,9 @@
this.SpecificationList = this.addMsg.SpecificationList; this.SpecificationList = this.addMsg.SpecificationList;
if (this.addMsg.SeparateDistributionType == 1) { if (this.addMsg.SeparateDistributionType == 1) {
this.disList1 = this.addMsg.DistributionCommissionTreeList; this.disList1 = this.addMsg.DistributionCommissionTreeList;
this.GradeCommissionList = this.addMsg.DistributionCommissionTreeList[0].GradeCommissionList if(this.addMsg.DistributionCommissionTreeList.length>0){
this.GradeCommissionList = this.addMsg.DistributionCommissionTreeList[0].GradeCommissionList
}
} }
if (this.addMsg.SeparateDistributionType == 2) { if (this.addMsg.SeparateDistributionType == 2) {
this.disList2 = this.addMsg.DistributionCommissionTreeList; this.disList2 = this.addMsg.DistributionCommissionTreeList;
...@@ -1585,7 +1593,10 @@ ...@@ -1585,7 +1593,10 @@
GradeCommissionList: this.GradeCommissionList GradeCommissionList: this.GradeCommissionList
}; };
this.disList1.push(objNew); this.disList1.push(objNew);
this.$refs.ue.SetVal(this.addMsg.GoodsDetails); if(this.addMsg.GoodsDetails && this.addMsg.GoodsDetails!=''){
this.$refs.ue.SetVal(this.addMsg.GoodsDetails);
}
}) })
}, },
getRule() { getRule() {
......
...@@ -2,10 +2,22 @@ ...@@ -2,10 +2,22 @@
<div class="orderList"> <div class="orderList">
<div class="head-title"> <div class="head-title">
订单列表 订单列表
<el-upload
class="upload-demo"
ref="upload"
:action="importFileUrl"
:multiple="true"
:on-success="successUpload"
:show-file-list="false"
accept=".csv, .xlsx,.xls">
<el-button size="small" type="primary">
批量导入</el-button>
</el-upload>
<el-button @click="dialogVisible=true" style="float:right;margin-top: -5px;" size="small" type="primary">批量导出 <el-button @click="dialogVisible=true" style="float:right;margin-top: -5px;" size="small" type="primary">批量导出
</el-button> </el-button>
<el-button @click="ClearHsz" style="float:right;margin-top: -5px;margin-right:20px" size="small" type="primary"> <el-button @click="ClearHsz" style="float:right;margin-top: -5px;margin-right:20px" size="small" type="primary">
清空回收站</el-button> 清空回收站</el-button>
</div> </div>
<div class="content"> <div class="content">
<div> <div>
...@@ -418,6 +430,7 @@ ...@@ -418,6 +430,7 @@
name: "orderList", name: "orderList",
data() { data() {
return { return {
importFileUrl: this.domainManager().UploadFileUrl,
priceType: 1, priceType: 1,
priceMsg: { priceMsg: {
Income: '', Income: '',
...@@ -590,6 +603,17 @@ ...@@ -590,6 +603,17 @@
}, },
mounted() {}, mounted() {},
methods: { methods: {
successUpload(file){
let path=file.data.Path;
this.apipost("/api/order/SetGoodsOrderBatchImport", {FilePath:path}, res => {
if (res.data.resultCode == 1) {
this.Success(res.data.message)
}else{
this.Error(res.data.message)
}
})
},
// 订单操作 // 订单操作
priceForm(formName) { priceForm(formName) {
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
...@@ -1162,6 +1186,11 @@ ...@@ -1162,6 +1186,11 @@
</script> </script>
<style> <style>
.orderList .upload-demo{
float:right;
margin-top: -5px;
margin-left:20px;
}
.orderList .pendSelect .el-input { .orderList .pendSelect .el-input {
width: 100px; width: 100px;
} }
......
...@@ -245,6 +245,13 @@ export default new Router({ ...@@ -245,6 +245,13 @@ export default new Router({
name: 'goodsListEdit', name: 'goodsListEdit',
component: resolve => require(['@/components/CommodityMan/goodsListEdit'], resolve), component: resolve => require(['@/components/CommodityMan/goodsListEdit'], resolve),
}, },
// 商品管理 批量导入
{
path: '/bulkImport',
name: 'bulkImport',
component: resolve => require(['@/components/CommodityMan/bulkImport'], resolve),
},
// 商品管理 淘宝CSV // 商品管理 淘宝CSV
{ {
path: '/taoBaoCSV', path: '/taoBaoCSV',
......
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