Authored by 陈峰

Merge branch 'release/2.0' of http://git.yoho.cn/fe/yoho-shop-manage into release/2.0

... ... @@ -64,12 +64,17 @@
},
upload(data) {
let files = this.files;
if (!files) {
return Promise.reject();
}
let postFiles = Array.prototype.slice.call(files);
postFiles = postFiles.slice(0, 1);
if (postFiles.length === 0) {
return;
return Promise.reject();
}
Object.assign(this.data, data);
... ...
... ... @@ -53,15 +53,25 @@
</filter-item>
<filter-item>
<Button type="primary" @click="upload">开始上传</Button>
<Button type="primary" :loading="loading" @click="upload">开始上传</Button>
</filter-item>
</layout-filter>
<layout-list>
<div v-if="importInfo">
<div v-if="importInfo.length !== 0">
<div class="error-title">导入错误记录</div>
<div class="error-content" v-for="e in importInfo"> {{e}} </div>
</div>
</div>
</layout-list>
</layout-body>
</template>
<script>
import {SelectCategory, SelectBrand} from 'components/select';
import _ from 'lodash';
import LayoutList from '../../../components/global/layout/layout-list';
export default {
data() {
... ... @@ -109,7 +119,9 @@
fieldSpan: 18,
model: ''
}
}
},
loading: false,
importInfo: null
};
},
methods: {
... ... @@ -132,15 +144,25 @@
if (files.length !== 1) {
return;
}
this.importInfo = null;
this.xlsxFile = files[0].name;
},
upload() {
this.$refs.xlsxUpload.upload({brandId: this.brandId});
this.loading = true;
this.$refs.xlsxUpload.upload({brandId: this.brandId})
.then(() => {
this.loading = false;
})
.catch(() => {
this.loading = false;
});
},
onSuccess(data) {
if (data.code === 200) {
if (_.has(data.data, 'failFileReason')) {
this.$Message.error('部分导入成功');
this.importInfo = data.data.failFileReason;
} else {
this.$Message.info('全部导入成功');
}
... ... @@ -149,7 +171,7 @@
}
},
onError() {
this.loading = false;
},
onProgress() {
... ... @@ -159,13 +181,14 @@
}
},
components: {
LayoutList,
SelectCategory,
SelectBrand
}
};
</script>
<style lang="scss">
<style lang="scss" scoped>
.import-title {
font-size: 15px;
font-weight: bold;
... ... @@ -175,4 +198,20 @@
margin-bottom: 10px;
margin-top: 10px;
}
.error-title {
color: red;
font-size: 15px;
font-weight: bold;
background-color: #fafafa;
height: 40px;
line-height: 40px;
margin-bottom: 10px;
margin-top: 10px;
}
.error-content {
color: red;
line-height: 25px;
}
</style>
... ...
... ... @@ -23,14 +23,11 @@
<filter-item>
<Button type="primary" @click="getExpress">筛选</Button>
<Button type="warning" @click="exportList">导出</Button>
<Button @click="clearFilters">清空条件</Button>
</filter-item>
</layout-filter>
<layout-action>
<Button @click="exportList">导出</Button>
</layout-action>
<layout-list>
<Table border :columns="tableCols" :data="tableData"></Table>
<Page :total="pageData.total" :current="pageData.current"
... ...
... ... @@ -86,12 +86,17 @@
this.search();
},
create(params) {
if (!this.isNumber(params.row.buyingNums)) {
this.$Message.error('发货数量必须是数字');
return;
}
let data = {
proRequisitionFormId: this.oid,
goodsList: [
{
productSku: params.row.productSku,
num: +params.row.buyingNums
num: params.row.buyingNums
}
]
};
... ... @@ -106,6 +111,11 @@
});
},
update(params) {
if (!this.isNumber(params.row.buyingNums)) {
this.$Message.error('发货数量必须是数字');
return;
}
let data = {
proRequisitionFormId: this.oid,
goodsList: [
... ... @@ -144,6 +154,11 @@
},
refresh() {
this.search();
},
isNumber(numStr) {
const isNumber = /^[0-9]+$/;
return isNumber.test(numStr);
}
},
components: {
... ...
... ... @@ -47,7 +47,7 @@
</layout-filter>
<layout-action>
<Button type="primary" @click="onClickCreate">创建入库单</Button>
<Button type="warning" @click="onClickCreate">创建入库单</Button>
</layout-action>
<layout-list>
... ...
... ... @@ -30,7 +30,7 @@ let cols = function() {
align: 'center',
render: (h, params) => {
return (
<div>{params.row.goodsName} / {params.row.factoryGoodsName}</div>
<div>{params.row.goodsName || '-'} / {params.row.factoryGoodsName || '-'}</div>
);
}
},
... ... @@ -39,7 +39,7 @@ let cols = function() {
align: 'center',
render: (h, params) => {
return (
<div>{params.row.genderName} / {params.row.sizeName}</div>
<div>{params.row.genderName || '-'} / {params.row.sizeName || '-'}</div>
);
}
},
... ... @@ -48,7 +48,7 @@ let cols = function() {
align: 'center',
render: (h, params) => {
return (
<div>{params.row.retailPrice} / {params.row.salesPrice}</div>
<div>{params.row.retailPrice || '-'} / {params.row.salesPrice || '-'}</div>
);
}
},
... ... @@ -57,6 +57,11 @@ let cols = function() {
title: '结算折扣',
key: 'purchaseDiscount',
align: 'center',
render: (h, params) => {
return (
<div>{params.row.purchaseDiscount || '-'}</div>
);
}
},
{
title: '发货数量',
... ...
... ... @@ -47,13 +47,9 @@ export default () => {
},
prodStatus: {
label: '商品状态',
model: -1,
model: '',
options: [
{
value: -1,
label: '全部'
},
{
value: 2,
label: '已处理'
},
... ...
... ... @@ -42,13 +42,9 @@ export default function() {
},
prodStatus: {
label: '商品状态',
model: -1,
model: '',
options: [
{
value: -1,
label: '全部'
},
{
value: 1,
label: '待处理'
},
... ...
... ... @@ -28,7 +28,7 @@
v-model="filters.orderTime.model"></Date-picker>
</filter-item>
<filter-item :label="filters.prodStatus.label">
<Select v-model.trim="filters.prodStatus.model">
<Select v-model.trim="filters.prodStatus.model" clearable>
<Option v-for="option in filters.prodStatus.options"
:value="option.value"
:key="option.value">{{option.label}}</Option>
... ... @@ -150,7 +150,7 @@
values.endTime = '';
}
if (status === -1) {
if (status === '' || status === null) {
values.statusList = [2, 3, 4];
} else if (status === -2) {
values.statusList = [2];
... ...
... ... @@ -25,7 +25,7 @@
</Date-picker>
</filter-item>
<filter-item :label="filters.prodStatus.label">
<Select v-model.trim="filters.prodStatus.model">
<Select v-model.trim="filters.prodStatus.model" clearable>
<Option v-for="option in filters.prodStatus.options"
:value="option.value"
:key="option.value">{{option.label}}</Option>
... ...