新增用户下单获取手机号功能

This commit is contained in:
3321822538@qq.com 2024-10-14 17:26:21 +08:00
parent d3c488c8d1
commit c6cd07b711
9 changed files with 224 additions and 144 deletions

View File

@ -19,7 +19,7 @@ const install = (Vue, vm) => {
// },
// });
Vue.prototype.$u.http.setConfig({
// baseUrl: 'http://192.168.2.81:10002',
// baseUrl: 'http://192.168.2.106:10002',
baseUrl: 'https://kg.chuangtewl.com/prod-api',
// loadingText: '努力加载中~',
// loadingTime: 1000,
@ -101,7 +101,7 @@ const install = (Vue, vm) => {
// }
// });
}
});
})
wx.login({
success(res) {
if (res.code) {

View File

@ -53,15 +53,6 @@
<view class="card_left">
<view class="txt" style="font-size: 28rpx;">
<text>{{row.name}} </text>
<!-- <text v-if="row.value != null">
通电时长{{row.value}}
<text v-if="row.timeUnit == 1"></text>
<text v-if="row.timeUnit == 2"></text>
<text v-if="row.timeUnit == 3">分钟</text>
<text v-if="row.timeUnit == 4"></text>
</text>
<text v-else>(智能计时)</text>
<text>{{row.price}}</text> -->
<view class="">
<text style="margin-top: 10rpx;" v-if="row.feeType == 1">计时收费</text>
<text style="margin-top: 10rpx;" v-if="row.feeType == 2">按量收费</text>
@ -70,10 +61,12 @@
(<text style="margin-top: 10rpx;" v-if="row.feeMode == 1">单次收费</text>
<text style="margin-top: 10rpx;" v-if="row.feeMode == 2">智能收费</text>)
<text style="width: 20rpx;display: inline-block;"></text>
<text style="margin-top: 10rpx;" v-if="row.timeUnit == 2 && row.feeType != 3 && row.feeType != 4">{{row.value}} {{row.price}}</text>
<text style="margin-top: 10rpx;" v-if="row.timeUnit == 3 && row.feeType != 3 && row.feeType != 4">{{row.value}} {{row.price}}</text>
<text style="margin-top: 10rpx;" v-if="row.timeUnit == 4 && row.feeType != 3 && row.feeType != 4">{{row.value}} {{row.price}}</text>
<text style="margin-top: 10rpx;margin-left: 6rpx;" v-if="row.feeMode == 2">押金{{row.deposit}}</text>
<text v-else>
<text style="margin-top: 10rpx;" v-if="row.timeUnit == 2 && row.feeType != 3 && row.feeType != 4">{{row.value}} {{row.price}}</text>
<text style="margin-top: 10rpx;" v-if="row.timeUnit == 3 && row.feeType != 3 && row.feeType != 4">{{row.value}} {{row.price}}</text>
<text style="margin-top: 10rpx;" v-if="row.timeUnit == 4 && row.feeType != 3 && row.feeType != 4">{{row.value}} {{row.price}}</text>
</text>
</view>
</view>
<view class="ccc">

View File

@ -29,7 +29,7 @@
</view>
<view class="botwz">
<!-- 点击刷新实时信息 -->
<view @click="shuaxin" style="width: 100%;display: flex;color: #fff;justify-content: center;align-items: center;padding-top:40rpx;padding-bottom: 30rpx;box-sizing: border-box;">
<view @click="shuaxin(1)" style="width: 100%;display: flex;color: #fff;justify-content: center;align-items: center;padding-top:40rpx;padding-bottom: 30rpx;box-sizing: border-box;">
点击刷新实时信息
</view>
</view>
@ -94,11 +94,14 @@
</view>
<view class="qian">
<view class="yajin">
<text v-if="detaobj.suitFeeType == 1">{{detaobj.suitTime == null ? '--' : detaobj.suitTime}}<text
v-if="detaobj.suitTimeUnit == 2"></text> <text v-if="detaobj.suitTimeUnit == 3">分钟</text>
<text v-if="detaobj.suitTimeUnit == 4"></text></text>
<text v-if="detaobj.suitFeeType == 2">{{detaobj.suitTime}}</text>
<text v-if="detaobj.suitFeeMode == 2">押金</text>
<text v-else>
<text v-if="detaobj.suitFeeType == 1">{{detaobj.suitTime == null ? '--' : detaobj.suitTime}}<text
v-if="detaobj.suitTimeUnit == 2"></text> <text v-if="detaobj.suitTimeUnit == 3">分钟</text>
<text v-if="detaobj.suitTimeUnit == 4"></text></text>
<text v-if="detaobj.suitFeeType == 2">{{detaobj.suitTime}}</text>
</text>
</view>
<view class="yuan" v-if="detaobj.suitFeeMode == 2">
{{detaobj.suitDeposit == null ? '--' : detaobj.suitDeposit}}
@ -226,6 +229,24 @@
</view>
</view>
<view class="mask" v-if="trueboxfalg"></view>
<view class="tip_box" v-if="czflag">
<view class="top">
<view class="txt">
系统检测该设备未联网或者为蓝牙版本,金额充值失败,请靠近设备进行蓝牙充值
</view>
</view>
<view class="bot">
<view class="bot_left" @click="czflag = false">
取消
</view>
<view class="bot_right" @click="tocz()">
蓝牙充值
</view>
</view>
</view>
<view class="masks" v-if="czflag"></view>
</view>
@ -262,6 +283,7 @@
"水表",
],
czflag:false,
curtitidx: 0,
id: '',
timeday: '',
@ -296,7 +318,9 @@
suitStartEle: '',
sbobj: {},
jieshufalg:false,
channelId:''
channelId:'',
dingobj: '',
timerone:null
}
},
onLoad(option) {
@ -309,8 +333,11 @@
this.opflag = option.flag
}
setTimeout(()=>{
this.shuaxin()
// this.shuaxin()
// this.gethuidaio()
this.startTimerone()
},1500)
},
computed: {
//
@ -335,6 +362,8 @@
},
onUnload: function() {
console.log("unload ");
clearInterval(this.timerone);
this.timerone= null
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
wx.closeBLEConnection({
deviceId: this.deviceId,
@ -359,6 +388,7 @@
onShow() {
setTimeout(() => {
this.startTimers()
this.gethuidaio()
if (this.id) {
//id
} else {
@ -366,7 +396,7 @@
url: '/pages/shouye/index'
})
}
}, 100)
}, 1000)
},
onHide() {
this.stopTimer();
@ -383,6 +413,37 @@
this.stopTimer();
},
methods: {
startTimerone() {
//
clearInterval(this.timerone);
this.timerone = setInterval(() => {
this.shuaxin()
this.gethuidaio()
}, 2000);
},
// 线
gethuidaio() {
this.$u.get('/app/bill/recharge/device/fail/list').then(res => {
if (res.code == 200) {
if (res.data.length > 0) {
this.czflag = true
this.dingobj = res.data
clearInterval(this.timerone);
this.timerone= null
} else {
uni.removeStorageSync('time')
}
}
})
},
// 线
tocz() {
this.czflag = false
uni.navigateTo({
url: '/page_fenbao/chongzhi?dingobj=' + JSON.stringify(this.dingobj)
})
},
//
btncall(){
let phoneNumber = ''
@ -543,16 +604,18 @@
//
shuaxin(){
shuaxin(txt){
this.$u.get(`/app/device/${this.sbid}/refreshIot`).then((res) => {
if(res.code == 200){
this.getDevice()
this.getsb()
uni.showToast({
title: res.msg,
icon: 'success',
duration: 1500
})
if(txt == 1){
uni.showToast({
title: res.msg,
icon: 'success',
duration: 1500
})
}
}else{
uni.showToast({
title: res.msg,
@ -1102,7 +1165,7 @@
})
},
//
//
getDevice() {
this.$u.get(`/app/bill/byNo/${this.id}`).then(res => {
if (res.code == 200) {
@ -1112,6 +1175,10 @@
this.detaobj = res.data
this.billId = res.data.billId
this.orderno = res.data.billNo
if(res.data.deviceRechargeStatus == 1){
clearInterval(this.timerone);
this.timerone = null
}
this.getprice()
let dateTimeString = res.data.suitStartTime //
this.timeDifferenceString = this.calculateTimeDifference(dateTimeString); //
@ -1805,7 +1872,72 @@
}
}
}
.masks {
width: 100%;
height: 100vh;
position: fixed;
top: 0;
left: 50%;
transform: translateX(-50%);
background-color: #000;
opacity: .6;
z-index: 998;
}
.tip_box {
position: fixed;
left: 72rpx;
top: 700rpx;
width: 610rpx;
background: #F7FAFE;
border-radius: 30rpx 30rpx 30rpx 30rpx;
z-index: 10000000;
.top {
padding: 52rpx 38rpx 42rpx 36rpx;
.txt {
width: 100%;
text-align: center;
font-weight: 500;
font-size: 32rpx;
color: #3D3D3D;
}
}
.bot {
border-top: 2rpx solid #D8D8D8;
display: flex;
flex-wrap: nowrap;
height: 100%;
.bot_left {
width: 50%;
height: 98rpx;
display: flex;
align-items: center;
justify-content: center;
font-weight: 500;
font-size: 36rpx;
color: #3D3D3D;
}
.bot_right {
width: 50%;
height: 98rpx;
display: flex;
align-items: center;
justify-content: center;
border-left: 2rpx solid #D8D8D8;
font-weight: 500;
font-size: 36rpx;
color: #8883F0;
}
}
}
.page {
.zhuhu {
margin-top: 60rpx;

View File

@ -116,10 +116,14 @@
<u-checkbox v-model="checked" @change="checkboxChange" active-color="#8883F0 ">我已同意
</u-checkbox><text @click="btnyonghu"></text> <text @click="btnyinsi"></text>
</u-checkbox-group>
<view class="zf" @click="btnzhifu" v-if="zhifuflag">
<!-- <view class="zf" v-else>
立即支付
</view>
<view class="zf" v-else>
</view> -->
<!-- 获取手机号 -->
<button class="zf" v-if="telslag" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
立即支付
</button>
<view class="zf" @click="btnzhifu" v-else>
立即支付
</view>
</view>
@ -148,11 +152,12 @@
<view v-if="swindleflag" class="" style="width: 100%;height: 100vh;position: fixed;top: 0;left: 0;background-color: #000;opacity: .5;z-index: 98;"></view>
</view>
</template>
<script>
var xBlufi = require("@/page_components/blufi/xBlufi.js");
var xBlufi = require("@/page_components/blufi/xBlufi.js");
export default {
data() {
return {
@ -192,7 +197,10 @@
payNo:'',
q:'',
channelId:'',
swindleflag:true
swindleflag:true,
phonenumber:'',
mchShowBillMobile:'',
telslag:false
}
},
onLoad(option) {
@ -235,6 +243,7 @@
if (this.id != '') {
this.$u.get("/app/user/userInfo").then((res) => {
if (res.code == 200) {
this.phonenumber = res.data.phonenumber
this.getone()
} else {
uni.navigateTo({
@ -411,6 +420,12 @@
this.deviceobj = res.data
this.zfobj = res.data.suitList[0]
let targetDateStr = this.deviceobj.expireTime
this.mchShowBillMobile = res.data.mchShowBillMobile
if(this.mchShowBillMobile == true && this.phonenumber == ''){
this.telslag = true
}else{
this.telslag = false
}
if(targetDateStr != null){
let targetParts = targetDateStr.split(/[- :]/)
let targetDate = new Date(targetParts[0], targetParts[1] - 1, targetParts[2], targetParts[3], targetParts[4], targetParts[5])
@ -456,7 +471,30 @@
icon: 'none',
duration: 1000
})
} else if (this.onlineStatus == 1) {
}else if(this.mchShowBillMobile == true && this.phonenumber == ''){
this.getPhoneNumber()
}else {
this.getzhifu()
}
},
//
getPhoneNumber(e){
// console.log(e,'121212');
this.$u.put(`/app/user/bindWxMobile?mobileCode=${e.detail.code}`).then(res =>{
if(res.code == 200){
this.getzhifu()
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 1000
})
}
})
},
//
getzhifu(){
if (this.onlineStatus == 1) {
uni.showLoading({
title: '准备支付中...'
})
@ -761,46 +799,6 @@
this.zhifuflag = true
}
})
// that.$u.get('/app/bill/recharge/device/fail/list').then(res => {
// if (res.code == 200) {
// // console.log('',res);
// let dingobj = res.data[0].billNo
// // console.log(dingobj,'');
// uni.getNetworkType({
// success(res) {
// if (res.networkType !== 'none') {
// uni.getConnectedBluetoothDevices({
// success(res) {
// xBlufi.notifySendCustomData({
// customData: "time@" + that.jine
// })
// },
// fail(err) {
// console.error('',err)
// }
// })
// that.$u.get(`/app/bill/recharge/${dingobj}/bluetoothSuccess`).then(res => {
// if (res.code == 200) {
// this.zhifuflag = true
// console.log('线')
// setTimeout(() => {
// uni.reLaunch({
// url: '/pages/shouye/index'
// })
// },1000)
// }
// })
// } else {
// console.log('')
// // this.baiflag = false
// }
// }
// })
// }
// })
// 11111111111111111111111
//
// uni.setStorageSync('time', that.expireTimeStr)
}else{
let data = {
billNo:that.orderno,
@ -923,6 +921,7 @@
}
}
},
startLoading() {
this.isLoading = true;
const intervalId = setInterval(() => {

View File

@ -378,11 +378,11 @@
if (this.dotShowInterval) {
clearInterval(this.dotShowInterval);
}
console.log("unload ");
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
wx.closeBLEConnection({
deviceId: this.objlist.deviceId,
})
// console.log("unload ");
// xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
// wx.closeBLEConnection({
// deviceId: this.objlist.deviceId,
// })
},
mounted() {
//

View File

@ -197,7 +197,6 @@
</view>
</view>
<view class="">
<view class="cont" @click="topage(5)" v-if="modelId.some(tag => tag == 2)">
<view class="top">
<image style="width: 44rpx;height: 44rpx;"
@ -307,6 +306,7 @@
<view v-if="btnmsk"
style="width: 100%;height: 100vh;position: fixed;top: 0;left: 0;background-color: #000;opacity: .1;z-index: 999;">
</view>
</view>
</template>
@ -320,7 +320,7 @@
components: {
uniEcCanvas
},
data() {
data() {
return {
suitSurplus:'',
showflag: false,
@ -975,7 +975,7 @@
url: '/page_user/cbRecord?id=' + this.id
})
} else if (num == 1) {
console.log(this.deviceInfo.onlineStatus, 'this.deviceInfo.onlineStatusthis.deviceInfo.onlineStatus');
// console.log(this.deviceInfo.onlineStatus, 'this.deviceInfo.onlineStatusthis.deviceInfo.onlineStatus');
if (this.deviceInfo.onlineStatus == 1) {
let that = this
uni.showModal({
@ -987,22 +987,18 @@
//
that.$u.put(`/app/device/${that.id}/reset`).then((res) => {
if (res.code == 200) {
// console.log(res.data);
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
that.getshuax()
that.deviceInfo.status = 1
that.imgflag = false
that.tdtxt = '关闭'
} else if (res.msg == '设备剩余时间不足,无需归零') {
uni.showToast({
title: '设备剩余时间不足,无需归零',
icon: 'none',
icon: 'success',
duration: 2000
})
that.getDevice(that.id)
setTimeout(()=>{
that.deviceInfo.status = 1
that.imgflag = false
that.tdtxt = '关闭'
},1000)
// that.getshuax()
} else if (res.code == 500) {
uni.showToast({
title: res.msg,
@ -1283,14 +1279,14 @@
duration: 2000
})
// this.getshuax()
this.getDevice(this.id)
setTimeout(() => {
this.getshuax()
this.cztime = ''
this.danwei = ''
this.deviceInfo.status = 2
this.tdtxt = '开启'
this.imgflag = true
}, 1000)
}, 2000)
} else if (res.code == 500) {
uni.showToast({
title: res.msg,
@ -1390,8 +1386,6 @@
this.vipflag = false
this.cztime = ''
},
funListenDeviceMsgEvent: function(options) {
switch (options.type) {
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_MY_DATA:
@ -1424,14 +1418,9 @@
break;
case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
// console.log("" + JSON.stringify(options))
if (options.result) {
this.bluetoothflag = false
uni.hideLoading();
// uni.showToast({
// title: '',
// icon: 'none'
// });
{
console.log("连接回调options.data.deviceId" + options.data.deviceId,
"连接回调options.data.name" + options.data.name)
@ -1440,11 +1429,6 @@
this.shibaiflag = true
this.bluetoothflag = false
uni.hideLoading()
// uni.showToast({
// title: '线',
// icon: 'none',
// duration: 2000
// })
}
break;
@ -1506,28 +1490,6 @@
}
},
// parseCustomData(data) {
// // "@"
// const dataArray = data.split('@')
// //
// const voltage = parseFloat(dataArray[0].substring(1)) // "V"
// const switchState = dataArray[1].substring(1)// "S"
// const current = parseFloat(dataArray[2].substring(1)) // "A"
// const power = parseFloat(dataArray[4].substring(1)) // "P"
// const remainingPower = parseFloat(dataArray[5].substring(1)) // "M"
// const setMode = dataArray[6].substring(1) // "T"
// //
// return {
// voltage,
// switchState,
// current,
// power,
// remainingPower,
// setMode
// };
// },
parseCustomData(data) {
// "@"
const dataArray = data.split('@');
@ -1612,7 +1574,7 @@
.lanyalx {
display: inline-block;
text-align: center;
font-size: 28rpx;
font-size: 26rpx;
width: 196rpx;
height: 40rpx;
line-height: 40rpx;
@ -1748,7 +1710,7 @@
padding-bottom: 22rpx;
}
/deep/ .u-icon__icon {
/deep/ .uicon-nav-back {
padding-bottom: 22rpx;
}

View File

@ -232,7 +232,7 @@
}
this.isLoading = false
}
});
})
},
onReachBottom() {
@ -389,13 +389,7 @@
page {
background-color: #F7FAFE !important;
// position: fixed;
// top: 0;
// left: 0;
}
.pages {
// padding: 0 40rpx;
// box-sizing: border-box;
}
</style>

View File

@ -74,7 +74,7 @@
<image src="https://api.ccttiot.com/smartmeter/img/static/ui06lcaul58Y3ianRZAZ" mode=""></image>
<view class="txt">订单统计</view>
</view>
<view class="botcard" @click="topage(4)">
<view class="botcard" @click="topage(4)" v-if="false">
<image src="https://api.ccttiot.com/smartmeter/img/static/uKewAY8xvJN04yFpGEjl" mode=""></image>
<view class="txt">安全中心</view>
</view>

View File

@ -466,7 +466,7 @@
} else if (num == 6) {
this.$u.get("/app/user/userInfo").then((res) => {
if (res.code == 200) {
if(res.data.deviceCount == 0){
if(res.data.deviceCount == 0){
uni.showToast({
title: '您当前暂无设备,没有权限进入',
icon: 'none',