Authored by 李奇

Merge remote-tracking branch 'origin/release/2.0' into feature/product-return

<template>
<LayoutBody>
<LayoutFilter>
<FilterItem>
</FilterItem>
<FilterItem>
</FilterItem>
</LayoutFilter>
<div>
<Button type="primary" @click="back">返回发货物流列表</Button>
<span>物流单号:{{id}}</span>
<span>发货时间:{{sendTime}}</span>
</div>
<LayoutAction>
发往:{{storeroomName}} {{address}} {{adminName}}
</LayoutAction>
<LayoutList>
... ... @@ -22,6 +21,8 @@
<script>
import service from 'services/express-service';
import moment from 'moment';
import _ from 'lodash';
export default {
props: ['id'],
... ... @@ -40,8 +41,14 @@
},
{
title: '商品图片',
key: 'storeroomName',
align: 'center',
render: (h, params) => {
return (
<div>
<img v-prod-img={params.row.skn}></img>
</div>
);
}
},
{
title: '商品名称',
... ... @@ -58,8 +65,17 @@
}
},
{
title: '订单号/已发数/入库数',
title: '订单号/已发数',
align: 'center',
render: (h, params) => {
return (
<div>{params.row.boList.map((i) => {
return (
<div>{i.proRequisitionFormId}/{i.num}</div>
);
})}</div>
);
}
}
],
tableData: [],
... ... @@ -67,19 +83,44 @@
current: 1,
pageSize: 20,
total: 0
}
},
id: null,
time: null,
storeroomName: null,
address: null,
adminName: null
};
},
mounted() {
this.getExpress(this.$route.params.id);
this.id = this.$route.params.id;
this.time = this.$route.query.time;
this.getExpress(this.id);
},
computed: {
sendTime() {
return moment.unix(this.time).format('YYYY-MM-DD HH:mm:ss');
}
},
methods: {
pageChange(num) {
this.pageData.current = num;
},
getExpress(id) {
return service.show({expressNumber: id});
return service.show({expressNumber: id}).then((result) => {
if (result.code === 200) {
this.tableData = result.data;
this.storeroomName = _.first(this.tableData || {}).storeroomName;
this.address = _.first(this.tableData || {}).address;
this.adminName = _.first(this.tableData || {}).adminName;
}
});
},
back() {
this.$router.push({
name: 'repository.express.list'
});
}
}
};
</script>
... ...
... ... @@ -21,14 +21,6 @@
:placeholder="filters.skuFactoryCode.holder" :maxlength="9"></Input>
</FilterItem>
<FilterItem :label="filters.status.label">
<Select v-model.trim="filters.status.model">
<Option v-for="option in filters.status.options"
:value="option.value"
:key="option.value">{{option.label}}</Option>
</Select>
</FilterItem>
<FilterItem>
<Button type="primary" @click="getExpress">筛选</Button>
<Button @click="clearFilters">清空条件</Button>
... ... @@ -87,31 +79,6 @@
holder: '',
fieldSpan: 18
},
status: {
label: '物流状态',
labelSpan: 6,
model: '',
holder: '',
fieldSpan: 18,
options: [
{
value: -1,
label: '全部'
},
{
value: 10,
label: '已发出'
},
{
value: 20,
label: '已收货'
},
{
value: 41,
label: '入库完成'
}
]
}
}
};
},
... ... @@ -124,7 +91,6 @@
this.filters.expressNumber.model = null;
this.filters.productSkn.model = null;
this.filters.skuFactoryCode.model = null;
this.filters.status.model = -1;
this.pageData.current = 1;
this.pageData.total = 0;
... ... @@ -134,7 +100,7 @@
let params = {};
if (this.filters.id.model) {
params.id = this.filters.id.model;
params.proReqFormId = this.filters.id.model;
}
if (this.filters.expressNumber.model) {
... ... @@ -149,10 +115,6 @@
params.skuFactoryCode = this.filters.skuFactoryCode.model;
}
if (this.filters.status.model !== -1) {
params.status = this.filters.status.model;
}
params.pageSize = this.pageData.pageSize;
params.pageNo = this.pageData.current;
... ... @@ -169,11 +131,14 @@
}
});
},
info(expressId) {
info(data) {
this.$router.push({
name: 'repository.express.info',
params: {
id: expressId
id: data.expressNumber
},
query: {
time: data.createTime
}
});
}
... ...
... ... @@ -3,23 +3,36 @@
* @author: qi.li <qi.li@yoho.cn>
* @date: 2017/04/13
*/
import moment from 'moment';
let tableCols = function() {
return [
{
title: '物流单号',
key: 'expressNumber',
align: 'center'
align: 'center',
render: (h, params) => {
return (
<div>
{params.row.expressNumber} ({params.row.expressName})
</div>
);
}
},
{
title: '发货时间',
key: 'createTime',
align: 'center'
},
{
title: '仓库',
key: 'storeroomName',
align: 'center',
render: (h, params) => {
let time = moment.unix(params.row.createTime);
return (
<div>
<div> {time.format('YYYY-MM-DD')} </div>
<div> {time.format('HH:mm:ss')} </div>
</div>
);
}
},
{
title: '操作',
... ... @@ -28,7 +41,7 @@ let tableCols = function() {
render: (h, params) => {
return (
<div class="action-btn-row">
<i-button type="primary" size="small" onClick={() => this.info(params.row.expressId)}>查看明细</i-button>
<i-button type="primary" size="small" onClick={() => this.info(params.row)}>查看明细</i-button>
</div>
);
}
... ...
... ... @@ -3,11 +3,13 @@ import jit from './jit';
import prodReturn from './return';
import supplement from './supplement';
import invoice from './invoice';
import express from './express';
export default {
diff,
jit,
supplement,
prodReturn,
invoice
invoice,
express
};
... ...
... ... @@ -3,13 +3,15 @@
class="in-store"
width="700"
v-model="showModal"
@on-cancel="modalCancel"
title="添加到入库单">
<div class="in-store-content">
<p class="notice">* 请选择要添加的入库单</p>
<Table
ref="table"
v-if="loadingOk"
height="300"
height="300"
no-data-text="正在加载..."
:data="tableData"
:columns="tableColumn"
@on-row-click="tableRowClick"></Table>
... ... @@ -86,7 +88,6 @@ export default {
show() {
this.loadingData();
this.showModal = true;
this.loadingOk = true;
},
loadingData() {
return supplierService.listOrder({
... ... @@ -134,6 +135,8 @@ export default {
.in-store-content {
.notice {
color: #f30;
font-size: 14px;
line-height: 30px;
}
}
</style>
... ...
import {CellImage, CellInfo, CellPrice} from 'components/cell'; // eslint-disable-line
import timeFormat from 'filters/time-format';
export default function() {
return {
... ... @@ -22,55 +23,15 @@ export default function() {
sknFactoryCode: '',
skuFactoryCode: '',
prodName: '',
brandId: -1,
brandId: '',
stockStatus: ''
},
pageData: {
total: 0,
current: 1,
pageNo: 1,
pageSize: 20
},
tableData: [{
id: 1,
picImgUrl: 'http://img12.static.yhbimg.com/goodsimg/2017/05/09/09/028f8f329a40386d5cdbd966a92d0aaa0a.jpg?imageView2/0/w/78/h/78',
productSkn: '123',
productName: '123',
brandName: '123',
maxSortName: '123',
middleSortName: '123',
smallSortName: '123',
retailPrice: '123',
salesPrice: '123',
saleStatus: '已上架',
stock: '123',
day: '123',
buhuo: '123',
time: 1492531200,
store: '南京1号仓库',
brandId: 248,
_checked: false,
num: 0
}, {
id: 2,
picImgUrl: 'http://img12.static.yhbimg.com/goodsimg/2017/05/09/09/028f8f329a40386d5cdbd966a92d0aaa0a.jpg?imageView2/0/w/78/h/78',
productSkn: '123',
productName: '123',
brandName: '1232',
maxSortName: '123',
middleSortName: '123',
smallSortName: '123',
retailPrice: '123',
salesPrice: '123',
saleStatus: '已上架',
stock: '123',
day: '123',
buhuo: '123',
time: 1492531200,
store: '南京1号仓库',
brandId: 249,
_checked: false,
num: 0
}],
tableData: [],
tableCols: [{
type: 'selection',
width: 60,
... ... @@ -81,14 +42,13 @@ export default function() {
align: 'center',
render: (h, params) => {
return (
<CellImage
imageSrc={params.row.picImgUrl}
productUrl={params.row.productUrl}></CellImage>
<img v-prod-img={params.row.productSkn}/>
);
}
}, {
title: '商品信息',
align: 'center',
width: '15%',
render: (h, params) => {
return (
<CellInfo items={[
... ... @@ -111,6 +71,7 @@ export default function() {
}, {
title: '价格(元)',
align: 'center',
width: '13%',
render: (h, params) => {
return (
<CellInfo items={[
... ... @@ -119,34 +80,29 @@ export default function() {
value: params.row.retailPrice
}, {
label: '销售价',
value: params.row.salesPrice
value: params.row.salePrice
}
]}></CellInfo>
);
}
}, {
title: '销售状态',
key: 'saleStatus'
}, {
title: '仓库库存',
key: 'stock'
}, {
title: '库存可售天数',
key: 'day'
key: 'saleDays'
}, {
title: '建议补货数',
key: 'buhuo'
key: 'supplementNums'
}, {
title: '最近一次补货时间',
width: 150,
render: (h, params) => {
return (
<span>{params.row.time}</span>
<span>{timeFormat(params.row.lastTime)}</span>
);
}
}, {
title: '仓库',
key: 'store'
}, {
title: '补货数',
render: (h, params) => {
return (
... ... @@ -154,6 +110,7 @@ export default function() {
max={999}
min={0}
value={params.row.num}
style={{width: '60px'}}
onInput={val => (params.row.num = val)}
onOn-change={val => (this.numChange(params.row, val))}></Input-number>
);
... ...
... ... @@ -43,9 +43,9 @@
@on-selection-change="selectChange"></Table>
<Page
:total="pageData.total"
:current="pageData.current"
:current="pageData.pageNo"
@on-change="pageChange"
:page-size="20"
:page-size="pageData.pageSize"
show-total></Page>
</LayoutList>
<ModalInvoice ref="modalInvoice" @save="saveInvoice" :brand="selectBrand.brandId"></ModalInvoice>
... ... @@ -56,7 +56,7 @@
import _ from 'lodash';
import {SelectBrand, SelectCategory} from 'components/select';
import {ModalInvoice} from './components';
import supplierService from 'supplier-service';
import invoiceService from 'invoice-service';
import store from './store';
export default {
... ... @@ -64,19 +64,31 @@ export default {
return store.apply(this);
},
created() {
return this.search();
},
methods: {
search() {
return supplierService.supplementProductList(this.getQuery()).then(res => {
console.log(res);
this.$Loading.start();
return invoiceService.supplementProductList(this.getQuery()).then(res => {
this.$Loading.finish();
this.tableData = res.records;
this.pageData.total = res.totalCount;
}, () => {
this.$Loading.finish();
});
},
pageChange(page) {
this.pageData.pageNo = page;
return this.search();
},
getQuery() {
return Object.assign(this.query, {
let params = _.toPairs(Object.assign(this.query, {
maxSortId: _.get(this.category, '[0].value'),
middleSortId: _.get(this.category, '[1].value'),
smallSortId: _.get(this.category, '[2].value')
});
}, this.pageData));
return _.fromPairs(params.filter(item => item[1]));
},
reset() {
this.category = [];
... ... @@ -84,26 +96,34 @@ export default {
this.search();
},
selectChange(selection) {
_.each(this.tableData, row => {
_.each(this.$refs.table.rebuildData, row => { // 更新rebuildData不会导致页面重新刷新
if (_.some(selection, item => item.id === row.id)) {
if (row.num <= 0) {
row.num = 1;
}
row._checked = true;
} else {
row._checked = false;
row.num = 0;
row._checked = false;
}
});
this.validBrand();
},
numChange(row, num) {
this.syncData();
row._checked = num > 0;
this.validBrand();
if ((row.num > 0 && !row._checked) ||
(row.num === 0 && row._checked)) {
if (row.brandId !== this.selectBrand.brandId && this.selectBrand.brandId) { // 如果品牌不同就直接操作table的rebuilddata不会导致表格刷新
row.num = 0;
this.$Message.warning(`请选择品牌为:${this.selectBrand.brandName}的商品补货`);
return;
}
this.syncData();
row._checked = num > 0;
this.validBrand();
}
},
validBrand() {
let selection = _.filter(this.tableData, row => row._checked);
let selection = _.filter(this.$refs.table.rebuildData, row => row._checked);
if (selection.length > 0) {
if (!this.selectBrand.brandId) {
... ... @@ -113,7 +133,12 @@ export default {
let rmRows = _.remove(selection, row => row.brandId !== this.selectBrand.brandId);
if (rmRows.length) {
_.each(rmRows, row => {
this.syncData(); // 重新建立table的data和数据data的引用关系然后修改_checked重新渲染表格
let rowDatas = _.map(rmRows, row => {
return _.find(this.tableData, item => item.id === row.id);
});
_.each(rowDatas, row => {
row._checked = false;
row.num = 0;
});
... ... @@ -135,14 +160,36 @@ export default {
this.tableData = this.$refs.table.rebuildData;
},
saveInvoice(invoiceId) {
let skus = this.tableData.filter(row => row._checked).map(row => {
this.syncData();
let goodsList = this.tableData.filter(row => row._checked).map(row => {
return {
productSku: row.productSku,
num: row.num
};
});
console.log(skus, invoiceId);
if (goodsList.length && invoiceId) {
this.$Loading.start();
return invoiceService.addGoods({
proRequisitionFormId: invoiceId,
goodsList
}).then(res => {
this.$Loading.finish();
if (res.code === 200) {
this.$Notice.success({
title: '保存成功'
});
this.search();
} else {
this.$Notice.error({
title: res.message
});
}
}, () => {
this.$Loading.finish();
});
}
this.$Message.warning('请选择商品和入库单');
}
},
components: {
... ...
/**
* Created by TaoHuang on 2017/5/25.
*/
import _ from 'lodash';
import request from 'axios';
const apiUrl = {
... ... @@ -18,7 +18,8 @@ const apiUrl = {
listAvailableProduct: '/erp/invoiceGoodsAvailable',
addGoods: '/erp/invoiceGoodsAdd',
updateGoods: '/erp/invoiceGoodsUpdate',
deleteGoods: 'erp/invoiceGoodsDelete'
deleteGoods: 'erp/invoiceGoodsDelete',
supplementProductList: '/erp/supplementProductList'
};
function listOrder(params) {
... ... @@ -100,6 +101,22 @@ function deleteGoods(params) {
.then(res => res.data);
}
function supplementProductList(params) {
return request.post(apiUrl.supplementProductList, params)
.then(res => {
if (res.data.code === 200) {
let records = _.get(res, 'data.data.records', []);
_.each(records, item => {
item.num = 0;
item._checked = false;
});
return res.data.data;
}
return {};
});
}
export default {
listProduct,
listOrder,
... ... @@ -114,5 +131,6 @@ export default {
listAvailableProduct,
addGoods,
updateGoods,
deleteGoods
deleteGoods,
supplementProductList
};
... ...