index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <el-dialog :visible.sync="dialogFormVisible" width="700px" :before-close="beforeClose" :show-close="showClose">
  3. <div class="serviceTitle" slot="title">
  4. <span class="squat"></span>服务到期提醒
  5. </div>
  6. <p class="tips">
  7. <i class="el-icon-info"></i
  8. >您的以下服务即将到期,为了不影响学员的正常使用请联系本机构管理员及时续费
  9. </p>
  10. <div class="descriptions-container">
  11. <div class="descriptions">
  12. <div class="title">
  13. <i class="remind iconfont icon-banbenhuiyuantubiao"></i>
  14. 服务信息</div>
  15. <el-row style="padding: 0 20px 10px">
  16. <el-col :span="12">
  17. <el-row>
  18. <el-col :span="24"
  19. >当前版本:<span class="color">{{ tInfo.serverName }}</span></el-col
  20. >
  21. <el-col :span="24"
  22. v-if="tInfo.expiryDateEnd"
  23. >服务有效期:<span class="color"
  24. >{{ tInfo.expiryDateEnd }}</span
  25. ></el-col
  26. >
  27. </el-row>
  28. </el-col>
  29. <el-col :span="10" :offset="2">
  30. <el-row>
  31. <el-col :span="24"
  32. >学员上限:<span class="color">{{ tInfo.studentNum }} / {{ tInfo.studentUpLimit }}人</span></el-col
  33. >
  34. <el-col :span="24"
  35. >有效期剩余:<span class="color">{{ tInfo.validRemaining }}天</span></el-col
  36. >
  37. </el-row>
  38. </el-col>
  39. </el-row>
  40. </div>
  41. <div class="descriptions">
  42. <div class="title">
  43. <i class="remind iconfont icon-yunjiaoshiyue"></i>
  44. 云教室余额</div>
  45. <el-row style="padding: 0 20px 10px;">
  46. <el-col :span="24"
  47. >云教室总余额:<span class="color">{{ tInfo.balance | moneyFormat}}元</span></el-col
  48. >
  49. </el-row>
  50. </div>
  51. </div>
  52. <div class="btn-section" v-if="$helpers.permission('/productService') && $helpers.permission('/serviceRenew')">
  53. <div class="submit" @click="onSubmit">立刻续费</div>
  54. </div>
  55. </el-dialog>
  56. </template>
  57. <script>
  58. import { mapGetters } from "vuex";
  59. import dayjs from 'dayjs';
  60. export default {
  61. name: "serviceRemind",
  62. data() {
  63. return {
  64. dialogFormVisible: false,
  65. showClose: true, // 是否显示关闭按钮
  66. tInfo: {
  67. serverName: null,
  68. studentNum: 0,
  69. studentUpLimit: 0,
  70. expiryDate: null,
  71. expiryDateEnd: null,
  72. validRemaining: 0, // 剩余有效期
  73. balance: 0
  74. }
  75. };
  76. },
  77. computed: {
  78. ...mapGetters(["tenantInfo", "baseTenantId"])
  79. },
  80. watch: {
  81. "$route"(){
  82. // 路由变化时重新判断是否需要续费
  83. this.__init()
  84. },
  85. tenantInfo() {
  86. // console.log('showInfo ing', this.tenantInfo)
  87. this.__init()
  88. }
  89. },
  90. mounted() {
  91. this.__init()
  92. },
  93. methods: {
  94. __init() {
  95. const { path, query } = this.$route
  96. const tenantInfo = this.tenantInfo
  97. const tenantRenewStatus = sessionStorage.getItem('tenantRenewStatus')
  98. // 判断是否是平台的
  99. if(tenantRenewStatus || this.baseTenantId <= 0) {
  100. this.dialogFormVisible = false
  101. } else {
  102. this.tInfo = { ...tenantInfo }
  103. // 有效期如果小于0则不能关闭弹窗
  104. if(tenantInfo.validRemaining <= 0) {
  105. this.showClose = false
  106. } else if(tenantInfo.validRemaining <= 30 && tenantInfo.validRemaining > 0) {
  107. // 只要续费则弹窗
  108. this.dialogFormVisible = true
  109. this.showClose = true
  110. } else { // 大于30天
  111. this.showClose = true
  112. this.dialogFormVisible = false
  113. }
  114. // 如果是续费页面则不能弹续费, 并且tabrouter 也需要一起判断
  115. if(path === '/productService' && query.tabrouter == 1 || path === '/productService' && !query.tabrouter) {
  116. this.dialogFormVisible = false
  117. return
  118. }
  119. }
  120. },
  121. beforeClose() { // 续费弹窗关闭前
  122. const tInfo = this.tInfo
  123. if(tInfo.validRemaining > 0) { // 设置标识,如果机构可用天数大于1天,小于30天则,关闭一次,就不会在提示
  124. sessionStorage.setItem('tenantRenewStatus', 1)
  125. } else {
  126. sessionStorage.removeItem('tenantRenewStatus')
  127. }
  128. this.dialogFormVisible = false
  129. },
  130. onSubmit() {
  131. this.beforeClose()
  132. this.$router.push('/productService')
  133. }
  134. }
  135. };
  136. </script>
  137. <style lang="less" scoped>
  138. .serviceTitle {
  139. font-size: 26px;
  140. font-weight: 500;
  141. color: var(--color-primary);
  142. .squat {
  143. display: inline-block;
  144. margin-right: 10px;
  145. height: 17px;
  146. width: 5px;
  147. border-radius: 3px;
  148. background-color: var(--color-primary);
  149. }
  150. }
  151. .tips {
  152. font-size: 16px;
  153. line-height: 22px;
  154. color: #6d7278;
  155. .el-icon-info {
  156. color: #f7b500;
  157. margin-right: 6px;
  158. }
  159. }
  160. ::v-deep .el-dialog {
  161. background: url("./header_bg.png") no-repeat top center #fff;
  162. background-size: 100% auto;
  163. border-radius: 6px;
  164. overflow: hidden;
  165. .el-dialog__header {
  166. padding: 26px 26px 10px;
  167. background: transparent;
  168. .el-dialog__headerbtn .el-dialog__close {
  169. color: #000000;
  170. font-size: 14px;
  171. }
  172. }
  173. .el-dialog__body {
  174. padding: 0 26px 26px;
  175. }
  176. }
  177. .descriptions-container {
  178. display: flex;
  179. flex-direction: column;
  180. justify-content: space-between;
  181. margin-bottom: 15px;
  182. margin-top: 50px;
  183. .descriptions {
  184. border-radius: 6px;
  185. border: 1px solid #dde8ff;
  186. background: #fff;
  187. margin-bottom: 10px;
  188. .title {
  189. display: flex;
  190. align-items: center;
  191. // justify-content: space-between;
  192. padding: 18px;
  193. line-height: 28px;
  194. font-size: 20px;
  195. font-weight: 500;
  196. color: #212121;
  197. }
  198. }
  199. .el-col {
  200. height: 22px;
  201. line-height: 22px;
  202. font-size: 16px;
  203. color: #212121;
  204. display: table;
  205. span {
  206. color: #6d7278;
  207. }
  208. }
  209. .el-col-24 {
  210. padding-bottom: 15px;
  211. }
  212. .color {
  213. color: #6d7278;
  214. }
  215. }
  216. .btn-section {
  217. text-align: center;
  218. .submit {
  219. margin: 0 auto;
  220. width: 227px;
  221. height: 51px;
  222. cursor: pointer;
  223. background: linear-gradient(270deg, #FFC65E 0%, #FFE8A6 100%);
  224. border-radius: 26px;
  225. font-size: 24px;
  226. font-weight: 500;
  227. color: #981E13;
  228. line-height: 51px;
  229. }
  230. }
  231. .remind {
  232. display: inline-block;
  233. margin-right: 10px;
  234. font-size: 22px;
  235. color: var(--color-primary);
  236. }
  237. // .icon_service {
  238. // width: 22px;
  239. // height: 18px;
  240. // background: url("./icon_service.png") no-repeat center;
  241. // background-size: contain;
  242. // }
  243. // .icon_yunB {
  244. // width: 16px;
  245. // height: 22px;
  246. // background: url("./icon_yunB.png") no-repeat center;
  247. // background-size: contain;
  248. // }
  249. </style>