Files
medical-mall/pages/mall/admin/user/configuration/index.uvue
2026-02-06 12:06:33 +08:00

343 lines
8.5 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="user-config-page">
<view class="config-card">
<!-- 椤堕儴 Tab 鍒囨崲 -->
<view class="config-tabs">
<view
class="tab-item"
:class="{ active: activeTab === 0 }"
@click="activeTab = 0"
>
<text>鐢ㄦ埛绛夌骇閰嶇疆</text>
</view>
<view
class="tab-item"
:class="{ active: activeTab === 1 }"
@click="activeTab = 1"
>
<text>鏂扮敤鎴疯缃?/text>
</view>
</view>
<view class="config-content">
<!-- 鐢ㄦ埛绛夌骇閰嶇疆琛ㄥ崟 -->
<view v-if="activeTab === 0" class="config-form">
<view class="form-item">
<view class="item-label">
<text class="label-text">鐢ㄦ埛绛夌骇鍚敤锛?/text>
</view>
<view class="item-content">
<radio-group class="radio-group" @change="onLevelEnabledChange">
<label class="radio-label">
<radio value="1" :checked="levelConfig.enabled === '1'" color="#2f54eb" />
<text class="radio-text">寮€鍚?/text>
</label>
<label class="radio-label">
<radio value="0" :checked="levelConfig.enabled === '0'" color="#2f54eb" />
<text class="radio-text">鍏抽棴</text>
</label>
</radio-group>
<text class="item-desc">鍟嗗煄鐢ㄦ埛绛夌骇鍔熻兘寮€鍚叧闂?/text>
</view>
</view>
<view class="form-item">
<view class="item-label">
<text class="label-text">璁㈠崟璧犻€佺粡楠岋細</text>
</view>
<view class="item-content">
<input class="config-input" v-model="levelConfig.orderExp" type="number" />
<text class="item-desc">涓嬪崟璧犻€佺敤鎴风粡楠屾瘮渚?(瀹為檯鏀粯1鍏冭禒閫佸灏戠粡楠?</text>
</view>
</view>
<view class="form-item">
<view class="item-label">
<text class="label-text">閭€鏂拌禒閫佺粡楠岋細</text>
</view>
<view class="item-content">
<input class="config-input" v-model="levelConfig.inviteExp" type="number" />
<text class="item-desc">閭€璇蜂竴涓柊鐢ㄦ埛璧犻€佺敤鎴风粡楠屽€?/text>
</view>
</view>
<view class="form-actions">
<button class="submit-btn" type="primary" @click="onSubmit">鎻愪氦</button>
</view>
</view>
<!-- 鏂扮敤鎴疯缃〃鍗?-->
<view v-else class="config-form">
<view class="form-item">
<view class="item-label">
<text class="label-text">鐢ㄦ埛榛樿澶村儚锛?/text>
</view>
<view class="item-content">
<view class="avatar-upload">
<image class="avatar-preview" src="/static/logo.png" mode="aspectFill" />
<view class="upload-mask">
<text class="upload-icon">+</text>
</view>
</view>
<text class="item-desc">鍐呯敤鎴烽粯璁ゅご鍍忥紝鍚庡彴娣诲姞鐢ㄦ埛浠ュ強鐢ㄦ埛鐧诲綍鐨勯粯璁ゅご鍍忔樉绀猴紝灏哄(80*80)</text>
</view>
</view>
<view class="form-item">
<view class="item-label">
<text class="label-text">寮哄埗鎵嬫満鍙风櫥褰曪細</text>
</view>
<view class="item-content">
<radio-group class="radio-group" @change="onForcePhoneChange">
<label class="radio-label">
<radio value="1" :checked="newUserConfig.forcePhone === '1'" color="#2f54eb" />
<text class="radio-text">寮哄埗</text>
</label>
<label class="radio-label">
<radio value="0" :checked="newUserConfig.forcePhone === '0'" color="#2f54eb" />
<text class="radio-text">涓嶅己鍒?/text>
</label>
</radio-group>
<text class="item-desc">鐢ㄦ埛鍦ㄦ巿鏉冧箣鍚庡己鍒剁粦瀹氭墜鏈哄彿锛屽彲浠ュ疄鐜扮敤鎴峰绔粺涓€</text>
</view>
</view>
<view class="form-item">
<view class="item-label">
<text class="label-text">璧犻€佷綑棰?鍏?锛?/text>
</view>
<view class="item-content">
<input class="config-input" v-model="newUserConfig.giftBalance" type="number" />
<text class="item-desc">鏂扮敤鎴峰鍔遍噾棰濓紝蹇呴』澶т簬绛変簬0锛?涓轰笉璧犻€?/text>
</view>
</view>
<view class="form-item">
<view class="item-label">
<text class="label-text">璧犻€佺Н鍒嗭細</text>
</view>
<view class="item-content">
<input class="config-input" v-model="newUserConfig.giftIntegral" type="number" />
<text class="item-desc">鏂扮敤鎴峰鍔辩Н鍒嗭紝蹇呴』澶т簬绛変簬0锛?涓轰笉璧犻€?/text>
</view>
</view>
<view class="form-actions">
<button class="submit-btn" type="primary" @click="onSubmit">鎻愪氦</button>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref } from 'vue'
const activeTab = ref(0)
const levelConfig = ref({
enabled: '1',
orderExp: '1',
inviteExp: '100'
})
const newUserConfig = ref({
forcePhone: '1',
giftBalance: '88888',
giftIntegral: '88888'
})
function onLevelEnabledChange(e: any) {
levelConfig.value.enabled = e.detail.value
}
function onForcePhoneChange(e: any) {
newUserConfig.value.forcePhone = e.detail.value
}
function onSubmit() {
uni.showLoading({ title: '鎻愪氦涓?..' })
setTimeout(() => {
uni.hideLoading()
uni.showToast({
title: '淇敼鎴愬姛',
icon: 'success'
})
}, 800)
}
</script>
<style scoped lang="scss">
.user-config-page {
/* padding removed */
}
.config-card {
background-color: #fff;
border-radius: 4px;
overflow: hidden;
}
.config-tabs {
display: flex;
flex-direction: row;
border-bottom: 1px solid #f0f0f0;
padding: 0 24px;
}
.tab-item {
padding: 16px 20px;
cursor: pointer;
position: relative;
text {
font-size: 15px;
color: #666;
}
&.active {
text {
color: #1890ff;
font-weight: 500;
}
&::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 2px;
background: #1890ff;
}
}
}
.config-content {
padding: 32px 24px;
}
.config-form {
max-width: 800px;
}
.form-item {
display: flex;
flex-direction: row;
margin-bottom: 30px;
align-items: flex-start;
}
.item-label {
width: 160px;
padding-top: 6px;
display: flex;
justify-content: flex-end;
margin-right: 24px;
}
.label-text {
font-size: 14px;
color: #333;
}
.item-content {
flex: 1;
}
.radio-group {
display: flex;
flex-direction: row;
gap: 32px;
margin-bottom: 8px;
}
.radio-label {
display: flex;
flex-direction: row;
align-items: center;
gap: 6px;
}
.radio-text {
font-size: 14px;
color: #333;
}
.config-input {
width: 400px;
height: 36px;
border: 1px solid #d9d9d9;
border-radius: 4px;
padding: 0 12px;
font-size: 14px;
margin-bottom: 8px;
}
.item-desc {
display: block;
font-size: 12px;
color: #bfbfbf;
}
.avatar-upload {
width: 60px;
height: 60px;
border: 1px solid #d9d9d9;
border-radius: 4px;
position: relative;
margin-bottom: 12px;
overflow: hidden;
}
.avatar-preview {
width: 100%;
height: 100%;
}
.upload-mask {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.2);
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
transition: opacity 0.2s;
&:hover {
opacity: 1;
}
}
.upload-icon {
color: #fff;
font-size: 24px;
}
.form-actions {
margin-top: 48px;
padding-left: 184px;
}
.submit-btn {
width: 72px;
height: 32px;
background-color: #2f54eb;
border-color: #2f54eb;
color: #fff;
font-size: 14px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
margin: 0;
}
</style>