Browse Source

添加订单支付

v1
前端-胡立永 6 months ago
parent
commit
98b8395339
4 changed files with 49 additions and 33 deletions
  1. +1
    -1
      api/api.js
  2. +3
    -2
      config.js
  3. +7
    -3
      pages/center/center.vue
  4. +38
    -27
      pages/payment/payment.vue

+ 1
- 1
api/api.js View File

@ -10,7 +10,7 @@ const config = {
// 获取个人信息接口
infoGetInfo: { url: '/cheer/info/getInfo', method: 'GET', auth: true },
//下单
createOrderPay: { url: '/cheer/info/createOrderPay', method: 'GET', auth: true },
createOrderPay: { url: '/cheer/info/createOrderPay', method: 'GET', auth: true, limit : 2000 },
//获取折扣、客户电话、微信
getConfig: { url: '/cheer/info/getConfig', method: 'GET'},
//获取充值套餐


+ 3
- 2
config.js View File

@ -13,10 +13,11 @@ const type = 'dev'
// 环境配置
const config = {
dev : {
baseUrl : 'http://8.138.162.67:8000/a-notice-api',
// baseUrl : 'http://8.138.162.67:8000/a-notice-api',
baseUrl : 'http://h5.xzaiyp.top/a-notice-api',
},
prod : {
baseUrl : 'http://xxx.xxx.xxx/xxx',
baseUrl : 'http://admin.anqi.shop/a-notice-api',
}
}


+ 7
- 3
pages/center/center.vue View File

@ -64,7 +64,8 @@
pageNo: 1,
pageSize: 10
},
orderList: []
orderList: [],
total : 0
}
},
onShow() {
@ -75,14 +76,17 @@
},
//
onReachBottom() {
this.queryParams.pageSize += 10
this.getOrderList()
if(this.queryParams.pageSize < this.total){
this.queryParams.pageSize += 10
this.getOrderList()
}
},
methods: {
//
getOrderList() {
this.$api('getOrderWaterPage', this.queryParams, res => {
this.orderList = res.result.records
this.total = res.result.total
})
},
}


+ 38
- 27
pages/payment/payment.vue View File

@ -21,10 +21,10 @@
<view v-if="form.money" class="tip">
折后共计{{
form.money *
(form.money *
(configList.preferential ?
configList.preferential.keyCentent
: 1)
: 1)).toFixed(2)
}}
</view>
<view class="select-money">
@ -87,6 +87,16 @@
this.$refs.showPrivacy.init(resolve)
})
}
// wx.getPrivacySetting({
// success: res => {
// console.log(res)
// if (res.needAuthorization) {
// //
// this.$refs.showPrivacy.init()
// }
// },
// fail: () => {}
// })
this.getRechargePage()
},
methods: {
@ -118,33 +128,34 @@
})
}
this.$api('createOrderPay', this.form, res => {
this.form.money = ''
if(res.code == 200){
// uni.requestPayment({
// provider: 'wxpay', //
// timeStamp: res.weChatPayData.timestamp, //
// nonceStr: res.weChatPayData.noncestr, //
// package: res.weChatPayData.package,
// signType: res.weChatPayData.signtype, //
// paySign: res.weChatPayData.sign, //
// success: function (res) {
// console.log('',res);
// uni.redirectTo({
// url: '/pages/center/center'
// })
// },
// fail: function (err) {
// console.log('',err);
// uni.showToast({
// icon:'none',
// title:""
// })
// }
// });
uni.showToast({
icon : 'none',
title: '支付成功'
uni.requestPayment({
provider: 'wxpay', //
timeStamp: res.result.timeStamp, //
nonceStr: res.result.nonceStr, //
package: res.result.packageValue,
signType: res.result.signType, //
paySign: res.result.paySign, //
success: function (res) {
console.log('支付成功',res);
uni.switchTab({
url: '/pages/center/center'
})
},
fail: function (err) {
console.log('支付失败',err);
uni.showToast({
icon:'none',
title:"支付失败"
})
}
});
// uni.showToast({
// icon : 'none',
// title: ''
// });
}
})
},


Loading…
Cancel
Save