Authored by 李奇

商品退库修改

@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 return store.apply(this); 25 return store.apply(this);
26 }, 26 },
27 created() { 27 created() {
28 - const returnId = this.$route.params.returnId; 28 + const returnId = this.$route.params.id;
29 const supplierId = this.$route.params.supplierId; 29 const supplierId = this.$route.params.supplierId;
30 const supplierName = this.$route.params.supplierName; 30 const supplierName = this.$route.params.supplierName;
31 const params = { supplierId, returnedSupplierId: returnId }; 31 const params = { supplierId, returnedSupplierId: returnId };
@@ -2,28 +2,24 @@ @@ -2,28 +2,24 @@
2 <LayoutBody> 2 <LayoutBody>
3 <LayoutFilter> 3 <LayoutFilter>
4 <FilterItem :label="filters.sknCode.label"> 4 <FilterItem :label="filters.sknCode.label">
5 - <Input v-model.trim.number="filters.sknCode.model"  
6 - :placeholder="filters.sknCode.holder" :maxlength="9"></Input> 5 + <Input v-model.trim.number="filters.sknCode.model" :maxlength="9"></Input>
7 </FilterItem> 6 </FilterItem>
8 <FilterItem :label="filters.skuCode.label"> 7 <FilterItem :label="filters.skuCode.label">
9 - <Input v-model.trim.number="filters.skuCode.model"  
10 - :placeholder="filters.skuCode.holder" :maxlength="9"></Input> 8 + <Input v-model.trim.number="filters.skuCode.model" :maxlength="9"></Input>
11 </FilterItem> 9 </FilterItem>
12 <FilterItem :label="filters.prodBarCode.label"> 10 <FilterItem :label="filters.prodBarCode.label">
13 - <Input v-model.trim.number="filters.prodBarCode.model"  
14 - :placeholder="filters.prodBarCode.holder" :maxlength="9"></Input> 11 + <Input v-model.trim="filters.prodBarCode.model"></Input>
15 </FilterItem> 12 </FilterItem>
16 <FilterItem :label="filters.reqNum.label"> 13 <FilterItem :label="filters.reqNum.label">
17 - <Input v-model.trim.number="filters.reqNum.model"  
18 - :placeholder="filters.reqNum.holder" :maxlength="9"></Input> 14 + <Input v-model.trim.number="filters.reqNum.model" :maxlength="9"></Input>
19 </FilterItem> 15 </FilterItem>
20 - <FilterItem :label="filters.reqTime.label">  
21 - <Input v-model.trim.number="filters.reqTime.model"  
22 - :placeholder="filters.reqTime.holder" :maxlength="9"></Input> 16 + <FilterItem :label="filters.createTime.label">
  17 + <Date-picker type="datetimerange" placeholder="选择日期和时间"
  18 + @on-change="createTimeChange"></Date-picker>
23 </FilterItem> 19 </FilterItem>
24 - <FilterItem :label="filters.resTime.label">  
25 - <Input v-model.trim.number="filters.resTime.model"  
26 - :placeholder="filters.resTime.holder" :maxlength="9"></Input> 20 + <FilterItem :label="filters.outTime.label">
  21 + <Date-picker type="datetimerange" placeholder="选择日期和时间"
  22 + @on-change="outTimeChange"></Date-picker>
27 </FilterItem> 23 </FilterItem>
28 <FilterItem> 24 <FilterItem>
29 <Button type="primary" @click="filterSearch">筛选</Button> 25 <Button type="primary" @click="filterSearch">筛选</Button>
@@ -42,6 +38,7 @@ @@ -42,6 +38,7 @@
42 38
43 <script> 39 <script>
44 import _ from 'lodash'; 40 import _ from 'lodash';
  41 + import moment from 'moment';
45 import rs from 'return-service'; 42 import rs from 'return-service';
46 import listStore from './store/list'; 43 import listStore from './store/list';
47 44
@@ -59,31 +56,21 @@ @@ -59,31 +56,21 @@
59 size: 20 56 size: 20
60 }; 57 };
61 const fields = this.filters; 58 const fields = this.filters;
62 - const keyMap = { 59 + const keysMap = {
63 productSkn: 'sknCode', 60 productSkn: 'sknCode',
64 - sknFactoryCode: 'prodCode',  
65 - status: 'saleStatus',  
66 - productVipStatus: 'priceStatus',  
67 - skuFactoryCode: 'prodBarCode',  
68 - stock: 'stockStatus',  
69 - maxSortId: 'maxSort',  
70 - middleSortId: 'midSort',  
71 - smallSortId: 'minSort' 61 + productSku: 'skuCode',
  62 + factoryCode: 'prodBarCode',
  63 + returnedSupplierId: 'reqNum',
  64 + bCreateTime: 'bCreateTime',
  65 + eCreateTime: 'eCreateTime',
  66 + bOutTime: 'bOutTime',
  67 + eOutTime: 'eOutTime'
72 }; 68 };
73 - const selectKeys = ['status', 'stock', 'productVipStatus'];  
74 69
75 if (this.enableFilter) { 70 if (this.enableFilter) {
76 - _.each(keyMap, (val, key) => { 71 + _.each(keysMap, (val, key) => {
77 values[key] = fields[val].model; 72 values[key] = fields[val].model;
78 }); 73 });
79 -  
80 - _.each(selectKeys, key => {  
81 - const val = values[key];  
82 -  
83 - if (val === -1) {  
84 - values[key] = null;  
85 - }  
86 - });  
87 } 74 }
88 return values; 75 return values;
89 }, 76 },
@@ -97,22 +84,59 @@ @@ -97,22 +84,59 @@
97 }, 84 },
98 clearFilter() { 85 clearFilter() {
99 }, 86 },
  87 + createTimeChange(time) {
  88 + // 兼容: https://github.com/iview/iview/issues/973
  89 + if (!_.isArray(time)) {
  90 + time = time.split(' - ');
  91 + }
  92 + this.filters.bCreateTime.model = +moment(time[0]).format('X');
  93 + this.filters.eCreateTime.model = +moment(time[1]).format('X');
  94 + },
  95 + outTimeChange(time) {
  96 + // 兼容: https://github.com/iview/iview/issues/973
  97 + if (!_.isArray(time)) {
  98 + time = time.split(' - ');
  99 + }
  100 + this.filters.bOutTime.model = +moment(time[0]).format('X');
  101 + this.filters.eOutTime.model = +moment(time[1]).format('X');
  102 + },
