123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233 |
- <template>
- <view class="passwordset-content" :style="{'--status-bar-': statusBarHeight}">
- <view class="passwordset-content-info">
- <!-- 头部主要内容 开始 -->
- <view class="passwordset-content-header">
- <customNavbar
- title="支付密码设置"
- bgColor="var(--gd-bgm-color)"
- :contentStyle="{color: '#fff'}"
- :leftStyle="{color: '#fff'}"
- ></customNavbar>
- </view>
- <!-- 头部主要内容 结束 -->
-
- <!-- userInfo内容 开始 -->
-
- <view class="passwordset-content-password">
- <text>{{ tip[actionIndex] }}</text>
- <view>
- <u-code-input v-model="value" @finish="finish" :focus="true" dot></u-code-input>
- </view>
- </view>
- <!-- userInfo内容 结束 -->
- </view>
- </view>
- </template>
- <script>
- import { navigateTo } from "@/utils/util.js"
- export default {
- data() {
- return {
- title: '这是我的',
- statusBarHeight: 0, // 状态栏安全距离
- value: "",
- tip: ["输入当前密码,用于确认身份","设置六位数数字密码","再次输入"],
- actionIndex: 0,
- password: '',
- withdrawInfo: {}
- }
- },
- onLoad() {
- },
- onShow() {
- this.statusBarHeight = getApp().globalData.statusBarHeight
- this.getWithdrawInfo()
- },
- methods: {
- /**
- * @author ygh
- * @data 2023-12-20
- */
- navigateToFun(item){
- navigateTo(item.url)
- },
- finish(){
- if(this.actionIndex == 0) { // 认证密码
- this.marketPersons()
- }else if(this.actionIndex == 1) {
- uni.showLoading({
- title: "下一步"
- })
- this.password = this.value
- setTimeout(()=>{
- this.$set(this,'value', '')
- this.actionIndex += 1
- console.log("this.value==",this.value)
- uni.hideLoading()
- },500)
-
- }else if(this.actionIndex == 2) {
- if(this.password != this.value){
- uni.showToast({
- title: '两次密码不一样',
- icon: 'none'
- });
- this.getWithdrawInfo()
- }else {
- this.payset()
- }
- }
- },
- /**
- * 获取用户密码信息
- */
- async getWithdrawInfo() {
- try{
- this.password = ''
- this.value = ''
- let res = await this.$u.api.withdrawInfo({
- noSign: 1,
- userid: this.distribution_user_info.userId
- })
-
- if(res && res.code ===200) {
- this.withdrawInfo = res.data
- if(this.withdrawInfo.ifPaySet== 0) {
- this.actionIndex = 1
- }else {
- this.actionIndex = 0
- }
- }
- }catch(e){
- //TODO handle the exception
- console.error("e===",e)
- }
- },
- /**
- * 密码校验
- */
- async marketPersons() {
- try{
- uni.showLoading({
- title: "认证中..."
- })
- let res = await this.$u.api.marketPersons({
- noSign: 1,
- userid: this.distribution_user_info.userId,
- oldPassword: this.value
- })
-
- if(res && res.code ===200) {
- this.value = ''
- this.actionIndex += 1
- uni.hideLoading()
- uni.showToast({
- title: '认证成功',
- icon: 'none'
- });
-
- } else {
- this.value = ''
- uni.showToast({
- title: res.msg,
- icon: 'none'
- });
- }
- }catch(e){
- //TODO handle the exception
- console.error("e===",e)
- this.value = ''
- uni.showToast({
- title: "认证失败",
- icon: 'none'
- });
- }
- },
- /**
- * 设置密码
- */
- async payset() {
- try{
- let res = await this.$u.api.payset({
- noSign: 1,
- userid: this.distribution_user_info.userId,
- newPassword: this.value
- })
-
- if(res && res.code ===200) {
- uni.showToast({
- title: "设置成功",
- icon: 'none'
- });
- uni.navigateBack({
- delta: 1
- })
- } else {
- uni.showToast({
- title: "设置失败",
- icon: 'none'
- });
- this.getWithdrawInfo()
- }
- }catch(e){
- //TODO handle the exception
- console.error("e===",e)
- uni.showToast({
- title: "设置失败",
- icon: 'none'
- });
- this.getWithdrawInfo()
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .passwordset-content {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- --header-h: 90rpx;
- .passwordset-content-info {
- width: 100%;
- box-sizing: border-box;
- }
- }
- /** 头部主要内容 开始 */
- .passwordset-content-header {
- width: 100%;
- height: var(--header-h);
- box-sizing: border-box;
- ::v-deep .u-search {
- padding: 0 30rpx !important;
- }
- ::v-deep .u-search__action {
- color: #fff !important;
- }
- }
- /** 头部主要内容 结束 **/
-
- /** password内容 开始 */
- .passwordset-content-password {
- width: 100%;
- padding: 40rpx 40rpx 0;
- box-sizing: border-box;
- display: flex;
- flex-direction: column;
- justify-content: center;
- >text {
- text-align: center;
- }
- >view {
- margin-top: 40rpx;
- display: flex;
- justify-content: center;
- }
- }
- /** password内容 结束 */
- </style>
|