edit.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. <template>
  2. <view class="add-page white-wrap">
  3. <view class="section white-wrap">
  4. <view class="section-title require">归属公司</view>
  5. <view class="section-select-box" :style="{color:belongCompany?'#333':'#999'}" @click="showBelongCompanyPop=true">{{belongCompany?belongCompany:'请选择'}}</view>
  6. </view>
  7. <view class="section white-wrap">
  8. <view class="section-title require">用印用途</view>
  9. <view class="section-select-box" :style="{color:purpose?'#333':'#999'}" @click="showPurpose=true">{{purpose?purpose:'请选择'}}</view>
  10. </view>
  11. <!-- 系统合同模块 -->
  12. <view v-if="radioVal==='系统合同'">
  13. <view class="section white-wrap">
  14. <view class="section-title require">客户名称(全称)</view>
  15. <view
  16. class="section-select-box"
  17. :style="{color:customeName?'#333':'#999'}"
  18. @click="showCustome=true"
  19. >
  20. {{customeName?customeName:'请输入客户名称'}}
  21. </view>
  22. </view>
  23. <view class="section white-wrap" v-if="CreditCode">
  24. <view class="section-title require">统一社会信用码</view>
  25. <input type="text" v-model="CreditCode" placeholder="请填写统一社会信用码" disabled/>
  26. </view>
  27. <view class="section white-wrap" v-if="UseCompanyName">
  28. <view :class="['section-title',purpose=='代付合同'?'require':'']">实际使用方名称</view>
  29. <input type="text" v-model="UseCompanyName" placeholder="请填写实际使用方名称" disabled/>
  30. </view>
  31. <view class="section white-wrap" v-if="ServiceType">
  32. <view class="section-title require">业务类型</view>
  33. <view :style="{color:ServiceType?'#333':'#999'}">{{ServiceType?ServiceType:'请选择业务类型'}}</view>
  34. </view>
  35. </view>
  36. <!-- 上传附件模块 -->
  37. <view v-if="radioVal==='上传附件'">
  38. <view class="section white-wrap" style="position:relative">
  39. <view class="section-title require">客户名称(全称)</view>
  40. <input type="text" v-model="customeName" @input="handleAllCutomeInput" placeholder="请输入客户名称"/>
  41. <view class="show-all-custome-box" v-if="allCustome.list.length>0">
  42. <scroll-view scroll-y @scrolltolower="handleScrollToLower" style="height: 100%;width:100%">
  43. <view
  44. class="all-custome-item"
  45. v-for="item in allCustome.list"
  46. :key="item.CompanyId"
  47. @click="chooseAllCustomeItem(item)"
  48. >{{item.CompanyName}}</view>
  49. </scroll-view>
  50. </view>
  51. </view>
  52. <view class="section white-wrap">
  53. <view class="section-title require">统一社会信用码</view>
  54. <input type="text" v-model="CreditCode" placeholder="请填写统一社会信用码"/>
  55. </view>
  56. <view class="section white-wrap">
  57. <view :class="['section-title',purpose=='代付合同'?'require':'']">实际使用方名称</view>
  58. <input type="text" v-model="UseCompanyName" placeholder="请填写实际使用方名称"/>
  59. </view>
  60. <view class="section white-wrap">
  61. <view class="section-title require">业务类型</view>
  62. <view class="section-select-box" :style="{color:ServiceType?'#333':'#999'}" @click="showServiceType=true">{{ServiceType?ServiceType:'请选择业务类型'}}</view>
  63. </view>
  64. </view>
  65. <view class="section white-wrap">
  66. <view class="section-title require">文件份数</view>
  67. <input type="number" v-model="fileNum" placeholder="请填写总共盖章文件份数"/>
  68. </view>
  69. <view class="section white-wrap">
  70. <view class="section-title require">加盖何种印章</view>
  71. <view class="section-select-box" :style="{color:typeLength?'#333':'#999'}" @click="showType=true">{{type.length>0?type.join(','):'请选择'}}</view>
  72. </view>
  73. <view class="section white-wrap">
  74. <view class="section-title">备注</view>
  75. <textarea type="text" auto-height v-model="remark" placeholder="请填写备注"></textarea>
  76. </view>
  77. <view class="section white-wrap" v-if="radioVal==='系统合同'&& fileList &&fileList.length>0">
  78. <view class="section-title require">合同附件</view>
  79. <image src="../static/pdf.png" mode="aspectFill" style="width: 102rpx;height: 120rpx;" @click="handlePreviewFiles(fileList[0])"></image>
  80. </view>
  81. <view class="section white-wrap" v-if="radioVal==='上传附件'">
  82. <view class="section-title require">附件上传</view>
  83. <!-- crm_8.7 支持上传多个附件 -->
  84. <div class="check-file-contain">
  85. <image @click="handleUpload" src="../static/upload-icon.png" mode="aspectFill"
  86. style="width: 102rpx;height: 120rpx;margin: 0 16rpx 24rpx 16rpx;"></image>
  87. <div class="check-file-box" :style="'background-image:url('+item.img+')'"
  88. @click="handlePreviewFiles(item)" v-for="(item,index) in fileList" :key="item.url">
  89. <image class="del-icon" src="../static/del-icon.png" @click.stop="handleDeleteCheckFile(item)"></image>
  90. </div>
  91. </div>
  92. </view>
  93. <!-- 流程模块 -->
  94. <view class="section white-wrap process-wrap" v-if="processData">
  95. <view class="title" style="font-size: 16px;font-weight: bold;">审批流程</view>
  96. <steps :data="processData"></steps>
  97. </view>
  98. <view class="fix-bottom-wrap" style="text-align: center;">
  99. <van-button type="info" custom-class="btn" round @click="handleSubmit">提交</van-button>
  100. </view>
  101. <!-- 归属公司 -->
  102. <van-popup :show="showBelongCompanyPop" @close="showBelongCompanyPop=false" position="bottom">
  103. <van-picker
  104. show-toolbar
  105. title="选择归属公司"
  106. :columns="belongCompanyOptions"
  107. @confirm="handleComfirmBelongCmpany"
  108. @cancel="showBelongCompanyPop=false"
  109. />
  110. </van-popup>
  111. <!-- 用印用途 -->
  112. <van-popup :show="showPurpose" @close="showPurpose=false" position="bottom">
  113. <van-picker
  114. show-toolbar
  115. title="选择用印用途"
  116. :columns="purposeArr"
  117. @confirm="handlePurposeConfirm"
  118. @cancel="showPurpose=false"
  119. />
  120. </van-popup>
  121. <!-- 何种印章 -->
  122. <van-popup :show="showType" @close="showType=false" position="bottom">
  123. <view class="type-popup-wrap">
  124. <view class="flex top-title">
  125. <text style="color:#969799" @click="showType=false">取消</text>
  126. <text style="font-size:16px">选择何种印章</text>
  127. <text style="color:#576b95" @click="handleTypeConfirm">确认</text>
  128. </view>
  129. <van-checkbox-group v-model="temType" @change="onChangeType">
  130. <van-checkbox shape="square" :name="item" v-for="item in typeArr" :key="item">{{item}}</van-checkbox>
  131. </van-checkbox-group>
  132. </view>
  133. </van-popup>
  134. <!-- 业务类型 -->
  135. <van-popup :show="showServiceType" @close="showServiceType=false" position="bottom">
  136. <van-picker
  137. show-toolbar
  138. title="选择业务类型"
  139. :columns="ServiceTypeArr"
  140. @confirm="handleServiceTypeConfirm"
  141. @cancel="showServiceType=false"
  142. />
  143. </van-popup>
  144. <!-- 客户搜索 -->
  145. <van-popup :show="showCustome" @close="showCustome=false" position="bottom" custom-style="height: 100vh">
  146. <view class="custome-search-wrap">
  147. <van-search use-left-icon-slot use-action-slot shape="round" :value="searchCustomeVal" placeholder="请输入客户名称/社会信用码" @change="onSearchValChange" @search="onSearch"
  148. custom-class="search-box" field-class="search-con">
  149. <view slot="left-icon">
  150. <image src="../static/search-icon.png" mode="aspectFill" class="search-icon"></image>
  151. </view>
  152. <view slot="action" @click="showCustome=false" class="search-btn">取消</view>
  153. </van-search>
  154. <view class="search-result">
  155. <view class="result-custome-box" v-if="searchContractList.length===0">
  156. <van-empty description="暂无数据" :image="require('@/static/empty.png')" v-if="!searchCustomeStatus"/>
  157. <view v-else>
  158. <view class="result-item flex" v-for="item in searchCustomeList" :key="item" @click="getContract(item)">
  159. <image src="../static/search-icon.png" mode="aspectFill" class="search-icon"></image>
  160. <view class="con van-ellipsis">{{item}}</view>
  161. <image src="../static/click-icon.png" mode="aspectFill" class="click-icon"></image>
  162. </view>
  163. </view>
  164. </view>
  165. <view class="result-contract-box" v-else>
  166. <view class="result-contract-item" v-for="item in searchContractList" :key="item.ContractId" @click="handleChooseContract(item)">
  167. <view class="name">{{item.CompanyName}}</view>
  168. <view style="margin-top: 20rpx;">合同编号:{{item.ContractCode}}</view>
  169. <view style="margin-top: 20rpx;">合同类型:{{item.ContractType}}</view>
  170. <view style="margin-top: 20rpx;">合同金额:{{item.Price}}</view>
  171. </view>
  172. </view>
  173. </view>
  174. </view>
  175. </van-popup>
  176. </view>
  177. </template>
  178. <script>
  179. import steps from "../components/steps.vue";
  180. import {sealMixin} from './mixin'
  181. import { apiSealDetail,apiSealEdit } from "@/api/approve/seal.js";
  182. export default{
  183. components: {
  184. steps,
  185. },
  186. mixins: [sealMixin],
  187. data() {
  188. return {
  189. SealId:0,
  190. }
  191. },
  192. onLoad(options) {
  193. let ContractApprovalId=options.ContractApprovalId
  194. let ContractApprovalRecordId=options.ContractApprovalRecordId
  195. let SealId=options.SealId
  196. this.getDetail({ContractApprovalId,ContractApprovalRecordId,SealId})
  197. this.getBelongCompanyOptions()
  198. },
  199. methods: {
  200. // 获取详情
  201. async getDetail({ContractApprovalId,ContractApprovalRecordId,SealId}){
  202. const res=await apiSealDetail({
  203. ContractApprovalId:Number(ContractApprovalId),
  204. ContractApprovalRecordId:Number(ContractApprovalRecordId),
  205. SealId:Number(SealId),
  206. })
  207. if(res.code===200){
  208. if(res.data.SealDetail.ContractId>0){
  209. this.radioVal='系统合同'
  210. }else{
  211. this.radioVal='上传附件'
  212. }
  213. this.SealId=res.data.SealDetail.SealId
  214. this.purpose=res.data.SealDetail.Use
  215. this.type=res.data.SealDetail.SealType.split(',')
  216. this.temType=res.data.SealDetail.SealType.split(',')
  217. this.ServiceType=res.data.SealDetail.ServiceType
  218. this.customeName=res.data.SealDetail.CompanyName
  219. this.fileNum=res.data.SealDetail.FileNum
  220. this.remark=res.data.SealDetail.Remark
  221. this.CreditCode=res.data.SealDetail.CreditCode
  222. this.UseCompanyName=res.data.SealDetail.UseCompanyName
  223. this.belongCompany=res.data.SealDetail.AffiliatedCompany
  224. // this.ContractfileUrl=res.data.SealDetail.FileUrl
  225. this.handleFile(res.data.SealDetail.FileUrls)
  226. this.ContractId=res.data.SealDetail.ContractId
  227. this.getProcessData()
  228. }
  229. },
  230. //处理文件
  231. handleFile(filesUrls){
  232. const reg = /\.(pdf)$/;
  233. const reg2= /\.doc|\.docx$/
  234. filesUrls.map(filesUrl=>{
  235. if(reg.test(filesUrl)){
  236. this.fileList.push({
  237. type: "pdf",
  238. url: filesUrl,
  239. img: require("../static/pdf.png"),
  240. })
  241. }else if(reg2.test(filesUrl)){
  242. this.fileList.push({
  243. type: "word",
  244. url: filesUrl,
  245. img: require("../static/word.png"),
  246. })
  247. }else{
  248. this.fileList.push({
  249. type: "img",
  250. url: filesUrl,
  251. img: filesUrl,
  252. })
  253. }
  254. })
  255. },
  256. // 选择合同 更新表单数据
  257. handleChooseContract(e){
  258. this.customeName=e.CompanyName
  259. this.CreditCode=e.CreditCode
  260. this.ServiceType=e.ContractType
  261. this.UseCompanyName=e.ContractBusinessType=='代付合同'?e.UseCompanyName:e.CompanyName
  262. this.ContractId=e.ContractId
  263. this.belongCompany=e.AffiliatedCompany
  264. // this.ContractfileUrl=e.FileUrl
  265. this.handleFile([e.FileUrl])
  266. // 关闭搜索弹窗
  267. this.showCustome=false
  268. this.searchCustomeVal=''
  269. this.searchContractList=[]
  270. this.searchCustomeList=[]
  271. },
  272. // 提交申请
  273. async handleSubmit(){
  274. let params={
  275. CompanyName:this.customeName,
  276. ContractId:this.ContractId,
  277. CreditCode:this.CreditCode,
  278. FileUrls:this.fileList.map(file => file.url),
  279. FileNum:Number(this.fileNum),
  280. Remark:this.remark,
  281. SealType:this.type.join(','),
  282. ServiceType:this.ServiceType,
  283. Use:this.purpose,
  284. UseCompanyName:this.UseCompanyName,
  285. SealId:Number(this.SealId),
  286. AffiliatedCompany: this.belongCompany
  287. }
  288. if(!params.AffiliatedCompany){
  289. uni.showToast({
  290. title:'请选择归属公司',
  291. icon:"none"
  292. })
  293. return
  294. }
  295. if(!params.Use){
  296. uni.showToast({
  297. title:'请选择用印用途',
  298. icon:"none"
  299. })
  300. return
  301. }
  302. if(!params.CompanyName){
  303. uni.showToast({
  304. title:'客户名称不能为空',
  305. icon:"none"
  306. })
  307. return
  308. }
  309. if(!params.CreditCode){
  310. uni.showToast({
  311. title:'信用代码不能为空',
  312. icon:"none"
  313. })
  314. return
  315. }
  316. if(!params.ServiceType){
  317. uni.showToast({
  318. title:'业务类型不能为空',
  319. icon:"none"
  320. })
  321. return
  322. }
  323. if(!params.FileNum){
  324. uni.showToast({
  325. title:'请填写文件份数',
  326. icon:"none"
  327. })
  328. return
  329. }
  330. if(params.FileNum<1){
  331. uni.showToast({
  332. title:'文件份数不合法',
  333. icon:"none"
  334. })
  335. return
  336. }
  337. if(!params.SealType){
  338. uni.showToast({
  339. title:'印章类型不能为空',
  340. icon:"none"
  341. })
  342. return
  343. }
  344. if(!params.FileUrls){
  345. uni.showToast({
  346. title:'请上传文件',
  347. icon:"none"
  348. })
  349. return
  350. }
  351. // 代付合同 实际使用方必填
  352. if(params.Use=='代付合同'){
  353. if(!params.UseCompanyName&&this.radioVal==='上传附件'){
  354. uni.showToast({
  355. title:'请填写实际使用方',
  356. icon:"none"
  357. })
  358. return
  359. }
  360. }
  361. const res=await apiSealEdit(params)
  362. if(res.code===200){
  363. uni.showToast({
  364. title:"用印申请单已提交",
  365. icon:"none"
  366. })
  367. uni.$emit('sealEditSubmit')
  368. setTimeout(()=>{
  369. uni.navigateBack({
  370. delta:2
  371. })
  372. },1000)
  373. }
  374. }
  375. },
  376. }
  377. </script>
  378. <style lang="scss">
  379. .check-file-contain{
  380. display: flex;
  381. flex-wrap: wrap;
  382. .check-file-box{
  383. width: 102rpx;
  384. height: 120rpx;
  385. background-size: cover;
  386. background-position: center;
  387. position: relative;
  388. margin: 0 16rpx;
  389. .del-icon{
  390. position: absolute;
  391. width: 30rpx;
  392. height: 30rpx;
  393. top: -15rpx;
  394. right: -15rpx;
  395. }
  396. }
  397. }
  398. .add-page{
  399. width: 100%;
  400. min-height: 100vh;
  401. padding-bottom: calc(150rpx + constant(safe-area-inset-bottom));
  402. padding-bottom: calc(150rpx + env(safe-area-inset-bottom));
  403. }
  404. .section{
  405. padding: 30rpx 34rpx;
  406. border-top: 10rpx solid #F5F5F5;
  407. position: relative;
  408. textarea{
  409. width: 100%;
  410. height: 200rpx;
  411. }
  412. .section-title{
  413. font-size: 16px;
  414. margin-bottom: 20rpx;
  415. }
  416. .require::before{
  417. content: '*';
  418. font-size: 16px;
  419. color: #FF0000;
  420. position: absolute;
  421. left: 20rpx;
  422. }
  423. .section-select-box{
  424. color: #999;
  425. position: relative;
  426. &::after{
  427. position: absolute;
  428. right: 0;
  429. top: 50%;
  430. content: '';
  431. display: block;
  432. width: 18rpx;
  433. height: 18rpx;
  434. border-top: 1px solid #999;
  435. border-right: 1px solid #999;
  436. transform: translateY(-50%) rotate(45deg);
  437. }
  438. }
  439. .show-all-custome-box{
  440. top: 100%;
  441. width: 85vw;
  442. height: 440rpx;
  443. z-index: 10;
  444. padding: 30rpx 40rpx;
  445. position: absolute;
  446. background: #FFFFFF;
  447. box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.16);
  448. .all-custome-item{
  449. margin-bottom: 30rpx;
  450. }
  451. }
  452. }
  453. .btn{
  454. width: 360rpx;
  455. height: 60rpx;
  456. }
  457. .radio-wrap{
  458. .radio{
  459. font-size: 14px;
  460. &::before{
  461. content: '';
  462. display: inline-block;
  463. }
  464. }
  465. }
  466. .custome-search-wrap{
  467. padding: 34rpx;
  468. height: 100%;
  469. .search-box {
  470. border: 1px solid #3385FF;
  471. padding: 0 !important;
  472. border-radius: 60rpx;
  473. background-color: #fff !important;
  474. }
  475. .search-con {
  476. background-color: #fff !important;
  477. }
  478. .van-search__content {
  479. background-color: #fff !important;
  480. padding-left: 30rpx !important;
  481. }
  482. .search-btn {
  483. position: relative;
  484. color: #3385FF;
  485. &::before {
  486. content: '';
  487. display: block;
  488. width: 1px;
  489. height: 60%;
  490. background-color: #D1D1D1;
  491. position: absolute;
  492. left: -16rpx;
  493. top: 20%;
  494. }
  495. }
  496. .search-icon{
  497. width: 40rpx;
  498. height: 40rpx;
  499. display: block;
  500. position: relative;
  501. top: 4rpx;
  502. margin-right: 20rpx;
  503. }
  504. .click-icon{
  505. width: 24rpx;
  506. height: 24rpx;
  507. }
  508. .result-item{
  509. align-items: center;
  510. padding: 20rpx 0;
  511. border-bottom: 1px solid #EBEBEB;
  512. .con{
  513. flex: 1;
  514. margin-right: 20rpx;
  515. }
  516. }
  517. .search-result{
  518. overflow-y: auto;
  519. height: 100%;
  520. }
  521. .result-contract-box{
  522. padding: 0 10rpx;
  523. .result-contract-item{
  524. margin-top: 30rpx;
  525. box-shadow: 0px 0px 12rpx rgba(175, 175, 175, 0.38);
  526. padding: 30rpx;
  527. border-radius: 8px;
  528. .name{
  529. font-size: 16px;
  530. font-weight: bold;
  531. &::before{
  532. content:'';
  533. display:inline-block;
  534. width: 31rpx;
  535. height: 34rpx;
  536. background-image: url(../../static/man.png);
  537. background-size: cover;
  538. position: relative;
  539. top: 4rpx;
  540. margin-right: 10rpx;
  541. }
  542. }
  543. }
  544. }
  545. }
  546. .type-popup-wrap{
  547. padding: 20rpx 32rpx;
  548. height: 280px;
  549. .top-title{
  550. justify-content: space-between;
  551. margin-bottom: 124rpx;
  552. }
  553. .van-checkbox{
  554. margin-bottom: 30rpx;
  555. width: 200rpx;
  556. margin-left: auto;
  557. margin-right: auto;
  558. }
  559. }
  560. </style>