@@ -1,7 +1,7 @@ | |||||
var config = { | var config = { | ||||
name: "富茂", | 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: { | api: { | ||||
/** | /** | ||||
* 接口用途:login | * 接口用途:login | ||||
@@ -12,18 +12,22 @@ Page({ | |||||
wx.showLoading({ | wx.showLoading({ | ||||
title: '加载中...', | 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) => { | payOrderUpdate: (orderId, payOrderId, status, reason) => { | ||||
// 支付成功 | // 支付成功 | ||||
return Http.post({ | return Http.post({ | ||||
url: Http.config.api.payOrderUpdate, | |||||
url: config.api.payOrderUpdate, | |||||
data: { | data: { | ||||
payOrderId: payOrderId, | payOrderId: payOrderId, | ||||
orderId: orderId, | orderId: orderId, | ||||
@@ -109,7 +113,7 @@ Page({ | |||||
}) | }) | ||||
.then(res => { | .then(res => { | ||||
return Http.post({ | return Http.post({ | ||||
url: Http.config.api.orderSave, | |||||
url: config.api.orderSave, | |||||
data: { | data: { | ||||
couponId: that.data.couponId | couponId: that.data.couponId | ||||
} | } | ||||
@@ -119,7 +123,7 @@ Page({ | |||||
if (err.code == 11005) { | if (err.code == 11005) { | ||||
// 用户手机未授权 | // 用户手机未授权 | ||||
wx.redirectTo({ | wx.redirectTo({ | ||||
url: '../../getphoneInfo/index', | |||||
url: '../../getphoneInfo/index?couponId='+that.data.couponId, | |||||
}) | }) | ||||
} | } | ||||
if (err.code == 11006) { | if (err.code == 11006) { | ||||
@@ -137,7 +141,7 @@ Page({ | |||||
if (res.data.payment > 0) { | if (res.data.payment > 0) { | ||||
// real pay | // real pay | ||||
return Http.post({ | return Http.post({ | ||||
url: Http.config.api.payOrderCreate, | |||||
url: config.api.payOrderCreate, | |||||
data: { | data: { | ||||
orderId: orderId | orderId: orderId | ||||
} | } | ||||
@@ -1,4 +1,5 @@ | |||||
let format = require('../../../utils/util.js') | let format = require('../../../utils/util.js') | ||||
let config = require('../../../config/config.js') | |||||
let app = getApp() | let app = getApp() | ||||
const Http = require("../../../utils/HttpBasics") | const Http = require("../../../utils/HttpBasics") | ||||
//1535126400000 | //1535126400000 | ||||
@@ -3,10 +3,15 @@ const Http = require("../../utils/HttpBasics"); | |||||
var app = getApp(); | var app = getApp(); | ||||
Page({ | Page({ | ||||
data: { | data: { | ||||
canIUse: wx.canIUse('button.open-type.getPhoneNumber') | |||||
canIUse: wx.canIUse('button.open-type.getPhoneNumber'), | |||||
couponId: null, | |||||
}, | }, | ||||
onLoad: function(options) { | onLoad: function(options) { | ||||
var that = this; | var that = this; | ||||
console.log(options); | |||||
that.setData({ | |||||
couponId: options.couponId | |||||
}) | |||||
}, | }, | ||||
getPhoneNumber: function(e) { | getPhoneNumber: function(e) { | ||||
var that = this; | var that = this; | ||||
@@ -27,7 +32,7 @@ Page({ | |||||
icon: "success", | icon: "success", | ||||
success: function(res) { | success: function(res) { | ||||
wx.redirectTo({ | wx.redirectTo({ | ||||
url: '../login/login', | |||||
url: '../coupons/details/index?id=' + that.data.couponId + "&flag=pay", | |||||
}) | }) | ||||
} | } | ||||
}) | }) | ||||
@@ -68,7 +68,7 @@ Component({ | |||||
ready() { | ready() { | ||||
app.couponListCallback = token => { | app.couponListCallback = token => { | ||||
Http.get({ | Http.get({ | ||||
url: Http.config.api.couponList, | |||||
url: config.api.couponList, | |||||
data: { | data: { | ||||
pageNum: 1, | pageNum: 1, | ||||
pageSize: 10 | pageSize: 10 | ||||
@@ -1,3 +1,4 @@ | |||||
let config = require('../../../config/config.js') | |||||
let Http = require('../../../utils/HttpBasics') | let Http = require('../../../utils/HttpBasics') | ||||
let app = getApp() | let app = getApp() | ||||