address.js 713 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // page/component/new-pages/user/address/address.js
  2. Page({
  3. data:{
  4. address:{
  5. name:'',
  6. phone:'',
  7. detail:''
  8. }
  9. },
  10. onLoad(){
  11. var self = this;
  12. wx.getStorage({
  13. key: 'address',
  14. success: function(res){
  15. self.setData({
  16. address : res.data
  17. })
  18. }
  19. })
  20. },
  21. formSubmit(e){
  22. const value = e.detail.value;
  23. if (value.name && value.phone && value.detail){
  24. wx.setStorage({
  25. key: 'address',
  26. data: value,
  27. success(){
  28. wx.navigateBack();
  29. }
  30. })
  31. }else{
  32. wx.showModal({
  33. title:'提示',
  34. content:'请填写完整资料',
  35. showCancel:false
  36. })
  37. }
  38. }
  39. })