li-guang
2020-12-17 b16d36e2a314efc42f99d484e5291a78a95fcd8e
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<template>
    <view class="container">
        <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="right-text">
                    <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 class="right-text">
                    <picker mode="date" @change="dateChange" :end="endDate">
                        <view>{{birthday}}</view>
                    </picker>
                </view>
            </view>
            <view class="input-group-row">
                <text class="label">省市区</text>
                <view @click="openAddres" class="right-text">
                    <text v-if="regionText">{{regionText}}</text>
                    <text v-else class="gray">请选择省市区</text>
                </view>
            </view>
            <view class="input-group-row">
                <text class="label">详细地址</text>
                <input name="account" type="text" value="" placeholder="请填写详细地址" placeholder-class='placeholder'/>
            </view>
            <view class="input-group-row">
                <text class="label">到店途径</text>
                <view class="right-text">
                    <picker mode="selector" :range="wayList" @change="wayChange">
                        <view>
                            {{way}}
                            <text class="iconfont iconjiantouarrow486 gray"></text>
                        </view>
                    </picker>
                </view>
            </view>
            <view class="input-group-row">
                <text class="label">推荐人</text>
                <view class="right-text">
                    <picker mode="selector" :range="referrerList" @change="referrerChange">
                        <view>
                            {{referrer}}
                            <text class="iconfont iconjiantouarrow486 gray"></text>
                        </view>
                    </picker>
                </view>
            </view>
            <view class="input-group-row">
                <text class="label">备注</text>
                <input name="account" type="text" value="" placeholder="请填写备注" placeholder-class='placeholder'/>
            </view>
            <view class="input-group-row">
                <text class="label">标签</text>
                <view class="right-text">
                    <text class="tag">大方<text class="iconfont iconguanbi gray"></text></text>
                    <text class="tag">大方<text class="iconfont iconguanbi gray"></text></text>
                </view>
            </view>
            <button type="submit" class="blue-btn sticky-footer">保存</button>
        </form>
        <region ref="simpleAddress" @onConfirm="addressChange" 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: '',
                wayList: ['美团','户外广告'],
                way: '美团',
                referrerList: ['张三'],
                referrer: '张三'
            }
        },
        onLoad(options) {
            if(options.id){
                uni.setNavigationBarTitle({
                    title: '编辑会员'
                });
            }
        },
        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();
            },
            addressChange(e){
                this.regionText = e.labelArr.join(' ');
            },
            wayChange(e){
                this.way = this.wayList[e.detail.value];
            },
            referrerChange(e){
                this.referrer = this.referrerList[e.detail.value];
            }
        }
    }
</script>
 
<style>
    .container{
        padding: 10px 10px;
    }
    
</style>