Merge remote-tracking branch 'origin/release/2.0' into feature/product-return
Showing
8 changed files
with
180 additions
and
134 deletions
1 | <template> | 1 | <template> |
2 | <LayoutBody> | 2 | <LayoutBody> |
3 | - <LayoutFilter> | ||
4 | - <FilterItem> | ||
5 | - </FilterItem> | ||
6 | - <FilterItem> | ||
7 | - </FilterItem> | ||
8 | - </LayoutFilter> | 3 | + <div> |
4 | + <Button type="primary" @click="back">返回发货物流列表</Button> | ||
5 | + <span>物流单号:{{id}}</span> | ||
6 | + <span>发货时间:{{sendTime}}</span> | ||
7 | + </div> | ||
9 | 8 | ||
10 | <LayoutAction> | 9 | <LayoutAction> |
11 | - | 10 | + 发往:{{storeroomName}} {{address}} {{adminName}} |
12 | </LayoutAction> | 11 | </LayoutAction> |
13 | 12 | ||
14 | <LayoutList> | 13 | <LayoutList> |
@@ -22,6 +21,8 @@ | @@ -22,6 +21,8 @@ | ||
22 | 21 | ||
23 | <script> | 22 | <script> |
24 | import service from 'services/express-service'; | 23 | import service from 'services/express-service'; |
24 | + import moment from 'moment'; | ||
25 | + import _ from 'lodash'; | ||
25 | 26 | ||
26 | export default { | 27 | export default { |
27 | props: ['id'], | 28 | props: ['id'], |
@@ -40,8 +41,14 @@ | @@ -40,8 +41,14 @@ | ||
40 | }, | 41 | }, |
41 | { | 42 | { |
42 | title: '商品图片', | 43 | title: '商品图片', |
43 | - key: 'storeroomName', | ||
44 | align: 'center', | 44 | align: 'center', |
45 | + render: (h, params) => { | ||
46 | + return ( | ||
47 | + <div> | ||
48 | + <img v-prod-img={params.row.skn}></img> | ||
49 | + </div> | ||
50 | + ); | ||
51 | + } | ||
45 | }, | 52 | }, |
46 | { | 53 | { |
47 | title: '商品名称', | 54 | title: '商品名称', |
@@ -58,8 +65,17 @@ | @@ -58,8 +65,17 @@ | ||
58 | } | 65 | } |
59 | }, | 66 | }, |
60 | { | 67 | { |
61 | - title: '订单号/已发数/入库数', | 68 | + title: '订单号/已发数', |
62 | align: 'center', | 69 | align: 'center', |
70 | + render: (h, params) => { | ||
71 | + return ( | ||
72 | + <div>{params.row.boList.map((i) => { | ||
73 | + return ( | ||
74 | + <div>{i.proRequisitionFormId}/{i.num}</div> | ||
75 | + ); | ||
76 | + })}</div> | ||
77 | + ); | ||
78 | + } | ||
63 | } | 79 | } |
64 | ], | 80 | ], |
65 | tableData: [], | 81 | tableData: [], |
@@ -67,19 +83,44 @@ | @@ -67,19 +83,44 @@ | ||
67 | current: 1, | 83 | current: 1, |
68 | pageSize: 20, | 84 | pageSize: 20, |
69 | total: 0 | 85 | total: 0 |
70 | - } | 86 | + }, |
87 | + id: null, | ||
88 | + time: null, | ||
89 | + storeroomName: null, | ||
90 | + address: null, | ||
91 | + adminName: null | ||
71 | }; | 92 | }; |
72 | }, | 93 | }, |
73 | mounted() { | 94 | mounted() { |
74 | - this.getExpress(this.$route.params.id); | 95 | + this.id = this.$route.params.id; |
96 | + this.time = this.$route.query.time; | ||
97 | + this.getExpress(this.id); | ||
98 | + }, | ||
99 | + computed: { | ||
100 | + sendTime() { | ||
101 | + return moment.unix(this.time).format('YYYY-MM-DD HH:mm:ss'); | ||
102 | + } | ||
75 | }, | 103 | }, |
76 | methods: { | 104 | methods: { |
77 | pageChange(num) { | 105 | pageChange(num) { |
78 | this.pageData.current = num; | 106 | this.pageData.current = num; |
79 | }, | 107 | }, |
80 | getExpress(id) { | 108 | getExpress(id) { |
81 | - return service.show({expressNumber: id}); | 109 | + return service.show({expressNumber: id}).then((result) => { |
110 | + if (result.code === 200) { | ||
111 | + this.tableData = result.data; | ||
112 | + this.storeroomName = _.first(this.tableData || {}).storeroomName; | ||
113 | + this.address = _.first(this.tableData || {}).address; | ||
114 | + this.adminName = _.first(this.tableData || {}).adminName; | ||
115 | + } | ||
116 | + }); | ||
117 | + }, | ||
118 | + back() { | ||
119 | + this.$router.push({ | ||
120 | + name: 'repository.express.list' | ||
121 | + }); | ||
82 | } | 122 | } |
123 | + | ||
83 | } | 124 | } |
84 | }; | 125 | }; |
85 | </script> | 126 | </script> |
@@ -21,14 +21,6 @@ | @@ -21,14 +21,6 @@ | ||
21 | :placeholder="filters.skuFactoryCode.holder" :maxlength="9"></Input> | 21 | :placeholder="filters.skuFactoryCode.holder" :maxlength="9"></Input> |
22 | </FilterItem> | 22 | </FilterItem> |
23 | 23 | ||
24 | - <FilterItem :label="filters.status.label"> | ||
25 | - <Select v-model.trim="filters.status.model"> | ||
26 | - <Option v-for="option in filters.status.options" | ||
27 | - :value="option.value" | ||
28 | - :key="option.value">{{option.label}}</Option> | ||
29 | - </Select> | ||
30 | - </FilterItem> | ||
31 | - | ||
32 | <FilterItem> | 24 | <FilterItem> |
33 | <Button type="primary" @click="getExpress">筛选</Button> | 25 | <Button type="primary" @click="getExpress">筛选</Button> |
34 | <Button @click="clearFilters">清空条件</Button> | 26 | <Button @click="clearFilters">清空条件</Button> |
@@ -87,31 +79,6 @@ | @@ -87,31 +79,6 @@ | ||
87 | holder: '', | 79 | holder: '', |
88 | fieldSpan: 18 | 80 | fieldSpan: 18 |
89 | }, | 81 | }, |
90 | - status: { | ||
91 | - label: '物流状态', | ||
92 | - labelSpan: 6, | ||
93 | - model: '', | ||
94 | - holder: '', | ||
95 | - fieldSpan: 18, | ||
96 | - options: [ | ||
97 | - { | ||
98 | - value: -1, | ||
99 | - label: '全部' | ||
100 | - }, | ||
101 | - { | ||
102 | - value: 10, | ||
103 | - label: '已发出' | ||
104 | - }, | ||
105 | - { | ||
106 | - value: 20, | ||
107 | - label: '已收货' | ||
108 | - }, | ||
109 | - { | ||
110 | - value: 41, | ||
111 | - label: '入库完成' | ||
112 | - } | ||
113 | - ] | ||
114 | - } | ||
115 | } | 82 | } |
116 | }; | 83 | }; |
117 | }, | 84 | }, |
@@ -124,7 +91,6 @@ | @@ -124,7 +91,6 @@ | ||
124 | this.filters.expressNumber.model = null; | 91 | this.filters.expressNumber.model = null; |
125 | this.filters.productSkn.model = null; | 92 | this.filters.productSkn.model = null; |
126 | this.filters.skuFactoryCode.model = null; | 93 | this.filters.skuFactoryCode.model = null; |
127 | - this.filters.status.model = -1; | ||
128 | this.pageData.current = 1; | 94 | this.pageData.current = 1; |
129 | this.pageData.total = 0; | 95 | this.pageData.total = 0; |
130 | 96 | ||
@@ -134,7 +100,7 @@ | @@ -134,7 +100,7 @@ | ||
134 | let params = {}; | 100 | let params = {}; |
135 | 101 | ||
136 | if (this.filters.id.model) { | 102 | if (this.filters.id.model) { |
137 | - params.id = this.filters.id.model; | 103 | + params.proReqFormId = this.filters.id.model; |
138 | } | 104 | } |
139 | 105 | ||
140 | if (this.filters.expressNumber.model) { | 106 | if (this.filters.expressNumber.model) { |
@@ -149,10 +115,6 @@ | @@ -149,10 +115,6 @@ | ||
149 | params.skuFactoryCode = this.filters.skuFactoryCode.model; | 115 | params.skuFactoryCode = this.filters.skuFactoryCode.model; |
150 | } | 116 | } |
151 | 117 | ||
152 | - if (this.filters.status.model !== -1) { | ||
153 | - params.status = this.filters.status.model; | ||
154 | - } | ||
155 | - | ||
156 | params.pageSize = this.pageData.pageSize; | 118 | params.pageSize = this.pageData.pageSize; |
157 | params.pageNo = this.pageData.current; | 119 | params.pageNo = this.pageData.current; |
158 | 120 | ||
@@ -169,11 +131,14 @@ | @@ -169,11 +131,14 @@ | ||
169 | } | 131 | } |
170 | }); | 132 | }); |
171 | }, | 133 | }, |
172 | - info(expressId) { | 134 | + info(data) { |
173 | this.$router.push({ | 135 | this.$router.push({ |
174 | name: 'repository.express.info', | 136 | name: 'repository.express.info', |
175 | params: { | 137 | params: { |
176 | - id: expressId | 138 | + id: data.expressNumber |
139 | + }, | ||
140 | + query: { | ||
141 | + time: data.createTime | ||
177 | } | 142 | } |
178 | }); | 143 | }); |
179 | } | 144 | } |
@@ -3,23 +3,36 @@ | @@ -3,23 +3,36 @@ | ||
3 | * @author: qi.li <qi.li@yoho.cn> | 3 | * @author: qi.li <qi.li@yoho.cn> |
4 | * @date: 2017/04/13 | 4 | * @date: 2017/04/13 |
5 | */ | 5 | */ |
6 | +import moment from 'moment'; | ||
6 | 7 | ||
7 | let tableCols = function() { | 8 | let tableCols = function() { |
8 | return [ | 9 | return [ |
9 | { | 10 | { |
10 | title: '物流单号', | 11 | title: '物流单号', |
11 | key: 'expressNumber', | 12 | key: 'expressNumber', |
12 | - align: 'center' | 13 | + align: 'center', |
14 | + render: (h, params) => { | ||
15 | + return ( | ||
16 | + <div> | ||
17 | + {params.row.expressNumber} ({params.row.expressName}) | ||
18 | + </div> | ||
19 | + ); | ||
20 | + } | ||
13 | }, | 21 | }, |
14 | { | 22 | { |
15 | title: '发货时间', | 23 | title: '发货时间', |
16 | key: 'createTime', | 24 | key: 'createTime', |
17 | - align: 'center' | ||
18 | - }, | ||
19 | - { | ||
20 | - title: '仓库', | ||
21 | - key: 'storeroomName', | ||
22 | align: 'center', | 25 | align: 'center', |
26 | + render: (h, params) => { | ||
27 | + let time = moment.unix(params.row.createTime); | ||
28 | + | ||
29 | + return ( | ||
30 | + <div> | ||
31 | + <div> {time.format('YYYY-MM-DD')} </div> | ||
32 | + <div> {time.format('HH:mm:ss')} </div> | ||
33 | + </div> | ||
34 | + ); | ||
35 | + } | ||
23 | }, | 36 | }, |
24 | { | 37 | { |
25 | title: '操作', | 38 | title: '操作', |
@@ -28,7 +41,7 @@ let tableCols = function() { | @@ -28,7 +41,7 @@ let tableCols = function() { | ||
28 | render: (h, params) => { | 41 | render: (h, params) => { |
29 | return ( | 42 | return ( |
30 | <div class="action-btn-row"> | 43 | <div class="action-btn-row"> |
31 | - <i-button type="primary" size="small" onClick={() => this.info(params.row.expressId)}>查看明细</i-button> | 44 | + <i-button type="primary" size="small" onClick={() => this.info(params.row)}>查看明细</i-button> |
32 | </div> | 45 | </div> |
33 | ); | 46 | ); |
34 | } | 47 | } |
@@ -3,11 +3,13 @@ import jit from './jit'; | @@ -3,11 +3,13 @@ import jit from './jit'; | ||
3 | import prodReturn from './return'; | 3 | import prodReturn from './return'; |
4 | import supplement from './supplement'; | 4 | import supplement from './supplement'; |
5 | import invoice from './invoice'; | 5 | import invoice from './invoice'; |
6 | +import express from './express'; | ||
6 | 7 | ||
7 | export default { | 8 | export default { |
8 | diff, | 9 | diff, |
9 | jit, | 10 | jit, |
10 | supplement, | 11 | supplement, |
11 | prodReturn, | 12 | prodReturn, |
12 | - invoice | 13 | + invoice, |
14 | + express | ||
13 | }; | 15 | }; |
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | class="in-store" | 3 | class="in-store" |
4 | width="700" | 4 | width="700" |
5 | v-model="showModal" | 5 | v-model="showModal" |
6 | + @on-cancel="modalCancel" | ||
6 | title="添加到入库单"> | 7 | title="添加到入库单"> |
7 | <div class="in-store-content"> | 8 | <div class="in-store-content"> |
8 | <p class="notice">* 请选择要添加的入库单</p> | 9 | <p class="notice">* 请选择要添加的入库单</p> |
@@ -10,6 +11,7 @@ | @@ -10,6 +11,7 @@ | ||
10 | ref="table" | 11 | ref="table" |
11 | v-if="loadingOk" | 12 | v-if="loadingOk" |
12 | height="300" | 13 | height="300" |
14 | + no-data-text="正在加载..." | ||
13 | :data="tableData" | 15 | :data="tableData" |
14 | :columns="tableColumn" | 16 | :columns="tableColumn" |
15 | @on-row-click="tableRowClick"></Table> | 17 | @on-row-click="tableRowClick"></Table> |
@@ -86,7 +88,6 @@ export default { | @@ -86,7 +88,6 @@ export default { | ||
86 | show() { | 88 | show() { |
87 | this.loadingData(); | 89 | this.loadingData(); |
88 | this.showModal = true; | 90 | this.showModal = true; |
89 | - this.loadingOk = true; | ||
90 | }, | 91 | }, |
91 | loadingData() { | 92 | loadingData() { |
92 | return supplierService.listOrder({ | 93 | return supplierService.listOrder({ |
@@ -134,6 +135,8 @@ export default { | @@ -134,6 +135,8 @@ export default { | ||
134 | .in-store-content { | 135 | .in-store-content { |
135 | .notice { | 136 | .notice { |
136 | color: #f30; | 137 | color: #f30; |
138 | + font-size: 14px; | ||
139 | + line-height: 30px; | ||
137 | } | 140 | } |
138 | } | 141 | } |
139 | </style> | 142 | </style> |
1 | import {CellImage, CellInfo, CellPrice} from 'components/cell'; // eslint-disable-line | 1 | import {CellImage, CellInfo, CellPrice} from 'components/cell'; // eslint-disable-line |
2 | +import timeFormat from 'filters/time-format'; | ||
2 | 3 | ||
3 | export default function() { | 4 | export default function() { |
4 | return { | 5 | return { |
@@ -22,55 +23,15 @@ export default function() { | @@ -22,55 +23,15 @@ export default function() { | ||
22 | sknFactoryCode: '', | 23 | sknFactoryCode: '', |
23 | skuFactoryCode: '', | 24 | skuFactoryCode: '', |
24 | prodName: '', | 25 | prodName: '', |
25 | - brandId: -1, | 26 | + brandId: '', |
26 | stockStatus: '' | 27 | stockStatus: '' |
27 | }, | 28 | }, |
28 | pageData: { | 29 | pageData: { |
29 | total: 0, | 30 | total: 0, |
30 | - current: 1, | 31 | + pageNo: 1, |
31 | pageSize: 20 | 32 | pageSize: 20 |
32 | }, | 33 | }, |
33 | - tableData: [{ | ||
34 | - id: 1, | ||
35 | - picImgUrl: 'http://img12.static.yhbimg.com/goodsimg/2017/05/09/09/028f8f329a40386d5cdbd966a92d0aaa0a.jpg?imageView2/0/w/78/h/78', | ||
36 | - productSkn: '123', | ||
37 | - productName: '123', | ||
38 | - brandName: '123', | ||
39 | - maxSortName: '123', | ||
40 | - middleSortName: '123', | ||
41 | - smallSortName: '123', | ||
42 | - retailPrice: '123', | ||
43 | - salesPrice: '123', | ||
44 | - saleStatus: '已上架', | ||
45 | - stock: '123', | ||
46 | - day: '123', | ||
47 | - buhuo: '123', | ||
48 | - time: 1492531200, | ||
49 | - store: '南京1号仓库', | ||
50 | - brandId: 248, | ||
51 | - _checked: false, | ||
52 | - num: 0 | ||
53 | - }, { | ||
54 | - id: 2, | ||
55 | - picImgUrl: 'http://img12.static.yhbimg.com/goodsimg/2017/05/09/09/028f8f329a40386d5cdbd966a92d0aaa0a.jpg?imageView2/0/w/78/h/78', | ||
56 | - productSkn: '123', | ||
57 | - productName: '123', | ||
58 | - brandName: '1232', | ||
59 | - maxSortName: '123', | ||
60 | - middleSortName: '123', | ||
61 | - smallSortName: '123', | ||
62 | - retailPrice: '123', | ||
63 | - salesPrice: '123', | ||
64 | - saleStatus: '已上架', | ||
65 | - stock: '123', | ||
66 | - day: '123', | ||
67 | - buhuo: '123', | ||
68 | - time: 1492531200, | ||
69 | - store: '南京1号仓库', | ||
70 | - brandId: 249, | ||
71 | - _checked: false, | ||
72 | - num: 0 | ||
73 | - }], | 34 | + tableData: [], |
74 | tableCols: [{ | 35 | tableCols: [{ |
75 | type: 'selection', | 36 | type: 'selection', |
76 | width: 60, | 37 | width: 60, |
@@ -81,14 +42,13 @@ export default function() { | @@ -81,14 +42,13 @@ export default function() { | ||
81 | align: 'center', | 42 | align: 'center', |
82 | render: (h, params) => { | 43 | render: (h, params) => { |
83 | return ( | 44 | return ( |
84 | - <CellImage | ||
85 | - imageSrc={params.row.picImgUrl} | ||
86 | - productUrl={params.row.productUrl}></CellImage> | 45 | + <img v-prod-img={params.row.productSkn}/> |
87 | ); | 46 | ); |
88 | } | 47 | } |
89 | }, { | 48 | }, { |
90 | title: '商品信息', | 49 | title: '商品信息', |
91 | align: 'center', | 50 | align: 'center', |
51 | + width: '15%', | ||
92 | render: (h, params) => { | 52 | render: (h, params) => { |
93 | return ( | 53 | return ( |
94 | <CellInfo items={[ | 54 | <CellInfo items={[ |
@@ -111,6 +71,7 @@ export default function() { | @@ -111,6 +71,7 @@ export default function() { | ||
111 | }, { | 71 | }, { |
112 | title: '价格(元)', | 72 | title: '价格(元)', |
113 | align: 'center', | 73 | align: 'center', |
74 | + width: '13%', | ||
114 | render: (h, params) => { | 75 | render: (h, params) => { |
115 | return ( | 76 | return ( |
116 | <CellInfo items={[ | 77 | <CellInfo items={[ |
@@ -119,34 +80,29 @@ export default function() { | @@ -119,34 +80,29 @@ export default function() { | ||
119 | value: params.row.retailPrice | 80 | value: params.row.retailPrice |
120 | }, { | 81 | }, { |
121 | label: '销售价', | 82 | label: '销售价', |
122 | - value: params.row.salesPrice | 83 | + value: params.row.salePrice |
123 | } | 84 | } |
124 | ]}></CellInfo> | 85 | ]}></CellInfo> |
125 | ); | 86 | ); |
126 | } | 87 | } |
127 | }, { | 88 | }, { |
128 | - title: '销售状态', | ||
129 | - key: 'saleStatus' | ||
130 | - }, { | ||
131 | title: '仓库库存', | 89 | title: '仓库库存', |
132 | key: 'stock' | 90 | key: 'stock' |
133 | }, { | 91 | }, { |
134 | title: '库存可售天数', | 92 | title: '库存可售天数', |
135 | - key: 'day' | 93 | + key: 'saleDays' |
136 | }, { | 94 | }, { |
137 | title: '建议补货数', | 95 | title: '建议补货数', |
138 | - key: 'buhuo' | 96 | + key: 'supplementNums' |
139 | }, { | 97 | }, { |
140 | title: '最近一次补货时间', | 98 | title: '最近一次补货时间', |
99 | + width: 150, | ||
141 | render: (h, params) => { | 100 | render: (h, params) => { |
142 | return ( | 101 | return ( |
143 | - <span>{params.row.time}</span> | 102 | + <span>{timeFormat(params.row.lastTime)}</span> |
144 | ); | 103 | ); |
145 | } | 104 | } |
146 | }, { | 105 | }, { |
147 | - title: '仓库', | ||
148 | - key: 'store' | ||
149 | - }, { | ||
150 | title: '补货数', | 106 | title: '补货数', |
151 | render: (h, params) => { | 107 | render: (h, params) => { |
152 | return ( | 108 | return ( |
@@ -154,6 +110,7 @@ export default function() { | @@ -154,6 +110,7 @@ export default function() { | ||
154 | max={999} | 110 | max={999} |
155 | min={0} | 111 | min={0} |
156 | value={params.row.num} | 112 | value={params.row.num} |
113 | + style={{width: '60px'}} | ||
157 | onInput={val => (params.row.num = val)} | 114 | onInput={val => (params.row.num = val)} |
158 | onOn-change={val => (this.numChange(params.row, val))}></Input-number> | 115 | onOn-change={val => (this.numChange(params.row, val))}></Input-number> |
159 | ); | 116 | ); |
@@ -43,9 +43,9 @@ | @@ -43,9 +43,9 @@ | ||
43 | @on-selection-change="selectChange"></Table> | 43 | @on-selection-change="selectChange"></Table> |
44 | <Page | 44 | <Page |
45 | :total="pageData.total" | 45 | :total="pageData.total" |
46 | - :current="pageData.current" | 46 | + :current="pageData.pageNo" |
47 | @on-change="pageChange" | 47 | @on-change="pageChange" |
48 | - :page-size="20" | 48 | + :page-size="pageData.pageSize" |
49 | show-total></Page> | 49 | show-total></Page> |
50 | </LayoutList> | 50 | </LayoutList> |
51 | <ModalInvoice ref="modalInvoice" @save="saveInvoice" :brand="selectBrand.brandId"></ModalInvoice> | 51 | <ModalInvoice ref="modalInvoice" @save="saveInvoice" :brand="selectBrand.brandId"></ModalInvoice> |
@@ -56,7 +56,7 @@ | @@ -56,7 +56,7 @@ | ||
56 | import _ from 'lodash'; | 56 | import _ from 'lodash'; |
57 | import {SelectBrand, SelectCategory} from 'components/select'; | 57 | import {SelectBrand, SelectCategory} from 'components/select'; |
58 | import {ModalInvoice} from './components'; | 58 | import {ModalInvoice} from './components'; |
59 | -import supplierService from 'supplier-service'; | 59 | +import invoiceService from 'invoice-service'; |
60 | import store from './store'; | 60 | import store from './store'; |
61 | 61 | ||
62 | export default { | 62 | export default { |
@@ -64,19 +64,31 @@ export default { | @@ -64,19 +64,31 @@ export default { | ||
64 | return store.apply(this); | 64 | return store.apply(this); |
65 | }, | 65 | }, |
66 | created() { | 66 | created() { |
67 | + return this.search(); | ||
67 | }, | 68 | }, |
68 | methods: { | 69 | methods: { |
69 | search() { | 70 | search() { |
70 | - return supplierService.supplementProductList(this.getQuery()).then(res => { | ||
71 | - console.log(res); | 71 | + this.$Loading.start(); |
72 | + return invoiceService.supplementProductList(this.getQuery()).then(res => { | ||
73 | + this.$Loading.finish(); | ||
74 | + this.tableData = res.records; | ||
75 | + this.pageData.total = res.totalCount; | ||
76 | + }, () => { | ||
77 | + this.$Loading.finish(); | ||
72 | }); | 78 | }); |
73 | }, | 79 | }, |
80 | + pageChange(page) { | ||
81 | + this.pageData.pageNo = page; | ||
82 | + return this.search(); | ||
83 | + }, | ||
74 | getQuery() { | 84 | getQuery() { |
75 | - return Object.assign(this.query, { | 85 | + let params = _.toPairs(Object.assign(this.query, { |
76 | maxSortId: _.get(this.category, '[0].value'), | 86 | maxSortId: _.get(this.category, '[0].value'), |
77 | middleSortId: _.get(this.category, '[1].value'), | 87 | middleSortId: _.get(this.category, '[1].value'), |
78 | smallSortId: _.get(this.category, '[2].value') | 88 | smallSortId: _.get(this.category, '[2].value') |
79 | - }); | 89 | + }, this.pageData)); |
90 | + | ||
91 | + return _.fromPairs(params.filter(item => item[1])); | ||
80 | }, | 92 | }, |
81 | reset() { | 93 | reset() { |
82 | this.category = []; | 94 | this.category = []; |
@@ -84,26 +96,34 @@ export default { | @@ -84,26 +96,34 @@ export default { | ||
84 | this.search(); | 96 | this.search(); |
85 | }, | 97 | }, |
86 | selectChange(selection) { | 98 | selectChange(selection) { |
87 | - _.each(this.tableData, row => { | 99 | + _.each(this.$refs.table.rebuildData, row => { // 更新rebuildData不会导致页面重新刷新 |
88 | if (_.some(selection, item => item.id === row.id)) { | 100 | if (_.some(selection, item => item.id === row.id)) { |
89 | if (row.num <= 0) { | 101 | if (row.num <= 0) { |
90 | row.num = 1; | 102 | row.num = 1; |
91 | } | 103 | } |
92 | row._checked = true; | 104 | row._checked = true; |
93 | } else { | 105 | } else { |
94 | - row._checked = false; | ||
95 | row.num = 0; | 106 | row.num = 0; |
107 | + row._checked = false; | ||
96 | } | 108 | } |
97 | }); | 109 | }); |
98 | this.validBrand(); | 110 | this.validBrand(); |
99 | }, | 111 | }, |
100 | numChange(row, num) { | 112 | numChange(row, num) { |
113 | + if ((row.num > 0 && !row._checked) || | ||
114 | + (row.num === 0 && row._checked)) { | ||
115 | + if (row.brandId !== this.selectBrand.brandId && this.selectBrand.brandId) { // 如果品牌不同就直接操作table的rebuilddata不会导致表格刷新 | ||
116 | + row.num = 0; | ||
117 | + this.$Message.warning(`请选择品牌为:${this.selectBrand.brandName}的商品补货`); | ||
118 | + return; | ||
119 | + } | ||
101 | this.syncData(); | 120 | this.syncData(); |
102 | row._checked = num > 0; | 121 | row._checked = num > 0; |
103 | this.validBrand(); | 122 | this.validBrand(); |
123 | + } | ||
104 | }, | 124 | }, |
105 | validBrand() { | 125 | validBrand() { |
106 | - let selection = _.filter(this.tableData, row => row._checked); | 126 | + let selection = _.filter(this.$refs.table.rebuildData, row => row._checked); |
107 | 127 | ||
108 | if (selection.length > 0) { | 128 | if (selection.length > 0) { |
109 | if (!this.selectBrand.brandId) { | 129 | if (!this.selectBrand.brandId) { |
@@ -113,7 +133,12 @@ export default { | @@ -113,7 +133,12 @@ export default { | ||
113 | let rmRows = _.remove(selection, row => row.brandId !== this.selectBrand.brandId); | 133 | let rmRows = _.remove(selection, row => row.brandId !== this.selectBrand.brandId); |
114 | 134 | ||
115 | if (rmRows.length) { | 135 | if (rmRows.length) { |
116 | - _.each(rmRows, row => { | 136 | + this.syncData(); // 重新建立table的data和数据data的引用关系然后修改_checked重新渲染表格 |
137 | + let rowDatas = _.map(rmRows, row => { | ||
138 | + return _.find(this.tableData, item => item.id === row.id); | ||
139 | + }); | ||
140 | + | ||
141 | + _.each(rowDatas, row => { | ||
117 | row._checked = false; | 142 | row._checked = false; |
118 | row.num = 0; | 143 | row.num = 0; |
119 | }); | 144 | }); |
@@ -135,14 +160,36 @@ export default { | @@ -135,14 +160,36 @@ export default { | ||
135 | this.tableData = this.$refs.table.rebuildData; | 160 | this.tableData = this.$refs.table.rebuildData; |
136 | }, | 161 | }, |
137 | saveInvoice(invoiceId) { | 162 | saveInvoice(invoiceId) { |
138 | - let skus = this.tableData.filter(row => row._checked).map(row => { | 163 | + this.syncData(); |
164 | + let goodsList = this.tableData.filter(row => row._checked).map(row => { | ||
139 | return { | 165 | return { |
140 | productSku: row.productSku, | 166 | productSku: row.productSku, |
141 | num: row.num | 167 | num: row.num |
142 | }; | 168 | }; |
143 | }); | 169 | }); |
144 | 170 | ||
145 | - console.log(skus, invoiceId); | 171 | + if (goodsList.length && invoiceId) { |
172 | + this.$Loading.start(); | ||
173 | + return invoiceService.addGoods({ | ||
174 | + proRequisitionFormId: invoiceId, | ||
175 | + goodsList | ||
176 | + }).then(res => { | ||
177 | + this.$Loading.finish(); | ||
178 | + if (res.code === 200) { | ||
179 | + this.$Notice.success({ | ||
180 | + title: '保存成功' | ||
181 | + }); | ||
182 | + this.search(); | ||
183 | + } else { | ||
184 | + this.$Notice.error({ | ||
185 | + title: res.message | ||
186 | + }); | ||
187 | + } | ||
188 | + }, () => { | ||
189 | + this.$Loading.finish(); | ||
190 | + }); | ||
191 | + } | ||
192 | + this.$Message.warning('请选择商品和入库单'); | ||
146 | } | 193 | } |
147 | }, | 194 | }, |
148 | components: { | 195 | components: { |
1 | /** | 1 | /** |
2 | * Created by TaoHuang on 2017/5/25. | 2 | * Created by TaoHuang on 2017/5/25. |
3 | */ | 3 | */ |
4 | - | 4 | +import _ from 'lodash'; |
5 | import request from 'axios'; | 5 | import request from 'axios'; |
6 | 6 | ||
7 | const apiUrl = { | 7 | const apiUrl = { |
@@ -18,7 +18,8 @@ const apiUrl = { | @@ -18,7 +18,8 @@ const apiUrl = { | ||
18 | listAvailableProduct: '/erp/invoiceGoodsAvailable', | 18 | listAvailableProduct: '/erp/invoiceGoodsAvailable', |
19 | addGoods: '/erp/invoiceGoodsAdd', | 19 | addGoods: '/erp/invoiceGoodsAdd', |
20 | updateGoods: '/erp/invoiceGoodsUpdate', | 20 | updateGoods: '/erp/invoiceGoodsUpdate', |
21 | - deleteGoods: 'erp/invoiceGoodsDelete' | 21 | + deleteGoods: 'erp/invoiceGoodsDelete', |
22 | + supplementProductList: '/erp/supplementProductList' | ||
22 | }; | 23 | }; |
23 | 24 | ||
24 | function listOrder(params) { | 25 | function listOrder(params) { |
@@ -100,6 +101,22 @@ function deleteGoods(params) { | @@ -100,6 +101,22 @@ function deleteGoods(params) { | ||
100 | .then(res => res.data); | 101 | .then(res => res.data); |
101 | } | 102 | } |
102 | 103 | ||
104 | +function supplementProductList(params) { | ||
105 | + return request.post(apiUrl.supplementProductList, params) | ||
106 | + .then(res => { | ||
107 | + if (res.data.code === 200) { | ||
108 | + let records = _.get(res, 'data.data.records', []); | ||
109 | + | ||
110 | + _.each(records, item => { | ||
111 | + item.num = 0; | ||
112 | + item._checked = false; | ||
113 | + }); | ||
114 | + return res.data.data; | ||
115 | + } | ||
116 | + return {}; | ||
117 | + }); | ||
118 | +} | ||
119 | + | ||
103 | export default { | 120 | export default { |
104 | listProduct, | 121 | listProduct, |
105 | listOrder, | 122 | listOrder, |
@@ -114,5 +131,6 @@ export default { | @@ -114,5 +131,6 @@ export default { | ||
114 | listAvailableProduct, | 131 | listAvailableProduct, |
115 | addGoods, | 132 | addGoods, |
116 | updateGoods, | 133 | updateGoods, |
117 | - deleteGoods | 134 | + deleteGoods, |
135 | + supplementProductList | ||
118 | }; | 136 | }; |
-
Please register or login to post a comment