info.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <view>
  3. <view class="main">
  4. <view class="message _error" v-if="!item.phone">
  5. <text class="icon">&#xec72;</text>
  6. <text>需要完善结算信息才能接包。</text>
  7. </view>
  8. <view class="form_group">
  9. <view class="lable re">手机号</view>
  10. <input type="text" v-model="item.phone" placeholder="请输入手机号" />
  11. </view>
  12. <view class="form_group">
  13. <view class="lable re">支付宝</view>
  14. <input type="text" v-model="item.alipay" placeholder="请输入支付宝账号" />
  15. </view>
  16. <view class="form_group">
  17. <view class="lable re">开户行</view>
  18. <input type="text" v-model="item.bankName" placeholder="请输入开户行" />
  19. </view>
  20. <view class="form_group">
  21. <view class="lable re">银行卡号</view>
  22. <input type="text" v-model="item.bankAccount" placeholder="请输入银行卡号" />
  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. { name: 'phone', checkType: 'phone', errorMsg: '请请输入手机号' },
  53. { name: 'alipay', checkType: 'notnull', errorMsg: '请输入支付宝账号' }
  54. ];
  55. if (!this.verify.check(this.item, rule)) {
  56. uni.showModal({ content: this.verify.error, showCancel: false });
  57. return false;
  58. }
  59. this.http.request({
  60. url: '/app/user/edit',
  61. data: this.item,
  62. method: 'POST',
  63. success: (res) => {
  64. uni.showModal({
  65. title: '提示',
  66. content: '编辑成功。',
  67. showCancel: false,
  68. success: (res) => {
  69. uni.setStorageSync('bankName', 'bankName');
  70. uni.navigateBack();
  71. }
  72. });
  73. }
  74. });
  75. }
  76. }
  77. };
  78. </script>
  79. <style lang="scss">
  80. .btn {
  81. margin-top: 30px;
  82. }
  83. </style>