<template><view class="pageContainer"><u-navbar :title="$t('支付费用')" :autoBack="true"  ></u-navbar><view class="flex flexColumn flexAiCenter mt20"><u-text color="#999999" :text="$t('需支付')" align="center"></u-text><view class="price">¥{{price}}</view></view><!-- <view class="cellsBox"><u-cell-group :border="false"><template v-for="item in rechargeTypes"><u-cell :title="item.name" :icon="item.ico" :label="item.info" :iconStyle="style.icon"></u-cell></template></u-cell-group></view> --><view class="detail flexColumn flexJcCenter"><view class="title">{{$t('请选择支付方式')}}</view><view class="flexColumn"><view class="type-row" v-for="(item,index) in rechargeTypes" :key="`type_${index}`" @click="select(item)":class="{'disabled': item.disabled}"><view class="type-row-name"><u-icon :name="item.ico" size="24"></u-icon><text>{{item.name}}</text><text class="info" v-if="item.info">({{item.info}})</text></view><view v-if="typeChosed == item.code"><u-icon name="/static/icon/selected.png" size="24"></u-icon></view></view></view><view class=""><u-button :text="$t('立即支付')" shape="circle" class="colorsButton" @click="startPayment"></u-button></view></view><lyy-pass-input ref="passInput" :title="$t('支付金额')" :money="parseInt(price)" @confirm="confirm" @close="close"></lyy-pass-input></view>
</template><script>export default {data() {return {rechargeTypes:[],orderNo:'',price:'',isApp: false,style:{icon:{width:"50rpx",height:"50rpx"}},typeChosed:'',paymentPassword:null,};},onLoad(option) {this.orderNo = option.no;this.price = option.price;// #ifdef APP-PLUSthis.isApp = true// #endifthis.getRechargeTypes()},methods:{// 确认支付confirm(e){this.$refs.passInput.close();this.paymentPassword = e.pass;this.startPayment();this.paymentPassword=null;},close(){this.paymentPassword=null;},select(item) {if (item.disabled) return false;this.typeChosed = item.code;},getRechargeTypes(){this.$axios.post(`/user/rechargeTypes`,{orderNo:this.orderNo,isApp: this.isApp}).then(res=>{this.rechargeTypes = res.data;})},startPayment() {if (!this.orderNo) {uni.$u.toast(this.$t('订单号为空'))return false;}if (!this.typeChosed) {uni.$u.toast(this.$t('请选择一个支付方式'))return false;}let obj = {type: this.typeChosed,orderNo: this.orderNo}if(this.typeChosed == "legal" ){if(!getApp().globalData.loginUserInfo.hasSetWithdrawalPassword){uni.$u.toast(this.$t('请先设置您的支付密码'));setTimeout(()=>{uni.navigateTo({url: '/pages/my/securityPassword?type=0'})},2000)return false;}if(!this.paymentPassword){this.$refs.passInput.open();return;}elseobj.payPassword = this.paymentPassword;}this.$axios.post(`/user/doPayment`, obj).then(res => {this.paymentPassword=null;if (res.data.type === 'balance') {uni.$u.toast(res.data.res)// this.$u.$parent.call(this).callAnimation(res.data.items);setTimeout(() => {// uni.$u.$parent.call(this).loadSeries();this.$utils.getUserInfo((res => {getApp().globalData.loginUserInfo = res;}))uni.redirectTo({url: '/pages/my/pictures',animationType:"slide-in-right",animationDuration: 200})}, 1e3)// this.close();}if (res.data.payUrl) {//#ifdef H5let platform = uni.getSystemInfoSync().platformif (platform == 'ios') {location.href = res.data.payUrl;} else {open(res.data.payUrl)}//#endif//#ifdef APP-PLUSplus.runtime.openURL(res.data.payUrl)// this.close();this.$utils.showConfirmEx(this.$t('请在打开的页面中支付'), this.$t('我已完成支付'), this.$t('取消支付'), (e) => {if (e) {// uni.switchTab({//     url: '/pages/my/my'// });this.$axios.post(`/user/rechargeStatus`, {order: this.orderNo}).then(res => {if (res.status == 1) {let items = res.items;console.log(item)}});}})//#endif}})}}}
</script><style lang="scss">.price {margin-top: 32rpx;font-size: 70rpx;font-weight: 600    ;}.detail {margin-top: 102rpx;min-width: 280px;background: #222;padding: 20px;border-radius: 30rpx;.title {padding: 20rpx 0;font-size: 18px;width: 100%;text-align: center;border-bottom: #36364c 1px solid;}.type-row {display: flex;justify-content: space-between;align-items: center;margin-top: 20px;font-size: 14px;&-name {display: flex;align-items: center;text {margin-left: 10rpx;}.info {color: #666;font-size: 12px;}}}.type-row.disabled {color: #666;text-decoration: line-through;}.colorsButton {margin-top: 20px;}}
</style>

uniapp支付功能实现相关推荐

  1. uni-app支付功能

    uni-app支付功能 扫码查看原文 前言 近期一直在使用APP开发多端应用,IOS的APP.安卓的APP和H5网页,其中开发的APP使用到了微信和支付宝的支付,在此给大家分享出来,一起使用 前置条件 ...

  2. uniapp小程序微信支付功能

    目录 字段说明 前置工作 获取openid 微信支付 报错问题 uniapp 开发小程序需要实现微信支付功能,下面对相关业务进行说明. 字段说明 AppID:小程序的身份证,微信客户端用来确认你的小程 ...

  3. 关于实现uni-app项目在APP端使用微信支付功能

    首先在对项目开启支付功能,在项目的manifest.json文件中勾选APP模块配置中的Payment支付模块,并将需要的信息填写完整,如下图 除此之外还需要其他的一些配置,下面开结合图片来一步步的详 ...

  4. 【微信小程序支付功能】uniapp实现微信小程序支付功能

    场景:要实现公司微信小程序的电商模块微信支付功能 一.实现步骤和思路 在登录状态,登录的时候获取到code,利用code获取到openid:https://blog.csdn.net/weixin_4 ...

  5. uni-app - 最详细 H5 网页接入微信支付功能,提供从详细的示例代码与注释(移动端网页实现微信支付能力,微信公众号前端支付 JSAPI / JS-SDK 详细示例源码)官方最新超级详细教程

    前言 关于 uni-app 项目中接入微信支付的文章鱼龙混杂,各种 JSAPI / JS-SDK 乱代码.过时.没注释.不讲流程原理,非常难用. 本文实现了 uni-app H5 移动端网页项目,实现 ...

  6. 基于spring-boot+uni-app实现app支付功能(微信/支付宝)服务端

    基于spring-boot+uni-app实现app支付功能(微信/支付宝)服务端 支付宝支付 1 准备工作 申请支付能力 接口加签方式 2代码 依赖 支付宝支付配置类 支付宝控制层 异步通知 微信支 ...

  7. UniApp + SpringBoot 实现接入支付宝支付功能和退款功能

    一.支付宝开放平台设置 注册支付宝支付功能需要个体工商户或企业才可以!需要有营业执照才能去申请哦! 1.登录到控制台 进入支付宝开放平台 控制台 2.开发设置 3.产品绑定APP支付 如果没有绑定AP ...

  8. uniapp实现支付功能

    uniapp实现支付功能 详细参考: https://gitee.com/copperpeas/uniapp-payment uniapp-payment 介绍 uniapp支付 微信支付流程 测试接 ...

  9. uniapp实现微信小程序支付功能

    我这个项目是一个外卖小程序 首先要做支付功能,需要两个条件 1.必须是企业,个人用户不行 2.去微信支付平台提交资料审核 首先封装网络请求 api.js // 引进提示 import {errdata ...

最新文章

  1. 11月1日数据结构讨论班 【杂】
  2. CentOS系统设置自动登录
  3. 公众号滑动图代码_实用技巧:公众号封面图如何提取?
  4. mysql运行状态监控研究内容_如何监控mysql主从的运行状态shell脚本实例介绍
  5. 你不知道的 20+ Chrome Devtools 技巧!
  6. 制作一个状态栏中跑马灯效果_图标设计指南(3)——制作一个图标集所需全部信息(中)...
  7. 【Elasticsearch】如何在Elasticsearch中使用排名评估API
  8. 输入框中光标过长原因
  9. Qt总结之十二:C/C++内存分配方式与存储区
  10. 乐优商城遇到的坑(三)之Centos6.5下安装nginx出错
  11. Tkinter教程之Button篇
  12. 概率论实验 04 - | 基于Matlab的匹配滤波器
  13. cmd 批量复制文件/文件夹
  14. web前端中的文本居中效果
  15. 网络聊天室项目说明书
  16. 2022年煤矿探放水考题及模拟考试
  17. 如何手动对apk进行签名?
  18. Android移动开发问题 AAPT: error: resource xml/11 (aka com.example.myapplication:xml/11) not found.
  19. es6知识总结 模块 承诺加载
  20. python 常用系统内置模块

热门文章

  1. zabbix监控日志
  2. 品牌活动如何策划,更利于传播?(吸引媒体报道)
  3. VUE货架详情之缩略图previewww
  4. 【论文阅读】Federated Learning on Non-IID Data Silos: An Experimental Study
  5. Python爬虫之requests
  6. DEM转换为gltf
  7. 关于用户访问请求慢,TTFB时间长的问题分析
  8. Waiting (TTFB)
  9. 新城疫治疗行业调研报告 - 市场现状分析与发展前景预测
  10. ​Spring Cloud之赵国的覆灭