123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496 |
- <template>
- <view>
- <ujp-navbar title="帮人充值" :isBack="isBack" :customBack="customBack">
- <view class="slot-wrap">
-
- <span class="navBtn " @click="toRefundList"> <u-icon name="clock"></u-icon>充值记录</span>
- </view>
- </ujp-navbar>
- <view class="recharge">
- <view class="recharge-text">
- <p >充值手机号 </p >
- <p v-show="queryCard.query&&queryCard.name">
- 用户姓名:{{queryCard.name}}
- </p>
- <u-input v-model="phone" style=" border-bottom: 1px solid rgb(220, 223, 230);"
- :custom-style="{
- 'font-size': '48rpx',
- 'line-height': '48rpx',
- }"
- :placeholder-style="{
- 'font-size': '48rpx',
- 'line-height': '48rpx',
- 'color':' rgba(204, 204, 204, 1)',
- }"
- height="82" placeholder="请输入充值手机号" ></u-input>
- <view style="
- color: red;
- font-size: 16px;
- ">{{errorText}}</view>
- </view>
-
- </view>
-
-
- <view class="rechargeBk" v-if="queryCard.query&&queryCard.chargingCardList&&queryCard.chargingCardList.length">
- <view class="rechargeBkInfo" >
-
- <view class="recharge-text">
- <p>账户余额(元)</p>
- <h1>{{queryCard.amount}}</h1>
- </view>
- <view class="recharge-text">
- <p>充电卡号</p>
- <h1>{{queryCard.chargingCardList[0].cardNo}}</h1>
- </view>
- </view>
- </view>
- <view class="rechargeList" v-if="queryCard.query&&queryCard.chargingCardList&&queryCard.chargingCardList.length" >
- <view class="rechargeList1" @click="showCardBtn(queryCard.chargingCardList.length)">
- <view>
- 您的手机号下共有<span class="span">{{queryCard.chargingCardList.length}}</span>张卡
- </view>
- <view v-if="queryCard.chargingCardList.length>5">
- <span v-show="showCard" >
- <u-icon name="arrow-up" ></u-icon>收起
- </span>
- <span v-show="!showCard" >
- <u-icon name="arrow-down" ></u-icon>展开
- </span>
-
- </view>
- </view>
- <view v-show="showCard" class="rechargeList2">
- 充电卡号:
- <template v-for="(item,i) in queryCard.chargingCardList">
- <template v-if="i!=0">
- ,
- </template>
- <span class="rechargeList2Item" :key="i">
- {{item.cardNo}}
- </span>
- </template>
-
- </view>
- </view>
-
-
- <view >
- <view class="charge" >
- <view class="chargeTit">
- 选择充值金额
- </view>
- <view class="chargeMain">
- <template v-for="(item,i) in list">
-
- <view :key="i" :class="{
- 'active':amount==item
- }" @click="amount=item"
- class="chargeMain-item "><p>{{item}}元</p></view>
-
-
- </template>
- </view>
- </view>
- <view style=" padding-bottom: 240rpx; " >
- <view class="charge">
- <view class="chargeRadio">
- <view class="u-flex">
- <u-icon name="weixinzhifu" custom-prefix="custom-icon" color="#22ac38" size="80"></u-icon>
- <view class="chargeRadio-text">
- <h4>微信支付</h4>
- <p>推荐微信支付</p>
- </view>
- </view>
- <u-radio-group>
- <u-radio></u-radio>
- </u-radio-group>
- </view>
- </view>
-
- </view>
-
- <view class="foot-btn" >
- <view class="foot-pirce">
- <u-icon name="tikuan" custom-prefix="custom-icon" color="#FF9502" size="48"></u-icon>
- <span>支付 {{amount}} 元</span>
- </view>
- <u-button type="primary" @click="submit" :custom-style="customStyle" shape="square">{{btnText}}</u-button>
- </view>
- </view>
-
- </view>
- </template>
- <script>
- import * as Pay from '@/apis/weixin.js'
- import {
- checkPhone
- } from '@/utils'
- import {
- wxPayJs
- } from '@/utils/wxpay'
- import * as API from '@/apis/otherRecharge.js'
-
-
- export default {
- data() {
- return {
- queryCard:{},
- showCard:false,
- isReady:false,
- customStyle: {
- background: '#1677ff'
- },
- detail:{},
- isBack:true,
- chargingMarketingId:'',
- selectItem:{},
- list:[5,10,20,50,100,200],
- amount:5,
- phone:"",
- btnText:"请输入手机号",
- errorText:"",
- }
- },
- onLoad(op){
- if(op.phone){
- this.phone=op.phone
- this.findByPhone()
- }
- },
- onReady() {
-
- },
- watch:{
- phone(old){
- if(old&&old.length==11){
- var checkPhoneResult = checkPhone(old);
-
- if ( checkPhoneResult !== true) {
- this.btnText=checkPhoneResult
- }else{
- this.findByPhone()
- }
- }else{
- this.btnText="请输入手机号"
- this.queryCard={
- query:false,
- chargingCardList:[]
- }
- this.errorText="";
- }
- },
- },
- methods: {
- showCardBtn(num){
- if(num>5){
- this.showCard=!this.showCard
-
-
- }
-
- },
-
- findByPhone(){
- var checkPhoneResult = checkPhone(this.phone);
-
- if ( checkPhoneResult !== true) {
- uni.showToast({
- title: checkPhoneResult,
-
- })
- return;
- }
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- API.findByPhone({
- phone: this.phone,
-
- }).then((response) => {
-
- var data = response.data
- uni.hideLoading()
- this.queryCard={
- query:true,
- amount:data.userAccount.availableBalance,
- name:data.regUser.realName,
- chargingCardList:data.chargingCardList
- }
- if(data.chargingCardList>5){
- this.showCard=false
- }else{
- this.showCard=true
- }
- this.btnText="充值"
- }).catch(error => {
- uni.hideLoading()
- this.queryCard={
- query:false,
- chargingCardList:[]
- }
- this.errorText=error;
- })
- },
- customBack(){
- uni.reLaunch({
- url: '/pages/user/rechargeIndex'
- })
- },
- toRefundList() {
- uni.navigateTo({
- url: '/pages/user/rechargeListByPhone'
- })
- },
- submit(){
-
- if(!this.queryCard.query){
- uni.showModal({
- title:"提示",
- content:this.errorText?this.errorText:this.btnText,
- showCancel:false,
- })
- return
- }
- var checkPhoneResult = checkPhone(this.phone);
-
- // if ( checkPhoneResult !== true) {
- // uni.showToast({
- // title: checkPhoneResult,
-
- // })
- // return;
- // }
-
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- Pay.wxJsapiPayByPhone({
- openId:this.carhelp.getOpenId(),
- phone:this.phone,
- amount:this.amount
- }).then((response) => {
- if(!response.result){
- uni.showToast({
- title: response.message
- })
- return
- }
- var data = response.data
- uni.hideLoading()
- console.log("Pay+"+new Date().getTime())
- wxPayJs(data);
-
- }).catch(error => {
- uni.hideLoading()
- uni.showModal({
- title:"提示",
- content:error,
- showCancel:false,
- })
- })
- },
-
-
- },onShow(){
- if(this.isReady){
-
- }
- }
- }
- </script>
- <style>
- page{
- background-color: #f7f7f7;
- }
- </style>
- <style lang="scss" scoped>
- .rechargeList{
- padding: 30rpx;
- background-color: #fff;
- margin-bottom: 20rpx;
- .rechargeList1{
- display: flex;
- justify-content: space-between;
- width: 100%;
- .span{
- color: #FF5722;
- margin: 0 6rpx;
- }
- }
- .rechargeList2{
- margin-top: 10rpx;
- }
- .rechargeList2Item{
- margin: 12rpx;
- font-size: 32rpx;
- }
- }
- .slot-wrap{
- flex: 1;
- }
- .navBtn{
- float: right;
- margin-right: 30rpx;
- color:#1677FF ;
- }
-
- .rechargePhone{
- display: flex;
- justify-content: space-between;
- align-items: center;
- //padding: 15px;
- //background-color: #1677FF;
- background-color: #fff;
- .recharge-btn{
- width: 120rpx;
- height: 60rpx;
- text-align: center;
- line-height: 60rpx;
- background-color: #589EFF;
- color:#fff;
- border-radius: 15px;
- }
- }
- .rechargeBk{
- .rechargeBkInfo{
- display: flex;
- justify-content: space-around;
- align-items: center;
-
- }
- .recharge-text-name{
- width: 200rpx;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- padding: 30rpx;
- background-color: #1677FF;
-
- margin-bottom: 20rpx;
- .recharge-text{
- color:#fff;
- // width: 100%;
- white-space: pre;
- }
-
-
- }
-
- .recharge{
- padding: 30rpx;
- //background-color: #1677FF;
- background-color: #fff;
-
-
- .recharge-text{
- //color:#fff;
- width: 100%;
- }
- .recharge-btn{
- width: 120rpx;
- height: 60rpx;
- text-align: center;
- line-height: 60rpx;
- background-color: #589EFF;
- color:#fff;
- border-radius: 15px;
- }
- }
- .charge{
- padding: 30rpx;
- background-color: #fff;
- margin-bottom: 40rpx;
- }
- .chargeRadio{
- display: flex;
- justify-content: space-between;
- align-items: center;
- width: 100%;
- .chargeRadio-text{
- margin-left: 10rpx;
- h4{
- font-weight: normal;
- font-size: 30rpx;
- }
- p{
- font-size: 24rpx;
- color:#999;
- margin-top: 10rpx;
- }
- }
- }
- .chargeTit{
- border-bottom: 1px solid #f7f7f7;
- padding-bottom: 20rpx;
- font-size: 30rpx;
- }
- .chargeMain{
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- margin-top: 40rpx;
- .chargeMain-item{
- width: 32%;
- text-align: center;
- padding: 20rpx;
- border: 1px solid rgba(22, 119, 255, 1);
- margin-bottom: 20rpx;
- border-radius: 5px;
- color:#333;
- color: rgba(22, 119, 255, 1);
- position: relative;
- p{
- font-size: 40rpx;
- }
- span{
- background-color: #ff8d00;
- color:#fff;
- padding: 4rpx 20rpx;
- border-radius:0 10px 0 10px;
- position: absolute;
- font-size: 24rpx;
- right: -4rpx;
- top: -4rpx;
- }
- }
- .active{
- border-color:rgba(22, 119, 255, 1);
-
- background-color: rgba(22, 119, 255, 1);
- color: rgba(255, 255, 255, 1);
- }
- .fault{
- background-color:#e1e1e1;
- color:#666;
- border: 1px solid #ccc;
- }
- .occupy{
- color:#FF4F3F;
- border: 1px solid #FF4F3F;
- }
- }
- .foot-btn{
- padding: 20rpx;
- position: fixed;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: #fff;
- .foot-pirce{
- display: flex;
- align-items: center;
- span{
- margin-left: 10rpx;
- font-size: 32rpx;
- }
- padding-bottom: 20rpx;
- border-bottom: 1px solid #f7f7f7;
- margin-bottom: 20rpx;
- }
- }
- </style>
|