| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- <template>
- <view class="content">
- <view class="box">
- <view class="item top">
- <text>真实姓名</text>
- <input type="text" value="" v-model="name" placeholder="请输入真实姓名" />
- </view>
- <view class="item">
- <text>支付宝账号</text>
- <input type="text" value="" v-model="id" placeholder="请输入支付宝账号" />
- </view>
- </view>
- <button class="button" type="default" @click="confirm()">确认</button>
- </view>
- </template>
- <script>
- import {
- orderData,
- getUserInfo
- } from '@/api/user.js';
- import {
- mapState,
- mapMutations
- } from 'vuex';
- import {
- userEdit
- } from '@/api/set.js';
- export default {
- data() {
- return {
- name: '',
- id: ''
- }
- },
- computed: {
- //mapState使用时需要先导入mapState辅助函数 import{ mapState} from 'vuex'
- ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
- },
- onLoad() {
- console.log(this.userInfo)
- if (this.userInfo.alipay_code != null) {
- this.id = this.userInfo.alipay_code
- }
- if (this.userInfo.alipay_name != null) {
- this.name = this.userInfo.alipay_name
- }
- },
- methods: {
- //缓存信息
- ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
- confirm() {
- let obj = this
- if (!obj.name) {
- return this.$api.msg("请输入提款人姓名")
- }
- if (!obj.id) {
- return this.$api.msg('请输入支付宝账号')
- }
- userEdit({
- alipay_name: obj.name,
- alipay_code: obj.id
- }).then(e => {
- obj.$api.msg('修改成功')
- obj.getUserInfo();
- }).catch(e=>{
- console.log(e);
- })
- },
- getUserInfo() {
- getUserInfo({}).then(({data})=>{
- console.log(data)
- this.setUserInfo(data)
- })
- }
- }
- }
- </script>
- <style lang="scss">
- page,
- .content {
- height: 100%;
- padding: 0;
- margin: 0;
- }
- .top {
- border-bottom: 1rpx solid #F3F3F3;
- }
- .box {
- background: #FFFFFF;
- margin: 20rpx 0 70rpx 0;
- .item {
- display: flex;
- align-items: center;
- text {
- margin: 0 40rpx 0 25rpx;
- width: 150rpx;
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: 400;
- color: #333333;
- line-height: 100rpx;
- }
- input {
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 400;
- color: #999999;
- line-height: 100rpx;
- }
- }
- }
- .button {
- text-align: center;
- width: 560rpx;
- height: 80rpx;
- background: linear-gradient(90deg, #44BFEC, #438BED);
- border-radius: 40rpx;
- font-size: 30rpx;
- font-family: PingFangSC;
- font-weight: 500;
- color: #FFFFFF;
- line-height: 80rpx;
- }
- </style>
|