|
@@ -112,7 +112,6 @@ export default {
|
|
|
},
|
|
|
onMore() {
|
|
|
this.limit = util.plus(this.limit, 20);
|
|
|
- console.log(this.limit);
|
|
|
let data = { _id: this.form.room, customer: this.customer, shop: this.shop };
|
|
|
this.toView(data);
|
|
|
},
|
|
@@ -170,21 +169,32 @@ export default {
|
|
|
if (value == 'content') {
|
|
|
// 文字消息
|
|
|
form.msg_type = '0';
|
|
|
- if (this.form.content) form.content = this.form.content;
|
|
|
- else this.$message({ type: `warning`, message: `请输入要发送的消息` });
|
|
|
- } else {
|
|
|
+ if (this.form.content) {
|
|
|
+ form.content = this.form.content;
|
|
|
+ let res = await this.create(form);
|
|
|
+ if (this.$checkRes(res, '发送成功', '发送失败')) {
|
|
|
+ let data = { _id: res.data.room, customer: this.customer, shop: this.shop };
|
|
|
+ this.toClose();
|
|
|
+ this.search();
|
|
|
+ if (this.customer_id == this.customer._id) this.searchDetail();
|
|
|
+ else this.toView(data);
|
|
|
+ }
|
|
|
+ } else this.$message({ type: `warning`, message: `请输入要发送的消息` });
|
|
|
+ } else if (value == 'file') {
|
|
|
// 图片消息
|
|
|
form.msg_type = '1';
|
|
|
if (this.file.length == 0) this.$message({ type: `warning`, message: `请选择要发送的图片` });
|
|
|
- else form.content = this.file[0].url;
|
|
|
- }
|
|
|
- let res = await this.create(form);
|
|
|
- if (this.$checkRes(res, '发送成功', '发送失败')) {
|
|
|
- let data = { _id: res.data.room, customer: this.customer, shop: this.shop };
|
|
|
- this.toClose();
|
|
|
- this.search();
|
|
|
- if (this.customer_id == this.customer._id) this.searchDetail();
|
|
|
- else this.toView(data);
|
|
|
+ else {
|
|
|
+ form.content = this.file[0].url;
|
|
|
+ let res = await this.create(form);
|
|
|
+ if (this.$checkRes(res, '发送成功', '发送失败')) {
|
|
|
+ let data = { _id: res.data.room, customer: this.customer, shop: this.shop };
|
|
|
+ this.toClose();
|
|
|
+ this.search();
|
|
|
+ if (this.customer_id == this.customer._id) this.searchDetail();
|
|
|
+ else this.toView(data);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
// 关闭
|