Authored by htoooth

fix

@@ -9,6 +9,6 @@ export default { @@ -9,6 +9,6 @@ export default {
9 name: 'jit', 9 name: 'jit',
10 component: page, 10 component: page,
11 meta: { 11 meta: {
12 - pageName: '在售商品' 12 + pageName: '可调拨库存'
13 } 13 }
14 }; 14 };
@@ -9,10 +9,6 @@ @@ -9,10 +9,6 @@
9 <Input v-model.trim="filters.prodCode.model" 9 <Input v-model.trim="filters.prodCode.model"
10 :placeholder="filters.prodCode.holder"></Input> 10 :placeholder="filters.prodCode.holder"></Input>
11 </FilterItem> 11 </FilterItem>
12 - <FilterItem :label="filters.prodCode.label">  
13 - <Input v-model.trim="filters.prodCode.model"  
14 - :placeholder="filters.prodCode.holder"></Input>  
15 - </FilterItem>  
16 <FilterItem :label="filters.prodName.label"> 12 <FilterItem :label="filters.prodName.label">
17 <Input v-model.trim="filters.prodName.model" 13 <Input v-model.trim="filters.prodName.model"
18 :placeholder="filters.prodName.holder"></Input> 14 :placeholder="filters.prodName.holder"></Input>
@@ -21,6 +17,11 @@ @@ -21,6 +17,11 @@
21 <Input v-model.trim="filters.prodBarCode.model" 17 <Input v-model.trim="filters.prodBarCode.model"
22 :placeholder="filters.prodBarCode.holder"></Input> 18 :placeholder="filters.prodBarCode.holder"></Input>
23 </FilterItem> 19 </FilterItem>
  20 +
  21 + <FilterItem label="选择类目">
  22 + <SelectCategory :value="categoryValue" @select-change="sortChange"></SelectCategory>
  23 + </FilterItem>
  24 +
24 <FilterItem label="选择品牌"> 25 <FilterItem label="选择品牌">
25 <SelectBrand @on-change="brandChange" 26 <SelectBrand @on-change="brandChange"
26 :field-label="filters.brand.label" 27 :field-label="filters.brand.label"
@@ -30,13 +31,6 @@ @@ -30,13 +31,6 @@
30 :option-list="filters.brand.options"> 31 :option-list="filters.brand.options">
31 </SelectBrand> 32 </SelectBrand>
32 </FilterItem> 33 </FilterItem>
33 - <FilterItem :label="filters.verifyStatus.label">  
34 - <Select v-model.trim="filters.verifyStatus.model">  
35 - <Option v-for="option in filters.verifyStatus.options"  
36 - :value="option.value"  
37 - :key="option.value">{{option.label}}</Option>  
38 - </Select>  
39 - </FilterItem>  
40 <FilterItem :label="filters.stockStatus.label"> 34 <FilterItem :label="filters.stockStatus.label">
41 <Select v-model.trim="filters.stockStatus.model"> 35 <Select v-model.trim="filters.stockStatus.model">
42 <Option v-for="option in filters.stockStatus.options" 36 <Option v-for="option in filters.stockStatus.options"
@@ -44,59 +38,49 @@ @@ -44,59 +38,49 @@
44 :key="option.value">{{option.label}}</Option> 38 :key="option.value">{{option.label}}</Option>
45 </Select> 39 </Select>
46 </FilterItem> 40 </FilterItem>
47 - <FilterItem label="选择类目">  
48 - <SelectCategory :value="categoryValue" @select-change="sortChange"></SelectCategory>  
49 - </FilterItem>  
50 <FilterItem> 41 <FilterItem>
51 <Button type="primary" @click="filterSearch">筛选</Button> 42 <Button type="primary" @click="filterSearch">筛选</Button>
52 <Button @click="clearFilter">清空条件</Button> 43 <Button @click="clearFilter">清空条件</Button>
53 </FilterItem> 44 </FilterItem>
54 </LayoutFilter> 45 </LayoutFilter>
55 46
56 - <LayoutAction>  
57 - <Button type="error" @click="batchSetOffSale">下架</Button>  
58 - </LayoutAction>  
59 -  
60 <LayoutList> 47 <LayoutList>
61 <Table border :context="self" :columns="tableCols" :data="tableData" @on-selection-change="selectChange"></Table> 48 <Table border :context="self" :columns="tableCols" :data="tableData" @on-selection-change="selectChange"></Table>
62 <Page :total="pageData.total" :current="pageData.current" 49 <Page :total="pageData.total" :current="pageData.current"
63 @on-change="pageChange" :page-size="20" show-total></Page> 50 @on-change="pageChange" :page-size="20" show-total></Page>
64 </LayoutList> 51 </LayoutList>
65 52
66 - <SizeEdit ref="showSizeEdit" :show="showSizeEdit"></SizeEdit> 53 + <EditStore ref="showStoreEdit"></EditStore>
67 </LayoutBody> 54 </LayoutBody>
68 </template> 55 </template>
69 56
70 <script> 57 <script>
71 - import Vue from 'vue';  
72 import _ from 'lodash'; 58 import _ from 'lodash';
73 - import service from 'product-service';  
74 - import {SizeEdit} from 'product/size-edit'; 59 + import service from 'jit-service';
75 import {SelectBrand, SelectCategory} from 'product/filter-select'; 60 import {SelectBrand, SelectCategory} from 'product/filter-select';
76 - import {CellImage, CellInfo, CellPrice} from 'product/table-cell'; 61 + import {CellImage, CellInfo} from 'product/table-cell';
  62 + import EditStore from './views/edit-store';
