Console.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  1. <template>
  2. <div class="userConsole" v-if="moreProBox">
  3. <MiniTitle>
  4. <div slot="mini" class="miniTit">控制台</div>
  5. </MiniTitle>
  6. <div class="con-main">
  7. <div v-if="authProgress|| openedCount || productApplyCount || failCount ||authRejectCount" class="progress">
  8. <p class="userTitles">开通进度</p>
  9. <div ref="isNo" class="openTo">
  10. <div class="userOpen" v-if="authProgress != 0">
  11. <p class="openTxt">账号认证申请</p>
  12. <p class="openImg"><img class="rzImg" src="../../images/verify.png" /><img class="rzLine" src="../../images/2steps-1.png" /><img
  13. class="rzEnd" src="../../images/complete.png" /></p>
  14. <p class="text">认证中</p>
  15. </div>
  16. <div class="productOpen" v-if="passProduct.length!=0">
  17. <!-- 付费产品 -->
  18. <p class="openTxt">产品接入申请</p>
  19. <div class="sonProduct" v-for="i in passProduct">
  20. <!-- <p class="titlePro">{{i.name}}<span>订单号:{{i.num}}</span></p> -->
  21. <p class="titlePro">
  22. <el-tooltip class="item" effect="dark" :content="i.name" placement="top" v-if="i.name.length > 12">
  23. <span>{{i.name.slice(0,12)+'...'}}</span>
  24. </el-tooltip>
  25. <span v-else>{{i.name}}</span>
  26. <span class="num">订单号:{{i.num}}</span>
  27. </p>
  28. <p class="openImg" v-if="i.auditStatusMsg === '待审核'"><img class="rzImg" src="../../images/verify1.png" /><img
  29. class="rzLine" src="../../images/2steps-1.png" /><img class="rzEnd" src="../../images/complete.png" /></p>
  30. <p class="openImg" v-else="i.auditStatusMsg === '通过'"><img class="rzImg" src="../../images/verify1.png" /><img
  31. class="rzLine" src="../../images/2steps-2.png" /><img class="rzEnd" src="../../images/verify2.png" /></p>
  32. <p class="text">{{i.auditStatusMsg}}</p>
  33. </div>
  34. </div>
  35. <!-- 调接口queryAuthProgress 验证是否认证失败 -->
  36. <div class="faildBox" v-if="authRejectCount !=0 || failProduct.length !=0">
  37. <div class="regBo" v-show="authRejectCount !=0">
  38. <p class="openTxt">账号认证失败原因</p>
  39. <!-- 失败原因type和Comment二选一 -->
  40. <p class="failper">原因:{{rejectType?rejectType:rejectComment}}</p>
  41. </div>
  42. <div v-if="failProduct.length !=0">
  43. <p class="openTxt2">产品申请失败原因</p>
  44. <div class="pproFaild" v-for="failure in failProduct">
  45. <p class="failTitlt">{{failure.name}}</p>
  46. <p class="failper">原因 : {{failure.rejectReason}}</p>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. <!-- 已开通产品 -->
  52. <div class="reaOpen" v-if="openedCount">
  53. <p class="userTitles">已开通产品</p>
  54. <!-- <div class="openItem" v-for="op in openList"> -->
  55. <div v-for="op in openList" :class="['openItem',{'grays':op.isExpire==0||op.serviceStatus == 0}]" >
  56. <div class="openItBox">
  57. <el-tooltip class="item" :disabled="op.name.length > 44 ? false : true" effect="dark" :content="op.name" placement="top">
  58. <span class="openIt">{{op.name}}</span>
  59. </el-tooltip>
  60. </div>
  61. <!-- <p class="openIt">{{op.name}}</p> -->
  62. <div class="leftCo">
  63. <p>服务模式 :</p>
  64. <p :class="['produceN',{'grays':op.isExpire==0 ||op.serviceStatus == 0}]">{{op.accessTypeMsg}}</p>
  65. </div>
  66. <div class="rightCo">
  67. <p>产品服务有效时间 : </p>
  68. <p :class="['proDate',{'grays':op.isExpire==0 ||op.serviceStatus == 0}]">{{op.startTime}}~{{op.endTime}}</p>
  69. </div>
  70. <div class="emp"></div>
  71. <div class="rit">
  72. <!-- 停用 过期都不能点击生成令牌 -->
  73. <div v-if="op.isExpire==0 || op.serviceStatus == 0">
  74. <button v-show="op.isInto==1" class="proBtn grayHu">进入</button>
  75. <button v-show="op.isCreateToken==1" class="proBtn grayHu">生成令牌</button>
  76. <button class="proBtn grayHu" v-if="op.serviceStatus == 0">续费</button>
  77. <button class="proBtn" @click="morePros(op.productId)" v-else-if="op.renewalsStutas == 0">续费</button>
  78. <button class="proBtn orgCol" v-else-if="op.renewalsStutas == 1">续费中</button>
  79. </div>
  80. <div v-else>
  81. <button v-show="op.isInto==1" class="proBtn" @click="intoProduct(op)">进入</button>
  82. <button v-show="op.isCreateToken==1" class="proBtn" @click="tokenCheck()">生成令牌</button>
  83. <button class="proBtn" @click="morePros(op.productId)" v-if="op.renewalsStutas == 0">续费</button>
  84. <button class="proBtn orgCol" v-else-if="op.renewalsStutas == 1">续费中</button>
  85. </div>
  86. </div>
  87. <img v-if="op.isExpire==0 && op.serviceStatus != 0" src="../../images/overTime.png" height="54" width="54" class="overTime">
  88. <img v-else-if="op.serviceStatus == 0" src="../../images/stop.png" height="50" width="50" class="overTime">
  89. </div>
  90. <div class="openItem" style="cursor:pointer" @click="morePro()">
  91. <p class="moreTxt">更多服务</p>
  92. <div class="imBox">
  93. <img src="../../images/add_big.png" />
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. <!-- 可试用产品 -->
  99. <div class="trialProd" v-if="onTrialCount" ref="trialProd">
  100. <trial-pro></trial-pro>
  101. </div>
  102. <!-- 弹窗 -->
  103. <div class="mask" v-if="isMask">
  104. <div class="conmask">
  105. <p class="maskTxt">您是否需要续费该产品?</p>
  106. <div class="btn2">
  107. <button class="primary left" @click="saleBtn()">确认续费</button>
  108. <button class="primary right" @click="queBtn()">不续费</button>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. </template>
  115. <script>
  116. import userApi from '@api/user.js';
  117. import encode from '@api/base64.js';
  118. import TrialUser from '@components/user/TrialUser.vue';
  119. import MiniTitle from '../common/MiniTile.vue'
  120. export default {
  121. name: 'user-console',
  122. components: {
  123. 'trial-pro': TrialUser,
  124. MiniTitle
  125. },
  126. data() {
  127. return {
  128. passProduct:[],
  129. failProduct:[],
  130. toast: true,
  131. hide: false,
  132. isMask: false,
  133. moreProBox: true,
  134. isHidd: true,
  135. it: [],
  136. item: [],
  137. authStatus: null,
  138. auditStatusMsg: null,
  139. openList: [],
  140. onTrialCount: null,
  141. openedCount: null,
  142. productApplyCount: null,//产品接入数量
  143. failCount: null,
  144. authProgress:null,
  145. authRejectCount:null,
  146. rejectType:'',//账号认证被拒原因
  147. rejectComment: null,//补充信息
  148. maskId: null,
  149. showAuthenReject:false,
  150. }
  151. },
  152. created: function() {
  153. this.productAuthProgress();
  154. this.enShowOption();
  155. this.getConsoleOpened();
  156. if(this.authRejectCount != 0){
  157. this.getAuthenProgress();
  158. }
  159. },
  160. methods: {
  161. getAuthenProgress(){//账号认证进度
  162. userApi.getAuthenProgress().then((res)=>{
  163. const result = res.data;
  164. if(+result.code ==0){
  165. this.authStatus = result.data.userStatus;
  166. if(result.data.userStatus==0 && result.data.isReject==0){
  167. this.showAuthenReject = true;
  168. this.rejectComment = result.data.rejectComment;
  169. this.rejectType = result.data.rejectType;
  170. }
  171. }else{
  172. console.log(result.msg);
  173. }
  174. }).catch((error) => {
  175. console.log(error)
  176. });
  177. },
  178. queBtn() {
  179. this.isMask = false;
  180. },
  181. enShowOption() {
  182. userApi.enShowOption().then((res) => {
  183. if (res.data.code == '0') {
  184. const data = res.data.data;
  185. this.openedCount = data.openedCount;
  186. this.onTrialCount = data.onTrialCount;
  187. this.productApplyCount = data.orderCount;
  188. this.failCount = data.orderAuthFailCount;
  189. this.authProgress = data.authIngCount;
  190. this.authRejectCount = data.authRejectCount;
  191. }
  192. }).catch((error) => {
  193. console.log(error)
  194. });
  195. },
  196. productAuthProgress() { //申请进度
  197. userApi.productAuthProgress().then((res) => {
  198. if (res.data.code == '0') {
  199. const data = res.data.data;
  200. this.failProduct = data.failProduct;
  201. this.passProduct = data.passProduct;
  202. }
  203. }).catch((error) => {
  204. console.log(error)
  205. });
  206. },
  207. getConsoleOpened() { //已开通产品
  208. userApi.getConsoleOpened().then((res) => {
  209. if (res.data.code == '0') {
  210. this.openList= res.data.data;
  211. }
  212. }).catch((error) => {
  213. console.log(error)
  214. });
  215. },
  216. morePro() { //更多服务跳转
  217. this.$router.push({
  218. path: 'YH-GDFW'
  219. });
  220. },
  221. saleBtn() { //续费确定
  222. const params = {
  223. 'productId': this.maskId
  224. }
  225. userApi.addRenewalsInfo(params).then((res) => {
  226. if (res.data.code == '0') {
  227. this.isMask = false;
  228. this.$message({
  229. message: '提交成功!',
  230. type: 'success'
  231. });
  232. this.getConsoleOpened();
  233. }else{
  234. this.$message.error(res.data.msg);
  235. }
  236. }).catch((error) => {
  237. console.log(error)
  238. });
  239. },
  240. morePros(id) { // 蒙层出现
  241. this.isMask = true;
  242. this.maskId = id;
  243. },
  244. tokenCheck() { //查看令牌
  245. this.$router.push({
  246. path: 'YH-JGZX-YKTCP'
  247. });
  248. },
  249. openWin(url){//创建a标签打开新窗口
  250. let abtn = document.createElement('a');
  251. abtn.id = "openPro";
  252. abtn.href = url;
  253. abtn.target = "_blank";
  254. document.body.appendChild(abtn);
  255. document.getElementById("openPro").click();
  256. document.body.removeChild(abtn);
  257. },
  258. intoProduct(op){//进入产品页
  259. /*this.setCookie("appKeyId",keyId,1);
  260. this.setCookie("appKeySecret",keySecret,1);
  261. window.open(url);*/
  262. const {url,appKeyId,appKeySecret,isBegin,openId}=op;
  263. const id = op.productId;
  264. if(isBegin==0){//未到开通时间
  265. this.$message({
  266. message: '产品未到服务有效期',
  267. type: 'warning'
  268. });
  269. }else if(isBegin==1){
  270. let params = {
  271. 'productId':id,
  272. 'openId':openId
  273. }
  274. let newWindow = window.open();
  275. const tempTime = new Date().getTime().toString();//加密时间戳
  276. const securityCode = encode(tempTime);
  277. userApi.intoVerify(params).then((res)=>{
  278. if(res.data.code == 0){
  279. this.saveUserOper(id); //记录
  280. // const linkURL = url.indexOf("?")>-1? url + "&appKeyId="+appKeyId+"&appKeySecret="+appKeySecret : url + "?appKeyId="+appKeyId+"&appKeySecret="+appKeySecret;
  281. const linkURL = url.indexOf("?")>-1? url + "&appI="+appKeyId+"&appS="+appKeySecret + "&code=" + securityCode : url + "?appI="+appKeyId+"&appS="+appKeySecret + "&code=" + securityCode+"&productId="+id;
  282. // this.openWin(linkURL);
  283. newWindow.location.href = linkURL;
  284. }else{
  285. this.$message({
  286. message: res.data.msg,
  287. type: 'warning'
  288. });
  289. newWindow.close();
  290. }
  291. })
  292. }
  293. },
  294. saveUserOper(id){ //保存操作记录
  295. const userInfo = JSON.parse(localStorage.getItem("userLoginDTO")||'{}');
  296. const param={
  297. linkman:userInfo.linkman,
  298. productId:id,
  299. username:userInfo.username,
  300. };
  301. userApi.saveUserOper(param).then((res)=>{});
  302. },
  303. setCookie(name,value,day){
  304. var expires = day * 24 * 60 * 60 * 1000;
  305. var exp = new Date();
  306. exp.setTime(exp.getTime() + expires);
  307. document.cookie = name + "=" + value + ";expires=" + exp.toUTCString();
  308. },
  309. }
  310. }
  311. </script>
  312. <style lang="less" scoped>
  313. .userConsole {
  314. min-width: 1127px;
  315. height:100%;
  316. .miniTit {
  317. margin-left: 20px;
  318. font-weight: bold;
  319. }
  320. .con-main{
  321. height:92%;
  322. overflow-y: auto;
  323. }
  324. /*.progress{
  325. height: 21%;
  326. max-height: 350px;
  327. min-height: 165px;
  328. }*/
  329. .grayHu {
  330. background: #999 !important;
  331. cursor: auto !important;
  332. }
  333. .orgCol{
  334. background-color: #8CBDF4 !important;
  335. cursor: auto !important;
  336. }
  337. .hidd {
  338. display: none;
  339. }
  340. .mask {
  341. width: 100%;
  342. height: 100%;
  343. position: fixed;
  344. top: 0;
  345. left: 0;
  346. background-color: rgba(0, 0, 0, 0.4);
  347. z-index: 55;
  348. .conmask {
  349. background: #fff;
  350. width: 350px;
  351. height: 200px;
  352. position: absolute;
  353. left: 50%;
  354. top: 50%;
  355. transform: translate(-50%, -50%);
  356. border-radius:2px;
  357. .maskTxt {
  358. background: #fff;
  359. border-radius: 2px;
  360. text-align: center;
  361. margin-left: 53px;
  362. margin-right: 53px;
  363. margin-top: 50px;
  364. font-size: 14px;
  365. }
  366. .left {
  367. margin-left: 63px;
  368. cursor: pointer;
  369. }
  370. .right {
  371. background: #fff !important;
  372. border: 1px solid #1774f0 !important;
  373. color: #1774f0 !important;
  374. cursor: pointer;
  375. }
  376. .primary {
  377. width: 80px;
  378. height: 28px;
  379. border-radius: 3px;
  380. border: 0;
  381. background: #1774f0;
  382. color: #fff;
  383. margin-top: 40px;
  384. margin-right: 60px;
  385. }
  386. }
  387. }
  388. .grays {
  389. color: #aaa !important;
  390. }
  391. .toast-btn2 {
  392. width: 90px;
  393. bottom: 35px;
  394. right: 130px;
  395. }
  396. /*.pproFaild {
  397. height: 155px;
  398. }*/
  399. /*.regBo {
  400. height: 125px;
  401. line-height: 40px;
  402. }*/
  403. .reaOpen {
  404. display: inline-block;
  405. width: 100%;
  406. margin-top: 10px;
  407. }
  408. .trialProd{
  409. display:inline-block;
  410. }
  411. .userTrial .trialBox .felx .flex_item {
  412. width: 31%;
  413. min-width: 348px;
  414. max-width: 31%;
  415. }
  416. .imBox {
  417. text-align: center;
  418. img {
  419. width: 70px;
  420. height: 70px;
  421. cursor: pointer;
  422. }
  423. }
  424. .moreTxt {
  425. font-size: 14px;
  426. font-weight: bold;
  427. padding-top: 20px;
  428. margin-left: 20px;
  429. }
  430. .morePro {
  431. width: 31%;
  432. height: 150px;
  433. background: #fff;
  434. margin-left: 20px;
  435. margin-top: 20px;
  436. display: inline-block;
  437. }
  438. .openTo {
  439. /*height: 350px;*/
  440. height: 21%;
  441. max-height: 350px;
  442. min-height: 160px;
  443. }
  444. .emp {
  445. height: 1px;
  446. background: #c9c9c9;
  447. margin-top: 58px;
  448. }
  449. .rit {
  450. font-size: 12px;
  451. float: right;
  452. margin-right: 5px;
  453. margin-top: 8px;
  454. }
  455. .proBtn {
  456. width: 70px;
  457. height: 24px;
  458. border-radius: 2px;
  459. border: 0;
  460. display: inline-block;
  461. background: #1774f0;
  462. color: #fff;
  463. cursor: pointer;
  464. margin-right: 10px;
  465. font-size: 12px;
  466. outline: none;
  467. }
  468. .proDate {
  469. margin-top: 10px;
  470. color: #1774f0;
  471. }
  472. .rightCo {
  473. font-size: 12px;
  474. float: right;
  475. margin-right: 15px;
  476. }
  477. .produceN {
  478. margin-top: 10px;
  479. color: #1774f0;
  480. }
  481. .leftCo {
  482. font-size: 12px;
  483. margin-left: 20px;
  484. float: left;
  485. }
  486. .openItBox {
  487. height: 51px;
  488. line-height: 18px;
  489. overflow: hidden;
  490. }
  491. .openIt {
  492. display: -webkit-box;
  493. -webkit-box-orient: vertical;
  494. -webkit-line-clamp: 2;
  495. font-size: 14px;
  496. font-weight: bold;
  497. padding: 15px 20px 0 0;
  498. margin: 0 0 0px 20px;
  499. }
  500. .openTxt {
  501. font-size: 12px;
  502. height: 30px;
  503. line-height: 30px;
  504. border-bottom: 1px solid #c9c9c9;
  505. padding-left: 10px;
  506. font-weight: bold;
  507. }
  508. .openTxts {
  509. font-size: 12px;
  510. height: 30px;
  511. line-height: 30px;
  512. border-top: 1px solid #c9c9c9;
  513. border-bottom: 1px solid #c9c9c9;
  514. padding-left: 10px;
  515. font-weight: bold;
  516. }
  517. .openTxt2 {
  518. font-size: 12px;
  519. height: 30px;
  520. line-height: 30px;
  521. border-bottom: 1px solid #c9c9c9;
  522. padding-left: 10px;
  523. font-weight: bold;
  524. }
  525. .userTitles {
  526. margin: 20px 0 15px 20px;
  527. font-size: 14px;
  528. color: #999;
  529. }
  530. .userOpen {
  531. display: inline-block;
  532. width: 31%;
  533. min-width:334px;
  534. background: #fff;
  535. margin-left: 20px;
  536. float: left;
  537. .openImg {
  538. margin-top: 25px;
  539. text-align: center;
  540. }
  541. .text {
  542. font-size: 12px;
  543. text-align: center;
  544. margin-top: -15px;
  545. padding-bottom: 30px;
  546. }
  547. .rzLine {
  548. width: 210px;
  549. margin-left: 15px;
  550. margin-right: 15px;
  551. margin-bottom: 10px;
  552. }
  553. .rzEnd {
  554. width: 40px;
  555. height: 40px;
  556. }
  557. .rzImg {
  558. width: 40px;
  559. height: 40px;
  560. }
  561. img {
  562. display: inline-block;
  563. }
  564. }
  565. .productOpen {
  566. display: inline-block;
  567. background: #fff;
  568. width: 31.9%;
  569. min-width:334px;
  570. margin-left: 20px;
  571. float: left;
  572. height: 334px;
  573. overflow-y: auto;
  574. .openTxt {
  575. font-size: 12px;
  576. height: 30px;
  577. line-height: 30px;
  578. border-bottom: 1px solid #c9c9c9;
  579. padding-left: 10px;
  580. span {
  581. float: right;
  582. display: inline-block;
  583. margin-right: 10px;
  584. }
  585. }
  586. .openImg {
  587. text-align: center;
  588. margin: 10px 15px 20px 10px;
  589. }
  590. .text {
  591. font-size: 12px;
  592. text-align: center;
  593. margin-top: -30px;
  594. padding-bottom: 15px;
  595. }
  596. .rzLine {
  597. width: 50%;
  598. margin-left: 15px;
  599. margin-right: 15px;
  600. margin-bottom: 10px;
  601. }
  602. .rzEnd {
  603. width: 40px;
  604. height: 40px;
  605. }
  606. .rzImg {
  607. width: 40px;
  608. height: 40px;
  609. }
  610. img {
  611. display: inline-block;
  612. }
  613. .titlePro {
  614. font-size: 12px;
  615. margin-left: 10px;
  616. display: flex;
  617. justify-content: space-between;
  618. .num {
  619. margin-right: 15px;
  620. }
  621. }
  622. }
  623. .faildBox {
  624. width: 31%;
  625. min-width:334px;
  626. background: #fff;
  627. float: left;
  628. margin-left: 20px;
  629. height: 334px;
  630. overflow-y: auto;
  631. }
  632. .failTitlt {
  633. font-size: 12px;
  634. margin-top: 15px;
  635. margin-left: 10px;
  636. margin-bottom: 15px;
  637. }
  638. .failper {
  639. font-size: 12px;
  640. margin-left: 10px;
  641. margin-bottom: 20px;
  642. line-height: 20px;
  643. }
  644. .sonProduct {
  645. padding-top: 10px;
  646. }
  647. .openItem {
  648. width: 31%;
  649. min-width: 348px;
  650. height: 150px;
  651. background: #fff;
  652. margin-left: 20px;
  653. display: inline-block;
  654. margin-bottom: 20px;
  655. float: left;
  656. position: relative;
  657. .overTime{
  658. position: absolute;
  659. top: 10px;
  660. right: 10px;
  661. }
  662. }
  663. }
  664. </style>