detail.vue 15 KB

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