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"
/>
<view class="content">
<view class="jiner">
<view id="mancont" class="jiner">
<view class="num">
<view>余额</view>
<view><text style="font-size: 50rpx;">99.00</text> </view>
<view><text style="font-size: 50rpx;">{{totalAmount}}</text> </view>
</view>
<view class="ctbn" @tap="topage('/minePages/recharge/index')">充值</view>
</view>
<view class="mingxi">
<view class="tit">余额明细</view>
<!--:style="{height:height,overflowY: 'auto'}"-->
<view>
<view class="mxitem">
<view v-for="n in list" class="mxitem">
<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>
@ -28,7 +29,9 @@
<view style="font-size: 30rpx;color: #ccc;">实际到账金额100</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 style="padding-bottom: 8rpx;font-size: 40rpx;">换电</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="font-size: 30rpx;color: #ccc;">实际消费10</view>
</view>
</view>
</view> -->
</view>
</view>
</view>
</template>
<script setup lang="ts">
import {ref} from 'vue'
import { onReachBottom } from '@dcloudio/uni-app'
onReachBottom(() => {
import {ref,reactive,getCurrentInstance} from 'vue'
import { onLoad,onShow,onReachBottom } from '@dcloudio/uni-app'
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) {
uni.navigateTo({

View File

@ -58,7 +58,7 @@
>
<view class="hdbzcont">
<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>
</view>
</up-popup>
@ -70,9 +70,32 @@
import { onShow,onReachBottom } from '@dcloudio/uni-app'
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-
const statelist = reactive([
{ name: '全部'},
@ -150,7 +173,7 @@
}
//
getlist()
//getlist()
onReachBottom(() => {
if(status.value == 'loadmore'){

View File

@ -15,19 +15,19 @@
<view class="dingdan">
<view>
<view>订单号</view>
<view style="font-size: 28rpx;">YTSOgyy000012025011110572044197C</view>
<view style="font-size: 28rpx;">{{order.orderNo}}</view>
</view>
<view>
<view>订单金额</view>
<view>¥100</view>
<view>¥{{order.amount}}</view>
</view>
<view>
<view>车牌号</view>
<view>冀A12345D</view>
<view>{{order.plateNum}}</view>
</view>
<view>
<view>换电站</view>
<view>北京1号换电站</view>
<view>{{order.stationName}}</view>
</view>
</view>
<view class="btns">
@ -40,8 +40,23 @@
<script setup lang="ts">
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'
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(){
uni.switchTab({
@ -50,7 +65,7 @@
}
function goorder(){
uni.navigateTo({
uni.redirectTo({
url:'/minePages/order/index'
})
}

View File

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

View File

@ -46,14 +46,31 @@
<up-button type="success" @tap="zdysave">确认充值</up-button>
</view>
</view>
</up-popup>
</template>
<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 jiner = ref<string|number>('')
let jiner = ref<any>('')
let show = ref(false)
function setje(n:number,v:number|string){
@ -61,6 +78,8 @@
jiner.value = v
if(n == 6){
show.value = true
jiner.value = ''
zdyjr.value = ''
}
}
@ -74,23 +93,92 @@
title:'请选择金额',
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)
function zdysave() {
if(zdyjr.value == ''){
errtip.value = true
}else{
errtip.value = false
payqs.total = zdyjr.value*1
payqs.goodsDetail[0].unitPrice = zdyjr.value*1
payhand()
}
}
function focus() {
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>
<style lang="scss">

View File

@ -86,11 +86,11 @@
import { ref, reactive } from 'vue'
import { getInfo,inforupdate } from '@/utils/service'
const phoneNumber = uni.getStorageSync('PhoneNumber')
//const phoneNumber = uni.getStorageSync('PhoneNumber')
let genderName = ref('')
let formdata = reactive({
phoneNumber:phoneNumber?phoneNumber:'', //
phoneNumber:'', //
nickName:'', //
avatarUrl:'', //
name:'', //
@ -101,6 +101,7 @@
wuid:uni.getStorageSync('wxuid')
}).then((rps:any) => {
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.name = rps.data.name?rps.data.name:''
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 @tap="topage('/minePages/userInfor/index')" style="display: flex;width:50%;align-items: center;">
<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 class="niche">{{username()}}</view>
</view>
@ -33,7 +33,7 @@
<view style="font-size: 26rpx;color: #8e8a8a;">优惠券</view>
</view>
<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>
</view>
@ -150,6 +150,7 @@ import {
swiperimg,
agreement,
getInfo,
getaccou
} from '@/utils/service'
let height = ref('')
let islogin = ref(false)
@ -162,10 +163,57 @@ let imglist = ref<any[]>([])
// uni.removeStorageSync('wxToken')
// uni.removeStorageSync('PhoneNumber')
let xyobj = ref<any>({})
let account = ref<any>({})
let isinit = true
onLoad((opt:any) => {
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 xyshow = ref(false)
let init = true
let userInfo = reactive<any>({
phoneNumber:'',
@ -246,55 +293,20 @@ function getinfo(){
userInfo.avatarUrl = rps.data.avatarUrl?rps.data.avatarUrl:''
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({
success: n => {
//
height.value = (n.windowHeight - (v as any).height + 20)+'px'
//
getaccou(uni.getStorageSync('wxuid')).then((rps:any) => {
if(rps.data.records){
account.value = rps.data.records[0]
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){

View File

@ -3,14 +3,14 @@
<image class="bjtp" src="../../static/img/wobg.jpg" />
<view v-if="islogin" class="userinfor">
<view @tap="topage('/minePages/userInfor/index')" class="toux">
<image src="../../static/img/toux.png" />
<image :src="toux()" />
<view>
<view class="niche">微信用户</view>
<view style="text-align: center;color: #484848;">{{PhoneNumber}}</view>
<view class="niche">{{username()}}</view>
<!-- <view style="text-align: center;color: #484848;">{{userInfo.phoneNumber}}</view> -->
</view>
</view>
<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>
</view>
@ -174,26 +174,61 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { ref,reactive } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { login,getUser } from '@/utils/service'
import { getInfo } from '@/utils/service'
let islogin = ref(false)
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(() => {
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
let pnum = uni.getStorageSync('PhoneNumber')
if(pnum){
PhoneNumber.value = pnum
}
// let pnum = uni.getStorageSync('PhoneNumber')
// if(pnum){
// PhoneNumber.value = pnum
// }
}else{
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){
uni.navigateTo({
@ -309,7 +344,7 @@
}
}
.niche{
width: 200rpx;
width: 240rpx;
padding-left: 20rpx;
text-overflow: ellipsis;
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'){
resolve(rps.data)
}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)
}
}else{

View File

@ -105,7 +105,7 @@ export function getUser() {
// uni.navigateTo({
// url:'/pages/login/index'
// })
}).catch((err:any) => {
}).catch(() => {
uni.hideLoading()
rjt()
})
@ -178,7 +178,7 @@ export function carlist(wuid:String){
// interface Payment{
// wuid:String //用户编码
// description:String //订单总描述
// money:String|Number //支付金额,单位:分
// total:String|Number //支付金额,单位:分
// timeExp:String //支付结束时间
// attach:String //订单附加信息
// goodsDetail:{
@ -200,3 +200,24 @@ export function payment(parameter:any){
export function getip(){
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)
}