Commit 41b3dcfa by 张立顺

feat:v4.8.0 功能开发完成

1 parent d72dfac2
...@@ -11,6 +11,8 @@ Page({ ...@@ -11,6 +11,8 @@ Page({
merchantId: '', merchantId: '',
merchantName: '', merchantName: '',
payMoney: '', // 支付金额 payMoney: '', // 支付金额
unPayMoneyList: ['0', '0.', '0.0', '0.00'],
canPay: false,
keyHidden: false, keyHidden: false,
unpaid: true, unpaid: true,
showOrderInfo: false, showOrderInfo: false,
...@@ -21,7 +23,8 @@ Page({ ...@@ -21,7 +23,8 @@ Page({
{ name: 'tradeNo', label: '流水号', info: '' }, { name: 'tradeNo', label: '流水号', info: '' },
{ name: 'payTime', label: '支付时间', info: '' } { name: 'payTime', label: '支付时间', info: '' }
], ],
// openID: 'oQ6Sh5cGirPd55Oc1J1oJSRpboFM', openId: 'oQ6Sh5cGirPd55Oc1J1oJSRpboFM',
// openId: '',
outTradeNo: '' outTradeNo: ''
}, },
...@@ -32,7 +35,11 @@ Page({ ...@@ -32,7 +35,11 @@ Page({
// console.log('app', app.globalData.login()) // console.log('app', app.globalData.login())
console.log(options) console.log(options)
this.gteOpenId() this.gteOpenId()
wx.hideHomeButton({
success: function () {
console.log('隐藏成功!')
}
})
// this.successInfo() // this.successInfo()
// api.createWxPayOrderH5({ merchantId: '44184606', receivedMoney: 22 }, res => { // api.createWxPayOrderH5({ merchantId: '44184606', receivedMoney: 22 }, res => {
// // util.hideLoading() // // util.hideLoading()
...@@ -50,6 +57,7 @@ Page({ ...@@ -50,6 +57,7 @@ Page({
// }) // })
// options = { // options = {
// sceneId%3D4
// scene: 'sceneId%3D4' // scene: 'sceneId%3D4'
// } // }
...@@ -96,7 +104,6 @@ Page({ ...@@ -96,7 +104,6 @@ Page({
console.log(res) console.log(res)
let { returnCode, data } = res let { returnCode, data } = res
let op = {} let op = {}
// console.log('dddddddddddddddddd')
if (returnCode == '0') { if (returnCode == '0') {
if (data) { if (data) {
data.split('&').map(item => { data.split('&').map(item => {
...@@ -130,7 +137,7 @@ Page({ ...@@ -130,7 +137,7 @@ Page({
handleKey(e) { handleKey(e) {
const that = this const that = this
const { key } = e.currentTarget.dataset const { key } = e.currentTarget.dataset
const { payMoney } = this.data const { payMoney, unPayMoneyList } = this.data
// 删除金额 // 删除金额
if (key === 'X') { if (key === 'X') {
if (payMoney !== '') { if (payMoney !== '') {
...@@ -140,14 +147,27 @@ Page({ ...@@ -140,14 +147,27 @@ Page({
}) })
} }
} else { } else {
// 添加金额 // 添加金额 开头为.自动补全
const money = payMoney + key let money
if (key == '.' && payMoney == '') {
money = '0.'
} else {
money = payMoney + key
}
// console.log(/^(\d+\.?\d{0,2})$/.test(money), money, 'money') // console.log(/^(\d+\.?\d{0,2})$/.test(money), money, 'money')
console.log(/^(\d{0,7}\.?\d{0,2})$/.test(money), money, 'money') console.log(/^(\d{0,7}\.?\d{0,2})$/.test(money), money, 'money')
if (/^(\d{0,7}\.?\d{0,2})$/.test(money)) { if (/^(\d{0,6}\.?\d{0,2})$/.test(money)) {
// 此处控制的是如果没有小数点,首位不能为类似于 01、02的金额
if (money.indexOf('.') < 0 && money != '') {
console.log(parseFloat(money))
money = parseFloat(money).toString()
}
// 金额0不能给支付
that.setData({ that.setData({
payMoney: money payMoney: money,
canPay: !unPayMoneyList.includes(money)
}) })
} }
} }
...@@ -155,8 +175,8 @@ Page({ ...@@ -155,8 +175,8 @@ Page({
// 支付 // 支付
handlePay() { handlePay() {
let _this = this let _this = this
const { payMoney, merchantId, openId } = this.data const { payMoney, merchantId, openId, unPayMoneyList } = this.data
if (payMoney === '' || payMoney == '0' || payMoney == '0.0' || payMoney == '0.00') return if (payMoney === '' || unPayMoneyList.includes(payMoney)) return
// this.wxPayment(payMoney) // this.wxPayment(payMoney)
console.log(Number(payMoney), '付款') console.log(Number(payMoney), '付款')
let params = { let params = {
...@@ -166,6 +186,8 @@ Page({ ...@@ -166,6 +186,8 @@ Page({
} }
util.showLoading('加载中...') util.showLoading('加载中...')
// 调用支付接口生成对应的微信支付参数 // 调用支付接口生成对应的微信支付参数
// console.log(params)
// return
api.createWxPayOrderH5(params, res => { api.createWxPayOrderH5(params, res => {
util.hideLoading() util.hideLoading()
console.log(res) console.log(res)
...@@ -209,6 +231,9 @@ Page({ ...@@ -209,6 +231,9 @@ Page({
console.log(res) console.log(res)
// 查询订单信息 // 查询订单信息
util.showLoading('加载中...') util.showLoading('加载中...')
wx.setNavigationBarTitle({
title: '支付完成'
})
_this.successInfo() _this.successInfo()
}, },
fail: function (error) { fail: function (error) {
...@@ -232,7 +257,7 @@ Page({ ...@@ -232,7 +257,7 @@ Page({
if (returnCode == 0) { if (returnCode == 0) {
data && data &&
orderInfoList.forEach(element => { orderInfoList.forEach(element => {
element['info'] = data[element] element['info'] = data[element['name']]
}) })
this.setData({ this.setData({
unpaid: false, unpaid: false,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<view class="pay-container" catchtap="handleHiddenKey"> <view class="pay-container" catchtap="handleHiddenKey">
<view class="pay-header payCompanyInfo"> <view class="pay-header payCompanyInfo">
<!-- <view class=""> --> <!-- <view class=""> -->
<cover-image class="shopIcon" src="../../../images/shopIcon.png" /> <image class="shopIcon" src="../../../images/shopIcon.png" />
<view class="company"> <view class="company">
<view class="company-name">深圳市嘀加智慧云服务有限公司</view> <view class="company-name">深圳市嘀加智慧云服务有限公司</view>
<view class="company-yqd">{{merchantName}}</view> <view class="company-yqd">{{merchantName}}</view>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<!-- </view> --> <!-- </view> -->
</view> </view>
<view class="pay-main"> <view class="pay-main">
<view class="pay-money-title">付款金额</view> <!-- <view class="pay-money-title">付款金额</view> -->
<view class="pay-input-wrapper" catchtap="handleShowKey"> <view class="pay-input-wrapper" catchtap="handleShowKey">
<!-- <text class="pay-icon">¥</text> --> <!-- <text class="pay-icon">¥</text> -->
<text class="pay-icon">金额</text> <text class="pay-icon">金额</text>
...@@ -45,9 +45,9 @@ ...@@ -45,9 +45,9 @@
data-key="X" data-key="X"
catchtap="handleKey"> catchtap="handleKey">
<!-- X --> <!-- X -->
<cover-image class="deletIcon" src="../../../images/deleteIcon.png" /> <image class="deletIcon" src="../../../images/deleteIcon.png" />
</view> </view>
<view class="key pay_btn {{payMoney ? '' : 'pay-btn-display'}}" hover-class="pay-btn-hover" catchtap="handlePay"> <view class="key pay_btn {{payMoney&&canPay ? '' : 'pay-btn-display'}}" hover-class="pay-btn-hover" catchtap="handlePay">
付款 付款
</view> </view>
</view> </view>
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<view class="success-Container"> <view class="success-Container">
<view class="amountOfMoney">¥ {{payMoney}}</view> <view class="amountOfMoney">¥ {{payMoney}}</view>
<view class="success-tips"> <view class="success-tips">
<cover-image class="successIcon" src="../../../images/successIcon.png" /> <image class="successIcon" src="../../../images/successIcon.png" />
支付成功 支付成功
</view> </view>
<view class="line" /> <view class="line" />
...@@ -71,21 +71,17 @@ ...@@ -71,21 +71,17 @@
<view class="label">商户名称</view> <view class="label">商户名称</view>
<view class="info">{{merchantName}}</view> <view class="info">{{merchantName}}</view>
</view> </view>
<view class="orderInfo"> <!-- <view class="orderInfo">
<view class="label">交易参考号</view> <view class="label">交易参考号</view>
<view class="info">{{outTradeNo}}</view> <view class="info">{{outTradeNo}}</view>
</view> </view> -->
<block <block wx:for="{{orderInfoList}}" wx:for-item="item" wx:key="index">
wx:if="{{showOrderInfo}}" <view class="orderInfo" wx:if="{{item.info}}">
wx:for="{{orderInfoList}}"
wx:for-item="item"
wx:key="index">
<view class="orderInfo">
<view class="label">{{item.label}}</view> <view class="label">{{item.label}}</view>
<view class="info">{{item.info}}</view> <view class="info">{{item.info}}</view>
</view> </view>
</block> </block>
<cover-image class="logoIcon" src="../../../images/djLogin.png" /> <image class="logoIcon" src="../../../images/djLogin.png" />
</view> </view>
</view> </view>
<!-- <navigator open-type="exit" target="miniProgram">退出小程序</navigator> --> <!-- <navigator open-type="exit" target="miniProgram">退出小程序</navigator> -->
......
// env:dev 现在用上面的 // env:dev 现在用上面的
// const domain = 'http://192.168.3.181:9182' // const domain = 'http://192.168.3.181:9182'
const domain = 'https://dj.dev.glsx.com.cn' // const domain = 'https://dj.dev.glsx.com.cn'
// env:uat // env:uat
// const domain = 'https://dj.test.glsx.com.cn' const domain = 'https://dj.test.glsx.com.cn'
// env:prod // env:prod
// const domain = 'https://dj.glsx.com.cn' // const domain = 'https://dj.glsx.com.cn'
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!