Authored by 陈峰

Merge branch 'release/1.0' of http://git.yoho.cn/fe/yoho-shop-manage into release/1.0

... ... @@ -2,12 +2,14 @@
<div class="cell-price">
<div v-if="canChange">
<p>吊牌价:{{retailPrice}}</p>
<p v-if="!showChange">销售价:{{salesPrice}}
<p v-if="!showChange">
<i-button type="info" size="small" @click="changeClick">改</i-button>
销售价:{{salesPrice}}
</p>
<p v-else>销售价:<span class="price-input">
<Input v-model.number="newPrice"></Input></span>
<p v-else>
<i-button type="warning" size="small" @click="saveClick">存</i-button>
销售价:<span class="price-input">
<Input v-model.number="newPrice"></Input></span>
</p>
</div>
<div v-else>
... ...
... ... @@ -16,7 +16,7 @@ export default () => {
productName: '',
phrase: '',
factoryCode: '',
goodsYears: '',
goodsYears: new Date().getFullYear().toString(),
goodsSeason: '',
gender: '',
seasons: '',
... ...
... ... @@ -148,6 +148,11 @@ export default {
return api.getBrand().then((result) => {
if (result.code === 200) {
this.brands = result.data;
if (this.brands.length === 1) {
this.product.brandId = this.brands[0].brandId;
this.product.brandName = this.brands[0].brandName;
}
}
});
},
... ...
... ... @@ -44,7 +44,7 @@
<Row>
<Col span="8">
<Form-item label="商品卖点" prop="phrase">
<Form-item label="商品卖点">
<Input v-model="product.phrase" type="textarea" :rows="4" placeholder="请输入..."/>
</Form-item>
</Col>
... ... @@ -244,7 +244,9 @@ export default {
}
if (!Number.isInteger(value)) {
callback(new Error('请输入数字值'));
callback(new Error('请输入整数,不能有小数点'));
} else if (value > 100000) {
callback(new Error('价格不能大于6位'));
} else {
callback();
... ... @@ -383,9 +385,6 @@ export default {
productName: [
{ required: true, message: '商品名不能为空', trigger: 'blur'}
],
phrase: [
{ required: true, message: '商品卖点不能为空', trigger: 'blur'}
],
goodsYears: [
{ required: true, message: '货品年不能为空', trigger: 'change', type: 'string'}
],
... ... @@ -410,7 +409,8 @@ export default {
salesPrice: [
{ required: true, trigger: 'blur', validator: validateMustLessRetailPrice},
]
}
},
years: 2018
};
},
mounted: function() {
... ...
... ... @@ -261,9 +261,9 @@ export default {
},
getAllAttr: function(smallSortId, maxSortId) {
return api.getAllAttr(smallSortId, maxSortId).then((result) => {
this.render.productStandardRelationStr = result[0];
this.render.attributeProValuesOne = result[1];
this.render.attributeProValuesTwo = result[2];
this.render.productStandardRelationStr = service.addNoneItem(result[0]);
this.render.attributeProValuesOne = service.addNoneItem(result[1]);
this.render.attributeProValuesTwo = service.addNoneItem(result[2]);
this.render.productMaterial = result[3];
});
},
... ...
... ... @@ -43,7 +43,7 @@
<Row>
<Col span="8">
<Form-item label="商品卖点" prop="phrase">
<Form-item label="商品卖点">
<Input v-model="product.phrase" type="textarea" :rows="4" placeholder="请输入..." style="width: 350px;"/>
</Form-item>
</Col>
... ... @@ -620,9 +620,9 @@ export default {
},
getAllAttr: function(smallSortId, maxSortId) {
return api.getAllAttr(smallSortId, maxSortId).then((result) => {
this.render.productStandardRelationStr = result[0] || [];
this.render.attributeProValuesOne = result[1];
this.render.attributeProValuesTwo = result[2];
this.render.productStandardRelationStr = service.addNoneItem(result[0] || []);
this.render.attributeProValuesOne = service.addNoneItem(result[1]);
this.render.attributeProValuesTwo = service.addNoneItem(result[2]);
this.render.productMaterial = result[3];
}).then(() => {
let relation = this.product.productStandardRelationBoList || [];
... ... @@ -695,6 +695,7 @@ export default {
let goodsImageList = this.product.sellerGoodsImagesList;
this.table.data = _.range(goodsList.length).map((i) => {
console.log(goodsList[i], goodsImageList[i]);
return this.handleItem(goodsList[i], goodsImageList[i]);
});
... ... @@ -772,7 +773,6 @@ export default {
},
beforeSave: function() {
let newProduct = makeSaveProduct();
this.refreshTable();
newProduct.productSkn = this.product.productSkn;
... ...
... ... @@ -248,6 +248,11 @@
const salesPrice = newSalesPrice;
const productSkn = row.productSkn;
if(newSalesPrice > row.salesPrice) {
this.$Message.error('销售价不能大于吊牌价');
return;
}
if(newSalesPrice === row.salesPrice) {
row.changePrice = false;
return;
... ...
... ... @@ -171,6 +171,7 @@ export default () => {
{
title: '价格(元)',
key: 'price',
width: '180',
align: 'center',
render(row, column, index) {
row.lineIndex = index;
... ...
... ... @@ -231,10 +231,16 @@
row.changePrice = true;
},
updatePrice(row, newSalesPrice) {
const index = row.lineIndex;
const salesPrice = newSalesPrice;
const productSkn = row.productSkn;
if(newSalesPrice > row.salesPrice) {
this.$Message.error('销售价不能大于吊牌价');
return;
}
if(newSalesPrice === row.salesPrice) {
row.changePrice = false;
return;
... ...
... ... @@ -46,6 +46,7 @@ export default () => {
{
title: '价格(元)',
key: 'price',
width: '180',
align: 'center',
render(row, column, index) {
row.lineIndex = index;
... ...
... ... @@ -48,8 +48,9 @@
import _ from 'lodash';
import {SelectCategory} from 'components/select';
import {CellImage} from 'components/cell';
import {tableCols, tableData} from '../store'
import methods from '../methods'
import {tableCols, tableData} from '../store';
import methods from '../methods';
import service from 'shop-category-service';
export default {
data() {
... ... @@ -95,7 +96,8 @@
},
}
},
created() {
mounted() {
this.productList();
},
methods: {
filterParams() {
... ... @@ -105,6 +107,12 @@
clearFilter() {
},
productList(params) {
service.listProduct().then((result) => {
console.log(result);
if (result.code === 200) {
this.tableData = result.data.list;
}
})
},
reloadList() {
},
... ...
... ... @@ -49,8 +49,10 @@
import {SelectCategory} from 'components/select';
import {tableCols, tableData} from '../store'
import methods from '../methods'
import service from 'shop-category-service';
export default {
props: ['categoryId'],
data() {
return {
self: this,
... ... @@ -94,7 +96,8 @@
},
}
},
created() {
mounted() {
this.productList();
},
methods: {
filterParams() {
... ... @@ -104,6 +107,11 @@
clearFilter() {
},
productList(params) {
service.listBindProduct(this.categoryId).then((result) => {
if (result.code === 200) {
this.tableData = result.data.list;
}
})
},
reloadList() {
},
... ...
<template>
<Tabs type="card" :animated="false">
<Tab-pane :label="'全部商品'">
<ProductList></ProductList>
<ProductList @on-count-change="onCountChange"></ProductList>
</Tab-pane>
<Tab-pane :label="handleCount">
<ProductSelectedList></ProductSelectedList>
<ProductSelectedList @on-count-change="onCountChange" :categoryId="categoryId"></ProductSelectedList>
</Tab-pane>
<Button type="ghost" size="small" slot="extra" @click="back">返回</Button>
... ... @@ -14,16 +14,32 @@
<script>
import components from './components';
import service from 'shop-category-service';
export default {
data () {
return {
count: 2,
count: 0,
categoryId: ''
}
},
created() {
this.categoryId = this.$route.query.categoryId;
this.getCount();
},
methods: {
back() {
this.$router.push({name: 'shop.category.list'})
},
onCountChange() {
this.getCount();
},
getCount() {
service.countBindProduct(this.categoryId).then((result) => {
if (result.code === 200) {
this.count = result.data
}
})
}
},
computed: {
... ...
... ... @@ -8,7 +8,7 @@
<div style="text-align: center">
<FilterItem :label="'商品分类名称'">
<Input >fdsa</Input>
<Input v-model="name"/>
</FilterItem>
</div>
... ... @@ -20,15 +20,27 @@
</template>
<script>
import service from 'shop-category-service';
export default {
data() {
return {
model: false,
modal_loading: false
modal_loading: false,
name: '',
id: ''
}
},
methods: {
show() {
update(c) {
this.reset();
this.model = true;
this.id = c.categoryId;
this.name = c.categoryName;
},
create() {
this.reset();
this.model = true;
},
close() {
... ... @@ -38,17 +50,20 @@
this.modal_loading = true;
this.save().then(() => {
setTimeout(() => {
this.close();
}, 2000)
this.modal_loading = false;
this.$emit('on-success');
this.close();
})
},
cancel(){
this.close();
},
save() {
return service.updateCategoryName(this.id, this.name);
},
reset() {
this.name = '';
this.id = '';
}
}
}
... ...
... ... @@ -11,7 +11,7 @@
<Page :total="pageData.total" :current="pageData.current"
@on-change="pageChange" :page-size="20" show-total></Page>
</LayoutList>
<EditName ref="showNameEdit"></EditName>
<EditName ref="showNameEdit" @on-success="onEditSuccess"></EditName>
</LayoutBody>
</template>
... ... @@ -19,30 +19,35 @@
import _ from 'lodash';
import {tableCols, pageData, tableData} from './store';
import components from './components';
import service from 'shop-category-service';
export default {
data() {
return {
self: this,
tableCols,
tableData,
tableData: [],
pageData,
}
},
mounted() {
this.getData();
},
methods: {
clickEditName(row) {
this.$refs.showNameEdit.show(row)
this.$refs.showNameEdit.update(row)
},
clickDelete(row) {
let _this = this;
this.$Modal.confirm({
title: '删除店铺商品分类',
content: '你确定 删除 商品分类 test 么?',
onOk: function() {
content: `你确定 删除 商品分类 ${row.categoryName} 么?`,
onOk() {
_this.deleteCategory(row.categoryId).then(() => {
_this.tableData.splice(_this.tableData.indexOf(row), 1)
});
},
onCancel: function() {
}
})
},
clickEditRelation(row) {
... ... @@ -50,12 +55,33 @@
this.$router.push({name: 'shop.category.edit', query: { categoryId }})
},
clickCreate() {
this.$refs.showNameEdit.create()
},
pageChange() {
},
getData() {
return service.getCategoryList(pageData.current).then((result) => {
if (result.code === 200) {
this.pageData.total = result.data.total;
this.pageData.current = result.data.currentPage;
this.tableData = result.data.rows;
}
});
},
deleteCategory(id) {
return service.deleteCategory(id).then((result) => {
if (result.code === 200) {
return Promise.resolve();
} else {
return Promise.reject();
}
});
},
onEditSuccess() {
console.log('ok');
this.getData();
}
},
components: {
...components
... ...
... ... @@ -8,10 +8,12 @@ const handleRelation = (oneValuesObj = []) => {
return oneValuesObj.reduce((total, r) => {
let str = _.isArray(r.model) ? r.model.join(',') : r.model;
if (str) {
if (+str) {
let valObj = _.find(r.idNameList, {id: str});
total.push({
standardId: r.attributeId,
standardVal: r.attributeName,
standardVal: valObj.text || '',
parameterMakeId: str
});
}
... ... @@ -24,7 +26,7 @@ const handleValue = (skn, valueObj = []) => {
return valueObj.reduce((total, r) => {
let str = _.isArray(r.model) ? r.model.join(',') : r.model;
if (str) {
if (+str) {
total.push({
attributeId: r.attributeId,
productSkn: skn,
... ...
... ... @@ -133,10 +133,19 @@ function getProduct(skn) {
});
}
function addNoneItem(objArray) {
objArray.forEach(obj => {
obj.idNameList && obj.idNameList.unshift({id: 0, text: '请选择' + obj.attributeName})
});
return objArray;
}
export default {
handleGoods,
handleColorImage,
handleGoodsImage,
handleEditColorImage,
getProduct
getProduct,
addNoneItem
};
\ No newline at end of file
... ...
/**
* Created by TaoHuang on 2017/5/9.
*/
import _ from 'lodash';
import request from 'axios';
const apiUrl = {
categoryList: '/platform/getShopsCategoryList',
updateCategory: '/platform/addOrUpdateShopsCategory',
deleteCategory: '/platform/deleteShopsCategory',
listProduct: '/platform/getAllProduct',
listBindProduct: '/platform/getBindProduct',
countBindProduct: '/platform/getBindProductCount',
createBindProduct:'/platform/addCategoryLinkProduct',
deleteBindProduct:'/platform/deleteCategoryLinkProduct'
};
/**
* 获得所有分类
* @param page
*/
function getCategoryList(page = 1) {
return request.get(apiUrl.categoryList, {
params: {
page
}
}).then(res => res.data);
}
/**
* 更新或者新建分类
* @param id 有id 时是更新,没有id 是新建
* @param name
*/
function updateCategoryName(id, name) {
let data = {
categoryName: name,
};
if (id) {
data.categoryId = id
}
return request.post(apiUrl.updateCategory, data).then(res => res.data);
}
/**
* 删除一个分类
* @param id
*/
function deleteCategory(id) {
return request.post(apiUrl.deleteCategory, {
categoryId: id
}).then(res => res.data);
}
/**
* 列出该店铺中所有的商品
* @param categoryId
* @param page
* @param size
*/
function listProduct(page = 1, size = 20) {
return request.post(apiUrl.listProduct, { page, size } )
.then(res => res.data);
}
/**
* 列出分类下所有商品
* @param categoryId
* @param page
* @param size
*/
function listBindProduct(categoryId, page = 1, size = 20) {
return request.post(apiUrl.listBindProduct, { categoryId, page, size })
.then(res => res.data);
}
/**
* 获得分类下商品的个数
* @param categoryId
*/
function countBindProduct(categoryId) {
return request.post(apiUrl.countBindProduct, { categoryId })
.then(res => res.data);
}
/**
* 增加类目中关联的商品
* @param categoryId {string | array}
* @param productSKN
*/
function createBindProduct(categoryId, productSKN) {
if (_.isArray(productSKN)) {
}
return request.post(apiUrl.createBindProduct, {
categoryId, productSKN: _.isArray(productSKN) ? productSKN.join(',') : productSKN
}).then(res => res.data);
}
/**
* 删除类目中关联的商品
* @param categoryId {string | array}
* @param productSKN
*/
function deleteBindProduct(categoryId, productSKN) {
return request.post(apiUrl.deleteBindProduct, {
categoryId, productSKN: _.isArray(productSKN) ? productSKN.join(',') : productSKN
}).then(res => res.data);
}
export default {
getCategoryList,
updateCategoryName,
deleteCategory,
listProduct,
listBindProduct,
countBindProduct,
createBindProduct,
deleteBindProduct
}
\ No newline at end of file
... ...
... ... @@ -30,7 +30,15 @@ let domainApis = {
getShopDetailById: '/SellerShopController/getShopDetailById',
updateShopBaseInfoById: '/SellerShopController/updateShopBaseInfoById',
uploads: '/fileupload/uploads',
findBusinessShopsDecorator: '/ShopsDecoratorRest/findBusinessShopsDecorator'
findBusinessShopsDecorator: '/ShopsDecoratorRest/findBusinessShopsDecorator',
getShopsCategoryList: '/SellerShopController/getShopsCategoryList',
addOrUpdateShopsCategory: '/SellerShopController/addOrUpdateShopsCategory',
deleteShopsCategory: '/SellerShopController/deleteShopsCategory',
getAllProduct: '/SellerShopController/getAllProduct',
getBindProductCount: '/SellerShopController/getBindProductCount',
getBindProduct: '/SellerShopController/getBindProduct',
addCategoryLinkProduct: '/SellerShopController/addCategoryLinkProduct',
deleteCategoryLinkProduct: '/SellerShopController/deleteCategoryLinkProduct'
},
shop: {
login: '/loginInter'
... ...