|
@@ -1,41 +1,168 @@
|
|
<template>
|
|
<template>
|
|
-<div>
|
|
|
|
- <header class="mui-bar mui-bar-nav">
|
|
|
|
- <h1 class="mui-title">编辑联系人</h1>
|
|
|
|
- <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
|
|
|
|
- </header>
|
|
|
|
- <div class="mui-content">
|
|
|
|
|
|
+ <div>
|
|
|
|
+ <common @asynCallBack="asynCallBack"></common>
|
|
|
|
+ <top-header :pageTitle="pageTitle"></top-header>
|
|
|
|
+
|
|
|
|
+ <div class="mui-content">
|
|
<div class="mui-content-padded vongi-qingjiadt vongi-editme">
|
|
<div class="mui-content-padded vongi-qingjiadt vongi-editme">
|
|
<form class="mui-input-group">
|
|
<form class="mui-input-group">
|
|
<div class="mui-input-row">
|
|
<div class="mui-input-row">
|
|
<label>姓名<i class="colorfe616c">*</i></label>
|
|
<label>姓名<i class="colorfe616c">*</i></label>
|
|
- <!--<input type="text" class="mui-input-clear" placeholder="请填写联系人姓名">-->
|
|
|
|
- <span>赵刚</span>
|
|
|
|
|
|
+ <input type="text" v-model="subForm.name" class="mui-input-clear" placeholder="请填写联系人姓名">
|
|
</div>
|
|
</div>
|
|
<div class="mui-input-row">
|
|
<div class="mui-input-row">
|
|
<label>手机号码<i class="colorfe616c">*</i></label>
|
|
<label>手机号码<i class="colorfe616c">*</i></label>
|
|
- <!--<input type="text" class="mui-input-clear" placeholder="请填写联系人手机号码">-->
|
|
|
|
- <span>15500001111</span>
|
|
|
|
|
|
+ <input type="text" v-model="subForm.phone" class="mui-input-clear" placeholder="请填写联系人手机号码">
|
|
</div>
|
|
</div>
|
|
- <div class="mui-input-row">
|
|
|
|
|
|
+ <div class="mui-input-row">
|
|
<label style="width:50%">设为紧急联系人</label>
|
|
<label style="width:50%">设为紧急联系人</label>
|
|
- <div id="autoLogin" class="mui-switch mui-active">
|
|
|
|
|
|
+ <div @click="subForm.urgentStatus=!subForm.urgentStatus" :class="'mui-switch '+(subForm.urgentStatus?'mui-active':'')">
|
|
<div class="mui-switch-handle"></div>
|
|
<div class="mui-switch-handle"></div>
|
|
- </div>
|
|
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<div class="vongi-btn vongi-login-btn">
|
|
<div class="vongi-btn vongi-login-btn">
|
|
- <button class="mui-btn mui-btn-pink">保 存</button>
|
|
|
|
|
|
+ <button class="mui-btn mui-btn-pink" @click="save">保 存</button>
|
|
<button class="mui-btn mui-btn-danger mui-btn-outlined">删除联系人</button>
|
|
<button class="mui-btn mui-btn-danger mui-btn-outlined">删除联系人</button>
|
|
- </div>
|
|
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
-</div>
|
|
|
|
|
|
+
|
|
|
|
+ <loading :visible="isLoading"></loading>
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+ import * as API_Relatives from '@/apis/Master/relatives'
|
|
|
|
+ import Common from '$project/components/Common.vue'
|
|
|
|
+ import Loading from '$project/components/Loading.vue'
|
|
|
|
+ import TopHeader from '$project/components/TopHeader.vue'
|
|
|
|
+ import {
|
|
|
|
+ mapGetters,
|
|
|
|
+ mapMutations
|
|
|
|
+ } from 'vuex'
|
|
|
|
+ import {
|
|
|
|
+ checkPhone,
|
|
|
|
+ } from '$project/utils'
|
|
|
|
+ export default {
|
|
|
|
+ name: 'MasterRelativesPhoneSave',
|
|
|
|
+ components: {
|
|
|
|
+ Common,
|
|
|
|
+ Loading,
|
|
|
|
+ TopHeader,
|
|
|
|
+ },
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+
|
|
|
|
+ isLoading: false,
|
|
|
|
+
|
|
|
|
+ subForm: {
|
|
|
|
+ bookId: this.$route.query.bookId,
|
|
|
|
+ name: '',
|
|
|
|
+ phone: '',
|
|
|
|
+ urgentStatus: false
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ //detail: {}
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ created() {
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ //获取详情
|
|
|
|
+ getInfo() {
|
|
|
|
+ this.isLoading = true;
|
|
|
|
+ API_Relatives.getPhoneNumberInfo(this.subForm.bookId).then(response => {
|
|
|
|
+ this.isLoading = false;
|
|
|
|
+
|
|
|
|
+ this.subForm.name = response.person.name;
|
|
|
|
+ this.subForm.phone = response.person.phone;
|
|
|
|
+ this.subForm.urgentStatus = response.person.urgentStatus;
|
|
|
|
+
|
|
|
|
+ }).catch(error => {
|
|
|
|
+ this.isLoading = false;
|
|
|
|
+ mui.toast(error);
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ //检测表单
|
|
|
|
+ checkForm() {
|
|
|
|
+ let phoneResult = checkPhone(this.subForm.phone);
|
|
|
|
+ if (!this.subForm.name) {
|
|
|
|
+ mui.toast('请输入姓名');
|
|
|
|
+ return false;
|
|
|
|
+ } else if (typeof phoneResult == 'string') {
|
|
|
|
+ mui.toast(phoneResult);
|
|
|
|
+ return false;
|
|
|
|
+ } else {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ //保存
|
|
|
|
+ save() {
|
|
|
|
+ if (this.checkForm()) {
|
|
|
|
+ this.isLoading = true;
|
|
|
|
+ API_Relatives.updatePhoneNumber(this.subForm).then(response => {
|
|
|
|
+ this.isLoading = false;
|
|
|
|
+
|
|
|
|
+ mui.toast('保存成功');
|
|
|
|
+ this.$router.go(-1);
|
|
|
|
+
|
|
|
|
+ }).catch(error => {
|
|
|
|
+ this.isLoading = false;
|
|
|
|
+ mui.toast(error);
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ asynCallBack() {},
|
|
|
|
+ },
|
|
|
|
+ mounted() {
|
|
|
|
+ if (this.actionType == 'edit') {
|
|
|
|
+ //获取详情
|
|
|
|
+ this.getInfo();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ destroyed() {},
|
|
|
|
+ computed: {
|
|
|
|
+ pageTitle: {
|
|
|
|
+ // getter
|
|
|
|
+ get: function() {
|
|
|
|
+ if (this.subForm.bookId) {
|
|
|
|
+ return '编辑联系人';
|
|
|
|
+ } else {
|
|
|
|
+ return '新增联系人';
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // setter
|
|
|
|
+ set: function(newValue) {
|
|
|
|
+ console.log(newValue)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ actionType: {
|
|
|
|
+ // getter
|
|
|
|
+ get: function() {
|
|
|
|
+ if (this.subForm.bookId) {
|
|
|
|
+ return 'edit';
|
|
|
|
+ } else {
|
|
|
|
+ return 'add';
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // setter
|
|
|
|
+ set: function(newValue) {
|
|
|
|
+ console.log(newValue)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ ...mapGetters({
|
|
|
|
+ openId: 'wx_openid',
|
|
|
|
+ token: 'token',
|
|
|
|
+ person_data: 'person_data',
|
|
|
|
+ person_popedom: 'person_popedom',
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
+
|
|
<style scoped src="$project/assets/css/pension.css"></style>
|
|
<style scoped src="$project/assets/css/pension.css"></style>
|
|
<style scoped src="$project/assets/css/xpwyfyy.css"></style>
|
|
<style scoped src="$project/assets/css/xpwyfyy.css"></style>
|
|
<style src="$project/assets/css/iconfont.css"></style>
|
|
<style src="$project/assets/css/iconfont.css"></style>
|