edit.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. <template>
  2. <view class="add-page white-wrap">
  3. <view class="section white-wrap">
  4. <view class="section-title require">用印用途</view>
  5. <view class="section-select-box" :style="{color:purpose?'#333':'#999'}" @click="showPurpose=true">{{purpose?purpose:'请选择'}}</view>
  6. </view>
  7. <!-- 系统合同模块 -->
  8. <view v-if="radioVal==='系统合同'">
  9. <view class="section white-wrap">
  10. <view class="section-title require">客户名称(全称)</view>
  11. <view
  12. class="section-select-box"
  13. :style="{color:customeName?'#333':'#999'}"
  14. @click="showCustome=true"
  15. >
  16. {{customeName?customeName:'请输入客户名称'}}
  17. </view>
  18. </view>
  19. <view class="section white-wrap" v-if="CreditCode">
  20. <view class="section-title require">统一社会信用码</view>
  21. <input type="text" v-model="CreditCode" placeholder="请填写统一社会信用码" disabled/>
  22. </view>
  23. <view class="section white-wrap" v-if="UseCompanyName">
  24. <view :class="['section-title',purpose=='代付合同'?'require':'']">实际使用方名称</view>
  25. <input type="text" v-model="UseCompanyName" placeholder="请填写实际使用方名称" disabled/>
  26. </view>
  27. <view class="section white-wrap" v-if="ServiceType">
  28. <view class="section-title require">业务类型</view>
  29. <view :style="{color:ServiceType?'#333':'#999'}">{{ServiceType?ServiceType:'请选择业务类型'}}</view>
  30. </view>
  31. </view>
  32. <!-- 上传附件模块 -->
  33. <view v-if="radioVal==='上传附件'">
  34. <view class="section white-wrap" style="position:relative">
  35. <view class="section-title require">客户名称(全称)</view>
  36. <input type="text" v-model="customeName" @input="handleAllCutomeInput" placeholder="请输入客户名称"/>
  37. <view class="show-all-custome-box" v-if="allCustome.list.length>0">
  38. <scroll-view scroll-y @scrolltolower="handleScrollToLower" style="height: 100%;width:100%">
  39. <view
  40. class="all-custome-item"
  41. v-for="item in allCustome.list"
  42. :key="item.CompanyId"
  43. @click="chooseAllCustomeItem(item)"
  44. >{{item.CompanyName}}</view>
  45. </scroll-view>
  46. </view>
  47. </view>
  48. <view class="section white-wrap">
  49. <view class="section-title require">统一社会信用码</view>
  50. <input type="text" v-model="CreditCode" placeholder="请填写统一社会信用码"/>
  51. </view>
  52. <view class="section white-wrap">
  53. <view :class="['section-title',purpose=='代付合同'?'require':'']">实际使用方名称</view>
  54. <input type="text" v-model="UseCompanyName" placeholder="请填写实际使用方名称"/>
  55. </view>
  56. <view class="section white-wrap">
  57. <view class="section-title require">业务类型</view>
  58. <view class="section-select-box" :style="{color:ServiceType?'#333':'#999'}" @click="showServiceType=true">{{ServiceType?ServiceType:'请选择业务类型'}}</view>
  59. </view>
  60. </view>
  61. <view class="section white-wrap">
  62. <view class="section-title require">文件份数</view>
  63. <input type="number" v-model="fileNum" placeholder="请填写总共盖章文件份数"/>
  64. </view>
  65. <view class="section white-wrap">
  66. <view class="section-title require">加盖何种印章</view>
  67. <view class="section-select-box" :style="{color:typeLength?'#333':'#999'}" @click="showType=true">{{type.length>0?type.join(','):'请选择'}}</view>
  68. </view>
  69. <view class="section white-wrap">
  70. <view class="section-title">备注</view>
  71. <textarea type="text" auto-height v-model="remark" placeholder="请填写备注"></textarea>
  72. </view>
  73. <view class="section white-wrap" v-if="radioVal==='系统合同'&& fileList &&fileList.length>0">
  74. <view class="section-title require">合同附件</view>
  75. <image src="../static/pdf.png" mode="aspectFill" style="width: 102rpx;height: 120rpx;" @click="handlePreviewFiles(fileList[0])"></image>
  76. </view>
  77. <view class="section white-wrap" v-if="radioVal==='上传附件'">
  78. <view class="section-title require">附件上传</view>
  79. <!-- crm_8.7 支持上传多个附件 -->
  80. <div class="check-file-contain">
  81. <image @click="handleUpload" src="../static/upload-icon.png" mode="aspectFill"
  82. style="width: 102rpx;height: 120rpx;margin: 0 16rpx 24rpx 16rpx;"></image>
  83. <div class="check-file-box" :style="'background-image:url('+item.img+')'"
  84. @click="handlePreviewFiles(item)" v-for="(item,index) in fileList" :key="item.url">
  85. <image class="del-icon" src="../static/del-icon.png" @click.stop="handleDeleteCheckFile(item)"></image>
  86. </div>
  87. </div>
  88. </view>
  89. <!-- 流程模块 -->
  90. <view class="section white-wrap process-wrap" v-if="processData">
  91. <view class="title" style="font-size: 16px;font-weight: bold;">审批流程</view>
  92. <steps :data="processData"></steps>
  93. </view>
  94. <view class="fix-bottom-wrap" style="text-align: center;">
  95. <van-button type="info" custom-class="btn" round @click="handleSubmit">提交</van-button>
  96. </view>
  97. <!-- 用印用途 -->
  98. <van-popup :show="showPurpose" @close="showPurpose=false" position="bottom">
  99. <van-picker
  100. show-toolbar
  101. title="选择用印用途"
  102. :columns="purposeArr"
  103. @confirm="handlePurposeConfirm"
  104. @cancel="showPurpose=false"
  105. />
  106. </van-popup>
  107. <!-- 何种印章 -->
  108. <van-popup :show="showType" @close="showType=false" position="bottom">
  109. <view class="type-popup-wrap">
  110. <view class="flex top-title">
  111. <text style="color:#969799" @click="showType=false">取消</text>
  112. <text style="font-size:16px">选择何种印章</text>
  113. <text style="color:#576b95" @click="handleTypeConfirm">确认</text>
  114. </view>
  115. <van-checkbox-group v-model="temType" @change="onChangeType">
  116. <van-checkbox shape="square" :name="item" v-for="item in typeArr" :key="item">{{item}}</van-checkbox>
  117. </van-checkbox-group>
  118. </view>
  119. </van-popup>
  120. <!-- 业务类型 -->
  121. <van-popup :show="showServiceType" @close="showServiceType=false" position="bottom">
  122. <van-picker
  123. show-toolbar
  124. title="选择业务类型"
  125. :columns="ServiceTypeArr"
  126. @confirm="handleServiceTypeConfirm"
  127. @cancel="showServiceType=false"
  128. />
  129. </van-popup>
  130. <!-- 客户搜索 -->
  131. <van-popup :show="showCustome" @close="showCustome=false" position="bottom" custom-style="height: 100vh">
  132. <view class="custome-search-wrap">
  133. <van-search use-left-icon-slot use-action-slot shape="round" :value="searchCustomeVal" placeholder="请输入客户名称/社会信用码" @change="onSearchValChange" @search="onSearch"
  134. custom-class="search-box" field-class="search-con">
  135. <view slot="left-icon">
  136. <image src="../static/search-icon.png" mode="aspectFill" class="search-icon"></image>
  137. </view>
  138. <view slot="action" @click="showCustome=false" class="search-btn">取消</view>
  139. </van-search>
  140. <view class="search-result">
  141. <view class="result-custome-box" v-if="searchContractList.length===0">
  142. <van-empty description="暂无数据" :image="require('@/static/empty.png')" v-if="!searchCustomeStatus"/>
  143. <view v-else>
  144. <view class="result-item flex" v-for="item in searchCustomeList" :key="item" @click="getContract(item)">
  145. <image src="../static/search-icon.png" mode="aspectFill" class="search-icon"></image>
  146. <view class="con van-ellipsis">{{item}}</view>
  147. <image src="../static/click-icon.png" mode="aspectFill" class="click-icon"></image>
  148. </view>
  149. </view>
  150. </view>
  151. <view class="result-contract-box" v-else>
  152. <view class="result-contract-item" v-for="item in searchContractList" :key="item.ContractId" @click="handleChooseContract(item)">
  153. <view class="name">{{item.CompanyName}}</view>
  154. <view style="margin-top: 20rpx;">合同编号:{{item.ContractCode}}</view>
  155. <view style="margin-top: 20rpx;">合同类型:{{item.ContractType}}</view>
  156. <view style="margin-top: 20rpx;">合同金额:{{item.Price}}</view>
  157. </view>
  158. </view>
  159. </view>
  160. </view>
  161. </van-popup>
  162. </view>
  163. </template>
  164. <script>
  165. import steps from "../components/steps.vue";
  166. import {sealMixin} from './mixin'
  167. import { apiSealDetail,apiSealEdit } from "@/api/approve/seal.js";
  168. export default{
  169. components: {
  170. steps,
  171. },
  172. mixins: [sealMixin],
  173. data() {
  174. return {
  175. SealId:0,
  176. }
  177. },
  178. onLoad(options) {
  179. let ContractApprovalId=options.ContractApprovalId
  180. let ContractApprovalRecordId=options.ContractApprovalRecordId
  181. let SealId=options.SealId
  182. this.getDetail({ContractApprovalId,ContractApprovalRecordId,SealId})
  183. },
  184. methods: {
  185. // 获取详情
  186. async getDetail({ContractApprovalId,ContractApprovalRecordId,SealId}){
  187. const res=await apiSealDetail({
  188. ContractApprovalId:Number(ContractApprovalId),
  189. ContractApprovalRecordId:Number(ContractApprovalRecordId),
  190. SealId:Number(SealId),
  191. })
  192. if(res.code===200){
  193. if(res.data.SealDetail.ContractId>0){
  194. this.radioVal='系统合同'
  195. }else{
  196. this.radioVal='上传附件'
  197. }
  198. this.SealId=res.data.SealDetail.SealId
  199. this.purpose=res.data.SealDetail.Use
  200. this.type=res.data.SealDetail.SealType.split(',')
  201. this.temType=res.data.SealDetail.SealType.split(',')
  202. this.ServiceType=res.data.SealDetail.ServiceType
  203. this.customeName=res.data.SealDetail.CompanyName
  204. this.fileNum=res.data.SealDetail.FileNum
  205. this.remark=res.data.SealDetail.Remark
  206. this.CreditCode=res.data.SealDetail.CreditCode
  207. this.UseCompanyName=res.data.SealDetail.UseCompanyName
  208. // this.ContractfileUrl=res.data.SealDetail.FileUrl
  209. this.handleFile(res.data.SealDetail.FileUrls)
  210. this.ContractId=res.data.SealDetail.ContractId
  211. this.getProcessData()
  212. }
  213. },
  214. //处理文件
  215. handleFile(filesUrls){
  216. const reg = /\.(pdf)$/;
  217. const reg2= /\.doc|\.docx$/
  218. filesUrls.map(filesUrl=>{
  219. if(reg.test(filesUrl)){
  220. this.fileList.push({
  221. type: "pdf",
  222. url: filesUrl,
  223. img: require("../static/pdf.png"),
  224. })
  225. }else if(reg2.test(filesUrl)){
  226. this.fileList.push({
  227. type: "word",
  228. url: filesUrl,
  229. img: require("../static/word.png"),
  230. })
  231. }else{
  232. this.fileList.push({
  233. type: "img",
  234. url: filesUrl,
  235. img: filesUrl,
  236. })
  237. }
  238. })
  239. },
  240. // 选择合同 更新表单数据
  241. handleChooseContract(e){
  242. this.customeName=e.CompanyName
  243. this.CreditCode=e.CreditCode
  244. this.ServiceType=e.ContractType
  245. this.UseCompanyName=e.ContractBusinessType=='代付合同'?e.UseCompanyName:e.CompanyName
  246. this.ContractId=e.ContractId
  247. // this.ContractfileUrl=e.FileUrl
  248. this.handleFile([e.FileUrl])
  249. // 关闭搜索弹窗
  250. this.showCustome=false
  251. this.searchCustomeVal=''
  252. this.searchContractList=[]
  253. this.searchCustomeList=[]
  254. },
  255. // 提交申请
  256. async handleSubmit(){
  257. let params={
  258. CompanyName:this.customeName,
  259. ContractId:this.ContractId,
  260. CreditCode:this.CreditCode,
  261. FileUrls:this.fileList.map(file => file.url),
  262. FileNum:Number(this.fileNum),
  263. Remark:this.remark,
  264. SealType:this.type.join(','),
  265. ServiceType:this.ServiceType,
  266. Use:this.purpose,
  267. UseCompanyName:this.UseCompanyName,
  268. SealId:Number(this.SealId)
  269. }
  270. if(!params.Use){
  271. uni.showToast({
  272. title:'请选择用印用途',
  273. icon:"none"
  274. })
  275. return
  276. }
  277. if(!params.CompanyName){
  278. uni.showToast({
  279. title:'客户名称不能为空',
  280. icon:"none"
  281. })
  282. return
  283. }
  284. if(!params.CreditCode){
  285. uni.showToast({
  286. title:'信用代码不能为空',
  287. icon:"none"
  288. })
  289. return
  290. }
  291. if(!params.ServiceType){
  292. uni.showToast({
  293. title:'业务类型不能为空',
  294. icon:"none"
  295. })
  296. return
  297. }
  298. if(!params.FileNum){
  299. uni.showToast({
  300. title:'请填写文件份数',
  301. icon:"none"
  302. })
  303. return
  304. }
  305. if(params.FileNum<1){
  306. uni.showToast({
  307. title:'文件份数不合法',
  308. icon:"none"
  309. })
  310. return
  311. }
  312. if(!params.SealType){
  313. uni.showToast({
  314. title:'印章类型不能为空',
  315. icon:"none"
  316. })
  317. return
  318. }
  319. if(!params.FileUrls){
  320. uni.showToast({
  321. title:'请上传文件',
  322. icon:"none"
  323. })
  324. return
  325. }
  326. // 代付合同 实际使用方必填
  327. if(params.Use=='代付合同'){
  328. if(!params.UseCompanyName&&this.radioVal==='上传附件'){
  329. uni.showToast({
  330. title:'请填写实际使用方',
  331. icon:"none"
  332. })
  333. return
  334. }
  335. }
  336. const res=await apiSealEdit(params)
  337. if(res.code===200){
  338. uni.showToast({
  339. title:"用印申请单已提交",
  340. icon:"none"
  341. })
  342. uni.$emit('sealEditSubmit')
  343. setTimeout(()=>{
  344. uni.navigateBack({
  345. delta:2
  346. })
  347. },1000)
  348. }
  349. }
  350. },
  351. }
  352. </script>
  353. <style lang="scss">
  354. .check-file-contain{
  355. display: flex;
  356. flex-wrap: wrap;
  357. .check-file-box{
  358. width: 102rpx;
  359. height: 120rpx;
  360. background-size: cover;
  361. background-position: center;
  362. position: relative;
  363. margin: 0 16rpx;
  364. .del-icon{
  365. position: absolute;
  366. width: 30rpx;
  367. height: 30rpx;
  368. top: -15rpx;
  369. right: -15rpx;
  370. }
  371. }
  372. }
  373. .add-page{
  374. width: 100%;
  375. min-height: 100vh;
  376. padding-bottom: calc(150rpx + constant(safe-area-inset-bottom));
  377. padding-bottom: calc(150rpx + env(safe-area-inset-bottom));
  378. }
  379. .section{
  380. padding: 30rpx 34rpx;
  381. border-top: 10rpx solid #F5F5F5;
  382. position: relative;
  383. textarea{
  384. width: 100%;
  385. height: 200rpx;
  386. }
  387. .section-title{
  388. font-size: 16px;
  389. margin-bottom: 20rpx;
  390. }
  391. .require::before{
  392. content: '*';
  393. font-size: 16px;
  394. color: #FF0000;
  395. position: absolute;
  396. left: 20rpx;
  397. }
  398. .section-select-box{
  399. color: #999;
  400. position: relative;
  401. &::after{
  402. position: absolute;
  403. right: 0;
  404. top: 50%;
  405. content: '';
  406. display: block;
  407. width: 18rpx;
  408. height: 18rpx;
  409. border-top: 1px solid #999;
  410. border-right: 1px solid #999;
  411. transform: translateY(-50%) rotate(45deg);
  412. }
  413. }
  414. .show-all-custome-box{
  415. top: 100%;
  416. width: 85vw;
  417. height: 440rpx;
  418. z-index: 10;
  419. padding: 30rpx 40rpx;
  420. position: absolute;
  421. background: #FFFFFF;
  422. box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.16);
  423. .all-custome-item{
  424. margin-bottom: 30rpx;
  425. }
  426. }
  427. }
  428. .btn{
  429. width: 360rpx;
  430. height: 60rpx;
  431. }
  432. .radio-wrap{
  433. .radio{
  434. font-size: 14px;
  435. &::before{
  436. content: '';
  437. display: inline-block;
  438. }
  439. }
  440. }
  441. .custome-search-wrap{
  442. padding: 34rpx;
  443. height: 100%;
  444. .search-box {
  445. border: 1px solid #3385FF;
  446. padding: 0 !important;
  447. border-radius: 60rpx;
  448. background-color: #fff !important;
  449. }
  450. .search-con {
  451. background-color: #fff !important;
  452. }
  453. .van-search__content {
  454. background-color: #fff !important;
  455. padding-left: 30rpx !important;
  456. }
  457. .search-btn {
  458. position: relative;
  459. color: #3385FF;
  460. &::before {
  461. content: '';
  462. display: block;
  463. width: 1px;
  464. height: 60%;
  465. background-color: #D1D1D1;
  466. position: absolute;
  467. left: -16rpx;
  468. top: 20%;
  469. }
  470. }
  471. .search-icon{
  472. width: 40rpx;
  473. height: 40rpx;
  474. display: block;
  475. position: relative;
  476. top: 4rpx;
  477. margin-right: 20rpx;
  478. }
  479. .click-icon{
  480. width: 24rpx;
  481. height: 24rpx;
  482. }
  483. .result-item{
  484. align-items: center;
  485. padding: 20rpx 0;
  486. border-bottom: 1px solid #EBEBEB;
  487. .con{
  488. flex: 1;
  489. margin-right: 20rpx;
  490. }
  491. }
  492. .search-result{
  493. overflow-y: auto;
  494. height: 100%;
  495. }
  496. .result-contract-box{
  497. padding: 0 10rpx;
  498. .result-contract-item{
  499. margin-top: 30rpx;
  500. box-shadow: 0px 0px 12rpx rgba(175, 175, 175, 0.38);
  501. padding: 30rpx;
  502. border-radius: 8px;
  503. .name{
  504. font-size: 16px;
  505. font-weight: bold;
  506. &::before{
  507. content:'';
  508. display:inline-block;
  509. width: 31rpx;
  510. height: 34rpx;
  511. background-image: url(../../static/man.png);
  512. background-size: cover;
  513. position: relative;
  514. top: 4rpx;
  515. margin-right: 10rpx;
  516. }
  517. }
  518. }
  519. }
  520. }
  521. .type-popup-wrap{
  522. padding: 20rpx 32rpx;
  523. height: 280px;
  524. .top-title{
  525. justify-content: space-between;
  526. margin-bottom: 124rpx;
  527. }
  528. .van-checkbox{
  529. margin-bottom: 30rpx;
  530. width: 200rpx;
  531. margin-left: auto;
  532. margin-right: auto;
  533. }
  534. }
  535. </style>