Authored by htoooth

fix

... ... @@ -9,6 +9,6 @@ export default {
name: 'jit',
component: page,
meta: {
pageName: '在售商品'
pageName: '可调拨库存'
}
};
\ No newline at end of file
... ...
... ... @@ -9,10 +9,6 @@
<Input v-model.trim="filters.prodCode.model"
:placeholder="filters.prodCode.holder"></Input>
</FilterItem>
<FilterItem :label="filters.prodCode.label">
<Input v-model.trim="filters.prodCode.model"
:placeholder="filters.prodCode.holder"></Input>
</FilterItem>
<FilterItem :label="filters.prodName.label">
<Input v-model.trim="filters.prodName.model"
:placeholder="filters.prodName.holder"></Input>
... ... @@ -21,6 +17,11 @@
<Input v-model.trim="filters.prodBarCode.model"
:placeholder="filters.prodBarCode.holder"></Input>
</FilterItem>
<FilterItem label="选择类目">
<SelectCategory :value="categoryValue" @select-change="sortChange"></SelectCategory>
</FilterItem>
<FilterItem label="选择品牌">
<SelectBrand @on-change="brandChange"
:field-label="filters.brand.label"
... ... @@ -30,13 +31,6 @@
:option-list="filters.brand.options">
</SelectBrand>
</FilterItem>
<FilterItem :label="filters.verifyStatus.label">
<Select v-model.trim="filters.verifyStatus.model">
<Option v-for="option in filters.verifyStatus.options"
:value="option.value"
:key="option.value">{{option.label}}</Option>
</Select>
</FilterItem>
<FilterItem :label="filters.stockStatus.label">
<Select v-model.trim="filters.stockStatus.model">
<Option v-for="option in filters.stockStatus.options"
... ... @@ -44,59 +38,49 @@
:key="option.value">{{option.label}}</Option>
</Select>
</FilterItem>
<FilterItem label="选择类目">
<SelectCategory :value="categoryValue" @select-change="sortChange"></SelectCategory>
</FilterItem>
<FilterItem>
<Button type="primary" @click="filterSearch">筛选</Button>
<Button @click="clearFilter">清空条件</Button>
</FilterItem>
</LayoutFilter>
<LayoutAction>
<Button type="error" @click="batchSetOffSale">下架</Button>
</LayoutAction>
<LayoutList>
<Table border :context="self" :columns="tableCols" :data="tableData" @on-selection-change="selectChange"></Table>
<Page :total="pageData.total" :current="pageData.current"
@on-change="pageChange" :page-size="20" show-total></Page>
</LayoutList>
<SizeEdit ref="showSizeEdit" :show="showSizeEdit"></SizeEdit>
<EditStore ref="showStoreEdit"></EditStore>
</LayoutBody>
</template>
<script>
import Vue from 'vue';
import _ from 'lodash';
import service from 'product-service';
import {SizeEdit} from 'product/size-edit';
import service from 'jit-service';
import {SelectBrand, SelectCategory} from 'product/filter-select';
import {CellImage, CellInfo, CellPrice} from 'product/table-cell';
import {CellImage, CellInfo} from 'product/table-cell';
import EditStore from './views/edit-store';
import {filterFields, initialFields, tableCols, tableData, pageData} from './store';
export default {
data() {
return {
self: this,
showSizeEdit: false,
tableCols,
tableData,
pageData,
filters: '',
batchOffSale: [],
useFilterSign: false,
categoryValue: []
categoryValue: [],
}
},
created() {
this.productList();
this.filters = JSON.parse(initialFields);
},
methods: {
editSize(skn) {
this.$refs.showSizeEdit.show(skn);
editStore(skn) {
this.$refs.showStoreEdit.show(skn);
},
filterParams() {
const fts = this.filters;
... ... @@ -109,7 +93,6 @@
middleSortId: fts.sort.second.model,
smallSortId: fts.sort.third.model,
brandId: fts.brand.model != -1 ? fts.brand.model : null,
auditStatus: fts.verifyStatus.model != -1 ? fts.verifyStatus.model : null,
stock: fts.stockStatus.model != -1 ? this.filters.stockStatus.model : null
};
... ... @@ -119,37 +102,15 @@
const params = this.filterParams();
this.useFilterSign = true;
this.productList(params);
this.pageData.current = 1;
},
clearFilter() {
this.filters = JSON.parse(initialFields);
this.productList();
this.useFilterSign = false;
this.pageData.current = 1;
this.categoryValue = [];
},
productList(params) {
if(_.isObject(params) &&
params.productSkn !== undefined &&
!_.isFinite(+params.productSkn)) {
this.$Message.error('SKN编码只能是数字', 3);
return;
};
service.productList(
_.merge(params || {}, {
shelfStatus: 1,
size: 20
}))
.then(res => {
if(res.code === 200) {
this.updateStore(res.data);
}
});
},
reloadList() {
let params = {};
... ... @@ -163,7 +124,6 @@
productStatusStr: 1
});
this.productList(params);
this.pageData.current = 1;
},
updateStore(data) {
... ... @@ -197,71 +157,6 @@
size: 20,
productStatusStr: 1
});
this.productList(params);
},
setOffSale(skns) {
const params = {
targetStatus: 0
};
if(_.isArray(skns)) {
params['productSkns'] = `[${skns.join(',')}]`;
} else {
params['productSkns'] = `[${skns}]`
}
service.setOffSale(params)
.then(res => {
this.$Message.success(res.data.message);
this.reloadList();
});
},
batchSetOffSale() {
if(!this.batchOffSale.length) {
return this.$Message.error('请选择要下架的商品');
}
let skns = [];
_.each(this.batchOffSale, (item) => {
skns.push(item.productSkn);
});
this.setOffSale(skns);
},
editPrice(row) {
row.changePrice = true;
},
updatePrice(row, newSalesPrice) {
const index = row.lineIndex;
const salesPrice = newSalesPrice;
const productSkn = row.productSkn;
if(newSalesPrice === row.salesPrice) {
row.changePrice = false;
return;
}
const params = {
salesPrice,
productSkn
};
service.updateSalesPrice(params)
.then(res => {
this.tableData[index].salesPrice = salesPrice;
row.changePrice = false;
this.$Message.success(res.data.message);
});
},
editProduct(skn) {
this.$router.push({
name: 'product.edit',
params: {
id: skn
}
});
},
selectChange(selection) {
this.batchOffSale = selection;
... ... @@ -270,10 +165,9 @@
components: {
SelectBrand,
SelectCategory,
SizeEdit,
CellImage,
CellInfo,
CellPrice
EditStore
}
}
</script>
... ...
... ... @@ -3,12 +3,6 @@
* @author: qi.li <qi.li@yoho.cn>
* @date: 2017/04/13
*/
const auditStatus = {
0: '无状态',
1: '下架待审核',
2: '下架驳回',
3: '已上架'
};
let filterFields = {
sknCode: {
... ... @@ -114,14 +108,9 @@ let initialFields = JSON.stringify(filterFields);
let tableCols = [
{
type: 'selection',
width: 60,
align: 'center'
},
{
title: '商品图片',
key: 'image',
width: 120,
width: 200,
align: 'center',
render (row, column, index) {
return '<cell-image :image-src="row.picImgUrl" :product-url="row.productUrl"></cell-image>';
... ... @@ -145,60 +134,48 @@ let tableCols = [
{
title: '价格(元)',
key: 'price',
width: 200,
align: 'center',
render(row, column, index) {
row.lineIndex = index;
return `<cell-price
@click-change="editPrice(row)"
@click-save="updatePrice"
:can-change="true"
:current-row="row"
:show-change="row.changePrice"
:retail-price="row.retailPrice"
:sales-price="row.salesPrice">
</cell-price>`;
return ` <div style="text-align: left">
<p>吊牌价:{{row.retailPrice}}</p>
<p>销售价:{{row.salesPrice}}</p>
</div>`;
}
},
{
title: '可库存',
title: '可调拨库存',
key: 'stock',
width: 100,
align: 'center',
},
{
title: '上架时间',
title: '创建时间',
key: 'shelveTime',
width: 150,
align: 'center'
},
{
title: '审核状态',
key: 'verify',
align: 'center',
render(row) {
return `${auditStatus[row.auditStatus]}`
}
},
{
title: '操作',
key: 'action',
width: 180,
align: 'center',
render: function(row) {
return `<div class="action-btn-row">
<i-button type="primary" size="small" @click="editSize(row.productSkn)">尺码维护</i-button>
<i-button type="primary" size="small" @click="editProduct(${row.productSkn})">内容编辑</i-button>
</div>
<div class="btn-row-space">
<i-button v-if="row._disabled" type="error" size="small"
@click="setOffSale(${row.productSkn})" disabled>下架</i-button>
<i-button v-else type="error" size="small" @click="setOffSale(${row.productSkn})" >下架</i-button>
</div>`;
<i-button type="primary" size="small" @click="editStore(${row.productSkn})">库存编辑</i-button>
</div> `;
}
}
];
let tableData = [];
let tableData = [
{
picImgUrl: '',
productUrl: '',
}
];
let pageData = {
total: 0,
... ...
<template>
<Modal v-model="model"
width="auto"
class-name="vertical-center-modal">
<p slot="header">
<Row v-if="table.data">
<Col span="6">
<span>SKN:{{table.skn}}</span>
</Col>
<Col span="6">
<span>{{table.name}}</span>
</Col>
</Row>
</p>
<div style="text-align: center">
<div class="spin-container" v-if="!table.data">
<Spin fix></Spin>
</div>
<Table class="table-container" ref="storeTable" :context="self" :columns="table.cols" :data="table.data" v-if="table.data"> </Table>
</div>
<div slot="footer" style="text-align: center">
<Button type="primary" size="large" :loading="modal_loading" @click="submit">保存</Button>
<Button type="primary" size="large" @click="cancel">取消</Button>
</div>
</Modal>
</template>
<script>
const testData = [
{
productSku: 'fdsjakl',
productSize: 'fdsdfsa',
productStore: 'fdsafdas'
}
];
export default {
data() {
return {
model: false,
modal_loading: false,
self: this,
table: {
cols: [
{
title: 'SKU',
key: 'productSku',
width: 200,
align: 'center'
},
{
title: '规格',
key: 'productSize',
width: 200,
align: 'center'
},
{
title: '商家库存 ',
key: 'productStore',
width: 200,
align: 'center',
render(row, col, index) {
return `<i-input v-model="row.productStore"></i-input>`
}
}
],
data: null,
skn: '',
name: ''
}
}
},
methods: {
show(sku) {
this.reset();
this.model = true;
this.getData(sku)
},
close() {
this.model = false;
},
submit(){
this.modal_loading = true;
this.save().then(() => {
setTimeout(() => {
this.close();
}, 2000)
})
},
cancel(){
this.close();
},
getData() {
setTimeout(() => {
this.table.data = testData;
}, 3000);
},
save() {
this.refreshTable();
return new Promise((resolve, reject) => {
resolve();
});
},
refreshTable() {
this.table.data = this.$storeTable.rebuildData;
},
reset() {
this.modal_loading = false;
this.table.data = null;
this.table.skn = '';
this.table.name = '';
},
toRenderData() {
},
toSerialData() {
}
}
}
</script>
<style lang="scss">
.vertical-center-modal{
display: flex;
align-items: center;
justify-content: center;
.ivu-modal{
top: 0;
}
}
.spin-container{
width: 700px;
height: 200px;
position: relative;
}
.table-container {
width: 700px;
min-height: 200px;
}
</style>
\ No newline at end of file
... ...
/**
* Created by TaoHuang on 2017/5/5.
*/
import _ from 'lodash';
import axios from 'axios';
const apiUrl = {
};
... ...