ソースを参照

Merge remote-tracking branch 'origin/master'

chenxiqiang 6 年 前
コミット
5d6a0e16a3

+ 0
- 1
hksystem/src/components/login/index.vue ファイルの表示

@@ -45,7 +45,6 @@ export default {
45 45
                     Cookies.set('user', this.username);
46 46
                     Cookies.set('token', res.data.token);
47 47
                     this.axios.defaults.headers.common['Authorization'] = "Bearer " + res.data.token;
48
-                    this.$store.commit('setAvator', 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3448484253,3685836170&fm=27&gp=0.jpg');
49 48
                     this.show = false;
50 49
                 }
51 50
             });

+ 61
- 31
hksystem/src/router/router.js ファイルの表示

@@ -65,21 +65,51 @@ export const appRouter = [
65 65
         children: [
66 66
             { path: 'housekeeper', title: '保姆订单', name: 'order_housekeeper', component: resolve => { require(['@/views/housekeeper/index.vue'], resolve); } },
67 67
             { path: 'matron', title: '月嫂订单', name: 'order_matron', component: resolve => { require(['@/views/matron/index.vue'], resolve); } },
68
-            { path: 'product', title: '产品订单', name: 'order_product', component: resolve => { require(['@/views/product/index.vue'], resolve); } },
68
+            { path: 'product', title: '产品订单', name: 'order_product', component: resolve => { require(['@/views/product-order/index.vue'], resolve); } },
69 69
             // { path: 'comment', title: '订单评论', name: 'order_comment', component: resolve => { require(['@/views/comment/index.vue'], resolve); } },
70 70
             // { path: 'status', title: '订单状态', name: 'order_status', component: resolve => { require(['@/views/comment/index.vue'], resolve); } }
71 71
         ]
72 72
     },
73
-    // {
74
-    //     path: '/act',
75
-    //     icon: 'images',
76
-    //     name: 'act',
77
-    //     title: '活动管理',
78
-    //     component: Main,
79
-    //     children: [
80
-    //         { path: 'index', title: '活动管理', name: 'act_index', component: resolve => { require(['@/views/act/index.vue'], resolve); } }
81
-    //     ]
82
-    // },
73
+    {
74
+        path: '/product',
75
+        icon: 'images',
76
+        name: 'product',
77
+        title: '产品管理',
78
+        component: Main,
79
+        children: [
80
+            { path: 'index', title: '产品管理', name: 'product_index', component: resolve => { require(['@/views/product/index.vue'], resolve); } }
81
+        ]
82
+    },
83
+    {
84
+        path: '/service',
85
+        icon: 'images',
86
+        name: 'service',
87
+        title: '分类/服务信息',
88
+        component: Main,
89
+        children: [
90
+            { path: 'index', title: '分类/服务信息', name: 'service_index', component: resolve => { require(['@/views/service/index.vue'], resolve); } }
91
+        ]
92
+    },
93
+    {
94
+        path: '/reward',
95
+        icon: 'images',
96
+        name: 'reward',
97
+        title: '打赏金额',
98
+        component: Main,
99
+        children: [
100
+            { path: 'index', title: '打赏金额', name: 'reward_index', component: resolve => { require(['@/views/reward/index.vue'], resolve); } }
101
+        ]
102
+    },
103
+    {
104
+        path: '/act',
105
+        icon: 'images',
106
+        name: 'act',
107
+        title: '活动管理',
108
+        component: Main,
109
+        children: [
110
+            { path: 'index', title: '活动管理', name: 'act_index', component: resolve => { require(['@/views/act/index.vue'], resolve); } }
111
+        ]
112
+    },
83 113
     // {
84 114
     //     path: '/product',
85 115
     //     icon: 'images',
