updateServe.vue 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125
  1. <template>
  2. <div class="updateServer_container">
  3. <div class="card_cont">
  4. <div class="btn_top">
  5. <span style="fontSize:14px;color:#409EFF;cursor:pointer" @click="previewHistory">历史签约</span>
  6. </div>
  7. <div class="info">
  8. <h3 class="tit">客户信息</h3>
  9. <ul class="info_list">
  10. <li>
  11. 客户名称:{{companyInfo.CompanyName}}
  12. </li>
  13. <li>
  14. 社会信用码:{{companyInfo.CreditCode}}
  15. </li>
  16. <li>
  17. 地址:{{companyInfo.Address||''}}
  18. </li>
  19. <li>
  20. 客户类型:{{companyInfo.CompanyType}}
  21. </li>
  22. <li>
  23. 客户状态:{{companyInfo.Status}}
  24. </li>
  25. <li>
  26. 客户来源:{{companyInfo.Source}}
  27. </li>
  28. <li>
  29. 行业:{{companyInfo.IndustryName}}
  30. </li>
  31. <li>
  32. 所属销售:{{companyInfo.SellerName}}
  33. </li>
  34. <li>
  35. 备注:{{companyInfo.Reasons}}
  36. </li>
  37. </ul>
  38. </div>
  39. </div>
  40. <div class="card_cont">
  41. <div class="apply_info">
  42. <h3 style="fontSize:16px;">{{$route.path=='/updateCustom'?'续约申请':'补充协议'}}</h3>
  43. <div class="info_cont">
  44. <el-form
  45. @submit.native.prevent
  46. inline
  47. :model="dataForm"
  48. :rules="formRule"
  49. hide-required-asterisk
  50. ref="dataForm"
  51. label-width="100px"
  52. class="demo-ruleForm">
  53. <el-form-item label="选择合同类型" prop="contract_type" style="width:70%;padding-left:25px;" v-if="!isRaiSellerShow">
  54. <!-- <i style="color:#f00;fontSize:20px;position:absolute;left:-114px;top:10%;">*</i> -->
  55. <el-radio label="续约合同" v-model="dataForm.contract_type" v-if="$route.path=='/updateCustom'">续约合同</el-radio>
  56. <el-radio label="补充协议" v-model="dataForm.contract_type" v-else>补充协议</el-radio>
  57. </el-form-item>
  58. <el-form-item label-width="140px" label="请输入合同编号" style="width:100%" prop="CreditCode" v-if="isRaiSellerShow"
  59. :rules="{required: true, message: '请输入合同编号', trigger: 'blur'}">
  60. <i style="color:#f00;fontSize:20px;position:absolute;left:-128px;top:10%;">*</i>
  61. <el-autocomplete
  62. style="width:360px;"
  63. v-model="dataForm.CreditCode"
  64. :fetch-suggestions="querySearchCreditCode"
  65. placeholder="请复制申请用印时生成的合同编号"
  66. @select="handleSelectCreditCode"
  67. ></el-autocomplete>
  68. </el-form-item>
  69. <el-form-item label="合同期限" prop="term" style="marginRight:60px;">
  70. <i style="color:#f00;fontSize:20px;position:absolute;left:-90px;top:10%;">*</i>
  71. <el-date-picker
  72. :disabled="timeDisable || isRaiSellerShow"
  73. v-model="dataForm.term"
  74. type="daterange"
  75. range-separator="至"
  76. start-placeholder="开始日期"
  77. end-placeholder="结束日期"
  78. @change="dateChange"
  79. value-format="yyyy-MM-dd"
  80. :picker-options="pickerOptions"
  81. style="width:400px;">
  82. </el-date-picker>
  83. </el-form-item>
  84. <el-form-item label="合同金额" prop="amount" style="marginRight:60px;">
  85. <i style="color:#f00;fontSize:20px;position:absolute;left:-90px;top:10%;">*</i>
  86. <el-input
  87. v-model.number="dataForm.amount"
  88. :disabled="isRaiSellerShow"
  89. placeholder="请输入金额"
  90. style="width:400px"
  91. clearable></el-input>
  92. <span style="color:#666;">元</span>
  93. </el-form-item>
  94. <el-form-item label="付款方式" prop="payway" style="marginRight:60px;">
  95. <i style="color:#f00;fontSize:20px;position:absolute;left:-90px;top:10%;">*</i>
  96. <el-select v-model="dataForm.payway" placeholder="请选择付款方式" style="width:400px;" clearable>
  97. <el-option
  98. v-for="item in ['月付','季付','半年付','年付','两年付','三年付']"
  99. :key="item"
  100. :label="item"
  101. :value="item">
  102. </el-option>
  103. </el-select>
  104. </el-form-item>
  105. <el-form-item label="付款渠道" prop="payfrom">
  106. <i style="color:#f00;fontSize:20px;position:absolute;left:-90px;top:10%;">*</i>
  107. <el-input
  108. v-model="dataForm.payfrom"
  109. placeholder="填写代支付的渠道名称,没有可以填无"
  110. style="width:400px"
  111. clearable></el-input>
  112. </el-form-item>
  113. <el-form-item label="套餐类型" prop="setmeal" style="display:block;" :rules="{ required: true, message: '请选择套餐',trigger: 'change' }" v-if="companyInfo.CompanyType=='ficc' || isRoleType== 'ficc'">
  114. <i style="color:#f00;fontSize:20px;position:absolute;left:-90px;top:10%;">*</i>
  115. <el-radio-group v-model="dataForm.setmeal" @change="setmealChange">
  116. <el-radio :label="1">大套餐</el-radio>
  117. <el-radio :label="2">小套餐</el-radio>
  118. </el-radio-group>
  119. </el-form-item>
  120. <el-form-item class="textarea_item" style="width:97%;paddingLeft:26px;" prop="CheckList">
  121. <label style="display:block;marginBottom:10px;fontSize:16px;position:relative;color:#666;">
  122. <i style="color:#f00;fontSize:20px;position:absolute;left:-15px;top:10%;">*</i>
  123. 权限设置
  124. </label>
  125. <template v-if="companyInfo.CompanyType=='权益' || isRoleType== '权益'">
  126. <raiPermissionbox ref="raiPermissionboxRef" v-for="item in authList" :key="item.ClassifyName" :allData="item.Items" :formData.sync="dataForm" :raiCheckList.sync="raiCheckList"></raiPermissionbox>
  127. </template>
  128. <ul v-else class="menu_lists" style="width:100%">
  129. <li v-for="item in authList" :key="item.ClassifyName" class="menu_item">
  130. <el-checkbox :indeterminate="item.isIndeterminate" v-model="item.checkAll" :disabled="setSelectPerDisabled(item)" @change="handleCheckAll(item,'auth')" style="marginRight:30px;fontWeight:bold;minWidth:90px;">{{item.ClassifyName+':'}}</el-checkbox>
  131. <el-checkbox-group v-model="item.CheckList" @change="handleChecked(item)">
  132. <el-checkbox v-for="list in item.Items" :label="list.ChartPermissionId" :key="list.ChartPermissionId" class="list_item" :disabled="list.disabled||($route.path=='/updateCustom'&&list.IsPublic==1)">{{list.PermissionName}}</el-checkbox>
  133. </el-checkbox-group>
  134. </li>
  135. </ul>
  136. </el-form-item>
  137. <el-form-item prop="imglist" style="width:97%;paddingLeft:26px;" class="textarea_item">
  138. <label style="display:block;marginBottom:10px;fontSize:16px;position:relative;color:#666;">
  139. <i style="color:#f00;fontSize:20px;position:absolute;left:-15px;top:10%;">*</i>
  140. 上传合同附件<span style="fontSize:12px;color:#f00;">(建议上传盖章后的合同,支持png、jpg、pdf格式)</span>
  141. <input type="file" name="file" @change="fileSelected()" id="file" class="true-file" style="display:none;">
  142. <el-button type="primary" size="medium" @click.native="clickinput('')" style="marginLeft:20px;">点击上传</el-button>
  143. </label>
  144. <ul class="img_cont">
  145. <li v-for="(img,index) in dataForm.imglist" :key="img" class="img_item">
  146. <!-- <el-image :src="img" alt="" style="background:#aaa;width:240px;height:180px;" :preview-src-list="dataForm.imglist" :id="'img'+index"/> -->
  147. <pdf ref="pdf" :src="img" style="width:240px;height:180px;overflow:hidden" v-if="img.indexOf('.pdf')!=-1" @click.native="preview('img'+index,index,img)"></pdf>
  148. <el-image :src="img" alt="" style="background:#aaa;width:240px;height:180px;" :id="'img'+index" v-else @click.native="preview('img'+index,index,img)"/>
  149. <i class="el-icon-zoom-in" style="position:absolute;right:12px;top:12px;color:#fff;" @click="preview('img'+index,index,img)"></i>
  150. <span style="position:absolute;right:12px;bottom:12px;color:#409EFF;fontSize:16px;cursor:pointer;" @click.stop="clickinput(index+1)">重新上传</span>
  151. </li>
  152. </ul>
  153. </el-form-item>
  154. </el-form>
  155. </div>
  156. </div>
  157. <div class="bot_cont">
  158. <div style="display:flex;justify-content:center;margin:80px 0 30px;">
  159. <el-button type="primary" style="width:80px;marginRight:24px;" @click="saveHandle">提交</el-button>
  160. <el-button type="primary" plain style="width:80px;" @click="cancelHandle">取消</el-button>
  161. </div>
  162. </div>
  163. </div>
  164. <!-- 历史签约弹窗 -->
  165. <el-dialog
  166. :visible.sync="isPreview"
  167. :modal-append-to-body='false'
  168. :show-close="false"
  169. custom-class="update_dialog"
  170. center
  171. top="7vh"
  172. width="60%">
  173. <div slot="title" style="display:flex;alignItems:center;">
  174. <span style="fontSize:16px;color:#333;fontWeight:bold;">历史签约</span>
  175. </div>
  176. <template v-if="dealList.length">
  177. <div v-for="(item,index) in dealList" :key="index" class="history_item">
  178. <el-tag style="margin-bottom:30px;" size="small">合同编号:{{item.ContractCode}}</el-tag>
  179. <ul class="detail_item">
  180. <li>
  181. <span style="min-width:300px;marginRight:260px;display:inline-block;">合同期限:{{item.StartDate+'-'+item.EndDate}}</span>
  182. <span>合同金额:{{item.Money}}元</span>
  183. </li>
  184. <li>
  185. <span style="min-width:300px;marginRight:260px;display:inline-block;">付款方式:{{item.PayMethod}}</span>
  186. <span>付款渠道:{{item.PayChannel}}</span>
  187. </li>
  188. <li class="textarea_item" style="width:97%;">
  189. <label style="display:block;marginBottom:20px;fontSize:16px;position:relative;">
  190. 权限设置
  191. </label>
  192. <ul class="menu_lists">
  193. <li v-for="auth in item.PermissionList" :key="auth.ClassifyName" class="menu_item">
  194. <el-checkbox :indeterminate="auth.CheckList.length>0&&auth.CheckList.length<auth.Items.length" v-model="auth.CheckAll" disabled @change="handleCheckAll(item)" style="marginRight:30px;fontWeight:bold;">{{auth.ClassifyName+':'}}</el-checkbox>
  195. <el-checkbox-group v-model="auth.CheckList" @change="handleChecked(item)" disabled>
  196. <el-checkbox v-for="list in auth.Items" :label="list.ChartPermissionId" :key="list.ChartPermissionId" class="list_item">{{list.PermissionName}}</el-checkbox>
  197. </el-checkbox-group>
  198. </li>
  199. </ul>
  200. </li>
  201. </ul>
  202. </div>
  203. </template>
  204. <span v-else>暂无历史合同</span>
  205. </el-dialog>
  206. <!-- 图片预览 -->
  207. <imgPreview
  208. :isShowToggle="isShowToggle"
  209. :isPreview="isPreviewimg"
  210. :arr="dataForm.imglist"
  211. :actIndex="preAct"
  212. @close="closePreview"
  213. @togglePre="togglePre"></imgPreview>
  214. </div>
  215. </template>
  216. <script>
  217. import { customInterence } from '@/api/api.js'
  218. import imgPreview from '@/components/imgPreview.vue'
  219. // import JurisdictionCheck from '../compontents/jurisdictionCheck.vue';
  220. import raiPermissionbox from './components/raiPermissionbox'
  221. import pdf from 'vue-pdf'
  222. export default {
  223. name:'',
  224. components: {imgPreview , pdf,raiPermissionbox},
  225. data () {
  226. return {
  227. temContractData:{},// 最后一份有效合同详情数据
  228. pickerOptions: {},
  229. companyInfo:JSON.parse(sessionStorage.getItem('companyInfo')) || {},//客户基本信息
  230. isRoleType:localStorage.getItem('RoleType'),
  231. authList2:[],
  232. dealList:[],//合同列表
  233. isPreview:false,//合同弹窗
  234. dataForm:{
  235. contract_type:this.$route.path=='/updateCustom'?'续约合同':'补充协议',
  236. term:'',
  237. amount:'',
  238. payway:'',
  239. payfrom:'',
  240. imglist:[],
  241. setmeal:'',
  242. qyBigServeCheck:0,
  243. CreditCode:'',
  244. },
  245. formRule:{
  246. // contract_type:[
  247. // { required: true, message: '合同类型不能为空', trigger: 'blur' },
  248. // ],
  249. term:[
  250. { required: true, message: '合同期限不能为空', trigger: 'blur' },
  251. ],
  252. amount:[
  253. { required: true, message: '合同金额不能为空', trigger: 'blur' },
  254. { type: 'number', message: '合同金额必须为数字'}
  255. ],
  256. payway:[
  257. { required: true, message: '付款方式不能为空', trigger: 'change' },
  258. ],
  259. payfrom:[
  260. { required: true, message: '付款渠道不能为空', trigger: 'blur' },
  261. ],
  262. imglist:[
  263. { required: true, message: '合同附件不能为空', trigger: 'change' },
  264. ]
  265. },
  266. authList:[],//权限列表
  267. img_replace:'',//重新上传的img
  268. isPreviewimg:false,
  269. preAct:"",
  270. isShowToggle:false,//是否显示切换
  271. timeDisable:false,//是否能选择日期 补充协议不可选择日期
  272. equityCheckData:[], //权益复选框
  273. citiesEquity:[], //
  274. citiesListEquity:[], //
  275. citiesListpitchOn:[],
  276. raiCheckList:[], //权益复选框
  277. };
  278. },
  279. // 补充协议 最大截至日期 为权限中最大的
  280. // 续约 ficc 起始时间 为权限中最大的
  281. // 权益
  282. methods: {
  283. /* 获取客户大于今天的最后一份有效合同详情 */
  284. async getLastedContractInfo(){
  285. let res=await customInterence.lastContractInfo({CompanyId:this.companyInfo.CompanyId})
  286. if(res.Ret!=200) return
  287. this.temContractData=res.Data
  288. // 续约申请
  289. if(this.$route.path=='/updateCustom'){
  290. this.initUpdateTypeData()
  291. }
  292. // 补充协议
  293. if(this.$route.path=='/addAgreement'){
  294. let today=this.formatDate(new Date())
  295. // 找出权限中最晚截止的那个作为截至日期
  296. let timearr=this.temContractData.map(item=> item.EndDate)
  297. let maxTime=Math.max.apply(null, timearr.map(item => (new Date(item)).getTime()));
  298. let endDate=this.formatDate(new Date(maxTime))
  299. this.dataForm.term=[today,endDate]
  300. this.timeDisable=true
  301. }
  302. },
  303. // 格式化时间
  304. formatDate(date){
  305. let year=date.getFullYear()
  306. let month=date.getMonth()+1
  307. let day=date.getDate()
  308. return `${year}-${month<10?'0'+month:month}-${day<10?'0'+day:day}`
  309. },
  310. // 续约申请处理数据
  311. initUpdateTypeData(){
  312. let RoleType=this.companyInfo.CompanyType
  313. if(RoleType=='ficc'){
  314. // FICC:续约合同的起始日期需要在权限中最大的时间
  315. // 找出权限中最晚截止的那个作为截至日期
  316. let timearr=this.temContractData.map(item=> item.EndDate)
  317. let maxTime=Math.max.apply(null, timearr.map(item => (new Date(item)).getTime()));
  318. let endDate=this.formatDate(new Date(maxTime))
  319. this.pickerOptions={
  320. disabledDate(time) {
  321. return time.getTime() < new Date(endDate).getTime();
  322. }
  323. }
  324. }
  325. },
  326. //选择时间 权益:续约合同期限与上一份合同期限有重叠时,不能勾选同一行业.
  327. // 选择的时间和temContractData 中的时间比较 然后格式化权限选择列表
  328. dateChange(){
  329. if(parseInt((new Date() - new Date(this.dataForm.term[1]))/(1000*3600*24)) > 0) {
  330. this.$message.error('结束日期不能小于今天!')
  331. this.dataForm.term = []
  332. return
  333. }
  334. // if(this.companyInfo.CompanyType!='权益') return
  335. // if(!this.dataForm.term) return
  336. // let time1=new Date(this.dataForm.term[0]).getTime() //选择的开始时间
  337. // let time2=new Date(this.dataForm.term[1]).getTime() //选择的结束时间
  338. // let time3=new Date(this.temContractData.StartDate).getTime()// 上份合同的开始时间
  339. // let time4=new Date(this.temContractData.EndDate).getTime()// 上份合同的结束时间
  340. // if(time1>time4||time2<time3){
  341. // //没有重叠
  342. // console.log('时间无重叠');
  343. // }else{
  344. // //时间有重叠
  345. // console.log('时间有重叠');
  346. // this.$message.warning('合同期限内行业重复')
  347. // let arr=[]
  348. // this.temContractData.PermissionList.forEach(item=>{
  349. // arr=[...arr,...item.CheckList]
  350. // })
  351. // this.authList=this.authList.map(item=>{
  352. // item.CheckList=[]
  353. // item.isIndeterminate=false
  354. // item.Items.forEach(item2=>{
  355. // if(arr.indexOf(item2.ChartPermissionId)!=-1){
  356. // item2.disabled=true
  357. // }
  358. // })
  359. // return item
  360. // })
  361. // }
  362. },
  363. // /* 重新申请获取上次申请的合同信息并回显 */
  364. // getLastContract() {
  365. // customInterence.reapplyDetail({
  366. // CompanyApprovalId:parseInt(this.companyInfo.CompanyApprovalId)
  367. // }).then(res => {
  368. // if(res.Ret === 200) {
  369. // /* 处理日期 */
  370. // let date_arr = [];
  371. // date_arr.push(res.Data.Item.StartDate);
  372. // date_arr.push(res.Data.Item.EndDate);
  373. // this.dataForm = {
  374. // term:date_arr,
  375. // contract_type: res.Data.Item.ContractType,
  376. // amount:res.Data.Item.Money,
  377. // payway:res.Data.Item.PayMethod,
  378. // payfrom:res.Data.Item.PayChannel,
  379. // imglist:res.Data.Item.ImgUrl.split('#'),//合同列表图片
  380. // setmeal:res.Data.Item.PackageType
  381. // }
  382. // if(this.companyInfo.CompanyType == '权益' || this.isRoleType== '权益') {
  383. // let newData =res.Data.Item.PermissionList.length ? res.Data.Item.PermissionList[0] : []
  384. // this.citiesEquity = newData.ItemsType || []
  385. // this.citiesListEquity = newData.Items || []
  386. // this.citiesListpitchOn = newData.CheckList || []
  387. // }else {
  388. // /* 处理权限列表 */
  389. // let newArr = [];
  390. // res.Data.Item.PermissionList.forEach(item => {
  391. // item.Items=item.Items.map(item2=>{
  392. // return{
  393. // ...item2,
  394. // disabled:false
  395. // }
  396. // })
  397. // let obj = {
  398. // checkAll:item.CheckList&&item.CheckList.length===item.Items.length?true:false,
  399. // isIndeterminate:item.CheckList&&item.CheckList.length>0 && item.CheckList.length<item.Items.length,
  400. // ...item,
  401. // }
  402. // newArr.push(obj)
  403. // })
  404. // this.authList = newArr;
  405. // this.dataForm.setmeal == 1 && this.setmealChange()
  406. // }
  407. // }
  408. // })
  409. // },
  410. getLastContract() {
  411. customInterence.reapplyDetail({
  412. CompanyApprovalId:parseInt(this.companyInfo.CompanyApprovalId)
  413. }).then(res => {
  414. if(res.Ret === 200) {
  415. /* 处理日期 */
  416. let date_arr = [];
  417. date_arr.push(res.Data.Item.StartDate);
  418. date_arr.push(res.Data.Item.EndDate);
  419. this.dataForm = {
  420. term:date_arr,
  421. contract_type: res.Data.Item.ContractType,
  422. amount:res.Data.Item.Money,
  423. payway:res.Data.Item.PayMethod,
  424. payfrom:res.Data.Item.PayChannel,
  425. imglist:res.Data.Item.ImgUrl.split('#'),//合同列表图片
  426. qyBigServeCheck:res.Data.Item.RaiPackageType
  427. }
  428. /* 处理权限列表 */
  429. let newArr = [];
  430. if(this.companyInfo.CompanyType == '权益' || this.isRoleType== '权益') {
  431. res.Data.Item.PermissionList.length&&res.Data.Item.PermissionList.forEach(item => {
  432. this.raiCheckList = item.CheckList || []
  433. newArr.push(item)
  434. })
  435. } else {
  436. res.Data.Item.PermissionList.forEach(item => {
  437. item.Items=item.Items.map(item2=>{
  438. return{
  439. ...item2,
  440. disabled:false
  441. }
  442. })
  443. let obj = {
  444. checkAll:item.CheckList&&item.CheckList.length===item.Items.length?true:false,
  445. isIndeterminate:item.CheckList&&item.CheckList.length>0 && item.CheckList.length<item.Items.length,
  446. ...item,
  447. }
  448. newArr.push(obj)
  449. })
  450. }
  451. this.authList = newArr;
  452. }
  453. })
  454. },
  455. /* 获取基本权限信息 */
  456. // getAuthBasic() {
  457. // customInterence.authList().then(res => {
  458. // if(res.Ret === 200) {
  459. // // if(this.companyInfo.CompanyType == '权益'|| this.isRoleType== '权益') {
  460. // // this.citiesEquity = res.Data.ListType ? res.Data.ListType[0].Items : [];
  461. // // this.citiesListEquity = res.Data.List ? res.Data.List[0].Items : [];
  462. // // }else {
  463. // let newArr = [];
  464. // res.Data.List.length&&res.Data.List.forEach(item => {
  465. // item.Items=item.Items.map(item2=>{
  466. // return{
  467. // ...item2,
  468. // disabled:false
  469. // }
  470. // })
  471. // let obj = {
  472. // checkAll:false,
  473. // isIndeterminate:item.ClassifyName === '宏观经济'?true:false,
  474. // ...item,
  475. // }
  476. // newArr.push(obj)
  477. // this.authList = newArr;
  478. // })
  479. // this.authList = newArr;
  480. // // }
  481. // }
  482. // })
  483. // },
  484. /* 获取基本权限信息 */
  485. getAuthBasic() {
  486. customInterence.authList({
  487. IsShowYanXuanKouDian:true,
  488. }).then(res => {
  489. if(res.Ret === 200) {
  490. let newArr = [];
  491. if(this.companyInfo.CompanyType == '权益' || this.isRoleType== '权益') {
  492. res.Data.List.length&&res.Data.List.forEach(item => {
  493. newArr.push(item)
  494. })
  495. }else {
  496. res.Data.List.length&&res.Data.List.forEach(item => {
  497. item.Items=item.Items||[]
  498. const temarr=item.Items?item.Items.filter(_e=>_e.IsPublic==1):[]
  499. item.Items=item.Items.map(item2=>{
  500. return{
  501. ...item2,
  502. disabled:false
  503. }
  504. })
  505. let obj = {
  506. checkAll:item.Items.length>0?temarr.length==item.Items.length:false,
  507. isIndeterminate:item.Items.length>0?temarr.length==item.Items.length?false:item.Items.some(_e=>_e.IsPublic==1):false,
  508. ...item,
  509. }
  510. newArr.push(obj)
  511. })
  512. }
  513. this.authList = newArr;
  514. }
  515. })
  516. },
  517. setSelectPerDisabled(data){
  518. const arr=data.Items?data.Items.filter(_e=>_e.IsPublic==1):[]
  519. return (this.$route.path=='/updateCustom'&&arr.length==data.Items.length) || data.disabled
  520. //($route.path=='/updateCustom'&&item.IsPublic==1) || item.disabled
  521. },
  522. /* 获取历史签约 */
  523. getDealList() {
  524. customInterence.historydeal({
  525. CompanyId:this.companyInfo.CompanyId,
  526. CompanyType:this.companyInfo.CompanyType
  527. }).then(res => {
  528. if(res.Ret === 200) {
  529. let auth = [];
  530. res.Data.List&&res.Data.List.forEach(item=> {
  531. item.StartDate = item.StartDate.replace(/-/g,'.')
  532. item.EndDate = item.EndDate.replace(/-/g,'.')
  533. item.PermissionList.forEach(auth => {
  534. auth.CheckAll = auth.CheckList&&auth.CheckList.length===auth.Items.length?true:false
  535. })
  536. })
  537. this.dealList = res.Data.List || []
  538. }
  539. })
  540. },
  541. /* 查看历史签约 */
  542. previewHistory() {
  543. this.isPreview = true
  544. },
  545. // 权益 续约合同判断
  546. // 1、勾选同行业,判断选择的期限,是否与已存在的合同期限重叠:
  547. // 有重叠则提示:同行业有重叠的合同期限,请核实后再提交
  548. // 没有重叠,则提交成功,两份合同独立执行
  549. // 2、勾选不同行业,直接提交成功,提交成功后,
  550. // 若期限有重叠,新开新的行业,使用期限按照合同期限,列表中的服务期限按照合同期限加总
  551. // 若期限无重叠,两份合同独立执行,列表中的服务期限按照执行时的合同期限
  552. // 2023-02-21 修改只需判断勾选行业的服务期限与本行业是否有重叠,无需判断勾选行业与其余行业是否有期限重叠
  553. handleValidate(e){
  554. let validate=true
  555. const newtemContractData=[]//把所有的都加上升级 id加100000
  556. this.temContractData.forEach(item=>{
  557. newtemContractData.push(item)
  558. newtemContractData.push({...item,ChartPermissionId:100000+item.ChartPermissionId,PermissionName:item.PermissionName+'(升级)'})
  559. })
  560. const time1=new Date(this.dataForm.term[0]).getTime() //选择的开始时间
  561. const time2=new Date(this.dataForm.term[1]).getTime() //选择的结束时间
  562. if(this.companyInfo.CompanyType=='权益' &&this.$route.path=='/updateCustom'){
  563. let count=0
  564. newtemContractData.forEach(item=>{
  565. let flag=e.indexOf(item.ChartPermissionId)
  566. if(flag!=-1){
  567. const time3=new Date(item.StartDate).getTime()// 上份合同的开始时间
  568. const time4=new Date(item.EndDate).getTime()// 上份合同的结束时间
  569. if(time1>time4||time2<time3){
  570. console.log(item.ChartPermissionId,'没重叠');
  571. }else{
  572. count++
  573. }
  574. }
  575. })
  576. if(count>0){
  577. validate=false
  578. }
  579. // 勾选了同行业
  580. // if(count>0){
  581. // let tag=0
  582. // let time1=new Date(this.dataForm.term[0]).getTime() //选择的开始时间
  583. // let time2=new Date(this.dataForm.term[1]).getTime() //选择的结束时间
  584. // this.temContractData.forEach(item=>{
  585. // let time3=new Date(item.StartDate).getTime()// 上份合同的开始时间
  586. // let time4=new Date(item.EndDate).getTime()// 上份合同的结束时间
  587. // if(time1>time4||time2<time3){
  588. // // 没有重叠
  589. // console.log(item.ChartPermissionId,'没重叠');
  590. // }else{
  591. // // 重叠了
  592. // tag++
  593. // }
  594. // })
  595. // if(tag>0) {
  596. // validate=false
  597. // }
  598. // }
  599. }
  600. return validate
  601. },
  602. // /* 提交 */
  603. // saveHandle() {
  604. // if(!this.dataForm.contract_type) {
  605. // this.$message.warning('合同类型不能为空!')
  606. // }else {
  607. // this.$refs.dataForm.validate((valid) => {
  608. // if (valid) {
  609. // /* 处理权限列表 */
  610. // let checkArr = [];
  611. // this.authList.forEach(item => {
  612. // if(item.CheckList.length) {checkArr.push(item.CheckList)}})
  613. // // if(this.companyInfo.CompanyType==='权益' || this.isRoleType== '权益'){
  614. // // this.$refs.childrenCheck.cities.forEach(item=>{
  615. // // item.Items.forEach(key => {
  616. // // if(key.Checked) {
  617. // // checkArr.push(key.ChartPermissionId)
  618. // // }
  619. // // })
  620. // // })
  621. // // this.$refs.childrenCheck.citiesList.forEach(item=>{
  622. // // if(item.Checked) {
  623. // // checkArr.push(item.ChartPermissionId)
  624. // // }
  625. // // })
  626. // // }else {
  627. // // this.authList.forEach(item => {
  628. // // if(item.CheckList.length) {
  629. // // checkArr.push(item.CheckList)
  630. // // }
  631. // // })
  632. // // }
  633. // if(!checkArr.length && this.companyInfo.CompanyType === '权益') {
  634. // this.$message.warning('请选择权限!');
  635. // return
  636. // }
  637. // // 判断
  638. // let flag=this.handleValidate(checkArr.flat(2))
  639. // if(!flag){
  640. // this.$message.warning('同行业有重叠的合同期限,请核实后再提交')
  641. // return false
  642. // }
  643. // let PermissionIds = checkArr.flat(2).join(',');
  644. // // let PermissionIds = (this.companyInfo.CompanyType === '权益'|| this.isRoleType== '权益') ? checkArr.join(',') : [... new Set(checkArr.flat(2))].join(',');
  645. // let params = {
  646. // CompanyId:this.companyInfo.CompanyId,
  647. // CompanyApprovalId:this.companyInfo.CompanyApprovalId?parseInt(this.companyInfo.CompanyApprovalId):0,
  648. // CompanyType:this.companyInfo.CompanyType,
  649. // ContractType: this.dataForm.contract_type,
  650. // StartDate:this.dataForm.term[0],
  651. // EndDate:this.dataForm.term[1],
  652. // ImgUrl:this.dataForm.imglist.join('#'),
  653. // Money:Number(this.dataForm.amount),
  654. // PayChannel:this.dataForm.payfrom,
  655. // PayMethod:this.dataForm.payway,
  656. // PermissionIds:PermissionIds,
  657. // PackageType:this.dataForm.setmeal ? this.dataForm.setmeal : 0
  658. // }
  659. // console.log(params);
  660. // customInterence.Update(params).then(res => {
  661. // if(res.Ret === 200) {
  662. // this.$message.success('更新成功!')
  663. // this.$router.go(-1)
  664. // }
  665. // })
  666. // }
  667. // })
  668. // }
  669. // },
  670. /* 提交 */
  671. saveHandle() {
  672. if(!this.dataForm.contract_type) {
  673. this.$message.warning('合同类型不能为空!')
  674. }else {
  675. this.$refs.dataForm.validate((valid) => {
  676. if (valid) {
  677. /* 处理权限列表 */
  678. let checkArr = [];
  679. let PointsArr = []
  680. let isPoints = true;
  681. this.authList.forEach(item => {
  682. if(item.CheckList.length) {
  683. checkArr.push(item.CheckList)
  684. }
  685. })
  686. if((this.companyInfo.CompanyType === '权益' || this.isRoleType == '权益') && !this.isXClassCustom){
  687. checkArr = this.raiCheckList
  688. this.authList.forEach(item => {
  689. item.Items.forEach(key => {
  690. if (checkArr.includes(key.ChartPermissionId) && key.ShowInput) {
  691. if (!key.Points) return isPoints = false;
  692. PointsArr.push({
  693. ChartPermissionId: key.ChartPermissionId,
  694. Points: key.Points-0,
  695. });
  696. }
  697. })
  698. })
  699. }
  700. // 判断
  701. let flag=this.handleValidate(checkArr.flat(2))
  702. if(!flag){
  703. this.$message.warning('同行业有重叠的合同期限,请核实后再提交')
  704. return false
  705. }
  706. // 判断是否有选着了权限没有输入点数
  707. if(!isPoints) return this.$message.warning('请输入点数!')
  708. if(!checkArr.length && this.companyInfo.CompanyType === '权益') return this.$message.warning('请选择权限!');
  709. let PermissionIds = checkArr.flat(2).join(',');
  710. let params = {
  711. CompanyId:this.companyInfo.CompanyId,
  712. CompanyApprovalId:this.companyInfo.CompanyApprovalId?parseInt(this.companyInfo.CompanyApprovalId):0,
  713. CompanyType:this.companyInfo.CompanyType,
  714. ContractType: this.dataForm.contract_type,
  715. StartDate:this.dataForm.term[0],
  716. EndDate:this.dataForm.term[1],
  717. ImgUrl:this.dataForm.imglist.join('#'),
  718. Money:Number(this.dataForm.amount),
  719. PayChannel:this.dataForm.payfrom,
  720. PayMethod:this.dataForm.payway,
  721. PermissionIds:PermissionIds,
  722. PackageType:Number(this.dataForm.setmeal),
  723. RaiPackageType:this.dataForm.qyBigServeCheck||0,
  724. PointsArr
  725. }
  726. console.log(params);
  727. customInterence.Update(params).then(res => {
  728. if(res.Ret === 200) {
  729. this.$message.success('更新成功!')
  730. //this.$router.go(-1)
  731. this.$router.push({path:`/${this.$route.meta.pathFrom}`})
  732. }
  733. })
  734. }
  735. })
  736. }
  737. },
  738. /* 取消返回 */
  739. cancelHandle() {
  740. //this.$router.go(-1);
  741. this.$router.push({path:`/${this.$route.meta.pathFrom}`})
  742. },
  743. /* 选择全选或取消全选 */
  744. handleCheckAll(item,type) {
  745. if(type=='auth'){
  746. //获取公有的id合集
  747. let publicIds=[]
  748. let ids = item.Items.map(item =>{
  749. if(item.IsPublic==1){
  750. publicIds.push(item.ChartPermissionId)
  751. }
  752. return item.ChartPermissionId
  753. })
  754. item.CheckList = item.checkAll ? ids : publicIds;
  755. item.isIndeterminate = publicIds.length>0&&!item.checkAll?true:false;
  756. return
  757. }
  758. // 取到所有的子菜单id
  759. let ids = item.Items.map(item =>{
  760. return item.ChartPermissionId
  761. })
  762. item.CheckList = item.checkAll ? ids : [];
  763. item.isIndeterminate = false;
  764. },
  765. /* 复选框組选中时 */
  766. handleChecked(item) {
  767. let len = item.CheckList.length;
  768. if(this.companyInfo.CompanyType == '权益' || this.isRoleType== '权益') {
  769. /* 获取大套餐行业并且判断 value里面有没有包含 大套餐的全部id*/
  770. let isCheckAllTrue = item.Items.filter(key=> ![31,29].includes(key.ChartPermissionId)&& !key.PermissionName.includes('升级')).every(val => item.CheckList.includes(val.ChartPermissionId))
  771. item.checkAll = isCheckAllTrue;
  772. item.isIndeterminate = len > 0 && !isCheckAllTrue
  773. }else{
  774. item.checkAll = len === item.Items.length;
  775. item.isIndeterminate = len > 0 && len < item.Items.length;
  776. }
  777. },
  778. /* 预览 */
  779. preview(id,index,img) {
  780. // $('#'+id).click()
  781. if(img.indexOf('.pdf') == -1) {
  782. this.preAct = index;
  783. /* 是否显示左右切换 */
  784. let bol = this.dataForm.imglist.some(item => {
  785. return item.indexOf('.pdf') != -1
  786. })
  787. // 有pdf或图片只有一张
  788. if(bol || this.dataForm.imglist.length<=1) {
  789. this.isShowToggle = false
  790. }else {
  791. this.isShowToggle = true
  792. }
  793. this.isPreviewimg = true;
  794. }else {
  795. window.open(img)
  796. }
  797. },
  798. clickinput(index){ //上传模拟点击
  799. this.img_replace = '';
  800. if(index) {
  801. this.img_replace = index
  802. }
  803. $("#file").click();
  804. },
  805. fileSelected(){ //选择文件上传
  806. if( document.getElementById('file').files[0] ){
  807. let hostfile = document.getElementById('file').files[0];
  808. let size = Math.floor(hostfile.size / 1024 / 1024);
  809. if( size>200 ){
  810. this.$message.error('上传文件大小不能大于200M!');
  811. hostfile = {};
  812. return false
  813. }
  814. if( hostfile.name.toLowerCase().includes('.png') || hostfile.name.toLowerCase().includes('.jpg') || hostfile.name.toLowerCase().includes('.jpeg') || hostfile.name.toLowerCase().includes('.pdf') ){
  815. let form = new FormData();
  816. form.append('file',hostfile); //hostfile.name
  817. this.uploadloading=true;
  818. customInterence.upload(form).then((res) => {
  819. if( res.Ret === 200 ){
  820. /* 是替换还是新增 */
  821. if(this.img_replace) {
  822. this.dataForm.imglist.splice(this.img_replace-1,1,res.Data.ResourceUrl)
  823. }else {
  824. if(this.dataForm.imglist.length >= 4) {
  825. this.$message.warning('最多上传4张')
  826. }else {
  827. this.dataForm.imglist.push(res.Data.ResourceUrl)
  828. }
  829. }
  830. }
  831. this.uploadloading=false;
  832. $("#file").val('');
  833. hostfile = {};
  834. });
  835. }else{
  836. this.$message.error('上传文件格式不正确!');
  837. }
  838. }
  839. },
  840. closePreview() {
  841. this.isPreviewimg = false;
  842. },
  843. togglePre(type) {
  844. if(type==1) {
  845. this.preAct--;
  846. if(this.preAct < 0) {
  847. this.preAct = this.dataForm.imglist.length-1;
  848. }
  849. }else {
  850. this.preAct++;
  851. if(this.preAct > this.dataForm.imglist.length-1) {
  852. this.preAct = 0;
  853. }
  854. }
  855. },
  856. //套餐的选择
  857. setmealChange(){
  858. if(this.dataForm.setmeal == '1'){
  859. this.authList.forEach(item => {
  860. if(!['市场策略','固定收益'].includes(item.ClassifyName)) {
  861. item.Items.forEach(key => {
  862. item.CheckList.push(key.ChartPermissionId)
  863. key.Checked = true
  864. key.disabled = true
  865. })
  866. item.isIndeterminate = false
  867. item.checkAll = true
  868. item.disabled = true
  869. }
  870. })
  871. } else {
  872. console.log(this.authList);
  873. // 根据是否为公共品种来设置选中态
  874. this.authList.forEach(item=>{
  875. const publicIds=[]
  876. item.Items.forEach(_item=>{
  877. if(_item.IsPublic===1){
  878. publicIds.push(_item.ChartPermissionId)
  879. }
  880. _item.Checked = false
  881. _item.disabled = false
  882. })
  883. item.CheckList=publicIds
  884. item.disabled = false
  885. item.isIndeterminate = item.CheckList.length===item.Items.length||item.CheckList.length===0?false:true
  886. item.checkAll = item.CheckList.length===item.Items.length?true:false
  887. })
  888. // this.authList.forEach(item => {
  889. // if(item.ClassifyName == '宏观经济') {
  890. // item.CheckList = [1]
  891. // item.isIndeterminate = true
  892. // item.disabled=false
  893. // item.Items[1].disabled=false
  894. // item.Items[0].disabled=false
  895. // }else {
  896. // item.Items.forEach(key => {
  897. // item.CheckList = []
  898. // key.Checked = false
  899. // key.disabled = false
  900. // })
  901. // item.isIndeterminate = false
  902. // item.checkAll = false
  903. // item.disabled = false
  904. // }
  905. // })
  906. this.$message.warning('请勾选品种')
  907. }
  908. },
  909. // 获取合同编号
  910. async querySearchCreditCode(queryString, cb) {
  911. cb([])
  912. if(queryString) {
  913. const res = await customInterence.searchSealcodeSeal({
  914. KeyWord:queryString
  915. })
  916. if(res.Ret === 200) {
  917. if(res.Data.List.length) {
  918. const data = res.Data.List.map(item => {
  919. return {
  920. value: item.Code,
  921. ...item
  922. }
  923. })
  924. cb(data)
  925. }
  926. }
  927. }
  928. },
  929. // 选择合同编号
  930. handleSelectCreditCode(item) {
  931. this.dataForm.term = [item.StartDate,item.EndDate]
  932. this.dataForm.amount = item.Money
  933. }
  934. },
  935. created() {},
  936. mounted() {
  937. this.getDealList();
  938. this.getLastedContractInfo()
  939. if(this.$route.query.isReapply) {
  940. this.getLastContract();
  941. }else {
  942. this.getAuthBasic();
  943. }
  944. },
  945. computed: {
  946. isRaiSellerShow() {
  947. return localStorage.getItem('Role') === 'rai_seller';
  948. },
  949. }
  950. }
  951. </script>
  952. <style lang='scss'>
  953. .updateServer_container {
  954. min-width: 1570px;
  955. *{
  956. box-sizing: border-box;
  957. }
  958. /* reset */
  959. .el-collapse {
  960. border: none;
  961. }
  962. .el-collapse-item__header {
  963. display: block;
  964. border: none;
  965. font-size: 16px;
  966. color: #333;
  967. font-weight: bold;
  968. position: relative;
  969. }
  970. .el-collapse-item__content {
  971. padding-left: 30px;
  972. }
  973. .el-collapse-item__wrap {
  974. border: none;
  975. margin-top: 20px;
  976. }
  977. .el-form-item {
  978. margin-bottom: 30px;
  979. }
  980. .el-form-item .el-checkbox-group {
  981. height: 40px;
  982. }
  983. .textarea_item .el-form-item__content {
  984. width: 100%;
  985. }
  986. /* */
  987. .card_cont {
  988. margin-bottom: 20px;
  989. border: 1px solid #ECECEC;
  990. padding: 30px;
  991. background: #fff;
  992. border-radius: 4px;
  993. box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
  994. .btn_top {
  995. display: flex;
  996. justify-content: flex-end;
  997. }
  998. .info {
  999. margin-top: 10px;
  1000. font-size: 16px;
  1001. color: #666;
  1002. .tit {
  1003. color: #333;
  1004. font-size: 16px;
  1005. margin-bottom: 30px;
  1006. }
  1007. .info_list {
  1008. display: flex;
  1009. flex-wrap: wrap;
  1010. padding-left: 50px;
  1011. padding-bottom: 20px;
  1012. li {
  1013. margin-right: 113px;
  1014. margin-bottom: 20px;
  1015. min-width: 250px;
  1016. }
  1017. }
  1018. }
  1019. .info_cont {
  1020. padding-left: 30px;
  1021. margin-top: 30px;
  1022. }
  1023. .img_cont {
  1024. width: 100%;
  1025. display: flex;
  1026. flex-wrap: wrap;
  1027. .img_item {
  1028. position: relative;
  1029. margin-right: 23px;
  1030. &:last-child {
  1031. margin-right: 0;
  1032. }
  1033. }
  1034. }
  1035. }
  1036. .menu_lists {
  1037. padding: 40px 18px;
  1038. border: 1px dashed #AAB4CC;
  1039. border-radius: 4px;
  1040. .menu_item {
  1041. display: flex;
  1042. // align-items: center;
  1043. margin-bottom: 40px;
  1044. &:last-child {
  1045. margin-bottom: 0;
  1046. }
  1047. .list_item {
  1048. margin-right: 30px;
  1049. &:last-child {
  1050. margin-right: 0;
  1051. }
  1052. }
  1053. }
  1054. }
  1055. .update_dialog {
  1056. max-height: 810px;
  1057. min-height: 200px;
  1058. // overflow: hidden;
  1059. overflow-y: auto;
  1060. .el-dialog__header {
  1061. background: #fff;
  1062. }
  1063. .el-dialog__body {
  1064. padding: 30px 50px !important;
  1065. }
  1066. .history_item {
  1067. margin-bottom: 60px;
  1068. .detail_item {
  1069. font-size: 16px;
  1070. color: #666;
  1071. li {
  1072. margin-bottom: 30px;
  1073. &:last-child {
  1074. margin-bottom: 0;
  1075. }
  1076. }
  1077. }
  1078. }
  1079. .menu_lists {
  1080. padding: 20px 18px;
  1081. border: 1px dashed #AAB4CC;
  1082. border-radius: 4px;
  1083. .menu_item {
  1084. display: flex;
  1085. // align-items: center;
  1086. margin-bottom: 20px;
  1087. &:last-child {
  1088. margin-bottom: 0;
  1089. }
  1090. .list_item {
  1091. margin-right: 30px;
  1092. margin-bottom: 5px;
  1093. &:last-child {
  1094. margin-right: 0;
  1095. }
  1096. }
  1097. }
  1098. }
  1099. }
  1100. }
  1101. </style>