...
|
...
|
@@ -11,6 +11,7 @@ |
|
|
|
|
|
<filter-item >
|
|
|
<Button type="primary" @click="saveOrder">保存</Button>
|
|
|
<Button type="warning" @click="showImport">导入商品</Button>
|
|
|
<Button type="ghost" @click="back">返回发货入库列表</Button>
|
|
|
</filter-item>
|
|
|
|
...
|
...
|
@@ -34,80 +35,139 @@ |
|
|
</Tabs>
|
|
|
</layout-list>
|
|
|
|
|
|
<modal-import
|
|
|
ref="imporGoods"
|
|
|
title="导入入库单"
|
|
|
:trans-params="transParams"
|
|
|
@import="importGoods">
|
|
|
<div slot="remark">
|
|
|
<Form-item label="说明:">
|
|
|
<div style="display: inline-block">
|
|
|
<ul>
|
|
|
<li>1、上传文件必须是 <span style="color: red;">.xlsx</span> 文件</li>
|
|
|
<li>2、第一行为标题栏:<strong>skn | sku | 库存数量</strong></li>
|
|
|
<li>3、每次最多导入1000条数据</li>
|
|
|
<li>4、<a href="/invoice-import.xlsx">下载样例</a></li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
</Form-item>
|
|
|
</div>
|
|
|
</modal-import>
|
|
|
</layout-body>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import _ from 'lodash';
|
|
|
import ProductList from './components/product-list';
|
|
|
import OrderInfo from './components/order-info';
|
|
|
import DatePick from './components/date-pick';
|
|
|
import InvoiceService from 'services/repository/invoice-service';
|
|
|
import moment from 'moment';
|
|
|
|
|
|
import ProductList from './components/product-list';
|
|
|
import OrderInfo from './components/order-info';
|
|
|
import DatePick from './components/date-pick';
|
|
|
import InvoiceService from 'services/repository/invoice-service';
|
|
|
import moment from 'moment';
|
|
|
|
|
|
export default {
|
|
|
props: ['isEdit'],
|
|
|
data() {
|
|
|
return {
|
|
|
count: 0,
|
|
|
id: '',
|
|
|
storeId: '',
|
|
|
arrivalTime: null,
|
|
|
brandId: '',
|
|
|
info: null
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
this.invoiceService = new InvoiceService();
|
|
|
this.id = this.$route.params.id;
|
|
|
this.brandId = this.$route.query.brandId;
|
|
|
},
|
|
|
computed: {
|
|
|
arrival: {
|
|
|
get() {
|
|
|
return moment.unix(this.arrivalTime).format('YYYY-MM-DD');
|
|
|
},
|
|
|
set(newVal) {
|
|
|
this.arrivalTime = moment(newVal, 'YYYY-MM-DD').unix();
|
|
|
export default {
|
|
|
props: ['isEdit'],
|
|
|
data() {
|
|
|
return {
|
|
|
importAction: '',
|
|
|
transParams: {
|
|
|
cols: {
|
|
|
productSkn: 'product_skn',
|
|
|
productSku: 'product_sku',
|
|
|
num: '数量'
|
|
|
}
|
|
|
},
|
|
|
count: 0,
|
|
|
id: '',
|
|
|
storeId: '',
|
|
|
arrivalTime: null,
|
|
|
brandId: '',
|
|
|
info: null
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
this.invoiceService = new InvoiceService();
|
|
|
this.id = this.$route.params.id;
|
|
|
this.brandId = this.$route.query.brandId;
|
|
|
},
|
|
|
computed: {
|
|
|
arrival: {
|
|
|
get() {
|
|
|
return moment.unix(this.arrivalTime).format('YYYY-MM-DD');
|
|
|
},
|
|
|
set(newVal) {
|
|
|
this.arrivalTime = moment(newVal, 'YYYY-MM-DD').unix();
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
showImport() {
|
|
|
this.$refs.imporGoods.show();
|
|
|
},
|
|
|
methods: {
|
|
|
back() {
|
|
|
this.$router.push({name: 'repository.invoice.list'});
|
|
|
},
|
|
|
saveOrder() {
|
|
|
this.invoiceService.updateOrder({
|
|
|
proRequisitionFormId: this.id,
|
|
|
predictArrivalTime: this.arrivalTime,
|
|
|
storeroomId: this.storeId
|
|
|
}).then((result) => {
|
|
|
if (result.code === 200) {
|
|
|
this.$Message.info('更新成功');
|
|
|
} else {
|
|
|
this.$Message.error('更新失败');
|
|
|
}
|
|
|
importGoods(goods) {
|
|
|
goods = _.filter(goods, row =>
|
|
|
_.trim(row.productSku) &&
|
|
|
_.trim(row.productSkn) &&
|
|
|
_.trim(row.num));
|
|
|
goods = _.each(goods, row => {
|
|
|
row.productSkn = _.parseInt(row.productSkn);
|
|
|
row.productSku = _.parseInt(row.productSku);
|
|
|
row.num = _.parseInt(row.num);
|
|
|
});
|
|
|
if (!goods.length) {
|
|
|
return this.$Notice.warning({
|
|
|
title: '导入商品为空'
|
|
|
});
|
|
|
},
|
|
|
onTabsClick(index) {
|
|
|
if (index === 0) {
|
|
|
}
|
|
|
this.invoiceService.importGoods(goods, this.id).then(result => {
|
|
|
if (result.code === 200) {
|
|
|
this.$Notice.success({
|
|
|
title: '导入成功'
|
|
|
});
|
|
|
this.$refs.imporGoods.close();
|
|
|
this.$refs.selectProduct.search();
|
|
|
} else {
|
|
|
this.$refs.allProduct.search();
|
|
|
this.$Notice.error({
|
|
|
title: '导入失败:',
|
|
|
desc: result.message
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
onChangeInfo(data) {
|
|
|
this.storeId = data.storeroomId;
|
|
|
this.arrivalTime = data.predictArrivalTime;
|
|
|
},
|
|
|
refreshInfo() {
|
|
|
this.$refs.info.getOrderInfo();
|
|
|
});
|
|
|
},
|
|
|
back() {
|
|
|
this.$router.push({name: 'repository.invoice.list'});
|
|
|
},
|
|
|
saveOrder() {
|
|
|
this.invoiceService.updateOrder({
|
|
|
proRequisitionFormId: this.id,
|
|
|
predictArrivalTime: this.arrivalTime,
|
|
|
storeroomId: this.storeId
|
|
|
}).then((result) => {
|
|
|
if (result.code === 200) {
|
|
|
this.$Message.info('更新成功');
|
|
|
} else {
|
|
|
this.$Message.error('更新失败');
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
onTabsClick(index) {
|
|
|
if (index === 0) {
|
|
|
this.$refs.selectProduct.search();
|
|
|
} else {
|
|
|
this.$refs.allProduct.search();
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
|
ProductList,
|
|
|
OrderInfo,
|
|
|
DatePick
|
|
|
onChangeInfo(data) {
|
|
|
this.storeId = data.storeroomId;
|
|
|
this.arrivalTime = data.predictArrivalTime;
|
|
|
},
|
|
|
refreshInfo() {
|
|
|
this.$refs.info.getOrderInfo();
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
components: {
|
|
|
ProductList,
|
|
|
OrderInfo,
|
|
|
DatePick
|
|
|
}
|
|
|
};
|
|
|
</script> |
...
|
...
|
|