detail.vue 16 KB

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