|
@@ -11,14 +11,14 @@
|
|
|
<u-form-item label="姓名" prop="name" borderBottom>
|
|
|
<u--input v-model="form.name" placeholder="与证件名字一致" border="none"></u--input>
|
|
|
</u-form-item>
|
|
|
- <u-form-item label="身份证" prop="sfz" borderBottom>
|
|
|
- <u--input v-model="form.sfz" placeholder="身份证号码" border="none"></u--input>
|
|
|
+ <u-form-item label="身份证" prop="idcard" borderBottom>
|
|
|
+ <u--input v-model="form.idcard" placeholder="身份证号码" border="none"></u--input>
|
|
|
</u-form-item>
|
|
|
<u-form-item label="手机号" prop="mobile" borderBottom>
|
|
|
<u--input v-model="form.mobile" placeholder="常用手机号" border="none"></u--input>
|
|
|
</u-form-item>
|
|
|
</u--form>
|
|
|
- <view class="set-default u-flex u-row-between">
|
|
|
+ <!-- <view class="set-default u-flex u-row-between">
|
|
|
<view class="left">
|
|
|
<view class="up">设置为默认信息</view>
|
|
|
<view class="down">提醒:每次下单会默认使用该信息</view>
|
|
@@ -26,10 +26,11 @@
|
|
|
<view class="right">
|
|
|
<u-switch v-model="form.default" activeValue='1' inactiveValue='0'></u-switch>
|
|
|
</view>
|
|
|
- </view>
|
|
|
+ </view> -->
|
|
|
</view>
|
|
|
<view class="btn-wrap">
|
|
|
<view class="full-btn" @click="submit">保存</view>
|
|
|
+ <view class="full-btn red" v-if="type=='editVisitor'" @click="delVisitor">删除</view>
|
|
|
<view class="full-btn white" @click="cancel">取消</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -42,14 +43,14 @@
|
|
|
mixins:[systemInfo],
|
|
|
data() {
|
|
|
return {
|
|
|
- id:'',
|
|
|
type:'',
|
|
|
fromPage:'',
|
|
|
form: {
|
|
|
+ id:null,
|
|
|
name: '',
|
|
|
- sfz:'',
|
|
|
+ idcard:'',
|
|
|
mobile:'',
|
|
|
- default:'0',
|
|
|
+ // default:'0',
|
|
|
},
|
|
|
rules: {
|
|
|
'name': [
|
|
@@ -60,7 +61,7 @@
|
|
|
trigger: ['blur', 'change']
|
|
|
}
|
|
|
],
|
|
|
- 'sfz': [
|
|
|
+ 'idcard': [
|
|
|
{
|
|
|
type: 'string',
|
|
|
required: true,
|
|
@@ -103,7 +104,10 @@
|
|
|
this.getSystemInfo();
|
|
|
this.type = page.type;
|
|
|
this.fromPage = page.fromPage;
|
|
|
- this.id = page.id;
|
|
|
+ this.form.id = page.id;
|
|
|
+ this.form.name = page.name;
|
|
|
+ this.form.idcard = page.idcard;
|
|
|
+ this.form.mobile = page.mobile;
|
|
|
},
|
|
|
onReady() {
|
|
|
this.$refs.uForm.setRules(this.rules)
|
|
@@ -121,11 +125,49 @@
|
|
|
},
|
|
|
submit() {
|
|
|
this.$refs.uForm.validate().then(res => {
|
|
|
- uni.$u.toast('表单校验失败')
|
|
|
+ uni.$u.toast('表单校验成功')
|
|
|
+ console.log('this.type',this.type);
|
|
|
+ console.log('form',this.form);
|
|
|
+ this.$u.api.insertOrUpdateMember(this.form).then(res=>{
|
|
|
+ uni.navigateBack()
|
|
|
+ // if(this.type=='addVisitor'){
|
|
|
+ // // this.addVisitor()
|
|
|
+ // }else if(this.type=='editVisitor'){
|
|
|
+ // // this.editVisitor()
|
|
|
+ // }
|
|
|
+ }).catch(err=>{
|
|
|
+ console.log('insertOrUpdateMember',err);
|
|
|
+ })
|
|
|
}).catch(errors => {
|
|
|
+ console.log('errors',errors);
|
|
|
uni.$u.toast('表单校验失败')
|
|
|
})
|
|
|
},
|
|
|
+ addVisitor(){
|
|
|
+ console.log('form',this.form);
|
|
|
+ this.$u.api.insertOrUpdateMember(this.form).then(res=>{
|
|
|
+ // console.log('getSettlement',res.data);
|
|
|
+ this.pageContent = res.data;
|
|
|
+ }).catch(err=>{
|
|
|
+ console.log('insertOrUpdateMember',err);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ editVisitor(){
|
|
|
+ console.log('form',this.form);
|
|
|
+ },
|
|
|
+ delVisitor(){
|
|
|
+ console.log('form',this.form);
|
|
|
+ this.$u.api.deleteMember({id:this.form.id}).then(res=>{
|
|
|
+ uni.navigateBack()
|
|
|
+ // if(this.type=='addVisitor'){
|
|
|
+ // // this.addVisitor()
|
|
|
+ // }else if(this.type=='editVisitor'){
|
|
|
+ // // this.editVisitor()
|
|
|
+ // }
|
|
|
+ }).catch(err=>{
|
|
|
+ console.log('deleteMember',err);
|
|
|
+ })
|
|
|
+ },
|
|
|
cancel(){
|
|
|
this.leftClick();
|
|
|
}
|