diff --git a/api/saas.js b/api/saas.js index 6ca10f5..2076137 100644 --- a/api/saas.js +++ b/api/saas.js @@ -16,7 +16,7 @@ const getRoleList = (params) => mGet(`/recycle-user-center/get/self-department-r const getBaseInfo = () => mGet(`/ztb-factory/get/self-enterprise-profile-detail`, null, sconfig) const getBankList = () => mGet(`/ztb-factory/get/bank-list`, null, sconfig) const getStatisticsInfo = (params) => mGet(`/ztb-factory/get/my-workbench-statistics-info`, params, sconfig) -const bindingAdmin = (params) => mPost(`/recycle-user-center/bind/factory-admin`, params, sconfig) +const bindingFactory = (params) => mPost(`/recycle-user-center/bind/factory-admin`, params, sconfig) const getOrderList = (params) => mGet(`/ztb-factory/factory-customer/get/order-list`, params, sconfig) const getReceiptList = (params) => mGet(`/ztb-factory/factory/get/order-receipt-proof-audit-list`, params, sconfig) const getPeymentList = (params) => mGet(`/ztb-factory/get/order-pay-list`, params, sconfig) @@ -81,7 +81,7 @@ export { getBaseInfo, getBankList, getUserInfo, - bindingAdmin, + bindingFactory, getFactoryOrderList, getFactoryOrderInfo, getOrderList, diff --git a/api/user.js b/api/user.js index 91e500f..b0c5754 100644 --- a/api/user.js +++ b/api/user.js @@ -27,6 +27,7 @@ const certificateIdentity = (params) => mPost('/uec/identify/identity', params, const generateCode = (params) => mPost('/uec/generate/qrcode', params, config) const createQrcode = (params) => mPost('/uec/create/qrcode-record', params, config) const verifyCode = (code, params) => mGet(`/uec/verify/qrcode${code}`, params, config) +const bindAccount = (params) => mPost(`/uec/bind/primary-account`, params, config) const applyEmplyee = (params) => mPost(`/uec/save/join/of/enterprise-department`, params, config) const getCheckList = (params) => mGet(`/uec/get/employee-joining-department-application-list`, params, config) const auditEmploye = (params) => mPost(`/uec/modify/join/of/enterprise-department`, params, config) @@ -244,6 +245,7 @@ export { verifyCode, generateCode, createQrcode, + bindAccount, applyEmplyee, getCheckList, auditEmploye, diff --git a/pages/login/index.js b/pages/login/index.js index 5eb510d..3f60d45 100644 --- a/pages/login/index.js +++ b/pages/login/index.js @@ -1,7 +1,7 @@ //获取应用实例 import Dialog from '../../components/dialog/dialog' -import { config, headerFactoryId, wechatApplet, loginWechat, postCaptcha, loginCaptcha, loginPwd, verifyCode, applyEmplyee } from "../../api/user" -import { sconfig, loginToken, getUserInfo, bindingAdmin, bindCustomer } from "../../api/saas" +import { config, headerFactoryId, wechatApplet, loginWechat, postCaptcha, loginCaptcha, loginPwd, verifyCode, bindAccount, applyEmplyee } from "../../api/user" +import { sconfig, loginToken, getUserInfo, bindingFactory, bindCustomer } from "../../api/saas" import { pconfig } from "../../api/payment" import { zconfig } from "../../api/ztb" import { mconfig } from "../../api/moment" @@ -382,14 +382,27 @@ Page({ return } this.setData({loging: true}) - if(this.data.metaData.qrPage == '/page/index/yaoqing'){ - bindingAdmin(this.data.metaData).then(result => { + if(this.data.metaData.qrPage == '/page/inde/ztbsaas/yaoqing'){ + // 绑定企业主账号 + var param = {joiningEnterprisePublicInvitationId: this.data.enterpriseId, userName: this.data.metaData.userName} + bindAccount(param).then(result => { + this.data.metaData = null + this.fetchUserInfo(app.globalData.token) + }).catch(error => { + this.setData({loging: false}) + util.showToast(error) + }) + } else if(this.data.metaData.qrPage == '/page/index/yaoqing'){ + // 绑定工厂主账号 + bindingFactory(this.data.metaData).then(result => { + this.data.metaData = null this.fetchUserInfo(app.globalData.token) }).catch(error => { this.setData({loging: false}) util.showToast(error) }) } else if(this.data.metaData.qrPage == '/page/index/shenqing'){ + // 绑定申请成为员工 applyEmplyee(this.data.metaData).then(result => { this.data.metaData = null this.setData({loging: false}) diff --git a/pages/message/card-list/index.js b/pages/message/card-list/index.js index e0640d3..554c602 100644 --- a/pages/message/card-list/index.js +++ b/pages/message/card-list/index.js @@ -20,17 +20,17 @@ Scene({ pageSize: 15 }, show: false, - actions: [ - { id: 2, name: '绑定员工' }, - { id: 1, name: '绑定客户' } - ], + actions: [ { id: 1, name: '绑定客户' } ], nowItem: null }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - this.setData({ height: app.globalData.fragmentHeight }) + if(app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0){ + this.data.actions = [{ id: 2, name: '绑定员工' }, { id: 1, name: '绑定客户' }] + } + this.setData({ height: app.globalData.fragmentHeight, actions: this.data.actions }) this.fetchList() }, onRefreshList: function () { diff --git a/pages/message/notification/index.js b/pages/message/notification/index.js index 506e84f..b41112a 100644 --- a/pages/message/notification/index.js +++ b/pages/message/notification/index.js @@ -17,11 +17,7 @@ Component({ }, lifetimes: { attached: function () { - this.setData({ - StatusBar: app.globalData.StatusBar, - CustomBar: app.globalData.CustomBar, - isAdmin: app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0 - }) + this.setData({ StatusBar: app.globalData.StatusBar, CustomBar: app.globalData.CustomBar }) } }, methods: { @@ -29,7 +25,7 @@ Component({ if(!app.userInfo.factoryId || this.data.notice){ return } - this.setData({ notice: true, message }) + this.setData({ notice: true, message, isAdmin: app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0 }) }, submit: function(e){ if(!this.data.message.redirectInfo || !this.data.message.redirectInfo.targetView){