Commit 6505881f authored by Facius's avatar Facius

feat: 成员列表

parent 225af844
Pipeline #3522 canceled with stages
...@@ -468,6 +468,25 @@ ...@@ -468,6 +468,25 @@
} }
} }
,{
"path": "employees/index",
"name": "employee-list",
"style": {
"navigationBarTitleText": "项目成员",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"disableScroll": true
}
},{
"path": "employees/employee-create",
"name": "employee-create",
"style": {
"navigationBarTitleText": "新建成员",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"disableScroll": true
}
}
] ]
} }
], ],
......
<template>
<view class="cell-employee">
<view class="content-view">
<view class="left-view">
<view class="image-view">{{ imagekName }}</view>
<view class="name-view">{{ member.name }}</view>
<view class="info-view">{{ textInfo }}</view>
</view>
<view class="right-view">
<view
v-if="isSelect"
class="select-view"
@click="$u.throttle(handleSelect, 500)"
hover-class="u-hover-class"
>
<u-icon
v-if="member.selected"
name="checkmark-circle-fill"
color="#02A074"
size="42"
></u-icon>
<view v-else class="select-icon"></view>
</view>
<view
v-if="isEdit"
class="edit-view"
@click="$u.throttle(handleClickButtoon, 500)"
hover-class="u-hover-class"
>
<image :src="editImage" class="edit-image"></image>
</view>
</view>
</view>
</view>
</template>
<script>
import { formatCount } from '@/utils/common.js';
export default {
props: {
member: {
type: Object,
default() {
return {
memberId: '',
name: '',
money: '',
phone: '',
}
},
},
// edit 编辑;select: 选择
type: {
type: String,
default: 'edit',
},
},
data() {
return {}
},
computed: {
baseUrl() {
return process.uniEnv.qn_base_url
},
imagekName() {
var length = (this.member.name || '').length
return (this.member.name || '').substring(length - 2)
},
isSelect() {
return this.type == 'select'
},
isEdit() {
return this.type == 'edit'
},
editImage() {
return this.baseUrl + 'bianjifuwufenlei@3x.png'
},
textInfo() {
return this.isEdit ? this.member.phone : '¥' + formatCount(this.member. money || 0)
}
},
created() {},
methods: {
handleClickButtoon() {
this.$emit('action', this.memberId)
},
handleSelect() {
this.member.selected = !this.member.selected
console.log(this.member)
this.$emit('select', this.member.memberId, this.member.selected)
},
},
}
</script>
<style scoped lang="scss">
.cell-employee {
padding: 32rpx 0 32rpx 24rpx;
min-height: 120rpx;
border-radius: 8rpx;
background-color: #ffffff;
.content-view {
display: flex;
justify-content: space-between;
align-items: center;
.left-view {
display: flex;
align-items: center;
font-size: 28rpx;
font-weight: bold;
color: #333333;
.image-view {
width: 72rpx;
height: 72rpx;
background-color: #02a074;
border-radius: 16rpx;
display: flex;
justify-content: center;
align-items: center;
color: #ffffff;
font-size: 26rpx;
}
.info-view {
}
.name-view {
margin-right: 32rpx;
margin-left: 24rpx;
width: 120rpx;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
}
.right-view {
display: flex;
align-items: center;
justify-content: flex-end;
flex: 1;
.select-view {
width: 80rpx;
height: 80rpx;
display: flex;
justify-content: center;
align-items: center;
.select-icon {
width: 32rpx;
height: 32rpx;
border-radius: 50%;
border: 2rpx solid #cccccc;
}
}
}
.edit-view {
width: 80rpx;
height: 72rpx;
display: flex;
justify-content: center;
align-items: center;
.edit-image {
width: 32rpx;
height: 32rpx;
}
}
}
}
</style>
<template>
<view class="employee-create">
<NavbarRight :title="title" />
<view class="content-view">
<view class="info-view">
<view class="part-view">
<view class="label-view">姓名</view>
<view class="name-input">
<u-input type="text" :clearable="false" :custom-style="customStyle" :placeholder-style="placeholderStyle"
v-model="form.name" placeholder="填写成员姓名" />
</view>
</view>
<view class="line-view"></view>
<view class="part-view">
<view class="label-view">手机号码</view>
<view class="value-view">
<u-input maxlength="11" type="number" :clearable="false" :custom-style="customStyle"
:placeholder-style="placeholderStyle" v-model="form.phone" placeholder="填写手机号码" />
</view>
</view>
</view>
</view>
<view class="bottom-view">
<u-button v-if="memberId" :custom-style="customDelete" @click="handleClickDelete" class="delete-button">
<view class="delete-view">修改</view>
</u-button>
<u-button :custom-style="customConFirm" @click="handleClickConFirm" :loading="buttonLoading">
<view class="confirm-view">保存</view>
</u-button>
</view>
<view class="loading-view" v-if="loading">
<u-loading mode="flower"></u-loading>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import NavbarRight from '@/components/navbar-right'
export default {
components: {
NavbarRight,
},
data () {
return {
memberId: '',
form: {
name: '',
phone: '',
},
loading: false,
buttonLoading: false,
}
},
computed: {
baseUrl () {
return process.uniEnv.qn_base_url
},
title() {
return this.memberId ? '编辑成员' : '新建成员'
},
placeholderStyle () {
return 'color:#ccc;font-size:28rpx;font-weight: bold;'
},
customStyle () {
return {
fontSize: '28rpx',
textAlign: 'right',
fontWeight: 'bold',
}
},
customDelete () {
return {
color: '#02a074',
'background-color': '#ffffff',
height: '104rpx',
'border-radius': '16rpx',
width: '200rpx',
}
},
customConFirm () {
return {
color: 'transparent',
'background-color': this.canConfirm ? '#02a074' : '#7DCFB8',
height: '104rpx',
'border-radius': '16rpx',
width: this.memberId ? '470rpx' : '686rpx',
}
},
canConfirm () {
return true
},
},
onLoad (options) {
if (options && options.memberId) {
this.memberId = options.memberId
this.loading = true
// 加载成员信息
}
},
methods: {},
}
</script>
<style scoped lang="scss">
.employee-create {
display: flex;
flex-direction: column;
height: 100vh;
background-color: #f6f7fa;
.content-view {
height: 100%;
overflow: auto;
padding: 24rpx 24rpx 0rpx 24rpx;
.info-view {
padding: 0 24rpx;
background-color: #ffffff;
border-radius: 16rpx;
.line-view {
background-color: #F6F7FA;
height: 2rpx;
width: 100%;
}
.part-view {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 28rpx;
color: #333333;
height: 108rpx;
.label-view {}
.value-view {}
}
}
}
.bottom-view {
margin: 16rpx 32rpx 36rpx 32rpx;
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
.confirm-view {
color: #ffffff;
height: 104rpx;
line-height: 104rpx;
font-weight: bold;
font-size: 32rpx;
}
.delete-button {
margin-left: 32rpx;
}
.delete-view {
color: #fc524d;
height: 104rpx;
line-height: 104rpx;
font-weight: bold;
font-size: 32rpx;
}
}
.loading-view {
width: 100%;
background-color: transparent;
display: flex;
align-items: center;
justify-content: center;
top: 50%;
left: 0;
position: fixed;
}
}
</style>
This diff is collapsed.
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