sim.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <view>
  3. <view class="section">
  4. <view class="tit">
  5. <image mode="widthFix" src="http://static.yfpyx.com/bigdata_app/image/cb/sim1.png" ></image>
  6. 数据sim卡流量
  7. </view>
  8. <view class="item">
  9. <text>ICCID:</text>
  10. <text>{{sim.iccid}}</text>
  11. </view>
  12. <view class="item">
  13. <text>状态:</text>
  14. <text>{{sim.account_status|simStatus}}</text>
  15. </view>
  16. <view class="item">
  17. <text>套餐:</text>
  18. <text>{{sim.data_plan}}MB</text>
  19. </view>
  20. <view class="item">
  21. <text>已用流量:</text>
  22. <text>{{sim.data_usage}}MB</text>
  23. </view>
  24. <view class="item">
  25. <text>剩余流量:</text>
  26. <text>{{sim.data_balance}}MB</text>
  27. </view>
  28. <view class="item">
  29. <text>到期时间:</text>
  30. <text>{{sim.expiry_date|timeFormat}}</text>
  31. </view>
  32. </view>
  33. <template v-if="showHksimFlag">
  34. <view class="section">
  35. <view class="tit">
  36. <image mode="widthFix" src="http://static.yfpyx.com/bigdata_app/image/cb/sim2.png" ></image>
  37. 图片sim卡流量
  38. </view>
  39. <view class="item">
  40. <text>ICCID:</text>
  41. <text>{{hksim.iccid}}</text>
  42. </view>
  43. <view class="item">
  44. <text>状态:</text>
  45. <text>{{hksim.account_status|simStatus}}</text>
  46. </view>
  47. <view class="item">
  48. <text>套餐:</text>
  49. <text>{{hksim.data_plan}}MB</text>
  50. </view>
  51. <view class="item">
  52. <text>已用流量:</text>
  53. <text>{{hksim.data_usage}}MB</text>
  54. </view>
  55. <view class="item">
  56. <text>剩余流量:</text>
  57. <text>{{hksim.data_balance}}MB</text>
  58. </view>
  59. <view class="item">
  60. <text>到期时间:</text>
  61. <text>{{hksim.expiry_date|timeFormat}}</text>
  62. </view>
  63. <view class="item">
  64. <text>更换ICCID:</text>
  65. <u-input v-model="hksiminp" type="text" :custom-style="sty" />
  66. </view>
  67. <view class="submit-box">
  68. <u-button @click="submit" type="warning">确定</u-button>
  69. </view>
  70. <u-toast ref="toast" />
  71. </view>
  72. </template>
  73. </view>
  74. </template>
  75. <script>
  76. export default {
  77. data() {
  78. return {
  79. sim: {
  80. iccid: "",
  81. account_status: 0, //卡状态 0-7 未知 测试期 沉默期 使用中 停机 停机保号 预销号 销号
  82. data_plan: 0, //套餐大小
  83. data_usage: 0, //当月用量
  84. data_balance: 0, //剩余流量
  85. expiry_date: 0, //到期日期
  86. },
  87. showHksimFlag: true, //是否显示hksim卡标识
  88. hksim: {
  89. iccid: "",
  90. account_status: 0, //卡状态 0-7 未知 测试期 沉默期 使用中 停机 停机保号 预销号 销号
  91. data_plan: 0, //套餐大小
  92. data_usage: 0, //当月用量
  93. data_balance: 0, //剩余流量
  94. expiry_date: 0, //到期日期
  95. },
  96. hksiminp:'',//更换ICCID
  97. d_id:'',
  98. sty:{
  99. 'background':'#F7F8FA'
  100. }
  101. }
  102. },
  103. onLoad(option){
  104. if(Number(option.device_type)==4){
  105. this.showHksimFlag = false
  106. }
  107. this.d_id=option.d_id
  108. this.lookSIMCode('sim')
  109. this.lookSIMCode('hksim')
  110. },
  111. filters: {
  112. simStatus(val) {
  113. switch (val) {
  114. case 0:
  115. return "未知";
  116. case 1:
  117. return "测试期";
  118. case 2:
  119. return "沉默期";
  120. case 3:
  121. return "使用中";
  122. case 4:
  123. return "停机";
  124. case 5:
  125. return "停机保号";
  126. case 6:
  127. return "预销号";
  128. case 7:
  129. return "销号";
  130. }
  131. },
  132. },
  133. methods: {
  134. async lookSIMCode(flag){
  135. let res=await this.$myRequest({
  136. url:'/api/api_gateway?method=forecast.send_control.device_sim',
  137. data:{
  138. d_id:this.d_id,
  139. type:flag
  140. }
  141. })
  142. let res2=await this.$myRequest({
  143. url:'/api/api_gateway?method=forecast.send_control.sim_query',
  144. data:{
  145. iccid:res[0].iccid,
  146. }
  147. })
  148. // let obj=eval('('+res2.data+')').data
  149. let obj = res2.data.data
  150. console.log(obj)
  151. if(flag=='sim'){
  152. this.sim={
  153. iccid: res[0].iccid,
  154. account_status: obj.account_status, //卡状态 0-7 未知 测试期 沉默期 使用中 停机 停机保号 预销号 销号
  155. data_plan: obj.data_plan, //套餐大小
  156. data_usage: obj.data_usage, //当月用量
  157. data_balance:obj.data_balance, //剩余流量
  158. expiry_date:obj.expiry_date, //到期日期
  159. }
  160. }else if(flag=='hksim'){
  161. this.hksim={
  162. iccid: res[0].iccid,
  163. account_status: obj.account_status, //卡状态 0-7 未知 测试期 沉默期 使用中 停机 停机保号 预销号 销号
  164. data_plan: obj.data_plan, //套餐大小
  165. data_usage: obj.data_usage, //当月用量
  166. data_balance:obj.data_balance, //剩余流量
  167. expiry_date: obj.expiry_date, //到期日期
  168. }
  169. }
  170. },
  171. async submit(){
  172. let res=await this.$myRequest({
  173. url:'/api/api_gateway?method=forecast.send_control.device_sim',
  174. data:{
  175. d_id: this.d_id,
  176. iccid: this.hksiminp,
  177. type: "change",
  178. }
  179. })
  180. this.$refs.toast.show({
  181. title: '修改成功!',
  182. type: 'success',
  183. callback:function(){
  184. uni.navigateBack({
  185. delta: 1
  186. });
  187. }
  188. })
  189. }
  190. }
  191. }
  192. </script>
  193. <style lang="scss">
  194. page{
  195. padding:30rpx;
  196. box-sizing: border-box;
  197. .section{
  198. padding:30rpx;
  199. box-shadow: 0px 0px 5px 3px rgba(136,136,136,.1);
  200. margin-bottom:20rpx;
  201. box-sizing: border-box;
  202. .item{
  203. line-height:56rpx;
  204. font-size:26rpx;
  205. text:nth-child(1){
  206. margin-right:10rpx;
  207. }
  208. display:flex;
  209. }
  210. .tit{
  211. margin-bottom:20rpx;
  212. font-size:28rpx;
  213. image{
  214. width:22rpx;
  215. margin-right:10rpx;
  216. }
  217. }
  218. .submit-box{
  219. margin-top:20rpx;
  220. }
  221. }
  222. }
  223. </style>