feat: 添加商户端页面
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
<template>
|
||||
<view class="mode-switch" @tap.stop="open">
|
||||
<view class="mode-switch__text">{{ label }}</view>
|
||||
<uni-icons type="bottom" size="14" color="#333" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
|
||||
const appStore = sheep.$store('app');
|
||||
|
||||
const label = computed(() => (appStore.bizMode === 'merchant' ? '商户' : '用户'));
|
||||
|
||||
const setMode = (mode) => {
|
||||
const next = mode === 'merchant' ? 'merchant' : 'user';
|
||||
if (appStore.bizMode === next) return;
|
||||
appStore.setBizMode(next);
|
||||
const url = next === 'merchant' ? '/pages/merchant/pickupList' : '/pages/index/index';
|
||||
uni.reLaunch({ url });
|
||||
};
|
||||
|
||||
const open = () => {
|
||||
uni.showActionSheet({
|
||||
itemList: ['用户', '商户'],
|
||||
success: ({ tapIndex }) => {
|
||||
setMode(tapIndex === 1 ? 'merchant' : 'user');
|
||||
},
|
||||
fail: () => {},
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.mode-switch {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
padding: 10rpx 18rpx;
|
||||
border-radius: 100rpx;
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.mode-switch__text {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
margin-right: 8rpx;
|
||||
line-height: 1;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user