This commit is contained in:
cjb 2025-01-18 16:28:15 +08:00
parent 96493e08d8
commit 8486ca4c34
10 changed files with 387 additions and 110 deletions

View File

@ -8,17 +8,18 @@
:placeholder="true" :placeholder="true"
/> />
<view class="content"> <view class="content">
<view class="jiner"> <view id="mancont" class="jiner">
<view class="num"> <view class="num">
<view>余额</view> <view>余额</view>
<view><text style="font-size: 50rpx;">99.00</text> </view> <view><text style="font-size: 50rpx;">{{totalAmount}}</text> </view>
</view> </view>
<view class="ctbn" @tap="topage('/minePages/recharge/index')">充值</view> <view class="ctbn" @tap="topage('/minePages/recharge/index')">充值</view>
</view> </view>
<view class="mingxi"> <view class="mingxi">
<view class="tit">余额明细</view> <view class="tit">余额明细</view>
<!--:style="{height:height,overflowY: 'auto'}"-->
<view> <view>
<view class="mxitem"> <view v-for="n in list" class="mxitem">
<view> <view>
<view style="padding-bottom: 8rpx;font-size: 40rpx;color: #00aa00;">充值</view> <view style="padding-bottom: 8rpx;font-size: 40rpx;color: #00aa00;">充值</view>
<view style="font-size: 30rpx;color: #ccc;">2024-12-20 11:20:00</view> <view style="font-size: 30rpx;color: #ccc;">2024-12-20 11:20:00</view>
@ -28,7 +29,9 @@
<view style="font-size: 30rpx;color: #ccc;">实际到账金额100</view> <view style="font-size: 30rpx;color: #ccc;">实际到账金额100</view>
</view> </view>
</view> </view>
<view class="mxitem"> <up-empty v-if="list.length == 0" mode="list" text="暂无记录" />
<up-loadmore v-else :status="status" color="#c0c4cc" lineColor="#c0c4cc" />
<!-- <view class="mxitem">
<view> <view>
<view style="padding-bottom: 8rpx;font-size: 40rpx;">换电</view> <view style="padding-bottom: 8rpx;font-size: 40rpx;">换电</view>
<view style="font-size: 30rpx;color: #ccc;">2024-10-20 11:20:00</view> <view style="font-size: 30rpx;color: #ccc;">2024-10-20 11:20:00</view>
@ -37,18 +40,82 @@
<view style="padding-bottom: 8rpx;font-size: 40rpx;">-<text>20</text></view> <view style="padding-bottom: 8rpx;font-size: 40rpx;">-<text>20</text></view>
<view style="font-size: 30rpx;color: #ccc;">实际消费10</view> <view style="font-size: 30rpx;color: #ccc;">实际消费10</view>
</view> </view>
</view> </view> -->
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {ref} from 'vue' import {ref,reactive,getCurrentInstance} from 'vue'
import { onReachBottom } from '@dcloudio/uni-app' import { onLoad,onShow,onReachBottom } from '@dcloudio/uni-app'
onReachBottom(() => { import {
getaccou,
balancedetails
} from '@/utils/service'
let status = ref('nomore') //loadmore loading
let totalAmount = ref(0)
//
let qsobj = reactive({
walletCode:uni.getStorageSync('walletCode'),
pageSize:30,
pageNo:1
}) })
let list = ref<any[]>([])
function getylist() {
balancedetails(qsobj).then((rps:any) => {
if(rps.data.total > 0){
list.value = [...list.value,...rps.data.records]
if(list.value.length == rps.data.total){
status.value = 'nomore'
}else{
status.value = 'loadmore'
qsobj.pageNo++
}
}
})
}
let height = ref('')
onLoad(() => {
const instance = getCurrentInstance()
const query = uni.createSelectorQuery().in((instance as any).proxy)
query.select('#mancont').boundingClientRect(v => {
uni.getSystemInfo({
success: n => {
//
height.value = (n.windowHeight - (v as any).height + 20)+'px'
}
})
})
.exec()
})
//
let account =ref<any>({})
onShow(() => {
getaccou(uni.getStorageSync('wxuid')).then((rps:any) => {
if(rps.data.records){
totalAmount.value = rps.data.records[0].totalAmount
uni.setStorageSync('totalAmount',totalAmount.value)
}
})
getylist()
})
onReachBottom(() => {
if(status.value == 'loadmore'){
getylist()
}
})
function topage(url:string) { function topage(url:string) {
uni.navigateTo({ uni.navigateTo({

View File

@ -58,7 +58,7 @@
> >
<view class="hdbzcont"> <view class="hdbzcont">
<up-steps v-if="show" :current="bzlist.length" direction="column"> <up-steps v-if="show" :current="bzlist.length" direction="column">
<up-steps-item v-for="n in bzlist" :title="n.step" :desc="n.stepTime" /> <up-steps-item v-for="n in bzlist" :title="hdbzname(n.step)" :desc="n.stepTime" />
</up-steps> </up-steps>
</view> </view>
</up-popup> </up-popup>
@ -70,9 +70,32 @@
import { onShow,onReachBottom } from '@dcloudio/uni-app' import { onShow,onReachBottom } from '@dcloudio/uni-app'
onShow(() => { onShow(() => {
tabshand(stanum.value) pageNo.value = 1
list.value.splice(0)
getlist()
}) })
function hdbzname(n:string|number) {
if(n == 1){
return '车辆进站'
}else if(n == 2){
return '车辆到达指定位置'
}else if(n == 3){
return '启动对中机构'
}else if(n == 4){
return '取新电池'
}else if(n == 5){
return '拆旧电池'
}else if(n == 6){
return '装新电池'
}else if(n == 7){
return '放旧电池'
}else if(n == 8){
return '换电完成'
}
}
// 1-2-3-4-5-6-7-9- // 1-2-3-4-5-6-7-9-
const statelist = reactive([ const statelist = reactive([
{ name: '全部'}, { name: '全部'},
@ -150,7 +173,7 @@
} }
// //
getlist() //getlist()
onReachBottom(() => { onReachBottom(() => {
if(status.value == 'loadmore'){ if(status.value == 'loadmore'){

View File

@ -15,19 +15,19 @@
<view class="dingdan"> <view class="dingdan">
<view> <view>
<view>订单号</view> <view>订单号</view>
<view style="font-size: 28rpx;">YTSOgyy000012025011110572044197C</view> <view style="font-size: 28rpx;">{{order.orderNo}}</view>
</view> </view>
<view> <view>
<view>订单金额</view> <view>订单金额</view>
<view>¥100</view> <view>¥{{order.amount}}</view>
</view> </view>
<view> <view>
<view>车牌号</view> <view>车牌号</view>
<view>冀A12345D</view> <view>{{order.plateNum}}</view>
</view> </view>
<view> <view>
<view>换电站</view> <view>换电站</view>
<view>北京1号换电站</view> <view>{{order.stationName}}</view>
</view> </view>
</view> </view>
<view class="btns"> <view class="btns">
@ -40,8 +40,23 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref,reactive } from 'vue' import { ref,reactive } from 'vue'
import { payment,getip } from '@/utils/service' import { payment,getip,orderlist } from '@/utils/service'
import { onLoad,onShow } from '@dcloudio/uni-app' import { onLoad,onShow } from '@dcloudio/uni-app'
let order = ref<any>({})
onLoad((opt:any) => {
orderlist({
userId:uni.getStorageSync('wxuid'),
pageSize:30,
pageNo:1,
orderNo:opt.orderNo
}).then((rps:any) => {
if(rps.data.total > 0){
order.value = rps.data.records[0]
}
})
})
function gohome(){ function gohome(){
uni.switchTab({ uni.switchTab({
@ -50,7 +65,7 @@
} }
function goorder(){ function goorder(){
uni.navigateTo({ uni.redirectTo({
url:'/minePages/order/index' url:'/minePages/order/index'
}) })
} }

View File

@ -12,21 +12,22 @@
<view>付款金额</view> <view>付款金额</view>
<view style="color: #ffaa00;"> <view style="color: #ffaa00;">
<text>¥ </text> <text>¥ </text>
<text style="font-size: 50rpx;">{{payqs.money}}</text> <text style="font-size: 50rpx;">{{payqs.total}}</text>
</view> </view>
</view> </view>
<view style="padding: 40rpx 20rpx 20rpx;color: #959595;">选择支付方式</view> <view style="padding: 40rpx 20rpx 20rpx;color: #959595;">选择支付方式</view>
<view style="background: #fff;"> <view style="background: #fff;">
<radio-group size="30" @change="radioChange"> <radio-group size="30" @change="radioChange">
<label style="display: flex;align-items: center;padding: 30rpx;border-bottom: 2px solid #f4f4f4;"> <label style="display: flex;align-items: center;padding: 30rpx;border-bottom: 2px solid #f4f4f4;">
<radio :checked="actv == 1" value="1" color="#00aa00" style="transform:scale(80%);" /> <radio :checked="actv == 1" :value="1" color="#00aa00" style="transform:scale(80%);" />
<view style="display: flex;align-items: center;"> <view style="display: flex;align-items: center;">
<image src="/src/static/img/yuer.png" style="width: 60rpx;height: 60rpx;" /> <image src="/src/static/img/yuer.png" style="width: 60rpx;height: 60rpx;" />
<view style="padding-left: 10rpx;">余额</view> <view style="padding-left: 10rpx;">余额</view>
<!-- <view style="flex: 1;">100</view> -->
</view> </view>
</label> </label>
<label style="display: flex;align-items: center;padding: 30rpx;"> <label style="display: flex;align-items: center;padding: 30rpx;">
<radio :checked="actv == 2" value="2" color="#00aa00" style="transform:scale(80%);" /> <radio :checked="actv == 2" :value="2" color="#00aa00" style="transform:scale(80%);" />
<view style="display: flex;align-items: center;"> <view style="display: flex;align-items: center;">
<image src="/src/static/img/weixin.png" style="width: 60rpx;height: 60rpx;" /> <image src="/src/static/img/weixin.png" style="width: 60rpx;height: 60rpx;" />
<view style="padding-left: 10rpx;">微信</view> <view style="padding-left: 10rpx;">微信</view>
@ -43,38 +44,50 @@
import { onLoad,onShow } from '@dcloudio/uni-app' import { onLoad,onShow } from '@dcloudio/uni-app'
onLoad((opt:any) => { onLoad((opt:any) => {
payqs.money = opt.amount*1 payqs.total = opt.amount*1
payqs.attach = opt.orderNo payqs.attach.orderNo = opt.orderNo
payqs.detail.goodsDetail.merchantGoodsId = opt.orderNo payqs.goodsDetail[0].merchantGoodsId = opt.orderNo
payqs.detail.goodsDetail.unitPrice = opt.amount*1 payqs.goodsDetail[0].unitPrice = opt.amount*1
payqs.description = `车牌号:${opt.plateNum} 换电站:${opt.stationName}` payqs.description = `${opt.plateNum}${opt.stationName}换电`
// payqs.detail.costPrice = opt.amount // payqs.detail.costPrice = opt.amount
// payqs.detail.goodsDetail.unitPrice = opt.amount // payqs.detail.goodsDetail.unitPrice = opt.amount
orderNo.value = opt.orderNo
}) })
let orderNo = ref('')
let actv = ref(2) let actv = ref(2)
function radioChange(v:any) { function radioChange(v:any) {
console.log(v,'v') console.log(v,'v')
} }
let payqs = reactive({ let payqs = reactive<any>({
wuid:uni.getStorageSync('wxuid'), wuid:uni.getStorageSync('wxuid'),
description:'', // description:'', //
money:0, // total:0, //
//timeExp:'', // //timeExp:'', //
attach:'', attach:{ //
detail:{ type: 2, //"1-,2- number"
goodsDetail:{ orderNo:'', //"",
trader:'', //
tradercode:uni.getStorageSync('wxuid') //
//walletCode:'' //
// ownerId:'', //"IDwuid",
// walletCode:'' //""
},
goodsDetail:[
{
merchantGoodsId:'', // merchantGoodsId:'', //
wechatpayGoodsId:'', // wechatpayGoodsId:'', //
goodsName:'', // goodsName:'', //
quantity:1, // quantity:1, //
unitPrice:0 // unitPrice:0 //
}// }
}, ],
payerClientIp:'', //IP payerClientIp:'', //IP
deviceId:'', // deviceId:'', //
stationCode:'' stationCode:''
}) })
@ -84,6 +97,7 @@
}) })
function payhand() { function payhand() {
payqs.attach = JSON.stringify(payqs.attach)
payment(payqs).then((rps:any) => { payment(payqs).then((rps:any) => {
//#ifdef MP-WEIXIN //#ifdef MP-WEIXIN
@ -95,7 +109,7 @@
paySign: rps.data.paySign, paySign: rps.data.paySign,
success(){ success(){
uni.redirectTo({ uni.redirectTo({
url:'/minPages/paySuccess/index' url:`/minePages/paySuccess/index?orderNo=${orderNo.value}`
}) })
}, },
fail(){ fail(){

View File

@ -46,14 +46,31 @@
<up-button type="success" @tap="zdysave">确认充值</up-button> <up-button type="success" @tap="zdysave">确认充值</up-button>
</view> </view>
</view> </view>
</up-popup> </up-popup>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref,reactive } from 'vue'
import { payment,getip,getInfo } from '@/utils/service'
import { onLoad } from '@dcloudio/uni-app'
onLoad((opt:any) => {
//payqs.attach.walletCode = opt.walletCode
})
let phoneNumber = ref('')
getInfo({
wuid:uni.getStorageSync('wxuid')
}).then((rps:any) => {
let nickName = rps.data.nickName?rps.data.nickName:''
let name = rps.data.name?rps.data.name:''
phoneNumber.value = rps.data.phoneNumber?rps.data.phoneNumber:''
payqs.attach.trader = name?name:nickName
payqs.description = `${phoneNumber.value}余额充值`
})
let actv = ref(0) let actv = ref(0)
let jiner = ref<string|number>('') let jiner = ref<any>('')
let show = ref(false) let show = ref(false)
function setje(n:number,v:number|string){ function setje(n:number,v:number|string){
@ -61,6 +78,8 @@
jiner.value = v jiner.value = v
if(n == 6){ if(n == 6){
show.value = true show.value = true
jiner.value = ''
zdyjr.value = ''
} }
} }
@ -74,23 +93,92 @@
title:'请选择金额', title:'请选择金额',
icon:'none' icon:'none'
}) })
}else{
payqs.total = jiner.value*1
payqs.goodsDetail[0].unitPrice = jiner.value*1
payhand()
} }
} }
// //
let zdyjr = ref('') let zdyjr = ref<any>('')
let errtip = ref(false) let errtip = ref(false)
function zdysave() { function zdysave() {
if(zdyjr.value == ''){ if(zdyjr.value == ''){
errtip.value = true errtip.value = true
}else{ }else{
errtip.value = false
payqs.total = zdyjr.value*1
payqs.goodsDetail[0].unitPrice = zdyjr.value*1
payhand()
} }
} }
function focus() { function focus() {
errtip.value = false errtip.value = false
} }
//
let payqs = reactive<any>({
wuid:uni.getStorageSync('wxuid'),
description:'余额充值', //
total:0, //
//timeExp:'', //
//
attach:{
type: 1, //"1-,2- number"
//orderNo:'', //"",
trader:'', //
tradercode:uni.getStorageSync('wxuid'), // wuid
walletCode:uni.getStorageSync('walletCode') //
// ownerId:'', //"IDwuid",
// walletCode:'' //""
},
goodsDetail:[
{
merchantGoodsId:new Date().getTime(), //
wechatpayGoodsId:'', //
goodsName:'', //
quantity:1, //
unitPrice:0 //
}
],
payerClientIp:'', //IP
deviceId:'', //
stationCode:''
})
//ip
getip().then((rps:any) => {
payqs.payerClientIp = rps.data
})
function payhand() {
//'{"type":1,"trader":"cijiangbo","tradercode":"8d4638c713e9391baa60395385932fb3","walletCode":"YTWAP1863511124008374272NARVLW"}'
payqs.attach = JSON.stringify(payqs.attach)
payment(payqs).then((rps:any) => {
//#ifdef MP-WEIXIN
wx.requestPayment({
timeStamp:rps.data.timeStamp,
nonceStr: rps.data.nonceStr,
package: rps.data.packageVal,
signType: rps.data.signType,
paySign: rps.data.paySign,
success(){
uni.navigateBack()
},
fail(){
}
})
//#endif
})
}
</script> </script>
<style lang="scss"> <style lang="scss">

View File

@ -86,11 +86,11 @@
import { ref, reactive } from 'vue' import { ref, reactive } from 'vue'
import { getInfo,inforupdate } from '@/utils/service' import { getInfo,inforupdate } from '@/utils/service'
const phoneNumber = uni.getStorageSync('PhoneNumber') //const phoneNumber = uni.getStorageSync('PhoneNumber')
let genderName = ref('') let genderName = ref('')
let formdata = reactive({ let formdata = reactive({
phoneNumber:phoneNumber?phoneNumber:'', // phoneNumber:'', //
nickName:'', // nickName:'', //
avatarUrl:'', // avatarUrl:'', //
name:'', // name:'', //
@ -101,6 +101,7 @@
wuid:uni.getStorageSync('wxuid') wuid:uni.getStorageSync('wxuid')
}).then((rps:any) => { }).then((rps:any) => {
formdata.nickName = rps.data.nickName?rps.data.nickName:'' formdata.nickName = rps.data.nickName?rps.data.nickName:''
formdata.phoneNumber = rps.data.phoneNumber?rps.data.phoneNumber:''
formdata.avatarUrl = rps.data.avatarUrl?rps.data.avatarUrl:'' formdata.avatarUrl = rps.data.avatarUrl?rps.data.avatarUrl:''
formdata.name = rps.data.name?rps.data.name:'' formdata.name = rps.data.name?rps.data.name:''
formdata.gender = rps.data.gender?rps.data.gender:'' formdata.gender = rps.data.gender?rps.data.gender:''

View File

@ -24,7 +24,7 @@
<view v-else class="kuaijrk" style="position: relative;margin-top: -50rpx;align-items:center;background: #fff;"> <view v-else class="kuaijrk" style="position: relative;margin-top: -50rpx;align-items:center;background: #fff;">
<view @tap="topage('/minePages/userInfor/index')" style="display: flex;width:50%;align-items: center;"> <view @tap="topage('/minePages/userInfor/index')" style="display: flex;width:50%;align-items: center;">
<view style="width: 70rpx;height: 70rpx;border-radius: 50%;overflow: hidden;"> <view style="width: 70rpx;height: 70rpx;border-radius: 50%;overflow: hidden;">
<image style="width: 100%;height: 100%;" src="../../static/img/toux.png" /> <image style="width: 100%;height: 100%;" :src="toux()" />
</view> </view>
<view class="niche">{{username()}}</view> <view class="niche">{{username()}}</view>
</view> </view>
@ -33,7 +33,7 @@
<view style="font-size: 26rpx;color: #8e8a8a;">优惠券</view> <view style="font-size: 26rpx;color: #8e8a8a;">优惠券</view>
</view> </view>
<view @tap="topage('/minePages/account/index')"> <view @tap="topage('/minePages/account/index')">
<view style="font-size: 36rpx;">66</view> <view style="font-size: 36rpx;">{{account.totalAmount?account.totalAmount:0}}</view>
<view style="font-size: 26rpx;color: #8e8a8a;">余额</view> <view style="font-size: 26rpx;color: #8e8a8a;">余额</view>
</view> </view>
</view> </view>
@ -150,6 +150,7 @@ import {
swiperimg, swiperimg,
agreement, agreement,
getInfo, getInfo,
getaccou
} from '@/utils/service' } from '@/utils/service'
let height = ref('') let height = ref('')
let islogin = ref(false) let islogin = ref(false)
@ -162,10 +163,57 @@ let imglist = ref<any[]>([])
// uni.removeStorageSync('wxToken') // uni.removeStorageSync('wxToken')
// uni.removeStorageSync('PhoneNumber') // uni.removeStorageSync('PhoneNumber')
let xyobj = ref<any>({}) let xyobj = ref<any>({})
let account = ref<any>({})
let isinit = true
onLoad((opt:any) => { onLoad((opt:any) => {
hdzcode.value = opt.hdzcode hdzcode.value = opt.hdzcode
if(uni.getStorageSync('wxuid')){
loginstate({
wuid:uni.getStorageSync('wxuid')
}).then((rps:any) => {
if(rps.data && rps.data.wxToken){
uni.setStorageSync('wxToken',rps.data.wxToken)
}
getinfo()
})
}
})
onShow(() => {
xyshow.value = false
uni.showTabBar()
//
if(uni.getStorageSync('wxuid')){
islogin.value = true
if(!isinit){
getinfo()
}else{
isinit = false
}
}else{
islogin.value = false
PhoneNumber.value = ''
covers.value = []
hdzcode.value = ''
imglist.value = []
showxy()
}
const instance = getCurrentInstance()
const query = uni.createSelectorQuery().in((instance as any).proxy)
query.select('#mancont').boundingClientRect(v => {
uni.getSystemInfo({
success: n => {
//
height.value = (n.windowHeight - (v as any).height + 20)+'px'
}
})
})
.exec()
}) })
// //
@ -174,7 +222,6 @@ let longitude = ref(114.530428)
let hdzname = ref('') let hdzname = ref('')
let xyshow = ref(false) let xyshow = ref(false)
let init = true
let userInfo = reactive<any>({ let userInfo = reactive<any>({
phoneNumber:'', phoneNumber:'',
@ -246,55 +293,20 @@ function getinfo(){
userInfo.avatarUrl = rps.data.avatarUrl?rps.data.avatarUrl:'' userInfo.avatarUrl = rps.data.avatarUrl?rps.data.avatarUrl:''
userInfo.name = rps.data.name?rps.data.name:'' userInfo.name = rps.data.name?rps.data.name:''
}) })
}
onShow(() => {
xyshow.value = false
uni.showTabBar()
//
if(uni.getStorageSync('wxuid')){
islogin.value = true
// let pnum = uni.getStorageSync('PhoneNumber')
// if(pnum){
// PhoneNumber.value = pnum
// }
//??
getinfo() //??
// if(init){
// loginstate({
// wuid:uni.getStorageSync('wxuid')
// }).then((rps:any) => {
// if(rps.data && rps.data.wxToken){
// uni.setStorageSync('wxToken',rps.data.wxToken)
// }
// getinfo()
// })
// init = false
// }else{
// getinfo()
// }
}else{
islogin.value = false
PhoneNumber.value = ''
covers.value = []
hdzcode.value = ''
imglist.value = []
showxy()
}
const instance = getCurrentInstance()
const query = uni.createSelectorQuery().in((instance as any).proxy)
query.select('#mancont').boundingClientRect(v => { //
uni.getSystemInfo({ getaccou(uni.getStorageSync('wxuid')).then((rps:any) => {
success: n => { if(rps.data.records){
// account.value = rps.data.records[0]
height.value = (n.windowHeight - (v as any).height + 20)+'px' uni.setStorageSync('totalAmount', rps.data.records[0].totalAmount) //??
} uni.setStorageSync('walletCode', rps.data.records[0].code) //??
}) }
}) })
.exec() }
})
function toux() {
return userInfo.avatarUrl?userInfo.avatarUrl:'../../static/img/toux.png'
}
// //
function topage(url:string){ function topage(url:string){

View File

@ -3,14 +3,14 @@
<image class="bjtp" src="../../static/img/wobg.jpg" /> <image class="bjtp" src="../../static/img/wobg.jpg" />
<view v-if="islogin" class="userinfor"> <view v-if="islogin" class="userinfor">
<view @tap="topage('/minePages/userInfor/index')" class="toux"> <view @tap="topage('/minePages/userInfor/index')" class="toux">
<image src="../../static/img/toux.png" /> <image :src="toux()" />
<view> <view>
<view class="niche">微信用户</view> <view class="niche">{{username()}}</view>
<view style="text-align: center;color: #484848;">{{PhoneNumber}}</view> <!-- <view style="text-align: center;color: #484848;">{{userInfo.phoneNumber}}</view> -->
</view> </view>
</view> </view>
<view @tap="topage('/minePages/account/index')"> <view @tap="topage('/minePages/account/index')">
<view style="font-size: 36rpx;">186</view> <view style="font-size: 36rpx;">{{totalAmount}}</view>
<view style="color: #848484;">余额</view> <view style="color: #848484;">余额</view>
</view> </view>
</view> </view>
@ -174,26 +174,61 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref,reactive } from 'vue'
import { onShow } from '@dcloudio/uni-app' import { onShow } from '@dcloudio/uni-app'
import { login,getUser } from '@/utils/service' import { getInfo } from '@/utils/service'
let islogin = ref(false) let islogin = ref(false)
let PhoneNumber = ref('') let PhoneNumber = ref('')
let userInfo = reactive<any>({
phoneNumber:'',
avatarUrl:'',
name:'',
nickName:''
})
let totalAmount = ref(0)
function toux() {
return userInfo.avatarUrl?userInfo.avatarUrl:'../../static/img/toux.png'
}
onShow(() => { onShow(() => {
if(uni.getStorageSync('wxuid')){ if(uni.getStorageSync('wxuid')){
//
getInfo({
wuid:uni.getStorageSync('wxuid')
}).then((rps:any) => {
userInfo.phoneNumber = rps.data.phoneNumber?rps.data.phoneNumber:''
userInfo.nickName = rps.data.nickName?rps.data.nickName:''
userInfo.avatarUrl = rps.data.avatarUrl?rps.data.avatarUrl:''
userInfo.name = rps.data.name?rps.data.name:''
})
totalAmount.value = uni.getStorageSync('totalAmount')
islogin.value = true islogin.value = true
let pnum = uni.getStorageSync('PhoneNumber') // let pnum = uni.getStorageSync('PhoneNumber')
if(pnum){ // if(pnum){
PhoneNumber.value = pnum // PhoneNumber.value = pnum
} // }
}else{ }else{
islogin.value = false islogin.value = false
PhoneNumber.value = '' //PhoneNumber.value = ''
} }
}) })
function username() {
if(userInfo.phoneNumber){
return userInfo.phoneNumber
}else if(userInfo.nickName){
return userInfo.nickName
}else if(userInfo.name){
return userInfo.name
}
return '微信用户'
}
// //
function topage(url:string){ function topage(url:string){
uni.navigateTo({ uni.navigateTo({
@ -309,7 +344,7 @@
} }
} }
.niche{ .niche{
width: 200rpx; width: 240rpx;
padding-left: 20rpx; padding-left: 20rpx;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;

View File

@ -48,7 +48,8 @@ export function request(method:any,url:string,data?:any,isLoading?:any){
if(url == '/wechat/login/checksessionkey'){ if(url == '/wechat/login/checksessionkey'){
resolve(rps.data) resolve(rps.data)
}else{ }else{
uni.setStorageSync('wxToken',(rps.data as any).wxToken) let wdata:any = rps.data
uni.setStorageSync('wxToken',wdata.data.wxToken)
request(method,url,data,isLoading) request(method,url,data,isLoading)
} }
}else{ }else{

View File

@ -105,7 +105,7 @@ export function getUser() {
// uni.navigateTo({ // uni.navigateTo({
// url:'/pages/login/index' // url:'/pages/login/index'
// }) // })
}).catch((err:any) => { }).catch(() => {
uni.hideLoading() uni.hideLoading()
rjt() rjt()
}) })
@ -178,7 +178,7 @@ export function carlist(wuid:String){
// interface Payment{ // interface Payment{
// wuid:String //用户编码 // wuid:String //用户编码
// description:String //订单总描述 // description:String //订单总描述
// money:String|Number //支付金额,单位:分 // total:String|Number //支付金额,单位:分
// timeExp:String //支付结束时间 // timeExp:String //支付结束时间
// attach:String //订单附加信息 // attach:String //订单附加信息
// goodsDetail:{ // goodsDetail:{
@ -199,4 +199,25 @@ export function payment(parameter:any){
//获取ip //获取ip
export function getip(){ export function getip(){
return request('GET','/wechat/resource/util/ip') return request('GET','/wechat/resource/util/ip')
} }
//开通钱包账户
export function openaccou(wuid:string){
return request('post_form','/wechat/wechat/user/wallet/open',{wuid})
}
//查询钱包账户
export function getaccou(wuid:string){
return request('post_form','/wechat/wechat/user/wallet/list',{wuid})
}
//余额明细
interface Balande{
walletCode:String,
pageSize:String|Number, //每页条数,示例值(10)
pageNo:String|Number //页数,示例值(1)
}
export function balancedetails(parameter:Balande){
return request('post_form','/wechat/wechat/user/wallet/detail/list',parameter)
}