offlinePayment.js 1.66 KB
Newer Older
wangcong committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
import paymentService from "@/query-actions/payments/PaymentConstant";
import PaymentConstant from "@/query-actions/payments/PaymentConstant";
/**
 * 线下批量支付动作
 * offlinePayment
 */
export default {
    execute(context, param) {
        console.log('s1 offlinePayment')
        if (context.selects.length === 0) {
            context.dom.$Message.info(paymentService.paymentNotSelectMessage);
            return;
        }
        let confirmMessage = PaymentConstant.paymentOfflineConfirmMessage;
        context.dom.$Modal.confirm({
            title: '信息提示',
            content: confirmMessage,
            onOk: () => {
                let param = {
                    "payIds": [],
                    "tableName": PaymentConstant.tableName
                }
                context.selects.forEach(e => {
                    param.payIds.push(e.id)
                })
                paymentService.postPaymentOfflineRequest(param, (data) => {
                    if (data.code === 200 && data.data.extErrorFlag) {
                        setTimeout(() => {
                            context.dom.$Modal.error({
                                title: "错误",
                                content: data.data.errorMessage
                            });
                        }, 400)
                    } else {
                        context.dom.$Message.success('线下支付完成')
                        GMS.vbus.$emit('custom-query-refresh');
                        GMS.vbus.$emit('tab-count-refresh');
                    }
                }, (resp) => {
                })
            },
            onCancel() {
            }
        });
    },
}