Commit da86f14d by zhousil

withdraw

parent 06f2486e
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
import { dbController } from "../database"; import { dbController } from "../database";
import { getLastMessageId } from "../store"; import { getLastMessageId } from "../store";
import { CustomerServiceEvent } from "../event"; import { CustomerServiceEvent } from "../event";
import xim from "../xim/xim";
@Component({ components: { message, ImagePreview, VideoPreview } }) @Component({ components: { message, ImagePreview, VideoPreview } })
export default class MessageList extends Vue { export default class MessageList extends Vue {
...@@ -192,7 +193,7 @@ ...@@ -192,7 +193,7 @@
this.handleScrollWrapper(); this.handleScrollWrapper();
this.onNewMessage((e) => { this.onNewMessage((e) => {
if (e.type === MessageType.Withdraw) { if (e.type === MessageType.Withdraw) {
const ids = e.ref_id ? [e.ref_id] : JSON.parse(e.msg); const ids = xim.withDrawMsgHandle(e);
this.executeWithDraw(ids); this.executeWithDraw(ids);
dbController dbController
.removeMessage(e.chat_id, ids) .removeMessage(e.chat_id, ids)
......
...@@ -10,6 +10,7 @@ import { ...@@ -10,6 +10,7 @@ import {
UploadImageItem, UploadImageItem,
orderPayItemPredict, orderPayItemPredict,
OrderComment, OrderComment,
PayStatus
} from "../model"; } from "../model";
import { GeneralOrderDirection } from "../model/order-product"; import { GeneralOrderDirection } from "../model/order-product";
...@@ -133,11 +134,12 @@ class OrderService { ...@@ -133,11 +134,12 @@ class OrderService {
.query({ pageIndex: 1, item_size: 100 }) .query({ pageIndex: 1, item_size: 100 })
.then((r) => { .then((r) => {
if (r && r.pageData && r.pageData.rows) { if (r && r.pageData && r.pageData.rows) {
const items = this.handler.buildRows<OrderPayItem>( let items = this.handler.buildRows<OrderPayItem>(
r.pageData.rows, r.pageData.rows,
orderPayItemPredict orderPayItemPredict
); );
items = items.filter(i => i.status !== PayStatus.Deleted &&
i.status !== PayStatus.Cancel)
if (withActions) { if (withActions) {
for (let i = 0; i < r.pageData.rows.length; i++) { for (let i = 0; i < r.pageData.rows.length; i++) {
items[i].actions = r.pageData.rows[i].actions; items[i].actions = r.pageData.rows[i].actions;
......
...@@ -765,7 +765,7 @@ export default { ...@@ -765,7 +765,7 @@ export default {
if (e.type === MessageType.Withdraw) { if (e.type === MessageType.Withdraw) {
commit( commit(
ChatStore.MUTATION_WITHDRAW, ChatStore.MUTATION_WITHDRAW,
e.msg.startsWith("[") ? JSON.parse(e.msg) : [+e.msg] xim.withDrawMsgHandle(e)
); );
} }
const scroll = () => const scroll = () =>
...@@ -782,7 +782,7 @@ export default { ...@@ -782,7 +782,7 @@ export default {
dbController dbController
.removeMessage( .removeMessage(
e.chat_id, e.chat_id,
e.msg.startsWith("[") ? JSON.parse(e.msg) : [+e.msg] xim.withDrawMsgHandle(e)
) )
.finally(() => thenAction()); .finally(() => thenAction());
} else { } else {
......
...@@ -430,6 +430,11 @@ export class Xim { ...@@ -430,6 +430,11 @@ export class Xim {
this.on("msg", action); this.on("msg", action);
vue.$once("hook:beforeDestroy", () => this.off("msg", action)); vue.$once("hook:beforeDestroy", () => this.off("msg", action));
} }
public withDrawMsgHandle(e:Message){
const ids = e.ref_id ? [e.ref_id] : e.msg.startsWith("[") ? JSON.parse(e.msg) : [+e.msg];
return ids;
}
} }
const ximInstance = new Xim(); const ximInstance = new Xim();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment