123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <template>
- <view>
- <view class="main">
- <view class="form">
- <view class="form_group">
- <view class="lable">手机号</view>
- <input type="text" v-model="item.phone" placeholder="请输入手机号" />
- </view>
- <view class="form_group">
- <view class="lable">支付宝</view>
- <input type="text" v-model="item.alipay" placeholder="请输入支付宝账号" />
- </view>
- </view>
- <button class="btn" @click="save()">确定</button>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- item: {}
- };
- },
- onLoad() {
- this.getData();
- },
- methods: {
- getData() {
- this.http.request({
- url: '/app/user/info',
- data: this.item,
- success: (res) => {
- this.item = res.data.data;
- }
- });
- },
- save() {
- let rule = [
- { name: 'phone', checkType: 'phone', errorMsg: '请请输入手机号' },
- { name: 'alipay', checkType: 'notnull', errorMsg: '请输入支付宝账号' }
- ];
- if (!this.verify.check(this.item, rule)) {
- uni.showModal({ content: this.verify.error, showCancel: false });
- return false;
- }
- this.http.request({
- url: '/app/user/edit',
- data: this.item,
- method: 'POST',
- success: (res) => {
- uni.showModal({
- title: '提示',
- content: '编辑成功。',
- showCancel: false,
- success: (res) => {
- uni.navigateBack();
- }
- });
- }
- });
- }
- }
- };
- </script>
- <style lang="scss">
- .btn {
- margin-top: 30px;
- }
- </style>
|