edit.vue 17 KB

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