quanwei
13 hours ago 408c463c5b66bba2aa1c81d8dca23e04c1608e24
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
<template>
    <view class="apply-team">
        <!--申请成功-->
        <template v-if="!is_applying && is_pass">
            <view class="form-wrap p30 f30">
                <view class="pb30 d-c-c gray3 f40 fb">
                    供应方入驻申请
                </view>
                <form @submit="formCheck" @reset="formReset">
                    <view class="form-item border-b">
                        <view class="field-name">姓名:</view>
                        <input class="flex-1 ml10" name="name" type="text" value="" placeholder-class="grary" placeholder="请输入姓名" />
                    </view>
                    <view class="form-item border-b">
                        <view class="field-name">手机号:</view>
                        <input class="flex-1 ml10" name="mobile" type="number" value="" placeholder-class="grary" placeholder="请输入手机" />
                    </view>
                    <!-- <view class="form-item border-b">
                        <text class="field-name">地址:</text>
                        <input class="flex-1 ml10" name="location_address" type="text"  placeholder-class="grary9" placeholder="请选择地址" v-model="short_address"
                             disabled @click="chooseLocation" />
                    </view> -->
                    <view class="d-c-c mt30">
                        <button class="btn-red" form-type="submit">立即申请</button>
                    </view>
                </form>
                <view class="form-wrap p30 f30" v-if="reason">
                    <view class="d-c-c pt30">
                        <text style=" font-size: 100rpx;" class="icon iconfont icon-icon_xianshi-xian"></text>
                    </view>
                    <view class="p-30-0 d-c-c gray6 f30">
                        上次的申请已被驳回,原因:{{reason}}!
                    </view>
                </view>
            </view>
        </template>
        <!--审核中-->
        <template v-if="is_applying">
            <view class="form-wrap p30 f30">
                <view class="d-c-c pt30">
                    <text style=" font-size: 100rpx;" class="icon iconfont icon-icon_xianshi-xian"></text>
                </view>
                <view class="p-30-0 d-c-c gray6 f30">
                    您的申请正在审核,请耐心等待!
                </view>
            </view>
        </template>
        <shopTabBar></shopTabBar>
    </view>
</template>
 
<script>
    import Popup from '@/components/uni-popup.vue'
    export default {
        components: {
            Popup,
        },
        data() {
            return {
                /*弹窗是否打开*/
                isPopup: false,
                is_applying: false,
                is_release:'',
                /*小程序订阅消息*/
                temlIds: [],
                iphone_x: false,
                is_pass: true,
                reason:'',
                releaseData:[],
                province_id: 0,
                city_id: 0,
                region_id: 0,
                address: {},
                location_address: '',
                short_address:'',
            }
        },
        mounted() {
            /*数据*/
            this.getData();
        },
        created() {
            let self = this;
            uni.getSystemInfo({
                success: function (res) {
                    let model = ['X', 'XR', 'XS', '11', '12', '13', '14', '15'];
                    model.forEach(item => {
                        //适配iphoneX以上的底部,给tabbar一定高度的padding-bottom
                        if(res.model.indexOf(item) != -1 && res.model.indexOf('iPhone') != -1) {
                            self.iphone_x = true;
                        }
                    })
                }
            });
        },
        methods: {
            /*获取数据*/
            getData() {
                let self = this;
                uni.showLoading({
                    title: '加载中'
                })
                
                self._get('plus.release.supplyIndex/apply', {
                    platform: self.getPlatform()
                }, function(res) {
                    uni.hideLoading();
                    self.is_applying = res.data.is_applying;
                    self.is_release=res.data.is_release;
                    self.temlIds = res.data.template_arr;
                    self.releaseData = res.data.releaseData;
    
                    if(self.is_release){
                        uni.navigateBack({});
                    }
                    if(res.data.reason){
                        self.reason = res.data.reason;
                    }
                });
            },
            
            chooseLocation(n) {
                let self=this;
                 uni.authorize({
                 scope: 'scope.userLocation',
                 success: () => {
                     uni.chooseLocation({
                         success: function (res) {
                            console.log(res)
                             self.address.longitude=res.longitude;
                             self.address.latitude=res.latitude;
                             self.location_address=res.address;
                             // 获取省市区
                            setTimeout(function(){
                                self.setLocationAddress();
                            },500)
                         },fail: function (err) {
                             //console.log(err)
                        }
                     }); 
                 },        
                })
            },
            // 获取省市区 by yj
            setLocationAddress() {
                let self = this;
                self._get('user.address/setLocationAddress', {
                    address: self.location_address
                }, function(res) {
                    self.short_address = res.data.short_address;
                    self.address.location_address = res.data.short_address;
                    self.province_id = res.data.cityCode[0];
                    self.city_id = res.data.cityCode[1];
                    self.region_id = res.data.cityCode[2];
                });
            },
            
            /*申请*/
            formCheck: function(e) {
                let self = this;
                let formdata = e.detail.value;
                
                // formdata.province_id = self.province_id;
                // formdata.city_id = self.city_id;
                // formdata.region_id = self.region_id;
                // formdata.longitude = self.address.longitude;
                // formdata.latitude = self.address.latitude;
                // formdata.location_address = self.address.location_address;
                // formdata.detail= self.location_address;
                
                if(formdata.name==''){
                    uni.showToast({
                        title: '请输入姓名!',
                        icon:'none'
                    });
                    return;
                }
                if(formdata.mobile.length==''){
                    uni.showToast({
                        title: '请输入手机号!',
                        icon: 'none'
                    });
                    return;
                }
                if (!/^1(3|4|5|6|7|8|9)\d{9}$/.test(formdata.mobile)) {
                    uni.showToast({
                        title: '手机有误,请重填!',
                        icon: 'none'
                    });
                    return;
                }
                
                // if (formdata.province_id == 0 || formdata.city_id == 0 || formdata.region_id == 0 || formdata.location_address == '') {
                //     uni.showToast({
                //             title: '请选择完整省市区',
                //             duration: 1000,
                //             icon: 'none'
                //     });
                //     return false;
                // }
                
                uni.showLoading({
                    title: '正在提交',
                    mask: true
                })
                self.formSubmit(formdata);
            },
            
            formSubmit(e) {
                let self = this;
                let callback = function(){
                    self._post('plus.release.supplyIndex/submit', e, function(res) {
                        uni.hideLoading();
                        uni.showToast({
                            title: '申请成功'
                        });
                        self.getData();
                    });
                };
                self.subMessage(self.temlIds, callback);
            },
            goback() {
                uni.navigateBack();
            },
        }
    }
</script>
 
<style lang="scss">
    .form-wrap {
        background: #FFFFFF;
        position: relative;
    }
 
    .form-item {
        padding: 20rpx 0;
        margin-bottom: 20rpx;
        display: flex;
        justify-content: flex-start;
        align-items: center;
        font-size: 28rpx;
    }
 
    .form-item .field-name {
        width: 100rpx;
    }
 
    .form-item input {
        font-size: 28rpx;
    }
    .apply-team .btn-red {
        width: 600rpx;
        height: 88rpx;
        line-height: 88rpx;
        border-radius: 44rpx;
        box-shadow: 0 8rpx 16rpx 0 rgba(226,35,26,.6);
    }    
</style>