Authored by 李奇

列表页价格变更添加

@@ -89,7 +89,7 @@ @@ -89,7 +89,7 @@
89 </Col> 89 </Col>
90 </Row> 90 </Row>
91 <Row class-name="filter-row"> 91 <Row class-name="filter-row">
92 - <Button type="primary">筛选</Button> 92 + <Button type="primary" @click="filterSearch">筛选</Button>
93 <Button>清空条件</Button> 93 <Button>清空条件</Button>
94 </Row> 94 </Row>
95 <div class="hr"></div> 95 <div class="hr"></div>
@@ -119,30 +119,39 @@ @@ -119,30 +119,39 @@
119 } 119 }
120 }, 120 },
121 created() { 121 created() {
122 - const params = {  
123 - productStatusStr: 1,  
124 - size: 20  
125 - };  
126 -  
127 - service.productList(params).then(res => {  
128 - let code = _.get(res, 'data.code');  
129 -  
130 - if(code === 200) {  
131 - this.updateStore(res.data.data);  
132 - }  
133 - }); 122 + this.productList();
134 }, 123 },
135 methods: { 124 methods: {
136 - productList(params) {  
137 - service.productList(_.merge(params, {size: 20})).then(res => {  
138 - let code = _.get(res, 'data.code'); 125 + filterSearch() {
  126 + const params = {
  127 +// productSkn: this.filters.sknCode.model,
  128 +// factoryCode: this.filters.factoryCode.model,
  129 +// productName: this.filters.productName.model,
  130 +// skuFactoryCode: this.filters.skuFactoryCode.model,
  131 +// maxSortId: this.filters.maxSortId.model,
  132 +// maxSortId: this.filters.maxSortId.model,
  133 +// middleSortId: this.filters.middleSortId.model,
  134 +// smallSortId: this.filters.smallSortId.model,
  135 +// auditStatus: this.filters.auditStatus.model,
  136 +// stock: this.filters.stock.model
  137 + };
139 138
140 - if(code === 200) {  
141 - this.updateStore(res.data.data);  
142 - }  
143 - }); 139 + this.productList(params);
144 }, 140 },
  141 + productList(params) {
  142 + service.productList(
  143 + _.merge(params || {}, {
  144 + shelfStatus: 1,
  145 + size: 20
  146 + }))
  147 + .then(res => {
  148 + let code = _.get(res, 'data.code');
145 149
  150 + if(code === 200) {
  151 + this.updateStore(res.data.data);
  152 + }
  153 + });
  154 + },
146 updateStore(data) { 155 updateStore(data) {
147 this.pageData.total = data.total; 156 this.pageData.total = data.total;
148 157
@@ -152,15 +161,12 @@ @@ -152,15 +161,12 @@
152 161
153 this.tableData = data.list; 162 this.tableData = data.list;
154 }, 163 },
155 -  
156 categoryChange(val) { 164 categoryChange(val) {
157 _.set(this.filters, 'category.model', val); 165 _.set(this.filters, 'category.model', val);
158 }, 166 },
159 -  
160 brandChange(val) { 167 brandChange(val) {
161 _.set(this.filters, 'brand.model', val); 168 _.set(this.filters, 'brand.model', val);
162 }, 169 },
163 -  
164 pageChange(page) { 170 pageChange(page) {
165 let params = { 171 let params = {
166 page, 172 page,
@@ -191,23 +197,27 @@ @@ -191,23 +197,27 @@
191 batchSetOffSale() { 197 batchSetOffSale() {
192 }, 198 },
193 199
194 - changePrice(row) { 200 + changePrice(row, index) {
  201 + console.log(index)
195 row.changePrice = true; 202 row.changePrice = true;
196 }, 203 },
197 -  
198 updatePrice(row) { 204 updatePrice(row) {
199 - row.changePrice = false; 205 + const index = row.lineIndex;
  206 + const salesPrice = row.salesPrice;
  207 + const productSkn = row.productSkn;
  208 +
200 const params = { 209 const params = {
201 - productSkn: row.productSkn,  
202 - salesPrice: row.salesPrice 210 + salesPrice,
  211 + productSkn
203 }; 212 };
204 213
205 service.updateSalesPrice(params) 214 service.updateSalesPrice(params)
206 .then(res => { 215 .then(res => {
  216 + this.tableData[index].salesPrice = salesPrice;
  217 + row.changePrice = false;
207 this.$Message.success(res.data.message); 218 this.$Message.success(res.data.message);
208 }) 219 })
209 }, 220 },
210 -  
211 editProduct(skn) { 221 editProduct(skn) {
212 this.$router.push({ 222 this.$router.push({
213 name: 'product.create.step1', 223 name: 'product.create.step1',
@@ -215,6 +225,10 @@ @@ -215,6 +225,10 @@
215 skn 225 skn
216 } 226 }
217 }); 227 });
  228 + },
  229 + priceChange(val) {
  230 + console.log(val)
  231 +
218 } 232 }
219 }, 233 },
220 components: { 234 components: {
@@ -3,18 +3,11 @@ @@ -3,18 +3,11 @@
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 status = {  
7 - 0: '已下架',  
8 - 1: '已上架',  
9 - 2: '上架待审核',  
10 - 3: '上架驳回',  
11 - 4: '通过',  
12 - 5: '再上架待审核',  
13 - 6: '再上架驳回',  
14 - 7: '再上架通过',  
15 - 8: '待上架',  
16 - 9: '下架审核驳回',  
17 - 10: '下架待审核' 6 +const auditStatus = {
  7 + 0: '无状态',
  8 + 1: '提出审核',
  9 + 2: '审核驳回',
  10 + 3: '审核通过'
18 }; 11 };
19 12
20 let filterFields = { 13 let filterFields = {
@@ -137,6 +130,7 @@ let tableCols = [ @@ -137,6 +130,7 @@ let tableCols = [
137 align: 'center', 130 align: 'center',
138 label: 'test', 131 label: 'test',
139 render(row, column, index) { 132 render(row, column, index) {
  133 + row.lineIndex = index;
140 return `<p>吊牌价:${row.retailPrice}</p> 134 return `<p>吊牌价:${row.retailPrice}</p>
141 <p v-if="!row.changePrice">销售价:${row.salesPrice} 135 <p v-if="!row.changePrice">销售价:${row.salesPrice}
142 <i-button type="info" size="small" @click="changePrice(row)"></i-button> 136 <i-button type="info" size="small" @click="changePrice(row)"></i-button>
@@ -161,7 +155,7 @@ let tableCols = [ @@ -161,7 +155,7 @@ let tableCols = [
161 key: 'verify', 155 key: 'verify',
162 align: 'center', 156 align: 'center',
163 render(row, column, index) { 157 render(row, column, index) {
164 - return `${status[row.status]}` 158 + return `${auditStatus[row.auditStatus]}`
165 } 159 }
166 }, 160 },
167 { 161 {