魏熙美 il y a 5 ans
Parent
révision
7aecfc193a

+ 13
- 1
src/config/api.js Voir le fichier

@@ -284,8 +284,20 @@ const apis = {
284 284
     },
285 285
     handle:{
286 286
       method:'get',
287
-      url: `${commPrefix}/extendContent/:id `
287
+      url: `${commPrefix}/extendContent/:id`
288 288
     },
289
+    update: {
290
+      method:'put',
291
+      url: `${commPrefix}/extendContent/:id`
292
+    },
293
+    getById: {
294
+      method:'get',
295
+      url: `${commPrefix}/extendContent/:id`
296
+    },
297
+    add: {
298
+      method:'post',
299
+      url: `${commPrefix}/extendContent`
300
+    }
289 301
   },
290 302
 }
291 303
 export default apis

+ 46
- 17
src/store/modules/carouselFigure.js Voir le fichier

@@ -52,22 +52,51 @@ export default {
52 52
         })
53 53
       })
54 54
     },
55
-    // getGoodsDetail ({ commit }, payload) {
56
-    //   return new Promise((resolve, reject) => {
57
-    //     request({
58
-    //       ...apis.goods.detail,
59
-    //       urlData: payload,
60
-    //     }).then((data) => {
61
-    //       commit('updateDetail', data)
62
-    //       resolve(data)
63
-    //     }).catch((err) => {
64
-    //       const message = err.message || err.msg
65
-
66
-    //       if (typeof message === 'string') {
67
-    //         reject(message)
68
-    //       }
69
-    //     })
70
-    //   })
71
-    // },
55
+    updateExtendContent ({ commit }, payload) {
56
+      return new Promise((resolve, reject) => {
57
+        request({
58
+          ...apis.carouselFigure.update,
59
+          urlData: { id: payload.contentId },
60
+          data: payload,
61
+        }).then((data) => {
62
+          resolve(data)
63
+        }).catch((err) => {
64
+          const message = err.message || err.msg
65
+          if (typeof message === 'string') {
66
+            reject(message)
67
+          }
68
+        })
69
+      })
70
+    },
71
+    getByIdExtendContent({ commit }, payload) { // 根据Id查询
72
+      return new Promise((resolve, reject) => {
73
+        request({
74
+          ...apis.carouselFigure.getById,
75
+          urlData: { id: payload.contentId },
76
+        }).then((data) => {
77
+          resolve(data)
78
+        }).catch((err) => {
79
+          const message = err.message || err.msg
80
+          if (typeof message === 'string') {
81
+            reject(message)
82
+          }
83
+        })
84
+      })
85
+    },
86
+    addExtendContent ({ commit }, payload) { // 添加
87
+      return new Promise((resolve, reject) => {
88
+        request({
89
+          ...apis.carouselFigure.add,
90
+          data: payload,
91
+        }).then((data) => {
92
+          resolve(data)
93
+        }).catch((err) => {
94
+          const message = err.message || err.msg
95
+          if (typeof message === 'string') {
96
+            reject(message)
97
+          }
98
+        })
99
+      })
100
+    },
72 101
   }
73 102
 }

+ 1
- 1
src/store/modules/customer.js Voir le fichier

@@ -57,7 +57,7 @@ export default {
57 57
         })
58 58
       })
59 59
     },
