diff --git a/config/config.js b/config/config.js index 1df5018..057caac 100755 --- a/config/config.js +++ b/config/config.js @@ -1,7 +1,7 @@ var config = { name: "富茂", - //url: "https://ciformall.youlane.cn/C/api", - url: "http://0da722ce.ngrok.io/C/api", + url: "https://ciformall.youlane.cn/C/api", + //url: "http://d6a6e7e6.ngrok.io/C/api", api: { /** * 接口用途:login diff --git a/pages/coupons/details/index.js b/pages/coupons/details/index.js index d5c1207..671c9bd 100644 --- a/pages/coupons/details/index.js +++ b/pages/coupons/details/index.js @@ -12,18 +12,22 @@ Page({ wx.showLoading({ title: '加载中...', }) - Http.get({ - url: Http.config.api.couponDetail, - data: { - id: e.id - } - }).then(res => { - wx.hideLoading(); - this.setData({ - data: res, - couponId: e.id + if (e.flag == 'pay') { + this.orderFunc(); + } else { + Http.get({ + url: config.api.couponDetail, + data: { + id: e.id + } + }).then(res => { + wx.hideLoading(); + this.setData({ + data: res, + couponId: e.id + }) }) - }) + } }, /** * 支付订单更新 @@ -31,7 +35,7 @@ Page({ payOrderUpdate: (orderId, payOrderId, status, reason) => { // 支付成功 return Http.post({ - url: Http.config.api.payOrderUpdate, + url: config.api.payOrderUpdate, data: { payOrderId: payOrderId, orderId: orderId, @@ -109,7 +113,7 @@ Page({ }) .then(res => { return Http.post({ - url: Http.config.api.orderSave, + url: config.api.orderSave, data: { couponId: that.data.couponId } @@ -119,7 +123,7 @@ Page({ if (err.code == 11005) { // 用户手机未授权 wx.redirectTo({ - url: '../../getphoneInfo/index', + url: '../../getphoneInfo/index?couponId='+that.data.couponId, }) } if (err.code == 11006) { @@ -137,7 +141,7 @@ Page({ if (res.data.payment > 0) { // real pay return Http.post({ - url: Http.config.api.payOrderCreate, + url: config.api.payOrderCreate, data: { orderId: orderId } diff --git a/pages/coupons/index/index.js b/pages/coupons/index/index.js index 6b55ba3..b3783ae 100644 --- a/pages/coupons/index/index.js +++ b/pages/coupons/index/index.js @@ -1,4 +1,5 @@ let format = require('../../../utils/util.js') +let config = require('../../../config/config.js') let app = getApp() const Http = require("../../../utils/HttpBasics") //1535126400000 diff --git a/pages/getphoneInfo/index.js b/pages/getphoneInfo/index.js index 507757d..2bc0537 100755 --- a/pages/getphoneInfo/index.js +++ b/pages/getphoneInfo/index.js @@ -3,10 +3,15 @@ const Http = require("../../utils/HttpBasics"); var app = getApp(); Page({ data: { - canIUse: wx.canIUse('button.open-type.getPhoneNumber') + canIUse: wx.canIUse('button.open-type.getPhoneNumber'), + couponId: null, }, onLoad: function(options) { var that = this; + console.log(options); + that.setData({ + couponId: options.couponId + }) }, getPhoneNumber: function(e) { var that = this; @@ -27,7 +32,7 @@ Page({ icon: "success", success: function(res) { wx.redirectTo({ - url: '../login/login', + url: '../coupons/details/index?id=' + that.data.couponId + "&flag=pay", }) } }) diff --git a/pages/index/coupons/index.js b/pages/index/coupons/index.js index 07cea2a..22c012a 100644 --- a/pages/index/coupons/index.js +++ b/pages/index/coupons/index.js @@ -68,7 +68,7 @@ Component({ ready() { app.couponListCallback = token => { Http.get({ - url: Http.config.api.couponList, + url: config.api.couponList, data: { pageNum: 1, pageSize: 10 diff --git a/pages/order/index/index.js b/pages/order/index/index.js index 46fc481..535e5da 100644 --- a/pages/order/index/index.js +++ b/pages/order/index/index.js @@ -1,3 +1,4 @@ +let config = require('../../../config/config.js') let Http = require('../../../utils/HttpBasics') let app = getApp()