joinSeller.js
3.97 KB
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
// pages/customer/joinSeller.js
var util = require('../../utils/util.js')
import App from '../../utils/api';
Page({
/**
* 页面的初始数据
*/
data: {
sellername: '',
phone: '',
rname: '',
map_address: '',
pro_code: '',
dis_code: '',
pro_code: '',
long: '',
lat: '',
region: [],
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
submitInfo() {
let sellername = this.data.sellername.trim();
let phone = this.data.phone.trim();
let rname = this.data.rname.trim();
this.setData({
sellername,
phone,
rname,
})
if (!sellername) {
return util.toast('请输入店铺名称', 'none')
}
if (!this.data.pro_code || !this.data.city_code || !this.data.dis_code) {
return util.toast('请选择城市', 'none')
}
if (!this.data.map_address) {
return util.toast('请输入店铺地址', 'none')
}
if (!this.data.phone) {
return util.toast('请输入您的电话号码', 'none')
}
var myreg = /^[1][3,4,5,7,8][0-9]{9}$/;
if (!myreg.test(phone)) {
return util.toast('手机格式不正确', 'none')
}
if (!this.data.rname) {
return util.toast('请输入您的姓名', 'none')
}
let obj = {
sellername,
phone,
rname,
map_address: this.data.map_address,
long: this.data.long,
lat: this.data.lat,
pro_code: this.data.pro_code,
city_code: this.data.city_code,
dis_code: this.data.dis_code,
}
console.log('提交信息', {
...obj
});
App.SellerVersion.SetSellerCollect({
...obj,
openid: getApp().openid,
}).then(res => {
if (res.ret != 200) {
return util.toast(res.msg, 'none')
}
wx.redirectTo({
url: '/pages/customer/collectSeller',
})
})
},
bindRegionChange(e) {
if (e.detail.value) {
this.setData({
region: e.detail.value,
pro_code: e.detail.code[0],
city_code: e.detail.code[1],
dis_code: e.detail.code[2],
})
}
},
// 选择地址
chooselocation: function () {
var that = this;
wx.chooseLocation({
success: function (res) {
console.log('选址信息', res);
that.setData({
map_address: res.address,
long: res.longitude,
lat: res.latitude,
})
},
fail: function (res) {
console.log(res)
wx.showModal({
title: '位置授权',
content: '您的位置信息需授权给一键订商户用于位置的展示',
confirmColor: '#199095',
cancelColor: '#999999',
success: function (res) {
console.log(res)
if (res.confirm) {
util.setting();
}
}
})
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
})