|
@@ -1,5 +1,7 @@
|
|
|
import recordSource from '../../utils/recordSource';
|
|
|
-const getReq = require('../../config.js').getReq
|
|
|
+const config = require('../../config.js')
|
|
|
+const getReq = config.getReq
|
|
|
+const buyVGoods = config.buyVGoods
|
|
|
|
|
|
let app = getApp();
|
|
|
Page({
|
|
@@ -17,26 +19,10 @@ Page({
|
|
|
card_no: '', //油卡号
|
|
|
firstLoad: true,
|
|
|
tabsData: [
|
|
|
- { id: 0, icon: '/image/postage/sinopec.png', title: '中国石化', tips: '选择油卡:(一人最多十张油卡)', card_no: '15853434113521' },
|
|
|
- { id: 1, icon: '/image/postage/petrochina.png', title: '中国石油', tips: '选择油卡:(一人最多八张油卡)', card_no: '41865461251351' }
|
|
|
+ { id: 0, icon: '/image/postage/sinopec.png', title: '中国石化', tips: '选择油卡(一人最多十张油卡)', card_no: '15853434113521' },
|
|
|
+ { id: 1, icon: '/image/postage/petrochina.png', title: '中国石油', tips: '选择油卡(一人最多八张油卡)', card_no: '41865461251351' }
|
|
|
],
|
|
|
-// <<<<<<< HEAD
|
|
|
-// selectArray: [{
|
|
|
-// "id": "10",
|
|
|
-// "text": "9066666888"
|
|
|
-// }, {
|
|
|
-// "id": "21",
|
|
|
-// "text": "25288888556"
|
|
|
-// }],
|
|
|
-// gearData: [
|
|
|
-// { faceValue: 100, price: 95 },
|
|
|
-// { faceValue: 200, price: 190 },
|
|
|
-// { faceValue: 500, price: 475 },
|
|
|
-// { faceValue: 1000, price: 950 }
|
|
|
-// ]
|
|
|
-// =======
|
|
|
fromSource: ''
|
|
|
-// >>>>>>> 259bb9c31cb59d1d11de38b7b18920184eefb6c9
|
|
|
},
|
|
|
|
|
|
// 页签切换
|
|
@@ -105,68 +91,17 @@ Page({
|
|
|
|
|
|
// 立即充值
|
|
|
handlerRecharge(){
|
|
|
- wx.showToast({
|
|
|
- icon: 'none',
|
|
|
- title: `goods_id: ${this.data.goods_id}, card_no: ${this.data.card_no}`,
|
|
|
- duration: 2000
|
|
|
- })
|
|
|
+ // wx.showToast({
|
|
|
+ // icon: 'none',
|
|
|
+ // title: `goods_id: ${this.data.goods_id}, card_no: ${this.data.card_no}`,
|
|
|
+ // duration: 2000
|
|
|
+ // })
|
|
|
console.table({'goods_id': this.data.goods_id, 'card_no': this.data.card_no})
|
|
|
|
|
|
- this.toPay()
|
|
|
- },
|
|
|
-
|
|
|
- toPay() {
|
|
|
- let goods_id = this.data.goods_id
|
|
|
- let goods_num = 1
|
|
|
- let iscart = this.data.ifcart
|
|
|
- let cart_id = this.data.cart_id
|
|
|
-
|
|
|
- let ifcart = cart_id ? 1 : 0
|
|
|
- let cartids = cart_id ? cart_id : (goods_id + '|' + goods_num)
|
|
|
- let params = {
|
|
|
- act: 'member_buy',
|
|
|
- op: 'step_vsecond',
|
|
|
- payment: 'minipay',
|
|
|
- usebonus: 1,
|
|
|
- ifcart:1,
|
|
|
- cart_id: 1,
|
|
|
- invoice_id: 0
|
|
|
- }
|
|
|
- params = Object.assign({}, params);
|
|
|
- getReq(params, function (res) {
|
|
|
- wx.hideLoading()
|
|
|
- if (res.code == 200) {
|
|
|
- let param = res.datas.param.data
|
|
|
- let pay_sn = res.datas.pay_sn
|
|
|
- wx.requestPayment({
|
|
|
- timeStamp: param.timeStamp, //时间戳,自1970年以来的秒数
|
|
|
- nonceStr: param.nonceStr, //随机串
|
|
|
- package: param.package,
|
|
|
- signType: param.signType, //微信签名方式:
|
|
|
- paySign: param.paySign, //微信签名
|
|
|
- success: function (res) {
|
|
|
- wx.reLaunch({
|
|
|
- url: "/pages/index/index"
|
|
|
- })
|
|
|
- },
|
|
|
- fail: function (res) {
|
|
|
- // wx.redirectTo({
|
|
|
- // url: `/pages/orderPaySn/orderPaySn?pay_sn=${pay_sn}`
|
|
|
- // })
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- else {
|
|
|
- wx.showToast({
|
|
|
- icon: 'none',
|
|
|
- title: res.message,
|
|
|
- duration: 2000
|
|
|
- })
|
|
|
- app.globalData.fcodeErr = res.message
|
|
|
- setTimeout(() => {
|
|
|
- wx.navigateBack()
|
|
|
- }, 2000);
|
|
|
- }
|
|
|
+ buyVGoods(this.data.goods_id,1,{ card_no: this.data.card_no }, (res) => {
|
|
|
+ // console.log('res',res) 成功回调
|
|
|
+ }, (err) => {
|
|
|
+ // 失败回调
|
|
|
})
|
|
|
},
|
|
|
|