Browse Source

对接支付

master
前端-胡立永 6 months ago
parent
commit
8be9f2b500
6 changed files with 50 additions and 23 deletions
  1. +6
    -6
      api/api.js
  2. +3
    -2
      config.js
  3. +2
    -1
      pages.json
  4. +15
    -9
      pages/center/center.vue
  5. +23
    -4
      pages/contentDetail/contentDetail.vue
  6. +1
    -1
      store/store.js

+ 6
- 6
api/api.js View File

@ -7,17 +7,17 @@ const config = {
// limit : 1000
// },
getConfig : {url : '/api/getConfig', method : 'GET', limit : 500},
getConfig : {url : '/api/getConfig', method : 'GET'},
// 登录接口
loginLogin: { url: '/cheer/login/login', method: 'GET', },
loginLogin: { url: '/pay-api/login/login', method: 'GET', limit : 500},
//获取商品信息
getPayShopOne : {url : '/pay-api/info/getPayShopOne', method : 'GET', limit : 500},
getPayShopOne : {url : '/pay-api/info/getPayShopOne', method : 'GET'},
//创建支付订单
createPayOrder : {url : '/pay-api/info/createPayOrder', method : 'GET', limit : 500},
createPayOrder : {url : '/pay-api/info/createPayOrder', method : 'POST', limit : 2000},
//获取个人信息
getInfo : {url : '/pay-api/info/getInfo', method : 'GET', limit : 500},
getInfo : {url : '/pay-api/info/getInfo', method : 'GET'},
//获取订单列表
getPayOrderPage : {url : '/pay-api/info/getPayOrderPage', method : 'GET', limit : 500},
getPayOrderPage : {url : '/pay-api/info/getPayOrderPage', method : 'GET'},
//修改个人信息
updateInfo : {url : '/pay-api/info/updateInfo', method : 'GET', limit : 500},
}


+ 3
- 2
config.js View File

@ -10,10 +10,11 @@ const type = 'dev'
// 环境配置
const config = {
dev : {
baseUrl : 'http://noticeadmin.augcl.com/a-notice-api/',
// baseUrl : 'http://noticeadmin.augcl.com/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',
}
}


+ 2
- 1
pages.json View File

@ -15,7 +15,8 @@
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录"
"navigationBarTitleText": "登录",
"navigationStyle": "custom"
}
}
],


+ 15
- 9
pages/center/center.vue View File

@ -10,7 +10,9 @@
{{ userInfo.nickName }}
</view>
</view>
<view class="u-top" v-else>
<view class="u-top"
v-else
@click="$utils.navigateTo('/login/login')">
<image class="img"
src="https://img2.baidu.com/it/u=2953585264,744730101&fm=253&fmt=auto&app=138&f=JPEG?w=360&h=360"
mode="widthFix"></image>
@ -64,25 +66,29 @@
pageNo: 1,
pageSize: 10
},
orderList: []
orderList: [],
total : 0
}
},
onShow() {
// if (uni.getStorageSync('token')) {
// this.$store.commit('getUserInfo')
// }
// this.getOrderList()
if (uni.getStorageSync('token')) {
this.$store.commit('getUserInfo')
this.getOrderList()
}
},
//
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.$api('getPayOrderPage', this.queryParams, res => {
this.orderList = res.result.records
this.total = res.result.total
})
},
}


+ 23
- 4
pages/contentDetail/contentDetail.vue View File

@ -101,13 +101,32 @@
//
createPayOrder() {
// if (this.$refs.login.checkLogin()) {
// return
// }
this.registerForm.shopId = this.shopInfo.id
this.$api('createPayOrder', this.registerForm, res => {
console.log(res);
if(res.code == 200){
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:"支付失败"
})
}
});
}
})
}


+ 1
- 1
store/store.js View File

@ -72,7 +72,7 @@ const store = new Vuex.Store({
})
},
getUserInfo(state) {
api('infoGetInfo', res => {
api('getInfo', res => {
if(res.code == 200){
state.userInfo = res.result
}


Loading…
Cancel
Save