商户身份验证
This commit is contained in:
1 parent
33340867ab
commit
3daf1e1f20
2 files changed
+20
-5
No files matched your search
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import user from "./sheep/api/user"
|
||||
import isDevEnv from "./sheep/utils/isDevEnv"
|
||||
|
||||
// import { onLaunch, onShow, onHide } from "@dcloudio/uni-app"
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import user from "@/sheep/api/user"
|
||||
import { ref } from "vue"
|
||||
|
||||
const userRole = ref("user")
|
||||
@@ -46,9 +47,24 @@ const userRole = ref("user")
|
||||
const selectRole = (role: "user" | "merchant") => (userRole.value = role)
|
||||
|
||||
// 确认选择
|
||||
const confirmRole = () => {
|
||||
uni.setStorageSync("userRole", userRole.value)
|
||||
if (userRole.value === "user") uni.redirectTo({ url: "/pages/tabbar/coopMerchant" })
|
||||
if (userRole.value === "merchant") uni.redirectTo({ url: "/pages/tabbar/individualOrder" })
|
||||
const confirmRole = async () => {
|
||||
if (userRole.value === "user") {
|
||||
uni.setStorageSync("userRole", userRole.value)
|
||||
uni.redirectTo({ url: "/pages/tabbar/coopMerchant" })
|
||||
return
|
||||
}
|
||||
if (userRole.value === "merchant") {
|
||||
uni.showLoading({ title: "正在验证身份", mask: true })
|
||||
const res = await user.isMerchant().finally(() => uni.hideLoading())
|
||||
if (res.code == 0) {
|
||||
if (res.data) {
|
||||
uni.setStorageSync("userRole", userRole.value)
|
||||
uni.redirectTo({ url: "/pages/tabbar/individualOrder" })
|
||||
return
|
||||
} else {
|
||||
uni.showToast({ title: "您不是商户", icon: "none" })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in new issue
Block a user