修改支付

This commit is contained in:
cjb 2025-01-11 17:13:02 +08:00
parent 1910d111de
commit 96493e08d8
12 changed files with 227 additions and 86 deletions

View File

@ -44,7 +44,7 @@
<view style="color: #009688;" @tap="getbz(n.orderNo)">查看换电详情</view>
</view>
</view>
<view v-if="n.status == 6" class="qxyy" @tap="topay(`/minePages/payment/index?orderNo=${n.orderNo}&amount=${n.amount}`)">去支付</view>
<view v-if="n.status == 6" class="qxyy" @tap="topay(`/minePages/payment/index?orderNo=${n.orderNo}&amount=${n.amount}&plateNum=${n.plateNum}&stationName=${n.stationName}`)">去支付</view>
</view>
</view>
<up-empty v-if="list.length == 0" mode="list" text="暂无订单" />
@ -67,8 +67,11 @@
<script setup lang="ts">
import { ref,reactive } from 'vue'
import { orderlist,dzbzxq } from '@/utils/service'
import { onReachBottom } from '@dcloudio/uni-app'
import { onShow,onReachBottom } from '@dcloudio/uni-app'
onShow(() => {
tabshand(stanum.value)
})
// 1-2-3-4-5-6-7-9-
const statelist = reactive([

View File

@ -0,0 +1,95 @@
<template>
<up-navbar
title="支付详情"
bgColor="#00aa7f"
:autoBack="false"
leftIconColor="#00aa7f"
titleStyle="color:#fff"
:placeholder="true"
/>
<view style="padding: 100rpx 20rpx; background: #fff;">
<view style="display: flex;align-items: center;justify-content: center;">
<up-icon name="checkmark-circle" color="#00aa00" size="38" />
<view style="padding-left: 10rpx;font-size: 54rpx;color: #00aa00;">支付成功</view>
</view>
<view class="dingdan">
<view>
<view>订单号</view>
<view style="font-size: 28rpx;">YTSOgyy000012025011110572044197C</view>
</view>
<view>
<view>订单金额</view>
<view>¥100</view>
</view>
<view>
<view>车牌号</view>
<view>冀A12345D</view>
</view>
<view>
<view>换电站</view>
<view>北京1号换电站</view>
</view>
</view>
<view class="btns">
<view class="qxyy" @tap="gohome">返回首页</view>
<view class="qxyy" @tap="goorder">我的订单</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref,reactive } from 'vue'
import { payment,getip } from '@/utils/service'
import { onLoad,onShow } from '@dcloudio/uni-app'
function gohome(){
uni.switchTab({
url:'/pages/home/index'
})
}
function goorder(){
uni.navigateTo({
url:'/minePages/order/index'
})
}
</script>
<style lang="scss">
page{
background: #f4f4f4;
}
.dingdan{
padding:60rpx 20rpx 100rpx;
>view{
display: flex;
justify-content:space-between;
padding-bottom: 24rpx;
>view{
padding-right: 14rpx;
}
>view:last-child{
color: #616161;
}
}
}
.btns{
display: flex;
box-sizing: border-box;
width: 100%;
padding: 0 30rpx;
justify-content:space-between
}
.qxyy{
width: 40%;
height: 80rpx;
//margin: 100rpx auto 0;
line-height: 80rpx;
border-radius:16rpx;
color: #fff;
text-align: center;
background: #00aa00;
}
</style>

View File

@ -8,68 +8,97 @@
:placeholder="true"
/>
<view class="content">
<view style="padding-bottom: 200rpx;text-align: center;">
<text>¥</text>
<text style="font-size: 60rpx;">100</text>
<text></text>
<view style="display: flex;align-items:center;justify-content: space-between;padding:30rpx;border-bottom:1px solid #f4f4f4;background: #fff;">
<view>付款金额</view>
<view style="color: #ffaa00;">
<text>¥ </text>
<text style="font-size: 50rpx;">{{payqs.money}}</text>
</view>
<view class="qxyy" @tap="payhand">立即支付</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%);" />
<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>
</label>
<label style="display: flex;align-items: center;padding: 30rpx;">
<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>
</view>
</label>
</radio-group>
</view>
<view class="qxyy" @tap="payhand">立即支付</view>
</template>
<script setup lang="ts">
import { ref,reactive } from 'vue'
import { payment } from '@/utils/service'
import { payment,getip } from '@/utils/service'
import { onLoad,onShow } from '@dcloudio/uni-app'
onLoad((opt:any) => {
payqs.money = opt.amount
payqs.detail.costPrice = opt.amount
payqs.detail.goodsDetail.unitPrice = opt.amount
payqs.money = opt.amount*1
payqs.attach = opt.orderNo
payqs.detail.goodsDetail.merchantGoodsId = opt.orderNo
payqs.detail.goodsDetail.unitPrice = opt.amount*1
payqs.description = `车牌号:${opt.plateNum} 换电站:${opt.stationName}`
// payqs.detail.costPrice = opt.amount
// payqs.detail.goodsDetail.unitPrice = opt.amount
})
let actv = ref(2)
function radioChange(v:any) {
console.log(v,'v')
}
let payqs = reactive({
wuid:uni.getStorageSync('wxuid'),
remarks:'',
money:'',
description:'', //
money:0, //
//timeExp:'', //
attach:'',
detail:{
costPrice:'', //
invoiceId:'', //ID
goodsDetail:{
merchantGoodsId:'', //
wechatpayGoodsId:'', //
goodsName:'', //
quantity:1, //
unitPrice:'' //
}
}
unitPrice:0 //
}//
},
payerClientIp:'', //IP
deviceId:'', //
stationCode:''
})
//ip
getip().then((rps:any) => {
payqs.payerClientIp = rps.data
})
function payhand() {
payment(payqs).then((rps:any) => {
console.log(rps)
// appId: "wx2ab384cf1e6f85a1"
// nonceStr: "WhtgCld5gCTWBDzfFuRcFEhKCYTsIq2f"
// packageVal: "prepay_id=wx091610306843188838925c6a38a9fb0000"
// paySign: "JCWH1qZtgIJx6k+Cah5Js40Bgx9k1sQlvthfsYu3IwexwPX3JXOnEjAHhKSG61iRkcdaxaqtcIxYpXUuiQOwWf4epZE+YTZIJ021eXiM4J/o0NwXXTB7guEDo5MuEFQWsrdyAqhoTD1cziVrKyp/ka1aux5ULOgVfn6FvHRaoEO+YIn71ls9z/sKloJjuCS9bdSppknJwAmmVD+k7Xc/vCiFZ0c7k13JzYWbWCXgHCMNJ02DrP75EuzuDvmN/4U9ABN9z/SN/Roz2fs9/h7DPagICC9oj0oEg80+Y4S84EUFupsR2MCFVQlCF4+dPdCx75JcXId6cSIE+ySJciyjHQ=="
// signType: "RSA"
// timeStamp: "1736410231"
//#ifdef MP-WEIXIN
wx.requestPayment({
timeStamp:rps.data.timeStamp,
nonceStr: rps.data.timeStamp,
package: rps.data.timeStamp,
nonceStr: rps.data.nonceStr,
package: rps.data.packageVal,
signType: rps.data.signType,
paySign: rps.data.paySign,
success:function(res){
success(){
uni.redirectTo({
url:'/minPages/paySuccess/index'
})
},
fail:function(res){
fail(){
}
})
@ -83,19 +112,15 @@
page{
background: #f4f4f4;
}
.content{
margin:50rpx 30rpx 30rpx;
padding: 40rpx;
border-radius: 20rpx;
background: #fff;
.qxyy{
height: 80rpx;
line-height: 80rpx;
border-radius:20rpx;
color: #fff;
text-align: center;
background: #00aa00;
}
.qxyy{
width: 90%;
height: 80rpx;
margin: 100rpx auto 0;
line-height: 80rpx;
border-radius:10rpx;
color: #fff;
text-align: center;
background: #00aa00;
}
.hdbzcont{
box-sizing: border-box;

View File

@ -24,7 +24,7 @@
</view>
<view>
<view>预约时间</view>
<view>{{ytime(n.swapDay,n.swapDuration)}}</view>
<view style="font-size: 30rpx;">{{ytime(n.swapDay,n.swapDuration)}}</view>
</view>
</view>
<view v-if="n.status == 1" @tap="cancel(n.pkId)" class="qxyy" style="background: #00aa00;">取消预约</view>

View File

@ -66,6 +66,9 @@
},
{
"path": "payment/index" //
},
{
"path": "paySuccess/index" //
}
]
}

View File

@ -5,7 +5,6 @@
height="500rpx"
keyName="picUrl"
:list="imglist"
indicator
indicatorMode="line"
radius="0"
:indicator="false"
@ -143,7 +142,15 @@
<script setup lang="ts">
import { ref,reactive,watch,getCurrentInstance } from 'vue'
import { onLoad,onShow } from '@dcloudio/uni-app'
import { login,getUser,gethdz,loginstate,swiperimg,agreement,getInfo } from '@/utils/service'
import {
login,
getUser,
gethdz,
loginstate,
swiperimg,
agreement,
getInfo,
} from '@/utils/service'
let height = ref('')
let islogin = ref(false)
let PhoneNumber = ref('')
@ -252,17 +259,20 @@ onShow(() => {
// }
//??
if(init){
loginstate({
wuid:uni.getStorageSync('wxuid')
}).then((rps:any) => {
uni.setStorageSync('wxToken',rps.data.wxToken)
getinfo()
})
init = false
}else{
getinfo()
}
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 = ''

View File

@ -8,9 +8,9 @@
open-type="getPhoneNumber"
@getphonenumber="onGetPhoneNumber"
>手机号快捷登录</button> -->
<button style="width: 80%;height: 80rpx;line-height: 80rpx;border-radius:10rpx;color:#fff;text-align:center;background: #4CAF50;" @tap="login"> </button>
<view style="display: flex;align-items: center;;padding-top: 10rpx;">
<label class="radio"><radio value="r1" :checked="checked" @tap="checked = !checked">已阅读并同意</radio></label>
<button style="width: 85%;height: 80rpx;line-height: 80rpx;border-radius:10rpx;color:#fff;text-align:center;background: #4CAF50;" @tap="login"> </button>
<view style="display: flex;align-items: center;;padding-top: 20rpx;">
<label class="radio"><radio value="r1" :checked="checked" @tap="checked = !checked" style="transform:scale(80%);" />已阅读并同意</label>
<view @tap="topage('/minePages/agreement/index?type=1')" style="padding: 0 10rpx;color: #ffaa00;">服务条款</view>
<view @tap="topage('/minePages/agreement/index?type=2')" style="color: #ffaa00;">隐私协议</view>
</view>

BIN
src/static/img/weixin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
src/static/img/yuer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -1,4 +1,5 @@
const ENV = process.env.APP_ENV || process.env.NODE_ENV;
const confing = {
development: {
// #ifdef MP-WEIXIN

View File

@ -29,8 +29,8 @@ export function request(method:any,url:string,data?:any,isLoading?:any){
uni.request({
header:headers,
//url:'http://192.168.5.200:9100/gateway'+ url,//`${conf.apiBaseUrl}${url}`,
//url:'http://192.168.5.213:9100/gateway'+ url,
url:'https://api.evo-techina.com'+url,
url:'http://192.168.5.213:9100/gateway'+ url,
//url:'https://api.evo-techina.com'+url,
method,
data:data,
timeout:30000,
@ -43,8 +43,6 @@ export function request(method:any,url:string,data?:any,isLoading?:any){
resolve(rps.data)
}else if((rps.data as any).code == 'D0402'){
resolve({data:[]})
}else if((rps.data as any).code == 'W0404'){
resolve({data:[]})
}else if((rps.data as any).code == 'W0405'){
//uni.removeStorageSync('wxToken')
if(url == '/wechat/login/checksessionkey'){

View File

@ -175,22 +175,28 @@ export function carlist(wuid:String){
}
//支付
interface Payment{
wuid:String,
remarks:String,
money:String|Number,
detail:{
costPrice:String|Number,
invoiceId:String,
goodsDetail:{
merchantGoodsId:String
wechatpayGoodsId:String
goodsName:String
quantity:String|Number
unitPrice:String|Number
}
}
}
export function payment(parameter:Payment){
// interface Payment{
// wuid:String //用户编码
// description:String //订单总描述
// money:String|Number //支付金额,单位:分
// timeExp:String //支付结束时间
// attach:String //订单附加信息
// goodsDetail:{
// merchantGoodsId:String
// wechatpayGoodsId:String
// goodsName:String
// quantity:String|Number
// unitPrice:String|Number
// }
// payerClientIp:String //用户IP
// deviceId:String //用户设备型号
// stationCode:String
// }
export function payment(parameter:any){
return request('post_json','/wechat/wechatpay/xcx/prepay',parameter)
}
//获取ip
export function getip(){
return request('GET','/wechat/resource/util/ip')
}