血透系统PC前端

myService.vue 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <div class="my-service">
  3. <div class="page-title" v-if="isShowProbationPeriod">
  4. <img src="../../../assets/service/shoplogo_init.png" alt="logo" class="page-title-logo">
  5. <div class="page-title-info">
  6. <h2>{{subscibe.Org.org_name}}<span class="EC1_BG">试用版</span></h2>
  7. <p>您的血透管理处于试用期<span class="EC5">
  8. </span></p>
  9. <span class="buy-version" @click="buy">立即购买 </span>
  10. </div>
  11. </div>
  12. <div class="page-title" v-if="isShowFormal">
  13. <img src="../../../assets/service/shoplogo_init.png" alt="logo" class="page-title-logo">
  14. <div class="page-title-info">
  15. <h2>{{subscibe.Org.org_name}}<span class="EC1_BG">标准版</span></h2>
  16. <p>您正在使用标准版血透管理<span class="EC5">{{time}}</span></p>
  17. <!--<span class="buy-version">立即购买 </span>-->
  18. </div>
  19. </div>
  20. <div class="page-title" v-if="isZYShowFormal">
  21. <img src="../../../assets/service/shoplogo_init.png" alt="logo" class="page-title-logo">
  22. <div class="page-title-info">
  23. <h2>{{subscibe.Org.org_name}}<span class="EC1_BG">专业版</span></h2>
  24. <p>您正在使用专业版血透管理<span class="EC5">{{time}}</span></p>
  25. <!--<span class="buy-version">立即购买 </span>-->
  26. </div>
  27. </div>
  28. <div class="page-title" v-if="isShowYj">
  29. <img src="../../../assets/service/shoplogo_init.png" alt="logo" class="page-title-logo">
  30. <div class="page-title-info">
  31. <h2>{{subscibe.Org.org_name}}<span class="EC1_BG">永久版</span></h2>
  32. <p>您正在使用永久版血透管理<span class="EC5"></span></p>
  33. <!--<span class="buy-version">立即购买 </span>-->
  34. </div>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. import {getServiceList} from "@/api/service"
  40. import timeDown from './timeDown.vue'
  41. import {uParseTime} from "@/utils/tools";
  42. export default {
  43. components : {
  44. timeDown
  45. },
  46. created() {
  47. this.getMyService()
  48. },
  49. name: "MyService",
  50. data() {
  51. return {
  52. isShowProbationPeriod: true,
  53. isShowFormal: true,
  54. isShowYj:true,
  55. isZYShowFormal:true,
  56. time: '',
  57. flag: false,
  58. serviceTime: '',
  59. expiryTime: '',
  60. leftTime:'',
  61. subscibe:{
  62. Org:{},
  63. }
  64. };
  65. },
  66. methods: {
  67. getMyService: function () {
  68. getServiceList().then(response => {
  69. this.subscibe = response.data.data.subscibe
  70. if(this.subscibe.state == 1){
  71. this.isShowFormal = true;
  72. this.isShowProbationPeriod = false;
  73. this.isShowYj = false;
  74. this.isZYShowFormal = false;
  75. this.leftTime = response.data.data.subscibe.period_end - response.data.data.serviceTime
  76. if(this.leftTime <= 0){
  77. this.flag = true
  78. this.time = '(已过期)'
  79. }
  80. }else if(this.subscibe.state == 8){
  81. this.isShowFormal = false;
  82. this.isShowProbationPeriod = false;
  83. this.isShowYj = false;
  84. this.isZYShowFormal = true;
  85. this.leftTime = response.data.data.subscibe.period_end - response.data.data.serviceTime
  86. if(this.leftTime <= 0){
  87. this.flag = true
  88. this.time = '(已过期)'
  89. }
  90. }else if(this.subscibe.state == 2){
  91. this.isShowProbationPeriod = true;
  92. this.isShowFormal = false;
  93. this.isShowYj = false;
  94. this.isZYShowFormal = false;
  95. }else if(this.subscibe.state == 9){
  96. this.isShowProbationPeriod = false;
  97. this.isShowFormal = false;
  98. this.isShowYj = true;
  99. this.isZYShowFormal = false;
  100. }else {
  101. this.isShowProbationPeriod = false;
  102. this.isShowFormal = false;
  103. this.isShowYj = false;
  104. this.isZYShowFormal = false;
  105. }
  106. })
  107. },
  108. buy:function () {
  109. this.$router.push("/service/buy");
  110. },
  111. timeDown() {
  112. let leftTime = this.leftTime
  113. let d = parseInt(leftTime / (24 * 60 * 60))
  114. let h = this.formate(parseInt(leftTime / (60 * 60) % 24))
  115. let m = this.formate(parseInt(leftTime / 60 % 60))
  116. let s = this.formate(parseInt(leftTime % 60))
  117. if (leftTime <= 0) {
  118. this.flag = true
  119. }else {
  120. this.time = d + '天' + h + '小时' + m + '分' + s + '秒'
  121. }
  122. }, formate(time) {
  123. if (time >= 10) {
  124. return time
  125. } else {
  126. return `0${time}`
  127. }
  128. },
  129. },
  130. mounted() {
  131. let time = setInterval(() => {
  132. if (this.flag == true) {
  133. clearInterval(time)
  134. }
  135. this.leftTime = this.leftTime - 1
  136. this.timeDown()
  137. }, 1000)
  138. },
  139. };
  140. </script>
  141. <style rel="stylesheet/scss" lang="scss" scoped>
  142. .my-service {
  143. padding: 10px;
  144. .page-title {
  145. background: white;
  146. box-shadow: 0px 6px 12px 0px rgba(0, 0, 0, 0.07),
  147. 0px 0px 4px 0px rgba(0, 0, 0, 0.05);
  148. border-radius: 2px;
  149. padding: 30px 20px;
  150. position: relative;
  151. display: flex;
  152. display: -webkit-flex;
  153. flex-direction: row;
  154. .page-title-logo {
  155. order: 1;
  156. width: 60px;
  157. height: 60px;
  158. margin-right: 10px;
  159. border-radius: 40px;
  160. }
  161. .page-title-info {
  162. order: 2;
  163. h2 {
  164. height: 28px;
  165. line-height: 28px;
  166. font-size: 20px;
  167. margin: 0;
  168. color: #353535;
  169. font-weight: normal;
  170. span {
  171. color: #fff;
  172. width: 44px;
  173. height: 16px;
  174. line-height: 16px;
  175. text-align: center;
  176. font-size: 12px;
  177. display: inline-block;
  178. position: relative;
  179. top: -2px;
  180. background: #409eff;
  181. margin: 0 0 0 12px;
  182. }
  183. }
  184. p {
  185. height: 20px;
  186. font-size: 14px;
  187. margin: 12px 0 0 0;
  188. color: #888;
  189. line-height: 20px;
  190. span {
  191. color: red;
  192. }
  193. }
  194. .buy-version {
  195. min-width: 100px;
  196. height: 36px;
  197. background: #409eff;
  198. border-radius: 2px;
  199. color: white;
  200. line-height: 20px;
  201. font-size: 14px;
  202. line-height: 36px;
  203. display: block;
  204. position: absolute;
  205. right: 20px;
  206. top: 50%;
  207. text-align: center;
  208. transform: translateY(-50%);
  209. padding: 0 15px;
  210. cursor: pointer;
  211. }
  212. }
  213. }
  214. }
  215. </style>