|
@@ -1,54 +1,53 @@
|
|
|
const app = getApp()
|
|
|
-
|
|
|
+import {
|
|
|
+ exchangemobile,
|
|
|
+} from '~/api/user'
|
|
|
+import {
|
|
|
+ registerSale
|
|
|
+} from '~/api/sale'
|
|
|
Page({
|
|
|
data: {
|
|
|
menuTop: app.globalData.menuTop,
|
|
|
username: '',
|
|
|
- phone: '',
|
|
|
+ mobile: '17600188802',
|
|
|
isSubmit: false
|
|
|
},
|
|
|
- onLoad(options) {
|
|
|
-
|
|
|
- },
|
|
|
bindblur(e) {
|
|
|
this.setData({
|
|
|
- username: e.detail.value
|
|
|
+ username: e.detail.value.trim()
|
|
|
})
|
|
|
},
|
|
|
- async getPhoneNumber({
|
|
|
+ async getmobileNumber({
|
|
|
detail
|
|
|
}) {
|
|
|
- console.log(detail);
|
|
|
- /* let mobile = await exchangePhone({
|
|
|
- code: detail.code
|
|
|
- })
|
|
|
- await bindPhone({
|
|
|
- mobile
|
|
|
- })
|
|
|
- let userInfo = await getMyInfo()
|
|
|
- this.setUser(userInfo.user)
|
|
|
- wx.showToast({
|
|
|
- title: '绑定成功!',
|
|
|
- icon: "none",
|
|
|
- duration: 4000
|
|
|
- }) */
|
|
|
+ let mobile = await exchangemobile({
|
|
|
+ code: detail.code
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ mobile
|
|
|
+ })
|
|
|
},
|
|
|
black() {
|
|
|
wx.navigateBack()
|
|
|
},
|
|
|
- submit() {
|
|
|
+ async submit() {
|
|
|
let {
|
|
|
- phone,
|
|
|
+ mobile,
|
|
|
username
|
|
|
} = this.data
|
|
|
this.setData({
|
|
|
isSubmit: true
|
|
|
})
|
|
|
- console.log(this.data, username);
|
|
|
- if (phone && username) {
|
|
|
- console.log('通过');
|
|
|
- return
|
|
|
+ console.log(this.data);
|
|
|
+ if (mobile && username) {
|
|
|
+ let res = await registerSale({
|
|
|
+ mobile,
|
|
|
+ name: username
|
|
|
+ })
|
|
|
+ console.log(res);
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/salesperson/pages/saleOffice/index',
|
|
|
+ })
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
})
|