123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390 |
- <template>
- <view class="wrapper">
- <view class="account">
- <image :src="`${$imgUrl}common/bg-recharge.png`" class="head-bg"></image>
- <view class="account-text">
- <view class="balance">
- <text class="balance-tit">账户余额</text>
- <text class="balance-val">20.00元</text>
- </view>
- <view class="right-box">
- <view class="no">账户编号:000100</view>
- <view class="btn btn-record">账户充值记录</view>
- </view>
- </view>
- </view>
- <view class="input-box">
- <input placeholder="请输入金额" class="input" />
- <view class="tips">最低充值金额不小于10元</view>
- </view>
- <view class="tabs">
- <view class="tab-tit">在线充值</view>
- <view class="tab">
- <view class="item">50元</view>
- <view class="item active">100元</view>
- <view class="item">200元</view>
- <view class="item">300元</view>
- <view class="item">500元</view>
- <view class="item">1000元</view>
- </view>
- </view>
- <view class="btn btn-primary" @click="recharge">立即充值</view>
- </view>
- </template>
-
- <script setup lang="ts">
- import {
- stringToJson
- } from "@/utils/network/encryption";
- import navBar from "../components/nav-bar/nav-bar2.vue";
- import {
- onLoad,
- onShow
- } from "@dcloudio/uni-app";
- import {
- quanCheck,
- quanApply,
- quanXf,
- cardCzPayResultCheck,
- cardCzApply
- } from "@/utils/network/api.js";
- import {
- request
- } from "@/utils/network/request.js";
- import {
- reactive
- } from "vue";
- import {
- msg
- } from "@/utils/utils";
- import {
- getItem,
- StorageKeys
- } from "@/utils/storage";
- const datas = require("../../static/etcUtil/datas.js");
- const bluetoothUtil = require("../../static/etcUtil/index.js");
- const recharge = () => {
- uni.navigateTo({
- url: "/pages/recharge/result"
- })
- }
- onLoad((option) => {
- /*1.圈层检测*/
- quanCheckAction().then(val => {
- //圈层检测正常
- if (val.chargeStatus === 1) {
- czCheckAction()
-
- } else {
- if (option.connectSuccess !== '1') {
-
- uni.navigateTo({
- url: `/pages/bluetooth/device-active-step3?routeType=2`,
- });
-
-
- } else {
- let cmdArr = val.command.split(",");
- uni.showLoading({
- title: "写入中"
- })
- bluetoothUtil.transCmd(cmdArr, "10", function(res) {
- let response = res.toString();
- var dic = {
- command: val.command,
- cosResponse: response,
- rechargeId: val.rechargeId
- }
- quanFixAction(dic).then(value => {
- var fixStatus = value.fixStatus;
- //圈存修复COS指令Response信息不足,重新进行修复初始化
- if (fixStatus === 1) {
-
- } else if (fixStatus === 2) {
- quanApplyAction()
- //圈存确认
- } else if (fixStatus === 3) {
- //圈存确认
- }
- console.log('修复成功')
- })
- uni.hideLoading()
-
- });
- }
- }
- })
-
- });
- /*圈层检测*/
- const quanCheckAction = () => {
- var data = {
- cardId: '52011328220201979745',
- fee: 199,
- preBalance: 19588,
- tradeType: 14,
- agentId: "52010106004",
- channelId: "5201010200601130001",
- channelType: "1",
- staffId: "opId",
- terminalId: "999999999999"
- };
- const options = {
- type: 2,
- data: data,
- method: "POST",
- showLoading: true,
- };
- return new Promise(async (resolve, reject) => {
- const res = await request(quanCheck, options);
- const data = stringToJson(res.bizContent);
- resolve(data);
- }).catch((error) => {
- reject(error);
- });
- }
- /*圈存修复*/
- const quanFixAction = (val) => {
- var data = {
- command: val.command, //修复初始化的指令
- cosResponse: val.cosResponse, //修复初始化结果
- rechargeId: val.rechargeId, //充值流水号
- agentId: "52010106004",
- channelId: "5201010200601130001",
- channelType: "1",
- staffId: "opId",
- terminalId: "999999999999"
- };
- console.log('111111111')
- const options = {
- type: 2,
- data: data,
- method: "POST",
- showLoading: true,
- };
- return new Promise(async (resolve, reject) => {
- const res = await request(quanXf, options);
- const data = stringToJson(res.bizContent);
- resolve(data);
- }).catch((error) => {
- reject(error);
- });
- }
- /*圈层申请*/
- const quanApplyAction = (data) => {
-
- var form = {
- cardId: '52011328220201979745',
- fee: 50,
- preBalance: 100,
- tradeType: 14,
- command: data.command,
- cosResponse: '',
-
- agentId: "52010106004",
- channelId: "5201010200601130001",
- channelType: "1",
- staffId: "opId",
- terminalId: "999999999999"
- };
- const options = {
- type: 2,
- data: form,
- method: "POST",
- showLoading: true,
- };
- request(quanApply, options).then((res) => {
- const data = stringToJson(res.bizContent);
- quanApplyAction(data)
-
- });
- }
-
- /*充值检测*/
- const czCheckAction = (data) => {
- var form = {
- cardId: '52011328220201979745',
- openId: getItem(StorageKeys.OpenId),
- agentId: "52010106004",
- channelId: "5201010200601130001",
- channelType: "1",
- staffId: "opId",
- terminalId: "999999999999"
- };
- const options = {
- type: 2,
- data: form,
- method: "POST",
- showLoading: true,
- };
- request(cardCzPayResultCheck, options).then((res) => {
- const data = stringToJson(res.bizContent);
- cardCzApplyAction().then(val => {
- console.log(val)
- })
-
- });
- }
- const cardCzApplyAction = () => {
- var data = {
- cardId: '52011328220201979745',
- openId: getItem(StorageKeys.OpenId),
- rechargeMoney: 100,
- agentId: "52010106004",
- channelId: "5201010200601130001",
- channelType: "1",
- staffId: "opId",
- terminalId: "999999999999"
- };
- const options = {
- type: 2,
- data: data,
- method: "POST",
- showLoading: true,
- };
- return new Promise(async (resolve, reject) => {
- const res = await request(cardCzApply, options);
- const data = stringToJson(res.bizContent);
- resolve(data);
- }).catch((error) => {
- reject(error);
- });
- }
- </script>
-
- <style>
- .account {
- height: 224rpx;
- width: 690rpx;
- margin: 30rpx;
- position: relative;
- }
-
- .account .account-text {
- display: flex;
- justify-content: space-between;
- padding: 20rpx 50rpx;
- height: 100%;
- }
-
- .account .balance {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: flex-start;
- color: #ffffff;
- }
-
- .account .balance-tit {
- font-size: 26rpx;
- margin-bottom: 10rpx;
- }
-
- .account .balance-val {
- font-size: 56rpx;
- }
-
- .account .right-box {
- display: flex;
- flex-direction: column;
- justify-content: flex-start;
- align-items: flex-end;
- }
-
- .account .right-box .no {
- font-size: 26rpx;
- color: #ffffff;
- }
-
- .account .right-box .btn {
- font-size: 26rpx;
- padding: 0 20rpx;
- box-sizing: border-box;
- height: 42rpx;
- line-height: 42rpx;
- color: #28d20f;
- background: #ffffff;
- border-radius: 21rpx;
- display: inline-block;
- margin-top: 18rpx;
- }
-
- .account .head-bg {
- width: 690rpx;
- height: 224rpx;
- position: absolute;
- left: 0;
- top: 0;
- z-index: -99;
- }
-
- .input-box {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- padding: 20rpx 0;
- }
-
- .input-box .input {
- width: 430rpx;
- height: 98rpx;
- line-height: 98rpx;
- background: #f8f8f8;
- border: 1px solid #999999;
- border-radius: 6rpx;
- font-size: 30rpx;
- text-align: center;
- }
-
- .input-box .tips {
- color: #666666;
- font-size: 26rpx;
- margin-top: 18rpx;
- }
-
- .tabs {}
-
- .tabs .tab-tit {
- font-size: 30rpx;
- color: #333;
- padding: 45rpx 0 22rpx 30rpx;
- }
-
- .tabs .tab {
- display: flex;
- flex-wrap: wrap;
- justify-content: space-evenly;
- }
-
- .tabs .tab .item {
- width: 210rpx;
- height: 100rpx;
- background: #F6FFF7;
- border: 1px solid #DCDDE1;
- box-sizing: border-box;
- line-height: 100rpx;
- border-radius: 6rpx;
- text-align: center;
- margin-bottom: 24rpx;
- color: #333333;
- font-size: 32rpx;
- }
-
- .tabs .tab .item.active {
- border: 1px solid #24cc49;
- color: #24cc49;
- }
-
- .btn-primary {
- width: 670rpx;
- height: 80rpx;
- line-height: 80rpx;
- background: linear-gradient(-90deg, #43A1E0 0%, #13E7C1 100%);
- border-radius: 40rpx;
- font-size: 32rpx;
- color: #ffffff;
- margin: 200rpx 40rpx 0;
- text-align: center;
- }
- </style>
|