detail.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. <template>
  2. <view class="detail-page white-wrap">
  3. <view>
  4. <!-- 基础信息 -->
  5. <view class="section white-wrap base-info-wrap" v-if="detail">
  6. <image :src="statusImg" mode="aspectFill" class="status-img"></image>
  7. <view class="title">
  8. <text>{{detail.CompanyName}}</text>
  9. <!-- van-tag
  10. color="#ECF5FF"
  11. text-color="#4A83F1"
  12. style="margin-bottom:0;margin-left: 10rpx;"
  13. >新签</van-tag> -->
  14. </view>
  15. <view class="base-info-list">
  16. <view>
  17. <text class="lable">合同编号:</text>
  18. <text >{{detail.ContractCode}}</text>
  19. <van-tag color="#ECF5FF" text-color="#4A83F1" style="margin-left:5px;margin-top:2px">{{detail.ContractType}}</van-tag>
  20. </view>
  21. <view>
  22. <text class="lable">合同期限:</text>
  23. <text>{{detail.StartDate|formatDate}}~{{detail.EndDate | formatDate}}({{detail.StartDate|formateYear(detail.EndDate)}})</text>
  24. </view>
  25. <view>
  26. <text class="lable">合同金额:</text>
  27. <text style="color:#FE6B7C">{{detail.Price}}元</text>
  28. </view>
  29. <view>
  30. <text class="lable">合同归属:</text>
  31. <text>{{detail.ProductId===1?'FICC':'权益'}}</text>
  32. </view>
  33. <view>付款方式说明:{{detail.PayRemark}}</view>
  34. <view>付款渠道:{{detail.PayChannel}}</view>
  35. <view v-if="detail.SellerRemark">备注:{{detail.SellerRemark}}</view>
  36. <view v-if="detail && detail.Status === '已驳回'">
  37. <text class="lable" style="color:#FE6B7C">驳回理由:</text>
  38. <text style="color:#FE6B7C">{{ detail.ApprovalRemark }}</text>
  39. </view>
  40. </view>
  41. </view>
  42. <!-- 变更说明 -->
  43. <view class="section white-wrap change-info-wrap" v-if="changeDesc.length>0">
  44. <view class="title">变更说明</view>
  45. <view style="margin-bottom: 20rpx;" v-for="(item,index) in changeDesc" :key="index">{{index+1}}、{{item}}</view>
  46. </view>
  47. <!-- 服务内容 -->
  48. <view class="section white-wrap service-wrap">
  49. <view class="title">服务内容</view>
  50. <view style="border-bottom: 1px dashed rgba(112, 112, 112, .21);margin-bottom: 30rpx;" >
  51. <view class="service-item flex" v-for="item in detail.Service" :key="item.Title">
  52. <text style="width:60%">{{item.Title}}</text>
  53. <text class="btn" @click="handlePreviewImg(item.Value)">查看服务单</text>
  54. </view>
  55. </view>
  56. <view >补充内容:{{detail.Remark||'无'}}</view>
  57. </view>
  58. <!-- 回签附件 -->
  59. <view class="section white-wrap contract-wrap" v-if="detail.Status==='已签回'">
  60. <view class="title">回签附件</view>
  61. <view class="contract-list">
  62. <view class="contract-item" v-for="item in checkBackFiles" :key="item.url"
  63. @click="preViewContract(item)">
  64. <image class="contract-img" mode="aspectFill" :src="item.img"></image>
  65. </view>
  66. </view>
  67. </view>
  68. <!-- 解约附件 -->
  69. <view class="section white-wrap contract-wrap" v-if="detail.Status==='已解约'">
  70. <view class="title">解约附件</view>
  71. <view class="contract-list">
  72. <view class="contract-item" v-for="item in rescindFile" :key="item.url"
  73. @click="preViewContract(item)">
  74. <image class="contract-img" mode="aspectFill" :src="item.img"></image>
  75. </view>
  76. </view>
  77. </view>
  78. <!-- 合同模块 -->
  79. <view class="section white-wrap contract-wrap" v-if="constractFiles.length !== 0&&detail.Status!='已签回'&&detail.Status!='已解约'">
  80. <view class="title">合同预览</view>
  81. <view class="contract-list">
  82. <view class="contract-item" v-for="item in constractFiles" :key="item.url"
  83. @click="preViewContract(item)">
  84. <image class="contract-img" mode="aspectFill" :src="item.img"></image>
  85. </view>
  86. </view>
  87. </view>
  88. <!-- 客户信息模块 -->
  89. <view class="section white-wrap customer-wrap">
  90. <view class="title">客户信息</view>
  91. <view class="customer-main-info">
  92. <view class="customer-info-item">
  93. <text>客户名称:</text>
  94. <text>{{detail.CompanyName}}</text>
  95. </view>
  96. <view class="customer-info-item">
  97. <text>社会信用码:</text>
  98. <text>{{detail.CreditCode}}</text>
  99. </view>
  100. <view class="customer-info-item">
  101. <text>地址:</text>
  102. <text>{{detail.Province}}{{detail.City}}{{detail.Address}}</text>
  103. </view>
  104. <view class="customer-info-item">
  105. <text>申请人:</text>
  106. <text>{{detail.SellerName}}</text>
  107. </view>
  108. </view>
  109. </view>
  110. <!-- 流程模块 -->
  111. <view class="section white-wrap process-wrap" v-if="flowNodeList">
  112. <view class="title">审批流程</view>
  113. <steps :data="flowNodeList"></steps>
  114. </view>
  115. </view>
  116. <!-- 审批按钮 -->
  117. <view class="fix-bottom-wrap btns-wrap flex" v-if="opt.Approval">
  118. <button class="pass-btn" @click="handlePass">通过</button>
  119. <button class="refuse-btn" @click="handleRefuse">驳回</button>
  120. </view>
  121. <!-- 上传回签附件 -->
  122. <view class="fix-bottom-wrap btns-wrap flex" v-if="opt.UploadFile">
  123. <button class="pass-btn" style="width: 450rpx;" @click="handleUploadMethod('file')">{{detail.Status==='已审批'?'上传回签附件':'更新回签附件'}}</button>
  124. </view>
  125. <!-- 作废合同 -->
  126. <!-- <view class="fix-bottom-wrap btns-wrap flex" v-if="opt.Invalid">
  127. <button class="refuse-btn" style="width: 450rpx;" >作废合同</button>
  128. </view> -->
  129. <!-- 上传回签附件选择上传文件类型弹窗 -->
  130. <van-popup :show="show" @close="show=false" round>
  131. <view style="width: 50vw;text-align: center;font-size: 16px;padding: 32rpx;line-height: 80rpx;">
  132. <view @click="handleUploadMethod('img')">上传图片</view>
  133. <view @click="handleUploadMethod('file')">上传文件</view>
  134. </view>
  135. </van-popup>
  136. <!-- 上传回签附件弹窗 -->
  137. <van-popup :show="showUpload" @close="showUpload=false" position="bottom" round>
  138. <view class="uploadfile-wrap">
  139. <view style="text-align: center;font-size: 16px;font-weight: bold;">上传回签附件</view>
  140. <view class="contract-list" style="height: 30vh;">
  141. <view class="contract-item" v-for="item in files" :key="item.url"
  142. @click="preViewContract(item)">
  143. <image class="contract-img" mode="aspectFill" :src="item.img"></image>
  144. </view>
  145. </view>
  146. <button style="width: 450rpx;" @click='handleConfirmSignBack'>确定</button>
  147. </view>
  148. </van-popup>
  149. <van-dialog id="van-dialog" />
  150. </view>
  151. </template>
  152. <script>
  153. import {apiContractDetail,apiContractApproved,apiContractApprovalDetail,apiContractSignBackFiles} from '@/api/approve/contract.js'
  154. import steps from '../components/steps.vue'
  155. import {preViewFile} from '../utils/util.js'
  156. import {uploadImg,uploadFiles} from '@/utils/uploadFile.js'
  157. export default{
  158. components:{
  159. steps
  160. },
  161. filters:{
  162. formatDate(e){
  163. if(e==='0001-01-01T00:00:00Z'){
  164. return ''
  165. }else{
  166. return e.split('T')[0].replace(/-/g,'.')
  167. }
  168. },
  169. formatTime(e){
  170. if(e==='0001-01-01T00:00:00Z'){
  171. return ''
  172. }else{
  173. return e.replace(/T/g,' ').replace(/\+08:00/g,' ').replace(/-/g,'.')
  174. }
  175. },
  176. formateYear(start,end){
  177. let starttime = new Date(start);
  178. let endtime = new Date(end);
  179. let difftime = endtime - starttime;
  180. let ret = parseFloat((difftime / (1000 * 60 * 60 * 24 * 365)).toFixed(1));
  181. return `有效期为 ${ret} 年`;
  182. }
  183. },
  184. computed:{
  185. // 处理变更说明
  186. changeDesc(){
  187. return this.detail&&this.detail.ModifyContent&&this.detail.ModifyContent.split('<br/>').filter(item=> item)
  188. },
  189. //回签附件
  190. checkBackFiles(){
  191. const reg = /\.(pdf)|\.doc|\.docx$/;
  192. return this.detail&&this.detail.CheckBackFileUrl&&this.detail.CheckBackFileUrl.split("#").map((item) => {
  193. if (reg.test(item)) {
  194. return {
  195. type: "pdf",
  196. url: item,
  197. img: require("@/pages-approve/static/pdf.png"),
  198. };
  199. } else {
  200. return {
  201. type: "img",
  202. url: item,
  203. img: item,
  204. };
  205. }
  206. });
  207. },
  208. //解约附件
  209. rescindFile(){
  210. const reg = /\.(pdf)|\.doc|\.docx$/;
  211. return this.detail&&this.detail.RescindFileUrl&&this.detail.RescindFileUrl.split("#").map((item) => {
  212. if (reg.test(item)) {
  213. return {
  214. type: "pdf",
  215. url: item,
  216. img: require("@/pages-approve/static/pdf.png"),
  217. };
  218. } else {
  219. return {
  220. type: "img",
  221. url: item,
  222. img: item,
  223. };
  224. }
  225. });
  226. },
  227. // 合同附件
  228. constractFiles(){
  229. const reg = /\.(pdf)|\.doc|\.docx$/;
  230. return this.detail&&this.detail.FileUrl&&this.detail.FileUrl.split("#").map((item) => {
  231. if (reg.test(item)) {
  232. return {
  233. type: "pdf",
  234. url: item,
  235. img: require("@/pages-approve/static/pdf.png"),
  236. };
  237. } else {
  238. return {
  239. type: "img",
  240. url: item,
  241. img: item,
  242. };
  243. }
  244. });
  245. },
  246. // 状态图标
  247. statusImg(){
  248. if(!this.detail) return
  249. if(this.detail.Status==='已审批'){
  250. return require('../static/pass-icon.png')
  251. }else if(this.detail.Status==='已签回'){
  252. return require('../static/draw-back-icon.png')
  253. }else if(this.detail.Status==='已驳回'){
  254. return require('../static/fail-icon.png')
  255. }else if(this.detail.Status==='已作废'){
  256. return require('../static/cancel-icon.png')
  257. }else if(this.detail.Status==='已撤回'){
  258. return require('../static/recall-icon.png')
  259. }else if(this.detail.Status==='处理中'){
  260. return require('../static/processing-icon.png')
  261. }else if(this.detail.Status==='已解约'){
  262. return require('../static/jieyue-icon.png')
  263. }
  264. }
  265. },
  266. data() {
  267. return {
  268. ContractApprovalId: null,//审批单id
  269. ContractApprovalRecordId:null,//审批流程单id
  270. ContractId:null,//合同id
  271. detail:null,
  272. flowNodeList:null,
  273. opt:{},
  274. show:false,
  275. showUpload:false,
  276. files:[],
  277. }
  278. },
  279. onLoad(options) {
  280. this.ContractApprovalId=options.ContractApprovalId||0
  281. this.ContractApprovalRecordId=options.ContractApprovalRecordId||0
  282. this.ContractId=options.ContractId||0
  283. },
  284. onShow() {
  285. // 当合同id 不存在时(或0) 使用审批详情
  286. if(this.ContractId!=0){
  287. this.getContractDetail()
  288. }else{
  289. this.getApprovalDetail()
  290. }
  291. },
  292. onPullDownRefresh() {
  293. if(this.ContractId!=0){
  294. this.getContractDetail()
  295. }else{
  296. this.getApprovalDetail()
  297. }
  298. setTimeout(()=>{
  299. uni.stopPullDownRefresh()
  300. },1000)
  301. },
  302. methods: {
  303. //确认提交上传回签附件
  304. async handleConfirmSignBack(){
  305. let FileUrlarr=this.files.map(item=>item.url)
  306. const res=await apiContractSignBackFiles({
  307. ContractId:Number(this.detail.ContractId),
  308. FileUrl:FileUrlarr.join('#')
  309. })
  310. if(res.code===200){
  311. uni.showToast({
  312. title:'操作成功',
  313. icon:'none'
  314. })
  315. // 已审批上传签回附件更新列表
  316. if(this.detail.Status==='已审批'){
  317. uni.$emit('contractApproveListUpdate',{
  318. ContractApprovalId:this.ContractApprovalId,
  319. ContractApprovalRecordId:this.ContractApprovalRecordId,
  320. ContractId:this.ContractId
  321. })
  322. }
  323. setTimeout(()=>{
  324. this.showUpload=false
  325. this.files=[]
  326. if(this.ContractId!=0){
  327. this.getContractDetail()
  328. }else{
  329. this.getApprovalDetail()
  330. }
  331. },1000)
  332. }
  333. },
  334. // 上传回签附件文件
  335. async handleUploadMethod(type){
  336. let res=[]
  337. if(type==='img'){
  338. res=await uploadImg()
  339. }else if(type==='file'){
  340. res=await uploadFiles({type:'file'})
  341. }
  342. const reg = /\.(pdf)|\.doc|\.docx$/;
  343. if(!reg.test(res[0])){
  344. uni.showToast({
  345. title:'请上传pdf/word格式文件',
  346. icon:"none"
  347. })
  348. return
  349. }
  350. this.files=[{type:'pdf',url:res[0],img: require("@/pages-approve/static/pdf.png")}]
  351. // this.files=res.map((item) => {
  352. // if (reg.test(item)) {
  353. // return {
  354. // type: "pdf",
  355. // url: item,
  356. // img: require("@/pages-approve/static/pdf.png"),
  357. // };
  358. // } else {
  359. // return {
  360. // type: "img",
  361. // url: item,
  362. // img: item,
  363. // };
  364. // }
  365. // });
  366. this.show=false
  367. this.showUpload=true
  368. },
  369. // 审批单详情
  370. async getApprovalDetail() {
  371. const res=await apiContractApprovalDetail({
  372. ContractApprovalId:Number(this.ContractApprovalId),
  373. ContractApprovalRecordId:Number(this.ContractApprovalRecordId)
  374. })
  375. if(res.code===200){
  376. this.detail=res.data.ContractDetail
  377. this.opt=res.data.OpButton
  378. this.flowNodeList=res.data.FlowNodeList
  379. }
  380. },
  381. //合同详情
  382. async getContractDetail(){
  383. const res=await apiContractDetail({ContractId:Number(this.ContractId)})
  384. if(res.code===200){
  385. this.detail=res.data.ContractDetail
  386. this.opt=res.data.OpButton
  387. this.flowNodeList=res.data.FlowNodeList
  388. }
  389. },
  390. handlePreviewImg(url){
  391. uni.previewImage({
  392. urls:[url]
  393. })
  394. },
  395. // 预览合同文件
  396. preViewContract(e) {
  397. if (e.type === "pdf") {
  398. preViewFile(e.url)
  399. } else {
  400. this.handlePreviewImg(e.url)
  401. }
  402. },
  403. //审批通过
  404. async handlePass(){
  405. const res=await apiContractApproved({ContractId:Number(this.detail.ContractId)})
  406. if(res.code===200){
  407. this.$dialog.alert({
  408. title: "处理成功",
  409. confirmButtonColor: "#5890FB",
  410. }).then(() => {
  411. // on close
  412. // 当合同id 不存在时(或0) 使用审批详情
  413. if(this.ContractId!=0){
  414. this.getContractDetail()
  415. }else{
  416. this.getApprovalDetail()
  417. }
  418. // 更新列表
  419. uni.$emit('contractApproveListUpdate',{
  420. ContractApprovalId:this.ContractApprovalId,
  421. ContractApprovalRecordId:this.ContractApprovalRecordId,
  422. ContractId:this.ContractId
  423. })
  424. });
  425. }
  426. },
  427. //审批驳回
  428. handleRefuse(){
  429. uni.$once('contractApproveReject',()=>{
  430. // 更新列表
  431. uni.$emit('contractApproveListUpdate',{
  432. ContractApprovalId:this.ContractApprovalId,
  433. ContractApprovalRecordId:this.ContractApprovalRecordId,
  434. ContractId:this.ContractId
  435. })
  436. })
  437. uni.navigateTo({
  438. url:"./reason?ContractId="+this.detail.ContractId
  439. })
  440. }
  441. },
  442. }
  443. </script>
  444. <style lang="scss">
  445. .detail-page {
  446. width: 100%;
  447. min-height: 100%;
  448. padding-bottom: calc(150rpx + constant(safe-area-inset-bottom));
  449. padding-bottom: calc(150rpx + env(safe-area-inset-bottom));
  450. }
  451. .section {
  452. padding: 30rpx 34rpx;
  453. border-bottom: 14rpx solid #f5f5f5;
  454. &:last-child {
  455. margin-bottom: 0;
  456. border: none;
  457. }
  458. .title {
  459. font-size: 16px;
  460. font-weight: bold;
  461. margin: 0 0 40rpx 0;
  462. color: #333;
  463. }
  464. .lable {
  465. color: #666;
  466. flex-shrink: 0;
  467. font-size: 14px;
  468. }
  469. }
  470. .section::last-child{
  471. border: none;
  472. }
  473. .base-info-wrap {
  474. position: relative;
  475. .status-img{
  476. position: absolute;
  477. width: 222rpx;
  478. height: 222rpx;
  479. right: 0;
  480. top: 150rpx;
  481. z-index: 10;
  482. }
  483. .title {
  484. margin: 0 0 40rpx 0;
  485. &::before {
  486. content: "";
  487. display: inline-block;
  488. width: 15px;
  489. height: 17px;
  490. background-image: url("@/static/man.png");
  491. background-size: cover;
  492. background-repeat: no-repeat;
  493. margin-right: 10rpx;
  494. position: relative;
  495. top: 4rpx;
  496. }
  497. }
  498. .base-info-list {
  499. font-size: 14px;
  500. color: #000;
  501. view {
  502. margin-bottom: 10px;
  503. display: flex;
  504. }
  505. }
  506. }
  507. .contract-list {
  508. display: flex;
  509. flex-wrap: wrap;
  510. .contract-img {
  511. width: 102rpx;
  512. height: 120rpx;
  513. margin-right: 20rpx;
  514. margin-bottom: 20rpx;
  515. }
  516. }
  517. .service-wrap{
  518. color: #666;
  519. .service-item{
  520. margin-bottom: 30rpx;
  521. position: relative;
  522. justify-content: space-between;
  523. .btn{
  524. color: #3385FF;
  525. }
  526. // &::after{
  527. // content: '查看服务单';
  528. // display: inline-block;
  529. // color: #3385FF;
  530. // position: absolute;
  531. // left: 35%;
  532. // }
  533. }
  534. }
  535. .customer-main-info {
  536. padding-bottom: 40rpx;
  537. }
  538. .customer-info-item {
  539. font-size: 14px;
  540. color: #999;
  541. margin-bottom: 20rpx;
  542. }
  543. .customer-info-list {
  544. flex-wrap: wrap;
  545. padding-top: 20rpx;
  546. }
  547. .btns-wrap {
  548. justify-content: center;
  549. button {
  550. width: 260rpx;
  551. height: 70rpx;
  552. border-radius: 28px;
  553. border: none;
  554. margin: 0 15px;
  555. font-size: 15px;
  556. color: #fff;
  557. line-height: 70rpx;
  558. }
  559. .pass-btn {
  560. background-color: #5890fb;
  561. }
  562. .refuse-btn {
  563. background-color: #f55768;
  564. }
  565. }
  566. .uploadfile-wrap{
  567. width: 100%;
  568. height: 50vh;
  569. background-color: #FFFFFF;
  570. padding: 32rpx;
  571. button {
  572. margin-left: auto;
  573. margin-right: auto;
  574. width: 260rpx;
  575. height: 70rpx;
  576. display: block;
  577. border-radius: 28px;
  578. border: none;
  579. font-size: 15px;
  580. color: #fff;
  581. line-height: 70rpx;
  582. background-color: #5890fb;
  583. }
  584. }
  585. </style>