|
@@ -2,26 +2,41 @@
|
|
|
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
|
|
|
- });
|
|
|
+ if (item.isneedpay) {
|
|
|
+ update(false).then(res => {
|
|
|
+ let p = res.find(v => v.label == item.label);
|
|
|
+ if (p && !p.isneedpay) {
|
|
|
+ toPage()
|
|
|
+ } else {
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: `当前模块未付费,是否付费使用?`,
|
|
|
+ confirmText: "去付费",
|
|
|
+ cancelText: isLeader ? "下次再说" : "提醒老板",
|
|
|
+ complete: (res) => {
|
|
|
+ if (res.confirm) createOrder();
|
|
|
+ if (res.cancel && !isLeader) sendMessage();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
} else {
|
|
|
- wx.navigateTo({
|
|
|
- url: item.path
|
|
|
- });
|
|
|
+ toPage()
|
|
|
+ }
|
|
|
+
|
|
|
+ function toPage() {
|
|
|
+ if (item.label == "营销物料") {
|
|
|
+ wx.switchTab({
|
|
|
+ url: item.path
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: item.path
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
//创建新的订单
|
|
|
const createOrder = (query = "") => {
|
|
|
getApp().globalData.http.basic({
|
|
@@ -30,11 +45,11 @@ const createOrder = (query = "") => {
|
|
|
"content": {},
|
|
|
}).then(res => {
|
|
|
console.log("新建订单", res)
|
|
|
- if (res.msg != '成功') return wx.showToast({
|
|
|
- title: res.msg,
|
|
|
- icon: "none",
|
|
|
- mask: true
|
|
|
- });
|
|
|
+ if (res.msg != '成功') return wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: res.msg,
|
|
|
+ showCancel: false,
|
|
|
+ })
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/teams/addOrder?sys_payorderid=' + res.data.sys_payorderid + query
|
|
|
})
|
|
@@ -113,27 +128,30 @@ const sendMessage = (sys_payorderid = '') => getApp().globalData.http.basic({
|
|
|
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();
|
|
|
- }
|
|
|
- });
|
|
|
+const update = (total = true) => {
|
|
|
+ return new Promise((resolve) => {
|
|
|
+ getApp().globalData.http.basic({
|
|
|
+ "classname": "system.payorder.payorder",
|
|
|
+ "method": "query_userauth",
|
|
|
+ content: {
|
|
|
+ nocache: true
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log('更新付费信息', res)
|
|
|
+ if (res.msg != '成功') return resolve(false)
|
|
|
+ wx.setStorageSync('userauth', res.data);
|
|
|
+ if (total) wx.showToast({
|
|
|
+ title: '应用付费信息已更新',
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ try {
|
|
|
+ let page = getCurrentPages().find(v => v.__route__ == 'pages/tabbar/home/index')
|
|
|
+ resolve(page ? page.refreshData() : getApp().globalData.refreshData())
|
|
|
+ } catch (error) {
|
|
|
+ resolve([])
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
}
|
|
|
export {
|
|
|
evidence,
|