You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

162 lines
4.0 KiB
Vue

<template>
<view>
<view class='module'>
<view class="cu-form-group">
<view class="title">会员编码</view>
{{form.memberNum}}
</view>
<view class='common-hr'></view>
</view>
<view class='module'>
<view class="cu-form-group">
<view class="title">会员名称</view>
<text v-show="!memberNameShow" @click="memberNameShow=true">
{{form.memberName}}
</text>
<input v-show="memberNameShow" @blur="memberNameShow=false" type="text" :value="form.memberName" />
</view>
<view class='common-hr'></view>
</view>
<view class='module'>
<view class="cu-form-group">
<view class="title">会员手机号</view>
{{form.mobilePhone}}
</view>
<view class='common-hr'></view>
</view>
<view class='module'>
<view class="cu-form-group">
<view class="title">性别</view>
<picker @change="PickerChange" :value="form.sex" :range="picker">
<view class="picker">
{{form.sex>-1?picker[form.sex]:form.sex == 1 ? '男' : '女'}}
</view>
</picker>
</view>
<view class='common-hr'></view>
</view>
<view class='module'>
<view class="cu-form-group">
<view class="title">支付密码</view>
<input type="password" placeholder="请输入您的支付密码" v-show="passwordShow" :value="form.cashPassword" />
<button class="cu-btn round line-red" @click="passClick()"> <text v-if="!passwordShow">变更</text><text v-else>取消</text></button>
</view>
<view class='common-hr'></view>
</view>
<view class='module' v-if="passwordShow">
<view class="cu-form-group">
<view class="title">新的密码</view>
<input type="password" placeholder="请输入新的支付密码" :value="form.newCashPassword" />
</view>
<view class='common-hr'></view>
</view>
<view class='module' v-if="passwordShow">
<view class="cu-form-group">
<view class="title">确认密码</view>
<input type="password" placeholder="请再次输入支付密码" :value="form.confirmpass" />
</view>
<view class='common-hr'></view>
</view>
<button style="width: 90%;margin: 50upx 5%;" @click="confirm" class="cu-btn bg-red lg"></button>
</view>
</template>
<script>
export default {
data() {
return {
form: {
memberNum: null,
memberName: null,
mobilePhone: null,
sex: null,
cashPassword: null,
newCashPassword: null,
confirmpass: null,
},
memberNameShow: false,
modalName: "",
passwordShow: false,
picker: ["女", "男"]
}
},
methods: {
passClick() {
this.passwordShow = !this.passwordShow
},
PickerChange(e) {
this.form.sex = e.detail.value
},
confirm() {
let flag = true
if (this.passwordShow == true) {
if (this.form.cashPassword == null) {
uni.showToast({
title: '原始支付密码不能为空',
icon: 'none',
duration: 2000
});
} else if (this.form.newCashPassword == null) {
uni.showToast({
title: '新的支付密码不能为空',
icon: 'none',
duration: 2000
});
} else if (this.form.newCashPassword != this.form.confirmpass) {
uni.showToast({
title: '两次输入密码不一致',
icon: 'none',
duration: 2000
});
} else {
flag = false
}
}
if (flag == true) {
this.$api.editmemberCs(this.form).then(res => {
if (res.code == "000000") {
uni.showToast({
title: '修改成功',
icon: 'none',
duration: 2000
});
uni.switchTab({
url: '../../../mySet'
});
} else {
uni.showToast({
title: res.message,
icon: 'none',
duration: 2000
});
}
})
}
},
},
created() {
this.form = uni.getStorageSync('userInfo')
delete this.form.cashPassword
// this.form.cashPassword = null
}
}
</script>
<style>
.cu-form-group .title {
min-width: calc(4em + 30upx);
}
.cu-form-group input {
text-align: left;
}
.common-hr {
width: 94%;
margin: 0 3%;
height: 1upx;
background-color: #ececec;
}
</style>