Authored by 李奇

Merge remote-tracking branch 'origin/release/1.0' into feature/trade-allot-order

@@ -2,5 +2,8 @@ @@ -2,5 +2,8 @@
2 "presets": [ 2 "presets": [
3 "es2015" 3 "es2015"
4 ], 4 ],
5 - "plugins": ["transform-runtime"] 5 + "plugins": [
  6 + "transform-runtime",
  7 + "transform-object-rest-spread"
  8 + ]
6 } 9 }
@@ -68,16 +68,15 @@ export default { @@ -68,16 +68,15 @@ export default {
68 this.visible = true; 68 this.visible = true;
69 }, 69 },
70 handleRemove(file) { 70 handleRemove(file) {
71 - const fileList = this.$refs.upload.fileList;  
72 -  
73 - this.$refs.upload.fileList.splice(fileList.indexOf(file), 1); 71 + this.uploadList.splice(this.uploadList.indexOf(file), 1);
74 this.$emit('on-remove', this.id); 72 this.$emit('on-remove', this.id);
75 }, 73 },
76 - handleSuccess(response, file) { 74 + handleSuccess(response, file, files) {
77 if (_.get(response, 'data.imagesList.length', 0)) { 75 if (_.get(response, 'data.imagesList.length', 0)) {
78 file.url = response.data.imagesList[0]; 76 file.url = response.data.imagesList[0];
79 } 77 }
80 78
  79 + this.uploadList = files;
81 this.$emit('on-success', this.id, file); 80 this.$emit('on-success', this.id, file);
82 }, 81 },
83 handleError(){ 82 handleError(){
@@ -100,7 +99,6 @@ export default { @@ -100,7 +99,6 @@ export default {
100 this.show = false; 99 this.show = false;
101 this.$nextTick(() => { 100 this.$nextTick(() => {
102 this.show = true; 101 this.show = true;
103 - this.uploadList = this.$refs.upload.fileList;  
104 }) 102 })
105 } 103 }
106 }, 104 },
  1 +/**
  2 + * Created by TaoHuang on 2017/5/8.
  3 + */
  4 +
  5 +import ProductList from './list'
  6 +import ProductSelectedList from './selected'
  7 +
  8 +export default {
  9 + ProductList,
  10 + ProductSelectedList
  11 +}
  1 +<template>
  2 + <LayoutBody>
  3 + <LayoutFilter>
  4 + <FilterItem :label="filters.sknCode.label">
  5 + <Input v-model.trim="filters.sknCode.model"
  6 + :placeholder="filters.sknCode.holder"></Input>
  7 + </FilterItem>
  8 +
  9 + <FilterItem :label="filters.prodName.label">
  10 + <Input v-model.trim="filters.prodName.model"
  11 + :placeholder="filters.prodName.holder"></Input>
  12 + </FilterItem>
  13 +
  14 + <FilterItem :label="filters.prodStatus.label">
  15 + <Select v-model.trim="filters.prodStatus.model">
  16 + <Option v-for="option in filters.prodStatus.options"
  17 + :value="option.value"
  18 + :key="option.value">{{option.label}}</Option>
  19 + </Select>
  20 + </FilterItem>
  21 +
  22 + <FilterItem label="选择类目">
  23 + <SelectCategory :value="categoryValue" @select-change="sortChange"></SelectCategory>
  24 + </FilterItem>
  25 +
  26 + <FilterItem>
  27 + <Button type="primary" @click="filterSearch">查询</Button>
  28 + <Button @click="clearFilter">清空条件</Button>
  29 + </FilterItem>
  30 +
  31 +
  32 + </LayoutFilter>
  33 +
  34 + <LayoutAction>
  35 + <Button type="error">选择</Button>
  36 + </LayoutAction>
  37 +
  38 + <LayoutList>
  39 + <Table border :context="self" :columns="tableCols" :data="tableData"></Table>
  40 + <Page :total="pageData.total" :current="pageData.current"
  41 + @on-change="pageChange" :page-size="20" show-total></Page>
  42 + </LayoutList>
  43 +
  44 + </LayoutBody>
  45 +</template>
  46 +
  47 +<script>
  48 + import _ from 'lodash';
  49 + import {SelectCategory} from 'product/filter-select';
  50 + import {tableCols, tableData} from '../store'
  51 + import methods from '../methods'
  52 + import {CellImage} from 'product/table-cell';
  53 +
  54 + export default {
  55 + data() {
  56 + return {
  57 + self: this,
  58 + tableCols: tableCols,
  59 + tableData: tableData,
  60 + categoryValue: [],
  61 + pageData: {
  62 + total: 0,
  63 + current: 1
  64 + },
  65 + filters: {
  66 + sknCode: {
  67 + label: 'SKN',
  68 + model: '',
  69 + holder: ''
  70 + },
  71 + prodName: {
  72 + label: '商品名称',
  73 + model: '',
  74 + holder: ''
  75 + },
  76 + prodStatus: {
  77 + label: '上下架状态',
  78 + model: '',
  79 + options: [
  80 + {
  81 + value: -1,
  82 + label: '全部'
  83 + },
  84 + {
  85 + value: 1,
  86 + label: '上架'
  87 + },
  88 + {
  89 + value: 2,
  90 + label: '下架'
  91 + }
  92 + ]
  93 + }
  94 +
  95 + },
  96 + }
  97 + },
  98 + created() {
  99 + },
  100 + methods: {
  101 + filterParams() {
  102 + },
  103 + filterSearch() {
  104 + },
  105 + clearFilter() {
  106 + },
  107 + productList(params) {
  108 + },
  109 + reloadList() {
  110 + },
  111 + pageChange(page) {
  112 + },
  113 + sortChange() {
  114 +
  115 + },
  116 + ...methods
  117 + },
  118 + components: {
  119 + SelectCategory,
  120 + CellImage
  121 + }
  122 + }
  123 +</script>
  124 +
  125 +<style lang="scss">
  126 + .btn-row-space {
  127 + margin-top: 10px;
  128 + }
  129 +</style>
  1 +<template>
  2 + <LayoutBody>
  3 + <LayoutFilter>
  4 + <FilterItem :label="filters.sknCode.label">
  5 + <Input v-model.trim="filters.sknCode.model"
  6 + :placeholder="filters.sknCode.holder"></Input>
  7 + </FilterItem>
  8 +
  9 + <FilterItem :label="filters.prodName.label">
  10 + <Input v-model.trim="filters.prodName.model"
  11 + :placeholder="filters.prodName.holder"></Input>
  12 + </FilterItem>
  13 +
  14 + <FilterItem :label="filters.prodStatus.label">
  15 + <Select v-model.trim="filters.prodStatus.model">
  16 + <Option v-for="option in filters.prodStatus.options"
  17 + :value="option.value"
  18 + :key="option.value">{{option.label}}</Option>
  19 + </Select>
  20 + </FilterItem>
  21 +
  22 + <FilterItem label="选择类目">
  23 + <SelectCategory :value="categoryValue" @select-change="sortChange"></SelectCategory>
  24 + </FilterItem>
  25 +
  26 + <FilterItem>
  27 + <Button type="primary" @click="filterSearch">查询</Button>
  28 + <Button @click="clearFilter">清空条件</Button>
  29 + </FilterItem>
  30 +
  31 +
  32 + </LayoutFilter>
  33 +
  34 + <LayoutAction>
  35 + <Button type="error">取消选择</Button>
  36 + </LayoutAction>
  37 +
  38 + <LayoutList>
  39 + <Table border :context="self" :columns="tableCols" :data="tableData"></Table>
  40 + <Page :total="pageData.total" :current="pageData.current"
  41 + @on-change="pageChange" :page-size="20" show-total></Page>
  42 + </LayoutList>
  43 +
  44 + </LayoutBody>
  45 +</template>
  46 +
  47 +<script>
  48 + import _ from 'lodash';
  49 + import {SelectCategory} from 'product/filter-select';
  50 + import {tableCols, tableData} from '../store'
  51 + import methods from '../methods'
  52 +
  53 + export default {
  54 + data() {
  55 + return {
  56 + self: this,
  57 + tableCols: tableCols,
  58 + tableData: tableData,
  59 + categoryValue: [],
  60 + pageData: {
  61 + total: 0,
  62 + current: 1
  63 + },
  64 + filters: {
  65 + sknCode: {
  66 + label: 'SKN',
  67 + model: '',
  68 + holder: ''
  69 + },
  70 + prodName: {
  71 + label: '商品名称',
  72 + model: '',
  73 + holder: ''
  74 + },
  75 + prodStatus: {
  76 + label: '上下架状态',
  77 + model: '',
  78 + options: [
  79 + {
  80 + value: -1,
  81 + label: '全部'
  82 + },
  83 + {
  84 + value: 1,
  85 + label: '上架'
  86 + },
  87 + {
  88 + value: 2,
  89 + label: '下架'
  90 + }
  91 + ]
  92 + }
  93 +
  94 + },
  95 + }
  96 + },
  97 + created() {
  98 + },
  99 + methods: {
  100 + filterParams() {
  101 + },
  102 + filterSearch() {
  103 + },
  104 + clearFilter() {
  105 + },
  106 + productList(params) {
  107 + },
  108 + reloadList() {
  109 + },
  110 + pageChange(page) {
  111 + },
  112 + sortChange() {
  113 +
  114 + },
  115 + ...methods
  116 + },
  117 + components: {
  118 + SelectCategory
  119 + }
  120 + }
  121 +</script>
  122 +
  123 +<style lang="scss">
  124 + .btn-row-space {
  125 + margin-top: 10px;
  126 + }
  127 +</style>
  1 +<template>
  2 + <Tabs type="card" :animated="false">
  3 + <Tab-pane :label="'全部商品'">
  4 + <ProductList></ProductList>
  5 + </Tab-pane>
  6 +
  7 + <Tab-pane :label="handleCount">
  8 + <ProductSelectedList></ProductSelectedList>
  9 + </Tab-pane>
  10 +
  11 + <Button type="ghost" size="small" slot="extra" @click="back">返回</Button>
  12 + </Tabs>
  13 +</template>
  14 +<script>
  15 +
  16 +import components from './components';
  17 +
  18 +export default {
  19 + data () {
  20 + return {
  21 + count: 2,
  22 + }
  23 + },
  24 + methods: {
  25 + back() {
  26 + this.$router.push({name: 'shop.category.list'})
  27 + }
  28 + },
  29 + computed: {
  30 + handleCount(){
  31 + return `已选(${this.count})`
  32 + }
  33 + },
  34 + components: {
  35 + ...components,
  36 + }
  37 +}
  38 +</script>
  1 +/**
  2 + * Created by TaoHuang on 2017/5/8.
  3 + */
  4 +function sellStatus(status) {
  5 + return status === 1 ? '已上架' : '未上架'
  6 +}
  7 +
  8 +export default {
  9 + sellStatus
  10 +}
  1 +/**
  2 + * Created by TaoHuang on 2017/5/8.
  3 + */
  4 +
  5 +let tableCols = [
  6 + {
  7 + type: 'selection',
  8 + width: 60,
  9 + align: 'center'
  10 + },
  11 + {
  12 + title: '当前状态',
  13 + key: 'checked',
  14 + render: function(row) {
  15 + return `<div class="action-btn-row">
  16 + <Tag color="green" v-if="row.checked">已选择</Tag>
  17 + <Tag color="yellow" v-else>未选择</Tag>
  18 + </div>`;
  19 + }
  20 + },
  21 + {
  22 + title: '商品图片',
  23 + key: 'productPic',
  24 + render: function(row) {
  25 + return `<div><img :src="row.productPic" style="max-width: 80px;" alt=""></div>`
  26 +
  27 + }
  28 + },
  29 + {
  30 + title: 'SKN',
  31 + key: 'productSKN'
  32 + },
  33 + {
  34 + title: '商品名称',
  35 + key: 'productName'
  36 + },
  37 + {
  38 + title: '销售价(元)',
  39 + key: 'salePrice'
  40 + },
  41 + {
  42 + title: '可售库存',
  43 + key: 'storage'
  44 + },
  45 + {
  46 + title: '上下架状态',
  47 + key: 'status',
  48 + render: function(row) {
  49 + return `{{sellStatus(row.status)}}`
  50 + }
  51 + },
  52 + {
  53 + title: '分类',
  54 + key: 'productSort'
  55 + },
  56 + {
  57 + title: '商品分类',
  58 + key: 'saleCategory'
  59 + }
  60 +];
  61 +
  62 +let tableData = [
  63 + {
  64 + "categoryName": "111222",
  65 + "checked": true,
  66 + "factoryCode": "",
  67 + "productName": "创建的基础商品为什么找不到_审核通过",
  68 + "productPic": "",
  69 + "productSKN": 51198397,
  70 + "productSort": "裤装-连体裤-连体裤",
  71 + "saleCategory": [
  72 + "111222",
  73 + "铁锁链孤舟"
  74 + ],
  75 + "salePrice": 199,
  76 + "status": 0,
  77 + "storage": 5
  78 + },
  79 + {
  80 + "categoryName": "铁锁链孤舟",
  81 + "checked": false,
  82 + "factoryCode": "",
  83 + "productName": "得宝笔记本测试商品,请勿购买",
  84 + "productPic": "http://img13.static.yhbimg.com/goodsimg/2015/09/14/07/0216e9186d1b41e76434457636fdb3e70c.jpg",
  85 + "productSKN": 51145654,
  86 + "productSort": "创意生活-文具-本子",
  87 + "saleCategory": [
  88 + "测试111333",
  89 + "111222",
  90 + "铁锁链孤舟"
  91 + ],
  92 + "salePrice": 11,
  93 + "status": 0,
  94 + "storage": 2
  95 + }
  96 +];
  97 +
  98 +export {
  99 + tableCols,
  100 + tableData
  101 +}
  1 +/**
  2 + * Created by TaoHuang on 2017/5/8.
  3 + */
  4 +
  5 +const list = r => require.ensure([], () => r(require('./list/list')), 'shop.category');
  6 +const edit = r => require.ensure([], () => r(require('./edit/edit')), 'shop.category');
  7 +
  8 +export default [{
  9 + path: '/list.html',
  10 + name: 'list',
  11 + component: list,
  12 + meta: {
  13 + pageName: '商品分类'
  14 + }
  15 +}, {
  16 + path: '/edit.html',
  17 + name: 'edit',
  18 + component: edit,
  19 + meta: {
  20 + pageName: '商品分类编辑'
  21 + }
  22 +}];
  1 +<template>
  2 + <Modal v-model="model"
  3 + width="500"
  4 + class-name="vertical-center-modal">
  5 + <p slot="header">
  6 + 编辑商品分类
  7 + </p>
  8 +
  9 + <div style="text-align: center">
  10 + <FilterItem :label="'商品分类名称'">
  11 + <Input >fdsa</Input>
  12 + </FilterItem>
  13 + </div>
  14 +
  15 + <div slot="footer" style="text-align: center">
  16 + <Button type="primary" size="large" :loading="modal_loading" @click="submit">保存</Button>
  17 + <Button type="primary" size="large" @click="cancel">取消</Button>
  18 + </div>
  19 + </Modal>
  20 +</template>
  21 +
  22 +<script>
  23 + export default {
  24 + data() {
  25 + return {
  26 + model: false,
  27 + modal_loading: false
  28 + }
  29 + },
  30 + methods: {
  31 + show() {
  32 + this.model = true;
  33 + },
  34 + close() {
  35 + this.model = false;
  36 + },
  37 + submit(){
  38 + this.modal_loading = true;
  39 +
  40 + this.save().then(() => {
  41 + setTimeout(() => {
  42 + this.close();
  43 + }, 2000)
  44 + })
  45 + },
  46 + cancel(){
  47 + this.close();
  48 + },
  49 + save() {
  50 + },
  51 + reset() {
  52 + }
  53 + }
  54 + }
  55 +
  56 +</script>
  57 +
  58 +<style lang="scss">
  59 + .vertical-center-modal{
  60 + display: flex;
  61 + align-items: center;
  62 + justify-content: center;
  63 +
  64 + .ivu-modal{
  65 + top: 0;
  66 + }
  67 + }
  68 +</style>
  1 +/**
  2 + * Created by TaoHuang on 2017/5/8.
  3 + */
  4 +
  5 +import EditName from './EditName'
  6 +
  7 +export default {
  8 + EditName
  9 +}
  1 +<template>
  2 + <LayoutBody>
  3 + <LayoutFilter>
  4 + <FilterItem>
  5 + <Button type="primary" @click="clickCreate">新建商品分类</Button>
  6 + </FilterItem>
  7 + </LayoutFilter>
  8 +
  9 + <LayoutList>
  10 + <Table border :context="self" :columns="tableCols" :data="tableData"></Table>
  11 + <Page :total="pageData.total" :current="pageData.current"
  12 + @on-change="pageChange" :page-size="20" show-total></Page>
  13 + </LayoutList>
  14 + <EditName ref="showNameEdit"></EditName>
  15 + </LayoutBody>
  16 +</template>
  17 +
  18 +<script>
  19 + import _ from 'lodash';
  20 + import {tableCols, pageData, tableData} from './store';
  21 + import components from './components';
  22 +
  23 + export default {
  24 + data() {
  25 + return {
  26 + self: this,
  27 + tableCols,
  28 + tableData,
  29 + pageData,
  30 + }
  31 + },
  32 + methods: {
  33 + clickEditName(row) {
  34 + this.$refs.showNameEdit.show(row)
  35 + },
  36 + clickDelete(row) {
  37 + this.$Modal.confirm({
  38 + title: '删除店铺商品分类',
  39 + content: '你确定 删除 商品分类 test 么?',
  40 + onOk: function() {
  41 +
  42 + },
  43 + onCancel: function() {
  44 +
  45 + }
  46 + })
  47 + },
  48 + clickEditRelation(row) {
  49 + let categoryId = row.categoryId;
  50 + this.$router.push({name: 'shop.category.edit', query: { categoryId }})
  51 + },
  52 + clickCreate() {
  53 +
  54 + },
  55 + pageChange() {
  56 +
  57 + },
  58 +
  59 + },
  60 + components: {
  61 + ...components
  62 + }
  63 + }
  64 +</script>
  65 +
  66 +<style lang="scss">
  67 + .btn-row-space {
  68 + margin-top: 10px;
  69 + }
  70 +</style>
  1 +/**
  2 + * Created by TaoHuang on 2017/5/8.
  3 + */
  4 +
  5 +let tableCols = [
  6 + {
  7 + title: '分类ID',
  8 + key: 'categoryId',
  9 + width: 100,
  10 + align: 'center',
  11 + },
  12 + {
  13 + title: '分类名称',
  14 + width: 150,
  15 + key: 'categoryName',
  16 + align: 'center',
  17 + },
  18 + {
  19 + title: '创建时间',
  20 + key: 'addTime',
  21 + width: 200,
  22 + align: 'center',
  23 + },
  24 + {
  25 + title: '已关联商品数量',
  26 + key: 'productNum',
  27 + width: 150,
  28 + align: 'center',
  29 + },
  30 + {
  31 + title: '操作',
  32 + key: 'action',
  33 + width: 250,
  34 + align: 'center',
  35 + render: function(row) {
  36 + return `<div class="action-btn-row">
  37 + <i-button type="info" size="small" @click="clickEditName(row)">编辑名称</i-button>
  38 + <i-button type="primary" size="small" @click="clickEditRelation(row)">关联商品</i-button>
  39 + <i-button type="error" size="small" @click="clickDelete(row)">删除</i-button>
  40 + </div>`;
  41 + }
  42 + }
  43 +];
  44 +
  45 +let tableData = [
  46 + {
  47 + addTime : "2017-03-28 05:46:12",
  48 + categoryId : 448,
  49 + categoryName : "test19",
  50 + createTime : 1490694372,
  51 + productNum : 13
  52 + }
  53 +];
  54 +
  55 +let pageData = {
  56 + total: 0,
  57 + current: 1
  58 +};
  59 +
  60 +export {
  61 + tableCols,
  62 + tableData,
  63 + pageData
  64 +};
