| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330 |
- <template>
- <view>
- <view class="section">
- <view class="sim_info_loding" v-if="loding">
- <image src="../../../static/images/cb/6286299.gif" mode="" class="img"></image>
- </view>
- <view class="tit">
- <image mode="widthFix" :src="$imageURL+'/bigdata_app/image/cb/sim1.png'"></image>
- 数据sim卡流量{{"("+sim.simnew+")"}}
- </view>
- <view class="item">
- <text>ICCID:</text>
- <text>{{sim.iccid}}</text>
- </view>
- <view class="item">
- <text>状态:</text>
- <text>{{sim.account_status}}</text>
- </view>
- <view class="item">
- <text>套餐:</text>
- <text>{{sim.data_plan}}MB</text>
- </view>
- <view class="item">
- <text>已用流量:</text>
- <text>{{sim.data_usage.toFixed(2)}}MB</text>
- </view>
- <view class="item">
- <text>剩余流量:</text>
- <text>{{sim.data_balance.toFixed(2)}}MB</text>
- </view>
- <view class="item">
- <text>到期时间:</text>
- <text v-if="sim.simnew=='新'">{{sim.expiry_date|timeFormat}}</text>
- <text v-else>{{sim.expiry_date|timeFormat}}</text>
- </view>
- </view>
- <template v-if="showHksimFlag">
- <view class="section">
- <view class="sim_info_loding" v-if="loding2">
- <image src="../../../static/images/cb/6286299.gif" mode="" class="img"></image>
- </view>
- <view class="tit">
- <image mode="widthFix" :src="$imageURL+'/bigdata_app/image/cb/sim2.png'"></image>
- 图片sim卡流量{{"("+hksim.simnew+")"}}
- </view>
- <view class="item">
- <text>ICCID:</text>
- <text>{{hksim.iccid}}</text>
- </view>
- <view class="item">
- <text>状态:</text>
- <text>{{hksim.account_status}}</text>
- </view>
- <view class="item">
- <text>套餐:</text>
- <text>{{hksim.data_plan}}MB</text>
- </view>
- <view class="item">
- <text>已用流量:</text>
- <text>{{hksim.data_usage}}MB</text>
- </view>
- <view class="item">
- <text>剩余流量:</text>
- <text>{{hksim.data_balance}}MB</text>
- </view>
- <view class="item">
- <text>到期时间:</text>
- <text v-if="hksim.simnew=='新'">{{hksim.expiry_date}}</text>
- <text v-else>{{hksim.expiry_date|timeFormat}}</text>
- </view>
- <view class="item">
- <text>更换ICCID:</text>
- <u-input v-model="hksiminp" type="text" :custom-style="sty" />
- </view>
- <view class="submit-box">
- <u-button @click="submit" type="warning">确定</u-button>
- </view>
- <u-toast ref="toast" />
- </view>
- </template>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- sim: {
- iccid: "",
- account_status: 0, //卡状态 0-7 未知 测试期 沉默期 使用中 停机 停机保号 预销号 销号
- data_plan: 0, //套餐大小
- data_usage: 0, //当月用量
- data_balance: 0, //剩余流量
- expiry_date: 0, //到期日期,
- simnew: ""
- },
- showHksimFlag: true, //是否显示hksim卡标识
- hksim: {
- iccid: "",
- account_status: 0, //卡状态 0-7 未知 测试期 沉默期 使用中 停机 停机保号 预销号 销号
- data_plan: 0, //套餐大小
- data_usage: 0, //当月用量
- data_balance: 0, //剩余流量
- expiry_date: 0, //到期日期
- simnew: ""
- },
- hksiminp: '', //更换ICCID
- d_id: '',
- sty: {
- 'background': '#F7F8FA'
- },
- loding: false,
- loding2: false
- }
- },
- onLoad(option) {
- if (Number(option.device_type) == 4) {
- this.showHksimFlag = false
- }
- this.d_id = option.d_id
- this.lookSIMCode('sim')
- if (option.device_type != 4) {
- this.lookSIMCode('hksim')
- }
- this.loding = true
- this.loding2 = true
- },
- methods: {
- async lookSIMCode(flag) {
- let res = await this.$myRequest({
- url: '/api/api_gateway?method=forecast.send_control.device_sim',
- data: {
- d_id: this.d_id,
- type: flag
- }
- })
- let res2 = await this.$myRequest({
- url: '/api/api_gateway?method=forecast.send_control.sim_query',
- data: {
- iccid: res[0].iccid,
- }
- })
- let obj = res2.data.data
- this.loding = false
- this.loding2 = false
- if (res2.code == 1) { //企鹏 新
- var state = ""
- switch (obj.deviceStatus) {
- case "TEST_READY_NAME":
- state = "可测试"
- break;
- case "INVENTORY_NAME":
- state = "库存"
- break;
- case "ACTIVATION_READY_NAME":
- state = "可激活"
- break;
- case "ACTIVATED_NAME":
- state = "已激活"
- break;
- case "DEACTIVATED_NAME":
- state = "已停卡"
- break;
- case "RETIRED_NAME":
- state = "已销卡"
- break;
- case "PURGED_NAME":
- state = "已清除"
- break;
- }
- if (flag == 'sim') {
- this.sim = {
- iccid: res[0].iccid,
- account_status: state,
- data_plan: obj.totalDataVolume, //套餐大小
- data_usage: obj.usedDataVolume, //当月用量
- data_balance: Number(obj.totalDataVolume) - Number(obj.usedDataVolume), //剩余流量
- expiry_date: obj.dateDeactivated, //到期日期,
- simnew: "新"
- }
- // this.loding = false
- } else if (flag == 'hksim') {
- this.hksim = {
- iccid: res[0].iccid,
- account_status: state,
- data_plan: obj.totalDataVolume, //套餐大小
- data_usage: obj.usedDataVolume, //当月用量
- data_balance: Number(obj.totalDataVolume) - Number(obj.usedDataVolume), //剩余流量
- expiry_date: obj.expireDate, //到期日期
- simnew: "新"
- }
- // this.loding2 = false
- }
- } else if (res2.code == 2) { //合宙 旧
- var state = ""
- switch (obj.account_status) {
- case 0:
- state = "未知"
- break;
- case 1:
- state = "测试期"
- break;
- case 2:
- state = "沉默期"
- break;
- case 3:
- state = "使用中"
- break;
- case 4:
- state = "停机"
- break;
- case 5:
- state = "停机保号"
- break;
- case 6:
- state = "预销号"
- break;
- case 7:
- state = "销号"
- break;
- }
- this.simnew = "旧"
- if (flag == 'sim') {
- this.sim = {
- iccid: res[0].iccid,
- account_status: state, //卡状态 0-7 未知 测试期 沉默期 使用中 停机 停机保号 预销号 销号
- data_plan: obj.data_plan, //套餐大小
- data_usage: obj.data_usage, //当月用量
- data_balance: obj.data_balance, //剩余流量
- expiry_date: obj.expiry_date, //到期日期
- simnew: "旧"
- }
- // this.loding = false
- } else if (flag == 'hksim') {
- this.hksim = {
- iccid: res[0].iccid,
- account_status: state, //卡状态 0-7 未知 测试期 沉默期 使用中 停机 停机保号 预销号 销号
- data_plan: obj.data_plan, //套餐大小
- data_usage: obj.data_usage, //当月用量
- data_balance: obj.data_balance, //剩余流量
- expiry_date: obj.expiry_date, //到期日期
- simnew: "旧"
- }
- // this.loding2 = false
- }
- }
- },
- async submit() {
- let res = await this.$myRequest({
- url: '/api/api_gateway?method=forecast.send_control.device_sim',
- data: {
- d_id: this.d_id,
- iccid: this.hksiminp,
- type: "change",
- }
- })
- this.$refs.toast.show({
- title: '修改成功!',
- type: 'success',
- callback: function() {
- uni.navigateBack({
- delta: 1
- });
- }
- })
- }
- }
- }
- </script>
- <style lang="scss">
- page {
- padding: 30rpx;
- box-sizing: border-box;
- .section {
- padding: 30rpx;
- box-shadow: 0px 0px 5px 3px rgba(136, 136, 136, .1);
- margin-bottom: 20rpx;
- box-sizing: border-box;
- position: relative;
- .sim_info_loding {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- background-color: rgba(0, 0, 0, 0.3);
- border-radius: 20rpx;
- height: 100%;
- display: flex;
- justify-content: space-around;
- align-items: center;
- .img {
- width: 400rpx;
- height: 350rpx;
- }
- }
- .item {
- line-height: 56rpx;
- font-size: 26rpx;
- text:nth-child(1) {
- margin-right: 10rpx;
- }
- display:flex;
- }
- .tit {
- margin-bottom: 20rpx;
- font-size: 28rpx;
- image {
- width: 22rpx;
- margin-right: 10rpx;
- }
- }
- .submit-box {
- margin-top: 20rpx;
- }
- }
- }
- </style>
|