| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 | //验证付费凭证,通过后跳转const evidence = item => {    const isLeader = wx.getStorageSync('isLeader');    //应用是否开通,开通直接跳转    if (item.isneedpay) return wx.showModal({        title: '提示',        content: `当前模块未付费,是否付费使用?`,        confirmText: "去付费",        cancelText: isLeader ? "下次再说" : "提醒老板",        complete: (res) => {            if (res.confirm) createOrder();            if (res.cancel && !isLeader) sendMessage();        }    })    if (item.label == "营销物料") {        wx.switchTab({            url: item.path        });    } else {        wx.navigateTo({            url: item.path        });    }};//创建新的订单const createOrder = (query = "") => {    getApp().globalData.http.basic({        "classname": "system.payorder.payorder",        "method": "createOrder",        "content": {},    }).then(res => {        console.log("新建订单", res)        if (res.msg != '成功') return wx.showToast({            title: res.msg,            icon: "none",            mask: true        });        wx.navigateTo({            url: '/pages/teams/addOrder?sys_payorderid=' + res.data.sys_payorderid + query        })    })}//查询版本到期情况const vIndate = () => {    const http = getApp().globalData.http;    const isLeader = wx.getStorageSync('isLeader');    return http.basic({        "classname": "webmanage.site.paymentrules",        "method": "queryRemind",        "content": {            nocache: true,            pageSize: 999        }    }, false).then(res => {        console.log("版本到期情况", res)        if (res.msg != '成功') return;        let data = res.data;        let content = data.map(v => {            return `【${v.partitionname}】将于${v.enddate}日到期`        }).join(";") + ',请尽快续费!'        if (data.length) {            wx.showModal({                title: '提示',                content,                confirmText: "去付费",                cancelText: isLeader ? "下次再说" : "提醒老板",                complete: (res) => {                    if (res.confirm) createOrder(`&vid=${data[0].sys_site_systempartitionid}`);                    if (res.cancel && !isLeader) {                        sendMessage();                    } else {                        uIndate()                    }                }            })        } else {            if (isLeader) uIndate();        }    })}//查询人员到期情况const uIndate = () => {    const http = getApp().globalData.http;    http.basic({        "classname": "webmanage.site.paymentrules",        "method": "queryRemindUser",        "content": {}    }).then(res => {        console.log("人员到期情况", res)        if (res.msg != '成功') return;        let data = res.data;        let content = data.map(v => v.name).join(",")        if (data.length) wx.showModal({            title: '提示',            content: `${content}申请账号付费,请前往处理!`,            confirmText: "去付费",            cancelText: "下次再说",            complete: (res) => {                if (res.confirm) createOrder(`&users=${JSON.stringify(data.map(v => v.userid+''))}`);            }        })    })}//发送提醒付费消息发送到主账号const sendMessage = (sys_payorderid = '') => getApp().globalData.http.basic({    "classname": "system.payorder.payorder",    "method": "sendMessage",    "content": {        sys_payorderid    }}).then(s => wx.showToast({    title: '已发送消息到主体主账号',    icon: "none"}));//更新付费权限const update = that => {    that.globalData.http.basic({        "classname": "system.payorder.payorder",        "method": "query_userauth",        content: {            nocache: true        }    }).then(res => {        console.log('更新付费信息', res)        wx.setStorageSync('userauth', res.data);        wx.showToast({            title: '应用付费信息已更新',            icon: "none"        })        let page = getCurrentPages().find(v => v.__route__ == 'pages/tabbar/home/index')        if (page) {            page.refreshData();        } else {            that.globalData.refreshData();        }    });}export {    evidence,    sendMessage,    createOrder,    vIndate,    uIndate,    update}
 |