index.js 1021 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. const app = getApp()
  2. import {
  3. exchangemobile,
  4. } from '~/api/user'
  5. import {
  6. registerSale
  7. } from '~/api/sale'
  8. Page({
  9. data: {
  10. menuTop: app.globalData.menuTop,
  11. username: '',
  12. mobile: '',
  13. isSubmit: false
  14. },
  15. bindblur(e) {
  16. this.setData({
  17. username: e.detail.value.trim()
  18. })
  19. },
  20. async getmobileNumber({
  21. detail
  22. }) {
  23. let mobile = await exchangemobile({
  24. code: detail.code
  25. })
  26. this.setData({
  27. mobile
  28. })
  29. },
  30. black() {
  31. wx.navigateBack()
  32. },
  33. async submit() {
  34. let {
  35. mobile,
  36. username
  37. } = this.data
  38. this.setData({
  39. isSubmit: true
  40. })
  41. if (mobile && username) {
  42. let res = await registerSale({
  43. mobile,
  44. name: username
  45. })
  46. wx.redirectTo({
  47. url: '/salesperson/pages/saleOffice/index',
  48. })
  49. }
  50. }
  51. })