detail.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. <template>
  2. <view class="detail white-wrap">
  3. <image :src="statusImg" mode="aspectFill" class="status-img" v-if="statusImg"></image>
  4. <view class="section white-wrap">
  5. <view class="section-title require">用印用途</view>
  6. <view :class="opButton.CheckEdit?'section-select-box':null" :style="{color:oldUse?'#333':'#999'}" @click="handleOperation('showPurpose')">{{oldUse?oldUse:'请选择'}}</view>
  7. </view>
  8. <view class="section white-wrap">
  9. <view class="section-title require">客户名称(全称)</view>
  10. <view>{{detail.CompanyName}}</view>
  11. </view>
  12. <view class="section white-wrap">
  13. <view class="section-title require">统一社会信用码</view>
  14. <input type="text" v-model="detail.CreditCode" placeholder="请填写统一社会信用码" disabled/>
  15. </view>
  16. <view class="section white-wrap">
  17. <view class="section-title">实际使用方名称</view>
  18. <input type="text" v-model="detail.UseCompanyName" placeholder="请填写实际使用方名称" disabled/>
  19. </view>
  20. <view class="section white-wrap">
  21. <view class="section-title require">业务类型</view>
  22. <input type="text" v-model="detail.ServiceType" placeholder="请填写业务类型" disabled/>
  23. </view>
  24. <view class="section white-wrap">
  25. <view class="section-title require">文件份数</view>
  26. <input type="number" v-model="oldFileNum" placeholder="请填写总共盖章文件份数" :disabled="!opButton.CheckEdit"/>
  27. </view>
  28. <view class="section white-wrap">
  29. <view class="section-title require">加盖何种印章</view>
  30. <view :class="opButton.CheckEdit?'section-select-box':null" :style="{color:oldSealType?'#333':'#999'}" @click="handleOperation('showType')">{{oldSealType?oldSealType:'请选择'}}</view>
  31. </view>
  32. <view class="section white-wrap" v-if="detail.ContractId>0">
  33. <view class="section-title require">合同附件</view>
  34. <image
  35. :src="files.img"
  36. mode="aspectFill"
  37. style="width: 102rpx;height: 120rpx"
  38. @click="handlepreViewFile(files)">
  39. </image>
  40. </view>
  41. <view class="section white-wrap" v-else>
  42. <view class="section-title require">合同附件</view>
  43. <!-- 合规可修改上传 -->
  44. <div class="check-file-box" :style="'background-image:url('+files.img+')'" v-if="files.url" @click="handlepreViewFile(files)">
  45. <image class="del-icon" src="../static/del-icon.png" @click.stop="handleDeleteCheckFile" v-if="opButton.CheckEdit"></image>
  46. </div>
  47. <image v-else @click="handleUpload" src="../static/upload-icon.png" mode="aspectFill" style="width: 102rpx;height: 120rpx;"></image>
  48. </view>
  49. <view class="section white-wrap" v-if="detail.Status==='已驳回'">
  50. <view class="section-title">驳回理由</view>
  51. <view style="color: #F55768;">{{detail.ApprovalRemark}}</view>
  52. </view>
  53. <view class="section white-wrap">
  54. <view class="section-title">备注</view>
  55. <textarea type="text" v-model="oldRemark" placeholder="请填写备注" :disabled="!opButton.CheckEdit"></textarea>
  56. </view>
  57. <!-- 流程模块 -->
  58. <view class="section white-wrap process-wrap">
  59. <view class="title" style="font-size: 16px;font-weight: bold;">审批流程</view>
  60. <steps :data="processData"></steps>
  61. </view>
  62. <!-- 审批/撤回申请 -->
  63. <view class="fix-bottom-wrap" style="text-align: center;" v-if="opButton.Approval||opButton.Cancel">
  64. <div class="flex" style="justify-content: space-between;width:100%">
  65. <van-button type="info" color="#3385FF" style="flex:1;" custom-class="btn-small" round @click="handleClickPass" v-if="opButton.Approval">通过</van-button>
  66. <van-button type="info" color="#F55768" style="flex:1;" custom-class="btn-small" round @click="handleApprovalReject" v-if="opButton.Approval">驳回</van-button>
  67. <van-button type="info" color="#F55768" style="flex:1;" :custom-class="opButton.Approval?'btn-small':'btn-big'" round @click="handleCancelApply" v-if="opButton.Cancel">撤回申请</van-button>
  68. </div>
  69. </view>
  70. <!-- 作废 -->
  71. <view class="fix-bottom-wrap" style="text-align: center;" v-if="opButton.Invalid">
  72. <view v-if="detail.ContractId>0" style="margin-bottom: 10rpx;" @click="checked=!checked"><radio value="同时作废合同" :checked="checked" color="#3385FF" style="transform:scale(0.8)"/>是否同时作废合同?</view>
  73. <van-button type="info" color="#F55768" custom-class="btn-big" round @click="handleSealInvalid">用印作废</van-button>
  74. </view>
  75. <!-- 重新提交 -->
  76. <view class="fix-bottom-wrap" style="text-align: center;" v-if="opButton.Edit">
  77. <van-button type="info" color="#3385FF" custom-class="btn-big" round @click="handleEdit">重新申请</van-button>
  78. </view>
  79. <!-- 撤回申请 -->
  80. <!-- <view class="fix-bottom-wrap" style="text-align: center;" v-if="opButton.Cancel">
  81. <van-button type="info" color="#3385FF" custom-class="btn-big" round @click="handleCancelApply">撤回申请</van-button>
  82. </view> -->
  83. <!-- 用印用途 -->
  84. <van-popup :show="showPurpose" @close="showPurpose=false" position="bottom">
  85. <van-picker
  86. show-toolbar
  87. title="选择用印用途"
  88. :columns="purposeArr"
  89. @confirm="handlePurposeConfirm"
  90. @cancel="showPurpose=false"
  91. />
  92. </van-popup>
  93. <!-- 何种印章 -->
  94. <van-popup :show="showType" @close="showType=false" position="bottom">
  95. <van-picker
  96. show-toolbar
  97. title="选择何种印章"
  98. :columns="typeArr"
  99. @confirm="handleTypeConfirm"
  100. @cancel="showType=false"
  101. />
  102. </van-popup>
  103. <!-- 客户搜索 -->
  104. <van-popup :show="showCustome" @close="showCustome=false" position="bottom" custom-style="height: 100vh">
  105. <view class="custome-search-wrap">
  106. <van-search use-left-icon-slot use-action-slot shape="round" :value="searchCustomeVal" placeholder="请输入客户名称/社会信用码" @change="onSearchValChange" @search="onSearch"
  107. custom-class="search-box" field-class="search-con">
  108. <view slot="left-icon">
  109. <image src="../static/search-icon.png" mode="aspectFill" class="search-icon"></image>
  110. </view>
  111. <view slot="action" @click="showCustome=false" class="search-btn">取消</view>
  112. </van-search>
  113. <view class="search-result">
  114. <view class="result-custome-box" v-if="searchContractList.length===0">
  115. <view class="result-item flex" v-for="item in searchCustomeList" :key="item" @click="getContract(item)">
  116. <image src="../static/search-icon.png" mode="aspectFill" class="search-icon"></image>
  117. <view class="con van-ellipsis">{{item}}</view>
  118. <image src="../static/click-icon.png" mode="aspectFill" class="click-icon"></image>
  119. </view>
  120. </view>
  121. <view class="result-contract-box" v-else>
  122. <view class="result-contract-item" v-for="item in searchContractList" :key="item.ContractId" @click="handleChooseContract(item)">
  123. <view class="name">{{item.CompanyName}}</view>
  124. <view style="margin-top: 20rpx;">合同编号:{{item.ContractCode}}</view>
  125. <view style="margin-top: 20rpx;">合同类型:{{item.ContractType}}</view>
  126. <view style="margin-top: 20rpx;">合同金额:{{item.Price}}</view>
  127. </view>
  128. </view>
  129. </view>
  130. </view>
  131. </van-popup>
  132. <van-dialog id="van-dialog" />
  133. </view>
  134. </template>
  135. <script>
  136. import {
  137. apiSealDetail,
  138. apiSearchCustome,
  139. apiSearchContract,
  140. apiApprovalPass,
  141. apiInvalidSeal,
  142. apiApprovalPassModify,
  143. apiSealCancelApply
  144. } from '@/api/approve/seal.js'
  145. import steps from '../components/steps.vue'
  146. import {preViewFile} from '../utils/util.js'
  147. import {uploadFiles} from '@/utils/uploadFile.js'
  148. export default{
  149. components:{
  150. steps
  151. },
  152. computed:{
  153. statusImg(){
  154. if(this.detail.Status==='已审批'){
  155. return require('../static/pass-icon.png')
  156. }else if(this.detail.Status==='已驳回'){
  157. return require('../static/fail-icon.png')
  158. }else if(this.detail.Status==='处理中'){
  159. return require('../static/processing-icon.png')
  160. }else if(this.detail.Status==='已撤回'){
  161. return require('../static/recall-icon.png')
  162. }else if(this.detail.Status==='已作废'){
  163. return require('../static/cancel-icon.png')
  164. }
  165. }
  166. },
  167. data() {
  168. return {
  169. val:'',
  170. ContractApprovalId:0,
  171. ContractApprovalRecordId:0,
  172. SealId:0,
  173. processData:null,
  174. detail:{},
  175. opButton:{},
  176. files:{
  177. type:'',
  178. img:'',
  179. url:''
  180. },//合同附件
  181. showPurpose:false,//显示用印用途选项
  182. purposeArr:['销售合同','渠道合同','付款通知函','招投标','战略合作协议'],
  183. showType:false,//显示用印用途选项
  184. typeArr:['公章','合同章','法人章'],
  185. showCustome:false,//显示搜索客户名称
  186. searchCustomeVal:'',//搜索客户输入数据
  187. searchCustomeList:[],//搜索到的客户名称列表
  188. searchContractList:[],//选择搜索中的客户后合同列表数据
  189. checked:false,//是否同时作废合同
  190. oldUse:"",
  191. oldFileNum:'',
  192. oldSealType:'',
  193. oldRemark:'',
  194. oldFile:''
  195. }
  196. },
  197. onLoad(options) {
  198. this.ContractApprovalId=options.ContractApprovalId
  199. this.ContractApprovalRecordId=options.ContractApprovalRecordId
  200. this.SealId=options.SealId
  201. this.getDetail()
  202. },
  203. onShow() {
  204. uni.$once('updateSealDetail',(data)=>{
  205. console.log('监听到事件来自updateSealDetail ,携带参数 msg 为:' + data.msg);
  206. this.getDetail()
  207. })
  208. },
  209. onPullDownRefresh() {
  210. this.getDetail()
  211. setTimeout(()=>{
  212. uni.stopPullDownRefresh()
  213. },1000)
  214. },
  215. methods: {
  216. // 合规删除合同附件
  217. handleDeleteCheckFile(){
  218. this.files={
  219. type:'',
  220. img:'',
  221. url:''
  222. }
  223. },
  224. //合规上传附件
  225. async handleUpload(){
  226. const res=await uploadFiles({type:'all'})
  227. const reg = /\.(pdf)$/;
  228. if(reg.test(res[0])){
  229. this.files={
  230. type:'pdf',
  231. url:res[0],
  232. img:require('../static/pdf.png')
  233. }
  234. }else{
  235. this.files={
  236. type:'img',
  237. url:res[0],
  238. img:res[0]
  239. }
  240. }
  241. },
  242. // 撤回申请
  243. handleCancelApply(){
  244. this.$dialog.confirm({
  245. title: '提示',
  246. message: '是否确认撤回',
  247. }).then(async ()=>{
  248. const res=await apiSealCancelApply({SealId:Number(this.detail.SealId)})
  249. if(res.code===200){
  250. uni.showToast({
  251. title:'撤回成功',
  252. icon:'none'
  253. })
  254. this.getDetail()
  255. }
  256. }).catch(() => {
  257. console.log('取消撤回');
  258. });
  259. },
  260. handlePurposeConfirm(e){
  261. this.oldUse=e.detail.value
  262. this.showPurpose=false
  263. },
  264. handleTypeConfirm(e){
  265. this.oldSealType=e.detail.value
  266. this.showType=false
  267. },
  268. //前去重审
  269. handleEdit(){
  270. uni.navigateTo({
  271. url:`./edit?ContractApprovalId=${this.ContractApprovalId}&ContractApprovalRecordId=${this.ContractApprovalRecordId}`
  272. })
  273. },
  274. //用印作废
  275. handleSealInvalid(){
  276. this.$dialog.confirm({
  277. title: '提示',
  278. message: '是否确认作废',
  279. }).then(async ()=>{
  280. const res=await apiInvalidSeal({
  281. IsInvalidContract:this.checked,
  282. SealId:this.detail.SealId
  283. })
  284. if(res.code===200){
  285. uni.showToast({
  286. title:'操作成功',
  287. icon:'none'
  288. })
  289. this.getDetail()
  290. }
  291. }).catch(() => {
  292. console.log('取消作废');
  293. });
  294. },
  295. //点击通过
  296. handleClickPass(){
  297. //判断是否有内容修改
  298. const flag1=this.oldUse===this.detail.Use
  299. const flag2=Number(this.oldFileNum)===Number(this.detail.FileNum)
  300. const flag3=this.oldSealType===this.detail.SealType
  301. const flag4=this.oldRemark===this.detail.Remark
  302. const flag5=this.files.url===this.detail.FileUrl
  303. if(flag1&&flag2&&flag3&&flag4&&flag5){
  304. this.handleApprovalPass()
  305. }else{
  306. this.handleApprovePassModify()
  307. }
  308. },
  309. //审批通过 (修改内容)
  310. async handleApprovePassModify(){
  311. if(!this.oldFileNum){
  312. uni.showToast({
  313. title:'请填写文件份数',
  314. icon:"none"
  315. })
  316. return
  317. }
  318. if(this.oldFileNum<1){
  319. uni.showToast({
  320. title:'文件份数不合法',
  321. icon:"none"
  322. })
  323. return
  324. }
  325. if(!this.oldSealType){
  326. uni.showToast({
  327. title:'印章类型不能为空',
  328. icon:"none"
  329. })
  330. return
  331. }
  332. if(!this.oldUse){
  333. uni.showToast({
  334. title:'请选择用印用途',
  335. icon:"none"
  336. })
  337. return
  338. }
  339. if(!this.files.url){
  340. uni.showToast({
  341. title:'合同附件不能为空',
  342. icon:"none"
  343. })
  344. return
  345. }
  346. const res=await apiApprovalPassModify({
  347. FileNum:Number(this.oldFileNum),
  348. Remark:this.oldRemark,
  349. SealId:Number(this.detail.SealId),
  350. SealType:this.oldSealType,
  351. Use:this.oldUse,
  352. FileUrl:this.files.url
  353. })
  354. if(res.code===200){
  355. this.$dialog.alert({
  356. title: "处理成功",
  357. confirmButtonColor: "#5890FB",
  358. }).then(() => {
  359. this.getDetail()
  360. });
  361. }
  362. },
  363. // 审批通过 (未修改内容)
  364. async handleApprovalPass(){
  365. const res=await apiApprovalPass({
  366. SealId:Number(this.detail.SealId),
  367. Remark:""
  368. })
  369. if(res.code===200){
  370. this.$dialog.alert({
  371. title: "处理成功",
  372. confirmButtonColor: "#5890FB",
  373. }).then(() => {
  374. this.getDetail()
  375. });
  376. }
  377. },
  378. //驳回
  379. handleApprovalReject(){
  380. uni.navigateTo({
  381. url:`./reason?SealId=${this.detail.SealId}`
  382. })
  383. },
  384. //预览文件
  385. handlepreViewFile(e){
  386. if (e.type === "pdf") {
  387. preViewFile(e.url)
  388. } else {
  389. uni.previewImage({
  390. urls: [e.url]
  391. })
  392. }
  393. },
  394. // 只有当 checkEdit 为true 即合规才能修改
  395. handleOperation(key){
  396. if(this.opButton.CheckEdit){
  397. this[key]=true
  398. }
  399. },
  400. // 客户搜索
  401. // 先搜索出客户 再通过客户去请求出客户下面存在的合同
  402. onSearchValChange(e){
  403. this.searchCustomeVal=e.detail
  404. },
  405. //搜索客户
  406. async onSearch(){
  407. if(!this.searchCustomeVal){
  408. uni.showToast({
  409. title:'请输入搜索关键字',
  410. icon:'none'
  411. })
  412. return
  413. }
  414. this.searchContractList=[]
  415. this.searchCustomeList=[]
  416. const res=await apiSearchCustome({Keyword:this.searchCustomeVal})
  417. if(res.code===200){
  418. this.searchCustomeList=res.data
  419. }
  420. },
  421. // 搜索客户对应的合同
  422. async getContract(e){
  423. const res=await apiSearchContract({Keyword:e})
  424. if(res.code===200){
  425. if(res.data.List){
  426. this.searchContractList=res.data.List
  427. }else{
  428. uni.showToast({
  429. title:"此客户无合同,请重新选择",
  430. icon:"none"
  431. })
  432. }
  433. }
  434. },
  435. // 选择合同 更新表单数据
  436. handleChooseContract(e){
  437. this.detail.CompanyName=e.CompanyName
  438. this.detail.ServiceType=e.ContractType
  439. this.detail.CreditCode=e.CreditCode
  440. this.detail.UseCompanyName=e.CompanyName
  441. this.detail.ContractId=e.ContractId
  442. this.detail.ContractfileUrl=e.FileUrl
  443. // 关闭搜索弹窗
  444. this.showCustome=false
  445. this.searchCustomeVal=''
  446. this.searchContractList=[]
  447. this.searchCustomeList=[]
  448. },
  449. //获取详情
  450. async getDetail() {
  451. const res=await apiSealDetail({
  452. ContractApprovalId:Number(this.ContractApprovalId),
  453. ContractApprovalRecordId:Number(this.ContractApprovalRecordId),
  454. SealId:Number(this.SealId)
  455. })
  456. if(res.code===200){
  457. this.detail=res.data.SealDetail
  458. this.oldUse=res.data.SealDetail.Use
  459. this.oldFileNum=res.data.SealDetail.FileNum
  460. this.oldSealType=res.data.SealDetail.SealType
  461. this.oldRemark=res.data.SealDetail.Remark
  462. this.processData=res.data.FlowNodeList
  463. this.opButton=res.data.OpButton
  464. this.handleFile(res.data.SealDetail.FileUrl)
  465. }
  466. },
  467. //处理文件
  468. handleFile(filesUrl){
  469. const reg = /\.(pdf)$/;
  470. if(reg.test(filesUrl)){
  471. this.files={
  472. type: "pdf",
  473. url: filesUrl,
  474. img: require("../static/pdf.png"),
  475. }
  476. }else{
  477. this.files={
  478. type: "img",
  479. url: filesUrl,
  480. img: filesUrl,
  481. }
  482. }
  483. },
  484. },
  485. }
  486. </script>
  487. <style lang="scss">
  488. .check-file-box{
  489. width: 102rpx;
  490. height: 120rpx;
  491. background-size: cover;
  492. background-position: center;
  493. position: relative;
  494. .del-icon{
  495. position: absolute;
  496. width: 30rpx;
  497. height: 30rpx;
  498. top: -15rpx;
  499. right: -15rpx;
  500. }
  501. }
  502. .detail{
  503. width: 100%;
  504. min-height: 100vh;
  505. padding-bottom: calc(150rpx + constant(safe-area-inset-bottom));
  506. padding-bottom: calc(150rpx + env(safe-area-inset-bottom));
  507. position: relative;
  508. }
  509. .status-img{
  510. position: absolute;
  511. right: 0;
  512. top: 50rpx;
  513. width: 220rpx;
  514. height: 220rpx;
  515. z-index: 10;
  516. }
  517. .section{
  518. padding: 30rpx 34rpx;
  519. border-top: 10rpx solid #F5F5F5;
  520. position: relative;
  521. .section-title{
  522. font-size: 16px;
  523. margin-bottom: 20rpx;
  524. }
  525. .require::before{
  526. content: '*';
  527. font-size: 16px;
  528. color: #FF0000;
  529. position: absolute;
  530. left: 20rpx;
  531. }
  532. .section-select-box{
  533. color: #999;
  534. position: relative;
  535. &::after{
  536. position: absolute;
  537. right: 0;
  538. top: 50%;
  539. content: '';
  540. display: block;
  541. width: 18rpx;
  542. height: 18rpx;
  543. border-top: 1px solid #999;
  544. border-right: 1px solid #999;
  545. transform: translateY(-50%) rotate(45deg);
  546. }
  547. }
  548. }
  549. .btn-big{
  550. width: 450rpx;
  551. height: 60rpx;
  552. }
  553. .btn-small{
  554. min-width: 220rpx;
  555. height: 60rpx;
  556. }
  557. .custome-search-wrap{
  558. padding: 34rpx;
  559. height: 100%;
  560. .search-box {
  561. border: 1px solid #3385FF;
  562. padding: 0 !important;
  563. border-radius: 60rpx;
  564. background-color: #fff !important;
  565. }
  566. .search-con {
  567. background-color: #fff !important;
  568. }
  569. .van-search__content {
  570. background-color: #fff !important;
  571. padding-left: 30rpx !important;
  572. }
  573. .search-btn {
  574. position: relative;
  575. color: #3385FF;
  576. &::before {
  577. content: '';
  578. display: block;
  579. width: 1px;
  580. height: 60%;
  581. background-color: #D1D1D1;
  582. position: absolute;
  583. left: -16rpx;
  584. top: 20%;
  585. }
  586. }
  587. .search-icon{
  588. width: 40rpx;
  589. height: 40rpx;
  590. display: block;
  591. position: relative;
  592. top: 4rpx;
  593. margin-right: 20rpx;
  594. }
  595. .click-icon{
  596. width: 24rpx;
  597. height: 24rpx;
  598. }
  599. .result-item{
  600. align-items: center;
  601. padding: 20rpx 0;
  602. border-bottom: 1px solid #EBEBEB;
  603. .con{
  604. flex: 1;
  605. margin-right: 20rpx;
  606. }
  607. }
  608. .search-result{
  609. overflow-y: auto;
  610. height: 100%;
  611. }
  612. .result-contract-box{
  613. padding: 0 10rpx;
  614. .result-contract-item{
  615. margin-top: 30rpx;
  616. box-shadow: 0px 0px 12rpx rgba(175, 175, 175, 0.38);
  617. padding: 30rpx;
  618. border-radius: 8px;
  619. .name{
  620. font-size: 16px;
  621. font-weight: bold;
  622. &::before{
  623. content:'';
  624. display:inline-block;
  625. width: 31rpx;
  626. height: 34rpx;
  627. background-image: url(../../static/man.png);
  628. background-size: cover;
  629. position: relative;
  630. top: 4rpx;
  631. margin-right: 10rpx;
  632. }
  633. }
  634. }
  635. }
  636. }
  637. </style>