li-guang
2020-12-17 06cd51f34f3a51e6ff848ae5b695a46dfc424200
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<template>
    <view>
        <form @submit="add">
            <view class="input-group-row">
                <text class="label">会员姓名<text class="require">*</text></text>
                <input name="account" type="text" value="" placeholder="请输入会员姓名" placeholder-class='placeholder'/>
            </view>
            <view class="input-group-row">
                <text class="label">手机号码<text class="require">*</text></text>
                <input name="account" type="number" value="" placeholder="请输入手机号码" placeholder-class='placeholder'/>
            </view>
            <view class="input-group-row">
                <text class="label">性别<text class="require">*</text></text>
                <view class="radio-group">
                    <radio-group @change="sexChange">
                        <label><radio name="sex" value="1" color="#518EFF"  class="radio" checked/>男</label>
                        <label><radio name="sex" value="2" color="#518EFF" class="radio"/>女</label>
                    </radio-group>
                </view>
            </view>
            <view class="input-group-row">
                <text class="label">生日</text>
                <view>
                    <picker mode="date" @change="dateChange" :end="endDate">
                        <view class="uni-input">{{birthday}}</view>
                    </picker>
                </view>
            </view>
            <view class="input-group-row">
                <text class="label">省市区</text>
                <view @click="openAddres">
                    {{regionText}}
                </view>
            </view>
        </form>
        <region ref="simpleAddress" @onConfirm="onConfirm" themeColor="#518EFF" cancelColor="#8c9fad"></region>
    </view>
</template>
 
<script>
    import region from '../../components/simple-address/simple-address.vue';
    export default{
        components:{
            region
        },
        data(){
            return {
                birthday: '1990-01-02',
                regionText: '321'
            }
        },
        computed: {
            endDate() {
                return this.getDate('end');
            }
        },
        methods:{
            add(){
                
            },
            sexChange(e){
                console.log(e)
            },
            dateChange(e){
                this.birthday = e.detail.value;
                console.log(e)
            },
            getDate(type) {
                const date = new Date();
                let year = date.getFullYear();
                let month = date.getMonth() + 1;
                let day = date.getDate();
    
                if (type === 'start') {
                    year = year - 70;
                }
                month = month > 9 ? month : '0' + month;;
                day = day > 9 ? day : '0' + day;
                return `${year}-${month}-${day}`;
            },
            openAddres(){
                this.$refs.simpleAddress.open();
            }
        }
    }
</script>
 
<style>
    .input-group-row{
        display: flex;
        justify-content: space-between;
        padding: 10px 10px;
        margin-bottom: 10px;
        border-bottom: 1px solid #EDEAF4;
    }
    .input-group-row .label{
        font-size: 15px;
        padding-right: 10px;
    }
    .input-group-row .label .require{
        color: #d20808;
        padding-left: 4px;
    }
    .input-group-row input{
        flex: 1;
        font-size: 15px;
        text-align: right;
    }
    .input-group-row .radio-group{
        text-align: right;
    }
    .input-group-row .radio-group .radio{
        transform: scale(0.8);
        margin-left: 10px;
    }
</style>