60
-    getRecommendCustomersUpdate ({ commit }, payload) { // 根据Id查询列表
60
+    getRecommendCustomersUpdate ({ commit }, payload) { // 修改
61 61
       return new Promise((resolve, reject) => {
62 62
         request({
63 63
           ...apis.recommendCustomer.update,

+ 189
- 102
src/views/carouselFigure/edit.vue Voir le fichier

@@ -1,66 +1,74 @@
1 1
 <template>
2 2
     <div class="edit-carousel">
3
-      <el-form ref="form" :model="building" label-width="180px">
3
+      <el-form ref="form" :model="form" label-width="180px">
4 4
         <el-form-item label="所属项目:">
5
-          <el-select v-model="buildingProperty" multiple placeholder="请选择">
6
-            <el-option v-for="(t,i) in propertyType" :key="i" :label="t.name" :value="t.id"></el-option>
5
+          <el-select v-model="form.buildingId" placeholder="请选择">
6
+            <el-option
7
+                    v-for="item in buildingList"
8
+                    :key="item.buildingId"
9
+                    :label="item.buildingName"
10
+                    :value="item.buildingId">
11
+            </el-option>
7 12
           </el-select>
8 13
         </el-form-item>
9 14
         <el-form-item label="主图:">
10 15
           <el-upload
11
-            :action="upFileUrl"
12
-            name='file'
13
-            list-type="picture-card"
14
-            :headers="uploadHeaders"
15
-            :file-list="imgList"
16
-            :show-file-list="true"
17
-            :before-upload="beforeImgUpload"
18
-            :on-success="handleAvatarSuccess"
19
-            :on-remove="handleRemove">
20
-            <i class="el-icon-plus"></i>
16
+                  :headers="uploadHeaders"
17
+                  :action="upFileUrl"
18
+                  :show-file-list="false"
19
+                  :on-success="handleAvatarSuccess">
20
+            <img v-if="imageUrl" :src="imageUrl" class="avatar">
21
+            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
21 22
           </el-upload>
22
-          <el-dialog :visible.sync="dialogVisible">
23
-            <img width="100%" :src="dialogImageUrl" alt="">
24
-          </el-dialog>
25 23
         </el-form-item>
26 24
         <el-form-item label="标题:">
27
-          <el-input v-model="building.tel"></el-input>
25
+          <el-input v-model="form.title"></el-input>
28 26
         </el-form-item>
29 27
         <el-form-item label="发布位置:">
30
-          <el-select v-model="buildingProperty" multiple placeholder="请选择">
31
-            <el-option v-for="(t,i) in propertyType" :key="i" :label="t.name" :value="t.id"></el-option>
28
+          <el-select v-model="form.showPosition" placeholder="请选择">
29
+            <el-option v-for="(item,i) in showPositionList" :key="i" :label="item.name" :value="item.value"></el-option>
32 30
           </el-select>
33 31
         </el-form-item>
34 32
         <el-form-item label="类型:">
35
-          <el-select v-model="buildingProperty" multiple placeholder="请选择">
36
-            <el-option v-for="(t,i) in propertyType" :key="i" :label="t.name" :value="t.id"></el-option>
33
+          <el-select v-model="form.contentType" placeholder="请选择">
34
+            <el-option v-for="(t,i) in contentTypeList" :key="i" :label="t.name" :value="t.value"></el-option>
37 35
           </el-select>
38 36
         </el-form-item>
39
-        <el-form-item label="发布内容:">
40
-          <div id="websiteEditorElem" style="height: 400px"></div>
37
+        <el-form-item label="发布内容:" v-if=" form.contentType === 'other'">
38
+          <rich-editor v-model="form.content" style="height: 400px; width: 1000px;" />
41 39
         </el-form-item>
42
-        <el-form-item label="发布内容:" class="publish">
43
-          <p>活动名称展示处<span class="choose" v-popover:popover4>{{showPlace?showPlace:'请选择'}}</span></p>
44
-          <el-popover ref="popover4"  placement="right"  width="560" v-model="popover4"  trigger="click">
45
-            <el-table :data="gridData">
46
-            <el-table-column width="360" property="name" label="标题"></el-table-column>
47
-            <el-table-column width="200" label="操作">
48
-              <template slot-scope="scope">
49
-                <el-button type="text" @click="handleEdit(scope.row)" size="small">选择</el-button>
50
-        </template>
51
-            </el-table-column>
52
-            </el-table>
53
-          </el-popover>
40
+        <el-form-item label="发布活动:" class="publish" v-if=" form.contentType === 'activity'">
41
+          <p>{{ showPlace }}<span class="choose" @click="showDial">请选择</span></p>
54 42
         </el-form-item>
55 43
         <el-form-item label="状态:">
56
-          <el-select v-model="buildingProperty" multiple placeholder="请选择">
57
-            <el-option v-for="(t,i) in propertyType" :key="i" :label="t.name" :value="t.id"></el-option>
44
+          <el-select v-model="form.status" placeholder="请选择">
45
+            <el-option v-for="(t,i) in extendContentStatus" :key="i" :label="t.name" :value="t.value"></el-option>
58 46
           </el-select>
59 47
         </el-form-item>
60 48
         <el-form-item>
61
-          <el-button type="primary" @click="onSubmit">保存</el-button>
49
+          <el-button type="primary" @click="submitAddOrUpdate">保存</el-button>
62 50
           <el-button @click="onCancel">取消</el-button>
63 51
         </el-form-item>
52
+
53
+
54
+        <el-dialog title="选择活动" :visible.sync="dialogTableVisible">
55
+          <el-table :data="activityList">
56
+            <el-table-column property="title" label="活动名称"></el-table-column>
57
+            <el-table-column fixed="right" label="操作">
58
+              <template slot-scope="scope">
59
+                <el-button type="text" @click="handleDel(scope.row)" size="small">选择</el-button>
60
+              </template>
61
+            </el-table-column>
62
+          </el-table>
63
+          <el-pagination
64
+                  @size-change="dialogHandleSizeChange"
65
+                  @current-change="dialogHandleCurrentChange"
66
+                  :current-page.sync="activityForm.pageNum"
67
+                  :page-size="activityForm.pageSize"
68
+                  layout="total, prev, pager, next"
69
+                  :total="activityTotal">
70
+          </el-pagination>
71
+        </el-dialog>
64 72
       </el-form>
65 73
     </div>    
66 74
 </template>
@@ -87,6 +95,76 @@ export default {
87 95
   data() {
88 96
     var _self = this;
89 97
     return {
98
+      form: {
99
+        contentId: '',
100
+        buildingId: '',
101
+        image: '',
102
+        title: '',
103
+        showPosition: '',
104
+        contentType: '',
105
+        content: '',
106
+        status: 0,
107
+        targetId: '',
108
+        showType: 'banner'
109
+      },
110
+      imageUrl: '',
111
+      buildingList: [], // 所属项目
112
+      buildingForm: { // 所属项目条件
113
+        pageNum: 1,
114
+        pageSize: 100
115
+      },
116
+      showPositionList: [
117
+        {
118
+          name: '首页',
119
+          value: 'index'
120
+        },
121
+        {
122
+          name: '商城',
123
+          value: 'mall'
124
+        }
125
+      ],
126
+      contentTypeList: [
127
+        {
128
+          name: '活动',
129
+          value: 'activity'
130
+        },
131
+        {
132
+          name: '项目',
133
+          value: 'project'
134
+        },
135
+        {
136
+          name: '资讯',
137
+          value: 'news'
138
+        },
139
+        {
140
+          name: '其他',
141
+          value: 'other'
142
+        }
143
+      ],
144
+      extendContentStatus: [ // 状态
145
+        {
146
+          name: "启用",
147
+          value: 1
148
+        },
149
+        {
150
+          name: "停用",
151
+          value: 0
152
+        },
153
+      ],
154
+      activityForm: { // 活动查询条件
155
+        pageNum: 1,
156
+        pageSize: 10
157
+      },
158
+      activityTotal: 0, // 活动总数
159
+      dialogTableVisible: false, //选择活动弹框
160
+      activityList: [], // 活动列表
161
+
162
+
163
+
164
+
165
+
166
+
167
+      // 下面的不敢删除
90 168
       popover4:false,//弹框
91 169
       showPlace:'',//活动名称展示处
92 170
       gridData: [
@@ -203,13 +281,8 @@ export default {
203 281
       return true;
204 282
     },
205 283
     handleAvatarSuccess(res) {
206
-      this.imgList = [
207
-        ...this.imgList,
208
-        {
209
-          url: res.data
210
-        }
211
-      ];
212
-      this.loading.close();
284
+      this.imageUrl = res.data
285
+      this.form.image = res.data
213 286
     },
214 287
     handleMapImgSuccess(res) {
215 288
       this.building = { ...this.building, mapImg: res.data };
@@ -328,66 +401,80 @@ export default {
328 401
     //     this.showHx = true;
329 402
     //   });
330 403
     // },
331
-    handleDel(row) {
332
-      this.$confirm("确认删除此数据?", "提示", {
333
-        confirmButtonText: "确定",
334
-        cancelButtonText: "取消",
335
-        type: "warning"
336
-      }).then(() => {
337
-        if (this.building.status === 1) {
338
-          this.$message.error("当前楼盘处于发布状态,不允许删除!");
339
-          return false;
340
-        }
341
-        this.deleteApartment({
342
-          id: row.apartmentId
343
-        }).then(() => {
344
-          this.getAparmentList();
345
-        });
404
+    handleDel(row) { // 选择
405
+      this.form.targetId = row.dynamicId
406
+      this.showPlace = row.title
407
+      this.dialogTableVisible = false
408
+    },
409
+
410
+    showDial() { // 显示活动弹窗
411
+      this.dialogTableVisible = true
412
+      this.getActivityList()
413
+    },
414
+    getExtendContentById() {
415
+      this.$store.dispatch('carouselFigure/getByIdExtendContent', this.form).then((res) => {
416
+        console.log('carouselFigure/getByIdExtendContent', res)
417
+        this.form = res
418
+        this.imageUrl = res.image
419
+        this.showPlace = res.targetName
420
+      }).catch(() => {
421
+        console.log('carouselFigure/getByIdExtendContent err')
422
+      })
423
+    },
424
+    getBuildList() {
425
+      this.$store.dispatch('building/getBuildings', this.buildingForm).then((res) => {
426
+        this.buildingList = res.records
427
+      }).catch(() => {
428
+        console.log('building/getBuildings err')
429
+      })
430
+    },
431
+    getActivityList() { // 活动列表
432
+      this.$store.dispatch('activity/getActivityList',this.activityForm).then(res => {
433
+        this.activityList = res.list;
434
+        this.activityForm.pageSize = res.pageSize
435
+        this.activityForm.pageNum = res.pageNum
436
+        this.activityTotal = res.total
437
+      }).catch(err => {
438
+        this.$notify.error(err.msg || err.message);
346 439
       });
347
-    }
440
+    },
441
+    dialogHandleSizeChange(value) {
442
+      this.activityForm.pageSize = value
443
+      this.getActivityList()
444
+    },
445
+    dialogHandleCurrentChange(value) {
446
+      this.activityForm.pageNum = value
447
+      this.getActivityList()
448
+    },
449
+    submitAddOrUpdate() { // 添加或者修改
450
+
451
+      // 添加
452
+      if (this.form.contentId === undefined || this.form.contentId === '') {
453
+        this.$store.dispatch('carouselFigure/addExtendContent', this.form).then((res) => {
454
+          this.$message.success('操作成功')
455
+          this.$router.go(-1)
456
+        }).catch(() => {
457
+
458
+        })
459
+        return
460
+      }
461
+
462
+      // 修改
463
+      this.$store.dispatch('carouselFigure/updateExtendContent', this.form).then((res) => {
464
+        this.$message.success('操作成功')
465
+        this.$router.go(-1)
466
+      }).catch(() => {
467
+        console.log('carouselFigure/updateExtendContent err')
468
+      })
469
+    },
470
+
348 471
   },
349
-  mounted() {
350
-    const _that = this;
351
-    const phoneEditor = new E("#websiteEditorElem");
352
-    phoneEditor.customConfig.onchange = function(html) {
353
-      _that.building = { ..._that.building, remark: html };
354
-    };
355
-    phoneEditor.customConfig.customUploadImg = function(files, insert) {
356
-      _that.uploadImg(files[0]).then(data => {
357
-        insert(data[0]);
358
-      });
359
-    };
360
-    phoneEditor.customConfig.menus = [
361
-      "head", // 标题
362
-      "bold", // 粗体
363
-      "fontSize", // 字号
364
-      "fontName", // 字体
365
-      "italic", // 斜体
366
-      "underline", // 下划线
367
-      "strikeThrough", // 删除线
368
-      "foreColor", // 文字颜色
369
-      "backColor", // 背景颜色
370
-      "justify", // 对齐方式
371
-      "image" // 插入图片
372
-    ];
373
-    phoneEditor.create();
374
-    if ((this.$route.query.id || "") !== "") {
375
-      this.getAparmentList();
376
-      window.console.log(this.getDetail);
377
-      this.getDetail({ id: this.$route.query.id }).then(data => {
378
-        this.buildingProperty = data.propertyType.split(",");
379
-        phoneEditor.txt.html(data.remark);
380
-        this.imgList = data.buildingImg.map(x => {
381
-          return {
382
-            name: x.imgId,
383
-            url: x.url
384
-          };
385
-        });
386
-        this.tags = data.buildingTag.map(x => x.tagName);
387
-      });
388
-    } else {
389
-      phoneEditor.txt.html("");
472
+  created() {
473
+    this.form.contentId = this.$route.query.id
474
+    if (this.$route.query.id !== undefined) {
475
+      this.getExtendContentById()
390 476
     }
477
+    this.getBuildList()
391 478
   }
392 479
 };
393 480
 </script>

+ 45
- 24
src/views/carouselFigure/list.vue Voir le fichier

@@ -5,6 +5,14 @@
5 5
         <div class="flex-item flex-h">
6 6
           <el-button size="mini" type="success" @click='addDynamic'>新增</el-button>
7 7
         </div>
8
+        <el-select v-model="buildingId" placeholder="请选择" @change="getList">
9
+          <el-option
10
+                  v-for="item in buildingList"
11
+                  :key="item.buildingId"
12
+                  :label="item.buildingName"
13
+                  :value="item.buildingId">
14
+          </el-option>
15
+        </el-select>
8 16
       </div>
9 17
       <div class="moreFilter"></div>
10 18
     </div>
@@ -26,10 +34,12 @@
26 34
       <el-table-column
27 35
         prop="showType"
28 36
         label="类型">
37
+        <template slot-scope="scope">{{ scope.row.showType === 'banner' ? '轮播图' : '' }}</template>
29 38
       </el-table-column>
30 39
       <el-table-column
31 40
         prop="showPosition"
32 41
         label="发布位置">
42
+        <template slot-scope="scope">{{ scope.row.showPosition === 'index' ? '首页' : scope.row.showPosition === 'mall' ? '商城' : '' }}</template>
33 43
       </el-table-column>
34 44
       <el-table-column
35 45
         label="发布时间"
@@ -51,8 +61,8 @@
51 61
         width="180">
52 62
         <template slot-scope="scope">
53 63
           <el-button type="text" @click="handleEdit(scope.row)" v-if="scope.row.status === 0" size="small">编辑</el-button>
54
-          <el-button type="text" @click="handlePulic(scope.row)" size="small" v-if="scope.row.status === 0">启用</el-button>
55
-          <el-button type="text" @click="Prohibit(scope.row)" size="small" v-if="scope.row.status === 1">禁用</el-button>
64
+          <el-button type="text" @click="handlePulic(scope.row.contentId, 1)" size="small" v-if="scope.row.status === 0">启用</el-button>
65
+          <el-button type="text" @click="Prohibit(scope.row.contentId, 0)" size="small" v-if="scope.row.status === 1">禁用</el-button>
56 66
         </template>
57 67
       </el-table-column>
58 68
     </el-table>
@@ -89,7 +99,12 @@ export default {
89 99
       pageSize: 20,
90 100
       currentPage: 1,
91 101
       name: "",
92
-      buildingId: ""
102
+      buildingId: "",
103
+      buildingList: [], // 所属项目
104
+      buildingForm: { // 所属项目条件
105
+        pageNum: 1,
106
+        pageSize: 100
107
+      },
93 108
     };
94 109
   },
95 110
   computed: {
@@ -115,7 +130,8 @@ export default {
115 130
     getList() {
116 131
       this.getExtendContent({
117 132
         pageNum: this.currentPage,
118
-        pageSize: this.pageSize
133
+        pageSize: this.pageSize,
134
+        buildingId: this.buildingId
119 135
       });
120 136
     },
121 137
     getBuildingName(id) {
@@ -129,32 +145,27 @@ export default {
129 145
       this.getList();
130 146
     },
131 147
     handleEdit(row) {
132
-      this.$router.push({ name: "editCarousel", query: { id: row.dynamicId } });
148
+      this.$router.push({ name: "editCarousel", query: { id: row.contentId } });
133 149
     },
134
-    handlePulic(row) {
150
+    handlePulic(contentId, status) {
135 151
       this.$confirm("确认发布此数据?", "提示", {
136 152
         confirmButtonText: "确定",
137 153
         cancelButtonText: "取消",
138 154
         type: "warning"
139
-      }).then(() => {});
155
+      }).then(() => {
156
+        this.updateExtendContent(contentId, status)
157
+      });
140 158
     },
141
-    Prohibit(row) {
159
+    Prohibit(contentId, status) {
142 160
       this.$confirm("确认停用此轮播图?", "提示", {
143 161
         confirmButtonText: "确定",
144 162
         cancelButtonText: "取消",
145 163
         type: "warning"
146 164
       }).then(() => {
147
-        this.handleExtendContent(row.contentId)
148
-        .then(res => {
149
-          
150
-        
151
-        })
152
-        .catch(err => {
153
-         
154
-        });
165
+        this.updateExtendContent(contentId, status)
155 166
       });
156 167
     },
157
-    handleDel(row) {
168
+    handleDel(contentId, status) {
158 169
       this.$confirm("确认删除此数据?", "提示", {
159 170
         confirmButtonText: "确定",
160 171
         cancelButtonText: "取消",
@@ -166,17 +177,27 @@ export default {
166 177
         }
167 178
       });
168 179
     },
180
+    updateExtendContent(contentId, status) { // 修改轮播状态
181
+      this.$store.dispatch('carouselFigure/updateExtendContent', { contentId: contentId, status: status }).then((res) => {
182
+        this.getList();
183
+      }).catch(() =>{
184
+        console.log('carouselFigure/updateExtendContent err')
185
+      })
186
+    },
169 187
     addDynamic() {
170 188
       this.$router.push({ name: "editCarousel" });
171
-    }
189
+    },
190
+    getBuildList() {
191
+      this.$store.dispatch('building/getBuildings', this.buildingForm).then((res) => {
192
+        this.buildingList = res.records
193
+      }).catch(() => {
194
+        console.log('building/getBuildings err')
195
+      })
196
+    },
172 197
   },
173 198
   created() {
174
-    this.getBuildings({
175
-      pageNum: 1,
176
-      pageSize: 100
177
-    }).then(() => {
178
-      this.getList();
179
-    });
199
+    this.getBuildList()
200
+    this.getList();
180 201
   }
181 202
 };
182 203
 </script>

+ 1
- 2
src/views/customer/editCustomer.vue Voir le fichier

@@ -250,8 +250,7 @@
250 250
         this.getConsultantsList()
251 251
       },
252 252
       dialogHandleCurrentChange(value) {
253
-        this.dialogForm.pageNumber = 1
254
-        this.dialogForm.pageSize = value
253
+        this.dialogForm.pageNumber = value
255 254
         this.getConsultantsList()
256 255
       }
257 256
     },

+ 1
- 2
src/views/customer/editRecommend.vue Voir le fichier

@@ -271,8 +271,7 @@ export default {
271 271
       this.getConsultantsList()
272 272
     },
273 273
     dialogHandleCurrentChange(value) {
274
-      this.dialogForm.pageNumber = 1
275
-      this.dialogForm.pageSize = value
274
+      this.dialogForm.pageNumber = value
276 275
       this.getConsultantsList()
277 276
     }
278 277
   },

+ 2
- 4
src/views/customer/list.vue Voir le fichier

@@ -298,8 +298,7 @@
298 298
         this.getConsultantsList()
299 299
       },
300 300
       dialogHandleCurrentChange(value) {
301
-        this.dialogForm.pageNumber = 1
302
-        this.dialogForm.pageSize = value
301
+        this.dialogForm.pageNumber = value
303 302
         this.getConsultantsList()
304 303
       },
305 304
       getConsultantsList() {
@@ -352,8 +351,7 @@
352 351
         this.getRecommendCustomerList()
353 352
       },
354 353
       recommendedDialogHandleCurrentChange(value) {
355
-        this.recommendedDialogConsultantForm.pageNumber = 1
356
-        this.recommendedDialogConsultantForm.pageSize = value
354
+        this.recommendedDialogConsultantForm.pageNumber = value
357 355
         this.getConsultantsList()
358 356
       },
359 357
     }