info.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <view>
  3. <view class="main">
  4. <view class="form">
  5. <view class="form_group">
  6. <view class="lable">手机号</view>
  7. <input type="text" v-model="item.phone" placeholder="请输入手机号" />
  8. </view>
  9. <view class="form_group">
  10. <view class="lable">支付宝</view>
  11. <input type="text" v-model="item.alipay" placeholder="请输入支付宝账号" />
  12. </view>
  13. </view>
  14. <view class="form" style="margin-top: 10px;">
  15. <view class="form_group">
  16. <view class="lable">开户行</view>
  17. <input type="text" v-model="item.bankName" placeholder="请输入开户行" />
  18. </view>
  19. <view class="form_group">
  20. <view class="lable">银行卡号</view>
  21. <input type="text" v-model="item.bankAccount" placeholder="请输入银行卡号" />
  22. </view>
  23. </view>
  24. <button class="btn" @click="save()">确定</button>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. data() {
  31. return {
  32. item: {}
  33. };
  34. },
  35. onLoad() {
  36. this.getData();
  37. },
  38. methods: {
  39. getData() {
  40. this.http.request({
  41. url: '/app/user/info',
  42. data: this.item,
  43. success: (res) => {
  44. this.item = res.data.data;
  45. }
  46. });
  47. },
  48. save() {
  49. let rule = [
  50. { name: 'phone', checkType: 'phone', errorMsg: '请请输入手机号' },
  51. { name: 'alipay', checkType: 'notnull', errorMsg: '请输入支付宝账号' }
  52. ];
  53. if (!this.verify.check(this.item, rule)) {
  54. uni.showModal({ content: this.verify.error, showCancel: false });
  55. return false;
  56. }
  57. this.http.request({
  58. url: '/app/user/edit',
  59. data: this.item,
  60. method: 'POST',
  61. success: (res) => {
  62. uni.showModal({
  63. title: '提示',
  64. content: '编辑成功。',
  65. showCancel: false,
  66. success: (res) => {
  67. uni.navigateBack();
  68. }
  69. });
  70. }
  71. });
  72. }
  73. }
  74. };
  75. </script>
  76. <style lang="scss">
  77. .btn {
  78. margin-top: 30px;
  79. }
  80. </style>