Commit 0b7191b6 authored by 刘用法's avatar 刘用法

管理员用户切换师傅用户

parent d2c7023e
...@@ -166,7 +166,11 @@ let orderApiFun = function(vm){ ...@@ -166,7 +166,11 @@ let orderApiFun = function(vm){
let payableRecord = async (params = {}) => await vm.$u.post(settle + vm.vuex_token + '/payable/v2/queryPayableRecord', params, formType); let payableRecord = async (params = {}) => await vm.$u.post(settle + vm.vuex_token + '/payable/v2/queryPayableRecord', params, formType);
// 获取我的钱包-师傅提现 // 获取我的钱包-师傅提现
let workerApplyPay = async () => await vm.$u.get(prefix + vm.vuex_token + '/applypay/batch/workerApplyPay'); let workerApplyPay = async () => await vm.$u.get(prefix + vm.vuex_token + '/applypay/batch/workerApplyPay');
// 是否有特殊登录权限
let allowLogin = async (params = {}) => await vm.$u.get(prefix + 'other/auth/' + vm.vuex_token + '/allow/login', params);
// 特殊登录切换师傅
let otherUser = async (params = {}) => await vm.$u.get(prefix + 'other/auth/' + vm.vuex_token + '/other/user', params);
const orderApi = { const orderApi = {
listByRecommendOrder, listByRecommendOrder,
listOrderCount, listOrderCount,
...@@ -204,6 +208,8 @@ let orderApiFun = function(vm){ ...@@ -204,6 +208,8 @@ let orderApiFun = function(vm){
listStatement, listStatement,
payableRecord, payableRecord,
workerApplyPay, workerApplyPay,
allowLogin,
otherUser
} }
return orderApi return orderApi
} }
......
...@@ -255,9 +255,14 @@ ...@@ -255,9 +255,14 @@
"navigationBarTitleText": "我的仓库", "navigationBarTitleText": "我的仓库",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
} },
{
"path": "superLogin/index",
"style": {
"navigationBarTitleText": ""
}
}
] ]
}, },
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
<text>{{telTip}}</text> <text>{{telTip}}</text>
<u-icon class="tel-arrow-icon" name="arrow-up-fill"></u-icon> <u-icon class="tel-arrow-icon" name="arrow-up-fill"></u-icon>
</view> </view>
</view> </view>
<view v-if="showSuperButton" class="super-button"><u-button@click="handleSuperButton">切换用户</u-button></view>
</view> </view>
<view class="list-view"> <view class="list-view">
...@@ -44,7 +45,8 @@ ...@@ -44,7 +45,8 @@
data() { data() {
return { return {
qnPath: process.uniEnv.qn_base_url, qnPath: process.uniEnv.qn_base_url,
serviceTel: '18124099271', serviceTel: '18124099271',
showSuperButton: false
} }
}, },
computed: { computed: {
...@@ -133,10 +135,20 @@ ...@@ -133,10 +135,20 @@
} }
}, },
onLoad() { onLoad() {
app.trackPage('我的首页') app.trackPage('我的首页')
if(this.vuex_token && !this.settled) { console.log('-------000-------')
this.getData()
} if(this.vuex_token ) {
console.log('-------1111-------')
if (!this.showSuperButton) {
this.allowLogin()
}
if (!this.settled) {
this.getData()
}
}
}, },
methods: { methods: {
getData() { getData() {
...@@ -163,7 +175,18 @@ ...@@ -163,7 +175,18 @@
return false return false
} }
this.$u.route({url: "pages/login/index"}) this.$u.route({url: "pages/login/index"})
}, },
async allowLogin() {
let res = await this.$u.api.allowLogin()
console.log(res)
if (res) {
this.showSuperButton = res.code == 200
}
},
handleSuperButton() {
this.$u.route({url: 'pages/mine/superLogin/index'})
}
} }
} }
</script> </script>
...@@ -239,6 +262,9 @@ ...@@ -239,6 +262,9 @@
margin-left: 6rpx; margin-left: 6rpx;
} }
} }
}
.super-button {
margin-left: 20rpx;
} }
} }
......
<template>
<view class="super-login">
<u-input auto-focus v-model="mobile" focus type="number" placeholder="请输入手机号"></u-input>
<view class="line-view"></view>
<view class="button-view">
<u-button class="change-button" type="primary" @click="handleClick">确认切换</u-button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
mobile: ''
}
},
methods: {
handleClick() {
this.otherUser()
},
async otherUser() {
let res = await this.$u.api.otherUser({mobile: this.mobile})
console.log(res)
if (res && res.code == 200) {
this.$u.vuex("vuex_token", res.data);
uni.navigateBack({
})
}
},
}
}
</script>
<style lang="scss" scoped>
.super-login {
padding: 30rpx;
margin: 30rpx;
background-color: #FFFFFF;
border-radius: 12rpx;
.line-view {
background-color: #F4F5F7;
height: 2rpx;
}
.button-view {
margin-top: 40rpx;
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment