detail.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074
  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">归属公司
  6. <span class="tip">(归属公司:申请用章公司)</span>
  7. </view>
  8. <view :class="opButton.CheckEdit?'section-select-box':null" :style="{color:belongCompany?'#333':'#999'}" @click="handleOperation('showBelongCompanyPop')">{{belongCompany?belongCompany:'请选择'}}</view>
  9. </view><view class="section white-wrap">
  10. <view class="section-title require">用印用途</view>
  11. <view :class="opButton.CheckEdit?'section-select-box':null" :style="{color:newUse?'#333':'#999'}" @click="handleOperation('showPurpose')">{{newUse?newUse:'请选择'}}</view>
  12. </view>
  13. <view class="section white-wrap">
  14. <view class="section-title require">客户名称(全称)</view>
  15. <view>{{detail.CompanyName}}</view>
  16. </view>
  17. <view class="section white-wrap">
  18. <view class="section-title require">统一社会信用码</view>
  19. <input type="text" v-model="detail.CreditCode" placeholder="请填写统一社会信用码" disabled/>
  20. </view>
  21. <view class="section white-wrap">
  22. <view class="section-title">实际使用方名称</view>
  23. <input type="text" v-model="detail.UseCompanyName" placeholder="请填写实际使用方名称" disabled/>
  24. </view>
  25. <view class="section white-wrap">
  26. <view class="section-title require">业务类型</view>
  27. <input type="text" v-model="detail.ServiceType" placeholder="请填写业务类型" disabled/>
  28. </view>
  29. <view class="section white-wrap">
  30. <view class="section-title require">文件份数</view>
  31. <input type="number" v-model="newFileNum" placeholder="请填写总共盖章文件份数" :disabled="!opButton.CheckEdit"/>
  32. </view>
  33. <view class="section white-wrap">
  34. <view class="section-title require">加盖何种印章</view>
  35. <view :class="opButton.CheckEdit?'section-select-box':null" :style="{color:typeLength?'#333':'#999'}" @click="handleOperation('showType')">{{newSealType.length>0?newSealType.join(','):'请选择'}}</view>
  36. </view>
  37. <view class="section white-wrap" v-if="detail.ContractId>0">
  38. <view class="section-title require">合同附件<span>(合同来源:系统合同)</span> </view>
  39. <image
  40. :src="fileList[0].img"
  41. mode="aspectFill"
  42. style="width: 102rpx;height: 120rpx"
  43. @click="handlepreViewFile(fileList[0])">
  44. </image>
  45. </view>
  46. <view class="section white-wrap" v-else>
  47. <view class="section-title require">合同附件<span>(合同来源:上传附件)</span></view>
  48. <!-- 合规可修改上传 -->
  49. <!-- crm_8.7 支持上传多个附件 -->
  50. <div class="check-file-contain">
  51. <image @click="handleUpload" src="../static/upload-icon.png" mode="aspectFill"
  52. style="width: 102rpx;height: 120rpx;margin: 0 16rpx 24rpx 16rpx;"></image>
  53. <div class="check-file-box" :style="'background-image:url('+item.img+')'"
  54. @click="handlepreViewFile(item)" v-for="(item,index) in fileList" :key="item.url">
  55. <image class="del-icon" src="../static/del-icon.png" @click.stop="handleDeleteCheckFile(item)"></image>
  56. </div>
  57. </div>
  58. </view>
  59. <view class="section white-wrap" v-if="detail.Status==='已驳回'">
  60. <view class="section-title">驳回理由</view>
  61. <view style="color: #F55768;">{{detail.ApprovalRemark}}</view>
  62. </view>
  63. <view class="section white-wrap">
  64. <view class="section-title">备注</view>
  65. <textarea type="text" auto-height v-model="newRemark" placeholder="请填写备注" :disabled="!opButton.CheckEdit"></textarea>
  66. </view>
  67. <!-- 签回附件模块 -->
  68. <view class="section white-wrap" v-if="checkBackFilesRes&&checkBackFilesRes.length>0">
  69. <view class="section-title">签回附件</view>
  70. <image
  71. v-for="item in checkBackFilesRes"
  72. :key="item.url"
  73. :src="item.img"
  74. mode="aspectFill"
  75. style="width: 102rpx;height: 120rpx"
  76. @click="handlepreViewFile(item)">
  77. </image>
  78. </view>
  79. <!-- 流程模块 -->
  80. <view class="section white-wrap process-wrap">
  81. <view class="title" style="font-size: 16px;font-weight: bold;">审批流程</view>
  82. <steps :data="processData"></steps>
  83. </view>
  84. <!-- 审批/撤回申请 -->
  85. <view class="fix-bottom-wrap" style="text-align: center;" v-if="opButton.Approval||opButton.Cancel">
  86. <view class="flex" style="justify-content: space-between;width:100%">
  87. <van-button type="info" color="#3385FF" style="flex:1;" custom-class="btn-small" round @click="handleClickPass" v-if="opButton.Approval">通过</van-button>
  88. <van-button type="info" color="#F55768" style="flex:1;" custom-class="btn-small" round @click="handleApprovalReject" v-if="opButton.Approval">驳回</van-button>
  89. <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>
  90. </view>
  91. </view>
  92. <!-- 作废 -->
  93. <view class="fix-bottom-wrap flex" style="text-align: center;align-items:flex-end" v-if="opButton.Invalid||opButton.UploadFile">
  94. <view style="flex:1" v-if="opButton.Invalid">
  95. <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>
  96. <van-button type="info" color="#F55768" :custom-class="opButton.UploadFile?'btn-small':'btn-big'" round @click="handleSealInvalid">用印作废</van-button>
  97. </view>
  98. <van-button v-if="opButton.UploadFile" style="flex:1" type="info" color="#3385FF" :custom-class="opButton.Invalid?'btn-small':'btn-big'" round @click="handleUploadCheckFile">{{checkBackFilesRes.length>0?'更新回签附件':'上传回签附件'}}</van-button>
  99. </view>
  100. <!-- 重新提交 -->
  101. <view class="fix-bottom-wrap" style="text-align: center;" v-if="opButton.Edit">
  102. <van-button type="info" color="#3385FF" custom-class="btn-big" round @click="handleEdit">重新申请</van-button>
  103. </view>
  104. <!-- 撤回申请 -->
  105. <!-- <view class="fix-bottom-wrap" style="text-align: center;" v-if="opButton.Cancel">
  106. <van-button type="info" color="#3385FF" custom-class="btn-big" round @click="handleCancelApply">撤回申请</van-button>
  107. </view> -->
  108. <!-- 归属公司 -->
  109. <van-popup :show="showBelongCompanyPop" @close="showBelongCompanyPop=false" position="bottom">
  110. <van-picker
  111. ref="howBelongCompanyRef"
  112. show-toolbar
  113. title="选择归属公司"
  114. :columns="belongCompanyOptions"
  115. @confirm="handleComfirmBelongCmpany"
  116. @cancel="showBelongCompanyPop=false"
  117. />
  118. </van-popup>
  119. <!-- 用印用途 -->
  120. <van-popup :show="showPurpose" @close="showPurpose=false" position="bottom">
  121. <van-picker
  122. ref="showPurposeRef"
  123. show-toolbar
  124. title="选择用印用途"
  125. :columns="purposeArr"
  126. @confirm="handlePurposeConfirm"
  127. @cancel="showPurpose=false"
  128. />
  129. </van-popup>
  130. <!-- 何种印章 -->
  131. <van-popup :show="showType" @close="showType=false" position="bottom">
  132. <view class="type-popup-wrap">
  133. <view class="flex top-title">
  134. <text style="color:#969799" @click="showType=false">取消</text>
  135. <text style="font-size:16px">选择何种印章</text>
  136. <text style="color:#576b95" @click="handleTypeConfirm">确认</text>
  137. </view>
  138. <van-checkbox-group v-model="temType" @change="onChangeType">
  139. <van-checkbox shape="square" :name="item" v-for="item in typeArr" :key="item">{{item}}</van-checkbox>
  140. </van-checkbox-group>
  141. </view>
  142. </van-popup>
  143. <!-- 客户搜索 -->
  144. <van-popup :show="showCustome" @close="showCustome=false" position="bottom" custom-style="height: 100vh">
  145. <view class="custome-search-wrap">
  146. <van-search use-left-icon-slot use-action-slot shape="round" :value="searchCustomeVal" placeholder="请输入客户名称/社会信用码" @change="onSearchValChange" @search="onSearch"
  147. custom-class="search-box" field-class="search-con">
  148. <view slot="left-icon">
  149. <image src="../static/search-icon.png" mode="aspectFill" class="search-icon"></image>
  150. </view>
  151. <view slot="action" @click="showCustome=false" class="search-btn">取消</view>
  152. </van-search>
  153. <view class="search-result">
  154. <view class="result-custome-box" v-if="searchContractList.length===0">
  155. <view class="result-item flex" v-for="item in searchCustomeList" :key="item" @click="getContract(item)">
  156. <image src="../static/search-icon.png" mode="aspectFill" class="search-icon"></image>
  157. <view class="con van-ellipsis">{{item}}</view>
  158. <image src="../static/click-icon.png" mode="aspectFill" class="click-icon"></image>
  159. </view>
  160. </view>
  161. <view class="result-contract-box" v-else>
  162. <view class="result-contract-item" v-for="item in searchContractList" :key="item.ContractId" @click="handleChooseContract(item)">
  163. <view class="name">{{item.CompanyName}}</view>
  164. <view style="margin-top: 20rpx;">合同编号:{{item.ContractCode}}</view>
  165. <view style="margin-top: 20rpx;">合同类型:{{item.ContractType}}</view>
  166. <view style="margin-top: 20rpx;">合同金额:{{item.Price}}</view>
  167. </view>
  168. </view>
  169. </view>
  170. </view>
  171. </van-popup>
  172. <!-- 上传回签附件弹窗确认弹窗 -->
  173. <van-popup :show="showConfirmCheckBackfile" @close="showConfirmCheckBackfile=false" position="bottom" round>
  174. <view class="uploadfile-wrap">
  175. <view style="text-align: center;font-size: 16px;font-weight: bold;">上传回签附件</view>
  176. <view class="contract-list" style="height: 30vh;">
  177. <view class="contract-item" v-for="item in checkBackFiles" :key="item.url"
  178. @click="handlepreViewCheckFile(item)">
  179. <image class="contract-img" mode="aspectFill" :src="item.img"></image>
  180. </view>
  181. </view>
  182. <button style="width: 450rpx;" @click='handleConfirmCheckBackFile'>确定</button>
  183. </view>
  184. </van-popup>
  185. <van-dialog id="van-dialog" />
  186. </view>
  187. </template>
  188. <script>
  189. import {
  190. apiSealDetail,
  191. apiSearchCustome,
  192. apiSearchContract,
  193. apiApprovalPass,
  194. apiInvalidSeal,
  195. apiApprovalPassModify,
  196. apiSealCancelApply,
  197. apiFlowDetail,
  198. apiSealCheckBackFiles,
  199. getBelongCompany
  200. } from '@/api/approve/seal.js'
  201. import steps from '../components/steps.vue'
  202. import {preViewFile} from '../utils/util.js'
  203. import {uploadFiles} from '@/utils/uploadFile.js'
  204. export default{
  205. components:{
  206. steps
  207. },
  208. computed:{
  209. typeLength() {
  210. if (this.newSealType.length > 0) {
  211. return true;
  212. } else {
  213. return false;
  214. }
  215. },
  216. statusImg(){
  217. if(this.detail.Status==='已审批'){
  218. return require('../static/pass-icon.png')
  219. }else if(this.detail.Status==='已驳回'){
  220. return require('../static/fail-icon.png')
  221. }else if(this.detail.Status==='处理中'){
  222. return require('../static/processing-icon.png')
  223. }else if(this.detail.Status==='已撤回'){
  224. return require('../static/recall-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/draw-back-icon.png')
  229. }
  230. },
  231. //页面显示的回签附件
  232. checkBackFilesRes(){
  233. const reg = /\.(pdf)$/;
  234. return this.detail&&this.detail.CheckBackFileUrl&&this.detail.CheckBackFileUrl.split("#").map((item) => {
  235. if (reg.test(item)) {
  236. return {
  237. type: "pdf",
  238. url: item,
  239. img: require("@/pages-approve/static/pdf.png"),
  240. };
  241. } else {
  242. return {
  243. type: "word",
  244. url: item,
  245. img: require("@/pages-approve/static/word.png"),
  246. };
  247. }
  248. });
  249. }
  250. },
  251. watch: {
  252. showType() {
  253. if (!this.showType) {
  254. this.temType = JSON.parse(JSON.stringify(this.newSealType));
  255. }
  256. }
  257. },
  258. data() {
  259. return {
  260. checkBackFiles:[],// 上传的签回附件文件
  261. showConfirmCheckBackfile:false,//确认上传的签回附件弹窗
  262. ContractApprovalId:0,
  263. ContractApprovalRecordId:0,
  264. SealId:0,
  265. processData:null,
  266. detail:{},
  267. opButton:{},
  268. // files:{
  269. // type:'',
  270. // img:'',
  271. // url:''
  272. // },//合同附件
  273. // 上传的附件列表 需求更改,可上传多个附件 crm-8.7
  274. fileList:[],
  275. showPurpose:false,//显示用印用途选项
  276. purposeArr: ["销售合同", "代付合同", "总对总协议", "渠道合同", "付款通知函", "招投标", "战略合作协议"],
  277. showType:false,//显示用印用途选项
  278. typeArr:['合同章','公章','法人章',"电子合同章"],
  279. temType: [], //临时存放选择的用印用途
  280. showCustome:false,//显示搜索客户名称
  281. searchCustomeVal:'',//搜索客户输入数据
  282. searchCustomeList:[],//搜索到的客户名称列表
  283. searchContractList:[],//选择搜索中的客户后合同列表数据
  284. checked:false,//是否同时作废合同
  285. newUse:"",
  286. newFileNum:'',
  287. newSealType:[],
  288. newRemark:'',
  289. oldFile:'',
  290. //归属公司弹窗
  291. showBelongCompanyPop:false,
  292. belongCompany:'',
  293. belongCompanyOptions:[]
  294. }
  295. },
  296. onLoad(options) {
  297. this.ContractApprovalId=options.ContractApprovalId||0
  298. this.ContractApprovalRecordId=options.ContractApprovalRecordId||0
  299. this.SealId=options.SealId||0
  300. this.getDetail()
  301. this.getBelongCompanyOptions()
  302. },
  303. onShow() {
  304. uni.$once('updateSealDetail',(data)=>{
  305. console.log('监听到事件来自updateSealDetail ,携带参数 msg 为:' + data.msg);
  306. this.getDetail()
  307. })
  308. },
  309. onPullDownRefresh() {
  310. this.getDetail()
  311. setTimeout(()=>{
  312. uni.stopPullDownRefresh()
  313. },1000)
  314. },
  315. methods: {
  316. async getBelongCompanyOptions() {
  317. const res = await getBelongCompany()
  318. if(res.code !==200 ) return
  319. this.belongCompanyOptions = res.data || []
  320. },
  321. // 上传(更新)签回附件
  322. handleUploadCheckFile(){
  323. wx.chooseMessageFile({
  324. count:1,
  325. type:'file',
  326. success:(res)=>{
  327. const tempFile=res.tempFiles[0]
  328. const reg = /\.(pdf)$/;
  329. const reg2= /\.doc|\.docx$/
  330. if(!reg.test(tempFile.path)&&!reg2.test(tempFile.path)){
  331. uni.showToast({
  332. title:'请上传pdf/word格式文件',
  333. icon:"none"
  334. })
  335. return
  336. }
  337. // pdf
  338. if(reg.test(tempFile.path)){
  339. this.checkBackFiles=[{type:'pdf',url:tempFile.path,img: require("@/pages-approve/static/pdf.png")}]
  340. }
  341. if(reg2.test(tempFile.path)){
  342. this.checkBackFiles=[{type:'word',url:tempFile.path,img: require("@/pages-approve/static/word.png")}]
  343. }
  344. this.showConfirmCheckBackfile=true
  345. },
  346. fail:(error)=>{
  347. if(error.errMsg.indexOf('not supported')){
  348. uni.showToast({
  349. title:'请通过手机上传附件',
  350. icon:'none'
  351. })
  352. }
  353. }
  354. })
  355. // const res=await uploadFiles({type:'file'})
  356. // const reg = /\.(pdf)$/;
  357. // const reg2= /\.doc|\.docx$/
  358. // if(reg.test(res[0])){
  359. // this.checkBackFiles=[{
  360. // type:'pdf',
  361. // url:res[0],
  362. // img:require('../static/pdf.png')
  363. // }]
  364. // this.showConfirmCheckBackfile=true
  365. // }else if(reg2.test(res[0])){
  366. // this.checkBackFiles=[{
  367. // type:'word',
  368. // url:res[0],
  369. // img:require('../static/word.png')
  370. // }]
  371. // this.showConfirmCheckBackfile=true
  372. // }else{
  373. // uni.showToast({
  374. // title:'请上传pdf/word格式文件',
  375. // icon:"none"
  376. // })
  377. // }
  378. },
  379. //确认上传的签回附件
  380. async handleConfirmCheckBackFile(){
  381. const temres=await apiSealCheckBackFiles({
  382. SealId:Number(this.detail.SealId),
  383. tempPath:this.checkBackFiles[0].url
  384. })
  385. const res=JSON.parse(temres.data)
  386. if(res.code===200){
  387. uni.showToast({
  388. title:'操作成功',
  389. icon:'none'
  390. })
  391. // 如果是已审批上传回签附件则更新列表页
  392. if(this.detail.Status==='已审批'){
  393. this.handleUpdateList()
  394. }
  395. setTimeout(()=>{
  396. this.checkBackFiles=[]
  397. this.showConfirmCheckBackfile=false
  398. this.getDetail()
  399. },500)
  400. }
  401. // let FileUrlarr=this.checkBackFiles.map(item=>item.url)
  402. // const res=await apiSealCheckBackFiles({
  403. //
  404. // FileUrl:FileUrlarr.join('#')
  405. // })
  406. // if(res.code===200){
  407. // uni.showToast({
  408. // title:'操作成功',
  409. // icon:'none'
  410. // })
  411. // // 如果是已审批上传回签附件则更新列表页
  412. // if(this.detail.Status==='已审批'){
  413. // this.handleUpdateList()
  414. // }
  415. // setTimeout(()=>{
  416. // this.checkBackFiles=[]
  417. // this.showConfirmCheckBackfile=false
  418. // this.getDetail()
  419. // },500)
  420. // }
  421. },
  422. // 预览要上传的签回附件
  423. handlepreViewCheckFile(){
  424. uni.openDocument({
  425. filePath:this.checkBackFiles[0].url,
  426. showMenu:true,
  427. success() {
  428. console.log('打开成功');
  429. },
  430. fail(){
  431. setTimeout(() => {
  432. uni.showToast({
  433. title:'打开失败,请重试',
  434. icon:"none"
  435. })
  436. }, 0);
  437. }
  438. })
  439. },
  440. // 更新列表页
  441. handleUpdateList(){
  442. uni.$emit('sealApproveListUpdate',{
  443. ContractApprovalId:this.ContractApprovalId,
  444. ContractApprovalRecordId:this.ContractApprovalRecordId,
  445. SealId:this.SealId
  446. })
  447. },
  448. // 合规删除合同附件
  449. handleDeleteCheckFile(file){
  450. this.fileList = this.fileList.filter(item => item.url!= file.url)
  451. },
  452. //合规上传附件
  453. async handleUpload(){
  454. const res=await uploadFiles({type:'all'})
  455. const reg = /\.(pdf)$/;
  456. const reg2 = /\.doc|\.docx$/;
  457. if (reg.test(res[0])) {
  458. this.fileList.push({
  459. type: "pdf",
  460. url: res[0],
  461. img: require("../static/pdf.png"),
  462. });
  463. } else if (reg2.test(res[0])) {
  464. this.fileList.push({
  465. type: "word",
  466. url: res[0],
  467. img: require("../static/word.png"),
  468. });
  469. } else {
  470. this.fileList.push({
  471. type: "img",
  472. url: res[0],
  473. img: res[0],
  474. });
  475. }
  476. },
  477. // 撤回申请
  478. handleCancelApply(){
  479. this.$dialog.confirm({
  480. title: '提示',
  481. message: '是否确认撤回',
  482. }).then(async ()=>{
  483. const res=await apiSealCancelApply({SealId:Number(this.detail.SealId)})
  484. if(res.code===200){
  485. uni.showToast({
  486. title:'撤回成功',
  487. icon:'none'
  488. })
  489. this.handleUpdateList()
  490. this.getDetail()
  491. }
  492. }).catch(() => {
  493. console.log('取消撤回');
  494. });
  495. },
  496. //归属公司选择
  497. handleComfirmBelongCmpany(e) {
  498. this.belongCompany = e.detail.value;
  499. this.showBelongCompanyPop = false;
  500. },
  501. handlePurposeConfirm(e){
  502. this.newUse=e.detail.value
  503. this.showPurpose=false
  504. },
  505. // 确认盖章类型
  506. handleTypeConfirm(e){
  507. this.newSealType=JSON.parse(JSON.stringify(this.temType))
  508. this.showType=false
  509. this.getProcessData()
  510. },
  511. // 盖章类型变换
  512. onChangeType(e){
  513. this.temType=e.detail
  514. },
  515. //前去重审
  516. handleEdit(){
  517. uni.$once('sealEditSubmit',()=>{
  518. this.handleUpdateList()
  519. })
  520. uni.navigateTo({
  521. url:`./edit?ContractApprovalId=${this.ContractApprovalId}&ContractApprovalRecordId=${this.ContractApprovalRecordId}&SealId=${this.SealId}`
  522. })
  523. },
  524. //用印作废
  525. handleSealInvalid(){
  526. this.$dialog.confirm({
  527. title: '提示',
  528. message: '是否确认作废',
  529. }).then(async ()=>{
  530. const res=await apiInvalidSeal({
  531. IsInvalidContract:this.checked,
  532. SealId:this.detail.SealId
  533. })
  534. if(res.code===200){
  535. uni.showToast({
  536. title:'操作成功',
  537. icon:'none'
  538. })
  539. this.handleUpdateList()
  540. this.getDetail()
  541. }
  542. }).catch(() => {
  543. console.log('取消作废');
  544. });
  545. },
  546. //点击通过
  547. handleClickPass(){
  548. //判断是否有内容修改
  549. const flag1=this.newUse===this.detail.Use
  550. const flag2=Number(this.newFileNum)===Number(this.detail.FileNum)
  551. // const flag3=this.newSealType.join(',')===this.detail.SealType
  552. const flag3=this.isArrEqual(this.newSealType,this.detail.SealType.split(','))
  553. const flag4=this.newRemark===this.detail.Remark
  554. const flag6=this.belongCompany===this.detail.AffiliatedCompany
  555. const flag5= JSON.stringify(this.fileList.map(file => file.url))===JSON.stringify(this.detail.FileUrls)
  556. if(flag1&&flag2&&flag3&&flag4&&flag5&&flag6){
  557. this.handleApprovalPass()
  558. }else{
  559. this.handleApprovePassModify()
  560. }
  561. },
  562. //判断两个数组是否相同
  563. isArrEqual(arr1, arr2){
  564. return arr1.length === arr2.length && arr1.every((ele) => arr2.includes(ele));
  565. },
  566. //审批通过 (修改内容)
  567. async handleApprovePassModify(){
  568. if(!this.newFileNum){
  569. uni.showToast({
  570. title:'请填写文件份数',
  571. icon:"none"
  572. })
  573. return
  574. }
  575. if(this.newFileNum<1){
  576. uni.showToast({
  577. title:'文件份数不合法',
  578. icon:"none"
  579. })
  580. return
  581. }
  582. if(!this.newSealType){
  583. uni.showToast({
  584. title:'印章类型不能为空',
  585. icon:"none"
  586. })
  587. return
  588. }
  589. if(!this.belongCompany){
  590. uni.showToast({
  591. title:'请选择归属公司',
  592. icon:"none"
  593. })
  594. return
  595. }
  596. if(!this.newUse){
  597. uni.showToast({
  598. title:'请选择用印用途',
  599. icon:"none"
  600. })
  601. return
  602. }
  603. if(!this.fileList || this.fileList.length==0){
  604. uni.showToast({
  605. title:'合同附件不能为空',
  606. icon:"none"
  607. })
  608. return
  609. }
  610. const res=await apiApprovalPassModify({
  611. FileNum:Number(this.newFileNum),
  612. Remark:this.newRemark,
  613. AffiliatedCompany:this.belongCompany,
  614. SealId:Number(this.detail.SealId),
  615. SealType:this.newSealType.join(','),
  616. Use:this.newUse,
  617. FileUrls:this.fileList.map(file => file.url)
  618. })
  619. if(res.code===200){
  620. this.$dialog.alert({
  621. title: "处理成功",
  622. confirmButtonColor: "#5890FB",
  623. }).then(() => {
  624. this.handleUpdateList()
  625. this.getDetail()
  626. });
  627. }
  628. },
  629. // 审批通过 (未修改内容)
  630. async handleApprovalPass(){
  631. const res=await apiApprovalPass({
  632. SealId:Number(this.detail.SealId),
  633. Remark:""
  634. })
  635. if(res.code===200){
  636. this.$dialog.alert({
  637. title: "处理成功",
  638. confirmButtonColor: "#5890FB",
  639. }).then(() => {
  640. this.handleUpdateList()
  641. this.getDetail()
  642. });
  643. }
  644. },
  645. //驳回
  646. handleApprovalReject(){
  647. uni.$once('sealApproveReject',()=>{
  648. this.handleUpdateList()
  649. })
  650. uni.navigateTo({
  651. url:`./reason?SealId=${this.detail.SealId}`
  652. })
  653. },
  654. //预览文件
  655. handlepreViewFile(e){
  656. if (e.type === "pdf"||e.type==='word') {
  657. preViewFile(e.url)
  658. } else {
  659. uni.previewImage({
  660. urls: [e.url]
  661. })
  662. }
  663. },
  664. // 只有当 checkEdit 为true 即合规才能修改
  665. handleOperation(key){
  666. if(this.opButton.CheckEdit){
  667. if(key==='showBelongCompanyPop'){
  668. let index=this.belongCompanyOptions.findIndex(el=>el===this.belongCompany)
  669. if(index>-1){
  670. this.$refs.howBelongCompanyRef.setColumnIndex(0, index)
  671. }
  672. }else if(key==='showPurpose'){
  673. let index=this.purposeArr.findIndex(el=>el===this.newUse)
  674. if(index>-1){
  675. this.$refs.showPurposeRef.setColumnIndex(0, index)
  676. }
  677. }
  678. this[key]=true
  679. }
  680. },
  681. // 客户搜索
  682. // 先搜索出客户 再通过客户去请求出客户下面存在的合同
  683. onSearchValChange(e){
  684. this.searchCustomeVal=e.detail
  685. },
  686. //搜索客户
  687. async onSearch(){
  688. if(!this.searchCustomeVal){
  689. uni.showToast({
  690. title:'请输入搜索关键字',
  691. icon:'none'
  692. })
  693. return
  694. }
  695. this.searchContractList=[]
  696. this.searchCustomeList=[]
  697. const res=await apiSearchCustome({Keyword:this.searchCustomeVal})
  698. if(res.code===200){
  699. this.searchCustomeList=res.data
  700. }
  701. },
  702. // 搜索客户对应的合同
  703. async getContract(e){
  704. const res=await apiSearchContract({Keyword:e})
  705. if(res.code===200){
  706. if(res.data.List){
  707. this.searchContractList=res.data.List
  708. }else{
  709. uni.showToast({
  710. title:"此客户无合同,请重新选择",
  711. icon:"none"
  712. })
  713. }
  714. }
  715. },
  716. // 选择合同 更新表单数据
  717. handleChooseContract(e){
  718. this.detail.CompanyName=e.CompanyName
  719. this.detail.ServiceType=e.ContractType
  720. this.detail.CreditCode=e.CreditCode
  721. this.detail.UseCompanyName=e.CompanyName
  722. this.detail.ContractId=e.ContractId
  723. this.detail.ContractfileUrl=e.FileUrl
  724. // 关闭搜索弹窗
  725. this.showCustome=false
  726. this.searchCustomeVal=''
  727. this.searchContractList=[]
  728. this.searchCustomeList=[]
  729. },
  730. //合同章5 公章、法人章 6
  731. async getProcessData(){
  732. if(this.newSealType.length===0) return
  733. let id=0
  734. if (this.newSealType.includes("公章") || this.newSealType.includes("法人章")) {
  735. id = 6;
  736. } else {
  737. id = 5;
  738. }
  739. let res=await apiFlowDetail({FlowId:id})
  740. if(res.code===200){
  741. this.processData=res.data||null
  742. }
  743. },
  744. //获取详情
  745. async getDetail() {
  746. const res=await apiSealDetail({
  747. ContractApprovalId:Number(this.ContractApprovalId),
  748. ContractApprovalRecordId:Number(this.ContractApprovalRecordId),
  749. SealId:Number(this.SealId)
  750. })
  751. if(res.code===200){
  752. this.detail=res.data.SealDetail
  753. this.newUse=res.data.SealDetail.Use
  754. this.newFileNum=res.data.SealDetail.FileNum
  755. this.newSealType=res.data.SealDetail.SealType.split(',')
  756. this.temType=res.data.SealDetail.SealType.split(',')
  757. this.newRemark=res.data.SealDetail.Remark
  758. this.belongCompany=res.data.SealDetail.AffiliatedCompany
  759. this.processData=res.data.FlowNodeList
  760. this.opButton=res.data.OpButton
  761. this.handleFile(res.data.SealDetail.FileUrls)
  762. }
  763. },
  764. //处理文件
  765. handleFile(filesUrls){
  766. // 清空 防止操作成功后再获取详情 数组叠加
  767. this.fileList=[]
  768. const reg = /\.(pdf)$/;
  769. const reg2= /\.doc|\.docx$/
  770. filesUrls.map(filesUrl=>{
  771. if(reg.test(filesUrl)){
  772. this.fileList.push({
  773. type: "pdf",
  774. url: filesUrl,
  775. img: require("../static/pdf.png"),
  776. })
  777. }else if(reg2.test(filesUrl)){
  778. this.fileList.push({
  779. type: "word",
  780. url: filesUrl,
  781. img: require("../static/word.png"),
  782. })
  783. }else{
  784. this.fileList.push({
  785. type: "img",
  786. url: filesUrl,
  787. img: filesUrl,
  788. })
  789. }
  790. })
  791. },
  792. },
  793. }
  794. </script>
  795. <style lang="scss">
  796. .uploadfile-wrap{
  797. width: 100%;
  798. height: 50vh;
  799. background-color: #FFFFFF;
  800. padding: 32rpx;
  801. button {
  802. margin-left: auto;
  803. margin-right: auto;
  804. width: 260rpx;
  805. height: 70rpx;
  806. display: block;
  807. border-radius: 28px;
  808. border: none;
  809. font-size: 15px;
  810. color: #fff;
  811. line-height: 70rpx;
  812. background-color: #5890fb;
  813. }
  814. .contract-list {
  815. display: flex;
  816. flex-wrap: wrap;
  817. .contract-img {
  818. width: 102rpx;
  819. height: 120rpx;
  820. margin-right: 20rpx;
  821. margin-bottom: 20rpx;
  822. }
  823. }
  824. }
  825. .check-file-contain{
  826. display: flex;
  827. flex-wrap: wrap;
  828. .check-file-box{
  829. width: 102rpx;
  830. height: 120rpx;
  831. background-size: cover;
  832. background-position: center;
  833. position: relative;
  834. margin: 0 16rpx;
  835. .del-icon{
  836. position: absolute;
  837. width: 30rpx;
  838. height: 30rpx;
  839. top: -15rpx;
  840. right: -15rpx;
  841. }
  842. }
  843. }
  844. .detail{
  845. width: 100%;
  846. min-height: 100vh;
  847. padding-bottom: calc(150rpx + constant(safe-area-inset-bottom));
  848. padding-bottom: calc(150rpx + env(safe-area-inset-bottom));
  849. position: relative;
  850. }
  851. .status-img{
  852. position: absolute;
  853. right: 0;
  854. top: 320rpx;
  855. width: 220rpx;
  856. height: 220rpx;
  857. z-index: 10;
  858. }
  859. .section{
  860. padding: 30rpx 34rpx;
  861. border-top: 10rpx solid #F5F5F5;
  862. position: relative;
  863. .section-title{
  864. font-size: 16px;
  865. margin-bottom: 20rpx;
  866. span{
  867. font-size: 28rpx;
  868. font-family: PingFang SC-Regular, PingFang SC;
  869. font-weight: 400;
  870. color: #999999;
  871. -webkit-background-clip: text;
  872. background-clip: text;
  873. }
  874. .tip {
  875. font-size: 12px;
  876. color: #999;
  877. }
  878. }
  879. .require::before{
  880. content: '*';
  881. font-size: 16px;
  882. color: #FF0000;
  883. position: absolute;
  884. left: 20rpx;
  885. }
  886. .section-select-box{
  887. color: #999;
  888. position: relative;
  889. &::after{
  890. position: absolute;
  891. right: 0;
  892. top: 50%;
  893. content: '';
  894. display: block;
  895. width: 18rpx;
  896. height: 18rpx;
  897. border-top: 1px solid #999;
  898. border-right: 1px solid #999;
  899. transform: translateY(-50%) rotate(45deg);
  900. }
  901. }
  902. }
  903. .btn-big{
  904. width: 450rpx;
  905. }
  906. .btn-small{
  907. min-width: 220rpx;
  908. }
  909. .fix-bottom-wrap{
  910. button{
  911. height: 70rpx;
  912. font-size: 15px;
  913. }
  914. }
  915. .custome-search-wrap{
  916. padding: 34rpx;
  917. height: 100%;
  918. .search-box {
  919. border: 1px solid #3385FF;
  920. padding: 0 !important;
  921. border-radius: 60rpx;
  922. background-color: #fff !important;
  923. }
  924. .search-con {
  925. background-color: #fff !important;
  926. }
  927. .van-search__content {
  928. background-color: #fff !important;
  929. padding-left: 30rpx !important;
  930. }
  931. .search-btn {
  932. position: relative;
  933. color: #3385FF;
  934. &::before {
  935. content: '';
  936. display: block;
  937. width: 1px;
  938. height: 60%;
  939. background-color: #D1D1D1;
  940. position: absolute;
  941. left: -16rpx;
  942. top: 20%;
  943. }
  944. }
  945. .search-icon{
  946. width: 40rpx;
  947. height: 40rpx;
  948. display: block;
  949. position: relative;
  950. top: 4rpx;
  951. margin-right: 20rpx;
  952. }
  953. .click-icon{
  954. width: 24rpx;
  955. height: 24rpx;
  956. }
  957. .result-item{
  958. align-items: center;
  959. padding: 20rpx 0;
  960. border-bottom: 1px solid #EBEBEB;
  961. .con{
  962. flex: 1;
  963. margin-right: 20rpx;
  964. }
  965. }
  966. .search-result{
  967. overflow-y: auto;
  968. height: 100%;
  969. }
  970. .result-contract-box{
  971. padding: 0 10rpx;
  972. .result-contract-item{
  973. margin-top: 30rpx;
  974. box-shadow: 0px 0px 12rpx rgba(175, 175, 175, 0.38);
  975. padding: 30rpx;
  976. border-radius: 8px;
  977. .name{
  978. font-size: 16px;
  979. font-weight: bold;
  980. &::before{
  981. content:'';
  982. display:inline-block;
  983. width: 31rpx;
  984. height: 34rpx;
  985. background-image: url(../../static/man.png);
  986. background-size: cover;
  987. position: relative;
  988. top: 4rpx;
  989. margin-right: 10rpx;
  990. }
  991. }
  992. }
  993. }
  994. }
  995. .type-popup-wrap{
  996. padding: 20rpx 32rpx;
  997. height: 280px;
  998. .top-title{
  999. justify-content: space-between;
  1000. margin-bottom: 124rpx;
  1001. }
  1002. .van-checkbox{
  1003. margin-bottom: 30rpx;
  1004. width: 300rpx;
  1005. margin-left: auto;
  1006. margin-right: auto;
  1007. }
  1008. }
  1009. </style>