|
|
|
@ -7,22 +7,24 @@ |
|
|
|
<view class="top"> |
|
|
|
<view class="lf-flex"> |
|
|
|
<view class="avatar"> |
|
|
|
<image src="https://picsum.photos/200"></image> |
|
|
|
<image :src="userInfo.avatar"></image> |
|
|
|
</view> |
|
|
|
<view class="phone">182****5380</view> |
|
|
|
<view class="phone">{{ userInfo.mobile_replace }}</view> |
|
|
|
</view> |
|
|
|
<view class="card"> |
|
|
|
<text class="lf-iconfont icon--1"></text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="balance">余额 ¥1829.83</view> |
|
|
|
<view class="barcode"> |
|
|
|
<lf-barcode :options="config.bar"></lf-barcode> |
|
|
|
</view> |
|
|
|
<view class="qrcode"> |
|
|
|
<lf-qrcode :options="config.qrc"></lf-qrcode> |
|
|
|
<!-- <view class="card"> |
|
|
|
<text class="lf-iconfont icon-daifukuan"></text> |
|
|
|
</view> --> |
|
|
|
</view> |
|
|
|
<view class="tips">{{ num }}s后自动刷新</view> |
|
|
|
<view class="balance">余额 ¥{{ centerInfo.balance }}</view> |
|
|
|
<block v-if="show_code"> |
|
|
|
<view class="barcode"> |
|
|
|
<lf-barcode :options="config.bar"></lf-barcode> |
|
|
|
</view> |
|
|
|
<view class="qrcode"> |
|
|
|
<lf-qrcode :options="config.qrc"></lf-qrcode> |
|
|
|
</view> |
|
|
|
<view class="tips">{{ num }}s后自动刷新</view> |
|
|
|
</block> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
@ -39,32 +41,38 @@ |
|
|
|
return { |
|
|
|
config: { |
|
|
|
bar: { |
|
|
|
code: 'E01181016286106', |
|
|
|
code: '', |
|
|
|
color: '#000', // 条形码的颜色 |
|
|
|
bgColor: '#FFFFFF', // 背景色 |
|
|
|
width: 586, // 宽度 |
|
|
|
height: 210 // 高度 |
|
|
|
}, |
|
|
|
qrc: { |
|
|
|
code: "https://weixin.qq.com/g/AwYAAHO3aO4zlasEij6bLsk4hlZd5XNFkkBmqyS55mLPFxmn5c9PaI1omqLhd24fABCD23333", |
|
|
|
code: "", |
|
|
|
size: 352, // 二维码大小 |
|
|
|
level: 4, //等级 0~4 |
|
|
|
bgColor: '#FFFFFF', //二维码背景色 默认白色 |
|
|
|
// border: { |
|
|
|
// color: ['#8A2387', '#F27121'], //边框颜色支持渐变色 |
|
|
|
// lineWidth: 3, //边框宽度 |
|
|
|
// }, |
|
|
|
// img: '/static/logo.png', //图片 |
|
|
|
// iconSize: 40, //二维码图标的大小 |
|
|
|
color: '#000000', //边框颜色支持渐变色 |
|
|
|
} |
|
|
|
}, |
|
|
|
timer: null, |
|
|
|
num: 90 |
|
|
|
num: 120, |
|
|
|
refresh: 120, |
|
|
|
token: '', |
|
|
|
userInfo: {}, |
|
|
|
centerInfo: {balance: 0}, |
|
|
|
show_code: false, |
|
|
|
show_code_count: 0, |
|
|
|
show_count: 0 |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(){ |
|
|
|
this.refreshCode(); |
|
|
|
var token = this.$cookieStorage.get('user_token'); |
|
|
|
this.token = token; |
|
|
|
this.getIsSetPayPwd(); |
|
|
|
this.getMeInfo(); |
|
|
|
this.getUcenter(); |
|
|
|
|
|
|
|
// 设置手机屏幕亮度 |
|
|
|
uni.getScreenBrightness({ |
|
|
|
success: (res) => { |
|
|
|
@ -76,6 +84,12 @@ |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
onShow(){ |
|
|
|
this.show_count++; |
|
|
|
if(this.show_count > 1){ |
|
|
|
this.getIsSetPayPwd(); |
|
|
|
} |
|
|
|
}, |
|
|
|
onUnload(){ |
|
|
|
if(this.timer){ |
|
|
|
clearInterval(this.timer); |
|
|
|
@ -86,6 +100,55 @@ |
|
|
|
}) |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 获取用户是否设置了支付密码 |
|
|
|
getIsSetPayPwd(){ |
|
|
|
this.$http.post({ |
|
|
|
api: 'api/user/isset_pay_pwd', |
|
|
|
header: { |
|
|
|
Authorization: this.token |
|
|
|
} |
|
|
|
}).then(res => { |
|
|
|
console.log("====",res) |
|
|
|
if(res.data.status){ |
|
|
|
this.refreshCode(); |
|
|
|
}else{ |
|
|
|
uni.showModal({ |
|
|
|
title: '温馨提示', |
|
|
|
content: res.data.message, |
|
|
|
showCancel: false, |
|
|
|
confirmColor: '#1c8482', |
|
|
|
confirmText: '去设置', |
|
|
|
success: result => { |
|
|
|
if(result.confirm){ |
|
|
|
this.$url('/pages/user/my/setPassword'); |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 获取页面信息 |
|
|
|
getMeInfo(){ |
|
|
|
this.$http.get({ |
|
|
|
api: 'api/me', |
|
|
|
header: { |
|
|
|
Authorization: this.token |
|
|
|
} |
|
|
|
}).then(res => { |
|
|
|
this.userInfo = res.data.data; |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 获取积分等信息 |
|
|
|
getUcenter(){ |
|
|
|
this.$http.get({ |
|
|
|
api: 'api/users/ucenter', |
|
|
|
header: { |
|
|
|
Authorization: this.token |
|
|
|
} |
|
|
|
}).then(res => { |
|
|
|
this.centerInfo = res.data.data; |
|
|
|
}) |
|
|
|
}, |
|
|
|
// rpx 转 px |
|
|
|
rpxTransformPx(num){ |
|
|
|
let systemInfo = uni.getSystemInfoSync(); |
|
|
|
@ -98,15 +161,75 @@ |
|
|
|
clearInterval(this.timer); |
|
|
|
this.timer = null; |
|
|
|
} |
|
|
|
this.getPay(); |
|
|
|
this.timer = setInterval(() => { |
|
|
|
this.num--; |
|
|
|
if(this.num % 5 === 0){ |
|
|
|
this.getPay({silence: true}); |
|
|
|
} |
|
|
|
if(this.num <= 0){ |
|
|
|
clearInterval(this.timer); |
|
|
|
this.timer = null; |
|
|
|
this.num = 90; |
|
|
|
this.num = this.refresh; |
|
|
|
this.refreshCode(); // 重新执行 |
|
|
|
} |
|
|
|
}, 1000); |
|
|
|
}, |
|
|
|
getPay(options = {}){ |
|
|
|
if(!options.silence){ |
|
|
|
if(this.show_code_count >= 1){ |
|
|
|
uni.showLoading({ |
|
|
|
title: '正在刷新' |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
uni.showLoading({ |
|
|
|
title: '正在拉取数据' |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
this.$http.get({ |
|
|
|
api: 'api/offline/get_pay', |
|
|
|
data: { |
|
|
|
refresh: 0 |
|
|
|
}, |
|
|
|
header: { |
|
|
|
Authorization: this.token |
|
|
|
} |
|
|
|
}).then(res => { |
|
|
|
if(res.data.code == 200){ |
|
|
|
let detail = res.data.data; |
|
|
|
let u_id = this.userInfo.id; |
|
|
|
if(!options.silence){ |
|
|
|
let str = JSON.stringify({ |
|
|
|
rand: detail.rand, |
|
|
|
time: detail.time, |
|
|
|
u_id: u_id |
|
|
|
}); |
|
|
|
this.config.bar.code = str; |
|
|
|
this.config.qrc.code = str; |
|
|
|
this.show_code = true; |
|
|
|
this.show_code_count++; |
|
|
|
} |
|
|
|
if(detail.clerk_id){ |
|
|
|
// 商家已扫码, 跳转至确认金额页 |
|
|
|
let amount = detail.amount; |
|
|
|
let brand_id = detail.brand_id; |
|
|
|
let clerk_id = detail.clerk_id; |
|
|
|
let url = '/pages/aboutpay/confirmcash'; |
|
|
|
url += `?clerk_id=${clerk_id}`; |
|
|
|
url += `&brand_id=${brand_id}`; |
|
|
|
url += `&amount=${amount}`; |
|
|
|
this.$url(url); |
|
|
|
} |
|
|
|
} |
|
|
|
if(!options.silence){ |
|
|
|
uni.hideLoading(); |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
if(!options.silence){ |
|
|
|
uni.hideLoading(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|