<template> <view > <view class="bgtop"></view> <uni-forms :modelValue="datainfo"> <view class="addbox"> <view class="boxs pdbox" style="padding-bottom: 2rpx;"> <view class="titbox mb14"> <view class="tit flexc"> <image :src="titimg"></image> <view>基本详情</view> </view> </view> <uni-forms-item label="项目线索名称" name="clueName" required> <uni-easyinput :inputBorder="false" type="text" v-model="datainfo.clueName" placeholder="请输入项目线索名称" /> </uni-forms-item> <uni-forms-item label="拟投资额" name="investmentAmount" > <view class="flexc"> <uni-easyinput :inputBorder="false" type="number" v-model="datainfo.investmentAmount" placeholder="请输入拟投资额" /> 万元 </view> </uni-forms-item> <uni-forms-item label="联系人" name="contactsName" required> <uni-easyinput :inputBorder="false" v-model="datainfo.contactsName" placeholder="请输入联系人" /> </uni-forms-item> <uni-forms-item label="联系方式" name="contactsPhone" required> <uni-easyinput :inputBorder="false" v-model="datainfo.contactsPhone" placeholder="请输入联系方式" /> </uni-forms-item> <!-- <picker mode="date" @change='bindDateChangea' > <uni-forms-item label="录入日期" name="publishTime" > <view class="lbtabp"> <view :class="datainfo.publishTime?'':'coa'">{{datainfo.publishTime || "请选择录入日期"}}</view> </view> </uni-forms-item> </picker> --> <picker range-key='label' :value="xsztidx" :range="xsztlist" @change='bindDateChangec'> <uni-forms-item label="线索状态" name="type" required> <view class="lbtabp"> <view v-if="datainfo.type&&!xszttxt">{{statusFormat(datainfo.type,xsztlist)}}</view> <view v-else :class="xszttxt?'':'coa'">{{xszttxt||"请选择线索状态"}}</view> </view> </uni-forms-item> </picker> </view> <view class="boxs pdbox"> <view class="titbox mb14 flexc"> <view class="tit flexc flex1"> <image :src="titimg"></image> <view>内容</view> </view> </view> <editor id="editor" :class="pbFlag?'pbbox':''" class="ql-container" placeholder="请输入内容" show-img-size show-img-toolbar show-img-resize @statuschange="onStatusChange" @ready="onEditorReady"> </editor> </view> <view class="addbtn"> <view class="btn btn2" v-if="checkPermi(['zx:investment:add'])&&pagetype=='add'||checkPermi(['zx:investment:edit'])&&pagetype=='edit'" @click="getSubmit">提交</view> </view> </view> </uni-forms> </view> </template> <script> import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数 import config from '@/config' const baseUrl = config.baseUrl import { getToken } from '@/utils/auth' import { selectValue,selectValueKey } from '@/utils/common.js'; import {getinvestmentAddFn,getinvestmentEditFn,getinvestmentDetailFn} from "@/api/mine/meeting.js" import {getDictionaryFn} from "@/api/mine/register.js" export default{ data(){ return{ titimg:require("@/work/static/images/titbg.png"), addimg:require("@/work/static/images/meeting/add.png"), datainfo:{ "userId":"",//委员账号id "name":"",//委员姓名 "clueName":"",//项目线索名称 "investmentAmount":"",//拟投资额 "contactsName":"",//联系人 "contactsPhone":"",//联系方式 "contactsContent":"",//联系内容 "publishTime":'' }, id:"", pagetype:'add', editinfo:'', hylxlist:[], hylxtxt:'', hylxidx:"", pbFlag:false, readOnly:false, xsztlist:[], xsztidx:'', xszttxt:'', } }, onUnload(){ uni.$off('refreshtalb') }, onLoad(e) { uni.$on('refreshtalb', (e) => { this.datainfo.zxConferenceUserList=e.zxConferenceUserList }) if(e.type=='edit'){ this.id=e.id; this.pagetype='edit' this.getDetail() } this.init() }, methods:{ checkPermi, checkRole, init(){ // 线索状态 getDictionaryFn('investment_type').then(res=>{ if(res.code==200&&res.data.length){ this.xsztlist = res.data.map(v => { return { label: v.dictLabel, value:v.dictValue } }) } }) }, kayType(ite,list){ return selectValue(list, ite); }, statusFormat(ite,list,type) { var aite=selectValueKey(list, ite); if(type=='hylx'){ this.hylxidx=aite.key } return aite.actions; }, bindDateChangea(e){ var val=e.detail.value; this.datainfo.publishTime=val; }, bindDateChangec(e){ var val=e.detail.value; this.xszttxt=this.xsztlist[val].label; this.datainfo.type=this.xsztlist[val].value }, getDetail(){ var that=this; var params={ investmentId:this.id } getinvestmentDetailFn(this.id).then(res=>{ if(res.code==200){ var data=res.data; this.datainfo=res.data; this.editinfo=data.contactsContent; uni.createSelectorQuery().select('#editor').context(function(res) { that.editorCtx = res.context; that.editorCtx.setContents({ html:that.editinfo }) }).exec(); } }) }, getSubmit(){ var that=this; if(!this.datainfo.clueName){ this.$toast("请输入项目线索名称") return } if(!this.datainfo.contactsName){ this.$toast("请输入联系人") return } if(!this.datainfo.contactsPhone){ this.$toast("请选择联系方式") return } if(this.datainfo.contactsPhone){ let regphone = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/ if (this.datainfo.contactsPhone && !regphone.test(this.datainfo.contactsPhone)) { that.$toast("请输入正确的联系方式") return } } if(!this.datainfo.type){ this.$toast("请选择线索状态") return } var params=this.datainfo that.editorCtx.getContents({ success: function(data) { params.contactsContent=data.html; if(that.pagetype=='add'){ getinvestmentAddFn(params).then(res=>{ if(res.code==200){ that.$toast("新增成功") uni.removeStorageSync('cjhyList') uni.$emit("refreshlist") setTimeout(function(){ uni.navigateBack({ delta: 1 //返回层数,2则上上页 }); },1200) } }) }else{ getinvestmentEditFn(params).then(res=>{ if(res.code==200){ that.$toast("修改成功") uni.$emit("refreshdetail") uni.$emit("refreshlist") setTimeout(function(){ uni.navigateBack({ delta: 1 //返回层数,2则上上页 }); },1200) } }) } } }) }, onStatusChange(){ }, onEditorReady(){ var that=this; uni.createSelectorQuery().select('#editor').context(function(res) { that.editorCtx = res.context; that.editorCtx.setContents({ html:that.editinfo }) }).exec(); } } } </script> <style scoped lang="scss"> .bgtop{height: 150rpx;background-color: $com-cd3;width: 100%;} .pdbox{padding: 34rpx 24rpx 16rpx;} .addbox /deep/ .uni-forms-item{margin-bottom:36rpx;} .addbox /deep/ .uni-easyinput{flex: 1;text-align: right;font-size: 30rpx;} .addbox /deep/ .uni-forms-item__label{font-weight: bold;font-size: 30rpx;color: #343434;width: 198rpx !important;padding-left:20rpx;} .addbox /deep/ .is-required{position: absolute;left: 0;top: 50%;margin-top: -10rpx;} .addbox /deep/ .uni-data-checklist{display: flex;align-items: center;justify-content: flex-end;} .addbox /deep/ .uni-easyinput__placeholder-class{font-weight: 500;font-size: 30rpx;color: #AAAAAA;} .addbox /deep/ .checklist-box{margin-right: 0 !important;margin-left: 40rpx !important;} .fjadd{ .btn{font-weight: bold;font-size: 30rpx;color: #1D64E2;margin: 0;display: flex;align-items: center;} } .addbox{margin-top: -120rpx; padding: 0 24rpx 50rpx; .boxs{background: #FFFFFF;border-radius: 30rpx;margin-bottom: 24rpx;overflow: hidden;position: relative; .infobg{width: 102rpx;height: 106rpx;position: absolute;right: 26rpx;bottom: 22rpx;} .tips{background: #F1F6FF;padding: 18rpx 38rpx;display: flex;align-items: flex-start; image{width: 20rpx;height: 26rpx;margin-right: 16rpx;flex:0 0 auto;margin-top: 4rpx;} view{font-weight: 500;font-size: 26rpx;color: #1D64E2;} } .titbox{ .tit{ image{width: 32rpx;height: 18rpx;margin-right: 10rpx;} view{font-weight: bold;font-size: 32rpx;color: #222327;} } .titr{width: 146rpx;height: 50rpx;background: #E4EEFF;border-radius: 26rpx;font-weight: 500;font-size: 24rpx;color: #1D64E2;text-align: center;line-height: 50rpx;} } .titinf{display: flex;flex-wrap: wrap; .txt{font-weight: 500;font-size: 28rpx;margin-bottom: 18rpx;flex:0 1 auto;min-width: 50%;display: flex;align-items: flex-start;color: #222327; text{flex: 0 0 auto;color: #9F9F9F;} } } .addpeo{font-weight: bold;font-size: 30rpx;color: #1D64E2;display: flex;align-items: center; image{width: 26rpx;height: 24rpx;margin-right: 14rpx;} } .openbox{display: flex;align-items: center;justify-content: flex-end;font-weight: 500; font-size: 30rpx;height: 100%;color: #222327; } .edtip{font-weight: 500;font-size: 22rpx;color: #FF0000; text{margin: 4rpx 8rpx 0 0;} &.pa{position: absolute;right: 0;bottom: -15px;text-align: right;width: 702rpx;} } } } .matab{display: flex;align-items: center;flex-wrap: nowrap;overflow: auto;position: absolute;left: 0;right: -48rpx; .list{min-width:112rpx;height: 50rpx;background: #ffffff;border-radius: 25rpx;font-size: 30rpx;font-weight: 500;box-sizing: border-box; color: #AAAAAA;padding: 0 24rpx;box-sizing: border-box;margin-left:24rpx;flex: 0 0 auto;border: 2rpx solid #C1C1C1;display: flex;align-items: center;justify-content: center; &.act{background: #E4EEFF;color: #1D64E2;border: none;} } } // 附件 .fjlists {display: flex;align-items: flex-start;justify-content: space-between;margin-bottom: 12rpx; image{margin-right: 18rpx;flex: 0 0 auto;} .imgl{width: 40rpx;height: 40rpx;display: flex;align-items: center;justify-content: center;margin-right: 16rpx; image{width: 26rpx;height: 24rpx;} } .tit{font-size: 26rpx;color: #343434;font-weight: 500;margin-top: 4rpx;} .delimg{width: 40rpx;height:40rpx;margin-left: 16rpx;display: flex;align-items: center;justify-content: center; image{width: 26rpx;height: 26rpx;} } } .peoBox{font-size: 30rpx;color: #AAAAAA;min-height: 200rpx;display: flex;flex-wrap: wrap; view{color: #222327;} } // 按钮 .addbtn{display: flex;align-items: center;justify-content: space-between;padding-top: 26rpx; .btn{width: 336rpx;height: 80rpx;font-weight: bold;font-size: 30rpx;box-sizing: border-box;border-radius: 40rpx;display: flex;align-items: center;justify-content: center; flex:1; &.btn1{border: 2rpx solid #1D64E2;background: #ffffff;color: #1D64E2;} &.btn2{background: #1D64E2;color: #ffffff;} } } .lbtabp{display: flex;align-items: center;flex: 0 0 auto;margin-left: 24rpx;height: 100%;justify-content: flex-end; view{font-size: 30rpx;color: #222327;} } .addbox /deep/ .pbbox .ql-editor p{text-indent: 2rem;} </style>