@@ -100,26 +130,26 @@ export const appRouter = [
100 130
     //         { path: 'index', title: '产品订单', name: 'productOrder_index', component: resolve => { require(['@/views/product-order/index.vue'], resolve); } }
101 131
     //     ]
102 132
     // },
103
-    {
104
-        path: '/hourse-clean',
105
-        icon: 'images',
106
-        name: 'hourseClean',
107
-        title: '家居清洁',
108
-        component: Main,
109
-        children: [
110
-            { path: 'index', title: '家居清洁', name: 'hourseClean_index', component: resolve => { require(['@/views/house-clean/index.vue'], resolve); } }
111
-        ]
112
-    },
113
-    {
114
-        path: '/appliance-clean',
115
-        icon: 'images',
116
-        name: 'applianceClean',
117
-        title: '家电清洁',
118
-        component: Main,
119
-        children: [
120
-            { path: 'index', title: '家电清洁', name: 'applianceClean_index', component: resolve => { require(['@/views/appliance-clean/index.vue'], resolve); } }
121
-        ]
122
-    }
133
+    // {
134
+    //     path: '/hourse-clean',
135
+    //     icon: 'images',
136
+    //     name: 'hourseClean',
137
+    //     title: '家居清洁',
138
+    //     component: Main,
139
+    //     children: [
140
+    //         { path: 'index', title: '家居清洁', name: 'hourseClean_index', component: resolve => { require(['@/views/house-clean/index.vue'], resolve); } }
141
+    //     ]
142
+    // },
143
+    // {
144
+    //     path: '/appliance-clean',
145
+    //     icon: 'images',
146
+    //     name: 'applianceClean',
147
+    //     title: '家电清洁',
148
+    //     component: Main,
149
+    //     children: [
150
+    //         { path: 'index', title: '家电清洁', name: 'applianceClean_index', component: resolve => { require(['@/views/appliance-clean/index.vue'], resolve); } }
151
+    //     ]
152
+    // }
123 153
 ];
124 154
 
