文件
Henglianshutong/uniapp/pages/commission/components/commission-info.vue

181 行
5.7 KiB
Vue

<!-- 分销商信息 -->
<template>
<!-- 用户资料 -->
<view class="user-card ss-flex ss-col-bottom">
<view class="card-top ss-flex ss-row-between ss-col-center ss-flex-1">
<view class="ss-flex ss-col-center">
<view class="head-img-box">
<image class="head-img" :src="sheep.$url.cdn(userInfo.avatar)" mode="aspectFill"></image>
</view>
<view class="ss-flex-col user-detail-col">
<view class="name-row ss-flex ss-col-center">
<text class="user-name">{{ userInfo.nickname || '分销合伙人' }}</text>
<text v-if="userInfo.id" class="user-id-pill">ID: {{ userInfo.id }}</text>
</view>
<view class="user-info-box ss-flex ss-col-center ss-flex-wrap">
<view class="tag-box ss-flex ss-col-center" v-if="agentInfo.level_info || levelTitle">
<image
v-if="agentInfo.level_info?.image"
class="tag-img"
:src="sheep.$url.cdn(agentInfo.level_info?.image)"
mode="aspectFill"
>
</image>
<text class="tag-title">{{ levelTitle }}</text>
</view>
<view v-if="agentInfo.is_venue || agentInfo.identities?.includes('venue')" class="mini-tag">{{ roleNames.venue || '酒道馆' }}</view>
<view v-if="agentInfo.is_county || agentInfo.identities?.includes('county')" class="mini-tag">{{ roleNames.county || '区县' }}</view>
<view v-if="agentInfo.is_partner || agentInfo.identities?.includes('partner')" class="mini-tag">{{ roleNames.partner || '团队成员' }}</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import sheep from '@/sheep';
import { computed } from 'vue';
const userInfo = computed(() => sheep.$store('user').userInfo);
const agentInfo = computed(() => sheep.$store('user').agentInfo);
const headerBg = sheep.$url.css('/assets/addons/shopro/uniapp/commission/background.png');
const roleNames = computed(() => {
return (
userInfo.value?.custom_role_names ||
userInfo.value?.role_names ||
agentInfo.value?.custom_role_names ||
agentInfo.value?.role_names ||
{}
);
});
const levelTitle = computed(() => {
if (userInfo.value?.maker_level_name) return userInfo.value.maker_level_name;
if (agentInfo.value?.maker_level_name) return agentInfo.value.maker_level_name;
if (userInfo.value?.identity_text) return userInfo.value.identity_text;
if (agentInfo.value?.identity_text) return agentInfo.value.identity_text;
const rawName = agentInfo.value?.level_info?.name;
if (rawName && roleNames.value.maker && rawName.includes('创客')) {
return rawName.replace('创客', roleNames.value.maker);
}
if (rawName && roleNames.value.taster && rawName.includes('品酒师')) {
return rawName.replace('品酒师', roleNames.value.taster);
}
return rawName || '';
});
</script>
<style lang="scss" scoped>
// 用户资料卡片
.user-card {
width: 694rpx;
min-height: 196rpx;
height: auto;
margin: -88rpx auto 0;
padding: 92rpx 30rpx 28rpx 30rpx;
box-sizing: border-box;
background: v-bind(headerBg) no-repeat;
background-size: 100% 100%;
position: relative;
z-index: 3;
.card-top {
box-sizing: border-box;
.head-img-box {
margin-right: 22rpx;
width: 100rpx;
height: 100rpx;
border-radius: 50%;
position: relative;
background: #fce0ad;
box-shadow: 0 4rpx 14rpx rgba(105, 46, 4, 0.15);
flex-shrink: 0;
.head-img {
width: 94rpx;
height: 94rpx;
border-radius: 50%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border: 2rpx solid #ffffff;
}
}
.user-detail-col {
justify-content: center;
}
.name-row {
margin-bottom: 12rpx;
.user-name {
font-size: 32rpx;
font-weight: 700;
color: #522703;
line-height: 38rpx;
max-width: 360rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.user-id-pill {
margin-left: 14rpx;
font-size: 20rpx;
font-family: OPPOSANS, sans-serif;
color: #8c531b;
background: rgba(255, 255, 255, 0.45);
padding: 2rpx 12rpx;
border-radius: 14rpx;
font-weight: 500;
}
}
.user-info-box {
gap: 8rpx;
.tag-box {
background: linear-gradient(135deg, #ff6b1a 0%, #ff5000 100%);
border-radius: 20rpx;
height: 36rpx;
padding-right: 12rpx;
box-shadow: 0 2rpx 6rpx rgba(255, 80, 0, 0.25);
.tag-img {
width: 36rpx;
height: 36rpx;
border-radius: 50%;
margin-right: 4rpx;
}
.tag-title {
font-size: 22rpx;
padding: 0 4rpx;
font-weight: 600;
line-height: 36rpx;
color: #ffffff;
}
}
.mini-tag {
padding: 0 14rpx;
height: 36rpx;
line-height: 36rpx;
border-radius: 18rpx;
background: rgba(255, 255, 255, 0.55);
backdrop-filter: blur(4px);
font-size: 20rpx;
font-weight: 600;
color: #692e04;
border: 1rpx solid rgba(255, 255, 255, 0.6);
}
}
}
}
</style>