77 import {filterFields, initialFields, tableCols, tableData, pageData} from './store'; 63 import {filterFields, initialFields, tableCols, tableData, pageData} from './store';
78 64
79 export default { 65 export default {
80 data() { 66 data() {
81 return { 67 return {
82 self: this, 68 self: this,
83 - showSizeEdit: false,  
84 tableCols, 69 tableCols,
85 tableData, 70 tableData,
86 pageData, 71 pageData,
87 filters: '', 72 filters: '',
88 batchOffSale: [], 73 batchOffSale: [],
89 useFilterSign: false, 74 useFilterSign: false,
90 - categoryValue: [] 75 + categoryValue: [],
91 } 76 }
92 }, 77 },
93 created() { 78 created() {
94 - this.productList();  
95 this.filters = JSON.parse(initialFields); 79 this.filters = JSON.parse(initialFields);
96 }, 80 },
97 methods: { 81 methods: {
98 - editSize(skn) {  
99 - this.$refs.showSizeEdit.show(skn); 82 + editStore(skn) {
  83 + this.$refs.showStoreEdit.show(skn);
100 }, 84 },
101 filterParams() { 85 filterParams() {
102 const fts = this.filters; 86 const fts = this.filters;
@@ -109,7 +93,6 @@ @@ -109,7 +93,6 @@
109 middleSortId: fts.sort.second.model, 93 middleSortId: fts.sort.second.model,
110 smallSortId: fts.sort.third.model, 94 smallSortId: fts.sort.third.model,
111 brandId: fts.brand.model != -1 ? fts.brand.model : null, 95 brandId: fts.brand.model != -1 ? fts.brand.model : null,
112 - auditStatus: fts.verifyStatus.model != -1 ? fts.verifyStatus.model : null,  
113 stock: fts.stockStatus.model != -1 ? this.filters.stockStatus.model : null 96 stock: fts.stockStatus.model != -1 ? this.filters.stockStatus.model : null
114 }; 97 };
115 98
@@ -119,37 +102,15 @@ @@ -119,37 +102,15 @@
119 const params = this.filterParams(); 102 const params = this.filterParams();
120 103
121 this.useFilterSign = true; 104 this.useFilterSign = true;
122 - this.productList(params);  
123 this.pageData.current = 1; 105 this.pageData.current = 1;
124 106
125 }, 107 },
126 clearFilter() { 108 clearFilter() {
127 this.filters = JSON.parse(initialFields); 109 this.filters = JSON.parse(initialFields);
128 - this.productList();  
129 this.useFilterSign = false; 110 this.useFilterSign = false;
130 this.pageData.current = 1; 111 this.pageData.current = 1;
131 this.categoryValue = []; 112 this.categoryValue = [];
132 }, 113 },
133 - productList(params) {  
134 -  
135 - if(_.isObject(params) &&  
136 - params.productSkn !== undefined &&  
137 - !_.isFinite(+params.productSkn)) {  
138 - this.$Message.error('SKN编码只能是数字', 3);  
139 - return;  
140 - };  
141 -  
142 - service.productList(  
143 - _.merge(params || {}, {  
144 - shelfStatus: 1,  
145 - size: 20  
146 - }))  
147 - .then(res => {  
148 - if(res.code === 200) {  
149 - this.updateStore(res.data);  
150 - }  
151 - });  
152 - },  
153 reloadList() { 114 reloadList() {
154 let params = {}; 115 let params = {};
155 116
@@ -163,7 +124,6 @@ @@ -163,7 +124,6 @@
163 productStatusStr: 1 124 productStatusStr: 1
164 }); 125 });
165 126
166 - this.productList(params);  
167 this.pageData.current = 1; 127 this.pageData.current = 1;
168 }, 128 },
169 updateStore(data) { 129 updateStore(data) {
@@ -197,71 +157,6 @@ @@ -197,71 +157,6 @@
197 size: 20, 157 size: 20,
198 productStatusStr: 1 158 productStatusStr: 1
199 }); 159 });
200 -  
201 - this.productList(params);  
202 - },  
203 - setOffSale(skns) {  
204 - const params = {  
205 - targetStatus: 0  
206 - };  
207 -  
208 - if(_.isArray(skns)) {  
209 - params['productSkns'] = `[${skns.join(',')}]`;  
210 - } else {  
211 - params['productSkns'] = `[${skns}]`  
212 - }  
213 -  
214 - service.setOffSale(params)  
215 - .then(res => {  
216 - this.$Message.success(res.data.message);  
217 - this.reloadList();  
218 - });  
219 - },  
220 - batchSetOffSale() {  
221 - if(!this.batchOffSale.length) {  
222 - return this.$Message.error('请选择要下架的商品');  
223 - }  
224 -  
225 - let skns = [];  
226 -  
227 - _.each(this.batchOffSale, (item) => {  
228 - skns.push(item.productSkn);  
229 - });  
230 -  
231 - this.setOffSale(skns);  
232 - },  
233 - editPrice(row) {  
234 - row.changePrice = true;  
235 - },  
236 - updatePrice(row, newSalesPrice) {  
237 - const index = row.lineIndex;  
238 - const salesPrice = newSalesPrice;  
239 - const productSkn = row.productSkn;  
240 -  
241 - if(newSalesPrice === row.salesPrice) {  
242 - row.changePrice = false;  
243 - return;  
244 - }  
245 -  
246 - const params = {  
247 - salesPrice,  
248 - productSkn  
249 - };  
250 -  
251 - service.updateSalesPrice(params)  
252 - .then(res => {  
253 - this.tableData[index].salesPrice = salesPrice;  
254 - row.changePrice = false;  
255 - this.$Message.success(res.data.message);  
256 - });  
257 - },  
258 - editProduct(skn) {  
259 - this.$router.push({  
260 - name: 'product.edit',  
261 - params: {  
262 - id: skn  
263 - }  
264 - });  
265 }, 160 },
266 selectChange(selection) { 161 selectChange(selection) {
267 this.batchOffSale = selection; 162 this.batchOffSale = selection;
@@ -270,10 +165,9 @@ @@ -270,10 +165,9 @@
270 components: { 165 components: {
271 SelectBrand, 166 SelectBrand,
272 SelectCategory, 167 SelectCategory,
273 - SizeEdit,  
274 CellImage, 168 CellImage,
275 CellInfo, 169 CellInfo,
276 - CellPrice 170 + EditStore
277 } 171 }
278 } 172 }
279 </script> 173 </script>
@@ -3,12 +3,6 @@ @@ -3,12 +3,6 @@
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 -const auditStatus = {  
7 - 0: '无状态',  
8 - 1: '下架待审核',  
9 - 2: '下架驳回',  
10 - 3: '已上架'  
11 -};  
12 6
13 let filterFields = { 7 let filterFields = {
14 sknCode: { 8 sknCode: {
@@ -114,14 +108,9 @@ let initialFields = JSON.stringify(filterFields); @@ -114,14 +108,9 @@ let initialFields = JSON.stringify(filterFields);
114 108
115 let tableCols = [ 109 let tableCols = [
116 { 110 {
117 - type: 'selection',  
118 - width: 60,  
119 - align: 'center'  
120 - },  
121 - {  
122 title: '商品图片', 111 title: '商品图片',
123 key: 'image', 112 key: 'image',
124 - width: 120, 113 + width: 200,
125 align: 'center', 114 align: 'center',
126 render (row, column, index) { 115 render (row, column, index) {
127 return '<cell-image :image-src="row.picImgUrl" :product-url="row.productUrl"></cell-image>'; 116 return '<cell-image :image-src="row.picImgUrl" :product-url="row.productUrl"></cell-image>';
@@ -145,60 +134,48 @@ let tableCols = [ @@ -145,60 +134,48 @@ let tableCols = [
145 { 134 {
146 title: '价格(元)', 135 title: '价格(元)',
147 key: 'price', 136 key: 'price',
  137 + width: 200,
148 align: 'center', 138 align: 'center',
149 render(row, column, index) { 139 render(row, column, index) {
150 row.lineIndex = index; 140 row.lineIndex = index;
151 - return `<cell-price  
152 - @click-change="editPrice(row)"  
153 - @click-save="updatePrice"  
154 - :can-change="true"  
155 - :current-row="row"  
156 - :show-change="row.changePrice"  
157 - :retail-price="row.retailPrice"  
158 - :sales-price="row.salesPrice">  
159 - </cell-price>`; 141 + return ` <div style="text-align: left">
  142 + <p>吊牌价:{{row.retailPrice}}</p>
  143 + <p>销售价:{{row.salesPrice}}</p>
  144 + </div>`;
160 } 145 }
161 }, 146 },
162 { 147 {
163 - title: '可库存', 148 + title: '可调拨库存',
164 key: 'stock', 149 key: 'stock',
165 width: 100, 150 width: 100,
166 align: 'center', 151 align: 'center',
167 }, 152 },
168 { 153 {
169 - title: '上架时间', 154 + title: '创建时间',
170 key: 'shelveTime', 155 key: 'shelveTime',
171 width: 150, 156 width: 150,
172 align: 'center' 157 align: 'center'
173 }, 158 },
174 { 159 {
175 - title: '审核状态',  
176 - key: 'verify',  
177 - align: 'center',  
178 - render(row) {  
179 - return `${auditStatus[row.auditStatus]}`  
180 - }  
181 - },  
182 - {  
183 title: '操作', 160 title: '操作',
184 key: 'action', 161 key: 'action',
185 width: 180, 162 width: 180,
186 align: 'center', 163 align: 'center',
187 render: function(row) { 164 render: function(row) {
188 return `<div class="action-btn-row"> 165 return `<div class="action-btn-row">
189 - <i-button type="primary" size="small" @click="editSize(row.productSkn)">尺码维护</i-button>  
190 - <i-button type="primary" size="small" @click="editProduct(${row.productSkn})">内容编辑</i-button>  
191 - </div>  
192 - <div class="btn-row-space">  
193 - <i-button v-if="row._disabled" type="error" size="small"  
194 - @click="setOffSale(${row.productSkn})" disabled>下架</i-button>  
195 - <i-button v-else type="error" size="small" @click="setOffSale(${row.productSkn})" >下架</i-button>  
196 - </div>`; 166 + <i-button type="primary" size="small" @click="editStore(${row.productSkn})">库存编辑</i-button>
  167 + </div> `;
197 } 168 }
198 } 169 }
199 ]; 170 ];
200 171
201 -let tableData = []; 172 +let tableData = [
  173 + {
  174 + picImgUrl: '',
  175 + productUrl: '',
  176 +
  177 + }
  178 +];
202 179
203 let pageData = { 180 let pageData = {
204 total: 0, 181 total: 0,
  1 +<template>
  2 + <Modal v-model="model"
  3 + width="auto"
  4 + class-name="vertical-center-modal">
  5 + <p slot="header">
  6 + <Row v-if="table.data">
  7 + <Col span="6">
  8 + <span>SKN:{{table.skn}}</span>
  9 + </Col>
  10 + <Col span="6">
  11 + <span>{{table.name}}</span>
  12 + </Col>
  13 + </Row>
  14 + </p>
  15 +
  16 + <div style="text-align: center">
  17 + <div class="spin-container" v-if="!table.data">
  18 + <Spin fix></Spin>
  19 + </div>
  20 +
  21 + <Table class="table-container" ref="storeTable" :context="self" :columns="table.cols" :data="table.data" v-if="table.data"> </Table>
  22 + </div>
  23 +
  24 + <div slot="footer" style="text-align: center">
  25 + <Button type="primary" size="large" :loading="modal_loading" @click="submit">保存</Button>
  26 + <Button type="primary" size="large" @click="cancel">取消</Button>
  27 + </div>
  28 + </Modal>
  29 +</template>
  30 +
  31 +<script>
  32 +
  33 +const testData = [
  34 + {
  35 + productSku: 'fdsjakl',
  36 + productSize: 'fdsdfsa',
  37 + productStore: 'fdsafdas'
  38 + }
  39 +];
  40 +
  41 +export default {
  42 + data() {
  43 + return {
  44 + model: false,
  45 + modal_loading: false,
  46 + self: this,
  47 + table: {
  48 + cols: [
  49 + {
  50 + title: 'SKU',
  51 + key: 'productSku',
  52 + width: 200,
  53 + align: 'center'
  54 + },
  55 + {
  56 + title: '规格',
  57 + key: 'productSize',
  58 + width: 200,
  59 + align: 'center'
  60 + },
  61 + {
  62 + title: '商家库存 ',
  63 + key: 'productStore',
  64 + width: 200,
  65 + align: 'center',
  66 + render(row, col, index) {
  67 + return `<i-input v-model="row.productStore"></i-input>`
  68 + }
  69 + }
  70 + ],
  71 + data: null,
  72 + skn: '',
  73 + name: ''
  74 + }
  75 + }
  76 + },
  77 + methods: {
  78 + show(sku) {
  79 + this.reset();
  80 + this.model = true;
  81 + this.getData(sku)
  82 + },
  83 + close() {
  84 + this.model = false;
  85 + },
  86 + submit(){
  87 + this.modal_loading = true;
  88 +
  89 + this.save().then(() => {
  90 + setTimeout(() => {
  91 + this.close();
  92 + }, 2000)
  93 + })
  94 + },
  95 + cancel(){
  96 + this.close();
  97 + },
  98 + getData() {
  99 + setTimeout(() => {
  100 + this.table.data = testData;
  101 + }, 3000);
  102 + },
  103 + save() {
  104 + this.refreshTable();
  105 + return new Promise((resolve, reject) => {
  106 + resolve();
  107 + });
  108 + },
  109 + refreshTable() {
  110 + this.table.data = this.$storeTable.rebuildData;
  111 + },
  112 + reset() {
  113 + this.modal_loading = false;
  114 + this.table.data = null;
  115 + this.table.skn = '';
  116 + this.table.name = '';
  117 + },
  118 + toRenderData() {
  119 +
  120 + },
  121 + toSerialData() {
  122 +
  123 + }
  124 + }
  125 +}
  126 +
  127 +</script>
  128 +
  129 +<style lang="scss">
  130 +.vertical-center-modal{
  131 + display: flex;
  132 + align-items: center;
  133 + justify-content: center;
  134 +
  135 + .ivu-modal{
  136 + top: 0;
  137 + }
  138 +}
  139 +
  140 +.spin-container{
  141 + width: 700px;
  142 + height: 200px;
  143 + position: relative;
  144 +}
  145 +
  146 +.table-container {
  147 + width: 700px;
  148 + min-height: 200px;
  149 +}
  150 +</style>
  1 +/**
  2 + * Created by TaoHuang on 2017/5/5.
  3 + */
  4 +
  5 +import _ from 'lodash';
  6 +import axios from 'axios';
  7 +
  8 +const apiUrl = {
  9 +};
  10 +