| @@ -1,6 +1,5 @@ | |||||
| //app.js | //app.js | ||||
| App({ | App({ | ||||
| data: { | data: { | ||||
| appId: '' | appId: '' | ||||
| @@ -19,8 +18,9 @@ App({ | |||||
| code: res.code | code: res.code | ||||
| }, | }, | ||||
| method: 'POST', | method: 'POST', | ||||
| success: function(result) { | |||||
| success: (result)=>{ | |||||
| console.log(result) | console.log(result) | ||||
| this.globalData.openId = result.data.data.openId | |||||
| } | } | ||||
| }) | }) | ||||
| // Http.postResquest('/api/user/login', '登录中', { | // Http.postResquest('/api/user/login', '登录中', { | ||||
| @@ -75,6 +75,7 @@ App({ | |||||
| globalData: { | globalData: { | ||||
| // 当前用户信息 | // 当前用户信息 | ||||
| userInfo: null, | userInfo: null, | ||||
| openId:null, | |||||
| // 当前商场信息 | // 当前商场信息 | ||||
| market: { | market: { | ||||
| name: "陕西大悦城" | name: "陕西大悦城" | ||||
| @@ -1,7 +1,7 @@ | |||||
| { | { | ||||
| "pages": [ | "pages": [ | ||||
| "pages/login/index", | |||||
| "pages/index/index", | "pages/index/index", | ||||
| "pages/login/index", | |||||
| "pages/market/index", | "pages/market/index", | ||||
| "pages/user/index", | "pages/user/index", | ||||
| "pages/coupons/index/index", | "pages/coupons/index/index", | ||||
| @@ -2,16 +2,29 @@ let Http = require('../../../utils/http.js') | |||||
| Page({ | Page({ | ||||
| data: { | data: { | ||||
| list:{} | |||||
| list:{}, | |||||
| openId: getApp().globalData.openId, | |||||
| cuponId:null | |||||
| }, | }, | ||||
| onLoad(e) { | onLoad(e) { | ||||
| console.log(this.data) | |||||
| console.log(e.id) | |||||
| Http.getResquest('/wxCoupon/findById','加载中',{ | Http.getResquest('/wxCoupon/findById','加载中',{ | ||||
| id: e.id | id: e.id | ||||
| },(res)=>{ | },(res)=>{ | ||||
| console.log(res) | |||||
| this.setData({ | this.setData({ | ||||
| list: res.data | |||||
| list: res.data, | |||||
| cuponId:e.id | |||||
| }) | }) | ||||
| }) | }) | ||||
| }, | |||||
| aaa(){ | |||||
| Http.postResquest('/wxOrder/save', '加载中', { | |||||
| couponId: this.data.cuponId, | |||||
| openId: this.data.openId | |||||
| }, (res) => { | |||||
| console.log(res) | |||||
| }) | |||||
| console.log(1) | |||||
| } | } | ||||
| }) | }) | ||||
| @@ -2,4 +2,5 @@ | |||||
| <image src='{{list.coverImg}}'></image> | <image src='{{list.coverImg}}'></image> | ||||
| <text>{{list.subTitle}}</text> | <text>{{list.subTitle}}</text> | ||||
| <text>{{list.title}}</text> | <text>{{list.title}}</text> | ||||
| <button bindtap='aaa'>下单</button> | |||||
| </view> | </view> | ||||
| @@ -107,6 +107,7 @@ Component({ | |||||
| "pageNum":1, | "pageNum":1, | ||||
| "pageSize":10 | "pageSize":10 | ||||
| },(res)=>{ | },(res)=>{ | ||||
| console.log(res) | |||||
| this.setData({ | this.setData({ | ||||
| list:res.data.list | list:res.data.list | ||||
| }) | }) | ||||
| @@ -2,10 +2,6 @@ | |||||
| //获取应用实例 | //获取应用实例 | ||||
| const app = getApp() | const app = getApp() | ||||
| Page({ | Page({ | ||||
| /** | |||||
| * 页面的初始数据 | |||||
| */ | |||||
| data: { | data: { | ||||
| market:app.globalData.market, | market:app.globalData.market, | ||||
| imgUrls: [ | imgUrls: [ | ||||
| @@ -1,4 +1,4 @@ | |||||
| let host = 'https://cinformall.youlane.cn/C'; | |||||
| let host = 'https://ciformall.youlane.cn/C'; | |||||
| let openId="12313213"; | let openId="12313213"; | ||||
| const postResquest = (url, message, postData, doSuccess, doFail) => { | const postResquest = (url, message, postData, doSuccess, doFail) => { | ||||
| let body={...postData}; | let body={...postData}; | ||||