Authored by OF1706

shop

import SelectBrand from './select-brand';
import SelectCategory from './select-category';
import SelectSupplier from './select-supplier';
export {
SelectBrand,
SelectCategory
SelectSupplier
};
... ...
... ... @@ -9,7 +9,7 @@
<script>
import _ from 'lodash';
import service from 'finance-service';
import service from 'product-service';
export default {
name: 'SelectBrand',
... ... @@ -35,7 +35,7 @@
data() {
return {
optionList: []
};
}
},
computed: {
_fieldModel() {
... ... @@ -44,12 +44,11 @@
},
created() {
const err_msg = '获取品牌列表失败。';
service.getBrand().then((res) => {
let code = _.get(res, 'data.code');
if (code === 200) {
this.optionList = res.data.data;
if(code === 200) {
return this.optionList = res.data.data;
}
return this.$Message.error(err_msg);
... ... @@ -62,11 +61,11 @@
this.$emit('on-change', val);
}
}
};
}
</script>
<style lang="scss" scoped>
.field-label {
line-height: 32px;
}
</style>
</style>
\ No newline at end of file
... ...
<template>
<div>
<Cascader :value="value" :data="categoryList" change-on-select @on-change="selectChange"></Cascader>
<slot></slot>
</div>
</template>
<script>
import _ from 'lodash';
import service from 'product-service';
export default {
name: 'SelcetCategory',
props: {
value: {
type: Array
}
},
data() {
return {
categoryList: []
};
},
created() {
this.getSortInfo(1);
},
methods: {
getSortInfo(level, sortId) {
const params = {
level,
sortId
};
service.getAllSort(params)
.then((res) => {
if (res.code === 200) {
_.each(res.data, item => {
this.categoryList.push({
value: item.sortId,
label: item.sortName,
children: [{
value: -1,
label: ''
}]
});
});
}
});
},
selectChange(val) {
const len = val.length;
const max = val[0] || '';
const mid = val[1] || '';
const min = val[2] || '';
switch (len) {
case 1:
_.each(this.categoryList, item => {
if (item.value !== max) {
return;
}
this.getChildren(2, max)
.then(res => {
item.children.shift();
_.each(res, i => {
item.children.push({
value: i.value,
label: i.label,
children: [{
value: -1,
label: ''
}]
});
});
});
});
break;
case 2:
_.each(this.categoryList, maxItem => {
if (maxItem.value !== max) {
return;
}
_.each(maxItem.children, midItem => {
if (midItem.value !== mid) {
return;
}
this.getChildren(3, mid)
.then(res => {
midItem.children.shift();
_.each(res, i => {
midItem.children.push({
value: i.value,
label: i.label
});
});
});
});
});
break;
}
this.$emit('select-change', {
max,
mid,
min
});
},
getChildren(level, sortId) {
const params = {
level,
sortId
};
return service.getAllSort(params)
.then((res) => {
let children = [];
if (res.code === 200) {
_.each(res.data, item => {
children.push({
value: item.sortId,
label: item.sortName
});
});
}
return children;
});
}
}
};
</script>
<style lang="scss" scoped>
</style>
<template>
<Select v-model="_fieldModel" @on-change="selectChange" clearable>
<Option :value="-1">全部</Option>
<Option v-for="option in optionList" :value="option.brandId" :key="option.brandId">
{{option.brandName}}
</Option>
</Select>
</template>
<script>
import _ from 'lodash';
import service from 'finance-service';
export default {
name: 'SelectSupplier',
props: {
fieldLabel: {
type: String
},
fieldModel: {
type: [String, Number]
},
labelSpan: {
type: [String, Number],
default: 6
},
fieldSpan: {
type: [String, Number],
default: 18
}
},
data() {
return {
optionList: []
};
},
computed: {
_fieldModel() {
return this.fieldModel;
}
},
created() {
const err_msg = '获取品牌列表失败。';
service.getSupplier().then((res) => {
let code = _.get(res, 'data.code');
if (code === 200) {
this.optionList = res.data.data;
}
return this.$Message.error(err_msg);
}, (error) => {
this.$Message.error(error.message);
});
},
methods: {
selectChange(val) {
this.$emit('on-change', val);
}
}
};
</script>
<style lang="scss" scoped>
.field-label {
line-height: 32px;
}
</style>
... ...
... ... @@ -2,23 +2,25 @@
<LayoutBody>
<LayoutFilter>
<FilterItem label="对帐单号">
<!--<Input v-model.trim.trim=""-->
<!--:placeholder=""-->
<!--&gt;</Input>-->
<Input v-model.trim.trim="filters.sknCode.model"
:placeholder="filters.sknCode.holder"
></Input>
</FilterItem>
<FilterItem label="供应商">
<!--<SelectBrand>-->
<!--</SelectBrand>-->
<SelectSupplier>
</SelectSupplier>
</FilterItem>
<FilterItem label="品牌">
<SelectBrand>
</SelectBrand>
</FilterItem>
<FilterItem label="日期">
<Date-picker type="date" placeholder="选择日期" style="width: 180px"></Date-picker>
<Date-picker type="date" placeholder="选择日期" style="width: 170px"></Date-picker>
</FilterItem>
<FilterItem label="">
<Date-picker type="daterange" placement="bottom-end" placeholder="选择日期" style="width: 180px"></Date-picker>
<Date-picker type="daterange" placement="bottom-end" placeholder="选择日期" style="width: 170px"></Date-picker>
</FilterItem>
<FilterItem>
... ... @@ -29,8 +31,8 @@
<LayoutList>
<Table border :context="self" :columns="tableCols" :data="tableData"></Table>
<!--<Page :total="" :current=""-->
<!--@on-change="" :page-size="20" show-total></Page>-->
<Page :total="pageData.total" :current="pageData.current"
@on-change="pageChange" :page-size="20" show-total></Page>
</LayoutList>
</LayoutBody>
... ... @@ -40,8 +42,8 @@
<script>
import Vue from 'vue';
import service from 'finance-service';
import {SelectBrand, SelectCategory} from 'finance/filter-select';
import {filterFields, initialFields, tableCols, tableData} from './detail';
import {SelectSupplier, SelectBrand} from 'finance/filter-select';
import {filterFields, initialFields, tableCols, tableData, pageData} from './detail';
export default {
data() {
... ... @@ -49,6 +51,7 @@
self: this,
tableCols,
tableData,
pageData,
filters: '',
};
},
... ... @@ -57,9 +60,9 @@
},
methods: {
filterParams() {
// const fts = this.filters;
const fts = this.filters;
const data = {
productSkn: fts.sknCode.model
};
return data;
... ... @@ -72,6 +75,12 @@
this.pageData.current = 1;
},
clearFilter() {
this.filters = JSON.parse(initialFields);
this.productList();
this.useFilterSign = false;
this.pageData.current = 1;
},
productList(params) {
if (_.isObject(params) &&
... ... @@ -79,7 +88,7 @@
!_.isFinite(+params.productSkn)) {
this.$Message.error('SKN编码只能是数字', 3);
return;
};
}
service.productList(
_.merge(params || {}, {
... ... @@ -91,11 +100,28 @@
this.updateStore(res.data);
}
});
}
},
pageChange(page) {
this.pageData.current = page;
let params = {};
if (this.useFilterSign) {
params = this.filterParams();
}
_.merge(params, {
page,
size: 20,
productStatusStr: 1
});
this.productList(params);
},
},
components: {
SelectBrand,
SelectCategory,
SelectSupplier,
SelectBrand
}
};
</script>
... ...
... ... @@ -185,9 +185,15 @@ let tableCols = [
let tableData = [];
let pageData = {
total: 0,
current: 1
};
export {
filterFields,
initialFields,
tableCols,
tableData
tableData,
pageData
};
... ...
let filterFields = {
sknCode: {
label: 'SKN编码',
labelSpan: 6,
model: '',
holder: '',
fieldSpan: 18
},
prodCode: {
label: '商家编码',
labelSpan: 6,
model: '',
holder: '',
fieldSpan: 18
},
prodName: {
label: '商品名称',
labelSpan: 6,
model: '',
holder: '',
fieldSpan: 18
},
prodBarCode: {
label: '商品条码',
labelSpan: 6,
model: '',
holder: '',
fieldSpan: 18
},
sort: {
first: {
label: '选择类目',
holder: '选择一级类目',
labelSpan: 6,
fieldSpan: 18,
model: ''
},
second: {
label: '二级类目',
holder: '选择二级类目',
labelSpan: 6,
fieldSpan: 18,
model: ''
},
third: {
label: '三级类目',
holder: '选择三级类目',
labelSpan: 6,
fieldSpan: 18,
model: ''
}
},
brand: {
label: '选择品牌',
labelSpan: 6,
fieldSpan: 18,
model: -1
},
verifyStatus: {
label: '审核状态',
labelSpan: 6,
fieldSpan: 18,
model: -1,
options: [
{
value: -1,
label: '全部'
},
{
value: 1,
label: '下架待审核'
},
{
value: 2,
label: '下架驳回'
}
]
},
stockStatus: {
label: '库存情况',
labelSpan: 6,
fieldSpan: 18,
model: -1,
options: [
{
value: -1,
label: '全部'
},
{
value: 1,
label: '有库存'
},
{
value: 0,
label: '无库存'
}
]
}
};
let initialFields = JSON.stringify(filterFields);
let tableCols = [
{
title: '对账单号',
key: 'image',
width: 120,
align: 'center',
render (row, column, index) {
return '<cell-image :image-src="row.picImgUrl" :product-url="row.productUrl"></cell-image>';
}
},
{
title: '生成日期',
key: 'info',
align: 'center',
render(row, column, index) {
return `<cell-info
:skn="row.productSkn"
:product-name="row.productName"
:brand-name="row.brandName"
:max-name="row.maxSortName"
:middle-name="row.middleSortName"
:small-name="row.smallSortName">
</cell-info>`;
}
},
{
title: '结算周期',
key: 'price',
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>`;
}
},
{
title: '品牌',
key: 'stock',
width: 100,
align: 'center',
},
{
title: '供应商',
key: 'shelveTime',
width: 150,
align: 'center'
},
{
title: '结算金额',
key: 'verify',
align: 'center',
render(row, column, index) {
return `${auditStatus[row.auditStatus]}`
}
},
{
title: '操作',
key: 'action',
width: 180,
align: 'center',
render: function(row, column, index) {
return `<div class="action-btn-row">
<i-button type="primary" size="small" @click="editSize(row.productSkn)">尺码维护</i-button>
<i-button v-if="row._disabled" type="primary" size="small"
@click="editProduct(${row.productSkn})" disabled>内容编辑</i-button>
<i-button v-else 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>`;
}
}
];
let tableData = [];
let pageData = {
total: 0,
current: 1
};
export {
filterFields,
initialFields,
tableCols,
tableData,
pageData
};
... ...
<template>
<LayoutBody>
<LayoutFilter>
<FilterItem label="公司">
<FilterItem label="供应商">
<SelectSupplier>
</SelectSupplier>
</FilterItem>
<FilterItem label="品牌">
<SelectBrand>
</SelectBrand>
</FilterItem>
<!--<FilterItem label="品牌">-->
<!--<SelectBrand>-->
<!--</SelectBrand>-->
<!--</FilterItem>-->
<FilterItem label="日期">
<Date-picker type="date" placeholder="选择日期" style="width: 180px"></Date-picker>
<Date-picker type="date" placeholder="选择日期" style="width: 170px"></Date-picker>
</FilterItem>
<FilterItem label="">
<Date-picker type="date" placement="bottom-end" placeholder="选择日期" style="width: 180px"></Date-picker>
<Date-picker type="date" placement="bottom-end" placeholder="选择日期" style="width: 170px"></Date-picker>
</FilterItem>
<FilterItem>
... ... @@ -23,9 +25,9 @@
</LayoutFilter>
<LayoutList>
<!--<Table :columns="" :data=""></Table>-->
<!--<Page :total="" :current=""-->
<!--@on-change="" :page-size="20" show-total></Page>-->
<Table border :context="self" :columns="tableCols" :data="tableData"></Table>
<Page :total="pageData.total" :current="pageData.current"
@on-change="pageChange" :page-size="20" show-total></Page>
</LayoutList>
</LayoutBody>
... ... @@ -35,16 +37,86 @@
<script>
import Vue from 'vue';
import service from 'finance-service';
import {SelectSupplier, SelectBrand} from 'finance/filter-select';
import {filterFields, initialFields, tableCols, tableData, pageData} from './detail';
export default {
data() {
return {
self: this,
tableCols,
tableData,
pageData,
filters: '',
};
},
created() {
this.filters = JSON.parse(initialFields);
},
methods: {
filterParams() {
const fts = this.filters;
const data = {
productSkn: fts.sknCode.model
};
return data;
},
filterSearch() {
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;
},
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);
}
});
},
pageChange(page) {
this.pageData.current = page;
let params = {};
if (this.useFilterSign) {
params = this.filterParams();
}
_.merge(params, {
page,
size: 20,
productStatusStr: 1
});
this.productList(params);
},
},
components: {
SelectBrand,
SelectSupplier
}
};
</script>
... ...
... ... @@ -88,7 +88,7 @@
batchOffSale: [],
useFilterSign: false,
categoryValue: []
}
};
},
created() {
this.productList();
... ...
<template>
<LayoutBody>
<LayoutBody v-if="shopData">
<Form :label-width="100">
<Form-item label="店铺名称:">
<span>{{shopData.shopName}}</span>
... ... @@ -13,9 +13,8 @@
<Form-item label="店铺LOGO:">
<div class="upload-item">
<div class="upload-item-img">
<drag-file-upload
<drag-file-upload v-if="shopData"
:default-file="shopData.shopLogo"
:id="{goodIndex:1, imageIndex: 1}"
@on-success="uploadImageSuccess"
@on-remove="uploadImageRemove">
</drag-file-upload>
... ... @@ -48,15 +47,27 @@
3: '初始状态(异常情况)'
};
const makeSaveShop = () => {
return {
shopDomain: '',
shopIntro: '',
shopLogo: '',
shopName: '',
shopNature: '',
shopRelationList: '',
shopsId: '',
shopsType: ''
};
};
export default {
created() {
service.getShop().then((res) => {
this.shopData = res.data;
this.tableData = JSON.parse(res.data.shopRelationList);
// console.log(res);
console.log(res.data.shopLogo);
console.log('res=====');
console.log(res);
}, (error) => {
this.$Message.error(error.message);
});
... ... @@ -64,7 +75,7 @@
data() {
return {
SHOPNATURE,
shopData: {},
shopData: null,
tableCols: [
{
title: '品牌',
... ... @@ -82,33 +93,32 @@
};
},
methods: {
updateData(c) {
this.content = c;
updateData: function(content) {
this.shopData.shopIntro = content;
},
//上传图片
uploadImageSuccess: function (attach, file) {
let colorIndex = attach.goodIndex;
let imageIndex = attach.imageIndex;
uploadImageSuccess: function(attach, file) {
this.product.goods[colorIndex].goodsImage[imageIndex].imageUrl = file.url;
this.shopData.shopLogo = file.url;
},
uploadImageRemove: function (attach) {
let colorIndex = attach.goodIndex;
let imageIndex = attach.imageIndex;
this.product.goods[colorIndex].goodsImage[imageIndex].imageUrl = '';
uploadImageRemove: function() {
this.shopData.shopLogo = '';
},
//提交
beforeSubmit: function () {
beforeSubmit: function() {
let newShop = makeSaveShop();
// newShop.expectSaleTimeStr = this.product.expectSaleTimeStr;
//
// newShop.sellerGoodsInfoStr = JSON.stringify(this.handleColor());
newShop.shopDomain = this.shopData.shopDomain;
newShop.shopLogo = this.shopData.shopLogo;
newShop.shopName = this.shopData.shopName;
newShop.shopNature = this.shopData.shopNature;
newShop.shopRelationList = this.shopData.shopRelationList;
newShop.shopsId = this.shopData.shopsId;
newShop.shopsType = this.shopData.shopsType;
return newShop;
},
submit: function () {
submit: function() {
let newShop = this.beforeSubmit();
this.$Loading.start();
... ... @@ -121,17 +131,14 @@
desc: '该店铺保存成功!'
});
this.$router.push({name: 'shop'});
} else {
this.$Notice.error({
title: '保存错误',
desc: result.message
});
}
});
}
}
};
</script>
... ...
// import _ from 'lodash';
import axios from 'axios';
const apiUrl = {
productList: '/platform/querySellerProductList'
};
const balanceService = {
getSupplier() {
return axios.get('/platform');
},
getBrand() {
return axios.get('/platform');
},
productList(params) {
return axios.get(apiUrl.productList, {
return axios.get('/platform', {
params
})
.then(res => {
... ...
... ... @@ -20,9 +20,17 @@ const shopService = {
* 保存店铺基本信息
* @param shop
*/
saveBaseShopInfo(shop) {
return axios.post('/platform/getShopDetailById', shop)
.then(result => result.data);
saveBaseShopInfo(shopsId, shopLogo, shopIntro) {
let opts = {
shopsId: shopsId,
shopLogo: shopLogo,
shopIntro: shopIntro
};
return axios.get('/platform/updateShopBaseInfoById', {
params: opts
})
.then(result => result.data);
}
... ...
... ... @@ -27,7 +27,8 @@ let domainApis = {
updateSellerPrice: '/SellerPriceController/updateSellerPrice',
updateProduct: '/SellerProductController/updateProduct',
getProduct: '/SellerProductController/getProduct',
getShopDetailById: '/SellerShopController/getShopDetailById'
getShopDetailById: '/SellerShopController/getShopDetailById',
updateShopBaseInfoById: '/SellerShopController/updateShopBaseInfoById'
},
shop: {
login: '/login'
... ...