pipi 4 years ago
parent 1ea4d1e7ca
commit 4a78d7c532

@ -38,6 +38,7 @@
</template>
<script>
import {weixin} from '../../utils/weixin.js'
export default {
data() {
const currentDate = this.getDate({
@ -49,12 +50,17 @@
token: '',
phone: '',
productId: '',
}
},
token: '',
openid: '',
}
},
onLoad() {
const phone_token = uni.getStorageSync('phone_token')
this.info.phone = phone_token.phone
this.token = phone_token.token
let user_info = weixin.getUserInfoCache()
this.openid = user_info.openid
},
methods: {
pay() {
@ -68,7 +74,28 @@
}
this.reqByToken('/api/member/order-add', this.info, r => {
console.log(r)
uni.request({
url: this.baseUrl + '/api/member/order-payment',
method: 'GET',
data: {
token: this.token,
order_id: r.id,
openid: this.openid
},
success: res => {
let payParams = JSON.parse(res.data.jsApiParameters)
payParams.provider = 'wxpay'
payParams.success = result => {
uni.navigateTo({
url: '../active/active'
})
}
payParams.fail = result => {
console.log(result);
}
wx.requestPayment(payParams);
}
})
})
},
bindDateChange: function(e) {

Loading…
Cancel
Save