Authored by htoooth

fix

... ... @@ -2,5 +2,8 @@
"presets": [
"es2015"
],
"plugins": ["transform-runtime"]
"plugins": [
"transform-runtime",
"transform-object-rest-spread"
]
}
... ...
/**
* Created by TaoHuang on 2017/5/8.
*/
import ProductList from './list'
import ProductSelectedList from './selected'
export default {
ProductList,
ProductSelectedList
}
\ No newline at end of file
... ...
<template>
<LayoutBody>
<LayoutFilter>
<FilterItem :label="filters.sknCode.label">
<Input v-model.trim="filters.sknCode.model"
:placeholder="filters.sknCode.holder"></Input>
</FilterItem>
<FilterItem :label="filters.prodName.label">
<Input v-model.trim="filters.prodName.model"
:placeholder="filters.prodName.holder"></Input>
</FilterItem>
<FilterItem :label="filters.prodStatus.label">
<Select v-model.trim="filters.prodStatus.model">
<Option v-for="option in filters.prodStatus.options"
:value="option.value"
: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">选择</Button>
</LayoutAction>
<LayoutList>
<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>
</template>
<script>
import _ from 'lodash';
import {SelectCategory} from 'product/filter-select';
import {tableCols, tableData} from '../store'
import methods from '../methods'
import {CellImage} from 'product/table-cell';
export default {
data() {
return {
self: this,
tableCols: tableCols,
tableData: tableData,
categoryValue: [],
pageData: {
total: 0,
current: 1
},
filters: {
sknCode: {
label: 'SKN',
model: '',
holder: ''
},
prodName: {
label: '商品名称',
model: '',
holder: ''
},
prodStatus: {
label: '上下架状态',
model: '',
options: [
{
value: -1,
label: '全部'
},
{
value: 1,
label: '上架'
},
{
value: 2,
label: '下架'
}
]
}
},
}
},
created() {
},
methods: {
filterParams() {
},
filterSearch() {
},
clearFilter() {
},
productList(params) {
},
reloadList() {
},
pageChange(page) {
},
sortChange() {
},
...methods
},
components: {
SelectCategory,
CellImage
}
}
</script>
<style lang="scss">
.btn-row-space {
margin-top: 10px;
}
</style>
\ No newline at end of file
... ...
<template>
<LayoutBody>
<LayoutFilter>
<FilterItem :label="filters.sknCode.label">
<Input v-model.trim="filters.sknCode.model"
:placeholder="filters.sknCode.holder"></Input>
</FilterItem>
<FilterItem :label="filters.prodName.label">
<Input v-model.trim="filters.prodName.model"
:placeholder="filters.prodName.holder"></Input>
</FilterItem>
<FilterItem :label="filters.prodStatus.label">
<Select v-model.trim="filters.prodStatus.model">
<Option v-for="option in filters.prodStatus.options"
:value="option.value"
: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">取消选择</Button>
</LayoutAction>
<LayoutList>
<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>
</template>
<script>
import _ from 'lodash';
import {SelectCategory} from 'product/filter-select';
import {tableCols, tableData} from '../store'
import methods from '../methods'
export default {
data() {
return {
self: this,
tableCols: tableCols,
tableData: tableData,
categoryValue: [],
pageData: {
total: 0,
current: 1
},
filters: {
sknCode: {
label: 'SKN',
model: '',
holder: ''
},
prodName: {
label: '商品名称',
model: '',
holder: ''
},
prodStatus: {
label: '上下架状态',
model: '',
options: [
{
value: -1,
label: '全部'
},
{
value: 1,
label: '上架'
},
{
value: 2,
label: '下架'
}
]
}
},
}
},
created() {
},
methods: {
filterParams() {
},
filterSearch() {
},
clearFilter() {
},
productList(params) {
},
reloadList() {
},
pageChange(page) {
},
sortChange() {
},
...methods
},
components: {
SelectCategory
}
}
</script>
<style lang="scss">
.btn-row-space {
margin-top: 10px;
}
</style>
... ...
<template>
<Tabs type="card" :animated="false">
<Tab-pane :label="'全部商品'">
<ProductList></ProductList>
</Tab-pane>
<Tab-pane :label="handleCount">
<ProductSelectedList></ProductSelectedList>
</Tab-pane>
<Button type="ghost" size="small" slot="extra" @click="back">返回</Button>
</Tabs>
</template>
<script>
import components from './components';
export default {
data () {
return {
count: 2,
}
},
methods: {
back() {
this.$router.push({name: 'shop.category.list'})
}
},
computed: {
handleCount(){
return `已选(${this.count})`
}
},
components: {
...components,
}
}
</script>
... ...
/**
* Created by TaoHuang on 2017/5/8.
*/
function sellStatus(status) {
return status === 1 ? '已上架' : '未上架'
}
export default {
sellStatus
}
\ No newline at end of file
... ...
/**
* Created by TaoHuang on 2017/5/8.
*/
let tableCols = [
{
type: 'selection',
width: 60,
align: 'center'
},
{
title: '当前状态',
key: 'checked',
render: function(row) {
return `<div class="action-btn-row">
<Tag color="green" v-if="row.checked">已选择</Tag>
<Tag color="yellow" v-else>未选择</Tag>
</div>`;
}
},
{
title: '商品图片',
key: 'productPic',
render: function(row) {
return `<div><img :src="row.productPic" style="max-width: 80px;" alt=""></div>`
}
},
{
title: 'SKN',
key: 'productSKN'
},
{
title: '商品名称',
key: 'productName'
},
{
title: '销售价(元)',
key: 'salePrice'
},
{
title: '可售库存',
key: 'storage'
},
{
title: '上下架状态',
key: 'status',
render: function(row) {
return `{{sellStatus(row.status)}}`
}
},
{
title: '分类',
key: 'productSort'
},
{
title: '商品分类',
key: 'saleCategory'
}
];
let tableData = [
{
"categoryName": "111222",
"checked": true,
"factoryCode": "",
"productName": "创建的基础商品为什么找不到_审核通过",
"productPic": "",
"productSKN": 51198397,
"productSort": "裤装-连体裤-连体裤",
"saleCategory": [
"111222",
"铁锁链孤舟"
],
"salePrice": 199,
"status": 0,
"storage": 5
},
{
"categoryName": "铁锁链孤舟",
"checked": false,
"factoryCode": "",
"productName": "得宝笔记本测试商品,请勿购买",
"productPic": "http://img13.static.yhbimg.com/goodsimg/2015/09/14/07/0216e9186d1b41e76434457636fdb3e70c.jpg",
"productSKN": 51145654,
"productSort": "创意生活-文具-本子",
"saleCategory": [
"测试111333",
"111222",
"铁锁链孤舟"
],
"salePrice": 11,
"status": 0,
"storage": 2
}
];
export {
tableCols,
tableData
}
\ No newline at end of file
... ...
/**
* Created by TaoHuang on 2017/5/8.
*/
const list = r => require.ensure([], () => r(require('./list/list')), 'shop.category');
const edit = r => require.ensure([], () => r(require('./edit/edit')), 'shop.category');
export default [{
path: '/category/list.html',
name: 'category.list',
component: list,
meta: {
pageName: '商品分类'
}
}, {
path: '/category/edit.html',
name: 'category.edit',
component: edit,
meta: {
pageName: '商品分类编辑'
}
}];
\ No newline at end of file
... ...
<template>
<Modal v-model="model"
width="500"
class-name="vertical-center-modal">
<p slot="header">
编辑商品分类
</p>
<div style="text-align: center">
<FilterItem :label="'商品分类名称'">
<Input >fdsa</Input>
</FilterItem>
</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>
export default {
data() {
return {
model: false,
modal_loading: false
}
},
methods: {
show() {
this.model = true;
},
close() {
this.model = false;
},
submit(){
this.modal_loading = true;
this.save().then(() => {
setTimeout(() => {
this.close();
}, 2000)
})
},
cancel(){
this.close();
},
save() {
},
reset() {
}
}
}
</script>
<style lang="scss">
.vertical-center-modal{
display: flex;
align-items: center;
justify-content: center;
.ivu-modal{
top: 0;
}
}
</style>
\ No newline at end of file
... ...
/**
* Created by TaoHuang on 2017/5/8.
*/
import EditName from './EditName'
export default {
EditName
}
\ No newline at end of file
... ...
<template>
<LayoutBody>
<LayoutFilter>
<FilterItem>
<Button type="primary" @click="clickCreate">新建商品分类</Button>
</FilterItem>
</LayoutFilter>
<LayoutList>
<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>
<EditName ref="showNameEdit"></EditName>
</LayoutBody>
</template>
<script>
import _ from 'lodash';
import {tableCols, pageData, tableData} from './store';
import components from './components';
export default {
data() {
return {
self: this,
tableCols,
tableData,
pageData,
}
},
methods: {
clickEditName(row) {
this.$refs.showNameEdit.show(row)
},
clickDelete(row) {
this.$Modal.confirm({
title: '删除店铺商品分类',
content: '你确定 删除 商品分类 test 么?',
onOk: function() {
},
onCancel: function() {
}
})
},
clickEditRelation(row) {
let categoryId = row.categoryId;
this.$router.push({name: 'shop.category.edit', query: { categoryId }})
},
clickCreate() {
},
pageChange() {
},
},
components: {
...components
}
}
</script>
<style lang="scss">
.btn-row-space {
margin-top: 10px;
}
</style>
\ No newline at end of file
... ...
/**
* Created by TaoHuang on 2017/5/8.
*/
let tableCols = [
{
title: '分类ID',
key: 'categoryId',
width: 100,
align: 'center',
},
{
title: '分类名称',
width: 150,
key: 'categoryName',
align: 'center',
},
{
title: '创建时间',
key: 'addTime',
width: 200,
align: 'center',
},
{
title: '已关联商品数量',
key: 'productNum',
width: 150,
align: 'center',
},
{
title: '操作',
key: 'action',
width: 250,
align: 'center',
render: function(row) {
return `<div class="action-btn-row">
<i-button type="info" size="small" @click="clickEditName(row)">编辑名称</i-button>
<i-button type="primary" size="small" @click="clickEditRelation(row)">关联商品</i-button>
<i-button type="error" size="small" @click="clickDelete(row)">删除</i-button>
</div>`;
}
}
];
let tableData = [
{
addTime : "2017-03-28 05:46:12",
categoryId : 448,
categoryName : "test19",
createTime : 1490694372,
productNum : 13
}
];
let pageData = {
total: 0,
current: 1
};
export {
tableCols,
tableData,
pageData
};
\ No newline at end of file
... ...
import info from './info';
import decoration from './decoration';
import category from './category';
let routers = [info, decoration];
let routers = [info, decoration, ...category];
routers.forEach(router => {
router.path = `/shop${router.path}`;
... ...
... ... @@ -67,7 +67,15 @@ export default [
menu_id: 'shop.decoration',
status: 1,
id: 22
}
},
{
menu_name: '商品分类',
menu_url: '/shop/category/list.html',
menu_id: 'shop.category',
status: 1,
id: 23
},
],
menu_name: '店铺管理',
menu_id: 'shop',
... ...
... ... @@ -52,6 +52,7 @@
"babel-eslint": "^7.1.1",
"babel-loader": "^6.2.10",
"babel-plugin-istanbul": "^3.1.2",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-preset-env": "^1.2.1",
"babel-preset-stage-2": "^6.22.0",
... ...