123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <template>
- <view style="background: #F2F6FF;position: absolute;min-height: 92.2vh;width: 100%;">
- <view style="background: #fff;padding:0 20rpx;">
- <u-form :model="dataForm" ref="uForm" label-width="180rpx" :rules="rules">
- <u-form-item label="开户行:" prop="bankCreat" borderBottom>
- <u--input v-model="dataForm.bankCreat" border="false" placeholder='请输入开户行'></u--input>
- </u-form-item>
- <u-form-item label="银行卡号:" prop="bankNo" borderBottom>
- <u--input v-model="dataForm.bankNo" border="false" placeholder='请输入银行卡号'></u--input>
- </u-form-item>
- <u-form-item label="是否默认:" prop="defaultd" borderBottom>
- <u-radio-group v-model="dataForm.defaultd" placement="row">
- <u-radio label="是" :name="1">
- </u-radio>
- <u-radio label="否" :name="0">
- </u-radio>
- </u-radio-group>
- </u-form-item>
- </u-form>
- <u-button type="primary" style="margin-top: 100rpx;" @click="submit">提交</u-button>
- <u-button type="error" style="margin: 20rpx 0;" v-if="dataForm.id" @click="deletebank">删除</u-button>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- dataForm: {
- bankCreat: "",
- bankNo: "",
- defaultd: 0,
- },
- rules: {
- bankCreat: [{
- required: true,
- message: '请输入开户行',
- trigger: ['blur', 'change']
- }],
- bankNo: [{
- required: true,
- message: '请输入银行卡号',
- trigger: ['blur', 'change']
- }],
- }
- }
- },
- onReady() {
- //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
- this.$refs.uForm.setRules(this.rules)
- },
- onLoad(e) {
- if (JSON.parse(e.date)) {
- this.dataForm = JSON.parse(e.date)
- }
- },
- methods: {
- deletebank() {
- let postdata = {
- workId: uni.getStorageSync('userInfo').id,
- ids: [this.dataForm.id]
- }
- this.$api.to_http(`/employees/banklist/delete`, postdata, "POST").then((
- res) => {
- if (res.data.code != 0) {
- return uni.$u.toast(res.data.msg)
- }
- uni.$u.toast('操作成功')
- setTimeout(() => {
- uni.navigateBack(-1)
- }, 500)
- })
- },
- submit() {
- let that = this
- this.dataForm.refUserId = uni.getStorageSync('userInfo').userProfileId
- that.$refs.uForm.validate().then(res => {
- this.$api.to_http(`/employees/banklist/saveByWorkId`, that.dataForm, "POST").then((
- res) => {
- if (res.data.code != 0) {
- return uni.$u.toast(res.data.msg)
- }
- uni.$u.toast('操作成功')
- setTimeout(() => {
- uni.navigateBack(-1)
- }, 500)
- })
- }).catch(errors => {
- uni.$u.toast('请完成必填项')
- })
- }
- }
- }
- </script>
- <style lang="less" scoped>
- /deep/.u-radio {
- margin-right: 15rpx;
- }
- /deep/.u-button {
- margin: 20rpx 0;
- }
- </style>
|