sim.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view>
  3. <view class="status_bar"></view>
  4. <view class="" style="position: relative;top: 40px;">
  5. <view style="position: fixed;z-index: 100;width: 100%;">
  6. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="sim卡详情"></uni-nav-bar>
  7. </view>
  8. <view class="sim_info">
  9. <view class="sim_info_loding" v-if="loding">
  10. <image src="../../static/images/cb/6286299.gif" mode="" class="img"></image>
  11. </view>
  12. <view class="sim_info_title">
  13. <image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/cb/sim1.png'" mode=""></image>
  14. <p>sim卡查询{{"("+simnew+")"}}</p>
  15. </view>
  16. <view class="sim_info_text">
  17. <p>运营商:{{siminfo.data.carrier}}</p>
  18. <p>ICCID:{{iccid}}</p>
  19. <p>状态:{{state}}</p>
  20. <p>套餐:{{siminfo.data.data_plan || siminfo.data.totalDataVolume}}MB</p>
  21. <p v-if="simnew=='旧'">已用流量:{{siminfo.data.data_usage.toFixed(2)}}MB</p>
  22. <p v-if="simnew=='新'">已用流量:{{siminfo.data.usedDataVolume.toFixed(2)}}MB</p>
  23. <p v-if="simnew=='旧'">剩余流量:{{siminfo.data.data_balance.toFixed(2)}}MB</p>
  24. <p v-if="simnew=='新'">剩余流量:{{(siminfo.data.totalDataVolume-siminfo.data.usedDataVolume).toFixed(2)}}MB</p>
  25. <p v-if="simnew=='旧'">到期时间:{{siminfo.data.outbound_date|timeFormat()}}</p>
  26. <p v-if="simnew=='新'">到期时间:{{siminfo.data.ratePlanExpirationDate}}</p>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. data() {
  35. return {
  36. iccid: '',
  37. siminfo: {
  38. data: {
  39. carrier: "--",
  40. account_status: "--",
  41. data_plan: "--",
  42. data_usage: "--",
  43. data_balance: "--",
  44. outbound_date: ""
  45. }
  46. },
  47. state:"",
  48. id: '',
  49. simnew:"",
  50. loding:false
  51. }
  52. },
  53. methods: {
  54. async simid(data) { //获取sim卡号
  55. const res = await this.$myRequest({
  56. url: '/api/api_gateway?method=forecast.send_control.device_sim',
  57. data: {
  58. d_id: data,
  59. type: 'sim'
  60. }
  61. })
  62. if(res.length!=0){
  63. this.iccid = res[0].iccid
  64. this.simdata(this.iccid)
  65. }
  66. },
  67. async simdata(data) { //获取sim信息
  68. const res = await this.$myRequest({
  69. url: '/api/api_gateway?method=forecast.send_control.sim_query',
  70. data: {
  71. iccid: data
  72. }
  73. })
  74. if(res.code==1){//企鹏
  75. this.simnew = "新"
  76. switch (res.data.data.deviceStatus){
  77. case "ACTIVATION_READY_NAME":
  78. this.state = "可测试"
  79. break;
  80. case "TEST_READY_NAME":
  81. this.state = "库存"
  82. break;
  83. case "INVENTORY_NAME":
  84. this.state = "可激活"
  85. break;
  86. case "ACTIVATION_READY_NAME":
  87. this.state = "已激活"
  88. break;
  89. case "ACTIVATED_NAME":
  90. this.state = "已停卡"
  91. break;
  92. case "DEACTIVATED_NAME":
  93. this.state = "已销卡"
  94. break;
  95. case "RETIRED_NAME":
  96. this.state = "已清除"
  97. break;
  98. }
  99. }else if(res.code==2){//合宙
  100. var arr = ['未知', '测试期', '沉默期', '使用中', '停机', '停机保号', '预销号', '销号']
  101. this.state = arr[res.data.data.active]
  102. this.simnew = "旧"
  103. }
  104. this.siminfo = res.data
  105. this.loding = false
  106. console.log(this.siminfo.data)
  107. },
  108. clickLeft() {
  109. uni.navigateBack({
  110. delta: 1
  111. })
  112. }
  113. },
  114. onLoad(option) {
  115. console.log(option)
  116. this.id = option.id
  117. this.loding = true
  118. this.simid(this.id)
  119. }
  120. }
  121. </script>
  122. <style lang="scss">
  123. .sim_info {
  124. width: 90%;
  125. position: absolute;
  126. top: 54px;
  127. left: 5%;
  128. box-shadow: 0 0 10rpx #bcb9ca;
  129. padding: 30rpx 20rpx 50rpx;
  130. border-radius: 20rpx;
  131. box-sizing: border-box;
  132. .sim_info_loding{
  133. position: absolute;
  134. top: 0;
  135. left: 0;
  136. width: 100%;
  137. background-color: rgba(0,0,0,0.3);
  138. border-radius: 20rpx;
  139. height: 100%;
  140. display: flex;
  141. justify-content: space-around;
  142. align-items: center;
  143. .img{
  144. width: 400rpx;
  145. height: 350rpx;
  146. }
  147. }
  148. .sim_info_title {
  149. width: 100%;
  150. display: flex;
  151. image {
  152. width: 24rpx;
  153. height: 32rpx;
  154. margin: 6rpx 20rpx 0 0;
  155. }
  156. p {
  157. font-weight: 700;
  158. }
  159. }
  160. .sim_info_text {
  161. width: 100%;
  162. padding-left: 44rpx;
  163. p {
  164. height: 30rpx;
  165. margin-top: 20rpx;
  166. font-size: 26rpx;
  167. }
  168. }
  169. }
  170. </style>