addSeal.vue 16 KB

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