100 returnList(params) { 103 returnList(params) {
  104 + const isValid = this.checkParams(params);
  105 +
  106 + if (isValid) {
  107 + this.$Loading.start();
  108 + rs.list(params)
  109 + .then(res => {
  110 + this.$Loading.finish();
  111 + if (res.code === 200) {
  112 + this.resolveData(res.data);
  113 + }
  114 + });
  115 + }
  116 + },
  117 + checkParams(params) {
101 if (_.isObject(params) && 118 if (_.isObject(params) &&
102 typeof params.productSkn !== 'undefined' && 119 typeof params.productSkn !== 'undefined' &&
103 !_.isFinite(+params.productSkn)) { 120 !_.isFinite(+params.productSkn)) {
104 this.$Message.error('SKN编码只能是数字', 3); 121 this.$Message.error('SKN编码只能是数字', 3);
105 - return; 122 + return false;
106 } 123 }
107 124
108 - this.$Loading.start();  
109 - rs.list()  
110 - .then(res => {  
111 - this.$Loading.finish();  
112 - if (res.code === 200) {  
113 - this.resolveData(res.data);  
114 - }  
115 - }); 125 + if (_.isObject(params) &&
  126 + typeof params.productSku !== 'undefined' &&
  127 + !_.isFinite(+params.productSku)) {
  128 + this.$Message.error('SKU编码只能是数字', 3);
  129 + return false;
  130 + }
  131 +
  132 + if (_.isObject(params) &&
  133 + typeof params.returnedSupplierId !== 'undefined' &&
  134 + !_.isFinite(+params.returnedSupplierId)) {
  135 + this.$Message.error('请退单号只能是数字', 3);
  136 + return false;
  137 + }
  138 +
  139 + return true;
116 }, 140 },
117 resolveData(data) { 141 resolveData(data) {
118 this.dataList = data.records; 142 this.dataList = data.records;
@@ -136,9 +160,9 @@ @@ -136,9 +160,9 @@
136 this.$router.push({ 160 this.$router.push({
137 name: 'repository.prodReturn.detail', 161 name: 'repository.prodReturn.detail',
138 params: { 162 params: {
139 - returnId,  
140 supplierId, 163 supplierId,
141 - supplierName 164 + supplierName,
  165 + id: returnId
142 } 166 }
143 }); 167 });
144 168
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 * @author: qi.li <qi.li@yoho.cn> 3 * @author: qi.li <qi.li@yoho.cn>
4 * @date: 2017/06/01 4 * @date: 2017/06/01
5 */ 5 */
  6 +import timeFormat from 'filters/time-format';
6 7
7 export default function() { 8 export default function() {
8 return { 9 return {
@@ -39,7 +40,13 @@ export default function() { @@ -39,7 +40,13 @@ export default function() {
39 { 40 {
40 title: '条码', 41 title: '条码',
41 align: 'center', 42 align: 'center',
42 - key: 'factoryCode' 43 + render: (h, params) => {
  44 + const row = params.row;
  45 +
  46 + return (
  47 + <span>{row.factoryCode || '-'}</span>
  48 + );
  49 + }
43 }, 50 },
44 { 51 {
45 title: '品牌', 52 title: '品牌',
@@ -84,12 +91,24 @@ export default function() { @@ -84,12 +91,24 @@ export default function() {
84 { 91 {
85 title: '退货原因', 92 title: '退货原因',
86 align: 'center', 93 align: 'center',
87 - key: 'returndReason' 94 + render: (h, params) => {
  95 + const row = params.row;
  96 +
  97 + return (
  98 + <span>{row.returndReason || '-'}</span>
  99 + );
  100 + }
88 }, 101 },
89 { 102 {
90 title: '物流单号', 103 title: '物流单号',
91 align: 'center', 104 align: 'center',
92 - key: 'expressCode' 105 + render: (h, params) => {
  106 + const row = params.row;
  107 +
  108 + return (
  109 + <span>{row.expressCode || '-'}</span>
  110 + );
  111 + }
93 }, 112 },
94 { 113 {
95 title: '承担方', 114 title: '承担方',
@@ -99,12 +118,20 @@ export default function() { @@ -99,12 +118,20 @@ export default function() {
99 { 118 {
100 title: '请退时间', 119 title: '请退时间',
101 align: 'center', 120 align: 'center',
102 - key: 'createTime' 121 + render: (h, params) => {
  122 + return (
  123 + <span>{timeFormat(params.row.createTime)}</span>
  124 + );
  125 + }
103 }, 126 },
104 { 127 {
105 title: '退库时间', 128 title: '退库时间',
106 align: 'center', 129 align: 'center',
107 - key: 'outTime' 130 + render: (h, params) => {
  131 + return (
  132 + <span>{timeFormat(params.row.outTime)}</span>
  133 + );
  134 + }
108 } 135 }
109 ], 136 ],
110 dataList: [] 137 dataList: []
@@ -6,51 +6,47 @@ @@ -6,51 +6,47 @@
6 6
7 import timeFormat from 'filters/time-format'; 7 import timeFormat from 'filters/time-format';
8 8
9 -const statusMap = {  
10 - 10: 'todo'  
11 -};  
12 -  
13 export default function() { 9 export default function() {
14 return { 10 return {
  11 + enableFilter: false,
15 filters: { 12 filters: {
16 sknCode: { 13 sknCode: {
17 label: 'SKN编码', 14 label: 'SKN编码',
18 - model: '',  
19 - holder: '' 15 + model: ''
20 }, 16 },
21 skuCode: { 17 skuCode: {
22 label: 'SKU编码', 18 label: 'SKU编码',
23 - model: '',  
24 - holder: '' 19 + model: ''
25 }, 20 },
26 prodBarCode: { 21 prodBarCode: {
27 label: '商品条码', 22 label: '商品条码',
28 - model: '',  
29 - holder: '' 23 + model: ''
30 }, 24 },
31 reqNum: { 25 reqNum: {
32 label: '请退单号', 26 label: '请退单号',
33 - model: '',  
34 - holder: ''  
35 - },  
36 - reqTime: {  
37 - label: '请退时间',  
38 - model: '',  
39 - holder: ''  
40 - },  
41 - resTime: {  
42 - label: '退库时间',  
43 - model: '',  
44 - holder: ''  
45 - } 27 + model: ''
  28 + },
  29 + createTime: {
  30 + label: '请退时间'
  31 + },
  32 + bCreateTime: {
  33 + model: ''
  34 + },
  35 + eCreateTime: {
  36 + model: ''
  37 + },
  38 + outTime: {
  39 + label: '退库时间'
  40 + },
  41 + bOutTime: {
  42 + model: ''
  43 + },
  44 + eOutTime: {
  45 + model: ''
  46 + },
46 }, 47 },
47 columns: [ 48 columns: [
48 { 49 {
49 - type: 'selection',  
50 - width: 60,  
51 - align: 'center'  
52 - },  
53 - {  
54 title: '请退单号', 50 title: '请退单号',
55 align: 'center', 51 align: 'center',
56 key: 'returnedSupplierId' 52 key: 'returnedSupplierId'
@@ -105,7 +101,7 @@ export default function() { @@ -105,7 +101,7 @@ export default function() {
105 align: 'center', 101 align: 'center',
106 render(h, params) { 102 render(h, params) {
107 return ( 103 return (
108 - <span>{statusMap[params.row.status]}</span> 104 + <span>{params.row.statusName}</span>
109 ); 105 );
110 } 106 }
111 }, 107 },
@@ -113,8 +109,13 @@ export default function() { @@ -113,8 +109,13 @@ export default function() {
113 title: '请退/退库时间', 109 title: '请退/退库时间',
114 align: 'center', 110 align: 'center',
115 render: (h, params) => { 111 render: (h, params) => {
  112 + const row = params.row;
  113 +
116 return ( 114 return (
117 - <span>{timeFormat(params.row.createTime)}</span> 115 + <div>
  116 + <p>请退时间:<span>{timeFormat(row.createTime)}</span></p>
  117 + <p>退库时间:<span>{timeFormat(row.outTime)}</span></p>
  118 + </div>
118 ); 119 );
119 } 120 }
120 }, 121 },
@@ -16,8 +16,8 @@ let domainApis = { @@ -16,8 +16,8 @@ let domainApis = {
16 allotExpressCompList: '/erp-shop-web/express/getExpressList', 16 allotExpressCompList: '/erp-shop-web/express/getExpressList',
17 allotExportList: '/erp-shop-web/export/exportForPurchaseForm', 17 allotExportList: '/erp-shop-web/export/exportForPurchaseForm',
18 allotPrintExpressDetail: '/erp-shop-web/purchase/queryExpressListByExpressNumber', 18 allotPrintExpressDetail: '/erp-shop-web/purchase/queryExpressListByExpressNumber',
19 - returnSupplierList: '/erp-shop-web/logistics/returnedSupploer/list',  
20 - returnSupplierDetail: '/erp-shop-web/logistics/returnedSupploer/detail', 19 + returnSupplierList: '/erp-shop-web/logistics/returnedSupplier/list',
  20 + returnSupplierDetail: '/erp-shop-web/logistics/returnedSupplier/detail',
21 jitProductList: '/erp-shop-web/product/jitProductList', 21 jitProductList: '/erp-shop-web/product/jitProductList',
22 getJitStorageListBySkn: '/erp-shop-web/product/getJitStorageListBySkn', 22 getJitStorageListBySkn: '/erp-shop-web/product/getJitStorageListBySkn',
23 importJitStorage: '/erp-shop-web/product/importJitStorage', 23 importJitStorage: '/erp-shop-web/product/importJitStorage',