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

管理员用户切换师傅用户

parent d2c7023e
......@@ -166,6 +166,10 @@ let orderApiFun = function(vm){
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 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 = {
listByRecommendOrder,
......@@ -204,6 +208,8 @@ let orderApiFun = function(vm){
listStatement,
payableRecord,
workerApplyPay,
allowLogin,
otherUser
}
return orderApi
}
......
......@@ -255,9 +255,14 @@
"navigationBarTitleText": "我的仓库",
"enablePullDownRefresh": false
}
}
},
{
"path": "superLogin/index",
"style": {
"navigationBarTitleText": ""
}
}
]
},
......
......@@ -16,6 +16,7 @@
<u-icon class="tel-arrow-icon" name="arrow-up-fill"></u-icon>
</view>
</view>
<view v-if="showSuperButton" class="super-button"><u-button@click="handleSuperButton">切换用户</u-button></view>
</view>
<view class="list-view">
......@@ -45,6 +46,7 @@
return {
qnPath: process.uniEnv.qn_base_url,
serviceTel: '18124099271',
showSuperButton: false
}
},
computed: {
......@@ -134,9 +136,19 @@
},
onLoad() {
app.trackPage('我的首页')
if(this.vuex_token && !this.settled) {
console.log('-------000-------')
if(this.vuex_token ) {
console.log('-------1111-------')
if (!this.showSuperButton) {
this.allowLogin()
}
if (!this.settled) {
this.getData()
}
}
},
methods: {
getData() {
......@@ -164,6 +176,17 @@
}
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>
......@@ -240,6 +263,9 @@
}
}
}
.super-button {
margin-left: 20rpx;
}
}
.list-view {
......
<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