1.修改肯德基接口对接

yj-dev
杨杰 3 years ago
parent 393897a68a
commit fa2371bdf4
  1. 4
      Utils/Api.js
  2. 119
      pages/qianZhuPay/qianZhuPay.vue
  3. 24
      pages/tabBar/home/home.vue
  4. 33
      pages/tabBar/order/order.vue
  5. BIN
      static/img/banner.jpg
  6. BIN
      static/img/banner2.png
  7. BIN
      static/img/banner3.png
  8. BIN
      static/img/tc.png

@ -157,6 +157,10 @@ export const getTPigCinemaToken = params => {
return POST('GET', `${base}/tPig/getTPigCinemaToken`, params).then(res => res.data);
}
export const qzOrderToPay = params => {
return POST('POST', `${base}/order/qzOrderToPay`, params).then(res => res.data);
}
/**
* H5 获取用户信息
*/

@ -5,17 +5,132 @@
</template>
<script>
import {
qzOrderToPay
} from '../../Utils/Api.js'
let app = getApp();
// #ifdef H5
var jweixin = require('jweixin-module');
// #endif
export default {
data() {
return {
orderNo : '',
source : ''
}
},
onLoad(options) {
console.log('========'+JSON.stringify(options))
this.orderNo = options.orderNo;
this.source = options.source;
this.orderToPay();
},
methods: {
//
orderToPay() {
let that = this;
let params = {
"orderNo": that.orderNo,
"openId": app.globalData.openId,
"source": that.source
}
qzOrderToPay(params).then(res => {
if (res.return_code == '000000') {
// #ifdef MP
uni.showLoading({
title: '支付中...'
})
uni.requestPayment({
"appId": res.return_data.appId,
"nonceStr": res.return_data.nonceStr,
"package": res.return_data.package,
"paySign": res.return_data.sign,
"signType": "MD5",
"timeStamp": res.return_data.timeStamp,
success: function(res) {
uni.hideLoading();
uni.showToast({
title: '支付成功'
})
uni.reLaunch({
url: '../success/success?id=' + that.couponId
});
},
fail: function(err) {
uni.hideLoading();
},
});
// #endif
//
// #ifdef H5
//
that.payRequest(res);
// #endif
} else {
uni.showToast({
title: res.return_msg,
icon: 'none'
})
}
})
},
payRequest: function(self) {
uni.showLoading({
title: '支付中...'
})
jweixin.config({
// debug: false, // ,apialertpclogpc
appId: self.return_data.appId, //
timestamp: self.return_data.timeStamp, //
nonceStr: self.return_data.nonceStr, //
signature: self.return_data.sign, // 1
jsApiList: ['chooseWXPay'] // 使JSJS2
});
uni.hideLoading();
jweixin.ready(function() {
jweixin.checkJsApi({
jsApiList: ['chooseWXPay'], // JSJS2,
success: function(res) {
},
fail: function(res) {
}
});
jweixin.chooseWXPay({
appId: self.return_data.appId,
timestamp: self.return_data.timeStamp, // jssdk使timestamp使timeStampS
nonceStr: self.return_data.nonceStr, // 32
package: self.return_data.package, // prepay_idprepay_id=***
signType: 'MD5', // 'SHA1'使'MD5'
paySign: self.return_data.sign, //
success: function(res) {
//
uni.showToast({
title: '支付成功'
})
uni.reLaunch({
url: '../success/success?id=' + that.couponId
});
},
cancel: function(r) {
},
fail: function(res) {
}
});
});
jweixin.error(function(res) {
uni.showToast({
icon: 'none',
title: '支付失败了',
duration: 4000
});
// configerrorconfigdebugresSPA
/*alert("config信息验证失败");*/
});
},
}
}
</script>

@ -9,7 +9,8 @@
<!-- 定位城市 -->
<view class="addr" @click="goPostion">
<!-- <view class="icon location"></view> -->
{{ city }} <image mode="widthFix" style="width: 15px;" src="../../../static/img/jt.png"></image>
{{ city }}
<image mode="widthFix" style="width: 15px;" src="../../../static/img/jt.png"></image>
</view>
<!-- 搜索框 -->
<view class="input-box">
@ -74,7 +75,8 @@
</view>
<!-- v-if="goldproductList&&goldproductList.length>0" -->
<swiper class="orange-content" :display-multiple-items="goldproductListleg" next-margin="50rpx">
<swiper-item class="swiper-hed" v-for="(item,index) in goldproductList" :key="index" @click="toGoods(item.id)">
<swiper-item class="swiper-hed" v-for="(item,index) in goldproductList" :key="index"
@click="toGoods(item.id)">
<view class="swiper-item" :data-id="item.id">
<image class="img" :src="imageUrl+item.couponImg" mode="aspectFit"></image>
<view class="fotct fcor333 font14 text1 mart10">{{item.couponName}}</view>
@ -525,26 +527,12 @@
url: item.src
})
} else if (item.name == '肯德基') {
let params = {
userId : app.globalData.userInfo.id
}
getTPigKFCToken(params).then(res => {
if (res.return_code == '000000') {
uni.navigateTo({
url: '/pages/tabBar/order/order?id='+res.return_data
})
}
url: '/pages/tabBar/order/order?id=1'
})
} else if (item.name == '电影票') {
let params = {
userId : app.globalData.userInfo.id
}
getTPigCinemaToken(params).then(res => {
if (res.return_code == '000000') {
uni.navigateTo({
url: '/pages/tabBar/order/order?id='+res.return_data
})
}
url: '/pages/tabBar/order/order?id=2'
})
} else {
uni.showToast({

@ -5,17 +5,44 @@
</template>
<script>
import {
getTPigKFCToken,
getTPigCinemaToken
} from '../../../Utils/Api.js';
let app = getApp();
export default {
data() {
return {
url:''
url: '',
typeId: ''
}
},
onLoad(options) {
this.url = options.id;
this.typeId = options.id;
this.reqUlr();
},
methods: {
reqUlr() {
if (this.typeId == 1) {
let params = {
userId: app.globalData.userInfo.id
}
getTPigKFCToken(params).then(res => {
if (res.return_code == '000000') {
this.url = res.return_data;
}
})
} else if (this.typeId == 2) {
let params = {
userId: app.globalData.userInfo.id
}
getTPigCinemaToken(params).then(res => {
if (res.return_code == '000000') {
this.url = res.return_data;
}
})
}
}
}
}
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Loading…
Cancel
Save