163 lines
3.0 KiB
Vue
163 lines
3.0 KiB
Vue
<template>
|
|
<view class="new_linkman">
|
|
<view class="info_head">基础信息</view>
|
|
<form-item v-for="(item,index) in listForm" :key="index" :objInfo="item" @changeData="changeData"></form-item>
|
|
<view id="btn" class="btn_g bg-blue button-hover round" @click="toSave">
|
|
保存
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import formItem from '@/components/form/formitem.vue'
|
|
import { netSetForm } from '@/api/index.js'
|
|
import { netSelect, netEditContactInfo, netConcatDetailInfo } from '@/api/kehu.js'
|
|
import { checkPhone } from '@/util/util.js'
|
|
export default {
|
|
components:{
|
|
formItem
|
|
},
|
|
data() {
|
|
return {
|
|
id:'', //客户名称
|
|
info:{},
|
|
listForm:[]
|
|
}
|
|
},
|
|
onLoad(options) {
|
|
this.id = options.id
|
|
//获取 联系人 信息
|
|
this.getInfo()
|
|
},
|
|
methods: {
|
|
//联系人 信息
|
|
getInfo() {
|
|
netConcatDetailInfo({id:this.id}).then(res=>{
|
|
res = res.data
|
|
this.info = res
|
|
this.getForm()
|
|
})
|
|
},
|
|
getForm() {
|
|
netSetForm({type:'contacts'}).then(res=>{
|
|
res = res.data.data
|
|
res.forEach(ele=>{
|
|
ele.value = this.info[ele.id]?this.info[ele.id]:''
|
|
})
|
|
this.listForm = res
|
|
})
|
|
},
|
|
changeData(name,value,obj) {
|
|
let arr = this.listForm
|
|
arr.forEach((ele,index) => {
|
|
if(ele.id == obj.id){
|
|
ele.value = value
|
|
this.$set(this.listForm,index,ele)
|
|
}
|
|
})
|
|
},
|
|
//保存
|
|
toSave() {
|
|
let params = this.checkCommonForm(this.listForm)
|
|
if(!params){
|
|
return
|
|
}
|
|
params = Object.assign({},params,{id:this.id})
|
|
netEditContactInfo(params).then(res=>{
|
|
uni.showToast({
|
|
title: res.msg,
|
|
icon:'none',
|
|
duration: 2000
|
|
})
|
|
setTimeout(()=>{
|
|
uni.navigateBack({
|
|
delta:1
|
|
})
|
|
},2000)
|
|
})
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.new_linkman {
|
|
font-size: 28rpx;
|
|
.mar_top {
|
|
margin-top: 30rpx;
|
|
}
|
|
.info_head {
|
|
height: 80rpx;
|
|
line-height: 80rpx;
|
|
font-size: 24rpx;
|
|
color: #999;
|
|
padding-left: 24rpx;
|
|
}
|
|
.fllow_form {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
height: 100rpx;
|
|
line-height: 100rpx;
|
|
background-color: #fff;
|
|
border-bottom: 1rpx solid #EAEAEA;
|
|
padding: 0 24rpx;
|
|
input {
|
|
height: 100rpx;
|
|
line-height: 100rpx;
|
|
}
|
|
.form_right {
|
|
display: flex;
|
|
color: #999;
|
|
image {
|
|
width: 40rpx;
|
|
height: 40rpx;
|
|
margin: 28rpx 5rpx 0 0;
|
|
}
|
|
}
|
|
.theme {
|
|
color: #5ca9fe;
|
|
}
|
|
text {
|
|
color: #f00;
|
|
margin-left: 10rpx;
|
|
}
|
|
.form_input {
|
|
input {
|
|
height: 100rpx;
|
|
line-height: 100rpx;
|
|
text-align: right;
|
|
margin-right: 10rpx;
|
|
}
|
|
}
|
|
}
|
|
.fllow_area {
|
|
background-color: #fff;
|
|
padding: 0 30rpx;
|
|
margin-bottom: 30rpx;
|
|
.area_head {
|
|
height: 100rpx;
|
|
line-height: 100rpx;
|
|
text {
|
|
color: #f00;
|
|
}
|
|
}
|
|
textarea {
|
|
width: 100%;
|
|
height: 300rpx;
|
|
background: #f8f8f8;
|
|
}
|
|
}
|
|
}
|
|
#btn {
|
|
font-size: 26rpx;
|
|
color: #fff;
|
|
text-align: center;
|
|
line-height: 88rpx;
|
|
width: 500rpx;
|
|
height: 88rpx;
|
|
background: $uni-text-color;
|
|
border-radius: 29rpx;
|
|
margin: 30rpx auto;
|
|
}
|
|
</style>
|