Authored by htoooth

fix

@@ -49,7 +49,9 @@ @@ -49,7 +49,9 @@
49 :on-progress="onProgress"> 49 :on-progress="onProgress">
50 <Button type="ghost">浏览</Button> 50 <Button type="ghost">浏览</Button>
51 </XlsxUpload> 51 </XlsxUpload>
  52 + <a @click="download">下载 Excel 模板</a>
52 </FilterItem> 53 </FilterItem>
  54 +
53 <FilterItem> 55 <FilterItem>
54 <Button type="primary" @click="upload">开始上传</Button> 56 <Button type="primary" @click="upload">开始上传</Button>
55 </FilterItem> 57 </FilterItem>
@@ -59,6 +61,7 @@ @@ -59,6 +61,7 @@
59 61
60 <script> 62 <script>
61 import {SelectCategory, SelectBrand} from 'components/select'; 63 import {SelectCategory, SelectBrand} from 'components/select';
  64 + import _ from 'lodash';
62 65
63 export default { 66 export default {
64 data() { 67 data() {
@@ -134,13 +137,25 @@ @@ -134,13 +137,25 @@
134 upload() { 137 upload() {
135 this.$refs.xlsxUpload.upload({brandId: this.brandId}); 138 this.$refs.xlsxUpload.upload({brandId: this.brandId});
136 }, 139 },
137 - onSuccess() { 140 + onSuccess(data) {
  141 + if (data.code === 200) {
  142 + if (_.has(data.data, 'failFileReason')) {
  143 + this.$Message.error('部分导入成功');
  144 + } else {
  145 + this.$Message.info('全部导入成功');
  146 + }
  147 + } else {
  148 + this.$Message.error('导入失败');
  149 + }
138 }, 150 },
139 onError() { 151 onError() {
140 152
141 }, 153 },
142 onProgress() { 154 onProgress() {
143 155
  156 + },
  157 + download() {
  158 + window.open('/Api/platform/downloadFile', '_blank');
144 } 159 }
145 }, 160 },
146 components: { 161 components: {
@@ -77,7 +77,8 @@ let domainApis = { @@ -77,7 +77,8 @@ let domainApis = {
77 addCategoryLinkProduct: '/SellerShopController/addCategoryLinkProduct', 77 addCategoryLinkProduct: '/SellerShopController/addCategoryLinkProduct',
78 deleteCategoryLinkProduct: '/SellerShopController/deleteCategoryLinkProduct', 78 deleteCategoryLinkProduct: '/SellerShopController/deleteCategoryLinkProduct',
79 getRemoteImageUrlBySku: '/product/getRemoteImageUrlBySku', 79 getRemoteImageUrlBySku: '/product/getRemoteImageUrlBySku',
80 - importSeller: '/batch/importSeller' 80 + importSeller: '/batch/importSeller',
  81 + downloadFile: '/exceltemplate/download/CreateProductForShops'
81 }, 82 },
82 shop: { 83 shop: {
83 login: '/loginInter', 84 login: '/loginInter',