Bläddra i källkod

置业管理新增授权项目

许成详 6 år sedan
förälder
incheckning
cbdc04f3d0

+ 1
- 0
package.json Visa fil

@@ -16,6 +16,7 @@
16 16
     "normalize.css": "^8.0.1",
17 17
     "nprogress": "^0.2.0",
18 18
     "vue": "^2.6.6",
19
+    "vue-amap": "^0.5.9",
19 20
     "vue-echarts": "^4.0.1",
20 21
     "vue-router": "^3.0.2",
21 22
     "vuex": "^3.1.0",

+ 10
- 0
src/config/api.js Visa fil

@@ -116,6 +116,16 @@ const apis = {
116 116
       method: 'delete',
117 117
       url: `${commPrefix}/apartment/deleted/:id`
118 118
     }
119
+  },
120
+  customer:{
121
+    list:{
122
+      method:'get',
123
+      url: `${commPrefix}/customer`
124
+    },
125
+    add: {
126
+      method: 'post',
127
+      url: `${commPrefix}/customer/add`
128
+    }
119 129
   }
120 130
 }
121 131
 

+ 1
- 0
src/store/index.js Visa fil

@@ -10,6 +10,7 @@ const store = new Vuex.Store({
10 10
     apartment,
11 11
     persons: require('./modules/persons').default,
12 12
     dynamic: require('./modules/dynamic').default,
13
+    customer: require('./modules/customer').default,
13 14
     building: require('./modules/building').default,
14 15
     img: require('./modules/img').default,
15 16
   }

+ 38
- 0
src/store/modules/customer.js Visa fil

@@ -0,0 +1,38 @@
1
+import request from '../../utils/request'
2
+import apis from '../../config/api'
3
+export default {
4
+  namespaced: true,
5
+  stare:{
6
+    customers:{}
7
+  },
8
+  mutations:{
9
+    updateList (state, payload) {
10
+      state.customers = payload
11
+    },
12
+    updateDetail (state, payload) {
13
+      state.detail = payload
14
+    }
15
+  },
16
+  actions:{
17
+    setDetailNull ({ commit }) {
18
+      commit('updateDetail', {})
19
+    },
20
+    getCustomers ({ commit }, payload) {
21
+      return new Promise((resolve, reject) => {
22
+        request({
23
+          ...apis.customer.list,
24
+          params: payload,
25
+        }).then((data) => {
26
+          window.console.log(data)
27
+          commit('updateList', data)
28
+          resolve(data)
29
+        }).catch(({ message }) => {
30
+          if (typeof message === 'string') {
31
+            reject(message)
32
+          }
33
+        })
34
+      })
35
+    }
36
+    
37
+  }
38
+}

+ 0
- 1
src/store/modules/dynamic.js Visa fil

@@ -62,7 +62,6 @@ export default {
62 62
           resolve(data)
63 63
         }).catch((err) => {
64 64
           const message = err.message || err.msg
65
-
66 65
           if (typeof message === 'string') {
67 66
             reject(message)
68 67
           }

+ 84
- 34
src/views/consultant/edit.vue Visa fil

@@ -17,14 +17,13 @@
17 17
         <el-form-item label="电话">
18 18
           <el-input v-model="detail.tel"></el-input>
19 19
         </el-form-item>
20
+        <el-form-item label="授权项目">
21
+          <el-select v-model="detail.buildings" placeholder="请选择">
22
+            <el-option v-for="(build,i) in buildings.list || []" :key="i" :label="build.buildingName" :value="build.buildingId"></el-option>
23
+          </el-select>
24
+        </el-form-item>
20 25
         <el-form-item label="图片">
21
-          <el-upload
22
-            class="avatar-uploader"
23
-            :action="upFileUrl"
24
-            name='file'
25
-            :show-file-list="false"
26
-            :before-upload="beforeImgUpload"
27
-            :on-success="handleAvatarSuccess">
26
+          <el-upload class="avatar-uploader" :action="upFileUrl" name="file" :show-file-list="false" :before-upload="beforeImgUpload" :on-success="handleAvatarSuccess">
28 27
             <img v-if="detail.photo" :src="detail.photo" class="avatar">
29 28
             <i v-else class="el-icon-plus avatar-uploader-icon"></i>
30 29
           </el-upload>
@@ -47,9 +46,10 @@
47 46
 <script>
48 47
 import { createNamespacedHelpers } from 'vuex'
49 48
 import apis from '../../config/api'
49
+import E from 'wangeditor'
50 50
 
51 51
 const { mapActions: mapPersonActions } = createNamespacedHelpers('persons')
52
-
52
+const { mapState: mapBuildingState, mapActions: mapBuildingActions } = createNamespacedHelpers('building')
53 53
 export default {
54 54
   name: 'consultantEdit',
55 55
   data () {
@@ -63,13 +63,23 @@ export default {
63 63
         tel: undefined,
64 64
         photo: undefined,
65 65
         status: 1,
66
+        buildings:[]
66 67
       },
67 68
     }
68 69
   },
69 70
   created () {
70 71
     this.init()
71 72
   },
73
+  computed:{
74
+    ...mapBuildingState({
75
+      buildings: x => x.buildings
76
+    }),
77
+  },
72 78
   methods: {
79
+    
80
+    ...mapBuildingActions([
81
+      'getBuildings'
82
+    ]),
73 83
     ...mapPersonActions([
74 84
       'getConsultant',
75 85
       'editConsultant',
@@ -90,7 +100,7 @@ export default {
90 100
       this.showLoadding('上传中...')
91 101
       return true
92 102
     },
93
-  
103
+
94 104
     handleAvatarSuccess (res) {
95 105
       this.detail.photo = res.data
96 106
       this.hideLoadding()
@@ -111,7 +121,7 @@ export default {
111 121
       })
112 122
     },
113 123
 
114
-    showLoadding (text) {      
124
+    showLoadding (text) {
115 125
       this.loading = this.$loading({
116 126
         text,
117 127
         lock: true,
@@ -121,9 +131,49 @@ export default {
121 131
     },
122 132
 
123 133
     hideLoadding () {
124
-      if (this.loading) this.loading.close()      
134
+      if (this.loading) this.loading.close()
125 135
     }
126 136
   },
137
+  mounted () {
138
+    const _that = this
139
+    const phoneEditor = new E('#websiteEditorElem')
140
+    phoneEditor.customConfig.onchange = function (html) {
141
+      _that.dynamic = {..._that.dynamic, url: html}
142
+    }
143
+    // phoneEditor.customConfig.uploadImgServer = this.upFileUrl
144
+    // phoneEditor.customConfig.uploadFileName = 'uploadFiles'
145
+
146
+    phoneEditor.customConfig.customUploadImg = function (files, insert) {
147
+      _that.uploadImg(files[0]).then(data => {
148
+        insert(data)
149
+      })
150
+    }
151
+    phoneEditor.customConfig.menus = [
152
+      'head',  // 标题
153
+      'bold',  // 粗体
154
+      'fontSize',  // 字号
155
+      'fontName',  // 字体
156
+      'italic',  // 斜体
157
+      'underline',  // 下划线
158
+      'strikeThrough',  // 删除线
159
+      'foreColor',  // 文字颜色
160
+      'backColor',  // 背景颜色
161
+      'justify',  // 对齐方式
162
+      'image',  // 插入图片
163
+    ]
164
+    // phoneEditor.create()
165
+    
166
+    this.getBuildings({
167
+      pageNum: 1,
168
+      pageSize: 100,
169
+    }).then(() => {
170
+      if ((this.$route.query.id || '') !== '') {
171
+        this.getDetail({id: this.$route.query.id}).then((data) => {
172
+          phoneEditor.txt.html(data.url)
173
+        })
174
+      }
175
+    })
176
+  }
127 177
 }
128 178
 </script>
129 179
 
@@ -134,27 +184,27 @@ export default {
134 184
 </style>
135 185
 
136 186
 <style lang="scss">
137
-  .avatar-uploader .el-upload {
138
-    border: 1px dashed #d9d9d9;
139
-    border-radius: 6px;
140
-    cursor: pointer;
141
-    position: relative;
142
-    overflow: hidden;
143
-  }
144
-  .avatar-uploader .el-upload:hover {
145
-    border-color: #409EFF;
146
-  }
147
-  .avatar-uploader-icon {
148
-    font-size: 28px;
149
-    color: #8c939d;
150
-    width: 178px;
151
-    height: 178px;
152
-    line-height: 178px;
153
-    text-align: center;
154
-  }
155
-  .avatar {
156
-    width: 178px;
157
-    height: 178px;
158
-    display: block;
159
-  }
187
+.avatar-uploader .el-upload {
188
+  border: 1px dashed #d9d9d9;
189
+  border-radius: 6px;
190
+  cursor: pointer;
191
+  position: relative;
192
+  overflow: hidden;
193
+}
194
+.avatar-uploader .el-upload:hover {
195
+  border-color: #409eff;
196
+}
197
+.avatar-uploader-icon {
198
+  font-size: 28px;
199
+  color: #8c939d;
200
+  width: 178px;
201
+  height: 178px;
202
+  line-height: 178px;
203
+  text-align: center;
204
+}
205
+.avatar {
206
+  width: 178px;
207
+  height: 178px;
208
+  display: block;
209
+}
160 210
 </style>

+ 214
- 0
src/views/customer/list.vue Visa fil

@@ -0,0 +1,214 @@
1
+<template>
2
+  <div>
3
+    <div class="system-table-search">
4
+      <div class="flex-h">
5
+        <ul>
6
+          <li>
7
+            <el-input v-model="name" placeholder="客户姓名"></el-input>
8
+          </li>
9
+        </ul>
10
+        <el-button
11
+          size="mini"
12
+          type="primary" @click="search">搜索</el-button>
13
+      </div>
14
+      <div class="moreFilter"></div>
15
+    </div>
16
+    <el-table
17
+
18
+      style="width: 100%">
19
+      <el-table-column
20
+        type="index"
21
+        width="50">
22
+        <template slot-scope="scope">
23
+          <span>{{ GetIndex(scope.$index) }}</span>
24
+        </template>
25
+      </el-table-column>
26
+      <el-table-column
27
+        label="照片">
28
+        <template slot-scope="scope">
29
+          <div class="header">
30
+            <img :src="scope.row.picture" alt="" />
31
+          </div>
32
+        </template>
33
+      </el-table-column>
34
+      <el-table-column
35
+        prop="name"
36
+        label="姓名">
37
+      </el-table-column>
38
+      <el-table-column
39
+        prop="sex"
40
+        label="性别">
41
+      </el-table-column>
42
+      <el-table-column
43
+        prop="phone"
44
+        label="电话">
45
+      </el-table-column>
46
+      <el-table-column
47
+        prop="describe"
48
+        label="描述">
49
+      </el-table-column>
50
+      <el-table-column
51
+        prop="appointmentTime"
52
+        label="预约时间">
53
+      </el-table-column>
54
+      <el-table-column
55
+        prop="visiteNum"
56
+        label="到访人数">
57
+      </el-table-column>
58
+      <el-table-column
59
+        prop="intention"
60
+        label="意向项目">
61
+      </el-table-column>
62
+      <el-table-column
63
+        prop="buildingId"
64
+        label="项目ID">
65
+      </el-table-column>
66
+      <el-table-column
67
+        prop="realtyManageType"
68
+        label="物业类型">
69
+      </el-table-column>
70
+      <el-table-column
71
+        prop="demandType"
72
+        label="需求类型">
73
+      </el-table-column>
74
+      <el-table-column
75
+        prop="priceRange"
76
+        label="价格区间">
77
+      </el-table-column>
78
+      <el-table-column
79
+        prop="reportDate"
80
+        label="报备日期">
81
+      </el-table-column>
82
+      <el-table-column
83
+        prop="status"
84
+        label="状态">
85
+      </el-table-column>
86
+      <el-table-column
87
+        prop="personId"
88
+        label="推荐人">
89
+      </el-table-column>
90
+    </el-table>
91
+    <el-pagination
92
+      small
93
+      style="margin-top:10px;"
94
+      layout="prev, pager, next"
95
+      :current-page.sync="currentPage"
96
+      :pageSize="pageSize"
97
+      @current-change="getList"
98
+    >
99
+    </el-pagination>
100
+  </div>
101
+</template>
102
+<script>
103
+import { createNamespacedHelpers } from 'vuex';
104
+const {mapState:mapCustomerState,mapActions:mapCustomerActions} = createNamespacedHelpers('customer');
105
+export default {
106
+  data() {
107
+    return{
108
+      pageSize: 20,
109
+      currentPage: 1,
110
+      name: '',
111
+      sex:'',
112
+      phone:'',
113
+      picture:'',
114
+      describe:'',
115
+      appointmentTime:'',
116
+      visiteNum:'',
117
+      intention:'',
118
+      buildingId:'',
119
+      realtyManageType:'',
120
+      demandType:'',
121
+      priceRange:'',
122
+      reportDate:'',
123
+      status:'',
124
+      personId:''
125
+    }
126
+  },
127
+  computed:{
128
+    ...mapCustomerState({
129
+      customers: x => x.customers
130
+    }),
131
+  },
132
+  methods:{
133
+    ...mapCustomerActions([
134
+      'getCustomers',
135
+      'getDetail'
136
+    ]),
137
+    GetIndex (inx) {
138
+      return (this.currentPage - 1) * this.pageSize + inx + 1
139
+    },
140
+    getList () {
141
+      this.getCustomers({
142
+        pageNum: this.currentPage,
143
+        pageSize: this.pageSize,
144
+        name:this.name,
145
+        sex:this.sex,
146
+        phone:this.phone,
147
+        picture:this.picture,
148
+        describe:this.describe,
149
+        appointmentTime:this.appointmentTime,
150
+        visiteNum:this.visiteNum,
151
+        intention:this.intention,
152
+        buildingId:this.buildingId,
153
+        realtyManageType:this.realtyManageType,
154
+        demandType:this.demandType,
155
+        priceRange:this.priceRange,
156
+        reportDate:this.reportDate,
157
+        status:this.status,
158
+        personId:this.personId
159
+      })
160
+    },
161
+    search () {
162
+      this.currentPage = 1
163
+      this.getList()
164
+    },
165
+    created () {
166
+      this.getList()
167
+    }
168
+  }
169
+}
170
+</script>
171
+<style lang="scss" scoped>
172
+.list{
173
+    .header{
174
+      width: 50px;
175
+      height: 50px;
176
+      img{
177
+        width: 100%;
178
+        height: 100%;
179
+      }
180
+    }
181
+  }
182
+
183
+.system-table-search{
184
+  width: calc(100% - 40px);
185
+  margin: 20px auto 0;
186
+}
187
+
188
+.system-table-search li{
189
+  margin-right: 20px;
190
+}
191
+
192
+.system-table-search ul{
193
+  font-size: 0;
194
+  white-space: nowrap;
195
+}
196
+
197
+.system-table-search ul>li{
198
+  display: inline-block;
199
+}
200
+.flex-h {
201
+  display: flex;
202
+  display: -webkit-flex;
203
+  justify-content:flex-end;
204
+}
205
+
206
+.flex-item {
207
+  flex: 1;
208
+  -webkit-flex: 1;
209
+  position: relative;
210
+  overflow: hidden;
211
+}
212
+</style>
213
+
214
+

+ 20
- 0
src/views/index.js Visa fil

@@ -85,6 +85,26 @@ const pages = [
85 85
       }
86 86
     ]
87 87
   },
88
+  {
89
+    path: 'customer',
90
+    name: 'customer',
91
+    component: () => import('./index.vue'),
92
+    meta: {
93
+      menuShow: true,
94
+      title: '客户管理',
95
+    },
96
+    children: [
97
+      {
98
+        path: 'customerlist',
99
+        name: 'customerlist',
100
+        component: () => import('./customer/list.vue'),
101
+        meta: {
102
+          menuShow: true,
103
+          title: '客户列表',
104
+        },
105
+      }
106
+    ]
107
+  },
88 108
 ]
89 109
 
90 110
 const flatten = (rts, parents = []) => {