addSeal.vue 16 KB

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