1 import info from './info'; 1 import info from './info';
  2 +import category from './category';
2 import decoration from './decoration-iframe'; 3 import decoration from './decoration-iframe';
3 4
  5 +
4 export default { 6 export default {
5 info, 7 info,
6 - decoration 8 + decoration,
  9 + category
7 }; 10 };
@@ -81,7 +81,15 @@ export default [ @@ -81,7 +81,15 @@ export default [
81 menu_id: 'shop.decoration', 81 menu_id: 'shop.decoration',
82 status: 1, 82 status: 1,
83 id: 22 83 id: 22
84 - } 84 + },
  85 + {
  86 + menu_name: '商品分类',
  87 + menu_url: '/shop/category/list.html',
  88 + menu_id: 'shop.category',
  89 + status: 1,
  90 + id: 23
  91 + },
  92 +
85 ], 93 ],
86 menu_name: '店铺管理', 94 menu_name: '店铺管理',
87 menu_id: 'shop', 95 menu_id: 'shop',
@@ -52,6 +52,7 @@ @@ -52,6 +52,7 @@
52 "babel-eslint": "^7.1.1", 52 "babel-eslint": "^7.1.1",
53 "babel-loader": "^6.2.10", 53 "babel-loader": "^6.2.10",
54 "babel-plugin-istanbul": "^3.1.2", 54 "babel-plugin-istanbul": "^3.1.2",
  55 + "babel-plugin-transform-object-rest-spread": "^6.23.0",
55 "babel-plugin-transform-runtime": "^6.22.0", 56 "babel-plugin-transform-runtime": "^6.22.0",
56 "babel-preset-env": "^1.2.1", 57 "babel-preset-env": "^1.2.1",
57 "babel-preset-stage-2": "^6.22.0", 58 "babel-preset-stage-2": "^6.22.0",