detail.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. <template>
  2. <view class="detail-page white-wrap">
  3. <view>
  4. <!-- 基础信息模块 -->
  5. <view class="section white-wrap base-info-wrap" v-if="info">
  6. <view class="title">
  7. {{ info.CompanyApprovalDetail.CompanyName }}
  8. <van-tag v-if="info.CompanyApprovalDetail.ApplyMethod === 3" color="#ECF5FF" text-color="#4A83F1"
  9. style="margin-bottom:0;margin-left: 10rpx;">第{{ info.CompanyApprovalDetail.ApprovalCount }}次申请</van-tag>
  10. </view>
  11. <view class="base-info-list">
  12. <view v-for="item in baseInfo" :key="item.key">
  13. <text class="lable">{{ item.key }}:</text>
  14. <text :style="{ color: item.color }">
  15. {{ item.val }}
  16. </text>
  17. <van-tag v-if="item.tag" color="#ECF5FF" text-color="#4A83F1" style="margin-left:5px">
  18. {{ item.tag }}
  19. </van-tag>
  20. </view>
  21. <view v-if="info && info.CompanyApprovalDetail.ApproveStatus === '驳回'">
  22. <text class="lable" style="color:#FE6B7C">驳回理由:</text>
  23. <text style="color:#FE6B7C">{{ info.CompanyApprovalDetail.ApproveRemark }}</text>
  24. </view>
  25. </view>
  26. <image :src="info.CompanyApprovalDetail.statusImg" mode="aspectFill" class="status-img"></image>
  27. <!-- view class="status-img pass-img" v-if="info.CompanyApprovalDetail.ApproveStatus==='已审批'"></view>
  28. <view class="status-img fail-img" v-if="info.CompanyApprovalDetail.ApproveStatus==='驳回'"></view> -->
  29. </view>
  30. <!-- 品种模块 -->
  31. <view class="section white-wrap variety-wrap" v-if="varietyInfo">
  32. <view class="title">{{ varietyInfo.title }}</view>
  33. <view class="variety-list">
  34. <view class="variety-item flex" v-for="item in varietyInfo.list" :key="item.ClassifyName">
  35. <view class="lable">{{ item.ClassifyName }}:</view>
  36. <view class="content">
  37. <van-tag color="#ECF5FF" text-color="#4A83F1" v-for="tag in item.Items"
  38. :key="tag.ChartPermissionId" custom-class="tag">{{ tag.PermissionName }}</van-tag>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. <!-- 合同模块 -->
  44. <view class="section white-wrap contract-wrap" v-if="constractFiles.length !== 0">
  45. <view class="title">查看合同附件</view>
  46. <view class="contract-list">
  47. <view class="contract-item" v-for="item in constractFiles" :key="item.url"
  48. @click="preViewContract(item)">
  49. <image class="contract-img" mode="aspectFill" :src="item.img"></image>
  50. </view>
  51. </view>
  52. </view>
  53. <!-- 客户信息模块 -->
  54. <view class="section white-wrap customer-wrap" v-if="showCustomerInfo && info">
  55. <view class="title">客户信息</view>
  56. <view class="customer-main-info">
  57. <view class="customer-info-item">
  58. <text>客户名称:</text>
  59. <text>{{ info.CompanyApprovalDetail.CompanyName }}</text>
  60. </view>
  61. <view class="customer-info-item">
  62. <text>社会信用码:</text>
  63. <text>{{ info.CompanyApprovalDetail.CreditCode }}</text>
  64. </view>
  65. <view class="customer-info-item">
  66. <text>地址:</text>
  67. <text>{{ info.CompanyApprovalDetail.Address }}</text>
  68. </view>
  69. </view>
  70. <view class="customer-info-list flex">
  71. <view class="customer-info-item flex" style="width:50%">
  72. <text style="flexShrink:0">客户类型:</text>
  73. <text>{{ info.CompanyApprovalDetail.CompanyType }}</text>
  74. </view>
  75. <view class="customer-info-item flex" style="width:50%">
  76. <text style="flexShrink:0">客户状态:</text>
  77. <text>{{ info.CompanyApprovalDetail.Status }}</text>
  78. </view>
  79. <view class="customer-info-item flex" style="width:50%">
  80. <text style="flexShrink:0">客户来源:</text>
  81. <text>{{ info.CompanyApprovalDetail.Source }}</text>
  82. </view>
  83. <view class="customer-info-item flex" style="width:50%">
  84. <text style="flexShrink:0">行业:</text>
  85. <text>{{ info.CompanyApprovalDetail.IndustryName }}</text>
  86. </view>
  87. <view class="customer-info-item flex" style="width:50%">
  88. <text style="flexShrink:0">申请销售:</text>
  89. <text>{{ info.CompanyApprovalDetail.SellerName }}</text>
  90. </view>
  91. </view>
  92. </view>
  93. <!-- 流程模块 -->
  94. <view class="section process-wrap">
  95. <view class="title" style="font-size: 16px;font-weight: bold;">审批流程</view>
  96. <steps :data="info.FlowNodeList"></steps>
  97. </view>
  98. </view>
  99. <!-- 审批按钮 -->
  100. <view class="fix-bottom-wrap btns-wrap flex" v-if="info &&info.CompanyApprovalDetail.OpButton&& info.CompanyApprovalDetail.ApproveStatus === '待审批'">
  101. <button class="pass-btn" @click="handlePass">通过</button>
  102. <button class="refuse-btn" @click="handleRefuse">驳回</button>
  103. </view>
  104. <van-dialog id="van-dialog" />
  105. </view>
  106. </template>
  107. <script>
  108. import {apiCustomeDetail,apiCustomeContractDetail,apiCustomeApprove} from '@/api/approve/custome.js'
  109. import {preViewFile} from '../utils/util.js'
  110. import steps from '../components/steps.vue'
  111. export default {
  112. components:{
  113. steps
  114. },
  115. computed: {
  116. //是否显示客户信息模块
  117. showCustomerInfo() {
  118. if (this.info && (this.info.CompanyApprovalDetail.ApplyMethod === 2 || this.info.CompanyApprovalDetail
  119. .ApplyMethod === 4)) {
  120. return false;
  121. } else {
  122. return true;
  123. }
  124. },
  125. },
  126. data() {
  127. return {
  128. id: null,
  129. info: null,
  130. baseInfo: null, //顶部基础信息
  131. varietyInfo: null, //品种信息
  132. constractFiles: [], //合同文件
  133. };
  134. },
  135. onLoad(options) {
  136. this.id = options.id||0
  137. },
  138. onShow() {
  139. this.getDetail()
  140. },
  141. onPullDownRefresh() {
  142. this.getDetail()
  143. setTimeout(() => {
  144. uni.stopPullDownRefresh()
  145. }, 1000)
  146. },
  147. methods: {
  148. // 同意
  149. async handlePass() {
  150. const res = await apiCustomeApprove({
  151. CompanyApprovalId: Number(this.info.CompanyApprovalDetail.CompanyApprovalId),
  152. CompanyContractId: Number(this.info.CompanyApprovalDetail.CompanyContractId),
  153. CompanyId: Number(this.info.CompanyApprovalDetail.CompanyId),
  154. Remark: "",
  155. Status: 1,
  156. })
  157. if (res.code === 200) {
  158. this.$dialog.alert({
  159. title: "处理成功",
  160. confirmButtonColor: "#5890FB",
  161. }).then(() => {
  162. // on close
  163. this.getDetail()
  164. // 更新列表
  165. uni.$emit('customeApproveListUpdate',{CompanyApprovalId:this.id})
  166. });
  167. }
  168. },
  169. //拒绝
  170. handleRefuse(){
  171. const data=this.info.CompanyApprovalDetail
  172. uni.navigateTo({
  173. url:`./reason?CompanyApprovalId=${data.CompanyApprovalId}&CompanyContractId=${data.CompanyContractId}&CompanyId=${data.CompanyId}`
  174. })
  175. },
  176. // 获取审批单详情
  177. async getDetail() {
  178. const res = await apiCustomeDetail({
  179. ApprovalId: this.id
  180. })
  181. if (res.code === 200) {
  182. this.info = res.data
  183. // 初始化状态
  184. let statusImg=''
  185. switch(res.data.CompanyApprovalDetail.ApproveStatus){
  186. case '已审批':
  187. statusImg=require('../static/pass-icon.png')
  188. break;
  189. case '驳回':
  190. statusImg=require('../static/fail-icon.png')
  191. break;
  192. }
  193. this.info.CompanyApprovalDetail.statusImg=statusImg
  194. let contractInfo = null
  195. // 如果有合同id 则获取合同数据
  196. if (res.data.CompanyApprovalDetail.CompanyContractId != 0) {
  197. const contractRes = await apiCustomeContractDetail({
  198. CompanyId: res.data.CompanyApprovalDetail.CompanyId,
  199. CompanyContractId: res.data.CompanyApprovalDetail.CompanyContractId
  200. })
  201. if (contractRes.code === 200) {
  202. contractInfo = contractRes.data
  203. }
  204. }
  205. this.initTopInfo(res.data, contractInfo)
  206. this.initVarietyInfo(res.data, contractInfo)
  207. this.initContractFiles(res.data, contractInfo)
  208. }
  209. },
  210. // 预览合同文件
  211. preViewContract(e) {
  212. if (e.type === "pdf") {
  213. preViewFile(e.url)
  214. } else {
  215. uni.previewImage({
  216. urls: [e.url]
  217. })
  218. }
  219. },
  220. // 初始化合同文件数据
  221. initContractFiles(info, contractInfo) {
  222. let arr = [];
  223. if (info && contractInfo && (info.CompanyApprovalDetail.ApplyMethod === 1 || info
  224. .CompanyApprovalDetail.ApplyMethod === 5||info
  225. .CompanyApprovalDetail.ApplyMethod === 6)) {
  226. const reg = /\.(pdf)|\.doc|\.docx$/;
  227. arr = contractInfo.ImgUrl.split("#").map((item) => {
  228. if (reg.test(item)) {
  229. return {
  230. type: "pdf",
  231. url: item,
  232. img: require("@/pages-approve/static/pdf.png"),
  233. };
  234. } else {
  235. return {
  236. type: "img",
  237. url: item,
  238. img: item,
  239. };
  240. }
  241. });
  242. }
  243. this.constractFiles = arr
  244. },
  245. // 初始化顶部数据
  246. initTopInfo(info, contractInfo) {
  247. let arr = [];
  248. //试用转正式
  249. if (info && contractInfo && info.CompanyApprovalDetail.ApplyMethod === 1) {
  250. uni.setNavigationBarTitle({
  251. title:'试用转正式'
  252. })
  253. arr = [{
  254. key: "合同编号",
  255. val: contractInfo.ContractCode,
  256. tag: contractInfo.ContractType,
  257. },
  258. {
  259. key: "合同期限",
  260. val: `${contractInfo.StartDate}~${contractInfo.EndDate}`.replace(/-/g, '.'),
  261. },
  262. {
  263. key: "合同金额",
  264. val: contractInfo.Money+'元',
  265. color: "#FE6B7C",
  266. },
  267. {
  268. key: "付款方式",
  269. val: contractInfo.PayMethod,
  270. },
  271. {
  272. key: "付款渠道",
  273. val: contractInfo.PayChannel,
  274. },
  275. {
  276. key: "申请时间",
  277. val: info.CompanyApprovalDetail.ApprovalTime.replace(/-/g, '.'),
  278. },
  279. {
  280. key: "申请理由",
  281. val: info.CompanyApprovalDetail.ApplyReasons || "无",
  282. },
  283. ];
  284. }
  285. //冻结转试用
  286. if (info && info.CompanyApprovalDetail.ApplyMethod === 2) {
  287. uni.setNavigationBarTitle({
  288. title:'冻结转试用'
  289. })
  290. arr = [{
  291. key: "客户状态",
  292. val: info.CompanyApprovalDetail.Status,
  293. },
  294. {
  295. key: "冻结期限",
  296. val: `${info.CompanyApprovalDetail.FreezeStartDate}~${info.CompanyApprovalDetail.FreezeEndDate}`
  297. .replace(/-/g, '.'),
  298. },
  299. {
  300. key: "到期天数",
  301. val: info.CompanyApprovalDetail.FreezeExpireDays,
  302. },
  303. {
  304. key: "申请销售",
  305. val: info.CompanyApprovalDetail.ApplyRealName,
  306. },
  307. {
  308. key: "申请时间",
  309. val: info.CompanyApprovalDetail.ApprovalTime.replace(/-/g, '.'),
  310. },
  311. {
  312. key: "解冻理由",
  313. val: info.CompanyApprovalDetail.ApplyReasons,
  314. },
  315. ];
  316. }
  317. //试用延期
  318. if (info && info.CompanyApprovalDetail.ApplyMethod === 3) {
  319. uni.setNavigationBarTitle({
  320. title:'试用延期'
  321. })
  322. arr = [{
  323. key: "地址",
  324. val: info.CompanyApprovalDetail.Address,
  325. },
  326. {
  327. key: "申请时间",
  328. val: info.CompanyApprovalDetail.ApprovalTime.replace(/-/g, '.'),
  329. },
  330. {
  331. key: "申请理由",
  332. val: info.CompanyApprovalDetail.ApplyReasons,
  333. },
  334. ];
  335. }
  336. //原销售申请领取
  337. if (info && info.CompanyApprovalDetail.ApplyMethod === 4) {
  338. uni.setNavigationBarTitle({
  339. title:'原销售申请领取'
  340. })
  341. arr = [{
  342. key: "客户状态",
  343. val: info.CompanyApprovalDetail.Status,
  344. },
  345. {
  346. key: "原销售",
  347. val: info.CompanyApprovalDetail.SellerName,
  348. },
  349. {
  350. key: "申请销售",
  351. val: info.CompanyApprovalDetail.ApplyRealName,
  352. },
  353. {
  354. key: "申请时间",
  355. val: info.CompanyApprovalDetail.ApprovalTime.replace(/-/g, '.'),
  356. },
  357. {
  358. key: "申请理由",
  359. val: info.CompanyApprovalDetail.ApplyReasons,
  360. },
  361. ];
  362. }
  363. //续约申请/补充协议
  364. if (info && contractInfo && (info.CompanyApprovalDetail.ApplyMethod === 5||info.CompanyApprovalDetail.ApplyMethod===6)) {
  365. uni.setNavigationBarTitle({
  366. title:info.CompanyApprovalDetail.ApplyMethod === 5?'续约申请':'补充协议'
  367. })
  368. arr = [{
  369. key: "合同编号",
  370. val: contractInfo.ContractCode,
  371. tag: contractInfo.ContractType,
  372. },
  373. {
  374. key: "合同期限",
  375. val: `${contractInfo.StartDate}~${contractInfo.EndDate}`.replace(/-/g, '.'),
  376. },
  377. {
  378. key: "合同金额",
  379. val: contractInfo.Money+'元',
  380. color: "#FE6B7C",
  381. },
  382. {
  383. key: "付款方式",
  384. val: contractInfo.PayMethod,
  385. },
  386. {
  387. key: "付款渠道",
  388. val: contractInfo.PayChannel,
  389. },
  390. {
  391. key: "申请时间",
  392. val: info.CompanyApprovalDetail.ApprovalTime.replace(/-/g, '.'),
  393. },
  394. {
  395. key: "申请理由",
  396. val: info.CompanyApprovalDetail.ApplyReasons || "无",
  397. },
  398. ];
  399. }
  400. this.baseInfo = arr
  401. },
  402. // 初始化品种信息
  403. initVarietyInfo(info, contractInfo) {
  404. let usertype = this.$store.state.userInfo.ProductName; //用户身份类型admin,ficc,权益
  405. let arr = [];
  406. let obj = {
  407. title: "",
  408. list: [],
  409. };
  410. //试用转正式
  411. if (info && contractInfo && info.CompanyApprovalDetail.ApplyMethod === 1) {
  412. obj.title = "购买品种";
  413. arr = contractInfo.PermissionList;
  414. if (!arr) return obj;
  415. arr.forEach((item) => {
  416. let temarr = item.Items.filter((e) => {
  417. let flag = item.CheckList.includes(e.ChartPermissionId);
  418. if (flag) return e;
  419. });
  420. if (temarr.length !== 0) {
  421. obj.list.push({
  422. ClassifyName: item.ClassifyName,
  423. Items: temarr,
  424. });
  425. }
  426. });
  427. }
  428. //冻结转试用
  429. if (info && info.CompanyApprovalDetail.ApplyMethod === 2) {
  430. obj.title = "申请品种";
  431. if (usertype === "ficc") {
  432. arr = info.FiccPermissionList;
  433. } else if (usertype === "权益") {
  434. arr = info.PermissionList;
  435. } else if (usertype === "admin") {
  436. if (info.FiccPermissionList) {
  437. arr = [...info.FiccPermissionList];
  438. }
  439. if (info.PermissionList) {
  440. arr = [...info.PermissionList];
  441. }
  442. }
  443. if (!arr) return obj;
  444. arr.forEach((item) => {
  445. let temarr = item.Items.filter((e) => {
  446. let flag = item.CheckList.includes(e.ChartPermissionId);
  447. if (flag) return e;
  448. });
  449. if (temarr.length !== 0) {
  450. obj.list.push({
  451. ClassifyName: item.ClassifyName,
  452. Items: temarr,
  453. });
  454. }
  455. });
  456. }
  457. //试用延期
  458. if (info && info.CompanyApprovalDetail.ApplyMethod === 3) {
  459. obj.title = "申请品种";
  460. if (usertype === "ficc") {
  461. arr = info.FiccPermissionList;
  462. } else if (usertype === "权益") {
  463. arr = info.PermissionList;
  464. } else if (usertype === "admin") {
  465. if (info.FiccPermissionList) {
  466. arr = [...info.FiccPermissionList];
  467. }
  468. if (info.PermissionList) {
  469. arr = [...info.PermissionList];
  470. }
  471. }
  472. if (!arr) return obj;
  473. arr.forEach((item) => {
  474. let temarr = item.Items.filter((e) => {
  475. let flag = item.CheckList.includes(e.ChartPermissionId);
  476. if (flag) return e;
  477. });
  478. if (temarr.length !== 0) {
  479. obj.list.push({
  480. ClassifyName: item.ClassifyName,
  481. Items: temarr,
  482. });
  483. }
  484. });
  485. }
  486. //原销售申请领取
  487. if (info && info.CompanyApprovalDetail.ApplyMethod === 4) {
  488. obj.title = "申请品种";
  489. if (usertype === "ficc") {
  490. arr = info.FiccPermissionList;
  491. } else if (usertype === "权益") {
  492. arr = info.PermissionList;
  493. } else if (usertype === "admin") {
  494. if (info.FiccPermissionList) {
  495. arr = [...info.FiccPermissionList];
  496. }
  497. if (info.PermissionList) {
  498. arr = [...info.PermissionList];
  499. }
  500. }
  501. if (!arr) return obj;
  502. arr.forEach((item) => {
  503. let temarr = item.Items.filter((e) => {
  504. let flag = item.CheckList.includes(e.ChartPermissionId);
  505. if (flag) return e;
  506. });
  507. if (temarr.length !== 0) {
  508. obj.list.push({
  509. ClassifyName: item.ClassifyName,
  510. Items: temarr,
  511. });
  512. }
  513. });
  514. }
  515. //续约申请/补充协议
  516. if (info && contractInfo && (info.CompanyApprovalDetail.ApplyMethod === 5||info.CompanyApprovalDetail.ApplyMethod===6)) {
  517. obj.title = "购买品种";
  518. arr = contractInfo.PermissionList;
  519. if (!arr) return obj;
  520. arr.forEach((item) => {
  521. let temarr = item.Items.filter((e) => {
  522. let flag = item.CheckList.includes(e.ChartPermissionId);
  523. if (flag) return e;
  524. });
  525. if (temarr.length !== 0) {
  526. obj.list.push({
  527. ClassifyName: item.ClassifyName,
  528. Items: temarr,
  529. });
  530. }
  531. });
  532. }
  533. this.varietyInfo = obj
  534. }
  535. },
  536. }
  537. </script>
  538. <style lang="scss">
  539. .detail-page {
  540. width: 100%;
  541. min-height: 100vh;
  542. padding-bottom: calc(150rpx + constant(safe-area-inset-bottom));
  543. padding-bottom: calc(150rpx + env(safe-area-inset-bottom));
  544. }
  545. .section {
  546. padding: 30rpx 34rpx;
  547. border-bottom: 14rpx solid #f5f5f5;
  548. &:last-child {
  549. margin-bottom: 0;
  550. border: none;
  551. }
  552. .title {
  553. font-size: 16px;
  554. font-weight: bold;
  555. margin: 0 0 40rpx 0;
  556. }
  557. .lable {
  558. color: #666;
  559. flex-shrink: 0;
  560. font-size: 14px;
  561. }
  562. }
  563. .base-info-wrap {
  564. position: relative;
  565. .title {
  566. margin: 0 0 40rpx 0;
  567. &::before {
  568. content: "";
  569. display: inline-block;
  570. width: 15px;
  571. height: 17px;
  572. background-image: url("@/static/man.png");
  573. background-size: cover;
  574. background-repeat: no-repeat;
  575. margin-right: 10rpx;
  576. position: relative;
  577. top: 4rpx;
  578. }
  579. }
  580. .base-info-list {
  581. font-size: 14px;
  582. color: #000;
  583. view {
  584. margin-bottom: 10px;
  585. display: flex;
  586. }
  587. }
  588. .status-img{
  589. position: absolute;
  590. width: 220rpx;
  591. height: 220rpx;
  592. right: 0;
  593. top: 100rpx;
  594. }
  595. }
  596. .variety-wrap {
  597. .variety-item {
  598. padding-top: 24rpx;
  599. padding-bottom: 24rpx;
  600. border-bottom: 1px dashed rgba(112, 112, 112, 0.2);
  601. }
  602. .variety-item:first-child {
  603. padding-top: 0;
  604. }
  605. .variety-item:last-child {
  606. border-bottom: none;
  607. }
  608. .tag {
  609. margin-right: 10rpx;
  610. margin-bottom: 10rpx;
  611. }
  612. }
  613. .contract-list {
  614. display: flex;
  615. flex-wrap: wrap;
  616. .contract-img {
  617. width: 102rpx;
  618. height: 120rpx;
  619. }
  620. }
  621. .customer-main-info {
  622. padding-bottom: 40rpx;
  623. border-bottom: 1px dashed rgba(112, 112, 112, 0.2);
  624. }
  625. .customer-info-item {
  626. font-size: 14px;
  627. color: #999;
  628. margin-bottom: 20rpx;
  629. }
  630. .customer-info-list {
  631. flex-wrap: wrap;
  632. padding-top: 20rpx;
  633. }
  634. .btns-wrap {
  635. justify-content: center;
  636. button {
  637. width: 260rpx;
  638. height: 70rpx;
  639. border-radius: 28px;
  640. border: none;
  641. margin: 0 15px;
  642. font-size: 15px;
  643. color: #fff;
  644. line-height: 70rpx;
  645. }
  646. .pass-btn {
  647. background-color: #5890fb;
  648. }
  649. .refuse-btn {
  650. background-color: #f55768;
  651. }
  652. }
  653. </style>