Commit da86f14d by zhousil

withdraw

parent 06f2486e
......@@ -50,6 +50,7 @@
import { dbController } from "../database";
import { getLastMessageId } from "../store";
import { CustomerServiceEvent } from "../event";
import xim from "../xim/xim";
@Component({ components: { message, ImagePreview, VideoPreview } })
export default class MessageList extends Vue {
......@@ -192,7 +193,7 @@
this.handleScrollWrapper();
this.onNewMessage((e) => {
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);
dbController
.removeMessage(e.chat_id, ids)
......
......@@ -10,6 +10,7 @@ import {
UploadImageItem,
orderPayItemPredict,
OrderComment,
PayStatus
} from "../model";
import { GeneralOrderDirection } from "../model/order-product";
......@@ -133,11 +134,12 @@ class OrderService {
.query({ pageIndex: 1, item_size: 100 })
.then((r) => {
if (r && r.pageData && r.pageData.rows) {
const items = this.handler.buildRows<OrderPayItem>(
let items = this.handler.buildRows<OrderPayItem>(
r.pageData.rows,
orderPayItemPredict
);
items = items.filter(i => i.status !== PayStatus.Deleted &&
i.status !== PayStatus.Cancel)
if (withActions) {
for (let i = 0; i < r.pageData.rows.length; i++) {
items[i].actions = r.pageData.rows[i].actions;
......
......@@ -765,7 +765,7 @@ export default {
if (e.type === MessageType.Withdraw) {
commit(
ChatStore.MUTATION_WITHDRAW,
e.msg.startsWith("[") ? JSON.parse(e.msg) : [+e.msg]
xim.withDrawMsgHandle(e)
);
}
const scroll = () =>
......@@ -782,7 +782,7 @@ export default {
dbController
.removeMessage(
e.chat_id,
e.msg.startsWith("[") ? JSON.parse(e.msg) : [+e.msg]
xim.withDrawMsgHandle(e)
)
.finally(() => thenAction());
} else {
......
......@@ -430,6 +430,11 @@ export class Xim {
this.on("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();
......
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