正在显示
22 个修改的文件
包含
437 行增加
和
253 行删除
@@ -32,118 +32,116 @@ App({ | @@ -32,118 +32,116 @@ App({ | ||
32 | } | 32 | } |
33 | } | 33 | } |
34 | }) | 34 | }) |
35 | + }, | ||
35 | 36 | ||
36 | 37 | ||
37 | - //自动更新版本 | ||
38 | - const updateManager = wx.getUpdateManager() | ||
39 | - updateManager.onCheckForUpdate(function (res) { | ||
40 | - // 请求完新版本信息的回调 | ||
41 | - }) | ||
42 | - | ||
43 | - updateManager.onUpdateReady(function () { | ||
44 | - wx.showModal({ | ||
45 | - title: '更新提示', | ||
46 | - content: '新版本已经准备好,是否重启应用?', | ||
47 | - success: function (res) { | ||
48 | - if (res.confirm) { | ||
49 | - // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 | ||
50 | - updateManager.applyUpdate() | ||
51 | - } | ||
52 | - } | ||
53 | - }) | ||
54 | 38 | ||
55 | - }) | ||
56 | 39 | ||
57 | - updateManager.onUpdateFailed(function () { | ||
58 | - // 新的版本下载失败 | ||
59 | - wx.showModal({ | ||
60 | - title: '更新提示', | ||
61 | - content: '新版本下载失败', | ||
62 | - showCancel: false | ||
63 | - }) | ||
64 | - }) | ||
65 | - }, | ||
66 | - | ||
67 | - /** | ||
68 | -* 自定义post函数,返回Promise | ||
69 | -* +------------------- | ||
70 | -* @param {String} url 接口网址 | ||
71 | -* @param {arrayObject} data 要传的数组对象 like: {name: 'name', age: 32} | ||
72 | -* +------------------- | ||
73 | -* @return {Promise} promise 返回promise供后续操作 | ||
74 | -*/ | ||
75 | - // url:接口地址 data:接口数据 header:请求头 | ||
76 | post: function (url, data, headerParams) { | 40 | post: function (url, data, headerParams) { |
41 | + /** | ||
42 | + * 自定义post函数,返回Promise | ||
43 | + * +------------------- | ||
44 | + * @param {String} url 接口网址 | ||
45 | + * @param {arrayObject} data 要传的数组对象 like: {name: 'name', age: 32} | ||
46 | + * +------------------- | ||
47 | + * @return {Promise} promise 返回promise供后续操作 | ||
48 | + */ | ||
49 | + // wx.showLoading({ | ||
50 | + // title: '加载中', | ||
51 | + // }) | ||
77 | wx.showNavigationBarLoading() | 52 | wx.showNavigationBarLoading() |
78 | wx.showLoading({ | 53 | wx.showLoading({ |
79 | title: '加载中', | 54 | title: '加载中', |
80 | }) | 55 | }) |
81 | var promise = new Promise((resolve, reject) => { | 56 | var promise = new Promise((resolve, reject) => { |
57 | + //init | ||
82 | let that = this; | 58 | let that = this; |
83 | let postData = data; | 59 | let postData = data; |
84 | let baseUrl = 'http://grouppay.w.bronet.cn/api/'; | 60 | let baseUrl = 'http://grouppay.w.bronet.cn/api/'; |
61 | + // let baseUrl = 'http://192.168.1.15/public'; | ||
62 | + // postData.signature = that.makeSign(postData); | ||
85 | //网络请求 | 63 | //网络请求 |
86 | let header = { | 64 | let header = { |
87 | - 'content-type': 'application/x-www-form-urlencoded', | ||
88 | - 'XX-Token': '123123' | 65 | + 'content-type': 'application/x-www-form-urlencoded' |
89 | } | 66 | } |
90 | - // console.log(baseUrl/ + url) | ||
91 | header = Object.assign(header, headerParams) | 67 | header = Object.assign(header, headerParams) |
92 | wx.request({ | 68 | wx.request({ |
93 | url: baseUrl + url, | 69 | url: baseUrl + url, |
94 | data: postData, | 70 | data: postData, |
95 | method: 'POST', | 71 | method: 'POST', |
96 | header: header, | 72 | header: header, |
97 | - success: function (res) { //返回取得的数据 | ||
98 | - // console.log(res) | 73 | + success: function (res) {//返回取得的数据 |
99 | if (res.data.code == '20000') { | 74 | if (res.data.code == '20000') { |
100 | - resolve(res.data); | ||
101 | - } else if (res.data.code == '10001') {//用户未 | ||
102 | - | ||
103 | - } else if (res.data.code == '40000') { | ||
104 | - wx.showModal({ | ||
105 | - title: '提示', | ||
106 | - content: res.data.msg, | ||
107 | - | ||
108 | - showCancel: false, | ||
109 | - success: function (res) { | ||
110 | - } | 75 | + resolve(res.data.data); |
76 | + } else if(res.data.code == '30000') { | ||
77 | + resolve(res.data.data); | ||
78 | + } else if (res.data.code == '40000') {//返回错误提示信息 | ||
79 | + wx.showToast({ | ||
80 | + title: res.data.msg, | ||
81 | + icon: 'none' | ||
111 | }) | 82 | }) |
112 | - } else if (res.data.code == '40005') { | 83 | + } else if (res.data.code == '40001') {//返回错误提示信息 |
113 | wx.showModal({ | 84 | wx.showModal({ |
114 | title: '提示', | 85 | title: '提示', |
115 | - content: res.data.msg, | 86 | + content: '登录已过期请重新登录!', |
116 | showCancel: false, | 87 | showCancel: false, |
117 | success: function (res) { | 88 | success: function (res) { |
118 | - | 89 | + if (res.confirm) { |
90 | + wx.removeStorageSync('token'); | ||
91 | + wx.navigateTo({ | ||
92 | + // url: '/pages/startRecord/startRecord', | ||
93 | + }) | ||
94 | + } | ||
119 | } | 95 | } |
120 | }) | 96 | }) |
121 | - } else if (res.data.code == '40006') { | ||
122 | - | 97 | + } else if (res.data.code == '40002') { |
98 | + console.log(res) | ||
99 | + // wx.showModal({ | ||
100 | + // title: '提示', | ||
101 | + // // content: res.data.msg, | ||
102 | + // showCancel: false, | ||
103 | + // success: function (res) { } | ||
104 | + // }) | ||
105 | + } else if (res.data.code == '40003') { | ||
106 | + // 初始化用户信息判断 | ||
107 | + let usetrInfoType = { | ||
108 | + hasUserInfo: false | ||
109 | + } | ||
110 | + resolve(usetrInfoType); | ||
111 | + // wx.showModal({ | ||
112 | + // title: '提示', | ||
113 | + // content: res.data.msg, | ||
114 | + // showCancel: false | ||
115 | + // }) | ||
123 | } else { | 116 | } else { |
124 | - wx.showModal({ | ||
125 | - title: '提示', | ||
126 | - content: res.data.msg, | ||
127 | - showCancel: false, | ||
128 | - }) | 117 | + console.log(res) |
118 | + // wx.showModal({ | ||
119 | + // title: '提示', | ||
120 | + // // content: res.data.msg, | ||
121 | + // showCancel: false | ||
122 | + // }) | ||
129 | reject(res.data) | 123 | reject(res.data) |
130 | } | 124 | } |
125 | + setTimeout(function () { | ||
131 | wx.hideLoading() | 126 | wx.hideLoading() |
132 | wx.hideNavigationBarLoading() | 127 | wx.hideNavigationBarLoading() |
128 | + }, 600) | ||
133 | }, | 129 | }, |
134 | fail: function (e) { | 130 | fail: function (e) { |
135 | - console.log(e) | ||
136 | reject('网络出错'); | 131 | reject('网络出错'); |
137 | // wx.hideLoading() | 132 | // wx.hideLoading() |
138 | wx.hideNavigationBarLoading() | 133 | wx.hideNavigationBarLoading() |
139 | } | 134 | } |
140 | }) | 135 | }) |
141 | }); | 136 | }); |
142 | - | ||
143 | return promise; | 137 | return promise; |
144 | }, | 138 | }, |
145 | 139 | ||
140 | + | ||
141 | + | ||
146 | globalData: { | 142 | globalData: { |
147 | - userInfo: null | 143 | + userInfo: null, |
144 | + baseUrl: '../../img/', | ||
145 | + artid: null | ||
148 | } | 146 | } |
149 | }) | 147 | }) |
@@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
18 | "window": { | 18 | "window": { |
19 | "backgroundTextStyle": "light", | 19 | "backgroundTextStyle": "light", |
20 | "navigationBarBackgroundColor": "#fff", | 20 | "navigationBarBackgroundColor": "#fff", |
21 | - "navigationBarTitleText": "WeChat", | 21 | + "navigationBarTitleText": "团购商城", |
22 | "navigationBarTextStyle": "black" | 22 | "navigationBarTextStyle": "black" |
23 | }, | 23 | }, |
24 | "tabBar": { | 24 | "tabBar": { |
不能预览此文件类型
img/join.png
已删除
100644 → 0
992.8 KB
img/蒙版组 33.png
已删除
100644 → 0
191.8 KB
1 | // pages/homeindex/homeindex.js | 1 | // pages/homeindex/homeindex.js |
2 | -const app=getApp() | 2 | +const app = getApp() |
3 | Page({ | 3 | Page({ |
4 | 4 | ||
5 | /** | 5 | /** |
6 | * 页面的初始数据 | 6 | * 页面的初始数据 |
7 | */ | 7 | */ |
8 | data: { | 8 | data: { |
9 | - url:'' | 9 | + banner: [], |
10 | + shop_class: [], | ||
11 | + middle:'', | ||
12 | + shop:[] | ||
10 | }, | 13 | }, |
14 | + // 跳转页面 | ||
15 | + btn_name() { | ||
16 | + wx.navigateTo({ | ||
17 | + url: '/pages/homeindex/search/search', | ||
18 | + }) | ||
19 | + }, | ||
20 | + get_info() { | ||
21 | + let that = this | ||
22 | + let url = app.interface.index; | ||
23 | + let header = { | ||
24 | + 'XX-Device-Type': 'wxapp', | ||
25 | + 'XX-Token': wx.getStorageSync('token') | ||
26 | + } | ||
27 | + | ||
28 | + app.post(url, {}, header).then((res) => { | ||
29 | + console.log(res) | ||
30 | + that.setData({ | ||
31 | + banner: res.data.banner, | ||
32 | + shop_class: res.data.shop_class, | ||
33 | + middle: res.data.middle, | ||
34 | + shop:res.data.shop | ||
35 | + }) | ||
11 | 36 | ||
37 | + }).catch((errMsg) => {}) | ||
38 | + | ||
39 | + }, | ||
12 | /** | 40 | /** |
13 | * 生命周期函数--监听页面加载 | 41 | * 生命周期函数--监听页面加载 |
14 | */ | 42 | */ |
15 | - onLoad: function (options) { | ||
16 | - this.setData({ | ||
17 | - url: app.globalData.baseUrl | ||
18 | - }) | ||
19 | - | ||
20 | - console.log(this.data.url) | 43 | + onLoad: function(options) { |
44 | + let that = this | ||
45 | + that.get_info() | ||
21 | }, | 46 | }, |
22 | 47 | ||
23 | /** | 48 | /** |
24 | * 生命周期函数--监听页面初次渲染完成 | 49 | * 生命周期函数--监听页面初次渲染完成 |
25 | */ | 50 | */ |
26 | - onReady: function () { | 51 | + onReady: function() { |
27 | 52 | ||
28 | }, | 53 | }, |
29 | 54 | ||
30 | /** | 55 | /** |
31 | * 生命周期函数--监听页面显示 | 56 | * 生命周期函数--监听页面显示 |
32 | */ | 57 | */ |
33 | - onShow: function () { | 58 | + onShow: function() { |
34 | 59 | ||
35 | }, | 60 | }, |
36 | 61 | ||
37 | /** | 62 | /** |
38 | * 生命周期函数--监听页面隐藏 | 63 | * 生命周期函数--监听页面隐藏 |
39 | */ | 64 | */ |
40 | - onHide: function () { | 65 | + onHide: function() { |
41 | 66 | ||
42 | }, | 67 | }, |
43 | 68 | ||
44 | /** | 69 | /** |
45 | * 生命周期函数--监听页面卸载 | 70 | * 生命周期函数--监听页面卸载 |
46 | */ | 71 | */ |
47 | - onUnload: function () { | 72 | + onUnload: function() { |
48 | 73 | ||
49 | }, | 74 | }, |
50 | 75 | ||
51 | /** | 76 | /** |
52 | * 页面相关事件处理函数--监听用户下拉动作 | 77 | * 页面相关事件处理函数--监听用户下拉动作 |
53 | */ | 78 | */ |
54 | - onPullDownRefresh: function () { | 79 | + onPullDownRefresh: function() { |
55 | 80 | ||
56 | }, | 81 | }, |
57 | 82 | ||
58 | /** | 83 | /** |
59 | * 页面上拉触底事件的处理函数 | 84 | * 页面上拉触底事件的处理函数 |
60 | */ | 85 | */ |
61 | - onReachBottom: function () { | 86 | + onReachBottom: function() { |
62 | 87 | ||
63 | }, | 88 | }, |
64 | 89 | ||
65 | /** | 90 | /** |
66 | * 用户点击右上角分享 | 91 | * 用户点击右上角分享 |
67 | */ | 92 | */ |
68 | - onShareAppMessage: function () { | 93 | + onShareAppMessage: function() { |
69 | 94 | ||
70 | } | 95 | } |
71 | }) | 96 | }) |
pages/homeindex/homeindex.wxss
已删除
100644 → 0
1 | -/* pages/homeindex/homeindex.wxss */ |
pages/homeindex/search/search.js
0 → 100644
1 | +// pages/homeindex/search/search.js | ||
2 | +const app = getApp() | ||
3 | +Page({ | ||
4 | + | ||
5 | + /** | ||
6 | + * 页面的初始数据 | ||
7 | + */ | ||
8 | + data: { | ||
9 | + recommend: [], | ||
10 | + history: [], | ||
11 | + keyword: '' | ||
12 | + }, | ||
13 | + | ||
14 | + /** | ||
15 | + * 生命周期函数--监听页面加载 | ||
16 | + */ | ||
17 | + onLoad: function (options) { | ||
18 | + let that = this | ||
19 | + that.get_info() | ||
20 | + }, | ||
21 | + get_info() { | ||
22 | + let that = this | ||
23 | + // 接口地址 | ||
24 | + let url = app.interface.history | ||
25 | + let header = { | ||
26 | + 'XX-Device-Type': 'wxapp', | ||
27 | + 'XX-Token': wx.getStorageSync('token') | ||
28 | + } | ||
29 | + | ||
30 | + app.post(url, {},header).then((res) => { | ||
31 | + console.log(res) | ||
32 | + that.setData({ | ||
33 | + recommend: res.data.recommend, | ||
34 | + history: res.data.history | ||
35 | + }) | ||
36 | + | ||
37 | + }).catch((errMsg) => { | ||
38 | + | ||
39 | + }) | ||
40 | + | ||
41 | + }, | ||
42 | + | ||
43 | + // get_info() { | ||
44 | + // let that = this | ||
45 | + // let url = app.interface.index; | ||
46 | + // let header = { | ||
47 | + // 'XX-Device-Type': 'wxapp', | ||
48 | + // 'XX-Token': wx.getStorageSync('token') | ||
49 | + // } | ||
50 | + | ||
51 | + // app.post(url, {}, header).then((res) => { | ||
52 | + // console.log(res) | ||
53 | + // that.setData({ | ||
54 | + // banner: res.data.banner, | ||
55 | + // shop_class: res.data.shop_class, | ||
56 | + // middle: res.data.middle, | ||
57 | + // shop: res.data.shop | ||
58 | + // }) | ||
59 | + | ||
60 | + // }).catch((errMsg) => { }) | ||
61 | + | ||
62 | + // }, | ||
63 | + | ||
64 | + | ||
65 | + | ||
66 | + info(){ | ||
67 | + let that = this | ||
68 | + // 接口地址 | ||
69 | + let url = app.interface.shopPage | ||
70 | + | ||
71 | + app.post(url, { | ||
72 | + page: 1, | ||
73 | + keyword: that.data.keyword | ||
74 | + }).then((res) => { | ||
75 | + console.log(res) | ||
76 | + that.setData({ | ||
77 | + | ||
78 | + }) | ||
79 | + | ||
80 | + }).catch((errMsg) => { | ||
81 | + | ||
82 | + }) | ||
83 | + }, | ||
84 | + /** | ||
85 | + * 生命周期函数--监听页面初次渲染完成 | ||
86 | + */ | ||
87 | + onReady: function () { | ||
88 | + | ||
89 | + }, | ||
90 | + | ||
91 | + /** | ||
92 | + * 生命周期函数--监听页面显示 | ||
93 | + */ | ||
94 | + onShow: function () { | ||
95 | + | ||
96 | + }, | ||
97 | + | ||
98 | + /** | ||
99 | + * 生命周期函数--监听页面隐藏 | ||
100 | + */ | ||
101 | + onHide: function () { | ||
102 | + | ||
103 | + }, | ||
104 | + | ||
105 | + /** | ||
106 | + * 生命周期函数--监听页面卸载 | ||
107 | + */ | ||
108 | + onUnload: function () { | ||
109 | + | ||
110 | + }, | ||
111 | + | ||
112 | + /** | ||
113 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
114 | + */ | ||
115 | + onPullDownRefresh: function () { | ||
116 | + | ||
117 | + }, | ||
118 | + | ||
119 | + /** | ||
120 | + * 页面上拉触底事件的处理函数 | ||
121 | + */ | ||
122 | + onReachBottom: function () { | ||
123 | + | ||
124 | + }, | ||
125 | + | ||
126 | + /** | ||
127 | + * 用户点击右上角分享 | ||
128 | + */ | ||
129 | + onShareAppMessage: function () { | ||
130 | + | ||
131 | + } | ||
132 | +}) |
pages/homeindex/search/search.wxml
0 → 100644
1 | +<!--pages/homeindex/search/search.wxml--> | ||
2 | +<!-- <text>pages/homeindex/search/search.wxml</text> --> | ||
3 | +<view class='search'> | ||
4 | + <view class='search_inp'> | ||
5 | + <input type='text' placeholder='请输入商品名称'></input> | ||
6 | + <image src='../../../img/search.png'></image> | ||
7 | + </view> | ||
8 | + <view class='search_txt' bindtap='info'> | ||
9 | + 搜索 | ||
10 | + </view> | ||
11 | +</view> | ||
12 | +<view class='Popular'> | ||
13 | + <view class='Popular_title'> | ||
14 | + <text>热门搜索</text> | ||
15 | + <image src='../../../img/zuire@3x.png'></image> | ||
16 | + </view> | ||
17 | + <view class='Popular_list' > | ||
18 | + <view class='Popular_item' wx:for='{{recommend}}' wx:key> | ||
19 | + {{recommend[index]}} | ||
20 | + </view> | ||
21 | + | ||
22 | + </view> | ||
23 | + <view class='History'> | ||
24 | + <view class='History_title'>历史搜索</view> | ||
25 | + <view class='History_list'> | ||
26 | + <view class='History_item' wx:for='{{history}}' wx:key>{{history[index]}}</view> | ||
27 | + </view> | ||
28 | + </view> | ||
29 | +</view> |
@@ -4,89 +4,66 @@ const app = getApp() | @@ -4,89 +4,66 @@ const app = getApp() | ||
4 | 4 | ||
5 | Page({ | 5 | Page({ |
6 | data: { | 6 | data: { |
7 | - motto: 'Hello World', | ||
8 | - userInfo: {}, | ||
9 | - hasUserInfo: false, | ||
10 | - canIUse: wx.canIUse('button.open-type.getUserInfo') | ||
11 | - }, | ||
12 | - //事件处理函数 | ||
13 | - bindViewTap: function() { | ||
14 | - wx.navigateTo({ | ||
15 | - url: '../logs/logs' | ||
16 | - }) | 7 | + session_key:'', |
8 | + openid:'' | ||
17 | }, | 9 | }, |
18 | 10 | ||
19 | 11 | ||
20 | - start(e) { | ||
21 | 12 | ||
22 | - let that = this; | ||
23 | - console.log(e) | 13 | + /** |
14 | + * 生命周期函数--监听页面加载 | ||
15 | + */ | ||
16 | + onLoad: function (options) { | ||
17 | + this.getLoginFun(); | ||
18 | + }, | ||
24 | 19 | ||
25 | - // app.globalData.userInfo = e.detail.userInfo | 20 | + // 获取session_key |
21 | + getLoginFun() { | ||
22 | + let that = this; | ||
26 | wx.login({ | 23 | wx.login({ |
27 | - success: (res) => { | ||
28 | - console.log(res) | 24 | + success: function (s) { |
25 | + console.log(s); | ||
29 | 26 | ||
30 | - wx.switchTab({ | ||
31 | - url: '../homeindex/homeindex', | 27 | + let url = 'wxapp/public/getSessionKey'; |
28 | + if (s.code) { | ||
29 | + var code = s.code; | ||
30 | + var param = { | ||
31 | + code: s.code | ||
32 | + } | ||
33 | + app.post(url, param).then((res) => { | ||
34 | + console.log(res); | ||
35 | + that.setData({ | ||
36 | + openid: res.data.openid, | ||
37 | + session_key: res.data.session_key | ||
32 | }) | 38 | }) |
33 | - // let url = '/api/portal/common/getToken '; | ||
34 | - // let params = { | ||
35 | - // code: res.code, | ||
36 | - // user_nickname: e.detail.userInfo.nickName, | ||
37 | - // avatar: e.detail.userInfo.avatarUrl | ||
38 | - // // user_nickname: e.detail.userInfo.nickName, | ||
39 | - // // avatar: e.detail.userInfo.avatarUrl //分享进入的需要此参数 | ||
40 | - // } | ||
41 | - // app.post(url, params).then((res) => { | ||
42 | - // console.log(res) | ||
43 | - // wx.setStorageSync('token', res.token); | ||
44 | - | ||
45 | - // wx.navigateTo({ | ||
46 | - // url: '../mainindex/mainindex', | ||
47 | - // }) | ||
48 | - | ||
49 | - // }).catch((errMsg) => { | ||
50 | - // // console.log(errMsg) | ||
51 | - // }) | 39 | + // res.data = {} |
52 | 40 | ||
41 | + }).catch((errMsg) => { | ||
42 | + console.log(errMsg); | ||
43 | + }) | ||
44 | + } | ||
53 | } | 45 | } |
54 | }); | 46 | }); |
55 | }, | 47 | }, |
56 | - onLoad: function () { | ||
57 | - if (app.globalData.userInfo) { | ||
58 | - this.setData({ | ||
59 | - userInfo: app.globalData.userInfo, | ||
60 | - hasUserInfo: true | ||
61 | - }) | ||
62 | - } else if (this.data.canIUse){ | ||
63 | - // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 | ||
64 | - // 所以此处加入 callback 以防止这种情况 | ||
65 | - app.userInfoReadyCallback = res => { | ||
66 | - this.setData({ | ||
67 | - userInfo: res.userInfo, | ||
68 | - hasUserInfo: true | ||
69 | - }) | 48 | + |
49 | + // 获取用户信息 | ||
50 | + getUserInfo(e) { | ||
51 | + console.log(e); | ||
52 | + let url = "wxapp/public/login"; | ||
53 | + let data = { | ||
54 | + openid: this.data.openid, | ||
55 | + session_key: this.data.session_key, | ||
56 | + encrypted_data: e.detail.encryptedData, | ||
57 | + iv: e.detail.iv, | ||
70 | } | 58 | } |
71 | - } else { | ||
72 | - // 在没有 open-type=getUserInfo 版本的兼容处理 | ||
73 | - wx.getUserInfo({ | ||
74 | - success: res => { | ||
75 | - app.globalData.userInfo = res.userInfo | ||
76 | - this.setData({ | ||
77 | - userInfo: res.userInfo, | ||
78 | - hasUserInfo: true | 59 | + app.post(url, data).then((res) => { |
60 | + console.log(res); | ||
61 | + wx.setStorageSync("token", res.data.token); | ||
62 | + wx.switchTab({ | ||
63 | + url: '../homeindex/homeindex', | ||
79 | }) | 64 | }) |
80 | - } | 65 | + }).catch((err) => { |
66 | + console.log(err); | ||
81 | }) | 67 | }) |
82 | - } | ||
83 | }, | 68 | }, |
84 | - getUserInfo: function(e) { | ||
85 | - console.log(e) | ||
86 | - app.globalData.userInfo = e.detail.userInfo | ||
87 | - this.setData({ | ||
88 | - userInfo: e.detail.userInfo, | ||
89 | - hasUserInfo: true | ||
90 | - }) | ||
91 | - } | ||
92 | }) | 69 | }) |
1 | -<button open-type="getUserInfo" bindgetuserinfo='start' class="begin">启动小程序</button> | 1 | +<view class='box'> |
2 | + <view class='cover'> | ||
3 | + <image src="../../images/aicon_23@2x.png"></image> | ||
4 | + asdlkjhnaisd | ||
5 | + <view class='go'> | ||
6 | + <button open-type='getUserInfo' bindgetuserinfo="getUserInfo">立即启动</button> | ||
7 | + </view> | ||
8 | + </view> | ||
9 | +</view> |
1 | /**index.wxss**/ | 1 | /**index.wxss**/ |
2 | -.userinfo { | ||
3 | - display: flex; | ||
4 | - flex-direction: column; | ||
5 | - align-items: center; | 2 | +.cover{ |
3 | + position: relative; | ||
4 | + height: 100vh; | ||
5 | + overflow:hidden; | ||
6 | } | 6 | } |
7 | - | ||
8 | -.userinfo-avatar { | ||
9 | - width: 128rpx; | ||
10 | - height: 128rpx; | ||
11 | - margin: 20rpx; | ||
12 | - border-radius: 50%; | 7 | +.cover image{ |
8 | + width:100%; | ||
9 | + height:100%; | ||
13 | } | 10 | } |
14 | - | ||
15 | -.userinfo-nickname { | ||
16 | - color: #aaa; | 11 | +.go{ |
12 | + position: absolute; | ||
13 | + bottom:26.41%; | ||
14 | + left:0; | ||
15 | + right: 0; | ||
16 | + margin: auto; | ||
17 | + width:400rpx; | ||
18 | + height:80rpx; | ||
19 | + border-radius:40rpx; | ||
20 | + background: #6EAC3D; | ||
21 | + /* border:1rpx solid #434343; */ | ||
17 | } | 22 | } |
18 | - | ||
19 | -.usermotto { | ||
20 | - margin-top: 200px; | 23 | +.go button{ |
24 | + font-size:30rpx; | ||
25 | + color:#fff; | ||
26 | + text-align: center; | ||
27 | + line-height:80rpx; | ||
28 | + display: block; | ||
29 | + background:none; | ||
21 | } | 30 | } |
@@ -28,7 +28,7 @@ Page({ | @@ -28,7 +28,7 @@ Page({ | ||
28 | goFirm_order1(e){ | 28 | goFirm_order1(e){ |
29 | 29 | ||
30 | wx.navigateTo({ | 30 | wx.navigateTo({ |
31 | - url: '../firm_order1/firm_order1?id=' + e.currentTarget.dataset.id, | 31 | + url: '../firm_order1/firm_order1?id=' + e.currentTarget.dataset.id + "&&num=" + this.data.num, |
32 | }) | 32 | }) |
33 | }, | 33 | }, |
34 | 34 |
1 | // pages/kind/firm_order1/firm_order1.js | 1 | // pages/kind/firm_order1/firm_order1.js |
2 | const app = getApp(); | 2 | const app = getApp(); |
3 | Page({ | 3 | Page({ |
4 | - goFirm_order2: function() { | ||
5 | - wx.navigateTo({ | ||
6 | - url: '../firm_order2/firm_order2', | ||
7 | - }) | 4 | + // 点击立即支付 |
5 | + goFirm_order2: function(e) { | ||
6 | + | ||
8 | }, | 7 | }, |
9 | /** | 8 | /** |
10 | * 页面的初始数据 | 9 | * 页面的初始数据 |
@@ -18,13 +17,15 @@ Page({ | @@ -18,13 +17,15 @@ Page({ | ||
18 | * 生命周期函数--监听页面加载 | 17 | * 生命周期函数--监听页面加载 |
19 | */ | 18 | */ |
20 | onLoad: function(options){ | 19 | onLoad: function(options){ |
20 | + console.log(options.num) | ||
21 | this.setData({ | 21 | this.setData({ |
22 | shop_id:options.id | 22 | shop_id:options.id |
23 | }) | 23 | }) |
24 | console.log(options.id) | 24 | console.log(options.id) |
25 | - this.order() | 25 | + this.order(options.num) |
26 | }, | 26 | }, |
27 | - order(){ | 27 | + // 确认订单1数据 |
28 | + order(num){ | ||
28 | let that = this; | 29 | let that = this; |
29 | let url = "home/index/goods"; | 30 | let url = "home/index/goods"; |
30 | let header = { | 31 | let header = { |
@@ -32,13 +33,13 @@ Page({ | @@ -32,13 +33,13 @@ Page({ | ||
32 | "XX-Device-Type": 'wxapp' | 33 | "XX-Device-Type": 'wxapp' |
33 | } | 34 | } |
34 | let params = { | 35 | let params = { |
35 | - shop_id: that.data.shop_id | ||
36 | - // shop_numb: | 36 | + shop_id: that.data.shop_id, |
37 | + shop_numb:num | ||
37 | } | 38 | } |
38 | app.post(url,params,header).then((res) => { | 39 | app.post(url,params,header).then((res) => { |
39 | console.log(res) | 40 | console.log(res) |
40 | that.setData({ | 41 | that.setData({ |
41 | - order_list:res.shop | 42 | + order_list:res |
42 | }) | 43 | }) |
43 | }).catch((err) => { | 44 | }).catch((err) => { |
44 | console.log(err) | 45 | console.log(err) |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | <view class='name'>{{order_list.name}}</view> | 15 | <view class='name'>{{order_list.name}}</view> |
16 | <view class='phone'>{{order_list.mobile}}</view> | 16 | <view class='phone'>{{order_list.mobile}}</view> |
17 | </view> | 17 | </view> |
18 | - <view class='address'></view> | 18 | + <view class='address'>{{order_list.address}}</view> |
19 | </view> | 19 | </view> |
20 | <image class='o_right' src='../../../img/right_1.png'></image> | 20 | <image class='o_right' src='../../../img/right_1.png'></image> |
21 | </view> | 21 | </view> |
@@ -35,58 +35,20 @@ | @@ -35,58 +35,20 @@ | ||
35 | <view class='goods_detail'> | 35 | <view class='goods_detail'> |
36 | <view class='goods_detail_pic'> | 36 | <view class='goods_detail_pic'> |
37 | <view class='detail_pic2'> | 37 | <view class='detail_pic2'> |
38 | - <image src='../../../img/douyao.png'></image> | 38 | + <image src='{{order_list.shop.thumb}}'></image> |
39 | </view> | 39 | </view> |
40 | - <view class='detail_pic_txt'>距结束2时22分</view> | 40 | + <view class='detail_pic_txt'>{{order_list.shop.end_time}}</view> |
41 | </view> | 41 | </view> |
42 | <view class='detail_txt'> | 42 | <view class='detail_txt'> |
43 | <view class='txt1'> | 43 | <view class='txt1'> |
44 | - <view class='txt1_name'>纯进口有机菜花</view> | ||
45 | - <view class='txt1_price'>¥52.00</view> | 44 | + <view class='txt1_name'>{{order_list.shop.name}}</view> |
45 | + <view class='txt1_price'>¥{{order_list.shop.money_sale}}</view> | ||
46 | </view> | 46 | </view> |
47 | <view class='txt2'> | 47 | <view class='txt2'> |
48 | <progress percent="42" show-info color="#B5DE96" border-radius="8" font-size="24rpx" stroke-width="16rpx" /> | 48 | <progress percent="42" show-info color="#B5DE96" border-radius="8" font-size="24rpx" stroke-width="16rpx" /> |
49 | - <view class='order'>x4</view> | 49 | + <view class='order'>x{{order_list.shop_numb}}</view> |
50 | </view> | 50 | </view> |
51 | - <view class='txt3'>已拼300份,目标500份</view> | ||
52 | - </view> | ||
53 | - </view> | ||
54 | - <view class='goods_detail'> | ||
55 | - <view class='goods_detail_pic'> | ||
56 | - <view class='detail_pic2'> | ||
57 | - <image src='../../../img/douyao.png'></image> | ||
58 | - </view> | ||
59 | - <view class='detail_pic_txt'>距结束2时22分</view> | ||
60 | - </view> | ||
61 | - <view class='detail_txt'> | ||
62 | - <view class='txt1'> | ||
63 | - <view class='txt1_name'>纯进口有机菜花</view> | ||
64 | - <view class='txt1_price'>¥52.00</view> | ||
65 | - </view> | ||
66 | - <view class='txt2'> | ||
67 | - <progress percent="42" show-info color="#B5DE96" border-radius="8" font-size="24rpx" stroke-width="16rpx" /> | ||
68 | - <view class='order'>x4</view> | ||
69 | - </view> | ||
70 | - <view class='txt3'>已拼300份,目标500份</view> | ||
71 | - </view> | ||
72 | - </view> | ||
73 | - <view class='goods_detail'> | ||
74 | - <view class='goods_detail_pic'> | ||
75 | - <view class='detail_pic2'> | ||
76 | - <image src='../../../img/douyao.png'></image> | ||
77 | - </view> | ||
78 | - <view class='detail_pic_txt'>距结束2时22分</view> | ||
79 | - </view> | ||
80 | - <view class='detail_txt'> | ||
81 | - <view class='txt1'> | ||
82 | - <view class='txt1_name'>纯进口有机菜花</view> | ||
83 | - <view class='txt1_price'>¥52.00</view> | ||
84 | - </view> | ||
85 | - <view class='txt2'> | ||
86 | - <progress percent="42" show-info color="#B5DE96" border-radius="8" font-size="24rpx" stroke-width="16rpx" /> | ||
87 | - <view class='order'>x4</view> | ||
88 | - </view> | ||
89 | - <view class='txt3'>已拼300份,目标500份</view> | 51 | + <view class='txt3'>已拼{{order_list.shop.numb}}份,目标{{order_list.shop.group}}份</view> |
90 | </view> | 52 | </view> |
91 | </view> | 53 | </view> |
92 | <!-- 运费 --> | 54 | <!-- 运费 --> |
@@ -98,11 +60,12 @@ | @@ -98,11 +60,12 @@ | ||
98 | <view class='othor'> | 60 | <view class='othor'> |
99 | <view class='othor1'> | 61 | <view class='othor1'> |
100 | <view class='othor1_name'>订单号</view> | 62 | <view class='othor1_name'>订单号</view> |
101 | - <view class='othor1_con'>2019885878957</view> | 63 | + <view class='othor1_con'>{{order_list.goods}}</view> |
102 | </view> | 64 | </view> |
103 | - <view class='othor1'> | 65 | + <view class='othor1 '> |
104 | <view class='othor1_name'>备注信息</view> | 66 | <view class='othor1_name'>备注信息</view> |
105 | - <view class='othor1_con'>尽量下午送货,来时电话联系</view> | 67 | + <textarea maxlength='30' class='othor1_con othor1_con2' placeholder='尽量下午送货,来时电话联系' placeholder-class="placeholderStyle"></textarea> |
68 | + <view ></view> | ||
106 | </view> | 69 | </view> |
107 | </view> | 70 | </view> |
108 | </view> | 71 | </view> |
@@ -111,10 +74,10 @@ | @@ -111,10 +74,10 @@ | ||
111 | </view> | 74 | </view> |
112 | <view class='footer'> | 75 | <view class='footer'> |
113 | <view class='footer_in'> | 76 | <view class='footer_in'> |
114 | - <view class='f_txt1'>共1件商品</view> | 77 | + <view class='f_txt1'>共{{order_list.shop_numb}}件商品</view> |
115 | <view class='f_txt2'>合计: | 78 | <view class='f_txt2'>合计: |
116 | - <text class='f_txt3'>¥52.00</text> | 79 | + <text class='f_txt3'>¥{{order_list.shop_numb*order_list.shop.money_sale}}</text> |
117 | </view> | 80 | </view> |
118 | - <view class='f_btn' bindtap='goFirm_order2'>立即支付</view> | 81 | + <view class='f_btn' bindtap=''>立即支付</view> |
119 | </view> | 82 | </view> |
120 | </view> | 83 | </view> |
@@ -223,7 +223,6 @@ page { | @@ -223,7 +223,6 @@ page { | ||
223 | 223 | ||
224 | .othor1 { | 224 | .othor1 { |
225 | display: flex; | 225 | display: flex; |
226 | - align-items: center; | ||
227 | margin-bottom: 16rpx; | 226 | margin-bottom: 16rpx; |
228 | } | 227 | } |
229 | 228 | ||
@@ -233,15 +232,23 @@ page { | @@ -233,15 +232,23 @@ page { | ||
233 | font-weight: 400; | 232 | font-weight: 400; |
234 | color: rgba(51, 51, 51, 1); | 233 | color: rgba(51, 51, 51, 1); |
235 | } | 234 | } |
236 | - | ||
237 | -.othor1_con { | 235 | +.othor1_con{ |
238 | font-size: 26rpx; | 236 | font-size: 26rpx; |
239 | margin-left: auto; | 237 | margin-left: auto; |
240 | font-family: PingFang SC; | 238 | font-family: PingFang SC; |
241 | font-weight: 400; | 239 | font-weight: 400; |
242 | color: rgba(153, 153, 153, 1); | 240 | color: rgba(153, 153, 153, 1); |
243 | } | 241 | } |
244 | - | 242 | +.othor1_con2{ |
243 | + width:330rpx; | ||
244 | + height:100rpx; | ||
245 | + font-size: 26rpx; | ||
246 | + margin-left: auto; | ||
247 | + font-family: PingFang SC; | ||
248 | + font-weight: 400; | ||
249 | + margin-top:6rpx; | ||
250 | + color: rgba(153, 153, 153, 1); | ||
251 | +} | ||
245 | /* footer */ | 252 | /* footer */ |
246 | 253 | ||
247 | .footer { | 254 | .footer { |
1 | // pages/kind/firm_order2/firm_order2.js | 1 | // pages/kind/firm_order2/firm_order2.js |
2 | +const app = getApp() | ||
2 | Page({ | 3 | Page({ |
3 | - go_success:function(){ | 4 | + go_success: function() { |
4 | wx.navigateTo({ | 5 | wx.navigateTo({ |
5 | url: '../success/success', | 6 | url: '../success/success', |
6 | }) | 7 | }) |
@@ -11,60 +12,72 @@ Page({ | @@ -11,60 +12,72 @@ Page({ | ||
11 | data: { | 12 | data: { |
12 | 13 | ||
13 | }, | 14 | }, |
14 | - | ||
15 | /** | 15 | /** |
16 | * 生命周期函数--监听页面加载 | 16 | * 生命周期函数--监听页面加载 |
17 | */ | 17 | */ |
18 | - onLoad: function (options) { | ||
19 | - | 18 | + onLoad: function(options) { |
19 | + this.orderFun2() | ||
20 | }, | 20 | }, |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * 生命周期函数--监听页面初次渲染完成 | 23 | * 生命周期函数--监听页面初次渲染完成 |
24 | */ | 24 | */ |
25 | - onReady: function () { | 25 | + onReady: function() { |
26 | 26 | ||
27 | }, | 27 | }, |
28 | - | 28 | + orderFun2(shop_id) { |
29 | + let that = this; | ||
30 | + let url = ""; | ||
31 | + let header = { | ||
32 | + "XX-Token": '123123', | ||
33 | + "XX-Device-Type": 'wxapp' | ||
34 | + }; | ||
35 | + let params = { | ||
36 | + shop_id: shop_id | ||
37 | + }; | ||
38 | + app.post(url,params,header).then((res) =>{ | ||
39 | + console.log(res) | ||
40 | + }) | ||
41 | + }, | ||
29 | /** | 42 | /** |
30 | * 生命周期函数--监听页面显示 | 43 | * 生命周期函数--监听页面显示 |
31 | */ | 44 | */ |
32 | - onShow: function () { | 45 | + onShow: function() { |
33 | 46 | ||
34 | }, | 47 | }, |
35 | 48 | ||
36 | /** | 49 | /** |
37 | * 生命周期函数--监听页面隐藏 | 50 | * 生命周期函数--监听页面隐藏 |
38 | */ | 51 | */ |
39 | - onHide: function () { | 52 | + onHide: function() { |
40 | 53 | ||
41 | }, | 54 | }, |
42 | 55 | ||
43 | /** | 56 | /** |
44 | * 生命周期函数--监听页面卸载 | 57 | * 生命周期函数--监听页面卸载 |
45 | */ | 58 | */ |
46 | - onUnload: function () { | 59 | + onUnload: function() { |
47 | 60 | ||
48 | }, | 61 | }, |
49 | 62 | ||
50 | /** | 63 | /** |
51 | * 页面相关事件处理函数--监听用户下拉动作 | 64 | * 页面相关事件处理函数--监听用户下拉动作 |
52 | */ | 65 | */ |
53 | - onPullDownRefresh: function () { | 66 | + onPullDownRefresh: function() { |
54 | 67 | ||
55 | }, | 68 | }, |
56 | 69 | ||
57 | /** | 70 | /** |
58 | * 页面上拉触底事件的处理函数 | 71 | * 页面上拉触底事件的处理函数 |
59 | */ | 72 | */ |
60 | - onReachBottom: function () { | 73 | + onReachBottom: function() { |
61 | 74 | ||
62 | }, | 75 | }, |
63 | 76 | ||
64 | /** | 77 | /** |
65 | * 用户点击右上角分享 | 78 | * 用户点击右上角分享 |
66 | */ | 79 | */ |
67 | - onShareAppMessage: function () { | 80 | + onShareAppMessage: function() { |
68 | 81 | ||
69 | } | 82 | } |
70 | }) | 83 | }) |
1 | // pages/kind/kind.js | 1 | // pages/kind/kind.js |
2 | +const app = getApp() | ||
2 | Page({ | 3 | Page({ |
3 | 4 | ||
4 | /** | 5 | /** |
5 | * 页面的初始数据 | 6 | * 页面的初始数据 |
6 | */ | 7 | */ |
7 | data: { | 8 | data: { |
9 | + class_id: '' | ||
8 | 10 | ||
9 | }, | 11 | }, |
10 | 12 | ||
@@ -12,9 +14,32 @@ Page({ | @@ -12,9 +14,32 @@ Page({ | ||
12 | * 生命周期函数--监听页面加载 | 14 | * 生命周期函数--监听页面加载 |
13 | */ | 15 | */ |
14 | onLoad: function (options) { | 16 | onLoad: function (options) { |
15 | - | 17 | + let that = this |
18 | + that.get_info() | ||
16 | }, | 19 | }, |
20 | + get_info() { | ||
21 | + let that = this | ||
22 | + // 接口地址 | ||
23 | + let url = app.interface.shopClass | ||
24 | + let header = { | ||
25 | + 'XX-Device-Type': 'wxapp', | ||
26 | + 'XX-Token': wx.getStorageSync('token') | ||
27 | + } | ||
28 | + | ||
29 | + let params = { | ||
30 | + class_id: that.data.class_id | ||
31 | + } | ||
32 | + app.post(url, params, header).then((res) => { | ||
33 | + console.log(res) | ||
34 | + that.setData({ | ||
35 | + shop_class: res.data.shop_class, | ||
36 | + shop:res.data.shop | ||
37 | + }) | ||
38 | + | ||
39 | + }).catch((errMsg) => { | ||
17 | 40 | ||
41 | + }) | ||
42 | + }, | ||
18 | /** | 43 | /** |
19 | * 生命周期函数--监听页面初次渲染完成 | 44 | * 生命周期函数--监听页面初次渲染完成 |
20 | */ | 45 | */ |
pages/kind/kind.wxss
已删除
100644 → 0
1 | -/* pages/kind/kind.wxss */ |
@@ -92,13 +92,14 @@ | @@ -92,13 +92,14 @@ | ||
92 | "id": 7, | 92 | "id": 7, |
93 | "name": "商品详情", | 93 | "name": "商品详情", |
94 | "pathName": "pages/kind/detail_1/detail_1", | 94 | "pathName": "pages/kind/detail_1/detail_1", |
95 | - "query": "" | 95 | + "query": "id=1", |
96 | + "scene": null | ||
96 | }, | 97 | }, |
97 | { | 98 | { |
98 | - "id": -1, | 99 | + "id": 8, |
99 | "name": "确认订单", | 100 | "name": "确认订单", |
100 | "pathName": "pages/kind/firm_order1/firm_order1", | 101 | "pathName": "pages/kind/firm_order1/firm_order1", |
101 | - "query": "", | 102 | + "query": "id = 1", |
102 | "scene": null | 103 | "scene": null |
103 | } | 104 | } |
104 | ] | 105 | ] |
-
请 注册 或 登录 后发表评论