Browse Source

首页应用授权,添加应用排序 应用图标染色

zhaoxiaohai 2 years ago
parent
commit
51d3db58e2

+ 11 - 11
packageA/borrow/index.js

@@ -39,7 +39,7 @@ Page({
 			name: "按(套)计算"
 		}, {
 			name: "按(个)计算"
-		}, ]
+		}]
 	},
 	onLoad(options) {
 		this.getList(true)
@@ -146,7 +146,7 @@ Page({
 							"sa_contractid": e.id[0]
 						}
 					}, false).then(s => {
-                        console.log("复制合同商品",s)
+						console.log("复制合同商品", s)
 						wx.redirectTo({
 							url: '/packageA/borrow/detail?id=' + res.data.sa_orderid,
 						})
@@ -173,15 +173,15 @@ Page({
 	tabsChange(e) {
 		let status = "";
 		switch (e.detail.title) {
-				case '全部':
-						status = "";
-						break;
-				case '待确认':
-						status = "交期待确认";
-						break;
-				default:
-						status = e.detail.title
-						break;
+			case '全部':
+				status = "";
+				break;
+			case '待确认':
+				status = "交期待确认";
+				break;
+			default:
+				status = e.detail.title
+				break;
 		}
 		this.setData({
 			active: status

+ 3 - 2
packageA/orderForm/detail.js

@@ -17,10 +17,11 @@ Page({
             label: "订单进度",
             icon: "icon-tabcaozuojilu1",
             model: "#Progress"
-        }, {
+        }],
+        /* , {
             label: "发票",
             icon: "icon-tabkaipiaoxinxi"
-        }],
+        } */
     },
     onLoad(options) {
         this.setData({

+ 1 - 1
pages/login/modules/account.js

@@ -54,7 +54,7 @@ Component({
             _Http.login({
                 "accountno": this.data.accountno,
                 "password": md5.hexMD5(this.data.password),
-                "systemclient": "wechatsaletool"
+                "systemclient": "wechatorder"
             }).then(res => {
                 getCurrentPages()[0].setData({
                     loading: false

+ 2 - 2
pages/login/modules/phone.js

@@ -31,7 +31,7 @@ Component({
             if (!Check.CheckPhoneNumber(this.data.phonenumber)) return;
             _Http.getpassword({
                 "phonenumber": this.data.phonenumber,
-                "systemclient": "wechatsaletool"
+                "systemclient": "wechatorder"
             }).then(res => {
                 wx.showToast({
                     title: res.msg,
@@ -78,7 +78,7 @@ Component({
             _Http.plogin({
                 "phonenumber": this.data.phonenumber,
                 "password": md5.hexMD5(this.data.password),
-                "systemclient": "wechatsaletool"
+                "systemclient": "wechatorder"
             }).then(res => {
                 getCurrentPages()[0].setData({
                     loading: false

+ 1 - 1
pages/login/phone.js

@@ -23,7 +23,7 @@ Page({
                 if (res.code) {
                     _Http.loginbywechat({
                         wechat_code: res.code,
-                        "systemclient": "wechatsaletool"
+                        "systemclient": "wechatorder"
                     }).then(res => {
                         console.log("微信快捷登录", res)
                         if (res.code == 0) return wx.showToast({

+ 329 - 208
pages/tabbar/home/index.js

@@ -1,211 +1,332 @@
 let _Http = getApp().globalData.http,
-	DataCarousel = null;
+    DataCarousel = null;
 Page({
-	data: {
-		bannerList: [], //banner列表
-		gridList: [],
-		notice: "",
-		msgCount: 1,
-		msgList: [], //消息列表
-	},
-	onLoad(options) {
-		this.setData({ //获取胶囊位置信息
-			capsule: wx.getMenuButtonBoundingClientRect()
-		})
-		this.refreshData() //更新权限等信息
-	},
-	/* 更新站点信息 */
-	refreshData() {
-		this.setData({
-			user: wx.getStorageSync('userMsg')
-		})
-		/* 首页宫格授权查询 */
-		if (wx.getStorageSync('userauth').length != 0) {
-			let auth = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['营销工具'], []),
-				gridList = [],
-				authList = {};
-			wx.setStorageSync('auth', authList)
-			gridList.push({
-				name: "商城",
-				path: "/packageA/market/index",
-				color: "#F29C37",
-				bColor: "#FCF6EF",
-				icon: "icon-shangcheng"
-			})
-			gridList.push({
-				name: "销售订单",
-				path: "/packageA/orderForm/index",
-				color: "#5AB73F",
-				bColor: "#F4FAEF",
-				icon: "icon-dingdan"
-			})
-			gridList.push({
-				name: "收货",
-				path: "/packageA/shipment/index",
-				color: "#3874F6",
-				bColor: "#F0F3FF",
-				icon: "icon-shouhuo"
-			})
-			gridList.push({
-				name: "业绩目标",
-				path: "/packageA/target/index",
-				color: "#5AB73F",
-				bColor: "#F4FAEF",
-				icon: "icon-yejimubiao"
-			})
-			gridList.push({
-				name: "账户",
-				path: "/packageA/account/index",
-				color: "#EB4B5C",
-				bColor: "#FDF1ED",
-				icon: "icon-zhanghu"
-			})
-			gridList.push({
-				name: "促销活动",
-				path: "/packageA/activity/index",
-				color: "#3874F6",
-				bColor: "#F0F3FF",
-				icon: "icon-cuxiaohuodong"
-			})
-			gridList.push({
-				name: "工具查询",
-				path: "/packageA/tool/index",
-				color: "#EB4B5C",
-				bColor: "#FDF1ED",
-				icon: "icon-kaipiao"
-			})
-			gridList.push({
-				name: "购物车",
-				path: "/packageA/shopping/index",
-				color: "#EB4B5C",
-				bColor: "#FDF1ED",
-				icon: "icon-kaipiao"
-			})
-			gridList.push({
-				name: "开票",
-				path: "/packageA/invoice/index",
-				color: "#EB4B5C",
-				bColor: "#FDF1ED",
-				icon: "icon-kaipiao"
-			})
-			gridList.push({
-				name: "打款凭证",
-				path: "/packageA/remitVoucher/index",
-				color: "#F29C37",
-				bColor: "#FCF6EF",
-				icon: "icon-shujuchaxun"
-			})
-			gridList.push({
-				name: "工具借用",
-				path: "/packageA/borrow/index",
-				color: "#F29C37",
-				bColor: "#FCF6EF",
-				icon: "icon-shujuchaxun"
-			})
-			gridList.push({
-				name: "工具归还",
-				path: "/packageA/toolBill/index",
-				color: "#F29C37",
-				bColor: "#FCF6EF",
-				icon: "icon-shujuchaxun"
-			})
-			gridList.push({
-				name: "居间费结算",
-				path: "/packageA/betweenFee/index",
-				color: "#F29C37",
-				bColor: "#FCF6EF",
-				icon: "icon-shujuchaxun"
-			})
-			/* ------------------------------- */
-			gridList.push({
-				name: "数据查询",
-				path: "#",
-				color: "#F29C37",
-				bColor: "#FCF6EF",
-				icon: "icon-shujuchaxun"
-			})
-			this.setData({
-				gridList
-			})
-		} else {
-			setTimeout(this.refreshData, 10);
-			return;
-		}
-		/* 获取首页banner */
-		let banner = wx.getStorageSync('banner_list').find(v => v.location == "index_top");
-		if (banner) this.setData({
-			bannerList: banner.ads
-		})
-	},
-	/* 获取最新信息 */
-	queryMessage(i = 0) {
-		_Http.basic({
-			"classname": "system.message.Message",
-			"method": "queryMessage",
-			content: {
-				nocache: true,
-				pageNumber: 1,
-				pageSize: 5,
-				pageTotal: 1,
-				type: "",
-				where: {}
-			},
-		}, false).then(res => {
-			if (res.msg != '成功') return (i <= 5) ? this.queryMessage(i + 1) : wx.showToast({
-				title: res.msg,
-				icon: "none"
-			})
-			this.setData({
-				msgList: res.data,
-				notice: res.data[0]
-			})
-			if (this.data.msgList.length > 2) this.startDataCarousel();
-		})
-	},
-	/* 开启消息轮播 */
-	startDataCarousel() {
-		clearInterval(DataCarousel);
-		DataCarousel = setInterval(() => {
-			let count = this.data.msgCount < this.data.msgList.length ? this.data.msgCount : 0;
-			this.setData({
-				msgCount: count + 1,
-				notice: this.data.msgList[count]
-			})
-		}, 5000)
-	},
-	/* 去消息详情 */
-	toMsg(e) {
-		const {
-			item
-		} = e.currentTarget.dataset;
-		wx.navigateTo({
-			url: '/pages/tabbar/message/details?id=' + item.messageid,
-		})
-	},
-	/* banner */
-	bannerClick(e) {
-		const {
-			item
-		} = e.currentTarget.dataset,
-			hyperlink = item.hyperlink.split(":");
-		if (hyperlink[0] == 'path') wx.navigateTo({
-			url: hyperlink[1]
-		})
-	},
-	onShow() {
-		this.getTabBar().init();
-		if (this.data.msgList.length > 2) this.startDataCarousel();
-		this.queryMessage(0); //更新最新消息
-	},
-	onHide() {
-		clearInterval(DataCarousel);
-	},
-	onReady() {
-		this.setListHeight();
-	},
-	/* 设置页面高度 */
-	setListHeight() {
-		this.selectComponent("#ListBox").setHeight(".grld-title", this);
-	},
-	onShareAppMessage() {}
+    data: {
+        bannerList: [], //banner列表
+        gridList: [],
+        notice: "",
+        msgCount: 1,
+        msgList: [], //消息列表
+    },
+    onLoad(options) {
+        this.setData({ //获取胶囊位置信息
+            capsule: wx.getMenuButtonBoundingClientRect()
+        })
+        this.refreshData() //更新权限等信息
+    },
+
+    queryApp(name) {
+        const routeList = [{
+            name: "商城",
+            path: "/packageA/market/index",
+            icon: "icon-shangcheng"
+        }, {
+            name: "销售订单",
+            path: "/packageA/orderForm/index",
+            icon: "icon-dingdan"
+        }, {
+            name: "收货",
+            path: "/packageA/shipment/index",
+            icon: "icon-shouhuo"
+        }, {
+            name: "业绩目标",
+            path: "/packageA/target/index",
+            icon: "icon-yejimubiao"
+        }, {
+            name: "账户",
+            path: "/packageA/account/index",
+            icon: "icon-zhanghu"
+        }, {
+            name: "促销活动",
+            path: "/packageA/activity/index",
+            icon: "icon-cuxiaohuodong"
+        }, {
+            name: "工具查询",
+            path: "/packageA/tool/index",
+            icon: "icon-kaipiao"
+        }, {
+            name: "购物车",
+            path: "/packageA/shopping/index",
+            icon: "icon-kaipiao"
+        }, {
+            name: "开票",
+            path: "/packageA/invoice/index",
+            icon: "icon-kaipiao"
+        }, {
+            name: "打款凭证",
+            path: "/packageA/remitVoucher/index",
+            icon: "icon-shujuchaxun"
+        }, {
+            name: "工具借用",
+            path: "/packageA/borrow/index",
+            icon: "icon-shujuchaxun"
+        }, {
+            name: "工具归还",
+            path: "/packageA/toolBill/index",
+            icon: "icon-shujuchaxun"
+        }, {
+            name: "居间费结算",
+            path: "/packageA/betweenFee/index",
+            icon: "icon-shujuchaxun"
+        }, {
+            name: "数据查询",
+            path: "#",
+            icon: "icon-shujuchaxun"
+        }];
+        let i = routeList.findIndex(v => v.name == name);
+        routeList[i].index = i
+        return routeList[i]
+    },
+    /* 更新站点信息 */
+    refreshData() {
+        this.setData({
+            user: wx.getStorageSync('userMsg')
+        })
+        /* 首页宫格授权查询 */
+        if (wx.getStorageSync('userauth').length != 0) {
+            let auth = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ["E-订单"], ["商品档案", "销售管理", "财务管理", "售后管理", "发货与库存", "业绩查询"]),
+                gridList = [],
+                authList = [],
+                colorList = [{
+                    color: "#3874F6",
+                    bColor: "#F0F3FF",
+                }, {
+                    color: "#5AB73F",
+                    bColor: "#F4FAEF",
+                }, {
+                    color: "#F29C37",
+                    bColor: "#FCF6EF",
+                }, {
+                    color: "#EB4B5C",
+                    bColor: "#FDF1ED",
+                }, {
+                    color: "#3874F6",
+                    bColor: "#F0F3FF",
+                }, {
+                    color: "#F29C37",
+                    bColor: "#FCF6EF",
+                }, {
+                    color: "#EB4B5C",
+                    bColor: "#FDF1ED",
+                }, {
+                    color: "#3874F6",
+                    bColor: "#F0F3FF",
+                }, {
+                    color: "#5AB73F",
+                    bColor: "#F4FAEF",
+                }, {
+                    color: "#F29C37",
+                    bColor: "#FCF6EF",
+                }, {
+                    color: "#5AB73F",
+                    bColor: "#F4FAEF",
+                }, {
+                    color: "#3874F6",
+                    bColor: "#F0F3FF",
+                }, {
+                    color: "#F29C37",
+                    bColor: "#FCF6EF",
+                }, {
+                    color: "#EB4B5C",
+                    bColor: "#FDF1ED",
+                }, {
+                    color: "#5AB73F",
+                    bColor: "#F4FAEF",
+                }];
+            auth.forEach(v => {
+                switch (v.systemmodulename) {
+                    case "商品档案":
+                        console.log(v)
+                        v.apps.forEach(value => {
+                            authList[value.name] = {
+                                options: value.meta.auth.map(a => a.option),
+                                optionnames: value.meta.auth.map(a => a.optionname),
+                            }
+                            switch (value.name) {
+                                case "wmarket":
+                                    if (value.meta.auth.some(r => r.option == 'read')) gridList.push(this.queryApp("商城"))
+                                    break;
+                                case "wtool":
+                                    if (value.meta.auth.some(r => r.option == 'read')) gridList.push(this.queryApp("工具查询"))
+                                    break;
+                                case "wshoppingtrolley":
+                                    if (value.meta.auth.some(r => r.option == 'read')) gridList.push(this.queryApp("购物车"))
+                                    break;
+                            };
+                        });
+                        break;
+                    case "销售管理":
+                        v.apps.forEach(value => {
+                            authList[value.name] = {
+                                options: value.meta.auth.map(a => a.option),
+                                optionnames: value.meta.auth.map(a => a.optionname),
+                            }
+                            switch (value.name) {
+                                case "worderform":
+                                    if (value.meta.auth.some(r => r.option == 'read')) gridList.push(this.queryApp("销售订单"))
+                                    break;
+                                case "wborrow":
+                                    if (value.meta.auth.some(r => r.option == 'read')) gridList.push(this.queryApp("工具借用"))
+                                    break;
+                                case "wdiscounts":
+                                    if (value.meta.auth.some(r => r.option == 'read')) gridList.push(this.queryApp("促销活动"))
+                                    break;
+                            };
+                        });
+                        break;
+                    case "财务管理":
+                        v.apps.forEach(value => {
+                            authList[value.name] = {
+                                options: value.meta.auth.map(a => a.option),
+                                optionnames: value.meta.auth.map(a => a.optionname),
+                            }
+                            switch (value.name) {
+                                case "wmakeoutaninvoice":
+                                    if (value.meta.auth.some(r => r.option == 'read')) gridList.push(this.queryApp("开票"))
+                                    break;
+                                case "wpaymentdocument":
+                                    if (value.meta.auth.some(r => r.option == 'read')) gridList.push(this.queryApp("打款凭证"))
+                                    break;
+                                case "waccount":
+                                    if (value.meta.auth.some(r => r.option == 'read')) gridList.push(this.queryApp("账户"))
+                                    break;
+                                case "wbrokerage":
+                                    if (value.meta.auth.some(r => r.option == 'read')) gridList.push(this.queryApp("居间费结算"))
+                                    break;
+                            };
+                        });
+                        break;
+                    case "售后管理":
+                        v.apps.forEach(value => {
+                            authList[value.name] = {
+                                options: value.meta.auth.map(a => a.option),
+                                optionnames: value.meta.auth.map(a => a.optionname),
+                            }
+                            switch (value.name) {
+                                case "whandback":
+                                    if (value.meta.auth.some(r => r.option == 'read')) gridList.push(this.queryApp("工具归还"))
+                                    break;
+                            };
+                        });
+                        break;
+                    case "发货与库存":
+                        v.apps.forEach(value => {
+                            authList[value.name] = {
+                                options: value.meta.auth.map(a => a.option),
+                                optionnames: value.meta.auth.map(a => a.optionname),
+                            }
+                            switch (value.name) {
+                                case "wlogistcs":
+                                    if (value.meta.auth.some(r => r.option == 'read')) gridList.push(this.queryApp("收货"))
+                                    break;
+                            };
+                        });
+                        break;
+                    case "业绩查询":
+                        v.apps.forEach(value => {
+                            authList[value.name] = {
+                                options: value.meta.auth.map(a => a.option),
+                                optionnames: value.meta.auth.map(a => a.optionname),
+                            }
+                            switch (value.name) {
+                                case "wtarget":
+                                    if (value.meta.auth.some(r => r.option == 'read')) gridList.push(this.queryApp("业绩目标"))
+                                    break;
+                            };
+                        });
+                        break;
+                };
+            });
+            wx.setStorageSync('auth', authList)
+            gridList = gridList.sort((a, b) => a.index - b.index);
+            this.setData({
+                gridList: gridList.map((v, i) => {
+                    return {
+                        ...v,
+                        ...colorList[i > colorList.length - 1 ? i - colorList.length : i]
+                    }
+                })
+            })
+        } else {
+            setTimeout(this.refreshData, 10);
+            return;
+        }
+
+        /* 获取首页banner */
+        let banner = wx.getStorageSync('banner_list').find(v => v.location == "index_top");
+        if (banner) this.setData({
+            bannerList: banner.ads
+        })
+    },
+    /* 获取最新信息 */
+    queryMessage(i = 0) {
+        _Http.basic({
+            "classname": "system.message.Message",
+            "method": "queryMessage",
+            content: {
+                nocache: true,
+                pageNumber: 1,
+                pageSize: 5,
+                pageTotal: 1,
+                type: "",
+                where: {}
+            },
+        }, false).then(res => {
+            if (res.msg != '成功') return (i <= 5) ? this.queryMessage(i + 1) : wx.showToast({
+                title: res.msg,
+                icon: "none"
+            })
+            this.setData({
+                msgList: res.data,
+                notice: res.data[0]
+            })
+            if (this.data.msgList.length > 2) this.startDataCarousel();
+        })
+    },
+    /* 开启消息轮播 */
+    startDataCarousel() {
+        clearInterval(DataCarousel);
+        DataCarousel = setInterval(() => {
+            let count = this.data.msgCount < this.data.msgList.length ? this.data.msgCount : 0;
+            this.setData({
+                msgCount: count + 1,
+                notice: this.data.msgList[count]
+            })
+        }, 5000)
+    },
+    /* 去消息详情 */
+    toMsg(e) {
+        const {
+            item
+        } = e.currentTarget.dataset;
+        wx.navigateTo({
+            url: '/pages/tabbar/message/details?id=' + item.messageid,
+        })
+    },
+    /* banner */
+    bannerClick(e) {
+        const {
+            item
+        } = e.currentTarget.dataset,
+            hyperlink = item.hyperlink.split(":");
+        if (hyperlink[0] == 'path') wx.navigateTo({
+            url: hyperlink[1]
+        })
+    },
+    onShow() {
+        this.getTabBar().init();
+        if (this.data.msgList.length > 2) this.startDataCarousel();
+        this.queryMessage(0); //更新最新消息
+    },
+    onHide() {
+        clearInterval(DataCarousel);
+    },
+    onReady() {
+        this.setListHeight();
+    },
+    /* 设置页面高度 */
+    setListHeight() {
+        this.selectComponent("#ListBox").setHeight(".grld-title", this);
+    },
+    onShareAppMessage() {}
 })

+ 7 - 0
project.private.config.json

@@ -99,6 +99,13 @@
           "query": "id=4",
           "launchMode": "default",
           "scene": null
+        },
+        {
+          "name": "",
+          "pathName": "packageA/market/index",
+          "query": "",
+          "launchMode": "default",
+          "scene": null
         }
       ]
     }

+ 3 - 1
utils/Http.js

@@ -1,5 +1,7 @@
 // const baseUrl = "https://meida.cnyunl.com/yos/rest/index";
-const baseUrl = "http://61.164.207.46:8000/yos/rest/index";
+// const baseUrl = "http://61.164.207.46:8000/yos/rest/index";
+const baseUrl = "http://122.226.136.204:8082/yos/rest/index";
+
 class HTTP {
     request({
         url,