Browse Source

feat: 个人中心修改银行信息

xuyunhui 1 năm trước cách đây
mục cha
commit
5520eb793b

+ 8 - 0
common/js/service.js

@@ -266,5 +266,13 @@ export default {
             data: data
         })
     },
+    // 更新个人信息
+    updateInfo(data) {
+        return request({
+            url: '/member/app/updateInfo',
+            method: 'POST',
+            data: data
+        })
+    },
 
 }

+ 7 - 0
pages.json

@@ -178,6 +178,13 @@
 				"navigationBarTitleText" : "提现记录"
 			}
 		},
+		{
+			"path" : "pages/updateBankCardData/index",
+			"style" :
+			{
+				"navigationBarTitleText" : "修改账户信息"
+			}
+		},
 		{
 			"path" : "pages/agreement/agreement",
 			"style" :

+ 0 - 1
pages/login/login.vue

@@ -149,7 +149,6 @@
 				uni.removeStorageSync('isLogOut');
 				console.log('savePassword', this.savePassword)
 
-
 				if (this.requestStatus){
 					return
 				}

+ 27 - 0
pages/updateBankCardData/index.rpx.css

@@ -0,0 +1,27 @@
+.page {
+    height: 100vh;
+    background-color: #f7f7f7;
+    padding: 0 32rpx;
+}
+.formView{
+    padding-top: 10rpx;
+}
+.updatePasswordButton{
+    text-align: center;
+    background: #4cd964;
+    line-height: 80rpx;
+    border-radius: 10rpx;
+    color: #FFFFFF;
+    margin-top: 100rpx;
+}
+.customStyle{
+    background: #fff05c;
+    border: #fff05c;
+    border-radius: 10rpx;
+}
+.customStyle::after{
+    border: none;
+}
+.inputCode{
+    width: 350rpx;
+}

+ 101 - 0
pages/updateBankCardData/index.vue

@@ -0,0 +1,101 @@
+<template>
+  <view class="page">
+    <!-- #ifdef H5-->
+    <uni-nav-bar v-if="!$isWxBrowser()" :fixed="true" background-color="#FFE05C" :border="false" :statusBar="false"
+                 left-icon="left" title="修改账户信息" @clickLeft="back"/>
+    <!-- #endif -->
+    <view class="formView">
+      <u--form labelPosition="left" :model="form" :rules="rules" ref="uForm">
+
+        <u-form-item :labelWidth="80" label="银行卡号:" prop="bankCard" ref="item1">
+          <u--input v-model="form.bankCard" placeholder="请输入银行卡号" type="number"></u--input>
+        </u-form-item>
+
+        <u-form-item :labelWidth="80" label="开户行:" prop="openingBank" ref="item1">
+          <u--input v-model="form.openingBank" placeholder="请输入开户行" type="text"></u--input>
+        </u-form-item>
+
+      </u--form>
+
+      <view :style="{'marginTop':'100rpx'}">
+        <button class="customStyle" @click="retrievePassword">提交</button>
+      </view>
+    </view>
+    <u-code ref="uCode" @change="codeChange" seconds="60" @start="disabled1 = true" @end="disabled1 = false"></u-code>
+    <!--#ifdef H5-->
+    <liu-drag-button v-if="$isWxBrowser()" @clickBtn="back">返回</liu-drag-button>
+    <!--#endif-->
+  </view>
+</template>
+<script>
+export default {
+  data() {
+    return {
+      disabled1: false,
+      tips: '',
+      form: {
+        bankCard: '',
+        openingBank: '',
+      },
+      rules: {
+        'bankCard': {
+          type: 'string',
+          required: true,
+          message: '请输入银行卡号',
+          trigger: ['blur', 'change']
+        },
+        'openingBank': {
+          type: 'string',
+          required: true,
+          message: '请输入开户行',
+          trigger: ['blur', 'change']
+        },
+      },
+    }
+  },
+  methods: {
+    retrievePassword() {
+      this.$refs.uForm.validate().then(res => {
+        this.$api.service.updateInfo(this.form).then(res => {
+          uni.showToast({
+            icon: 'success',
+            duration: 2000,
+            title: '修改成功,即将返回上一页'
+          });
+          this.updateInfo()
+        })
+      })
+    },
+    //更新个人信息
+    updateInfo() {
+      this.$api.user.getUserInfo().then(res=>{
+        this.userInfo = res.data.data
+        uni.setStorageSync('spreadUserInfo', this.userInfo)
+        this.back()
+      })
+    },
+    back() {
+      let pages = getCurrentPages()
+      if (pages.length > 1) {
+        uni.navigateBack({
+          delta: 1,
+          fail: err => {
+            console.log(err)
+          }
+        })
+      } else {
+        uni.switchTab({
+          url: '/pages/my/my'
+        });
+      }
+    },
+    codeChange(text) {
+      this.tips = text;
+    },
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+@import './index.rpx.css';
+</style>

+ 13 - 0
pages/userInfo/index.rpx.css

@@ -61,3 +61,16 @@
 .logoutButton{
     margin-top: 100rpx;
 }
+.popupStyle{
+    background-color: white;
+    width: 600rpx;
+    height: 250rpx;
+    border-radius: 20rpx;
+    margin: 20rpx;
+    padding: 10rpx;
+}
+.popupStyleItem{
+    display: flex;
+    justify-content: center;
+    align-items: center;
+}

+ 38 - 14
pages/userInfo/userInfo.vue

@@ -42,14 +42,38 @@
 					</view>
 				</view>
 				<view class="flex-row justify-between bordBot" >
-					<view class="key flex-col justify-center ">
-						<text>找回密码</text>
-					</view>
-					<view class="flex-row justify-end nikeName " @click="updatePassword">
-						<text>点击修改</text>
-						<u-icon name="arrow-right" color="#666" size="18"></u-icon>
-					</view>
-				</view>
+        <view class="key flex-col justify-center ">
+          <text>找回密码</text>
+        </view>
+        <view class="flex-row justify-end nikeName " @click="updatePassword">
+          <text>点击修改</text>
+          <u-icon name="arrow-right" color="#666" size="18"></u-icon>
+        </view>
+      </view>
+        <view class="flex-row justify-between bordBot" >
+          <view class="key flex-col justify-center ">
+            <text>银行卡号</text>
+          </view>
+          <view v-if="userInfo.bankCard" class="nikeName flex-row justify-center">
+            <input   name="phone" disabled v-model="userInfo.bankCard"/>
+          </view>
+          <view v-else class="flex-row justify-end nikeName " @click="updateCardNumber">
+            <text>去填写</text>
+            <u-icon name="arrow-right" color="#666" size="18"></u-icon>
+          </view>
+        </view>
+        <view class="flex-row justify-between bordBot" >
+          <view class="key flex-col justify-center ">
+            <text>开户行</text>
+          </view>
+          <view v-if="userInfo.openingBank" class="nikeName flex-row justify-center">
+            <input   name="phone" disabled v-model="userInfo.openingBank"/>
+          </view>
+          <view v-else class="flex-row justify-end nikeName " @click="updateCardNumber">
+            <text>去填写</text>
+            <u-icon name="arrow-right" color="#666" size="18"></u-icon>
+          </view>
+        </view>
 
 <!--				<button class="updateButton"  formType="submit">-->
 <!--					<text>保存</text>-->
@@ -71,7 +95,6 @@
 				@close="showSex = false"
 				@select="sexSelect">
 		</u-action-sheet>
-
 	</view>
 </template>
 
@@ -83,6 +106,7 @@
 				photoUrl:'',
 				userInfo: {},
 				genderIndex:0,
+        bankCardNumber:'',
 				actions: [{
 					name: '男',
 					value:'1'
@@ -109,12 +133,12 @@
 			inputValue(e){
 				console.log('+++++++++++++inputValue+++++++++++',e)
 				this.userInfo.name = e.detail.value.name
-
-
-
-
 			},
-
+      updateCardNumber(){
+        uni.navigateTo({
+          url:'/pages/updateBankCardData/index'
+        })
+      },
 			updateAvatar(){
 				let that = this
 				uni.chooseImage({