|
@@ -0,0 +1,145 @@
|
|
|
+//验证付费凭证,通过后跳转
|
|
|
+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
|
|
|
+}
|