125 155
 var other = [

+ 13
- 5
hksystem/src/views/product-order/index.vue ファイルの表示

@@ -23,6 +23,7 @@
23 23
                     </p>
24 24
                     <div class="edittable-table-height-con">
25 25
                         <Table :columns="columns" :data="prosHandle"></Table>
26
+                        <Page :total="total" :page-size="pageSize" @on-change="getData"></Page>
26 27
                     </div>
27 28
                 </Card>
28 29
             </Col>
@@ -60,6 +61,8 @@ export default {
60 61
     },
61 62
     data () {
62 63
         return {
64
+            total: 0,
65
+            pageSize: 20,
63 66
             proShow: true,
64 67
             formContent: {},
65 68
             columns: [
@@ -137,11 +140,16 @@ export default {
137 140
             this.proShow = true;
138 141
             this.getData();
139 142
         },
140
-        getData () {
141
-            this.axios.get("/product_orders")
142
-                .then((res) => {
143
-                    this.products = res.data.data;
144
-                });
143
+        getData (num) {
144
+            this.axios.get("/product_orders", {
145
+                params: {
146
+                    page: num || 1
147
+                }
148
+            }).then((res) => {
149
+                this.products = res.data.data;
150
+                this.pageSize = res.data.per_page;
151
+                this.total = res.data.total;
152
+            });
145 153
         }
146 154
     },
147 155
     created () {

+ 99
- 0
hksystem/src/views/reward/edit.vue ファイルの表示

@@ -0,0 +1,99 @@
1
+<style lang="less">
2
+
3
+</style>
4
+
5
+<template>
6
+    <div>
7
+        <Row>
8
+            <Col span="18">
9
+                <Card>
10
+                    <Form :label-width="80">
11
+                        <FormItem label="产品名称">
12
+                            <Input v-model="form.name" icon="android-list"/>
13
+                        </FormItem>
14
+                        <FormItem label="产品款色">
15
+                            <Input v-model="form.color" icon="android-list"/>
16
+                        </FormItem>
17
+                        <FormItem label="产品价格">
18
+                            <Input v-model="form.price" icon="android-list"/>
19
+                        </FormItem>
20
+                        <FormItem label="产品分类">
21
+                            <Input v-model="form.classify" icon="android-list"/>
22
+                        </FormItem>
23
+                        <FormItem label="产品状态">
24
+                            <Select v-model="form.status" style="width: 150px">
25
+                                <Option :value="0">上架</Option>
26
+                                <Option :value="1">下架</Option>
27
+                            </Select>
28
+                        </FormItem>
29
+                        <FormItem label="产品信息">
30
+                            <editor :editor-content="form.info"></editor>
31
+                        </FormItem>
32
+                    </Form>
33
+                    <div class="submit">
34
+                        <Button @click="handlePublish" :loading="publishLoading" icon="ios-checkmark" size="large" type="primary">发布</Button>
35
+                    </div>
36
+                </Card>
37
+            </Col>
38
+        </Row>
39
+    </div>
40
+</template>
41
+
42
+<script>
43
+import tinymce from 'tinymce';
44
+import editor from '../main-components/editor'
45
+export default {
46
+    name: 'edit',
47
+    components: {
48
+        editor
49
+    },
50
+    props: {
51
+        formContent: Object
52
+    },
53
+    watch: {
54
+        formContent() {
55
+            if (!this.formContent.status) {
56
+                this.formContent.status = 0;
57
+            }
58
+            this.form = this.formContent;
59
+        }
60
+    },
61
+    data () {
62
+        return {
63
+            form: this.formContent,
64
+            publishLoading: false
65
+        };
66
+    },
67
+    methods: {
68
+        handlePublish() {
69
+            if (true) {
70
+                this.publishLoading = true;
71
+                let info = tinymce.activeEditor.getContent();
72
+                let data = {
73
+                    name: this.form.name,
74
+                    info: info,
75
+                    color: this.form.color,
76
+                    price: parseFloat(this.form.price),
77
+                    classify: this.form.classify,
78
+                    status: this.form.status
79
+                };
80
+                if (this.form.id) {
81
+                    data.id = this.form.id;
82
+                }
83
+                this.axios.post("/product/store", data).then((res) => {
84
+                    if (res.data.status == 0) {
85
+                        this.$Message.success('操作成功!');
86
+                        this.publishLoading = false;
87
+                        setTimeout(() => {
88
+                            this.$emit("pub-success");
89
+                        }, 1000);
90
+                    }
91
+                });
92
+            } else {
93
+                this.$Message.error('请完善所有信息!');
94
+                this.publishLoading = false;
95
+            }
96
+        }
97
+    }
98
+};
99
+</script>

+ 68
- 0
hksystem/src/views/reward/index.vue ファイルの表示

@@ -0,0 +1,68 @@
1
+<style lang="less">
2
+    @import '../../styles/common.less';
3
+    .ivu-card-head {
4
+        p {
5
+            height: 32px;
6
+            line-height: 32px;
7
+        }
8
+        button {
9
+            float: right;
10
+        }
11
+    }
12
+</style>
13
+
14
+<template>
15
+    <div>
16
+        <Row class="margin-top-10">
17
+            <Col>
18
+                <Card>
19
+                    <p slot="title">
20
+                        <Icon type="android-remove"></Icon>
21
+                        打赏金额
22
+                    </p>
23
+                    <div class="edittable-table-height-con">
24
+                        <Form>
25
+                            <FormItem label="金额">
26
+                                <Input v-model="price" icon="android-list" />
27
+                            </FormItem>
28
+                        </Form>
29
+                        <div class="submit">
30
+                            <Button @click="changePrice" :loading="publishLoading" icon="ios-checkmark" size="large" type="primary"></Button>
31
+                        </div>
32
+                    </div>
33
+                </Card>
34
+            </Col>
35
+        </Row>
36
+    </div>
37
+</template>
38
+
39
+<script>
40
+export default {
41
+    name: 'reward',
42
+    data () {
43
+        return {
44
+            price: 0,
45
+            publishLoading: false
46
+        };
47
+    },
48
+    methods: {
49
+        changePrice() {
50
+            this.publishLoading = true;
51
+            this.axios.post("/reward/price", {
52
+                price: parseFloat(this.price)
53
+            }).then((res) => {
54
+                if (res.data.status == 0) {
55
+                    this.$message.success('操作成功');
56
+                    this.publishLoading = false;
57
+                }
58
+            })
59
+        },
60
+        getData (num) {
61
+            
62
+        }
63
+    },
64
+    created () {
65
+        this.getData();
66
+    }
67
+};
68
+</script>

+ 107
- 0
hksystem/src/views/service/edit.vue ファイルの表示

@@ -0,0 +1,107 @@
1
+<style lang="less">
2
+
3
+</style>
4
+
5
+<template>
6
+    <div>
7
+        <Row>
8
+            <Col span="18">
9
+                <Card>
10
+                    <Form :label-width="80">
11
+                        <FormItem label="父id">
12
+                            <Input v-model="form.pid" icon="android-list"/>
13
+                        </FormItem>
14
+                        <FormItem label="分类/服务">
15
+                            <Input v-model="form.name" icon="android-list"/>
16
+                        </FormItem>
17
+                        <FormItem label="描述信息">
18
+                            <Input v-model="form.info" icon="android-list"/>
19
+                        </FormItem>
20
+                        <FormItem label="简介">
21
+                            <Input v-model="form.summary" icon="android-list"/>
22
+                        </FormItem>
23
+                        <FormItem label="服务标题">
24
+                            <Input v-model="form.server" icon="android-list"/>
25
+                        </FormItem>
26
+                        <FormItem label="富文本内容">
27
+                            <editor :editor-content="form.content"></editor>
28
+                        </FormItem>
29
+                         <FormItem label="图片位置">
30
+                             <Input v-model="form.photo" icon="android-list"/>
31
+                        </FormItem>
32
+                         <FormItem label="显示位置">
33
+                             <Select v-model="form.location" style="width: 150px">
34
+                                <Option value="top">顶部</Option>
35
+                                <Option value="bottom">底部</Option>
36
+                            </Select>
37
+                        </FormItem>
38
+                    </Form>
39
+                    <div class="submit">
40
+                        <Button @click="handlePublish" :loading="publishLoading" icon="ios-checkmark" size="large" type="primary">发布</Button>
41
+                    </div>
42
+                </Card>
43
+            </Col>
44
+        </Row>
45
+    </div>
46
+</template>
47
+
48
+<script>
49
+import tinymce from 'tinymce';
50
+import editor from '../main-components/editor'
51
+export default {
52
+    name: 'edit',
53
+    components: {
54
+        editor
55
+    },
56
+    props: {
57
+        formContent: Object
58
+    },
59
+    watch: {
60
+        formContent() {
61
+            if (!this.formContent.location) {
62
+                this.formContent.location = 'top';
63
+            }
64
+            this.form = this.formContent;
65
+        }
66
+    },
67
+    data () {
68
+        return {
69
+            form: this.formContent,
70
+            publishLoading: false
71
+        };
72
+    },
73
+    methods: {
74
+        handlePublish() {
75
+            if (true) {
76
+                this.publishLoading = true;
77
+                let content = tinymce.activeEditor.getContent();
78
+                let data = {
79
+                    pid: this.form.pid,
80
+                    name: this.form.name,
81
+                    info: this.form.info,
82
+                    summary: this.form.summary,
83
+                    server: this.form.server,
84
+                    content: content,
85
+                    photo: this.form.photo,
86
+                    location: this.form.location
87
+                };
88
+                if (this.form.id) {
89
+                    data.id = this.form.id;
90
+                }
91
+                this.axios.post("/classify/store", data).then((res) => {
92
+                    if (res.data.status == 0) {
93
+                        this.$Message.success('操作成功!');
94
+                        this.publishLoading = false;
95
+                        setTimeout(() => {
96
+                            this.$emit("pub-success");
97
+                        }, 1000);
98
+                    }
99
+                });
100
+            } else {
101
+                this.$Message.error('请完善所有信息!');
102
+                this.publishLoading = false;
103
+            }
104
+        }
105
+    }
106
+};
107
+</script>

+ 161
- 0
hksystem/src/views/service/index.vue ファイルの表示

@@ -0,0 +1,161 @@
1
+<style lang="less">
2
+    @import '../../styles/common.less';
3
+    .ivu-card-head {
4
+        p {
5
+            height: 32px;
6
+            line-height: 32px;
7
+        }
8
+        button {
9
+            float: right;
10
+        }
11
+    }
12
+    .ivu-table-cell img {
13
+        width: 100%;
14
+    }
15
+</style>
16
+
17
+<template>
18
+    <div>
19
+        <Row class="margin-top-10" v-show="proShow">
20
+            <Col>
21
+                <Card>
22
+                    <p slot="title">
23
+                        <Icon type="android-remove"></Icon>
24
+                        分类/服务信息
25
+                        <Button type="primary" @click="add">新增</Button>
26
+                    </p>
27
+                    <div class="edittable-table-height-con">
28
+                        <Table :columns="columns" :data="prosHandle"></Table>
29
+                        <Page :total="total" :page-size="pageSize" @on-change="getData"></Page>
30
+                    </div>
31
+                </Card>
32
+            </Col>
33
+        </Row>
34
+        <edit v-show="editShow" @pub-success="pubSuccess" :form-content="formContent"></edit>
35
+    </div>
36
+</template>
37
+
38
+<script>
39
+import edit from "./edit";
40
+export default {
41
+    name: 'product',
42
+    components: {
43
+        edit
44
+    },
45
+    computed: {
46
+        editShow() {
47
+            return !this.proShow;
48
+        },
49
+        prosHandle() {
50
+            let products = [].concat(JSON.parse(JSON.stringify(this.products)));
51
+            console.log(products);
52
+            return products;
53
+        }
54
+    },
55
+    data () {
56
+        return {
57
+            total: 0,
58
+            pageSize: 20,
59
+            proShow: true,
60
+            formContent: {},
61
+            columns: [
62
+                {title: "id", key: 'id'},
63
+                {title: "pid", key: 'pid', align: 'center'},
64
+                // {title: "产品信息", key: 'info'},
65
+                {title: "分类/服务名称", key: 'name', align: 'center'},
66
+                {title: "描述信息", key: 'info', align: 'center'},
67
+                {title: "富文本简介", key: 'summary', align: 'center'},
68
+                {title: "服务标题", key: 'server', align: 'center'},
69
+                {title: "富文本内容", key: 'content', align: 'center'},
70
+                {title: "图片位置", key: 'photo', align: 'center',
71
+                    render: (h, params) => {
72
+                        console.log(params);
73
+                        return h('img', {
74
+                            attrs: {
75
+                                src: params.row.photo
76
+                            }
77
+                        })
78
+                    }
79
+                },
80
+                {title: "显示位置", key: 'location', align: 'center'},
81
+                {
82
+                    title: "操作",
83
+                    key: "action",
84
+                    align: 'center',
85
+                    render: (h, params) => {
86
+                        return h('div', [
87
+                            h('Button', {
88
+                                props: {
89
+                                    type: 'primary',
90
+                                    size: 'default'
91
+                                },
92
+                                style: {
93
+                                    marginRight: '5px'
94
+                                },
95
+                                on: {
96
+                                    click: () => {
97
+                                        let id = params.row.id;
98
+                                        this.proShow = false;
99
+                                        this.products.forEach((product) => {
100
+                                            if (product.id == id) {
101
+                                                this.formContent = product;
102
+                                            }
103
+                                        })
104
+                                    }
105
+                                }
106
+                            }, '修改'),
107
+                            h('Button', {
108
+                                props: {
109
+                                    type: 'error',
110
+                                    size: 'default'
111
+                                },
112
+                                style: {
113
+                                    marginRight: '5px'
114
+                                },
115
+                                on: {
116
+                                    click: () => {
117
+                                        let id = params.row.id;
118
+                                        this.axios.delete(`/classify/${id}`)
119
+                                            .then((res) => {
120
+                                                this.products = this.products.filter((product) => {
121
+                                                    if (product.id != id) {
122
+                                                        return true;
123
+                                                    }
124
+                                                });
125
+                                            });
126
+                                    }
127
+                                }
128
+                            }, '删除')
129
+                        ]);
130
+                    }
131
+                }
132
+            ],
133
+            products: []
134
+        };
135
+    },
136
+    methods: {
137
+        add () {
138
+            this.proShow = false;
139
+            this.formContent = {};
140
+        },
141
+        pubSuccess() {
142
+            this.proShow = true;
143
+            this.getData();
144
+        },
145
+        getData (num) {
146
+            this.axios.get("/classifies", {
147
+                params: {
148
+                    page: num || 1
149
+                }
150
+            }).then((res) => {
151
+                this.products = res.data.data;
152
+                this.pageSize = res.data.per_page;
153
+                this.total = res.data.total;
154
+            });
155
+        }
156
+    },
157
+    created () {
158
+        this.getData();
159
+    }
160
+};
161
+</script>

Loading…
キャンセル
保存