diff --git a/page_user/fuwu.vue b/page_user/fuwu.vue index 64dcd96..98e0cdb 100644 --- a/page_user/fuwu.vue +++ b/page_user/fuwu.vue @@ -2,18 +2,18 @@ - 扫码床垫 - {{obj.deviceName}} + - + @@ -32,7 +32,7 @@ ¥{{item.price}} - 可使用{{item.value}}小时 + 可使用{{item.value}} {{item.timeUnit == 3 ? '分钟' : '小时'}} @@ -52,7 +52,7 @@ 填充物:{{obj.fill == undefined ? '--' : obj.fill}} - 所属房间:{{obj.room == undefined ? '--' : obj.room}} + 设备地址:{{sbobj.storeName == undefined ? '' : sbobj.storeName}} {{obj.room == undefined ? '--' : obj.room}} @@ -102,6 +102,8 @@ suitGearTime:'', suitFeeMode:'', suitFeeType:'', + title:'', + sbobj:{} } }, onLoad(option) { @@ -161,6 +163,7 @@ if (res.code == 200) { this.list = res.data.suitList this.obj = res.data + this.getsb(res.data.deviceId) }else if(res.code == 401){ uni.navigateTo({ url:'/pages/login/login' @@ -168,95 +171,111 @@ } }) }, + // 查询设备详情 + getsb(id){ + this.$u.get(`app/device/${id}`).then((res) => { + if (res.code == 200) { + this.sbobj = res.data + } + }) + }, // 点击支付 btnzhifu() { - if(this.checked == false){ + if(this.sbobj.onlineStatus == 0){ uni.showToast({ - title: '请勾选用户服务协议 !', - icon: 'none', - duration: 1000 - }) - }else if(this.activeindex == -1){ - uni.showToast({ - title: '请选择套餐 !', + title: '该设备离线,暂不能使用', icon: 'none', duration: 1000 }) }else{ - // 不允许一直点击支付 - this.zhifuflag = false - let that = this - let data = { - deviceNo: that.id, - suitId: that.zfobj.suitId, - money: that.zfobj.price, - suitTime: that.zfobj.value, - suitTimeUnit:that.suitTimeUnit, - suitFeeMode:that.suitFeeMode, - suitFeeType:that.suitFeeType, - suitGearAmount:that.suitGearAmount, - suitGearTime:that.suitGearTime, - suitPrice:that.suitPrice - } - that.$u.post('/app/bill/recharge', data).then(res => { - if(res.code == 200){ - that.orderno = res.data - let data = { - billNo:that.orderno, - channelId:1 - } - that.$u.get(`app/pay/wx/${that.orderno}`).then(res => { - if(res.code == 200){ - that.payNo = res.data.payBill.payNo - uni.requestPayment({ - provider: 'wxpay', - timeStamp: res.data.payParams.timeStamp, - nonceStr: res.data.payParams.nonceStr, - package: res.data.payParams.packageVal, - signType: res.data.payParams.signType, - paySign: res.data.payParams.paySign, - success: (res) => { - that.zhifuflag = true - that.$u.put(`/app/bill/${that.payNo}/refreshPayResult`).then(res => {}) - // 支付成功逻辑 - uni.reLaunch({ - // url:'/page_user/mydetail?id=' + that.orderno - url:'/pages/index/index' - }) - }, - fail(err) { - that.zhifuflag = true - // 支付失败逻辑 - uni.showToast({ - title: '支付失败', - icon: 'none', - duration: 2000 - }) - } - }) - }else{ - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }) - setTimeout(()=>{ - this.zhifuflag = true - },2000) - } - }) - }else{ - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }) - setTimeout(()=>{ - this.zhifuflag = true - },2000) + if(this.checked == false){ + uni.showToast({ + title: '请勾选用户服务协议 !', + icon: 'none', + duration: 1000 + }) + }else if(this.activeindex == -1){ + uni.showToast({ + title: '请选择套餐 !', + icon: 'none', + duration: 1000 + }) + }else{ + // 不允许一直点击支付 + this.zhifuflag = false + let that = this + let data = { + deviceNo: that.id, + suitId: that.zfobj.suitId, + money: that.zfobj.price, + suitTime: that.zfobj.value, + suitTimeUnit:that.suitTimeUnit, + suitFeeMode:that.suitFeeMode, + suitFeeType:that.suitFeeType, + suitGearAmount:that.suitGearAmount, + suitGearTime:that.suitGearTime, + suitPrice:that.suitPrice } - }) - + that.$u.post('/app/bill/recharge', data).then(res => { + if(res.code == 200){ + that.orderno = res.data + let data = { + billNo:that.orderno, + channelId:1 + } + that.$u.get(`app/pay/wx/${that.orderno}`).then(res => { + if(res.code == 200){ + that.payNo = res.data.payBill.payNo + uni.requestPayment({ + provider: 'wxpay', + timeStamp: res.data.payParams.timeStamp, + nonceStr: res.data.payParams.nonceStr, + package: res.data.payParams.packageVal, + signType: res.data.payParams.signType, + paySign: res.data.payParams.paySign, + success: (res) => { + that.zhifuflag = true + that.$u.put(`/app/bill/${that.payNo}/refreshPayResult`).then(res => {}) + // 支付成功逻辑 + uni.reLaunch({ + // url:'/page_user/mydetail?id=' + that.orderno + url:'/pages/index/index' + }) + }, + fail(err) { + that.zhifuflag = true + // 支付失败逻辑 + uni.showToast({ + title: '支付失败', + icon: 'none', + duration: 2000 + }) + } + }) + }else{ + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + setTimeout(()=>{ + this.zhifuflag = true + },2000) + } + }) + }else{ + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + setTimeout(()=>{ + this.zhifuflag = true + },2000) + } + }) + + } } }, @@ -464,7 +483,7 @@ .wz { font-weight: 400; font-size: 32rpx; - margin-top: 30rpx; + margin-top: 10rpx; } } } diff --git a/page_user/mydetail.vue b/page_user/mydetail.vue index 0bb79b0..2a01a11 100644 --- a/page_user/mydetail.vue +++ b/page_user/mydetail.vue @@ -14,7 +14,7 @@ - {{detailobj.suitTime == undefined ? '--' : detailobj.suitTime}}小时 + {{detailobj.suitTime == undefined ? '--' : detailobj.suitTime}}{{detailobj.timeUnit == 3 ? '分钟' : '小时'}} 套餐时长 diff --git a/page_user/orderdetail.vue b/page_user/orderdetail.vue index a34f9c6..436d73a 100644 --- a/page_user/orderdetail.vue +++ b/page_user/orderdetail.vue @@ -41,7 +41,7 @@ 套餐时长 - {{obj.suitTime == undefined ? '--' : obj.suitTime}}小时 + {{obj.suitTime == undefined ? '--' : obj.suitTime}}{{obj.timeUnit == 3 ? '分钟' : '小时'}} 支付类型 diff --git a/page_user/orderlist.vue b/page_user/orderlist.vue index bbb7d20..ce9a875 100644 --- a/page_user/orderlist.vue +++ b/page_user/orderlist.vue @@ -58,7 +58,7 @@ 套餐时长 - {{item.suitTime}}小时 + {{item.suitTime}}{{item.timeUnit == 3 ? '分钟' : '小时'}} 合作伙伴信息