Authored by htoooth

Merge remote-tracking branch 'origin/release/2.0' into release/2.0

... ... @@ -20,16 +20,9 @@
},
created() {
this.brandService = new BrandService();
const err_msg = '获取品牌列表失败。';
this.brandService.getBrand().then((res) => {
let code = _.get(res, 'data.code');
if (code === 200) {
this.optionList = res.data.data;
return;
}
return this.$Message.error(err_msg);
this.optionList = res.data;
});
},
data() {
... ...
... ... @@ -128,7 +128,7 @@ import { ImageGoodsMain } from 'components/image';
import {ModalExample} from 'components/modal';
import {ExamplePop} from 'components/pop';
import {ProductCreateService} from 'services/product';
import {ProductCreateService, ProductService} from 'services/product';
export default {
props: {
... ... @@ -178,28 +178,30 @@ export default {
};
},
created() {
this.productService = new ProductService();
this.productCreateService = new ProductCreateService();
this.from = this.$route.query.from || this.from;
this.productCreateService.getProduct(this.$route.params.id).then((result) => {
_.update(result, 'goodsSeason', (s) => `${s}`);
if (!_.has(result, 'materialList')) {
result.materialList = [];
}
this.productService.getProduct(this.$route.params.id).then((result) => {
if (result.code === 200) {
this.product = result.data;
_.update(this.product, 'goodsSeason', (s) => `${s}`);
if (!_.has(this.product, 'materialList')) {
this.product.materialList = [];
}
if (!_.has(result, 'expectSaleTimeStr')) {
result.expectSaleTimeStr = '';
}
if (!_.has(this.product, 'expectSaleTimeStr')) {
this.product.expectSaleTimeStr = '';
}
if (!_.has(result, 'seasons')) {
result.seasons = '';
}
if (!_.has(this.product, 'seasons')) {
this.product.seasons = '';
}
if (!_.has(result, 'ageLevel')) {
result.ageLevel = '';
if (!_.has(this.product, 'ageLevel')) {
this.product.ageLevel = '';
}
}
this.product = result;
}).then(() => {
return this.getAllAttr(this.product.smallSortId, this.product.maxSortId);
}).then(() => {
... ...
... ... @@ -243,7 +243,7 @@
this.productService.setOnSale(params)
.then(res => {
this.$Message.success(res.data.message);
this.$Message.success(res.message);
this.reloadList();
});
},
... ... @@ -287,16 +287,13 @@
this.productService.updateSalesPrice(params)
.then(res => {
const data = res.data;
const code = data.code;
if (code === 200) {
if (res.code === 200) {
this.tableData[index].salesPrice = salesPrice;
row.changePrice = false;
this.$Message.success(data.message);
this.$Message.success(res.message);
} else {
row.changePrice = false;
this.$Message.error(data.message);
this.$Message.error(res.message);
}
});
},
... ...
... ... @@ -214,7 +214,7 @@
this.productService.setOffSale(params)
.then(res => {
this.$Message.success(res.data.message);
this.$Message.success(res.message);
this.reloadList();
});
},
... ...
... ... @@ -3,7 +3,7 @@
<layout-filter>
<filter-item :label="filters.orderNo.label">
<Input v-model.trim="filters.orderNo.model"
:placeholder="filters.orderNo.holder"></Input>
:placeholder="filters.orderNo.holder" :maxlength="9"></Input>
</filter-item>
<filter-item :label="filters.orderTime.label">
<Date-picker type="daterange"
... ... @@ -18,7 +18,7 @@
</filter-item>
</layout-filter>
<layout-list>
<Table border :context="self" :columns="tableCols" :data="tableData"></Table>
<Table border :columns="columns" :data="dataList"></Table>
<Page :total="page.total" :current="page.current"
@on-change="pageChange" :page-size="20" show-total></Page>
</layout-list>
... ... @@ -27,28 +27,15 @@
<script>
import _ from 'lodash';
import moment from 'moment';
import {TradeService} from 'services/trade';
import allotStore from './store';
import {TradeService} from 'services/trade';
export default {
data() {
return {
self: this,
tableCols: [],
tableData: {},
page: {},
filters: {},
enableFilter: false
};
return allotStore.apply(this);
},
created() {
this.tradeService = new TradeService();
const allot = allotStore.apply(this);
this.page = allot.page;
this.tableData = allot.list;
this.filters = allot.fields;
this.tableCols = allot.columns;
this.allotList(this.filterValues());
},
methods: {
... ... @@ -94,11 +81,12 @@
this.allotList(this.filterValues());
},
clearFilter() {
const allot = allotStore.apply(this);
this.page.current = 1;
this.enableFilter = false;
this.filters = allot.fields;
this.filters.orderNo.model = '';
this.filters.orderTime.model = '';
this.filters.startTime.model = '';
this.filters.endTime.model = '';
this.allotList(this.filterValues());
},
allotList(params) {
... ... @@ -125,7 +113,7 @@
this.page.current = 1;
},
resolveData(data) {
this.tableData = data.records;
this.dataList = data.records;
this.page.total = data.totalCount;
},
pageChange(page) {
... ...
... ... @@ -7,6 +7,7 @@ import timeFormat from 'filters/time-format';
export default function() {
return {
enableFilter: false,
columns: [
{
title: '调拨单号',
... ... @@ -133,12 +134,12 @@ export default function() {
}
}
],
list: [],
dataList: [],
page: {
total: 0,
current: 1
},
fields: {
filters: {
orderNo: {
label: '调拨单号',
model: ''
... ...
... ... @@ -7,11 +7,6 @@ class FinanceService extends Service {
productList(params) {
return this.get('/platform', {
params
}).then(res => {
if (res.status === 200) {
return res.data;
}
return {};
});
}
}
... ...
... ... @@ -4,7 +4,7 @@ class ColorService extends Service {
getColor() {
return this.get('/platform/querySellerProductColors', {
cache: true
}).then((result) => result.data);
});
}
}
... ...
... ... @@ -2,44 +2,15 @@ import Service from '../service';
import _ from 'lodash';
let apiUrl = {
brand: '/platform/getSellerBrandInfo',
sort: '/platform/getSellerSortInfo',
color: '/platform/querySellerProductColors',
size: '/platform/querySortSize',
addProduct: '/platform/addProduct',
params: '/platform/queryProductParamBySortId',
attr: '/platform/selectAttributes',
material: '/platform/querySellerProductMaterial',
updateNetInfo: '/platform/updateSellerProductNetSaleInfo',
updateProduct: '/platform/updateProduct',
getProduct: '/platform/getProduct'
updateProduct: '/platform/updateProduct'
};
class ProductCreateService extends Service {
/**
* 获得品牌所支持的所有颜色
*/
getColor() {
return this.get(apiUrl.color, {
cache: true
}).then((result) => result.data);
}
/**
* 获得品类下所支持的尺码
* @param smallSortId
*/
getSize(smallSortId) {
return this.get(apiUrl.size, {
params: {
sortId: smallSortId
},
cache: true
}).then(result => result.data);
}
/**
* 获得品类支持的商品相关参数
* @param sortId
... ... @@ -50,7 +21,7 @@ class ProductCreateService extends Service {
sortId
},
cache: true
}).then(result => result.data);
});
}
/**
... ... @@ -68,7 +39,7 @@ class ProductCreateService extends Service {
displayPosition
},
cache: true
}).then(result => result.data);
});
}
/**
... ... @@ -86,7 +57,7 @@ class ProductCreateService extends Service {
displayPosition
},
cache: true
}).then(result => result.data);
});
}
/**
... ... @@ -99,7 +70,7 @@ class ProductCreateService extends Service {
maxSortId: maxSortId
},
cache: true
}).then(result => result.data);
});
}
/**
... ... @@ -115,10 +86,10 @@ class ProductCreateService extends Service {
getAllAttr(smallSortId, maxSortId) {
return Promise.all([
this.getProductParams(smallSortId).then(r => r.data).then(r => r.map(this.addModelAttr)),
this.getProductAttribute(smallSortId).then(r => r.data).then(r => r.map(this.addModelAttr)),
this.getProductStyle(smallSortId).then(r => r.data).then(r => r.map(this.addModelAttr)),
this.getMaterial(maxSortId).then(r => r.data).then(r => this.addModelAttr(r)),
this.getProductParams(smallSortId).then(r => r.data.map(this.addModelAttr)),
this.getProductAttribute(smallSortId).then(r => r.data.map(this.addModelAttr)),
this.getProductStyle(smallSortId).then(r => r.data.map(this.addModelAttr)),
this.getMaterial(maxSortId).then(r => this.addModelAttr(r.data)),
]);
}
... ... @@ -127,8 +98,7 @@ class ProductCreateService extends Service {
* @param info
*/
updateNetInfo(info) {
return this.post(apiUrl.updateNetInfo, info)
.then(result => result.data);
return this.post(apiUrl.updateNetInfo, info);
}
/**
... ... @@ -136,29 +106,16 @@ class ProductCreateService extends Service {
* @param product
*/
saveBaseProductInfo(product) {
return this.post(apiUrl.addProduct, product)
.then(result => result.data);
return this.post(apiUrl.addProduct, product);
}
/**
* 查询商品所以有信息,包括网销信息
* @param skn
*/
getProductAllInfo(skn) {
return this.get(apiUrl.getProduct, {
params: {
productSkn: skn
}
}).then(result => result.data);
}
/**
* 更新商品信息,包括基础信息和网销信息
* @param product
*/
updateProductAllInfo(product) {
return this.post(apiUrl.updateProduct, product)
.then(result => result.data);
return this.post(apiUrl.updateProduct, product);
}
handleRelation(oneValuesObj = []) {
... ... @@ -327,12 +284,6 @@ class ProductCreateService extends Service {
return colorsObj;
}
getProduct(skn) {
return this.getProductAllInfo(skn).then((result) => {
return result.data;
});
}
addNoneItem(objArray) {
const objArrayClone = _.cloneDeep(objArray);
... ...
... ... @@ -17,7 +17,8 @@ const apiUrl = {
queryProdSizeList: '/platform/queryProdSizeList',
saveProdSizeInfo: '/platform/saveProdSizeInfo',
exportSellerProductList: '/platform/exportSellerProductList',
getSellerAllSortInfo: '/platform/getSellerAllSortInfo'
getSellerAllSortInfo: '/platform/getSellerAllSortInfo',
getProduct: '/platform/getProduct'
};
class ProductService extends Service {
... ... @@ -25,33 +26,15 @@ class ProductService extends Service {
productList(params) {
return this.get(apiUrl.productList, {
params
})
.then(res => {
if (res.status === 200) {
return res.data;
}
return {};
});
}
vipProductList(params) {
return this.post(apiUrl.vipProductList, params)
.then(res => {
if (res.status === 200) {
return res.data;
}
return {};
});
return this.post(apiUrl.vipProductList, params);
}
setVipPriceStatus(params) {
return this.post(apiUrl.setVipPriceStatus, params)
.then(res => {
if (res.status === 200) {
return res.data;
}
return {};
});
return this.post(apiUrl.setVipPriceStatus, params);
}
setOffSale(params) {
... ... @@ -68,8 +51,8 @@ class ProductService extends Service {
queryProdSize(skn) {
return this.post(apiUrl.queryProdSizeList, {productSkn: skn}).then(result => {
if (result.status === 200 && _.get(result, 'data.data.list.length', 0)) {
let sizeInfo = result.data.data.list[0];
if (result.code === 200 && _.get(result, 'data.list.length', 0)) {
let sizeInfo = result.data.list[0];
_.each(sizeInfo.sizeRelationsList, rela => {
let references = _.split(rela.referenceName, '/');
... ... @@ -77,27 +60,29 @@ class ProductService extends Service {
rela.referenceNameA = references[0] || '';
rela.referenceNameB = references[1] || '';
});
return result.data.data.list[0];
return result.data.list[0];
}
return {};
});
}
saveProdSizeInfo(params) {
return this.post(apiUrl.saveProdSizeInfo, params).then(result => {
if (result.status === 200) {
return result.data;
}
return {};
});
return this.post(apiUrl.saveProdSizeInfo, params);
}
exportProductFile(params) {
return this.get(apiUrl.exportSellerProductList, {params}).then(result => {
if (result.status === 200) {
return result.data;
return this.get(apiUrl.exportSellerProductList, {params});
}
/**
* 查询商品所以有信息,包括网销信息
* @param skn
*/
getProduct(skn) {
return this.get(apiUrl.getProduct, {
params: {
productSkn: skn
}
return {};
});
}
}
... ...
... ... @@ -7,7 +7,7 @@ class SizeService extends Service {
sortId: smallSortId
},
cache: true
}).then(result => result.data);
});
}
}
... ...
... ... @@ -5,11 +5,6 @@ class SortService extends Service {
return this.get('/platform/getSellerAllSortInfo', {
params,
cache: true
}).then(res => {
if (res.status === 200) {
return res.data;
}
return {};
});
}
}
... ...
... ... @@ -11,13 +11,11 @@ const apiUrl = {
class ExpressService extends Service {
list(params) {
return this.post(apiUrl.listExpress, params)
.then(res => res.data);
return this.post(apiUrl.listExpress, params);
}
show(params) {
return this.post(apiUrl.showExpress, params)
.then(res => res.data);
return this.post(apiUrl.showExpress, params);
}
exportList() {
... ...
... ... @@ -27,92 +27,83 @@ class InvoiceService extends Service {
return this.post(apiUrl.listOrder, Object.assign({
authLevel: true,
allowedSellTypes: [2, 5, 6]
}, params)).then(res => res.data);
}, params));
}
listProduct(params) {
return this.post(apiUrl.listProduct, params)
.then(res => res.data);
return this.post(apiUrl.listProduct, params);
}
orderInfo(orderId) {
return this.post(apiUrl.infoOrder, {
proRequisitionFormId: orderId
}).then(res => res.data);
});
}
getStorageList() {
return this.post(apiUrl.storageList, {})
.then(res => res.data);
return this.post(apiUrl.storageList, {});
}
createOrder(storeroomId, predictArrivalTime, brandId) {
return this.post(apiUrl.createOrder, {
storeroomId, predictArrivalTime, brandId
}).then(res => res.data);
});
}
updateOrder(params) {
return this.post(apiUrl.updateOrder, params)
.then(res => res.data);
return this.post(apiUrl.updateOrder, params);
}
deleteOrder(storeId) {
return this.post(apiUrl.deleteOrder, {
ids: [storeId]
}).then(res => res.data);
});
}
commitOrder(storeId) {
return this.post(apiUrl.commitOrder, {
id: storeId
}).then(res => res.data);
});
}
listExpress() {
return this.get(apiUrl.listExpress, {})
.then(res => res.data);
return this.get(apiUrl.listExpress, {});
}
/**
* 发货
*/
sendOrder(params) {
return this.post(apiUrl.sendOrder, params)
.then(res => res.data);
return this.post(apiUrl.sendOrder, params);
}
listAvailableProduct(params) {
return this.post(apiUrl.listAvailableProduct, params)
.then(res => res.data);
return this.post(apiUrl.listAvailableProduct, params);
}
addGoods(params) {
return this.post(apiUrl.addGoods, params)
.then(res => res.data);
return this.post(apiUrl.addGoods, params);
}
updateGoods(params) {
return this.post(apiUrl.updateGoods, params)
.then(res => res.data);
return this.post(apiUrl.updateGoods, params);
}
deleteGoods(params) {
return this.post(apiUrl.deleteGoods, params)
.then(res => res.data);
return this.post(apiUrl.deleteGoods, params);
}
supplementProductList(params) {
return this.post(apiUrl.supplementProductList, params)
.then(res => {
if (res.data.code === 200) {
let records = _.get(res, 'data.data.records', []);
if (res.code === 200) {
let records = _.get(res, 'data.records', []);
_.each(records, item => {
item.num = 0;
item._checked = false;
});
return res.data.data;
return res.data;
}
return {};
});
... ...
... ... @@ -11,13 +11,11 @@ const apiUrl = {
class JitService extends Service {
listProduct(params) {
return this.post(apiUrl.listProduct, params)
.then(res => res.data);
return this.post(apiUrl.listProduct, params);
}
getStorageBySkn(productSkn, brandId) {
return this.post(apiUrl.getStorageBySkn, { productSkn, brandId })
.then(res => res.data);
return this.post(apiUrl.getStorageBySkn, { productSkn, brandId });
}
updateStorage(params) {
... ... @@ -28,8 +26,7 @@ class JitService extends Service {
virtualInventoryBos: params
};
return this.post(apiUrl.importJitStorage, data)
.then(res => res.data);
return this.post(apiUrl.importJitStorage, data);
}
}
export default JitService;
... ...
... ... @@ -11,13 +11,11 @@ const apiUrl = {
class ReturnService extends Service {
list(params) {
return this.post(apiUrl.list, params)
.then(res => res.data);
return this.post(apiUrl.list, params);
}
detail(params) {
return this.post(apiUrl.detail, params)
.then(res => res.data);
return this.post(apiUrl.detail, params);
}
}
export default ReturnService;
... ...
... ... @@ -2,10 +2,20 @@ import axios from 'axios';
class Service {
get(url, options) {
return axios.get(url, options);
return axios.get(url, options).then(res => {
if (res.status === 200) {
return res.data;
}
return {};
});
}
post(url, data) {
return axios.post(url, data);
return axios.post(url, data).then(res => {
if (res.status === 200) {
return res.data;
}
return {};
});
}
}
export default Service;
... ...
... ... @@ -27,7 +27,7 @@ class ShopCategoryService extends Service {
page,
size
}
}).then(res => res.data);
});
}
/**
... ... @@ -44,7 +44,7 @@ class ShopCategoryService extends Service {
data.categoryId = id;
}
return this.post(apiUrl.updateCategory, data).then(res => res.data);
return this.post(apiUrl.updateCategory, data);
}
/**
... ... @@ -54,7 +54,7 @@ class ShopCategoryService extends Service {
deleteCategory(id) {
return this.post(apiUrl.deleteCategory, {
categoryId: id
}).then(res => res.data);
});
}
/**
... ... @@ -64,8 +64,7 @@ class ShopCategoryService extends Service {
* @param size
*/
listProduct(params) {
return this.post(apiUrl.listProduct, params)
.then(res => res.data);
return this.post(apiUrl.listProduct, params);
}
/**
... ... @@ -75,8 +74,7 @@ class ShopCategoryService extends Service {
* @param size
*/
listBindProduct(params) {
return this.post(apiUrl.listBindProduct, params)
.then(res => res.data);
return this.post(apiUrl.listBindProduct, params);
}
/**
... ... @@ -84,8 +82,7 @@ class ShopCategoryService extends Service {
* @param categoryId
*/
countBindProduct(categoryId) {
return this.post(apiUrl.countBindProduct, { categoryId })
.then(res => res.data);
return this.post(apiUrl.countBindProduct, { categoryId });
}
... ... @@ -97,7 +94,7 @@ class ShopCategoryService extends Service {
createBindProduct(categoryId, productSKN) {
return this.post(apiUrl.createBindProduct, {
categoryId, productSKN: _.isArray(productSKN) ? productSKN : [productSKN]
}).then(res => res.data);
});
}
/**
... ... @@ -108,7 +105,7 @@ class ShopCategoryService extends Service {
deleteBindProduct(categoryId, productSKN) {
return this.post(apiUrl.deleteBindProduct, {
categoryId, productSKN: _.isArray(productSKN) ? productSKN : [productSKN]
}).then(res => res.data);
});
}
}
export default ShopCategoryService;
... ...
... ... @@ -4,13 +4,6 @@ class ShopService extends Service {
getShop(params) {
return this.get('/platform/getShopDetailById', {
params
})
.then(res => {
if (res.status === 200) {
return res.data;
}
return {};
});
}
... ... @@ -20,13 +13,12 @@ class ShopService extends Service {
*/
saveBaseShopInfo(shop) {
return this.post('/platform/updateShopBaseInfoById', shop)
.then(result => result.data);
return this.post('/platform/updateShopBaseInfoById', shop);
}
findShopsDecorator() {
return this.post('/platform/findBusinessShopsDecorator').then(result => result.data);
return this.post('/platform/findBusinessShopsDecorator');
}
}
export default ShopService;
... ...
... ... @@ -19,106 +19,38 @@ const apiUrl = {
class TradeService extends Service {
allotPurchaseList(params) {
return this.post(apiUrl.allotPurchaseList, params)
.then(res => {
if (res.status === 200) {
return res.data;
}
return {};
});
return this.post(apiUrl.allotPurchaseList, params);
}
allotDelivery(params) {
return this.post(apiUrl.allotDelivery, params)
.then(res => {
if (res.status === 200) {
return res.data;
}
return {};
});
return this.post(apiUrl.allotDelivery, params);
}
allotExpressList(params) {
return this.post(apiUrl.allotExpressList, params)
.then(res => {
if (res.status === 200) {
return res.data;
}
return {};
});
return this.post(apiUrl.allotExpressList, params);
}
allotExpressDetail(no) {
return this.post(apiUrl.allotExpressDetail, {
expressNumber: no
})
.then(res => {
if (res.status === 200) {
return res.data;
}
return {};
});
}
allotWarehouseInfo() {
return this.post(apiUrl.allotWarehouseInfo)
.then(res => {
if (res.status === 200) {
return res.data;
}
return {};
});
return this.post(apiUrl.allotWarehouseInfo);
}
allotStockOut(params) {
return this.post(apiUrl.allotStockOut, params)
.then(res => {
if (res.status === 200) {
return res.data;
}
return {};
});
return this.post(apiUrl.allotStockOut, params);
}
allotExpressNumList(params) {
return this.post(apiUrl.allotExpressNumList, params)
.then(res => {
if (res.status === 200) {
return res.data;
}
return {};
});
return this.post(apiUrl.allotExpressNumList, params);
}
allotExpressCompList() {
return this.get(apiUrl.allotExpressCompList)
.then(res => {
if (res.status === 200) {
return res.data;
}
return {};
});
return this.get(apiUrl.allotExpressCompList);
}
allotList(params) {
return this.post(apiUrl.allotList, params)
.then(res => {
if (res.status === 200) {
return res.data;
}
return {};
});
return this.post(apiUrl.allotList, params);
}
allotPrintExpressDetail(no) {
return this.post(apiUrl.allotPrintExpressDetail, {
expressNumber: no
})
.then(res => {
if (res.status === 200) {
return res.data;
}
return {};
});
});
}
}
export default TradeService;
... ...
... ... @@ -3,15 +3,13 @@ import Service from '../service';
class UserService extends Service {
login(username, password) {
return this.post('/login', {username, password}).then(res => {
return res.data;
});
return this.post('/login', {username, password});
}
purviews() {
return this.post('/erp/getPurview', {
platform_id: 4
}).then(res => {
return {ori: res.data.data, deep: this.deepList(res.data.data)};
return {ori: res.data, deep: this.deepList(res.data)};
});
}
deepList(purviews) {
... ... @@ -35,8 +33,6 @@ class UserService extends Service {
switchShop(shopId) {
return this.post('/switchShop', {
shopId
}).then(res => {
return res.data;
});
}
}
... ...