正在显示
75 个修改的文件
包含
4827 行增加
和
0 行删除
app.js
0 → 100644
1 | +//app.js | ||
2 | +App({ | ||
3 | + onLaunch: function() { | ||
4 | + // 展示本地存储能力 | ||
5 | + var logs = wx.getStorageSync('logs') || [] | ||
6 | + logs.unshift(Date.now()) | ||
7 | + wx.setStorageSync('logs', logs) | ||
8 | + | ||
9 | + // 登录 | ||
10 | + wx.login({ | ||
11 | + success: res => { | ||
12 | + // 发送 res.code 到后台换取 openId, sessionKey, unionId | ||
13 | + } | ||
14 | + }) | ||
15 | + // 获取用户信息 | ||
16 | + wx.getSetting({ | ||
17 | + success: res => { | ||
18 | + if (res.authSetting['scope.userInfo']) { | ||
19 | + // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框 | ||
20 | + wx.getUserInfo({ | ||
21 | + success: res => { | ||
22 | + // 可以将 res 发送给后台解码出 unionId | ||
23 | + this.globalData.userInfo = res.userInfo | ||
24 | + | ||
25 | + // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 | ||
26 | + // 所以此处加入 callback 以防止这种情况 | ||
27 | + if (this.userInfoReadyCallback) { | ||
28 | + this.userInfoReadyCallback(res) | ||
29 | + } | ||
30 | + } | ||
31 | + }) | ||
32 | + } | ||
33 | + } | ||
34 | + }) | ||
35 | + }, | ||
36 | + | ||
37 | + //封装公共接口 | ||
38 | + | ||
39 | + post: function(url, data, headerParams) { | ||
40 | + wx.showNavigationBarLoading() | ||
41 | + var promise = new Promise((resolve, reject) => { | ||
42 | + //init | ||
43 | + let that = this; | ||
44 | + let postData = data; | ||
45 | + let baseUrl = 'https://buygive.w.broing.cn/api/'; | ||
46 | + //网络请求 | ||
47 | + let header = { | ||
48 | + // 'XX-Device-Type': 'wxapp', | ||
49 | + 'token': wx.getStorageSync("token") || '' | ||
50 | + } | ||
51 | + header = Object.assign(header, headerParams) | ||
52 | + //网络请求 | ||
53 | + wx.request({ | ||
54 | + url: baseUrl + url, | ||
55 | + data: postData, | ||
56 | + method: headerParams, | ||
57 | + header: header, | ||
58 | + success: function(res) { //返回取得的数据 | ||
59 | + if (res.data.code == '1') { | ||
60 | + resolve(res.data.data); | ||
61 | + } else { | ||
62 | + | ||
63 | + reject(res.data) | ||
64 | + } | ||
65 | + | ||
66 | + }, | ||
67 | + fail: function(e) { | ||
68 | + reject('网络出错'); | ||
69 | + // wx.hideLoading() | ||
70 | + wx.hideNavigationBarLoading() | ||
71 | + }, | ||
72 | + complete: function() { | ||
73 | + wx.hideNavigationBarLoading() | ||
74 | + }, | ||
75 | + }) | ||
76 | + }); | ||
77 | + return promise; | ||
78 | + }, | ||
79 | + | ||
80 | + //上传图片 | ||
81 | + // upload(filetype, file) { | ||
82 | + // let token = wx.getStorageSync('token'); | ||
83 | + // console.log(token) | ||
84 | + // var promise = new Promise((resolve, reject) => { | ||
85 | + // wx.showNavigationBarLoading() | ||
86 | + // wx.showLoading({ | ||
87 | + // title: '上传中', | ||
88 | + // }) | ||
89 | + // let url = 'http://buygive.w.brotop.cn/api/common/upload'; | ||
90 | + // let head = { | ||
91 | + // 'XX-Token': wx.getStorageSync('token'), | ||
92 | + // 'XX-Device-Type': 'wxapp' | ||
93 | + // } | ||
94 | + // let typename = { | ||
95 | + // filetype: filetype | ||
96 | + // } | ||
97 | + // wx.uploadFile({ | ||
98 | + // url: url, //仅为示例,非真实的接口地址 | ||
99 | + // filePath: file, | ||
100 | + // name: 'file', | ||
101 | + // header: head, | ||
102 | + // formData: typename, | ||
103 | + // success: function (res) { | ||
104 | + // console.log('上传文件后', res) | ||
105 | + // let temdata = JSON.parse(res.data); | ||
106 | + // console.log(temdata) | ||
107 | + | ||
108 | + // let urlobj = { | ||
109 | + // url: temdata.data.url | ||
110 | + // //url: temdata.data.filepath | ||
111 | + // } | ||
112 | + // resolve(urlobj); | ||
113 | + // wx.hideNavigationBarLoading(); | ||
114 | + // wx.hideLoading(); | ||
115 | + // }, | ||
116 | + // fail: function (res) { | ||
117 | + // reject('网络出错'); | ||
118 | + // wx.hideNavigationBarLoading() | ||
119 | + // wx.hideLoading() | ||
120 | + // }, | ||
121 | + // complete: () => { | ||
122 | + // wx.hideNavigationBarLoading() | ||
123 | + // wx.hideLoading() | ||
124 | + // }, | ||
125 | + // }) | ||
126 | + // }); | ||
127 | + // return promise; | ||
128 | + // }, | ||
129 | + | ||
130 | + | ||
131 | + upload(filetype, file) { | ||
132 | + | ||
133 | + var promise = new Promise((resolve, reject) => { | ||
134 | + wx.showNavigationBarLoading() | ||
135 | + wx.showLoading({ | ||
136 | + title: '上传中', | ||
137 | + }) | ||
138 | + let url = 'https://buygive.w.broing.cn/api/common/upload'; | ||
139 | + let head = { | ||
140 | + 'token': wx.getStorageSync('token'), | ||
141 | + 'XX-Device-Type': '' | ||
142 | + } | ||
143 | + let typename = { | ||
144 | + filetype: filetype | ||
145 | + } | ||
146 | + wx.uploadFile({ | ||
147 | + url: url, //仅为示例,非真实的接口地址 | ||
148 | + filePath: file, | ||
149 | + name: 'file', | ||
150 | + header: head, | ||
151 | + formData: typename, | ||
152 | + success: function (res) { | ||
153 | + console.log('上传文件后', res) | ||
154 | + let temdata = JSON.parse(res.data); | ||
155 | + console.log(temdata) | ||
156 | + let urlobj = { | ||
157 | + aburl: temdata.data.absolute_url, | ||
158 | + url: temdata.data.relative_url, | ||
159 | + | ||
160 | + //url: temdata.data.filepath | ||
161 | + } | ||
162 | + resolve(urlobj); | ||
163 | + wx.hideNavigationBarLoading(); | ||
164 | + wx.hideLoading(); | ||
165 | + }, | ||
166 | + fail: function (res) { | ||
167 | + reject('网络出错'); | ||
168 | + wx.hideNavigationBarLoading() | ||
169 | + wx.hideLoading() | ||
170 | + }, | ||
171 | + complete: () => { | ||
172 | + wx.hideNavigationBarLoading() | ||
173 | + wx.hideLoading() | ||
174 | + }, | ||
175 | + }) | ||
176 | + }); | ||
177 | + return promise; | ||
178 | + }, | ||
179 | + | ||
180 | + | ||
181 | + globalData: { | ||
182 | + userInfo: null | ||
183 | + } | ||
184 | +}) |
app.json
0 → 100644
1 | +{ | ||
2 | + "pages": [ | ||
3 | + "pages/homepage/homepage", | ||
4 | + "pages/login/login", | ||
5 | + "pages/cart/cart", | ||
6 | + "pages/orderbox/orderbox", | ||
7 | + "pages/goodevalute/goodevalute", | ||
8 | + "pages/addaddress/addaddress", | ||
9 | + "pages/dizhibox/dizhibox", | ||
10 | + "pages/message/message", | ||
11 | + "pages/mine/mine", | ||
12 | + "pages/goodtail/goodtail", | ||
13 | + "pages/orderdetail/orderdetail", | ||
14 | + "pages/sureorder/sureorder", | ||
15 | + "pages/searchbox/searchbox", | ||
16 | + "pages/goodkind/goodkind", | ||
17 | + "pages/index/index", | ||
18 | + "pages/logs/logs", | ||
19 | + "pages/giftdetail/giftdetail" | ||
20 | + ], | ||
21 | + "window": { | ||
22 | + "backgroundTextStyle": "light", | ||
23 | + "navigationBarBackgroundColor": "#fff", | ||
24 | + "navigationBarTitleText": "WeChat", | ||
25 | + "navigationBarTextStyle": "black" | ||
26 | + }, | ||
27 | + "sitemapLocation": "sitemap.json", | ||
28 | + "tabBar": { | ||
29 | + "selectedColor": "#FF5A4E", | ||
30 | + "list": [ | ||
31 | + { | ||
32 | + "pagePath": "pages/homepage/homepage", | ||
33 | + "text": "首页", | ||
34 | + "selectedColor": "#FF5A4E", | ||
35 | + "iconPath": "img/shou.png", | ||
36 | + "selectedIconPath": "img/shouactive.png" | ||
37 | + }, | ||
38 | + { | ||
39 | + "pagePath": "pages/goodkind/goodkind", | ||
40 | + "text": "分类", | ||
41 | + "selectedColor": "#FF5A4E", | ||
42 | + "iconPath": "img/kind.png", | ||
43 | + "selectedIconPath": "img/kindactive.png" | ||
44 | + }, | ||
45 | + { | ||
46 | + "pagePath": "pages/cart/cart", | ||
47 | + "text": "购物车", | ||
48 | + "selectedColor": "#FF5A4E", | ||
49 | + "iconPath": "img/cart.png", | ||
50 | + "selectedIconPath": "img/cartactive.png" | ||
51 | + }, | ||
52 | + { | ||
53 | + "pagePath": "pages/mine/mine", | ||
54 | + "text": "会员中心", | ||
55 | + "selectedColor": "#FF5A4E", | ||
56 | + "iconPath": "img/huiyuan.png", | ||
57 | + "selectedIconPath": "img/huiyaunactive.png" | ||
58 | + } | ||
59 | + ] | ||
60 | + } | ||
61 | +} |
app.wxss
0 → 100644
1 | +/**app.wxss**/ | ||
2 | + | ||
3 | +page { | ||
4 | + background: #fff; | ||
5 | +} | ||
6 | + | ||
7 | +.searchboxleft { | ||
8 | + width: 40rpx; | ||
9 | + height: 40rpx; | ||
10 | + font-size: 0; | ||
11 | +} | ||
12 | + | ||
13 | +.searchboxleft image { | ||
14 | + width: 100%; | ||
15 | + height: 100%; | ||
16 | +} | ||
17 | + | ||
18 | +.xiename { | ||
19 | + display: flex; | ||
20 | + align-items: center; | ||
21 | + margin-top: 24rpx; | ||
22 | +} | ||
23 | + | ||
24 | +.xienameleft { | ||
25 | + width: 52rpx; | ||
26 | + height: 28rpx; | ||
27 | + font-size: 0; | ||
28 | +} | ||
29 | + | ||
30 | +.xienameleft image { | ||
31 | + width: 100%; | ||
32 | + height: 100%; | ||
33 | +} | ||
34 | + | ||
35 | +.goodname { | ||
36 | + color: #06121e; | ||
37 | + font-size: 28rpx; | ||
38 | + margin-left: 15rpx; | ||
39 | +} | ||
40 | + | ||
41 | +.register { | ||
42 | + width: 100%; | ||
43 | + height: 100%; | ||
44 | + background-color: rgba(0, 0, 0, 0.5); | ||
45 | + position: fixed; | ||
46 | + top: 0; | ||
47 | + left: 0; | ||
48 | + right: 0; | ||
49 | + z-index: 5; | ||
50 | +} | ||
51 | + | ||
52 | +.registerk { | ||
53 | + width: 100%; | ||
54 | + height: 100%; | ||
55 | + background-color: rgba(0, 0, 0, 0.2); | ||
56 | + position: fixed; | ||
57 | + top: 0; | ||
58 | + left: 0; | ||
59 | + right: 0; | ||
60 | + z-index: 5; | ||
61 | +} | ||
62 | + | ||
63 | +.nodata { | ||
64 | + color: #999; | ||
65 | + font-size: 32rpx; | ||
66 | + text-align: center; | ||
67 | + margin-top: 100rpx; | ||
68 | +} | ||
69 | + | ||
70 | +.flex { | ||
71 | + display: flex; | ||
72 | +} | ||
73 | + | ||
74 | +.flexone { | ||
75 | + display: flex; | ||
76 | + align-items: center; | ||
77 | +} | ||
78 | + | ||
79 | +.flextwo { | ||
80 | + display: flex; | ||
81 | + align-items: center; | ||
82 | + justify-content: space-between; | ||
83 | +} | ||
84 | + | ||
85 | +.flexthree { | ||
86 | + display: flex; | ||
87 | + align-items: center; | ||
88 | + justify-content: center; | ||
89 | +} | ||
90 | + | ||
91 | +.flexfour { | ||
92 | + display: flex; | ||
93 | + flex-direction: column; | ||
94 | + align-items: center; | ||
95 | + justify-content: center; | ||
96 | +} |
img/add.png
0 → 100644
317 字节
img/addedit.png
0 → 100644
230 字节
img/addimg.png
0 → 100644
648 字节
img/addreess.png
0 → 100644
914 字节
img/buyadd.png
0 → 100644
673 字节
img/buyreduce.png
0 → 100644
598 字节
img/cart.png
0 → 100644
1.0 KB
img/cartactive.png
0 → 100644
786 字节
img/daifa.png
0 → 100644
911 字节
img/daifu.png
0 → 100644
780 字节
img/daiping.png
0 → 100644
718 字节
img/daishou.png
0 → 100644
1.0 KB
img/deladdress.png
0 → 100644
1.3 KB
img/delimg.png
0 → 100644
1.0 KB
img/delsuccess.png
0 → 100644
2.8 KB
img/evalute.png
0 → 100644
13.3 KB
img/good.png
0 → 100644
857 字节
img/gouwu.png
0 → 100644
188.4 KB
img/huiyaunactive.png
0 → 100644
925 字节
img/huiyuan.png
0 → 100644
1.2 KB
img/jian.png
0 → 100644
211 字节
img/jump.png
0 → 100644
1.3 KB
img/kefu.png
0 → 100644
845 字节
img/kind.png
0 → 100644
636 字节
img/kindactive.png
0 → 100644
544 字节
img/kongxing.png
0 → 100644
1.1 KB
img/liuyan.png
0 → 100644
877 字节
img/nosel.png
0 → 100644
550 字节
img/quanbu.png
0 → 100644
922 字节
img/seetingimger.png
0 → 100644
3.2 KB
img/selcart.png
0 → 100644
660 字节
img/send.png
0 → 100644
1.7 KB
img/shixing.png
0 → 100644
1.0 KB
img/shop.png
0 → 100644
872 字节
img/shou.png
0 → 100644
1.0 KB
img/shouactive.png
0 → 100644
806 字节
img/song.png
0 → 100644
1.7 KB
img/sousuo.png
0 → 100644
2.4 KB
img/touxiang.png
0 → 100644
20.9 KB
img/tuoyuan.png
0 → 100644
467 字节
img/yourow.png
0 → 100644
501 字节
img/zeng.png
0 → 100644
919 字节
pages/addaddress/addaddress.js
0 → 100644
1 | +// pages/addaddress/addaddress.js | ||
2 | +const app = getApp() | ||
3 | +Page({ | ||
4 | + | ||
5 | + /** | ||
6 | + * 页面的初始数据 | ||
7 | + */ | ||
8 | + data: { | ||
9 | + name: '', | ||
10 | + mobile: '', | ||
11 | + province: '', | ||
12 | + city: '', | ||
13 | + county: '', | ||
14 | + addr: '', | ||
15 | + region: ['北京市', '北京市', '东城区'], | ||
16 | + regionname: '请选择所在地区', | ||
17 | + addressid: '', | ||
18 | + type:'' | ||
19 | + }, | ||
20 | + | ||
21 | + /** | ||
22 | + * 生命周期函数--监听页面加载 | ||
23 | + */ | ||
24 | + onLoad: function(options) { | ||
25 | + console.log(options) | ||
26 | + if (options.type == 1) { | ||
27 | + wx.setNavigationBarTitle({ | ||
28 | + title: '新增收货地址' //页面切换,更换页面标题 | ||
29 | + }) | ||
30 | + this.setData({ | ||
31 | + type:options.type | ||
32 | + }) | ||
33 | + } else { | ||
34 | + this.setData({ | ||
35 | + addressid: options.id, | ||
36 | + type: options.type | ||
37 | + }) | ||
38 | + wx.setNavigationBarTitle({ | ||
39 | + title: '编辑收货地址' //页面切换,更换页面标题 | ||
40 | + }) | ||
41 | + this.getaddresstail() | ||
42 | + } | ||
43 | + | ||
44 | + console.log(this.data.type) | ||
45 | + | ||
46 | + | ||
47 | + }, | ||
48 | + | ||
49 | + //获取收货地址详情 | ||
50 | + getaddresstail() { | ||
51 | + let that = this; | ||
52 | + var url = 'take/get_one'; | ||
53 | + var params = { | ||
54 | + take_id: that.data.addressid, | ||
55 | + | ||
56 | + } | ||
57 | + app.post(url, params).then((res) => { | ||
58 | + console.log(res); | ||
59 | + that.setData({ | ||
60 | + name: res.name, | ||
61 | + mobile: res.mobile, | ||
62 | + | ||
63 | + province: res.province, | ||
64 | + city: res.city, | ||
65 | + county: res.county, | ||
66 | + addr: res.addr, | ||
67 | + regionname: res.province + res.city + res.county, | ||
68 | + | ||
69 | + }) | ||
70 | + console.log(that.data.name) | ||
71 | + | ||
72 | + | ||
73 | + | ||
74 | + }).catch((err) => { | ||
75 | + | ||
76 | + }) | ||
77 | + }, | ||
78 | + entershouhuo(e) { | ||
79 | + this.setData({ | ||
80 | + name: e.detail.value | ||
81 | + }) | ||
82 | + }, | ||
83 | + enterphone(e) { | ||
84 | + this.setData({ | ||
85 | + mobile: e.detail.value | ||
86 | + }) | ||
87 | + | ||
88 | + }, | ||
89 | + enteraddress(e) { | ||
90 | + this.setData({ | ||
91 | + addr: e.detail.value | ||
92 | + }) | ||
93 | + }, | ||
94 | + bindRegionChange: function(e) { | ||
95 | + console.log('picker发送选择改变,携带值为', e.detail.value) | ||
96 | + this.setData({ | ||
97 | + region: e.detail.value, | ||
98 | + regionname: e.detail.value[0] + e.detail.value[1] + e.detail.value[2], | ||
99 | + province: e.detail.value[0], | ||
100 | + city: e.detail.value[1], | ||
101 | + county: e.detail.value[2] | ||
102 | + }) | ||
103 | + }, | ||
104 | + | ||
105 | + addsave() { | ||
106 | + let that = this; | ||
107 | + console.log(that.data.regionname) | ||
108 | + if (that.data.name == '') { | ||
109 | + wx.showToast({ | ||
110 | + title: '请填写收货人', | ||
111 | + icon: 'none' | ||
112 | + }) | ||
113 | + | ||
114 | + return false | ||
115 | + } | ||
116 | + | ||
117 | + | ||
118 | + if (that.data.mobile == '') { | ||
119 | + wx.showToast({ | ||
120 | + title: '请填写手机号', | ||
121 | + icon: "none" | ||
122 | + }) | ||
123 | + | ||
124 | + return false | ||
125 | + } | ||
126 | + if (that.data.mobile != '') { | ||
127 | + var reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; | ||
128 | + if (!reg.test(that.data.mobile)) { | ||
129 | + wx.showToast({ | ||
130 | + title: '请输入正确的手机号', | ||
131 | + icon: "none" | ||
132 | + }) | ||
133 | + return false | ||
134 | + } | ||
135 | + | ||
136 | + | ||
137 | + } | ||
138 | + | ||
139 | + if (that.data.regionname == '请选择所在地区') { | ||
140 | + wx.showToast({ | ||
141 | + title: '请选择所在地区', | ||
142 | + icon: "none" | ||
143 | + }) | ||
144 | + | ||
145 | + return false | ||
146 | + } | ||
147 | + | ||
148 | + if (that.data.addr == '') { | ||
149 | + wx.showToast({ | ||
150 | + title: '请输入详细地址', | ||
151 | + icon: 'none' | ||
152 | + }) | ||
153 | + | ||
154 | + return false | ||
155 | + } | ||
156 | + var url = 'take/create_take'; | ||
157 | + var params = { | ||
158 | + name: that.data.name, | ||
159 | + mobile: that.data.mobile, | ||
160 | + province: that.data.province, | ||
161 | + city: that.data.city, | ||
162 | + county: that.data.county, | ||
163 | + addr: that.data.addr | ||
164 | + | ||
165 | + } | ||
166 | + app.post(url, params).then((res) => { | ||
167 | + console.log(res); | ||
168 | + | ||
169 | + wx.showToast({ | ||
170 | + title: '新增收货地址成功', | ||
171 | + icon: 'none' | ||
172 | + }) | ||
173 | + | ||
174 | + setTimeout(function() { | ||
175 | + // wx.navigateTo({ | ||
176 | + // url: '/pages/dizhibox/dizhibox', | ||
177 | + // }) | ||
178 | + | ||
179 | + wx.redirectTo({ | ||
180 | + | ||
181 | + url: '/pages/dizhibox/dizhibox?addrestype=' + 1, | ||
182 | + }) | ||
183 | + }, 1000) | ||
184 | + | ||
185 | + | ||
186 | + | ||
187 | + }).catch((err) => { | ||
188 | + | ||
189 | + }) | ||
190 | + | ||
191 | + }, | ||
192 | + editsave() { | ||
193 | + let that = this; | ||
194 | + console.log(that.data.regionname) | ||
195 | + if (that.data.name == '') { | ||
196 | + wx.showToast({ | ||
197 | + title: '请填写收货人', | ||
198 | + icon: 'none' | ||
199 | + }) | ||
200 | + | ||
201 | + return false | ||
202 | + } | ||
203 | + | ||
204 | + | ||
205 | + if (that.data.mobile == '') { | ||
206 | + wx.showToast({ | ||
207 | + title: '请填写手机号', | ||
208 | + icon: "none" | ||
209 | + }) | ||
210 | + | ||
211 | + return false | ||
212 | + } | ||
213 | + if (that.data.mobile != '') { | ||
214 | + var reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; | ||
215 | + if (!reg.test(that.data.mobile)) { | ||
216 | + wx.showToast({ | ||
217 | + title: '请输入正确的手机号', | ||
218 | + icon: "none" | ||
219 | + }) | ||
220 | + return false | ||
221 | + } | ||
222 | + | ||
223 | + | ||
224 | + } | ||
225 | + | ||
226 | + if (that.data.regionname == '请选择所在地区') { | ||
227 | + wx.showToast({ | ||
228 | + title: '请选择所在地区', | ||
229 | + icon: "none" | ||
230 | + }) | ||
231 | + | ||
232 | + return false | ||
233 | + } | ||
234 | + | ||
235 | + if (that.data.addr == '') { | ||
236 | + wx.showToast({ | ||
237 | + title: '请输入详细地址', | ||
238 | + icon: 'none' | ||
239 | + }) | ||
240 | + | ||
241 | + return false | ||
242 | + } | ||
243 | + var url = 'take/update_take'; | ||
244 | + var params = { | ||
245 | + name: that.data.name, | ||
246 | + mobile: that.data.mobile, | ||
247 | + province: that.data.province, | ||
248 | + city: that.data.city, | ||
249 | + county: that.data.county, | ||
250 | + addr: that.data.addr, | ||
251 | + take_id:that.data.addressid | ||
252 | + | ||
253 | + } | ||
254 | + app.post(url, params).then((res) => { | ||
255 | + console.log(res); | ||
256 | + | ||
257 | + wx.showToast({ | ||
258 | + title: '保存成功', | ||
259 | + icon: 'none' | ||
260 | + }) | ||
261 | + | ||
262 | + setTimeout(function() { | ||
263 | + wx.navigateTo({ | ||
264 | + url: '/pages/dizhibox/dizhibox', | ||
265 | + }) | ||
266 | + }, 1000) | ||
267 | + | ||
268 | + | ||
269 | + | ||
270 | + }).catch((err) => { | ||
271 | + | ||
272 | + }) | ||
273 | + }, | ||
274 | + | ||
275 | + | ||
276 | + /** | ||
277 | + * 生命周期函数--监听页面初次渲染完成 | ||
278 | + */ | ||
279 | + onReady: function() { | ||
280 | + | ||
281 | + }, | ||
282 | + | ||
283 | + /** | ||
284 | + * 生命周期函数--监听页面显示 | ||
285 | + */ | ||
286 | + onShow: function() { | ||
287 | + | ||
288 | + }, | ||
289 | + | ||
290 | + /** | ||
291 | + * 生命周期函数--监听页面隐藏 | ||
292 | + */ | ||
293 | + onHide: function() { | ||
294 | + | ||
295 | + }, | ||
296 | + | ||
297 | + /** | ||
298 | + * 生命周期函数--监听页面卸载 | ||
299 | + */ | ||
300 | + onUnload: function() { | ||
301 | + | ||
302 | + }, | ||
303 | + | ||
304 | + /** | ||
305 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
306 | + */ | ||
307 | + onPullDownRefresh: function() { | ||
308 | + | ||
309 | + }, | ||
310 | + | ||
311 | + /** | ||
312 | + * 页面上拉触底事件的处理函数 | ||
313 | + */ | ||
314 | + onReachBottom: function() { | ||
315 | + | ||
316 | + }, | ||
317 | + | ||
318 | + /** | ||
319 | + * 用户点击右上角分享 | ||
320 | + */ | ||
321 | + onShareAppMessage: function() { | ||
322 | + | ||
323 | + } | ||
324 | +}) |
pages/addaddress/addaddress.json
0 → 100644
pages/addaddress/addaddress.wxml
0 → 100644
1 | +<view class="addressbox"> | ||
2 | + <view class="addressboxitem"> | ||
3 | + <view class="addressboxitemleft"> | ||
4 | + <view class="addressboxitemleftname">收货人</view> | ||
5 | + <view class="addressenter"> | ||
6 | + <input placeholder='请输入收货人' placeholder-class='enteradd' bindinput="entershouhuo" value="{{name}}"/> | ||
7 | + </view> | ||
8 | + </view> | ||
9 | + | ||
10 | + | ||
11 | + </view> | ||
12 | + <view class="addressboxitem"> | ||
13 | + <view class="addressboxitemleft"> | ||
14 | + <view class="addressboxitemleftname">手机号码</view> | ||
15 | + <view class="addressenter"> | ||
16 | + <input placeholder='请输入手机号码' placeholder-class='enteradd' bindinput="enterphone" type="number" value="{{mobile}}"/> | ||
17 | + </view> | ||
18 | + </view> | ||
19 | + </view> | ||
20 | + <picker mode="region" bindchange="bindRegionChange" value="{{region}}" custom-item="{{customItem}}"> | ||
21 | + <view class="addressboxitem"> | ||
22 | + <view class="addressboxitemleft"> | ||
23 | + <view class="addressboxitemleftname">所在地区</view> | ||
24 | + <view class="addressenter"> | ||
25 | + {{regionname}} | ||
26 | + </view> | ||
27 | + | ||
28 | + | ||
29 | + <!-- <view class="picker"> | ||
30 | + 当前选择:{{region[0]}},{{region[1]}},{{region[2]}} | ||
31 | + </view> --> | ||
32 | + | ||
33 | + </view> | ||
34 | + | ||
35 | + <view class="addressright"> | ||
36 | + <image src="/img/yourow.png"></image> | ||
37 | + </view> | ||
38 | + </view> | ||
39 | + </picker> | ||
40 | + <view class="addressboxitem"> | ||
41 | + <view class="addressboxitemleft"> | ||
42 | + <view class="addressboxitemleftname">详细地址</view> | ||
43 | + <view class="addressenter"> | ||
44 | + <input placeholder='请输入详细地址' placeholder-class='enteradd' bindinput="enteraddress" value="{{addr}}"/> | ||
45 | + </view> | ||
46 | + </view> | ||
47 | + | ||
48 | + | ||
49 | + </view> | ||
50 | + | ||
51 | +</view> | ||
52 | + | ||
53 | +<view class="adddizhibtn" bindtap="addsave" wx:if="{{type==1}}">保存</view> | ||
54 | +<view class="adddizhibtn" bindtap="editsave" wx:else>保存</view> |
pages/addaddress/addaddress.wxss
0 → 100644
1 | +page { | ||
2 | + background: #f9f9f9; | ||
3 | +} | ||
4 | + | ||
5 | +.addressbox { | ||
6 | + padding: 0 32rpx; | ||
7 | + box-sizing: border-box; | ||
8 | + background: #fff; | ||
9 | +} | ||
10 | + | ||
11 | +.addressright { | ||
12 | + width: 12rpx; | ||
13 | + height: 20rpx; | ||
14 | + font-size: 0; | ||
15 | +} | ||
16 | + | ||
17 | +.addressright image { | ||
18 | + width: 100%; | ||
19 | + height: 100%; | ||
20 | +} | ||
21 | + | ||
22 | +.addressboxitemleftname { | ||
23 | + width: 115rpx; | ||
24 | + color: #3d444d; | ||
25 | + font-size: 28rpx; | ||
26 | +} | ||
27 | + | ||
28 | +.addressboxitem { | ||
29 | + display: flex; | ||
30 | + align-items: center; | ||
31 | + justify-content: space-between; | ||
32 | + padding: 30rpx 0; | ||
33 | + box-sizing: border-box; | ||
34 | + border-bottom: 1rpx solid #f5f5f5; | ||
35 | +} | ||
36 | + | ||
37 | +.addressboxitemleft { | ||
38 | + display: flex; | ||
39 | + align-items: center; | ||
40 | +} | ||
41 | + | ||
42 | +.addressenter { | ||
43 | + width: 475rpx; | ||
44 | + color: #06121e; | ||
45 | + font-size: 28rpx; | ||
46 | + margin-left: 40rpx; | ||
47 | +} | ||
48 | + | ||
49 | +.addressenter input { | ||
50 | + width: 100%; | ||
51 | + height: 100%; | ||
52 | +} | ||
53 | + | ||
54 | +.enteradd { | ||
55 | + color: #06121e; | ||
56 | + font-size: 28rpx; | ||
57 | +} | ||
58 | + | ||
59 | +.save { | ||
60 | + width: 686px; | ||
61 | + height: 88px; | ||
62 | + background: rgba(255, 90, 78, 1); | ||
63 | + opacity: 1; | ||
64 | + border-radius: 8px; | ||
65 | +} | ||
66 | + | ||
67 | +.adddizhibtn { | ||
68 | + width: 686rpx; | ||
69 | + height: 88rpx; | ||
70 | + background: rgba(255, 90, 78, 1); | ||
71 | + opacity: 1; | ||
72 | + border-radius: 8rpx; | ||
73 | + color: #fff; | ||
74 | + font-size: 32rpx; | ||
75 | + text-align: center; | ||
76 | + line-height: 88rpx; | ||
77 | + position: fixed; | ||
78 | + bottom:40rpx; | ||
79 | + left:24rpx; | ||
80 | +} |
pages/cart/cart.js
0 → 100644
1 | +// pages/cart/cart.js | ||
2 | +const app = getApp() | ||
3 | +Page({ | ||
4 | + | ||
5 | + /** | ||
6 | + * 页面的初始数据 | ||
7 | + */ | ||
8 | + data: { | ||
9 | + delshow: false, | ||
10 | + hidedelcart: false, | ||
11 | + delalldshow: false, | ||
12 | + cartlist: [], | ||
13 | + totalmoney: 0, | ||
14 | + goodsid: [], | ||
15 | + selall: false | ||
16 | + }, | ||
17 | + | ||
18 | + /** | ||
19 | + * 生命周期函数--监听页面加载 | ||
20 | + */ | ||
21 | + onLoad: function(options) { | ||
22 | + | ||
23 | + }, | ||
24 | + manage() { | ||
25 | + this.setData({ | ||
26 | + delalldshow: !this.data.delalldshow | ||
27 | + }) | ||
28 | + }, | ||
29 | + //获取购物车列表 | ||
30 | + getcarlist() { | ||
31 | + let that = this; | ||
32 | + var url = 'car/get_all'; | ||
33 | + var params = { | ||
34 | + token: wx.getStorageSync('token'), | ||
35 | + | ||
36 | + } | ||
37 | + app.post(url, params).then((res) => { | ||
38 | + console.log(res); | ||
39 | + for (var obj of res) { | ||
40 | + obj.sel = false | ||
41 | + } | ||
42 | + that.setData({ | ||
43 | + cartlist: res | ||
44 | + }) | ||
45 | + | ||
46 | + }).catch((err) => { | ||
47 | + | ||
48 | + }) | ||
49 | + }, | ||
50 | + | ||
51 | + // 选择购物车 | ||
52 | + selcart(e) { | ||
53 | + console.log(e) | ||
54 | + let cartid = e.currentTarget.dataset.id; | ||
55 | + console.log(cartid) | ||
56 | + let newcartlist = this.data.cartlist; | ||
57 | + let newtotalmoney = this.data.totalmoney; | ||
58 | + let newgoodsid = this.data.goodsid; | ||
59 | + for (var obj of newcartlist) { | ||
60 | + if (obj.id == cartid) { | ||
61 | + obj.sel = !obj.sel; | ||
62 | + if (obj.sel == true) { | ||
63 | + newtotalmoney = newtotalmoney + Number(obj.price) * Number(obj.number) + Number(obj.freight)+Number(obj.gift.freight); | ||
64 | + newgoodsid.push(obj.id) | ||
65 | + } else if (obj.sel == false) { | ||
66 | + newtotalmoney = newtotalmoney - Number(obj.price) * Number(obj.number) - Number(obj.freight)-Number(obj.gift.freight); | ||
67 | + for (var i = 0; i < newgoodsid.length; i++) { | ||
68 | + if (newgoodsid[i] == cartid) { | ||
69 | + newgoodsid.splice(i, 1) | ||
70 | + } | ||
71 | + } | ||
72 | + } | ||
73 | + } | ||
74 | + } | ||
75 | + | ||
76 | + if (newgoodsid.length == newcartlist.length) { | ||
77 | + this.setData({ | ||
78 | + selall: true | ||
79 | + }) | ||
80 | + } else { | ||
81 | + this.setData({ | ||
82 | + selall: false | ||
83 | + }) | ||
84 | + } | ||
85 | + this.setData({ | ||
86 | + cartlist: newcartlist, | ||
87 | + totalmoney: newtotalmoney, | ||
88 | + goodsid: newgoodsid | ||
89 | + }) | ||
90 | + | ||
91 | + // console.log(this.data.cartlist); | ||
92 | + // console.log(this.data.totalmoney); | ||
93 | + // console.log(this.data.goodsid) | ||
94 | + }, | ||
95 | + | ||
96 | + // 增加数量 | ||
97 | + addcartnum(e) { | ||
98 | + let cartid = e.currentTarget.dataset.id; | ||
99 | + let newcartlist = this.data.cartlist; | ||
100 | + let newtaotalmoney = this.data.totalmoney; | ||
101 | + let newnumber = 0; | ||
102 | + let suanmoney = 0 | ||
103 | + console.log(newtaotalmoney) | ||
104 | + for (var obj of newcartlist) { | ||
105 | + if (obj.id == cartid) { | ||
106 | + obj.number = Number(obj.number) + 1; | ||
107 | + if (obj.sel == true) { | ||
108 | + newnumber = newnumber + 1 | ||
109 | + suanmoney = newnumber * Number(obj.price) | ||
110 | + console.log(obj.number) | ||
111 | + newtaotalmoney = newtaotalmoney + suanmoney | ||
112 | + } | ||
113 | + | ||
114 | + | ||
115 | + } | ||
116 | + } | ||
117 | + | ||
118 | + this.setData({ | ||
119 | + totalmoney: newtaotalmoney, | ||
120 | + cartlist: newcartlist | ||
121 | + }) | ||
122 | + | ||
123 | + let that = this; | ||
124 | + var url = 'car/update_car'; | ||
125 | + var params = { | ||
126 | + goods_id: cartid, | ||
127 | + type: 1 | ||
128 | + | ||
129 | + } | ||
130 | + app.post(url, params).then((res) => { | ||
131 | + console.log(res); | ||
132 | + | ||
133 | + | ||
134 | + | ||
135 | + }).catch((err) => { | ||
136 | + | ||
137 | + }) | ||
138 | + }, | ||
139 | + | ||
140 | + | ||
141 | + // 减少数量 | ||
142 | + reducecartnum(e) { | ||
143 | + let cartid = e.currentTarget.dataset.id; | ||
144 | + let newcartlist = this.data.cartlist; | ||
145 | + let newtaotalmoney = this.data.totalmoney; | ||
146 | + let newnumber = 0; | ||
147 | + let suanmoney = 0 | ||
148 | + console.log(newtaotalmoney) | ||
149 | + for (var obj of newcartlist) { | ||
150 | + if (obj.id == cartid) { | ||
151 | + if (obj.number > 1) { | ||
152 | + obj.number = Number(obj.number) - 1; | ||
153 | + if (obj.sel == true) { | ||
154 | + newnumber = newnumber + 1 | ||
155 | + suanmoney = newnumber * Number(obj.price) | ||
156 | + console.log(obj.number) | ||
157 | + newtaotalmoney = newtaotalmoney - suanmoney | ||
158 | + } | ||
159 | + } else { | ||
160 | + wx.showToast({ | ||
161 | + title: '不能再减少了', | ||
162 | + icon: 'none' | ||
163 | + }) | ||
164 | + obj.number = 1; | ||
165 | + } | ||
166 | + | ||
167 | + | ||
168 | + | ||
169 | + | ||
170 | + } | ||
171 | + } | ||
172 | + | ||
173 | + this.setData({ | ||
174 | + totalmoney: newtaotalmoney, | ||
175 | + cartlist: newcartlist | ||
176 | + }) | ||
177 | + | ||
178 | + let that = this; | ||
179 | + var url = 'car/update_car'; | ||
180 | + var params = { | ||
181 | + goods_id: cartid, | ||
182 | + type: 2 | ||
183 | + | ||
184 | + } | ||
185 | + app.post(url, params).then((res) => { | ||
186 | + console.log(res); | ||
187 | + | ||
188 | + | ||
189 | + | ||
190 | + }).catch((err) => { | ||
191 | + | ||
192 | + }) | ||
193 | + }, | ||
194 | + | ||
195 | + // 结算 | ||
196 | + jiesuan() { | ||
197 | + let that = this; | ||
198 | + if (that.data.goodsid.length == 0) { | ||
199 | + wx.showToast({ | ||
200 | + title: '请选择商品', | ||
201 | + icon: "none" | ||
202 | + }) | ||
203 | + return false | ||
204 | + } | ||
205 | + var url = 'order/confirm_order'; | ||
206 | + var params = { | ||
207 | + take_id: '', | ||
208 | + type: 2, | ||
209 | + goods_ids: that.data.goodsid.join(",") | ||
210 | + | ||
211 | + } | ||
212 | + app.post(url, params).then((res) => { | ||
213 | + console.log(res); | ||
214 | + let orderarr = res.goods; | ||
215 | + console.log('887766554433', orderarr) | ||
216 | + for (var obj of orderarr) { | ||
217 | + obj.content = ''; | ||
218 | + obj.gift.content = '' | ||
219 | + } | ||
220 | + orderarr = JSON.stringify(orderarr) | ||
221 | + let freight = res.freight; | ||
222 | + let price = res.price; | ||
223 | + let total = res.total | ||
224 | + wx.navigateTo({ | ||
225 | + url: '/pages/sureorder/sureorder?orderarr=' + orderarr + '&freight=' + freight + '&price=' + price + '&total=' + total + '&type=' + 2, | ||
226 | + }) | ||
227 | + | ||
228 | + }).catch((err) => { | ||
229 | + console.log(err); | ||
230 | + wx.showToast({ | ||
231 | + title: err.msg, | ||
232 | + icon: 'none' | ||
233 | + }) | ||
234 | + }) | ||
235 | + }, | ||
236 | + | ||
237 | + // 全选 | ||
238 | + selquan() { | ||
239 | + this.setData({ | ||
240 | + selall: !this.data.selall | ||
241 | + }) | ||
242 | + let newcartlist = this.data.cartlist; | ||
243 | + let newgoodsid = [] | ||
244 | + | ||
245 | + if (this.data.selall == true) { | ||
246 | + for (var obj of newcartlist) { | ||
247 | + obj.sel = true | ||
248 | + newgoodsid.push(obj.id) | ||
249 | + } | ||
250 | + } else { | ||
251 | + for (var obj of newcartlist) { | ||
252 | + obj.sel = false | ||
253 | + | ||
254 | + } | ||
255 | + newgoodsid = [] | ||
256 | + } | ||
257 | + this.setData({ | ||
258 | + cartlist: newcartlist, | ||
259 | + goodsid: newgoodsid | ||
260 | + }) | ||
261 | + | ||
262 | + console.log(this.data.goodsid) | ||
263 | + | ||
264 | + }, | ||
265 | + delcart() { | ||
266 | + let that = this; | ||
267 | + if (that.data.goodsid.length == 0) { | ||
268 | + wx.showToast({ | ||
269 | + title: '请选择要删除的商品', | ||
270 | + icon: "none" | ||
271 | + }) | ||
272 | + } else { | ||
273 | + that.setData({ | ||
274 | + hidedelcart: true | ||
275 | + }) | ||
276 | + } | ||
277 | + | ||
278 | + | ||
279 | + | ||
280 | + | ||
281 | + }, | ||
282 | + surecancelcar() { | ||
283 | + let that=this; | ||
284 | + var url = 'car/delete_car'; | ||
285 | + var params = { | ||
286 | + goods_ids: that.data.goodsid.join(",") | ||
287 | + | ||
288 | + } | ||
289 | + app.post(url, params).then((res) => { | ||
290 | + console.log(res); | ||
291 | + that.setData({ | ||
292 | + delshow:true, | ||
293 | + hidedelcart:false, | ||
294 | + goodsid:[], | ||
295 | + totalmoney:0 | ||
296 | + | ||
297 | + }) | ||
298 | + // wx.showToast({ | ||
299 | + // title: '删除购物车成功', | ||
300 | + // icon: 'none' | ||
301 | + // }) | ||
302 | + | ||
303 | + setTimeout(function() { | ||
304 | + that.setData({ | ||
305 | + delshow: false, | ||
306 | + }) | ||
307 | + that.getcarlist() | ||
308 | + },1000) | ||
309 | + }).catch((err) => { | ||
310 | + | ||
311 | + }) | ||
312 | + }, | ||
313 | + cancelhidecar(){ | ||
314 | + this.setData({ | ||
315 | + hidedelcart: false | ||
316 | + }) | ||
317 | + }, | ||
318 | + | ||
319 | + | ||
320 | + hidedel() { | ||
321 | + this.setData({ | ||
322 | + delshow: false | ||
323 | + }) | ||
324 | + }, | ||
325 | + hidecart() { | ||
326 | + this.setData({ | ||
327 | + hidedelcart: false | ||
328 | + }) | ||
329 | + }, | ||
330 | + /** | ||
331 | + * 生命周期函数--监听页面初次渲染完成 | ||
332 | + */ | ||
333 | + onReady: function() { | ||
334 | + | ||
335 | + }, | ||
336 | + | ||
337 | + /** | ||
338 | + * 生命周期函数--监听页面显示 | ||
339 | + */ | ||
340 | + onShow: function() { | ||
341 | + this.setData({ | ||
342 | + totalmoney: 0, | ||
343 | + delalldshow: false, | ||
344 | + goodsid:[] | ||
345 | + }) | ||
346 | + this.getcarlist() | ||
347 | + }, | ||
348 | + | ||
349 | + /** | ||
350 | + * 生命周期函数--监听页面隐藏 | ||
351 | + */ | ||
352 | + onHide: function() { | ||
353 | + | ||
354 | + }, | ||
355 | + | ||
356 | + /** | ||
357 | + * 生命周期函数--监听页面卸载 | ||
358 | + */ | ||
359 | + onUnload: function() { | ||
360 | + | ||
361 | + }, | ||
362 | + | ||
363 | + /** | ||
364 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
365 | + */ | ||
366 | + onPullDownRefresh: function() { | ||
367 | + | ||
368 | + }, | ||
369 | + | ||
370 | + /** | ||
371 | + * 页面上拉触底事件的处理函数 | ||
372 | + */ | ||
373 | + onReachBottom: function() { | ||
374 | + | ||
375 | + }, | ||
376 | + | ||
377 | + /** | ||
378 | + * 用户点击右上角分享 | ||
379 | + */ | ||
380 | + onShareAppMessage: function() { | ||
381 | + | ||
382 | + } | ||
383 | +}) |
pages/cart/cart.json
0 → 100644
pages/cart/cart.wxml
0 → 100644
1 | +<!-- 删除购物车成功 --> | ||
2 | +<view class="register" bindtap="hidedel" wx:if="{{delshow}}"> | ||
3 | + <view class="delwrap"> | ||
4 | + <view class="delsuccess"> | ||
5 | + <image src='/img/delsuccess.png'></image> | ||
6 | + </view> | ||
7 | + | ||
8 | + <view class="delname">删除成功</view> | ||
9 | + </view> | ||
10 | +</view> | ||
11 | + | ||
12 | +<!-- 是否删除购物车 --> | ||
13 | + | ||
14 | +<view class="register" wx:if="{{hidedelcart}}" bindtap="hidecart"> | ||
15 | + <view class="delcartwrap"> | ||
16 | + <view class="delcatname">确认你已选中的商品删除吗</view> | ||
17 | + <view class="delbottom"> | ||
18 | + <view class="delbottomleft" catchtap='cancelhidecar'>取消</view> | ||
19 | + <view class="delbottomright" catchtap='surecancelcar'>确定</view> | ||
20 | + </view> | ||
21 | + | ||
22 | + </view> | ||
23 | +</view> | ||
24 | + | ||
25 | +<view class="manage" bindtap="manage"> | ||
26 | + <view class="manageitem"> | ||
27 | + <view class="manageimg"> | ||
28 | + <image src="/img/seetingimger.png"></image> | ||
29 | + </view> | ||
30 | + <view class="guanli" wx:if="{{delalldshow==false}}">管理</view> | ||
31 | + <view class="guanli" wx:else>完成</view> | ||
32 | + </view> | ||
33 | +</view> | ||
34 | + | ||
35 | +<view class="nodata" wx:if="{{cartlist.length==0}}">暂无数据</view> | ||
36 | + | ||
37 | +<view class="cartbox" wx:else> | ||
38 | + <view class="cartboxitem" wx:for="{{cartlist}}" wx:key=''> | ||
39 | + <view class="xuancar" bindtap="selcart" data-id="{{item.id}}"> | ||
40 | + <view class="cartboxitemleft" > | ||
41 | + <image src="/img/nosel.png" wx:if="{{item.sel==false}}"></image> | ||
42 | + <image src="/img/selcart.png" wx:else></image> | ||
43 | + </view> | ||
44 | + </view> | ||
45 | + | ||
46 | + <view class="cartboxitemright"> | ||
47 | + <view class="goodkindbox"> | ||
48 | + <view class='goodkindrightitemleft'> | ||
49 | + <view class="goodkindleftimg"> | ||
50 | + <image src="{{item.image}}"></image> | ||
51 | + </view> | ||
52 | + <view class="xiename"> | ||
53 | + <view class="xienameleft"> | ||
54 | + <image src="/img/good.png"></image> | ||
55 | + </view> | ||
56 | + <view class="goodname">{{item.goods_name}}</view> | ||
57 | + </view> | ||
58 | + </view> | ||
59 | + <view class="songk"> | ||
60 | + <image src="/img/send.png"></image> | ||
61 | + </view> | ||
62 | + <view class='goodkindrightitemleft'> | ||
63 | + <view class="goodkindleftimg"> | ||
64 | + <image src="{{item.gift.image}}"></image> | ||
65 | + </view> | ||
66 | + <view class="xiename"> | ||
67 | + <view class="xienameleft"> | ||
68 | + <image src="/img/zeng.png"></image> | ||
69 | + </view> | ||
70 | + <view class="goodname">{{item.gift.goods_name}}</view> | ||
71 | + </view> | ||
72 | + </view> | ||
73 | + </view> | ||
74 | + | ||
75 | + | ||
76 | + <view class="goodkindprice"> | ||
77 | + <view class="goodkindpriceleft"> | ||
78 | + ¥{{item.price}} | ||
79 | + </view> | ||
80 | + <view class="goodkindpriceright" wx:if="{{item.freight=='0.00'}}">运费:免运费</view> | ||
81 | + <view class="goodkindpriceright" wx:else>运费:{{item.freight}}元</view> | ||
82 | + | ||
83 | + <view class="goodkindpriceright" wx:if="{{item.gift.freight=='0.00'}}">运费:免运费</view> | ||
84 | + <view class="goodkindpriceright" wx:else>运费:{{item.gift.freight}}元</view> | ||
85 | + | ||
86 | + | ||
87 | + | ||
88 | + </view> | ||
89 | + | ||
90 | + <view class="goodkind"> | ||
91 | + <view class="goodkindnum"> | ||
92 | + <view class="goodkindnumleft" bindtap="reducecartnum" data-id="{{item.id}}"> | ||
93 | + <image src="/img/jian.png"></image> | ||
94 | + </view> | ||
95 | + <view class="goodnum">{{item.number}}</view> | ||
96 | + <view class="goodkindnumleft" bindtap="addcartnum" data-id="{{item.id}}"> | ||
97 | + <image src="/img/add.png"></image> | ||
98 | + </view> | ||
99 | + </view> | ||
100 | + </view> | ||
101 | + </view> | ||
102 | + </view> | ||
103 | +</view> | ||
104 | +<view class="cartbottom" wx:if="{{delalldshow}}"> | ||
105 | + <view class="cartbottomleft"> | ||
106 | + <view class="cartbottomleftsel" bindtap="selquan"> | ||
107 | + <image src="/img/selcart.png" wx:if="{{selall}}"></image> | ||
108 | + <image src="/img/nosel.png" wx:else></image> | ||
109 | + | ||
110 | + </view> | ||
111 | + <view class="cartbottomleftname">全选</view> | ||
112 | + </view> | ||
113 | + | ||
114 | + <view class="cartbottomright" bindtap="delcart">删除</view> | ||
115 | +</view> | ||
116 | + | ||
117 | +<view class="cartbottom" wx:else> | ||
118 | + <view class="cartbottomleft"> | ||
119 | + <view class="totalmoney">总计:{{totalmoney}}</view> | ||
120 | + </view> | ||
121 | + | ||
122 | + <view class="cartbottomright" bindtap="jiesuan">结算</view> | ||
123 | +</view> |
pages/cart/cart.wxss
0 → 100644
1 | +@import "../goodkind/goodkind.wxss"; | ||
2 | + | ||
3 | +page { | ||
4 | + background: #f9f9f9; | ||
5 | +} | ||
6 | + | ||
7 | +.cartboxitemleft { | ||
8 | + width: 32rpx; | ||
9 | + height: 32rpx; | ||
10 | + font-size: 0; | ||
11 | +} | ||
12 | + | ||
13 | +.cartboxitemright { | ||
14 | + margin-left: 1rpx; | ||
15 | +} | ||
16 | + | ||
17 | +.cartboxitemleft image { | ||
18 | + width: 100%; | ||
19 | + height: 100%; | ||
20 | +} | ||
21 | + | ||
22 | +.cartboxitem { | ||
23 | + display: flex; | ||
24 | + align-items: center; | ||
25 | + padding: 24rpx 18rpx; | ||
26 | + box-sizing: border-box; | ||
27 | +} | ||
28 | + | ||
29 | +.goodkindleftimg { | ||
30 | + width: 284rpx; | ||
31 | + height: 284rpx; | ||
32 | + font-size: 0; | ||
33 | +} | ||
34 | + | ||
35 | +.songk { | ||
36 | + width: 42rpx; | ||
37 | + height: 42rpx; | ||
38 | + font-size: 0; | ||
39 | + margin: 126rpx 12rpx 0; | ||
40 | +} | ||
41 | + | ||
42 | +.goodkindpriceleft { | ||
43 | + font-size: 32rpx; | ||
44 | +} | ||
45 | + | ||
46 | +.goodkindpriceright { | ||
47 | + font-size: 24rpx; | ||
48 | + margin-left: 43rpx; | ||
49 | +} | ||
50 | + | ||
51 | +.goodkindnumleft { | ||
52 | + width:47rpx; | ||
53 | + height: 34rpx; | ||
54 | + font-size: 0; | ||
55 | + margin: 14rpx; | ||
56 | + box-sizing: border-box; | ||
57 | +} | ||
58 | + | ||
59 | +.goodkindnumleft image { | ||
60 | + width: 100%; | ||
61 | + height: 100%; | ||
62 | +} | ||
63 | +.xuancar{ | ||
64 | + width:77rpx; | ||
65 | + height:200rpx; | ||
66 | + | ||
67 | +} | ||
68 | +.goodkind { | ||
69 | + display: flex; | ||
70 | + justify-content: flex-end; | ||
71 | + margin-top:14rpx; | ||
72 | +} | ||
73 | + | ||
74 | +.goodkindnum { | ||
75 | + display: flex; | ||
76 | + align-items: center; | ||
77 | + justify-content: flex-end; | ||
78 | + background: #f9f9f9; | ||
79 | + border:1rpx solid #f9f9f9; | ||
80 | + /* justify-content: space-between; */ | ||
81 | + /* width: 148px; | ||
82 | + height: 56px; | ||
83 | + background: #F9F9F9; */ | ||
84 | +} | ||
85 | + | ||
86 | +.goodnum { | ||
87 | + width:79rpx; | ||
88 | + height:79rpx; | ||
89 | + background: #fff; | ||
90 | + line-height:79rpx; | ||
91 | + text-align: center; | ||
92 | + color:26rpx; | ||
93 | + font-size: 26rpx; | ||
94 | + /* border-top:2rpx solid #f9f9f9; | ||
95 | + border-bottom:2rp solid #f9f9f9; */ | ||
96 | + | ||
97 | +} | ||
98 | +.cartbox{ | ||
99 | + padding-bottom: 100rpx; | ||
100 | +} | ||
101 | + | ||
102 | +.cartboxitem { | ||
103 | + background: #fff; | ||
104 | + margin-bottom: 24rpx; | ||
105 | +} | ||
106 | + | ||
107 | +.cartbottom { | ||
108 | + display: flex; | ||
109 | +} | ||
110 | + | ||
111 | +.cartbottom { | ||
112 | + display: flex; | ||
113 | + align-items: center; | ||
114 | + position: fixed; | ||
115 | + bottom: 0; | ||
116 | + left: 0; | ||
117 | + background: #fff; | ||
118 | + height: 88rpx; | ||
119 | +} | ||
120 | + | ||
121 | +.cartbottomleft { | ||
122 | + width: 470rpx; | ||
123 | + display: flex; | ||
124 | + align-items: center; | ||
125 | + padding: 28rpx 32rpx; | ||
126 | + box-sizing: border-box; | ||
127 | + background: #fff; | ||
128 | +} | ||
129 | + | ||
130 | +.cartbottomleftsel { | ||
131 | + width: 32rpx; | ||
132 | + height: 32rpx; | ||
133 | + font-size: 0; | ||
134 | +} | ||
135 | + | ||
136 | +.cartbottomleftname { | ||
137 | + color: #5b5e63; | ||
138 | + font-size: 28rpx; | ||
139 | + margin-left:24rpx; | ||
140 | +} | ||
141 | + | ||
142 | +.cartbottomright { | ||
143 | + width: 280rpx; | ||
144 | + height: 88rpx; | ||
145 | + background: rgba(255, 90, 78, 1); | ||
146 | + opacity: 1; | ||
147 | + color: #fff; | ||
148 | + font-size: 32rpx; | ||
149 | + text-align: center; | ||
150 | + line-height: 88rpx; | ||
151 | +} | ||
152 | + | ||
153 | +/* 删除成功 */ | ||
154 | + | ||
155 | +.delwrap { | ||
156 | + width: 240rpx; | ||
157 | + height: 240rpx; | ||
158 | + background: #3a3a3a; | ||
159 | + border-radius: 4rpx; | ||
160 | + position: absolute; | ||
161 | + top: 50%; | ||
162 | + left: 50%; | ||
163 | + transform: translate(-50%, -50%); | ||
164 | + z-index: 9999; | ||
165 | +} | ||
166 | + | ||
167 | +.delsuccess { | ||
168 | + width: 72rpx; | ||
169 | + height: 72rpx; | ||
170 | + font-size: 0; | ||
171 | + margin: 58rpx auto 0; | ||
172 | +} | ||
173 | + | ||
174 | +.delsuccess image { | ||
175 | + width: 100%; | ||
176 | + height: 100%; | ||
177 | +} | ||
178 | + | ||
179 | +.delname { | ||
180 | + color: #fff; | ||
181 | + font-size: 28rpx; | ||
182 | + text-align: center; | ||
183 | + margin-top: 16rpx; | ||
184 | +} | ||
185 | + | ||
186 | +.delcartwrap { | ||
187 | + width: 540rpx; | ||
188 | + height: 250rpx; | ||
189 | + background: rgba(255, 255, 255, 1); | ||
190 | + opacity: 1; | ||
191 | + border-radius: 16rpx; | ||
192 | + position: absolute; | ||
193 | + top: 50%; | ||
194 | + left: 50%; | ||
195 | + transform: translate(-50%, -50%); | ||
196 | +} | ||
197 | + | ||
198 | +.delcatname { | ||
199 | + color: #232323; | ||
200 | + font-size: 30rpx; | ||
201 | + margin-top: 60rpx; | ||
202 | + text-align: center; | ||
203 | +} | ||
204 | + | ||
205 | +.delbottom { | ||
206 | + display: flex; | ||
207 | + align-items: center; | ||
208 | + justify-content: space-between; | ||
209 | + height: 84rpx; | ||
210 | + border-top: 1rpx solid #f5f5f5; | ||
211 | + margin-top: 62rpx; | ||
212 | +} | ||
213 | + | ||
214 | +.delbottomleft { | ||
215 | + width: 274rpx; | ||
216 | + text-align: center; | ||
217 | + border-right: 1rpx solid #f5f5f5; | ||
218 | + color: #666; | ||
219 | + font-size: 30rpx; | ||
220 | + height: 84rpx; | ||
221 | + line-height: 84rpx; | ||
222 | +} | ||
223 | + | ||
224 | +.delbottomright { | ||
225 | + width: 274rpx; | ||
226 | + color: #ff5a4e; | ||
227 | + font-size: 30rpx; | ||
228 | + text-align: center; | ||
229 | + height: 84rpx; | ||
230 | + line-height: 84rpx; | ||
231 | +} | ||
232 | +.cartbottomleftsel{ | ||
233 | + width:32rpx; | ||
234 | + height:32rpx; | ||
235 | + font-size: 0 | ||
236 | +} | ||
237 | +.cartbottomleftsel image{ | ||
238 | + width:100%; | ||
239 | + height:100%; | ||
240 | +} | ||
241 | +.manageimg{ | ||
242 | + width:31rpx; | ||
243 | + height:31rpx; | ||
244 | + font-size: 0; | ||
245 | +} | ||
246 | +.manageimg image{ | ||
247 | + width:100%; | ||
248 | + height:100%; | ||
249 | +} | ||
250 | +.guanli{ | ||
251 | + color:#BDC4CE; | ||
252 | + font-size: 18rpx; | ||
253 | + margin-top:4rpx; | ||
254 | +} | ||
255 | +.manage{ | ||
256 | + display:flex; | ||
257 | + justify-content: flex-end; | ||
258 | + padding:12rpx 32rpx; | ||
259 | + box-sizing: border-box; | ||
260 | +} | ||
261 | +.totalmoney{ | ||
262 | + color:#FF5A4E; | ||
263 | + font-size: 30rpx; | ||
264 | + font-weight: bold; | ||
265 | +} |
pages/dizhibox/dizhibox.js
0 → 100644
1 | +// pages/dizhibox/dizhibox.js | ||
2 | +const app = getApp() | ||
3 | +Page({ | ||
4 | + | ||
5 | + /** | ||
6 | + * 页面的初始数据 | ||
7 | + */ | ||
8 | + data: { | ||
9 | + addresslist: [], | ||
10 | + deladdress: false, | ||
11 | + delid: '', | ||
12 | + addrestype: '' | ||
13 | + }, | ||
14 | + | ||
15 | + /** | ||
16 | + * 生命周期函数--监听页面加载 | ||
17 | + */ | ||
18 | + onLoad: function(options) { | ||
19 | + if (options.addrestype != undefined) { | ||
20 | + this.setData({ | ||
21 | + addrestype: options.addrestype | ||
22 | + }) | ||
23 | + } | ||
24 | + | ||
25 | + this.getaddresslist() | ||
26 | + }, | ||
27 | + | ||
28 | + //获取收货地址 | ||
29 | + getaddresslist() { | ||
30 | + let that = this; | ||
31 | + var url = 'take/get_all'; | ||
32 | + var params = { | ||
33 | + token: wx.getStorageSync('token'), | ||
34 | + | ||
35 | + } | ||
36 | + app.post(url, params).then((res) => { | ||
37 | + console.log(res); | ||
38 | + that.setData({ | ||
39 | + addresslist: res | ||
40 | + }) | ||
41 | + | ||
42 | + | ||
43 | + | ||
44 | + }).catch((err) => { | ||
45 | + | ||
46 | + }) | ||
47 | + | ||
48 | + }, | ||
49 | + adddizhi() { | ||
50 | + wx.redirectTo({ | ||
51 | + url: '/pages/addaddress/addaddress?type=' + 1, | ||
52 | + }) | ||
53 | + }, | ||
54 | + seladdress(e) { | ||
55 | + if (this.data.addrestype == 1) { | ||
56 | + let item = e.currentTarget.dataset.item | ||
57 | + let pages = getCurrentPages(); | ||
58 | + | ||
59 | + // let currPage = pages[pages.length - 1]; //当前页面 | ||
60 | + let prevPage = pages[pages.length - 2]; //上一个页面 | ||
61 | + | ||
62 | + //直接调用上一个页面的setData()方法,把数据存到上一个页面中去 | ||
63 | + prevPage.setData({ | ||
64 | + addresstext: item, | ||
65 | + addresstype: 2 | ||
66 | + }); | ||
67 | + wx.navigateBack({ | ||
68 | + checked: true | ||
69 | + }) | ||
70 | + } | ||
71 | + | ||
72 | + }, | ||
73 | + | ||
74 | + | ||
75 | + | ||
76 | + // 编辑地址 | ||
77 | + edit(e) { | ||
78 | + console.log(e) | ||
79 | + let id = e.currentTarget.dataset.id; | ||
80 | + wx.navigateTo({ | ||
81 | + url: '/pages/addaddress/addaddress?id=' + id + '&type=' + 2, | ||
82 | + }) | ||
83 | + | ||
84 | + }, | ||
85 | + | ||
86 | + //删除地址 | ||
87 | + deladdress(e) { | ||
88 | + let id = e.currentTarget.dataset.id; | ||
89 | + this.setData({ | ||
90 | + delid: id, | ||
91 | + deladdress: true | ||
92 | + }) | ||
93 | + }, | ||
94 | + cancelorder() { | ||
95 | + this.setData({ | ||
96 | + deladdress: false | ||
97 | + }) | ||
98 | + }, | ||
99 | + suredel() { | ||
100 | + let that = this; | ||
101 | + var url = 'take/delete_take'; | ||
102 | + var params = { | ||
103 | + take_id: that.data.delid, | ||
104 | + } | ||
105 | + app.post(url, params).then((res) => { | ||
106 | + console.log(res); | ||
107 | + wx.showToast({ | ||
108 | + title: '删除地址成功', | ||
109 | + icon: 'none' | ||
110 | + }) | ||
111 | + | ||
112 | + setTimeout(function() { | ||
113 | + that.setData({ | ||
114 | + deladdress: false | ||
115 | + }) | ||
116 | + that.getaddresslist() | ||
117 | + }, 1000) | ||
118 | + | ||
119 | + | ||
120 | + | ||
121 | + }).catch((err) => { | ||
122 | + | ||
123 | + }) | ||
124 | + | ||
125 | + }, | ||
126 | + | ||
127 | + /** | ||
128 | + * 生命周期函数--监听页面初次渲染完成 | ||
129 | + */ | ||
130 | + onReady: function() { | ||
131 | + | ||
132 | + }, | ||
133 | + | ||
134 | + /** | ||
135 | + * 生命周期函数--监听页面显示 | ||
136 | + */ | ||
137 | + onShow: function() { | ||
138 | + | ||
139 | + }, | ||
140 | + | ||
141 | + /** | ||
142 | + * 生命周期函数--监听页面隐藏 | ||
143 | + */ | ||
144 | + onHide: function() { | ||
145 | + | ||
146 | + }, | ||
147 | + | ||
148 | + /** | ||
149 | + * 生命周期函数--监听页面卸载 | ||
150 | + */ | ||
151 | + onUnload: function() { | ||
152 | + | ||
153 | + }, | ||
154 | + | ||
155 | + /** | ||
156 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
157 | + */ | ||
158 | + onPullDownRefresh: function() { | ||
159 | + | ||
160 | + }, | ||
161 | + | ||
162 | + /** | ||
163 | + * 页面上拉触底事件的处理函数 | ||
164 | + */ | ||
165 | + onReachBottom: function() { | ||
166 | + | ||
167 | + }, | ||
168 | + | ||
169 | + /** | ||
170 | + * 用户点击右上角分享 | ||
171 | + */ | ||
172 | + onShareAppMessage: function() { | ||
173 | + | ||
174 | + } | ||
175 | +}) |
pages/dizhibox/dizhibox.json
0 → 100644
pages/dizhibox/dizhibox.wxml
0 → 100644
1 | + | ||
2 | +<view class="register" wx:if="{{deladdress}}"> | ||
3 | + <view class="delwrap"> | ||
4 | + <view class="delwrd">是否删除该地址</view> | ||
5 | + | ||
6 | + <view class="delbottom"> | ||
7 | + <view class="delbottomleft" bindtap="cancelorder">取消</view> | ||
8 | + <view class="delbottomright" bindtap="suredel">确定</view> | ||
9 | + </view> | ||
10 | + </view> | ||
11 | +</view> | ||
12 | + | ||
13 | +<view class='shouhuobox'> | ||
14 | + <view class="shouhuoboxitem" wx:for="{{addresslist}}" wx:key="" bindtap="seladdress" data-item="{{item}}"> | ||
15 | + | ||
16 | + <view class="shouhuoitemtop"> | ||
17 | + <view class="addleft"> | ||
18 | + <view class="shouhuoitemtopleft">{{item.name}}</view> | ||
19 | + <view class="shouhuoitemphone">{{item.mobile}}</view> | ||
20 | + </view> | ||
21 | + | ||
22 | + <view class="shouitemright" catchtap="edit" data-id="{{item.id}}"> | ||
23 | + <image src="/img/addedit.png"></image> | ||
24 | + </view> | ||
25 | + </view> | ||
26 | + <view class="dizhi"> | ||
27 | + <view class="shouhuoaddress">{{item.province}} {{item.city}} {{item.addr}}</view> | ||
28 | + <view class="delimg" catchtap="deladdress" data-id="{{item.id}}"> | ||
29 | + <image src="/img/deladdress.png"></image> | ||
30 | + </view> | ||
31 | + </view> | ||
32 | + | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + </view> | ||
37 | +</view> | ||
38 | + | ||
39 | +<view class="adddizhi" bindtap="adddizhi"> | ||
40 | + <view class="adddizhibtn">添加收货地址</view> | ||
41 | +</view> |
pages/dizhibox/dizhibox.wxss
0 → 100644
1 | +.shouhuobox{ | ||
2 | + padding-bottom: 150rpx; | ||
3 | +} | ||
4 | +.addleft{ | ||
5 | + display:flex; | ||
6 | + align-items: center; | ||
7 | + | ||
8 | +} | ||
9 | + | ||
10 | +.shouhuoboxitem { | ||
11 | + padding: 24rpx 38rpx; | ||
12 | + box-sizing: border-box; | ||
13 | + border-top: 24rpx solid #f9f9f9; | ||
14 | + /* display: flex; | ||
15 | + justify-content: space-between; | ||
16 | + align-items: center; */ | ||
17 | +} | ||
18 | + | ||
19 | +.shouhuoitemtop { | ||
20 | + width:100%; | ||
21 | + display: flex; | ||
22 | + align-items: center; | ||
23 | + justify-content: space-between; | ||
24 | +} | ||
25 | + | ||
26 | +.shouhuoitemtopleft { | ||
27 | + color: #232323; | ||
28 | + font-size: 32rpx; | ||
29 | +} | ||
30 | + | ||
31 | +.shouhuoitemphone { | ||
32 | + color: #bdc4ce; | ||
33 | + font-size: 24rpx; | ||
34 | + margin-left: 14rpx; | ||
35 | +} | ||
36 | + | ||
37 | +.shouhuoaddress { | ||
38 | + width:600rpx; | ||
39 | + overflow: hidden; | ||
40 | + text-overflow: ellipsis; | ||
41 | + color: #3d444d; | ||
42 | + font-size: 24rpx; | ||
43 | + margin-top: 20rpx; | ||
44 | +} | ||
45 | + | ||
46 | +.shouitemright { | ||
47 | + width: 18rpx; | ||
48 | + height: 18rpx; | ||
49 | + font-size: 0; | ||
50 | + margin-right:9rpx; | ||
51 | +} | ||
52 | + | ||
53 | +.shouitemright image { | ||
54 | + width: 100%; | ||
55 | + height: 100%; | ||
56 | +} | ||
57 | + | ||
58 | +.adddizhi { | ||
59 | + height: 128rpx; | ||
60 | + background: #fff; | ||
61 | + width: 750rpx; | ||
62 | + position: fixed; | ||
63 | + bottom: 0; | ||
64 | + left: 0; | ||
65 | +} | ||
66 | + | ||
67 | +.adddizhibtn { | ||
68 | + width: 686rpx; | ||
69 | + height: 88rpx; | ||
70 | + background: rgba(255, 90, 78, 1); | ||
71 | + opacity: 1; | ||
72 | + border-radius: 8rpx; | ||
73 | + color:#fff; | ||
74 | + font-size: 32rpx; | ||
75 | + text-align: center; | ||
76 | + line-height: 88rpx; | ||
77 | + margin:0 auto; | ||
78 | +} | ||
79 | +.dizhi{ | ||
80 | + display:flex; | ||
81 | + align-items: center; | ||
82 | + justify-content: space-between | ||
83 | +} | ||
84 | +.delimg{ | ||
85 | + width:33rpx; | ||
86 | + height:33rpx; | ||
87 | + font-size: 0; | ||
88 | +} | ||
89 | +.delimg image{ | ||
90 | + width:100%; | ||
91 | + height:100%; | ||
92 | +} | ||
93 | + | ||
94 | +.delwrap{ | ||
95 | + width:600rpx; | ||
96 | + height:300rpx; | ||
97 | + position: absolute; | ||
98 | + left:50%; | ||
99 | + top:50%; | ||
100 | + transform: translate(-50%,-50%); | ||
101 | + background: #fff; | ||
102 | + border-radius: 16rpx; | ||
103 | + padding: 32rpx; | ||
104 | + box-sizing: border-box | ||
105 | +} | ||
106 | +.delwrd{ | ||
107 | + color:#5B5E63; | ||
108 | + font-size: 32rpx; | ||
109 | + font-weight: bold; | ||
110 | + text-align: center; | ||
111 | +} | ||
112 | +.delbottom{ | ||
113 | + display:flex; | ||
114 | + align-items: center; | ||
115 | + justify-content: space-between; | ||
116 | + margin-top:100rpx; | ||
117 | +} | ||
118 | +.delbottomleft{ | ||
119 | + width:200rpx; | ||
120 | + height:80rpx; | ||
121 | + border-radius: 44rpx; | ||
122 | + border:1rpx solid #8C9198; | ||
123 | + color:#5B5E63; | ||
124 | + font-size: 30rpx; | ||
125 | + text-align: center; | ||
126 | + line-height: 80rpx; | ||
127 | +} | ||
128 | +.delbottomright{ | ||
129 | + width:200rpx; | ||
130 | + height:80rpx; | ||
131 | + border-radius: 44rpx; | ||
132 | + background: #FF5A4E; | ||
133 | + color:#fff; | ||
134 | + font-size: 30rpx; | ||
135 | + text-align: center; | ||
136 | + line-height: 80rpx; | ||
137 | +} |
pages/giftdetail/giftdetail.js
0 → 100644
1 | +// pages/goodtail/goodtail.js | ||
2 | + | ||
3 | +var WxParse = require('../../wxParse/wxParse.js'); | ||
4 | +const app = getApp() | ||
5 | +Page({ | ||
6 | + | ||
7 | + /** | ||
8 | + * 页面的初始数据 | ||
9 | + */ | ||
10 | + data: { | ||
11 | + imgUrls: [ | ||
12 | + | ||
13 | + ], | ||
14 | + indicatorDots: false, | ||
15 | + autoplay: false, | ||
16 | + interval: 2000, | ||
17 | + duration: 1000, | ||
18 | + currentSwiper: 0, | ||
19 | + ping: 1, | ||
20 | + goodid: '', | ||
21 | + goodtail: '', | ||
22 | + page: 1, | ||
23 | + commentlist: [], | ||
24 | + totalping:0 | ||
25 | + | ||
26 | + }, | ||
27 | + | ||
28 | + /** | ||
29 | + * 生命周期函数--监听页面加载 | ||
30 | + */ | ||
31 | + onLoad: function (options) { | ||
32 | + this.setData({ | ||
33 | + goodid: options.goodid | ||
34 | + }) | ||
35 | + this.getgoodtail(); | ||
36 | + | ||
37 | + }, | ||
38 | + | ||
39 | + getgoodtail() { | ||
40 | + let that = this; | ||
41 | + var url = 'goods/get_one'; | ||
42 | + var params = { | ||
43 | + goods_id: that.data.goodid, | ||
44 | + | ||
45 | + } | ||
46 | + app.post(url, params).then((res) => { | ||
47 | + console.log(res); | ||
48 | + that.setData({ | ||
49 | + imgUrls: res.gift.images, | ||
50 | + goodtail: res | ||
51 | + }) | ||
52 | + | ||
53 | + this.getgoodcomment() | ||
54 | + | ||
55 | + WxParse.wxParse('article', 'html', res.gift.content, that, 5); | ||
56 | + }).catch((err) => { | ||
57 | + | ||
58 | + }) | ||
59 | + }, | ||
60 | + | ||
61 | + //获取商品评论 | ||
62 | + getgoodcomment() { | ||
63 | + let that = this; | ||
64 | + var url = 'comment/get_all'; | ||
65 | + var params = { | ||
66 | + goods_id: that.data.goodtail.gift.id, | ||
67 | + page: that.data.page, | ||
68 | + pageNum: 10 | ||
69 | + | ||
70 | + | ||
71 | + } | ||
72 | + app.post(url, params).then((res) => { | ||
73 | + console.log(res); | ||
74 | + that.setData({ | ||
75 | + commentlist: that.data.commentlist.concat(res.data), | ||
76 | + totalping:res.total | ||
77 | + }) | ||
78 | + | ||
79 | + | ||
80 | + | ||
81 | + }).catch((err) => { | ||
82 | + | ||
83 | + }) | ||
84 | + }, | ||
85 | + swiperChange: function (e) { | ||
86 | + this.setData({ | ||
87 | + currentSwiper: e.detail.current | ||
88 | + }) | ||
89 | + }, | ||
90 | + | ||
91 | + comment(e) { | ||
92 | + this.setData({ | ||
93 | + ping: e.currentTarget.dataset.id | ||
94 | + }) | ||
95 | + | ||
96 | + if (this.data.ping == 1) { | ||
97 | + this.getgoodtail() | ||
98 | + } else { | ||
99 | + this.setData({ | ||
100 | + page: 1, | ||
101 | + commentlist: [] | ||
102 | + }) | ||
103 | + | ||
104 | + this.getgoodcomment() | ||
105 | + | ||
106 | + } | ||
107 | + }, | ||
108 | + | ||
109 | + //商品详情页 | ||
110 | + gogood(){ | ||
111 | + wx.redirectTo({ | ||
112 | + | ||
113 | + url: '/pages/goodtail/goodtail?goodid='+this.data.goodid, | ||
114 | + }) | ||
115 | + }, | ||
116 | + /** | ||
117 | + * 生命周期函数--监听页面初次渲染完成 | ||
118 | + */ | ||
119 | + onReady: function () { | ||
120 | + | ||
121 | + }, | ||
122 | + | ||
123 | + /** | ||
124 | + * 生命周期函数--监听页面显示 | ||
125 | + */ | ||
126 | + onShow: function () { | ||
127 | + | ||
128 | + }, | ||
129 | + | ||
130 | + /** | ||
131 | + * 生命周期函数--监听页面隐藏 | ||
132 | + */ | ||
133 | + onHide: function () { | ||
134 | + | ||
135 | + }, | ||
136 | + | ||
137 | + /** | ||
138 | + * 生命周期函数--监听页面卸载 | ||
139 | + */ | ||
140 | + onUnload: function () { | ||
141 | + | ||
142 | + }, | ||
143 | + | ||
144 | + /** | ||
145 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
146 | + */ | ||
147 | + onPullDownRefresh: function () { | ||
148 | + | ||
149 | + }, | ||
150 | + | ||
151 | + /** | ||
152 | + * 页面上拉触底事件的处理函数 | ||
153 | + */ | ||
154 | + onReachBottom: function () { | ||
155 | + let newpage = this.data.page; | ||
156 | + newpage++; | ||
157 | + this.setData({ | ||
158 | + page: newpage | ||
159 | + }) | ||
160 | + | ||
161 | + this.getgoodcomment() | ||
162 | + }, | ||
163 | + | ||
164 | + /** | ||
165 | + * 用户点击右上角分享 | ||
166 | + */ | ||
167 | + onShareAppMessage: function () { | ||
168 | + | ||
169 | + } | ||
170 | +}) |
pages/giftdetail/giftdetail.json
0 → 100644
pages/giftdetail/giftdetail.wxml
0 → 100644
1 | +<import src="../../wxParse/wxParse.wxml" /> | ||
2 | + | ||
3 | +<!-- 转换箭头 --> | ||
4 | +<view class="zhuanhuan" bindtap="gogood"> | ||
5 | + <image src="/img/jump.png"></image> | ||
6 | +</view> | ||
7 | + | ||
8 | + | ||
9 | +<view class="swiper_image"> | ||
10 | + <swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" class="swiper_item_img" bindchange="swiperChange" circular="true"> | ||
11 | + <block wx:for="{{imgUrls}}" wx:key="doct"> | ||
12 | + <swiper-item> | ||
13 | + <image src="{{item}}" data-index='{{index}}' class="slide-image" bindtap='viewImg' width="355" height="150" /> | ||
14 | + </swiper-item> | ||
15 | + </block> | ||
16 | + </swiper> | ||
17 | + | ||
18 | + <view class="bannerdot"> | ||
19 | + <text>{{currentSwiper+1}}</text>/ | ||
20 | + <text>{{imgUrls.length}}</text> | ||
21 | + </view> | ||
22 | + | ||
23 | + <!-- <view class="dots"> | ||
24 | + <block wx:for="{{imgUrls}}" wx:key=""> | ||
25 | + <view class="dot{{index == currentSwiper ? ' active' : ''}}"></view> | ||
26 | + </block> | ||
27 | + </view> --> | ||
28 | + | ||
29 | + | ||
30 | +</view> | ||
31 | +<view class="goodname"> | ||
32 | + <view class="boxgoodrightop"> | ||
33 | + <view class="boxgoodrigtl"> | ||
34 | + <image src="/img/zeng.png"></image> | ||
35 | + </view> | ||
36 | + {{goodtail.gift.goods_name}} | ||
37 | + </view> | ||
38 | + | ||
39 | + <view class="goodprice"> | ||
40 | + <!-- <view class="goodpriceleft">¥{{goodtail.gift.price}}</view> --> | ||
41 | + <view class="goodpriceright" wx:if="{{goodtail.gift.freight=='0.00'}}">运费:免运费</view> | ||
42 | + <view class="goodpriceright" wx:else>运费:{{goodtail.gift.freight}}元</view> | ||
43 | + </view> | ||
44 | +</view> | ||
45 | + | ||
46 | +<!--商品 --> | ||
47 | +<view class="zenggood" bindtap="gogood"> | ||
48 | + <view class="zenggoodleft"> | ||
49 | + <image src='{{goodtail.image}}'></image> | ||
50 | + </view> | ||
51 | + <view class="zengright"> | ||
52 | + <view class="boxgoodrightop zengname"> | ||
53 | + <view class="boxgoodrigtl"> | ||
54 | + <image src="/img/good.png"></image> | ||
55 | + </view> | ||
56 | + {{goodtail.goods_name}} | ||
57 | + </view> | ||
58 | + </view> | ||
59 | +</view> | ||
60 | + | ||
61 | +<!-- 详情和评论 --> | ||
62 | +<view class="pingxiang"> | ||
63 | + <view class="pingxiangitem {{ping==1?'pingzctive':''}} " data-id="1" bindtap="comment">详情</view> | ||
64 | + <view class="pingxiangitem {{ping==2?'pingzctive':''}}" data-id="2" bindtap="comment">评论({{totalping}})</view> | ||
65 | +</view> | ||
66 | + | ||
67 | +<view class="pingdetail" wx:if="{{ping==1}}"> | ||
68 | + | ||
69 | + <template is="wxParse" data="{{wxParseData:article.nodes}}" /> | ||
70 | + <!-- <view class="pingdetailimg"> | ||
71 | + <image src="/img/changtu.png"></image> | ||
72 | + </view> --> | ||
73 | + | ||
74 | +</view> | ||
75 | + | ||
76 | +<view class='commentdetail' wx:else> | ||
77 | + | ||
78 | + <view class="nodata" wx:if="{{commentlist.length==0}}">暂无评论</view> | ||
79 | + | ||
80 | + <view wx:else> | ||
81 | + <view class="commentitem" wx:for="{{commentlist}}" wx:key=""> | ||
82 | + <view class="commentitemtop"> | ||
83 | + <view class="commentleft"> | ||
84 | + <view class="commentitemleft"> | ||
85 | + <image src="{{item.avatar}}"></image> | ||
86 | + </view> | ||
87 | + <view class="commentitemright">{{item.nickname}}</view> | ||
88 | + </view> | ||
89 | + | ||
90 | + <view class="commentright">{{item.createtime}}</view> | ||
91 | + | ||
92 | + </view> | ||
93 | + | ||
94 | + <view class="commenttext"> | ||
95 | + {{item.content}} | ||
96 | + </view> | ||
97 | + | ||
98 | + <view class="pingfen"> | ||
99 | + <view class="pingfenleft"> | ||
100 | + <view class="pingfenitem"> | ||
101 | + <image src="{{item.star>=1?'/img/shixing.png':'/img/kongxing.png'}}"></image> | ||
102 | + </view> | ||
103 | + <view class="pingfenitem"> | ||
104 | + <image src="{{item.star>=2?'/img/shixing.png':'/img/kongxing.png'}}"></image> | ||
105 | + </view> | ||
106 | + <view class="pingfenitem"> | ||
107 | + <image src="{{item.star>=3?'/img/shixing.png':'/img/kongxing.png'}}"></image> | ||
108 | + </view> | ||
109 | + <view class="pingfenitem"> | ||
110 | + <image src="{{item.star>=4?'/img/shixing.png':'/img/kongxing.png'}}"></image> | ||
111 | + </view> | ||
112 | + <view class="pingfenitem"> | ||
113 | + <image src="{{item.star>=5?'/img/shixing.png':'/img/kongxing.png'}}"></image> | ||
114 | + </view> | ||
115 | + </view> | ||
116 | + | ||
117 | + <view class="pingfenname">{{item.star}}分</view> | ||
118 | + </view> | ||
119 | + | ||
120 | + <view class="pingimg"> | ||
121 | + <view class="pingimgitem" wx:for="{{item.images}}" wx:key=""> | ||
122 | + <image src="{{item}}"></image> | ||
123 | + </view> | ||
124 | + | ||
125 | + </view> | ||
126 | + </view> | ||
127 | + </view> | ||
128 | + | ||
129 | +</view> |
pages/giftdetail/giftdetail.wxss
0 → 100644
1 | +.swiper_image { | ||
2 | + width: 750rpx; | ||
3 | + height: 600rpx; | ||
4 | + font-size: 0; | ||
5 | + position: relative; | ||
6 | + box-shadow: 0px -1px 6px 0px rgba(212, 137, 96, 0.11); | ||
7 | + border-radius: 10px; | ||
8 | +} | ||
9 | + | ||
10 | +.swiper_item_img { | ||
11 | + height: 600rpx; | ||
12 | +} | ||
13 | + | ||
14 | +.swiper_image image { | ||
15 | + width: 100%; | ||
16 | + height: 100%; | ||
17 | + /* box-shadow:0px -1px 6px 0px rgba(212,137,96,0.11); */ | ||
18 | +} | ||
19 | + | ||
20 | +.swiper_item_img swiper-item { | ||
21 | + width: 750rpx; | ||
22 | + height: 600rpx; | ||
23 | + box-shadow: 0px -1px 6px 0px rgba(212, 137, 96, 0.11); | ||
24 | + display: felx; | ||
25 | + align-items: center; | ||
26 | + justify-content: center; | ||
27 | +} | ||
28 | + | ||
29 | +.swiper_item_img swiper-item image { | ||
30 | + width: 100%; | ||
31 | + height: 100%; | ||
32 | +} | ||
33 | + | ||
34 | +.bannerdot { | ||
35 | + width: 84rpx; | ||
36 | + height: 44rpx; | ||
37 | + background: rgba(0, 0, 0, 0.2); | ||
38 | + opacity: 1; | ||
39 | + border-radius: 20rpx; | ||
40 | + color: #fff; | ||
41 | + font-size: 30rpx; | ||
42 | + text-align: center; | ||
43 | + position: absolute; | ||
44 | + bottom: 24rpx; | ||
45 | + right: 28rpx; | ||
46 | +} | ||
47 | + | ||
48 | +.boxgoodrightop { | ||
49 | + color: #06121e; | ||
50 | + font-size: 28rpx; | ||
51 | + font-weight: bold; | ||
52 | + position: relative; | ||
53 | + padding-left: 64rpx; | ||
54 | + box-sizing: border-box; | ||
55 | +} | ||
56 | + | ||
57 | +.boxgoodrigtl { | ||
58 | + width: 52rpx; | ||
59 | + height: 28rpx; | ||
60 | + font-size: 0; | ||
61 | + position: absolute; | ||
62 | + top: 6rpx; | ||
63 | + left: 0; | ||
64 | +} | ||
65 | + | ||
66 | +.boxgoodrigtl image { | ||
67 | + width: 100%; | ||
68 | + height: 100%; | ||
69 | +} | ||
70 | + | ||
71 | +.orderdetailboxgood { | ||
72 | + display: flex; | ||
73 | +} | ||
74 | + | ||
75 | +.boxgoodright { | ||
76 | + margin-left: 24rpx; | ||
77 | +} | ||
78 | + | ||
79 | +.boxgoodrigbot { | ||
80 | + display: flex; | ||
81 | + align-items: center; | ||
82 | + margin-top: 66rpx; | ||
83 | +} | ||
84 | + | ||
85 | +.boxgoodrmoney { | ||
86 | + color: #ea322b; | ||
87 | + font-size: 32rpx; | ||
88 | +} | ||
89 | + | ||
90 | +.boxgoodnum { | ||
91 | + color: #3d444d; | ||
92 | + font-size: 24rpx; | ||
93 | + margin-left: 16rpx; | ||
94 | +} | ||
95 | + | ||
96 | +.goodname { | ||
97 | + padding: 38rpx 32rpx; | ||
98 | + box-sizing: border-box; | ||
99 | + border-bottom: 24rpx solid #f5f5f5; | ||
100 | +} | ||
101 | + | ||
102 | +.goodprice { | ||
103 | + display: flex; | ||
104 | + align-items: center; | ||
105 | + justify-content: space-between; | ||
106 | + margin-top: 15rpx; | ||
107 | +} | ||
108 | + | ||
109 | +.goodpriceleft { | ||
110 | + color: #ea322b; | ||
111 | + font-size: 36rpx; | ||
112 | +} | ||
113 | + | ||
114 | +.goodpriceright { | ||
115 | + color: #3d444d; | ||
116 | + font-size: 28rpx; | ||
117 | +} | ||
118 | + | ||
119 | +.zenggood { | ||
120 | + display: flex; | ||
121 | + padding: 28rpx; | ||
122 | + box-sizing: border-box; | ||
123 | + border-bottom: 24rpx solid #f9f9f9; | ||
124 | +} | ||
125 | + | ||
126 | +.zenggoodleft { | ||
127 | + width: 144rpx; | ||
128 | + height: 144rpx; | ||
129 | + font-size: 0; | ||
130 | +} | ||
131 | + | ||
132 | +.zenggoodleft image { | ||
133 | + width: 100%; | ||
134 | + height: 100%; | ||
135 | +} | ||
136 | + | ||
137 | +.zengname { | ||
138 | + color: #5b5e63; | ||
139 | + font-size: 24rpx; | ||
140 | + width: 522rpx; | ||
141 | + margin-left: 28rpx; | ||
142 | +} | ||
143 | + | ||
144 | +.pingxiang { | ||
145 | + display: flex; | ||
146 | + align-items: center; | ||
147 | + padding: 24rpx 36rpx; | ||
148 | + box-sizing: border-box; | ||
149 | +} | ||
150 | + | ||
151 | +.pingxiangitem { | ||
152 | + color: #232323; | ||
153 | + font-size: 28rpx; | ||
154 | + margin-right: 70rpx; | ||
155 | +} | ||
156 | + | ||
157 | +.pingzctive { | ||
158 | + color: #ff5a4e; | ||
159 | + font-size: 28rpx; | ||
160 | + position: relative; | ||
161 | +} | ||
162 | +.commentdetail{ | ||
163 | + padding-bottom: 50rpx; | ||
164 | +} | ||
165 | +.pingzctive::after { | ||
166 | + content: ''; | ||
167 | + display: block; | ||
168 | + width: 80rpx; | ||
169 | + height: 4rpx; | ||
170 | + border-radius: 16rpx; | ||
171 | + background: #ff5a4e; | ||
172 | + position: absolute; | ||
173 | + left: 50%; | ||
174 | + transform: translateX(-50%); | ||
175 | + bottom: -20rpx; | ||
176 | +} | ||
177 | + | ||
178 | +.pingdetail { | ||
179 | + padding: 24rpx; | ||
180 | + box-sizing: border-box; | ||
181 | +} | ||
182 | + | ||
183 | +.pingdetailimg { | ||
184 | + width: 750rpx; | ||
185 | + height: 2474rpx; | ||
186 | + font-size: 0; | ||
187 | +} | ||
188 | + | ||
189 | +.pingdetailimg image { | ||
190 | + width: 100%; | ||
191 | + height: 100%; | ||
192 | +} | ||
193 | + | ||
194 | +.commentitem { | ||
195 | + padding: 0 26rpx 36rpx; | ||
196 | + box-sizing: border-box; | ||
197 | +} | ||
198 | + | ||
199 | +.commentitemtop { | ||
200 | + display: flex; | ||
201 | + align-items: center; | ||
202 | + justify-content: space-between; | ||
203 | + padding: 20rpx 0 16rpx; | ||
204 | + box-sizing: border-box; | ||
205 | +} | ||
206 | + | ||
207 | +.commentitemleft { | ||
208 | + width: 84rpx; | ||
209 | + height: 84rpx; | ||
210 | + border-radius: 50%; | ||
211 | +} | ||
212 | + | ||
213 | +.commentitemleft image { | ||
214 | + width: 100%; | ||
215 | + height: 100%; | ||
216 | + border-radius: 50%; | ||
217 | +} | ||
218 | + | ||
219 | +.commentleft { | ||
220 | + display: flex; | ||
221 | + align-items: center; | ||
222 | +} | ||
223 | + | ||
224 | +.commentitemright { | ||
225 | + color: #8c9198; | ||
226 | + font-size: 28rpx; | ||
227 | + margin-left: 18rpx; | ||
228 | +} | ||
229 | + | ||
230 | +.commentright { | ||
231 | + color: #3d444d; | ||
232 | + font-size: 24rpx; | ||
233 | +} | ||
234 | + | ||
235 | +.commenttext { | ||
236 | + color: #5b5e63; | ||
237 | + font-size: 24rpx; | ||
238 | +} | ||
239 | + | ||
240 | +.pingfenleft { | ||
241 | + display: flex; | ||
242 | + align-items: center; | ||
243 | +} | ||
244 | + | ||
245 | +.pingfenitem { | ||
246 | + width: 37rpx; | ||
247 | + height: 37rpx; | ||
248 | + font-size: 0; | ||
249 | + margin-right: 32rpx; | ||
250 | +} | ||
251 | + | ||
252 | +.pingfenitem image { | ||
253 | + width: 100%; | ||
254 | + height: 100%; | ||
255 | +} | ||
256 | + | ||
257 | +.pingfen { | ||
258 | + display: flex; | ||
259 | + align-items: center; | ||
260 | + margin-top: 24rpx; | ||
261 | +} | ||
262 | + | ||
263 | +.pingfenname { | ||
264 | + color: #ff5a4e; | ||
265 | + font-size: 26rpx; | ||
266 | + margin-left: 8rpx; | ||
267 | +} | ||
268 | + | ||
269 | +.pingimg { | ||
270 | + display: flex; | ||
271 | + align-items: center; | ||
272 | + margin-top: 24rpx; | ||
273 | +} | ||
274 | + | ||
275 | +.pingimgitem { | ||
276 | + width: 154rpx; | ||
277 | + height: 154rpx; | ||
278 | + font-size: 0; | ||
279 | + margin-right: 24rpx; | ||
280 | +} | ||
281 | + | ||
282 | +.pingimgitem image { | ||
283 | + width: 100%; | ||
284 | + height: 100%; | ||
285 | +} | ||
286 | + | ||
287 | +.zhuanhuan { | ||
288 | + position: fixed; | ||
289 | + top: 583rpx; | ||
290 | + right: 46rpx; | ||
291 | + width: 80rpx; | ||
292 | + height: 80rpx; | ||
293 | + font-size: 0; | ||
294 | + z-index: 999; | ||
295 | + transform: rotate(-180deg) | ||
296 | +} | ||
297 | + | ||
298 | +.zhuanhuan image { | ||
299 | + width: 100%; | ||
300 | + height: 100%; | ||
301 | +} |
pages/goodevalute/goodevalute.js
0 → 100644
1 | +// pages/goodevalute/goodevalute.js | ||
2 | +const app = getApp() | ||
3 | +Page({ | ||
4 | + | ||
5 | + /** | ||
6 | + * 页面的初始数据 | ||
7 | + */ | ||
8 | + data: { | ||
9 | + pingid: '', | ||
10 | + type: '', | ||
11 | + star: '', | ||
12 | + imgarr: [], | ||
13 | + chuanimgarr:[], | ||
14 | + star: 1, | ||
15 | + content: '', | ||
16 | + item:"", | ||
17 | + | ||
18 | + }, | ||
19 | + | ||
20 | + /** | ||
21 | + * 生命周期函数--监听页面加载 | ||
22 | + */ | ||
23 | + onLoad: function(options) { | ||
24 | + console.log(options) | ||
25 | + this.setData({ | ||
26 | + pingid: options.id, | ||
27 | + type: options.type, | ||
28 | + item:JSON.parse(options.item), | ||
29 | + imgarr: [], | ||
30 | + chuanimgarr: [], | ||
31 | + }) | ||
32 | + console.log(this.data.item) | ||
33 | + }, | ||
34 | + | ||
35 | + // 选择五角星 | ||
36 | + chosestar(e) { | ||
37 | + console.log(e) | ||
38 | + this.setData({ | ||
39 | + star: e.currentTarget.dataset.star | ||
40 | + }) | ||
41 | + | ||
42 | + }, | ||
43 | + chooseImage() { | ||
44 | + let that = this; | ||
45 | + wx.chooseImage({ | ||
46 | + count: 1, | ||
47 | + sizeType: ['original', 'compressed'], | ||
48 | + success: function(res) { | ||
49 | + console.log('9988776655',res) | ||
50 | + console.log(res.tempFilePaths[0]) | ||
51 | + app.upload('image', res.tempFilePaths[0]).then((res) => { | ||
52 | + console.log('上传文件', res); | ||
53 | + let newimagarr = that.data.imgarr; | ||
54 | + console.log(newimagarr) | ||
55 | + | ||
56 | + newimagarr.push(res.aburl); | ||
57 | + let newchuanimagarr=that.data.chuanimgarr; | ||
58 | + newchuanimagarr.push(res.url); | ||
59 | + that.setData({ | ||
60 | + imgarr: newimagarr, | ||
61 | + newchuanimagarr: newchuanimagarr | ||
62 | + }) | ||
63 | + | ||
64 | + console.log(that.data.imgarr) | ||
65 | + | ||
66 | + // that.setData({ | ||
67 | + // banneritem: res.url | ||
68 | + // }) | ||
69 | + }).catch((err) => { | ||
70 | + console.log(err) | ||
71 | + }) | ||
72 | + }, | ||
73 | + fail: function(res) {} | ||
74 | + }) | ||
75 | + }, | ||
76 | + delimg(e){ | ||
77 | + let that=this; | ||
78 | + let url=e.currentTarget.dataset.url; | ||
79 | + let index=e.currentTarget.dataset.index; | ||
80 | + | ||
81 | + let newimagarr = that.data.imgarr; | ||
82 | + let newchuanimagarr = that.data.chuanimgarr; | ||
83 | + for(var i=0;i<newimagarr.length;i++){ | ||
84 | + | ||
85 | + if (url == newimagarr[i]){ | ||
86 | + newimagarr.splice(i,1) | ||
87 | + } | ||
88 | + } | ||
89 | + for (var j = 0; j < newchuanimagarr.length; j++) { | ||
90 | + if (index==j) { | ||
91 | + newchuanimagarr.splice(j, 1) | ||
92 | + } | ||
93 | + } | ||
94 | + | ||
95 | + that.setData({ | ||
96 | + imgarr: newimagarr, | ||
97 | + chuanimgarr: newchuanimagarr | ||
98 | + }) | ||
99 | + | ||
100 | + console.log(that.data.imgarr); | ||
101 | + console.log(that.data.chuanimgarr) | ||
102 | + | ||
103 | + }, | ||
104 | + | ||
105 | + // 输入评论 | ||
106 | + enterevalute(e) { | ||
107 | + this.setData({ | ||
108 | + content: e.detail.value | ||
109 | + }) | ||
110 | + | ||
111 | + }, | ||
112 | + | ||
113 | + // 发布 | ||
114 | + fabu() { | ||
115 | + let that = this; | ||
116 | + if (that.data.content==''){ | ||
117 | + wx.showToast({ | ||
118 | + title: '请输入评价内容', | ||
119 | + icon:'none' | ||
120 | + }) | ||
121 | + | ||
122 | + return false | ||
123 | + } | ||
124 | + | ||
125 | + var url = 'comment/create_comment'; | ||
126 | + var params = { | ||
127 | + order_info_id:this.data.pingid, | ||
128 | + star:this.data.star, | ||
129 | + images: this.data.chuanimgarr.join(","), | ||
130 | + content: this.data.content | ||
131 | + | ||
132 | + } | ||
133 | + app.post(url, params).then((res) => { | ||
134 | + console.log(res); | ||
135 | + wx.showToast({ | ||
136 | + title: '评论成功', | ||
137 | + icon:'none' | ||
138 | + }) | ||
139 | + | ||
140 | + setTimeout(function(){ | ||
141 | + wx.navigateTo({ | ||
142 | + url: '/pages/orderbox/orderbox?index=' + 4, | ||
143 | + }) | ||
144 | + },1000) | ||
145 | + | ||
146 | + | ||
147 | + | ||
148 | + }).catch((err) => { | ||
149 | + | ||
150 | + }) | ||
151 | + | ||
152 | + }, | ||
153 | + | ||
154 | + | ||
155 | + // chooseImage() { | ||
156 | + // let that = this; | ||
157 | + // wx.chooseImage({ | ||
158 | + // count: 1, | ||
159 | + // sizeType: ['original', 'compressed'], | ||
160 | + // success: function (res) { | ||
161 | + // console.log(res) | ||
162 | + // app.upload('image', res.tempFilePaths[0]).then((res) => { | ||
163 | + | ||
164 | + // console.log('上传文件' + JSON.stringify(res)); | ||
165 | + // let data = JSON.parse(JSON.stringify(res)) | ||
166 | + // console.log(data) | ||
167 | + // let arr = that.data.images; | ||
168 | + // arr.push(data.url) | ||
169 | + // that.setData({ | ||
170 | + // images: arr | ||
171 | + // }) | ||
172 | + | ||
173 | + // console.log(that.data.images) | ||
174 | + // }).catch((err) => { | ||
175 | + // console.log(err) | ||
176 | + // }) | ||
177 | + // }, | ||
178 | + // fail: function (res) { } | ||
179 | + // }) | ||
180 | + // }, | ||
181 | + | ||
182 | + | ||
183 | + | ||
184 | + /** | ||
185 | + * 生命周期函数--监听页面初次渲染完成 | ||
186 | + */ | ||
187 | + onReady: function() { | ||
188 | + | ||
189 | + }, | ||
190 | + | ||
191 | + | ||
192 | + | ||
193 | + /** | ||
194 | + * 生命周期函数--监听页面显示 | ||
195 | + */ | ||
196 | + onShow: function() { | ||
197 | + | ||
198 | + }, | ||
199 | + | ||
200 | + /** | ||
201 | + * 生命周期函数--监听页面隐藏 | ||
202 | + */ | ||
203 | + onHide: function() { | ||
204 | + | ||
205 | + }, | ||
206 | + | ||
207 | + /** | ||
208 | + * 生命周期函数--监听页面卸载 | ||
209 | + */ | ||
210 | + onUnload: function() { | ||
211 | + | ||
212 | + }, | ||
213 | + | ||
214 | + /** | ||
215 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
216 | + */ | ||
217 | + onPullDownRefresh: function() { | ||
218 | + | ||
219 | + }, | ||
220 | + | ||
221 | + /** | ||
222 | + * 页面上拉触底事件的处理函数 | ||
223 | + */ | ||
224 | + onReachBottom: function() { | ||
225 | + | ||
226 | + }, | ||
227 | + | ||
228 | + /** | ||
229 | + * 用户点击右上角分享 | ||
230 | + */ | ||
231 | + onShareAppMessage: function() { | ||
232 | + | ||
233 | + } | ||
234 | +}) |
pages/goodevalute/goodevalute.json
0 → 100644
pages/goodevalute/goodevalute.wxml
0 → 100644
1 | +<view class="evalutepage"> | ||
2 | + | ||
3 | + <view class="evalutebox"> | ||
4 | + <view class="evaluteboxhead"> | ||
5 | + <view class="evaluteleft"> | ||
6 | + <image src="{{item.image}}"></image> | ||
7 | + <view class="zengsong" wx:if="{{type==2}}"> | ||
8 | + <image src="/img/song.png"></image> | ||
9 | + </view> | ||
10 | + </view> | ||
11 | + <view class="evaluteright"> | ||
12 | + <view class="boxgoodrightop"> | ||
13 | + <view class="boxgoodrigtl" wx:if="{{type==1}}"> | ||
14 | + <image src="/img/good.png"></image> | ||
15 | + | ||
16 | + </view> | ||
17 | + <view class="boxgoodrigtl" wx:else> | ||
18 | + <image src="/img/zeng.png"></image> | ||
19 | + | ||
20 | + </view> | ||
21 | + {{item.goods_name}} | ||
22 | + </view> | ||
23 | + | ||
24 | + <view class="desc">描述相符</view> | ||
25 | + | ||
26 | + <view class="wuxing"> | ||
27 | + <view class="wuxingleft"> | ||
28 | + <view class="wuxingitem" bindtap="chosestar" data-star="1"> | ||
29 | + <image src="/img/shixing.png" wx:if="{{star>=1}}" ></image> | ||
30 | + <image src="/img/kongxing.png" wx:else></image> | ||
31 | + </view> | ||
32 | + <view class="wuxingitem" bindtap="chosestar" data-star="2"> | ||
33 | + <image src="/img/shixing.png" wx:if="{{star>=2}}"></image> | ||
34 | + <image src="/img/kongxing.png" wx:else></image> | ||
35 | + </view> | ||
36 | + <view class="wuxingitem" bindtap="chosestar" data-star="3"> | ||
37 | + <image src="/img/shixing.png" wx:if="{{star>=3}}"></image> | ||
38 | + <image src="/img/kongxing.png" wx:else></image> | ||
39 | + </view> | ||
40 | + <view class="wuxingitem" bindtap="chosestar" data-star="4"> | ||
41 | + <image src="/img/shixing.png" wx:if="{{star>=4}}"></image> | ||
42 | + <image src="/img/kongxing.png" wx:else></image> | ||
43 | + </view> | ||
44 | + <view class="wuxingitem" bindtap="chosestar" data-star="5"> | ||
45 | + <image src="/img/shixing.png" wx:if="{{star>=5}}"></image> | ||
46 | + <image src="/img/kongxing.png" wx:else></image> | ||
47 | + </view> | ||
48 | + </view> | ||
49 | + | ||
50 | + <view class="wuxingfen">{{star}}分</view> | ||
51 | + </view> | ||
52 | + </view> | ||
53 | + </view> | ||
54 | + | ||
55 | + <view class="enterdes"> | ||
56 | + <textarea placeholder='请输入评价' placeholder-class='enterping' bindinput="enterevalute"/> | ||
57 | + </view> | ||
58 | + | ||
59 | + <view class="upimg"> | ||
60 | + <view class="upimgbnox"> | ||
61 | + | ||
62 | + <block wx:for="{{imgarr}}" wx:key=""> | ||
63 | + <view class="upimgnoxitem"> | ||
64 | + <image src="{{item}}"></image> | ||
65 | + <view class="chahao" bindtap="delimg" data-url="{{item}}" data-index="{{index}}"> | ||
66 | + <image src="/img/delimg.png"></image> | ||
67 | + </view> | ||
68 | + </view> | ||
69 | + </block> | ||
70 | + | ||
71 | + | ||
72 | + <view class="upimgnoxitem" bindtap="chooseImage"> | ||
73 | + <image src="/img/addimg.png"></image> | ||
74 | + </view> | ||
75 | + | ||
76 | + </view> | ||
77 | + </view> | ||
78 | + </view> | ||
79 | + | ||
80 | + | ||
81 | + <!-- <view class="evalutebox"> | ||
82 | + <view class="evaluteboxhead"> | ||
83 | + <view class="evaluteleft"> | ||
84 | + <image src="/img/evalute.png"></image> | ||
85 | + | ||
86 | + <view class="zengsong"> | ||
87 | + <image src="/img/song.png"></image> | ||
88 | + </view> | ||
89 | + </view> | ||
90 | + <view class="evaluteright"> | ||
91 | + <view class="boxgoodrightop"> | ||
92 | + <view class="boxgoodrigtl"> | ||
93 | + <image src="/img/good.png"></image> | ||
94 | + </view> | ||
95 | + 商品名称商品名称 | ||
96 | + </view> | ||
97 | + | ||
98 | + <view class="desc">描述相符</view> | ||
99 | + | ||
100 | + <view class="wuxing"> | ||
101 | + <view class="wuxingleft"> | ||
102 | + <view class="wuxingitem"> | ||
103 | + <image src="/img/shixing.png"></image> | ||
104 | + </view> | ||
105 | + <view class="wuxingitem"> | ||
106 | + <image src="/img/shixing.png"></image> | ||
107 | + </view> | ||
108 | + <view class="wuxingitem"> | ||
109 | + <image src="/img/shixing.png"></image> | ||
110 | + </view> | ||
111 | + <view class="wuxingitem"> | ||
112 | + <image src="/img/shixing.png"></image> | ||
113 | + </view> | ||
114 | + <view class="wuxingitem"> | ||
115 | + <image src="/img/shixing.png"></image> | ||
116 | + </view> | ||
117 | + </view> | ||
118 | + | ||
119 | + <view class="wuxingfen">5分</view> | ||
120 | + </view> | ||
121 | + </view> | ||
122 | + </view> | ||
123 | + | ||
124 | + <view class="enterdes"> | ||
125 | + <textarea placeholder='请输入评价' placeholder-class='enterping' /> | ||
126 | + </view> | ||
127 | + | ||
128 | + <view class="upimg"> | ||
129 | + <view class="upimgbnox"> | ||
130 | + <view class="upimgnoxitem"> | ||
131 | + <image src="/img/xie.png"></image> | ||
132 | + <view class="chahao"> | ||
133 | + <image src="/img/delimg.png"></image> | ||
134 | + </view> | ||
135 | + </view> | ||
136 | + <view class="upimgnoxitem"> | ||
137 | + <image src="/img/xie.png"></image> | ||
138 | + <view class="chahao"> | ||
139 | + <image src="/img/delimg.png"></image> | ||
140 | + </view> | ||
141 | + </view> | ||
142 | + <view class="upimgnoxitem"> | ||
143 | + <image src="/img/xie.png"></image> | ||
144 | + </view> | ||
145 | + | ||
146 | + </view> | ||
147 | + </view> | ||
148 | + </view> --> | ||
149 | +</view> | ||
150 | + | ||
151 | + | ||
152 | + | ||
153 | +<view class="adddizhi"> | ||
154 | + <view class="adddizhibtn" bindtap="fabu">发布</view> | ||
155 | +</view> |
pages/goodevalute/goodevalute.wxss
0 → 100644
1 | +.evalutebox { | ||
2 | + padding: 0 24rpx 24rpx; | ||
3 | + box-sizing: border-box; | ||
4 | + border-bottom:24rpx solid #f9f9f9; | ||
5 | + margin-top:24rpx; | ||
6 | + | ||
7 | +} | ||
8 | + | ||
9 | +.evaluteleft { | ||
10 | + width: 144rpx; | ||
11 | + height: 144rpx; | ||
12 | + border-radius: 16rpx; | ||
13 | + font-size: 0; | ||
14 | + flex: 0 0 auto; | ||
15 | + position: relative | ||
16 | +} | ||
17 | +.evaluteleft{ | ||
18 | + position: relative | ||
19 | +} | ||
20 | +.zengsong{ | ||
21 | + width:44rpx; | ||
22 | + height:44rpx; | ||
23 | + font-size: 0; | ||
24 | + position: absolute; | ||
25 | + left:-10rpx; | ||
26 | + top:-20rpx; | ||
27 | + z-index:999; | ||
28 | +} | ||
29 | +.zengsong image{ | ||
30 | + widht:100%; | ||
31 | +} | ||
32 | + | ||
33 | +.evaluteleft image { | ||
34 | + width: 100%; | ||
35 | + height: 100%; | ||
36 | + border-radius: 16rpx; | ||
37 | +} | ||
38 | + | ||
39 | +.boxgoodrightop { | ||
40 | + color: #06121e; | ||
41 | + font-size: 30rpx; | ||
42 | + font-weight: bold; | ||
43 | + position: relative; | ||
44 | + padding-left: 64rpx; | ||
45 | + box-sizing: border-box; | ||
46 | +} | ||
47 | + | ||
48 | +.boxgoodrigtl { | ||
49 | + width: 52rpx; | ||
50 | + height: 28rpx; | ||
51 | + font-size: 0; | ||
52 | + position: absolute; | ||
53 | + top: 6rpx; | ||
54 | + left: 0; | ||
55 | +} | ||
56 | + | ||
57 | +.boxgoodrigtl image { | ||
58 | + width: 100%; | ||
59 | + height: 100%; | ||
60 | +} | ||
61 | + | ||
62 | +.evaluteboxhead { | ||
63 | + display: flex; | ||
64 | + /* align-items: center */ | ||
65 | +} | ||
66 | + | ||
67 | +.evaluteright { | ||
68 | + margin-left: 36rpx; | ||
69 | +} | ||
70 | + | ||
71 | +.desc { | ||
72 | + color: #06121e; | ||
73 | + font-size: 24rpx; | ||
74 | + margin-top: 21rpx; | ||
75 | +} | ||
76 | + | ||
77 | +.wuxingitem { | ||
78 | + width: 30rpx; | ||
79 | + height: 30rpx; | ||
80 | + font-size: 0; | ||
81 | + margin-right: 26rpx; | ||
82 | +} | ||
83 | + | ||
84 | +.wuxingitem image { | ||
85 | + width: 100%; | ||
86 | + height: 100%; | ||
87 | +} | ||
88 | + | ||
89 | +.wuxingleft { | ||
90 | + display: flex; | ||
91 | + align-items: center; | ||
92 | +} | ||
93 | + | ||
94 | +.wuxingfen { | ||
95 | + color: #ff5a4e; | ||
96 | + font-size: 24rpx; | ||
97 | +} | ||
98 | + | ||
99 | +.wuxing { | ||
100 | + display: flex; | ||
101 | + align-items: center; | ||
102 | + margin-top: 16rpx; | ||
103 | +} | ||
104 | + | ||
105 | +.enterdes { | ||
106 | + width: 686rpx; | ||
107 | + height: 182rpx; | ||
108 | + color: #3d444d; | ||
109 | + font-size: 28rpx; | ||
110 | + margin-top: 44rpx; | ||
111 | +} | ||
112 | + | ||
113 | +.enterdes textarea { | ||
114 | + width: 100%; | ||
115 | + height: 100%; | ||
116 | + color: #3d444d; | ||
117 | + font-size: 28rpx; | ||
118 | +} | ||
119 | + | ||
120 | +.enterping { | ||
121 | + color: #3d444d; | ||
122 | + font-size: 28rpx; | ||
123 | +} | ||
124 | +.upimgbnox{ | ||
125 | + display:flex; | ||
126 | + align-items: center; | ||
127 | + flex-wrap: wrap | ||
128 | +} | ||
129 | +.upimgnoxitem{ | ||
130 | + width:180rpx; | ||
131 | + height:180rpx; | ||
132 | + font-size: 0; | ||
133 | + position: relative; | ||
134 | + margin-right:20rpx; | ||
135 | + margin-bottom:20rpx; | ||
136 | +} | ||
137 | +.upimgnoxitem image{ | ||
138 | + width:100%; | ||
139 | + height:100%; | ||
140 | +} | ||
141 | +.chahao{ | ||
142 | + width:40rpx; | ||
143 | + height:40rpx; | ||
144 | + font-size: 0; | ||
145 | + position: absolute; | ||
146 | + top:-10rpx; | ||
147 | + right:-10rpx; | ||
148 | +} | ||
149 | +.chahao image{ | ||
150 | + width:100%; | ||
151 | + height:100%; | ||
152 | +} | ||
153 | +.adddizhi { | ||
154 | + height: 128rpx; | ||
155 | + background: #fff; | ||
156 | + width: 750rpx; | ||
157 | + position: fixed; | ||
158 | + bottom: 0; | ||
159 | + left: 0; | ||
160 | +} | ||
161 | + | ||
162 | +.adddizhibtn { | ||
163 | + width: 686rpx; | ||
164 | + height: 88rpx; | ||
165 | + background: rgba(255, 90, 78, 1); | ||
166 | + opacity: 1; | ||
167 | + border-radius: 8rpx; | ||
168 | + color:#fff; | ||
169 | + font-size: 32rpx; | ||
170 | + text-align: center; | ||
171 | + line-height: 88rpx; | ||
172 | + margin:0 auto; | ||
173 | +} | ||
174 | +.evalutepage{ | ||
175 | + padding-bottom: 150rpx; | ||
176 | +} |
pages/goodkind/goodkind.js
0 → 100644
1 | +// pages/goodkind/goodkind.js | ||
2 | +const app = getApp() | ||
3 | +Page({ | ||
4 | + | ||
5 | + /** | ||
6 | + * 页面的初始数据 | ||
7 | + */ | ||
8 | + data: { | ||
9 | + goodkind: [], | ||
10 | + sel: 0, | ||
11 | + page: 1, | ||
12 | + categories_id: '', | ||
13 | + kindgoodlist: [], | ||
14 | + keyword: '' | ||
15 | + }, | ||
16 | + | ||
17 | + /** | ||
18 | + * 生命周期函数--监听页面加载 | ||
19 | + */ | ||
20 | + onLoad: function(options) { | ||
21 | + | ||
22 | + }, | ||
23 | + enterword(e) { | ||
24 | + this.setData({ | ||
25 | + keyword: e.detail.value | ||
26 | + }) | ||
27 | + }, | ||
28 | + sousuo(){ | ||
29 | + if(this.data.keyword==''){ | ||
30 | + wx.showToast({ | ||
31 | + title: '请输入商品/关键词', | ||
32 | + icon:'none' | ||
33 | + }) | ||
34 | + }else{ | ||
35 | + this.setData({ | ||
36 | + page:1, | ||
37 | + kindgoodlist:[] | ||
38 | + }) | ||
39 | + | ||
40 | + this.getfenleikind() | ||
41 | + } | ||
42 | + }, | ||
43 | + | ||
44 | + //获取分类 | ||
45 | + getkind() { | ||
46 | + let that = this; | ||
47 | + var url = 'sundry/get_category'; | ||
48 | + | ||
49 | + app.post(url, '').then((res) => { | ||
50 | + console.log(res); | ||
51 | + that.setData({ | ||
52 | + goodkind: res, | ||
53 | + categories_id: res[0].id | ||
54 | + }) | ||
55 | + | ||
56 | + that.getfenleikind() | ||
57 | + | ||
58 | + | ||
59 | + | ||
60 | + }).catch((err) => { | ||
61 | + | ||
62 | + }) | ||
63 | + }, | ||
64 | + | ||
65 | + //获取分类列表 | ||
66 | + getfenleikind() { | ||
67 | + let that = this; | ||
68 | + var url = 'goods/get_all'; | ||
69 | + var params = { | ||
70 | + keyword: that.data.keyword, | ||
71 | + categories_id: that.data.categories_id, | ||
72 | + page: that.data.page, | ||
73 | + pageNum: 10 | ||
74 | + } | ||
75 | + app.post(url, params).then((res) => { | ||
76 | + console.log(res); | ||
77 | + that.setData({ | ||
78 | + kindgoodlist: that.data.kindgoodlist.concat(res) | ||
79 | + }) | ||
80 | + | ||
81 | + | ||
82 | + | ||
83 | + }).catch((err) => { | ||
84 | + | ||
85 | + }) | ||
86 | + }, | ||
87 | + | ||
88 | + goodtail(e) { | ||
89 | + let token = wx.getStorageSync("token"); | ||
90 | + if (token == '') { | ||
91 | + wx.showToast({ | ||
92 | + title: '请先登录', | ||
93 | + icon: 'none' | ||
94 | + }) | ||
95 | + | ||
96 | + setTimeout(function () { | ||
97 | + wx.navigateTo({ | ||
98 | + url: '/pages/login/login', | ||
99 | + }) | ||
100 | + }, 1500) | ||
101 | + }else{ | ||
102 | + let id = e.currentTarget.dataset.id; | ||
103 | + wx.navigateTo({ | ||
104 | + url: '/pages/goodtail/goodtail?goodid=' + id, | ||
105 | + }) | ||
106 | + } | ||
107 | + | ||
108 | + }, | ||
109 | + goodsel(e) { | ||
110 | + this.setData({ | ||
111 | + sel: e.currentTarget.dataset.index, | ||
112 | + categories_id: e.currentTarget.dataset.id, | ||
113 | + page: 1, | ||
114 | + kindgoodlist: [] | ||
115 | + }) | ||
116 | + | ||
117 | + console.log(this.data.categories_id) | ||
118 | + | ||
119 | + this.getfenleikind() | ||
120 | + }, | ||
121 | + | ||
122 | + /** | ||
123 | + * 生命周期函数--监听页面初次渲染完成 | ||
124 | + */ | ||
125 | + onReady: function() { | ||
126 | + | ||
127 | + }, | ||
128 | + | ||
129 | + /** | ||
130 | + * 生命周期函数--监听页面显示 | ||
131 | + */ | ||
132 | + onShow: function() { | ||
133 | + this.setData({ | ||
134 | + kindgoodlist: [] | ||
135 | + }) | ||
136 | + this.getkind() | ||
137 | + }, | ||
138 | + | ||
139 | + /** | ||
140 | + * 生命周期函数--监听页面隐藏 | ||
141 | + */ | ||
142 | + onHide: function() { | ||
143 | + | ||
144 | + }, | ||
145 | + | ||
146 | + /** | ||
147 | + * 生命周期函数--监听页面卸载 | ||
148 | + */ | ||
149 | + onUnload: function() { | ||
150 | + | ||
151 | + }, | ||
152 | + | ||
153 | + /** | ||
154 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
155 | + */ | ||
156 | + onPullDownRefresh: function() { | ||
157 | + | ||
158 | + }, | ||
159 | + | ||
160 | + /** | ||
161 | + * 页面上拉触底事件的处理函数 | ||
162 | + */ | ||
163 | + onReachBottom: function() { | ||
164 | + let newpage = this.data.page; | ||
165 | + newpage++; | ||
166 | + this.setData({ | ||
167 | + page: newpage, | ||
168 | + | ||
169 | + }) | ||
170 | + | ||
171 | + this.getfenleikind() | ||
172 | + }, | ||
173 | + | ||
174 | + /** | ||
175 | + * 用户点击右上角分享 | ||
176 | + */ | ||
177 | + onShareAppMessage: function() { | ||
178 | + | ||
179 | + } | ||
180 | +}) |
pages/goodkind/goodkind.json
0 → 100644
pages/goodkind/goodkind.wxml
0 → 100644
1 | +<view class="searchhead"> | ||
2 | + <view class="searchheadleft"> | ||
3 | + <view class="searchboxleft"> | ||
4 | + <image src="/img/sousuo.png"></image> | ||
5 | + </view> | ||
6 | + <view class="searchleftcontent"> | ||
7 | + <input placeholder='请输入商品/赠品关键字' bindinput="enterword" /> | ||
8 | + </view> | ||
9 | + | ||
10 | + </view> | ||
11 | + | ||
12 | + <view class="searchheadright" bindtap="sousuo"> | ||
13 | + 搜索 | ||
14 | + </view> | ||
15 | +</view> | ||
16 | + | ||
17 | +<view class="goodkindbox"> | ||
18 | + <view class="goodkindleft"> | ||
19 | + <view class="goodkindleftitem {{sel==index?'goodsel':''}}" wx:for="{{goodkind}}" wx:key="" bindtap="goodsel" data-index="{{index}}" data-id="{{item.id}}">{{item.categories_name}}</view> | ||
20 | + </view> | ||
21 | + | ||
22 | + <view class="nodataw" wx:if="{{kindgoodlist.length==0}}">暂无数据</view> | ||
23 | + | ||
24 | + <view class="goodkindright" wx:else> | ||
25 | + <view class="goodkindrightitem" wx:for="{{kindgoodlist}}" wx:key="" bindtap="goodtail" data-id="{{item.id}}"> | ||
26 | + | ||
27 | + <view class="goodkindbox"> | ||
28 | + <view class='goodkindrightitemleft'> | ||
29 | + <view class="goodkindleftimg"> | ||
30 | + <image src="{{item.image}}"></image> | ||
31 | + </view> | ||
32 | + <view class="xiename"> | ||
33 | + <view class="xienameleft"> | ||
34 | + <image src="/img/good.png"></image> | ||
35 | + </view> | ||
36 | + <view class="goodname">{{item.goods_name}}</view> | ||
37 | + </view> | ||
38 | + </view> | ||
39 | + <view class="songk"> | ||
40 | + <image src="/img/send.png"></image> | ||
41 | + </view> | ||
42 | + <view class='goodkindrightitemleft'> | ||
43 | + <view class="goodkindleftimg"> | ||
44 | + <image src="{{item.gift.image}}"></image> | ||
45 | + </view> | ||
46 | + <view class="xiename"> | ||
47 | + <view class="xienameleft"> | ||
48 | + <image src="/img/zeng.png"></image> | ||
49 | + </view> | ||
50 | + <view class="goodname">{{item.gift.goods_name}}</view> | ||
51 | + </view> | ||
52 | + </view> | ||
53 | + </view> | ||
54 | + | ||
55 | + | ||
56 | + <view class="goodkindprice"> | ||
57 | + <view class="goodkindpriceleft"> | ||
58 | + ¥{{item.price}} | ||
59 | + </view> | ||
60 | + <view class="goodkindpriceright" wx:if="{{item.freight==0.00}}">运费:免运费</view> | ||
61 | + <view class="goodkindpriceright" wx:else>运费:{{item.freight}}元</view> | ||
62 | + <view class="zengfreight" wx:if="{{item.gift.freight==0.00}}"> | ||
63 | + <view class="goodkindpriceright">运费:免运费</view> | ||
64 | + </view> | ||
65 | + | ||
66 | + <view class="zengfreight" wx:else> | ||
67 | + <view class="goodkindpriceright">运费:{{item.gift.freight}}元</view> | ||
68 | + </view> | ||
69 | + | ||
70 | + </view> | ||
71 | + | ||
72 | + | ||
73 | + </view> | ||
74 | + | ||
75 | + | ||
76 | + </view> | ||
77 | +</view> |
pages/goodkind/goodkind.wxss
0 → 100644
1 | +page{ | ||
2 | + background: #f9f9f9; | ||
3 | + | ||
4 | +} | ||
5 | +.searchhead{ | ||
6 | + padding:20rpx 32rpx; | ||
7 | + box-sizing: border-box; | ||
8 | + display:flex; | ||
9 | + align-items: center; | ||
10 | + border-bottom:1rpx solid #f5f5f5; | ||
11 | + background: #fff; | ||
12 | + | ||
13 | +} | ||
14 | +.searchheadleft{ | ||
15 | + width:548rpx; | ||
16 | + height:60rpx; | ||
17 | + display:flex; | ||
18 | + align-items: center; | ||
19 | + background: #f9f9f9; | ||
20 | + padding: 0 22rpx; | ||
21 | + box-sizing: border-box | ||
22 | +} | ||
23 | +.searchleftcontent{ | ||
24 | + color:#8C9198; | ||
25 | + font-size: 24rpx; | ||
26 | + margin-left:12rpx; | ||
27 | +} | ||
28 | +.searchheadright{ | ||
29 | + width:126rpx; | ||
30 | + height:60rpx; | ||
31 | + background: #EEEEEE; | ||
32 | + text-align: center; | ||
33 | + line-height: 60rpx; | ||
34 | + color:#3D444D; | ||
35 | + font-size: 24rpx; | ||
36 | + margin-left:12rpx; | ||
37 | + | ||
38 | +} | ||
39 | +.goodkindleft{ | ||
40 | + width:218rpx; | ||
41 | + padding: 48rpx 30rpx; | ||
42 | + box-sizing: border-box; | ||
43 | + background: #fff; | ||
44 | + height:1104rpx; | ||
45 | + overflow-y: scroll; | ||
46 | + | ||
47 | + | ||
48 | +} | ||
49 | +.goodkindleftitem{ | ||
50 | + width:138rpx; | ||
51 | + color:#5B5E63; | ||
52 | + font-size: 32rpx; | ||
53 | + margin-bottom:60rpx; | ||
54 | + text-align: center | ||
55 | +} | ||
56 | +.goodkindleftimg{ | ||
57 | + width:212rpx; | ||
58 | + height:212rpx; | ||
59 | + font-size: 0 | ||
60 | +} | ||
61 | +.goodkindleftimg image{ | ||
62 | + width:100%; | ||
63 | + height:100%; | ||
64 | +} | ||
65 | +.goodkindright{ | ||
66 | + padding: 12rpx; | ||
67 | + box-sizing: border-box; | ||
68 | + background: #F9F9F9; | ||
69 | + height:1104rpx; | ||
70 | + overflow-y: scroll; | ||
71 | + overflow-x: hidden | ||
72 | +} | ||
73 | +.goodkindrightitem{ | ||
74 | + | ||
75 | + background: #fff; | ||
76 | + width:528rpx; | ||
77 | + padding: 24rpx 32rpx; | ||
78 | + box-sizing: border-box; | ||
79 | + margin-bottom:16rpx; | ||
80 | + | ||
81 | +} | ||
82 | +.goodkindbox{ | ||
83 | + display:flex; | ||
84 | +} | ||
85 | +.goodkindrightitem:last-child{ | ||
86 | + margin-bottom:0 | ||
87 | +} | ||
88 | +.songk{ | ||
89 | + width:32rpx; | ||
90 | + height:32rpx; | ||
91 | + font-size: 0; | ||
92 | + margin-top:90rpx; | ||
93 | +} | ||
94 | +.songk image{ | ||
95 | + width:100%; | ||
96 | + height:100%; | ||
97 | +} | ||
98 | +.goodkindbox{ | ||
99 | + display:flex; | ||
100 | + | ||
101 | +} | ||
102 | +.goodkindprice{ | ||
103 | + display:flex; | ||
104 | + align-items: center; | ||
105 | + margin-top:18rpx; | ||
106 | +} | ||
107 | +.goodkindpriceleft{ | ||
108 | + color:#FF5A4E; | ||
109 | + font-size:28rpx; | ||
110 | + font-weight:bold; | ||
111 | +} | ||
112 | +.goodkindpriceright{ | ||
113 | + color:#3D444D; | ||
114 | + font-size: 24rpx; | ||
115 | + margin-left:8rpx; | ||
116 | +} | ||
117 | +.goodsel{ | ||
118 | + width:138rpx; | ||
119 | + color:#06121E; | ||
120 | + font-size: 32rpx; | ||
121 | + font-weight: bold; | ||
122 | + position: relative; | ||
123 | +} | ||
124 | +.goodsel::after{ | ||
125 | + content:''; | ||
126 | + display:block; | ||
127 | + width:64rpx; | ||
128 | + height:4rpx; | ||
129 | + background:#FF5A4E; | ||
130 | + border-radius: 44rpx; | ||
131 | + position: absolute; | ||
132 | + left:50%; | ||
133 | + transform: translateX(-50%); | ||
134 | + bottom:-10rpx; | ||
135 | + | ||
136 | +} | ||
137 | +.zengfreight{ | ||
138 | + display:felx; | ||
139 | + justify-content: flex-end | ||
140 | +} | ||
141 | +.nodataw{ | ||
142 | + width:528rpx; | ||
143 | + text-align: center; | ||
144 | + color:#999; | ||
145 | + font-size: 30rpx; | ||
146 | + margin-top:185rpx; | ||
147 | +} | ||
148 | + /* .goodsel ::before{ | ||
149 | + display:block; | ||
150 | + content:''; | ||
151 | + width:64rpx; | ||
152 | + height:4rpx; | ||
153 | + border-radius: 44rpx; | ||
154 | + background: #FF5A4E; | ||
155 | + position: absolute; | ||
156 | + left:0; | ||
157 | + | ||
158 | + | ||
159 | +} */ | ||
160 | +.zengfreight{ | ||
161 | + margin-left:40rpx; | ||
162 | +} |
pages/goodtail/goodtail.js
0 → 100644
1 | +// pages/goodtail/goodtail.js | ||
2 | + | ||
3 | +var WxParse = require('../../wxParse/wxParse.js'); | ||
4 | +const app = getApp() | ||
5 | +Page({ | ||
6 | + | ||
7 | + /** | ||
8 | + * 页面的初始数据 | ||
9 | + */ | ||
10 | + data: { | ||
11 | + imgUrls: [ | ||
12 | + | ||
13 | + ], | ||
14 | + indicatorDots: false, | ||
15 | + autoplay: false, | ||
16 | + interval: 2000, | ||
17 | + duration: 1000, | ||
18 | + currentSwiper: 0, | ||
19 | + ping: 1, | ||
20 | + goodid: '', | ||
21 | + goodtail: '', | ||
22 | + page: 1, | ||
23 | + commentlist: [], | ||
24 | + count: 0, | ||
25 | + totalping: 0, | ||
26 | + giftstandard: '请选择规格', | ||
27 | + standard: '请选择规格', | ||
28 | + standardarr:[], | ||
29 | + giftstandardarr:[], | ||
30 | + buynum:1 | ||
31 | + | ||
32 | + }, | ||
33 | + | ||
34 | + /** | ||
35 | + * 生命周期函数--监听页面加载 | ||
36 | + */ | ||
37 | + onLoad: function(options) { | ||
38 | + this.setData({ | ||
39 | + goodid: options.goodid, | ||
40 | + page: 1, | ||
41 | + commentlist: [] | ||
42 | + | ||
43 | + | ||
44 | + }) | ||
45 | + this.getgoodtail(); | ||
46 | + this.getgoodcomment() | ||
47 | + //获取气泡 | ||
48 | + this.getqipao() | ||
49 | + }, | ||
50 | + | ||
51 | + gocart() { | ||
52 | + wx.switchTab({ | ||
53 | + | ||
54 | + url: '/pages/cart/cart', | ||
55 | + }) | ||
56 | + }, | ||
57 | + | ||
58 | + //获取购物车气泡 | ||
59 | + getqipao() { | ||
60 | + let that = this; | ||
61 | + var url = 'car/bubble'; | ||
62 | + var params = {} | ||
63 | + app.post(url, '').then((res) => { | ||
64 | + console.log(res); | ||
65 | + this.setData({ | ||
66 | + count: res.count | ||
67 | + }) | ||
68 | + | ||
69 | + | ||
70 | + }).catch((err) => { | ||
71 | + | ||
72 | + }) | ||
73 | + }, | ||
74 | + | ||
75 | + getgoodtail() { | ||
76 | + let that = this; | ||
77 | + var url = 'goods/get_one'; | ||
78 | + var params = { | ||
79 | + goods_id: that.data.goodid, | ||
80 | + | ||
81 | + } | ||
82 | + app.post(url, params).then((res) => { | ||
83 | + console.log(res); | ||
84 | + that.setData({ | ||
85 | + imgUrls: res.images, | ||
86 | + goodtail: res, | ||
87 | + | ||
88 | + }) | ||
89 | + | ||
90 | + that.data.goodtail.standard.forEach(function(value, index, array) { | ||
91 | + value.selindex = -1, | ||
92 | + value.selname = '' | ||
93 | + }) | ||
94 | + | ||
95 | + that.data.goodtail.gift.standard.forEach(function(value, index, array) { | ||
96 | + value.selindex = -1, | ||
97 | + value.selname = '' | ||
98 | + }) | ||
99 | + that.setData({ | ||
100 | + goodtail: that.data.goodtail | ||
101 | + }) | ||
102 | + // WxParse.wxParse('article', 'html', res.content, that, 5); | ||
103 | + }).catch((err) => { | ||
104 | + | ||
105 | + }) | ||
106 | + }, | ||
107 | + reducenum(){ | ||
108 | + this.data.buynum=this.data.buynum-1; | ||
109 | + if(this.data.buynum==1){ | ||
110 | + this.setData({ | ||
111 | + buynum:this.data.buynum | ||
112 | + }) | ||
113 | + } | ||
114 | + }, | ||
115 | + addnum(){ | ||
116 | + this.data.buynum = this.data.buynum +1; | ||
117 | + this.setData({ | ||
118 | + buynum: this.data.buynum | ||
119 | + }) | ||
120 | + }, | ||
121 | + | ||
122 | + selattr(e) { | ||
123 | + let that = this; | ||
124 | + console.log(e) | ||
125 | + let index = e.currentTarget.dataset.index; | ||
126 | + let attrindex = e.currentTarget.dataset.bindex; | ||
127 | + let name=e.currentTarget.dataset.name | ||
128 | + console.log(index); | ||
129 | + console.log(attrindex) | ||
130 | + that.data.standardarr.push(name) | ||
131 | + that.data.goodtail.standard[attrindex].selindex = index; | ||
132 | + that.data.goodtail.standard[attrindex].selname = name; | ||
133 | + | ||
134 | + that.setData({ | ||
135 | + goodtail: that.data.goodtail, | ||
136 | + standardarr: that.data.standardarr | ||
137 | + }) | ||
138 | + console.log(that.data.goodtail) | ||
139 | + console.log(that.data.standardarr) | ||
140 | + }, | ||
141 | + selgiftattr(e){ | ||
142 | + let that = this; | ||
143 | + console.log(e) | ||
144 | + let index = e.currentTarget.dataset.index; | ||
145 | + let attrindex = e.currentTarget.dataset.bindex; | ||
146 | + let name = e.currentTarget.dataset.name | ||
147 | + console.log(index); | ||
148 | + console.log(attrindex) | ||
149 | + that.data.giftstandardarr.push(name) | ||
150 | + that.data.goodtail.gift.standard[attrindex].selindex = index; | ||
151 | + that.data.goodtail.gift.standard[attrindex].selname = name; | ||
152 | + | ||
153 | + that.setData({ | ||
154 | + goodtail: that.data.goodtail, | ||
155 | + giftstandardarr: that.data.giftstandardarr | ||
156 | + }) | ||
157 | + console.log(that.data.goodtail) | ||
158 | + console.log(that.data.giftstandardarr) | ||
159 | + }, | ||
160 | + //加入购物车 | ||
161 | + addcart() { | ||
162 | + let that = this; | ||
163 | + var url = 'car/update_car'; | ||
164 | + var params = { | ||
165 | + goods_id: that.data.goodid, | ||
166 | + type: 1, | ||
167 | + goods_standard:that.data.standardarr.join(","), | ||
168 | + give_standard: that.data.giftstandardarr.join(",") | ||
169 | + | ||
170 | + } | ||
171 | + app.post(url, params).then((res) => { | ||
172 | + console.log(res); | ||
173 | + wx.showToast({ | ||
174 | + title: '添加购物车成功', | ||
175 | + icon: 'none' | ||
176 | + }) | ||
177 | + that.getqipao() | ||
178 | + | ||
179 | + | ||
180 | + | ||
181 | + }).catch((err) => { | ||
182 | + wx.showToast({ | ||
183 | + title: err.msg, | ||
184 | + icon: 'none' | ||
185 | + }) | ||
186 | + | ||
187 | + }) | ||
188 | + }, | ||
189 | + | ||
190 | + //跳入赠品详情 | ||
191 | + gogift() { | ||
192 | + wx.redirectTo({ | ||
193 | + url: '/pages/giftdetail/giftdetail?goodid=' + this.data.goodid, | ||
194 | + }) | ||
195 | + }, | ||
196 | + | ||
197 | + //获取商品评论 | ||
198 | + getgoodcomment() { | ||
199 | + let that = this; | ||
200 | + var url = 'comment/get_all'; | ||
201 | + var params = { | ||
202 | + goods_id: that.data.goodid, | ||
203 | + page: that.data.page, | ||
204 | + pageNum: 10 | ||
205 | + | ||
206 | + | ||
207 | + } | ||
208 | + app.post(url, params).then((res) => { | ||
209 | + console.log(res); | ||
210 | + that.setData({ | ||
211 | + commentlist: that.data.commentlist.concat(res.data), | ||
212 | + totalping: res.total | ||
213 | + }) | ||
214 | + | ||
215 | + console.log(that.data.commentlist) | ||
216 | + | ||
217 | + | ||
218 | + | ||
219 | + }).catch((err) => { | ||
220 | + | ||
221 | + }) | ||
222 | + }, | ||
223 | + swiperChange: function(e) { | ||
224 | + this.setData({ | ||
225 | + currentSwiper: e.detail.current | ||
226 | + }) | ||
227 | + }, | ||
228 | + | ||
229 | + comment(e) { | ||
230 | + this.setData({ | ||
231 | + ping: e.currentTarget.dataset.id | ||
232 | + }) | ||
233 | + | ||
234 | + if (this.data.ping == 1) { | ||
235 | + this.getgoodtail() | ||
236 | + } else { | ||
237 | + this.setData({ | ||
238 | + page: 1, | ||
239 | + commentlist: [] | ||
240 | + }) | ||
241 | + | ||
242 | + this.getgoodcomment() | ||
243 | + | ||
244 | + } | ||
245 | + }, | ||
246 | + | ||
247 | + //立即抢购 | ||
248 | + lijiqiang() { | ||
249 | + let that = this; | ||
250 | + var url = 'order/confirm_order'; | ||
251 | + var params = { | ||
252 | + goods_ids: that.data.goodtail.id, | ||
253 | + take_id: '', | ||
254 | + type: 1 | ||
255 | + | ||
256 | + } | ||
257 | + app.post(url, params).then((res) => { | ||
258 | + console.log(res); | ||
259 | + let orderarr = res.goods; | ||
260 | + for (var obj of orderarr) { | ||
261 | + obj.content = ''; | ||
262 | + obj.gift.content = '' | ||
263 | + } | ||
264 | + | ||
265 | + let neworderarr = JSON.stringify(orderarr) | ||
266 | + let freight = res.freight; | ||
267 | + let price = res.price; | ||
268 | + let total = res.total; | ||
269 | + | ||
270 | + | ||
271 | + console.log(freight); | ||
272 | + console.log(price); | ||
273 | + console.log(total); | ||
274 | + console.log(orderarr); | ||
275 | + | ||
276 | + wx.navigateTo({ | ||
277 | + url: '/pages/sureorder/sureorder?orderarr=' + neworderarr + '&freight=' + freight + '&price=' + price + '&total=' + total + '&type=' + 1, | ||
278 | + }) | ||
279 | + | ||
280 | + | ||
281 | + }).catch((err) => { | ||
282 | + wx.showToast({ | ||
283 | + title: err.msg, | ||
284 | + icon: 'none' | ||
285 | + }) | ||
286 | + }) | ||
287 | + }, | ||
288 | + /** | ||
289 | + * 生命周期函数--监听页面初次渲染完成 | ||
290 | + */ | ||
291 | + onReady: function() { | ||
292 | + | ||
293 | + }, | ||
294 | + | ||
295 | + /** | ||
296 | + * 生命周期函数--监听页面显示 | ||
297 | + */ | ||
298 | + onShow: function() { | ||
299 | + | ||
300 | + }, | ||
301 | + | ||
302 | + /** | ||
303 | + * 生命周期函数--监听页面隐藏 | ||
304 | + */ | ||
305 | + onHide: function() { | ||
306 | + | ||
307 | + }, | ||
308 | + | ||
309 | + /** | ||
310 | + * 生命周期函数--监听页面卸载 | ||
311 | + */ | ||
312 | + onUnload: function() { | ||
313 | + | ||
314 | + }, | ||
315 | + | ||
316 | + /** | ||
317 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
318 | + */ | ||
319 | + onPullDownRefresh: function() { | ||
320 | + | ||
321 | + }, | ||
322 | + | ||
323 | + /** | ||
324 | + * 页面上拉触底事件的处理函数 | ||
325 | + */ | ||
326 | + onReachBottom: function() { | ||
327 | + if (this.data.ping == 2) { | ||
328 | + let newpage = this.data.page; | ||
329 | + newpage++; | ||
330 | + this.setData({ | ||
331 | + page: newpage | ||
332 | + }) | ||
333 | + | ||
334 | + this.getgoodcomment() | ||
335 | + } | ||
336 | + | ||
337 | + }, | ||
338 | + | ||
339 | + /** | ||
340 | + * 用户点击右上角分享 | ||
341 | + */ | ||
342 | + onShareAppMessage: function() { | ||
343 | + | ||
344 | + } | ||
345 | +}) |
pages/goodtail/goodtail.json
0 → 100644
pages/goodtail/goodtail.wxml
0 → 100644
1 | +<import src="../../wxParse/wxParse.wxml" /> | ||
2 | + | ||
3 | +<!-- 转换箭头 --> | ||
4 | +<view class="zhuanhuan" bindtap="gogift"> | ||
5 | + <image src="/img/jump.png"></image> | ||
6 | +</view> | ||
7 | + | ||
8 | + | ||
9 | +<view class="swiper_image"> | ||
10 | + <swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" class="swiper_item_img" bindchange="swiperChange" circular="true"> | ||
11 | + <block wx:for="{{imgUrls}}" wx:key="doct"> | ||
12 | + <swiper-item> | ||
13 | + <image src="{{item}}" data-index='{{index}}' class="slide-image" bindtap='viewImg' width="355" height="150" /> | ||
14 | + </swiper-item> | ||
15 | + </block> | ||
16 | + </swiper> | ||
17 | + | ||
18 | + <view class="bannerdot"> | ||
19 | + <text>{{currentSwiper+1}}</text>/ | ||
20 | + <text>{{imgUrls.length}}</text> | ||
21 | + </view> | ||
22 | + | ||
23 | + <!-- <view class="dots"> | ||
24 | + <block wx:for="{{imgUrls}}" wx:key=""> | ||
25 | + <view class="dot{{index == currentSwiper ? ' active' : ''}}"></view> | ||
26 | + </block> | ||
27 | + </view> --> | ||
28 | + | ||
29 | + | ||
30 | +</view> | ||
31 | +<view class="goodname"> | ||
32 | + <view class="boxgoodrightop"> | ||
33 | + <view class="boxgoodrigtl"> | ||
34 | + <image src="/img/good.png"></image> | ||
35 | + </view> | ||
36 | + {{goodtail.goods_name}} | ||
37 | + </view> | ||
38 | + | ||
39 | + <view class="goodprice"> | ||
40 | + | ||
41 | + <view class="goodpriceleft">¥{{goodtail.price}}</view> | ||
42 | + <view class="goodpriceright" wx:if="{{goodtail.freight=='0.00'}}">运费:免运费</view> | ||
43 | + <view class="goodpriceright" wx:else>运费:{{goodtail.freight}}元</view> | ||
44 | + </view> | ||
45 | +</view> | ||
46 | + | ||
47 | +<!--赠品 --> | ||
48 | +<view class="zenggood" bindtap="gogift"> | ||
49 | + <view class="zenggoodleft"> | ||
50 | + <image src='{{goodtail.gift.image}}'></image> | ||
51 | + </view> | ||
52 | + <view class="zengright"> | ||
53 | + <view class="boxgoodrightop zengname"> | ||
54 | + <view class="boxgoodrigtl"> | ||
55 | + <image src="/img/zeng.png"></image> | ||
56 | + </view> | ||
57 | + {{goodtail.gift.goods_name}} | ||
58 | + </view> | ||
59 | + </view> | ||
60 | +</view> | ||
61 | + | ||
62 | +<!-- 详情和评论 --> | ||
63 | + | ||
64 | +<view class="pingxiang"> | ||
65 | + <view class="pingxiangitem {{ping==1?'pingzctive':''}} " data-id="1" bindtap="comment">详情</view> | ||
66 | + <view class="pingxiangitem {{ping==2?'pingzctive':''}}" data-id="2" bindtap="comment">评论({{totalping}})</view> | ||
67 | +</view> | ||
68 | + | ||
69 | +<view class="pingdetail" wx:if="{{ping==1}}"> | ||
70 | + | ||
71 | + <template is="wxParse" data="{{wxParseData:article.nodes}}" /> | ||
72 | + <!-- <view class="pingdetailimg"> | ||
73 | + <image src="/img/changtu.png"></image> | ||
74 | + </view> --> | ||
75 | + | ||
76 | +</view> | ||
77 | + | ||
78 | +<view class='commentdetail' wx:else> | ||
79 | + | ||
80 | + <view class="nodata" wx:if="{{commentlist.length==0}}">暂无评论</view> | ||
81 | + | ||
82 | + <view wx:else> | ||
83 | + <view class="commentitem" wx:for="{{commentlist}}" wx:key=""> | ||
84 | + <view class="commentitemtop"> | ||
85 | + <view class="commentleft"> | ||
86 | + <view class="commentitemleft"> | ||
87 | + <image src="{{item.avatar}}"></image> | ||
88 | + </view> | ||
89 | + <view class="commentitemright">{{item.nickname}}</view> | ||
90 | + </view> | ||
91 | + | ||
92 | + <view class="commentright">{{item.createtime}}</view> | ||
93 | + | ||
94 | + </view> | ||
95 | + | ||
96 | + <view class="commenttext"> | ||
97 | + {{item.content}} | ||
98 | + </view> | ||
99 | + | ||
100 | + <view class="pingfen"> | ||
101 | + <view class="pingfenleft"> | ||
102 | + <view class="pingfenitem"> | ||
103 | + <image src="{{item.star>=1?'/img/shixing.png':'/img/kongxing.png'}}"></image> | ||
104 | + </view> | ||
105 | + <view class="pingfenitem"> | ||
106 | + <image src="{{item.star>=2?'/img/shixing.png':'/img/kongxing.png'}}"></image> | ||
107 | + </view> | ||
108 | + <view class="pingfenitem"> | ||
109 | + <image src="{{item.star>=3?'/img/shixing.png':'/img/kongxing.png'}}"></image> | ||
110 | + </view> | ||
111 | + <view class="pingfenitem"> | ||
112 | + <image src="{{item.star>=4?'/img/shixing.png':'/img/kongxing.png'}}"></image> | ||
113 | + </view> | ||
114 | + <view class="pingfenitem"> | ||
115 | + <image src="{{item.star>=5?'/img/shixing.png':'/img/kongxing.png'}}"></image> | ||
116 | + </view> | ||
117 | + </view> | ||
118 | + | ||
119 | + <view class="pingfenname">{{item.star}}分</view> | ||
120 | + </view> | ||
121 | + | ||
122 | + <view class="pingimg"> | ||
123 | + <view class="pingimgitem" wx:for="{{item.images}}" wx:key=""> | ||
124 | + <image src="{{item}}"></image> | ||
125 | + </view> | ||
126 | + | ||
127 | + </view> | ||
128 | + </view> | ||
129 | + </view> | ||
130 | + | ||
131 | +</view> | ||
132 | + | ||
133 | +<view class="cartbottom"> | ||
134 | + <view class="cartbottomleft" bindtap="gocart"> | ||
135 | + <view class="cartbototmtopimg"> | ||
136 | + <image src="/img/shop.png"></image> | ||
137 | + <view class="cartnum">{{count}}</view> | ||
138 | + </view> | ||
139 | + | ||
140 | + <view class="gouwucart">购物车</view> | ||
141 | + | ||
142 | + | ||
143 | + </view> | ||
144 | + | ||
145 | + <view class="cartright"> | ||
146 | + <view class="cartleftname" bindtap="addcart">加入购物车</view> | ||
147 | + <view class="qianggou" bindtap="lijiqiang">立即抢购</view> | ||
148 | + </view> | ||
149 | +</view> | ||
150 | + | ||
151 | +<!-- 选择商品属性 --> | ||
152 | +<view class="registerk"> | ||
153 | + <view class="naturewrap"> | ||
154 | + <view class="naturebox"> | ||
155 | + <view class="naturetop flexone"> | ||
156 | + <view class="naturetopleft"> | ||
157 | + <image src="{{goodtail.image}}"></image> | ||
158 | + </view> | ||
159 | + <view class="naturetopright"> | ||
160 | + <view class="goodprice">¥{{goodtail.price}}</view> | ||
161 | + <view class="naturestock">库存:{{goodtail.inventory}}件</view> | ||
162 | + <view class="natureshu">{{standard}}</view> | ||
163 | + </view> | ||
164 | + </view> | ||
165 | + <view class="sizebox"> | ||
166 | + <view class="size" wx:for='{{goodtail.standard}}' wx:key="" wx:for-item="standarditem" wx:if="{{goodtail.standard!=null}}" wx:for-index="bindex" > | ||
167 | + <view class="sizetop">{{standarditem.name}}</view> | ||
168 | + <view class="sizebox flexone"> | ||
169 | + <view class="coloritem {{standarditem.selindex==index?'itemactive':''}}" wx:for='{{standarditem.value}}' wx:key="" bindtap="selattr" data-index="{{index}}" data-bindex="{{bindex}}" data-name="{{item}}">{{item}}</view> | ||
170 | + | ||
171 | + </view> | ||
172 | + </view> | ||
173 | + </view> | ||
174 | + | ||
175 | + | ||
176 | + | ||
177 | + <view class="buynum flextwo"> | ||
178 | + <view class="buymumleft">购买数量</view> | ||
179 | + <view class='buynumright flexone'> | ||
180 | + <view class="buynumreduce" bindtap="reducenum"> | ||
181 | + <image src="/img/buyreduce.png"></image> | ||
182 | + </view> | ||
183 | + <view class="numname">{{buynum}}</view> | ||
184 | + <view class="buynumreduce" bindtap="addnum"> | ||
185 | + <image src="/img/buyadd.png"></image> | ||
186 | + </view> | ||
187 | + </view> | ||
188 | + </view> | ||
189 | + | ||
190 | + <view class="naturetop flexone"> | ||
191 | + <view class="naturetopleft"> | ||
192 | + <image src="{{goodtail.gift.image}}"></image> | ||
193 | + </view> | ||
194 | + <view class="naturetopright"> | ||
195 | + <view class="goodprice">{{goodtail.gift.goods_name}}</view> | ||
196 | + <view class="naturestock">库存:{{goodtail.gift.inventory}}件</view> | ||
197 | + <view class="natureshu">{{giftstandard}}</view> | ||
198 | + </view> | ||
199 | + </view> | ||
200 | + | ||
201 | + <view> | ||
202 | + <view class="size" wx:for="{{goodtail.gift.standard}}" wx:if='{{goodtail.gift.standard!=null}}' wx:for-item="standarditem" wx:for-index="bindex"> | ||
203 | + <view class="sizetop">{{standarditem.name}}</view> | ||
204 | + <view class="sizebox flexone"> | ||
205 | + <view class="coloritem {{standarditem.selindex==index?'itemactive':''}}" wx:for='{{standarditem.value}}' wx:key="" bindtap="selgiftattr" data-index="{{index}}" data-bindex="{{bindex}}" data-name="{{item}}">{{item}}</view> | ||
206 | + | ||
207 | + | ||
208 | + </view> | ||
209 | + </view> | ||
210 | + </view> | ||
211 | + | ||
212 | + </view> | ||
213 | + | ||
214 | + | ||
215 | + <view class="cartbottom boxcartbot"> | ||
216 | + <view class="cartbottomleft" bindtap="gocart"> | ||
217 | + <view class="cartbototmtopimg"> | ||
218 | + <image src="/img/shop.png"></image> | ||
219 | + <view class="cartnum">{{count}}</view> | ||
220 | + </view> | ||
221 | + | ||
222 | + <view class="gouwucart">购物车</view> | ||
223 | + | ||
224 | + | ||
225 | + </view> | ||
226 | + | ||
227 | + <view class="cartright"> | ||
228 | + <view class="cartleftname" bindtap="addcart">加入购物车</view> | ||
229 | + <view class="qianggou" bindtap="lijiqiang">立即抢购</view> | ||
230 | + </view> | ||
231 | + </view> | ||
232 | + | ||
233 | + </view> | ||
234 | +</view> |
pages/goodtail/goodtail.wxss
0 → 100644
1 | +.swiper_image { | ||
2 | + width: 750rpx; | ||
3 | + height: 600rpx; | ||
4 | + font-size: 0; | ||
5 | + position: relative; | ||
6 | + box-shadow: 0px -1px 6px 0px rgba(212, 137, 96, 0.11); | ||
7 | + border-radius: 10px; | ||
8 | +} | ||
9 | + | ||
10 | +.swiper_item_img { | ||
11 | + height: 600rpx; | ||
12 | +} | ||
13 | + | ||
14 | +.swiper_image image { | ||
15 | + width: 100%; | ||
16 | + height: 100%; | ||
17 | + /* box-shadow:0px -1px 6px 0px rgba(212,137,96,0.11); */ | ||
18 | +} | ||
19 | + | ||
20 | +.swiper_item_img swiper-item { | ||
21 | + width: 750rpx; | ||
22 | + height: 600rpx; | ||
23 | + box-shadow: 0px -1px 6px 0px rgba(212, 137, 96, 0.11); | ||
24 | + display: felx; | ||
25 | + align-items: center; | ||
26 | + justify-content: center; | ||
27 | +} | ||
28 | + | ||
29 | +.swiper_item_img swiper-item image { | ||
30 | + width: 100%; | ||
31 | + height: 100%; | ||
32 | +} | ||
33 | + | ||
34 | +.bannerdot { | ||
35 | + width: 84rpx; | ||
36 | + height: 44rpx; | ||
37 | + background: rgba(0, 0, 0, 0.2); | ||
38 | + opacity: 1; | ||
39 | + border-radius: 20rpx; | ||
40 | + color: #fff; | ||
41 | + font-size: 30rpx; | ||
42 | + text-align: center; | ||
43 | + position: absolute; | ||
44 | + bottom: 24rpx; | ||
45 | + right: 28rpx; | ||
46 | +} | ||
47 | + | ||
48 | +.boxgoodrightop { | ||
49 | + color: #06121e; | ||
50 | + font-size: 28rpx; | ||
51 | + font-weight: bold; | ||
52 | + position: relative; | ||
53 | + padding-left: 64rpx; | ||
54 | + box-sizing: border-box; | ||
55 | +} | ||
56 | + | ||
57 | +.boxgoodrigtl { | ||
58 | + width: 52rpx; | ||
59 | + height: 28rpx; | ||
60 | + font-size: 0; | ||
61 | + position: absolute; | ||
62 | + top: 6rpx; | ||
63 | + left: 0; | ||
64 | +} | ||
65 | + | ||
66 | +.boxgoodrigtl image { | ||
67 | + width: 100%; | ||
68 | + height: 100%; | ||
69 | +} | ||
70 | + | ||
71 | +.orderdetailboxgood { | ||
72 | + display: flex; | ||
73 | +} | ||
74 | + | ||
75 | +.boxgoodright { | ||
76 | + margin-left: 24rpx; | ||
77 | +} | ||
78 | + | ||
79 | +.boxgoodrigbot { | ||
80 | + display: flex; | ||
81 | + align-items: center; | ||
82 | + margin-top: 66rpx; | ||
83 | +} | ||
84 | + | ||
85 | +.boxgoodrmoney { | ||
86 | + color: #ea322b; | ||
87 | + font-size: 32rpx; | ||
88 | +} | ||
89 | + | ||
90 | +.boxgoodnum { | ||
91 | + color: #3d444d; | ||
92 | + font-size: 24rpx; | ||
93 | + margin-left: 16rpx; | ||
94 | +} | ||
95 | + | ||
96 | +.goodname { | ||
97 | + padding: 38rpx 32rpx; | ||
98 | + box-sizing: border-box; | ||
99 | + border-bottom: 24rpx solid #f5f5f5; | ||
100 | +} | ||
101 | + | ||
102 | +.goodprice { | ||
103 | + display: flex; | ||
104 | + align-items: center; | ||
105 | + justify-content: space-between; | ||
106 | + margin-top: 15rpx; | ||
107 | +} | ||
108 | + | ||
109 | +.goodpriceleft { | ||
110 | + color: #ea322b; | ||
111 | + font-size: 36rpx; | ||
112 | +} | ||
113 | + | ||
114 | +.goodpriceright { | ||
115 | + color: #3d444d; | ||
116 | + font-size: 28rpx; | ||
117 | +} | ||
118 | + | ||
119 | +.zenggood { | ||
120 | + display: flex; | ||
121 | + padding: 28rpx; | ||
122 | + box-sizing: border-box; | ||
123 | + border-bottom: 24rpx solid #f9f9f9; | ||
124 | +} | ||
125 | + | ||
126 | +.zenggoodleft { | ||
127 | + width: 144rpx; | ||
128 | + height: 144rpx; | ||
129 | + font-size: 0; | ||
130 | + border-radius: 8rpx; | ||
131 | +} | ||
132 | + | ||
133 | +.zenggoodleft image { | ||
134 | + width: 100%; | ||
135 | + height: 100%; | ||
136 | + border-radius: 8rpx; | ||
137 | +} | ||
138 | + | ||
139 | +.zengname { | ||
140 | + color: #5b5e63; | ||
141 | + font-size: 24rpx; | ||
142 | + width: 522rpx; | ||
143 | + margin-left: 28rpx; | ||
144 | +} | ||
145 | + | ||
146 | +.pingxiang { | ||
147 | + display: flex; | ||
148 | + align-items: center; | ||
149 | + padding: 24rpx 36rpx; | ||
150 | + box-sizing: border-box; | ||
151 | +} | ||
152 | + | ||
153 | +.pingxiangitem { | ||
154 | + color: #232323; | ||
155 | + font-size: 28rpx; | ||
156 | + margin-right: 70rpx; | ||
157 | +} | ||
158 | + | ||
159 | +.pingzctive { | ||
160 | + color: #ff5a4e; | ||
161 | + font-size: 28rpx; | ||
162 | + position: relative; | ||
163 | +} | ||
164 | + | ||
165 | +.commentdetail { | ||
166 | + padding-bottom: 159rpx; | ||
167 | +} | ||
168 | + | ||
169 | +.pingzctive::after { | ||
170 | + content: ''; | ||
171 | + display: block; | ||
172 | + width: 80rpx; | ||
173 | + height: 4rpx; | ||
174 | + border-radius: 16rpx; | ||
175 | + background: #ff5a4e; | ||
176 | + position: absolute; | ||
177 | + left: 50%; | ||
178 | + transform: translateX(-50%); | ||
179 | + bottom: -20rpx; | ||
180 | +} | ||
181 | + | ||
182 | +.pingdetail { | ||
183 | + padding: 24rpx; | ||
184 | + box-sizing: border-box; | ||
185 | + padding-bottom: 159rpx; | ||
186 | +} | ||
187 | + | ||
188 | +.pingdetailimg { | ||
189 | + width: 750rpx; | ||
190 | + height: 2474rpx; | ||
191 | + font-size: 0; | ||
192 | +} | ||
193 | + | ||
194 | +.pingdetailimg image { | ||
195 | + width: 100%; | ||
196 | + height: 100%; | ||
197 | +} | ||
198 | + | ||
199 | +.commentitem { | ||
200 | + padding: 0 26rpx 36rpx; | ||
201 | + box-sizing: border-box; | ||
202 | +} | ||
203 | + | ||
204 | +.commentitemtop { | ||
205 | + display: flex; | ||
206 | + align-items: center; | ||
207 | + justify-content: space-between; | ||
208 | + padding: 20rpx 0 16rpx; | ||
209 | + box-sizing: border-box; | ||
210 | +} | ||
211 | + | ||
212 | +.commentitemleft { | ||
213 | + width: 84rpx; | ||
214 | + height: 84rpx; | ||
215 | + border-radius: 50%; | ||
216 | +} | ||
217 | + | ||
218 | +.commentitemleft image { | ||
219 | + width: 100%; | ||
220 | + height: 100%; | ||
221 | + border-radius: 50%; | ||
222 | +} | ||
223 | + | ||
224 | +.commentleft { | ||
225 | + display: flex; | ||
226 | + align-items: center; | ||
227 | +} | ||
228 | + | ||
229 | +.commentitemright { | ||
230 | + color: #8c9198; | ||
231 | + font-size: 28rpx; | ||
232 | + margin-left: 18rpx; | ||
233 | +} | ||
234 | + | ||
235 | +.commentright { | ||
236 | + color: #3d444d; | ||
237 | + font-size: 24rpx; | ||
238 | +} | ||
239 | + | ||
240 | +.commenttext { | ||
241 | + color: #5b5e63; | ||
242 | + font-size: 24rpx; | ||
243 | +} | ||
244 | + | ||
245 | +.pingfenleft { | ||
246 | + display: flex; | ||
247 | + align-items: center; | ||
248 | +} | ||
249 | + | ||
250 | +.pingfenitem { | ||
251 | + width: 37rpx; | ||
252 | + height: 37rpx; | ||
253 | + font-size: 0; | ||
254 | + margin-right: 32rpx; | ||
255 | +} | ||
256 | + | ||
257 | +.pingfenitem image { | ||
258 | + width: 100%; | ||
259 | + height: 100%; | ||
260 | +} | ||
261 | + | ||
262 | +.pingfen { | ||
263 | + display: flex; | ||
264 | + align-items: center; | ||
265 | + margin-top: 24rpx; | ||
266 | +} | ||
267 | + | ||
268 | +.pingfenname { | ||
269 | + color: #ff5a4e; | ||
270 | + font-size: 26rpx; | ||
271 | + margin-left: 8rpx; | ||
272 | +} | ||
273 | + | ||
274 | +.pingimg { | ||
275 | + display: flex; | ||
276 | + align-items: center; | ||
277 | + margin-top: 24rpx; | ||
278 | +} | ||
279 | + | ||
280 | +.pingimgitem { | ||
281 | + width: 154rpx; | ||
282 | + height: 154rpx; | ||
283 | + font-size: 0; | ||
284 | + margin-right: 24rpx; | ||
285 | +} | ||
286 | + | ||
287 | +.pingimgitem image { | ||
288 | + width: 100%; | ||
289 | + height: 100%; | ||
290 | +} | ||
291 | + | ||
292 | +.zhuanhuan { | ||
293 | + position: fixed; | ||
294 | + top: 583rpx; | ||
295 | + right: 46rpx; | ||
296 | + width: 80rpx; | ||
297 | + height: 80rpx; | ||
298 | + font-size: 0; | ||
299 | + z-index: 7; | ||
300 | +} | ||
301 | + | ||
302 | +.zhuanhuan image { | ||
303 | + width: 100%; | ||
304 | + height: 100%; | ||
305 | +} | ||
306 | + | ||
307 | +.cartbottom { | ||
308 | + width: 750rpx; | ||
309 | + height: 104rpx; | ||
310 | + background: #fff; | ||
311 | + position: fixed; | ||
312 | + bottom: 0; | ||
313 | + left: 0; | ||
314 | + padding: 14rpx 32rpx; | ||
315 | + box-sizing: border-box; | ||
316 | + display: flex; | ||
317 | + align-items: center; | ||
318 | + justify-content: space-between; | ||
319 | +} | ||
320 | + | ||
321 | +.cartbottomleft { | ||
322 | + display: felx; | ||
323 | + flex-direction: column; | ||
324 | + justify-content: center; | ||
325 | + align-items: center; | ||
326 | +} | ||
327 | + | ||
328 | +.cartleftname { | ||
329 | + width: 212rpx; | ||
330 | + height: 77rpx; | ||
331 | + background: rgba(255, 90, 78, 1); | ||
332 | + opacity: 1; | ||
333 | + border-radius: 20rpx 4rpx 4rpx 20rpx; | ||
334 | + color: #fff; | ||
335 | + font-size: 28rpx; | ||
336 | + text-align: center; | ||
337 | + line-height: 77rpx; | ||
338 | + margin-right: 12rpx; | ||
339 | +} | ||
340 | + | ||
341 | +.qianggou { | ||
342 | + width: 180rpx; | ||
343 | + height: 77rpx; | ||
344 | + background: rgba(255, 90, 78, 1); | ||
345 | + opacity: 1; | ||
346 | + color: #fff; | ||
347 | + font-size: 28rpx; | ||
348 | + text-align: center; | ||
349 | + line-height: 77rpx; | ||
350 | + border-radius: 4rpx 20rpx 20rpx 4rpx; | ||
351 | +} | ||
352 | + | ||
353 | +.cartright { | ||
354 | + display: flex; | ||
355 | + align-items: center; | ||
356 | +} | ||
357 | + | ||
358 | +.cartbototmtopimg { | ||
359 | + width: 48rpx; | ||
360 | + height: 48rpx; | ||
361 | + font-size: 0; | ||
362 | + position: relative; | ||
363 | + margin-left: 8rpx; | ||
364 | +} | ||
365 | + | ||
366 | +.cartbototmtopimg image { | ||
367 | + width: 100%; | ||
368 | + height: 100%; | ||
369 | +} | ||
370 | + | ||
371 | +.cartnum { | ||
372 | + width: 24rpx; | ||
373 | + height: 24rpx; | ||
374 | + background: #ff0001; | ||
375 | + border-radius: 50%; | ||
376 | + color: #fff; | ||
377 | + font-size: 20rpx; | ||
378 | + text-align: center; | ||
379 | + line-height: 24rpx; | ||
380 | + position: absolute; | ||
381 | + right: -5rpx; | ||
382 | + top: -5rpx; | ||
383 | +} | ||
384 | + | ||
385 | +.gouwucart { | ||
386 | + color: #3d444d; | ||
387 | + font-size: 20rpx; | ||
388 | + text-align: center; | ||
389 | + margin-top: 8rpx; | ||
390 | +} | ||
391 | + | ||
392 | +.wxParse-p { | ||
393 | + display: flex; | ||
394 | + flex-direction: column; | ||
395 | + justify-content: center; | ||
396 | + align-items: center; | ||
397 | +} | ||
398 | + | ||
399 | +.wxParse-p image { | ||
400 | + display: block; | ||
401 | +} | ||
402 | + | ||
403 | +.naturewrap { | ||
404 | + width: 750rpx; | ||
405 | + height: 1150rpx; | ||
406 | + background: rgba(255, 255, 255, 1); | ||
407 | + opacity: 1; | ||
408 | + border-radius: 20rpx 20rpx 0rpx 0rpx; | ||
409 | + position: absolute; | ||
410 | + bottom: 0; | ||
411 | + left: 0; | ||
412 | + z-index: 999; | ||
413 | + padding: 48rpx 32rpx; | ||
414 | + box-sizing: border-box; | ||
415 | + overflow-y: scroll | ||
416 | +} | ||
417 | + | ||
418 | +.naturetopleft { | ||
419 | + width: 156rpx; | ||
420 | + height: 156rpx; | ||
421 | + font-size: 0; | ||
422 | +} | ||
423 | + | ||
424 | +.naturetopright { | ||
425 | + margin-left: 28rpx; | ||
426 | +} | ||
427 | + | ||
428 | +.goodprice { | ||
429 | + color: #ea322b; | ||
430 | + font-size: 36rpx; | ||
431 | + font-weight: bold; | ||
432 | +} | ||
433 | + | ||
434 | +.naturestock { | ||
435 | + color: #8c9198; | ||
436 | + font-size: 28rpx; | ||
437 | + margin-top: 16rpx; | ||
438 | +} | ||
439 | + | ||
440 | +.natureshu { | ||
441 | + color: #8c9198; | ||
442 | + font-size: 28rpx; | ||
443 | + margin-top: 5rpx; | ||
444 | +} | ||
445 | + | ||
446 | +image { | ||
447 | + width: 100%; | ||
448 | + height: 100%; | ||
449 | +} | ||
450 | + | ||
451 | +.sizeitem { | ||
452 | + width: 88rpx; | ||
453 | + height: 56rpx; | ||
454 | + background: rgba(238, 238, 238, 1); | ||
455 | + opacity: 1; | ||
456 | + border-radius: 8rpx; | ||
457 | + color: #06121e; | ||
458 | + font-size: 24rpx; | ||
459 | + text-align: center; | ||
460 | + line-height: 56rpx; | ||
461 | + margin-right: 20rpx; | ||
462 | + margin-bottom: 16rpx; | ||
463 | +} | ||
464 | + | ||
465 | +.sizebox { | ||
466 | + flex-wrap: wrap; | ||
467 | + margin-top: 28rpx; | ||
468 | +} | ||
469 | + | ||
470 | +.coloritem { | ||
471 | + height:56rpx; | ||
472 | + padding: 12rpx 22rpx; | ||
473 | + box-sizing: border-box; | ||
474 | + background: rgba(238, 238, 238, 1); | ||
475 | + opacity: 1; | ||
476 | + border-radius: 8rpx; | ||
477 | + color:#06121E; | ||
478 | + font-size: 24rpx; | ||
479 | + text-align: center; | ||
480 | + margin-right:20rpx; | ||
481 | + margin-bottom: 16rpx; | ||
482 | + border:1rpx solid transparent; | ||
483 | + | ||
484 | + | ||
485 | +} | ||
486 | +.size{ | ||
487 | + margin-top:36rpx; | ||
488 | +} | ||
489 | +.buynumreduce{ | ||
490 | + width:56rpx; | ||
491 | + height:56rpx; | ||
492 | + font-size: 0 | ||
493 | +} | ||
494 | +.numname{ | ||
495 | + color:#3D444D; | ||
496 | + font-size: 32rpx; | ||
497 | + margin: 0 28rpx; | ||
498 | + height:56rpx; | ||
499 | + line-height: 56rpx; | ||
500 | +} | ||
501 | +.buynum{ | ||
502 | + margin-top:60rpx; | ||
503 | + margin-bottom:60rpx; | ||
504 | + padding-bottom: 60rpx; | ||
505 | + | ||
506 | + border-bottom:1rpx solid #f5f5f5; | ||
507 | + | ||
508 | +} | ||
509 | +.boxcartbot{ | ||
510 | + position: fixed; | ||
511 | + bottom:0; | ||
512 | + left:0; | ||
513 | + background:#fff; | ||
514 | + border-top:1rpx solid #f5f5f5; | ||
515 | +} | ||
516 | +.naturebox{ | ||
517 | + padding-bottom: 150rpx; | ||
518 | +} | ||
519 | +.itemactive{ | ||
520 | + border:1rpx solid #EF4C46; | ||
521 | + color:#EF4C46; | ||
522 | +} |
pages/homepage/homepage.js
0 → 100644
1 | +// pages/homepage/homepage.js | ||
2 | +const app = getApp() | ||
3 | +Page({ | ||
4 | + | ||
5 | + /** | ||
6 | + * 页面的初始数据 | ||
7 | + */ | ||
8 | + data: { | ||
9 | + imgUrls: [], | ||
10 | + indicatorDots: false, | ||
11 | + autoplay: true, | ||
12 | + interval: 2000, | ||
13 | + duration: 1000, | ||
14 | + currentSwiper: 0, | ||
15 | + categories_id: '', | ||
16 | + goodlist: [], | ||
17 | + page: 1 | ||
18 | + }, | ||
19 | + | ||
20 | + /** | ||
21 | + * 生命周期函数--监听页面加载 | ||
22 | + */ | ||
23 | + onLoad: function(options) { | ||
24 | + | ||
25 | + }, | ||
26 | + swiperChange: function(e) { | ||
27 | + this.setData({ | ||
28 | + currentSwiper: e.detail.current | ||
29 | + }) | ||
30 | + }, | ||
31 | + | ||
32 | + | ||
33 | + // 进入搜索页 | ||
34 | + gosearch() { | ||
35 | + let token = wx.getStorageSync("token"); | ||
36 | + if (token == '') { | ||
37 | + wx.showToast({ | ||
38 | + title: '请先登录', | ||
39 | + icon: 'none' | ||
40 | + }) | ||
41 | + | ||
42 | + setTimeout(function() { | ||
43 | + wx.navigateTo({ | ||
44 | + url: '/pages/login/login', | ||
45 | + }) | ||
46 | + }, 1500) | ||
47 | + } else { | ||
48 | + wx.navigateTo({ | ||
49 | + url: '/pages/searchbox/searchbox', | ||
50 | + }) | ||
51 | + } | ||
52 | + | ||
53 | + }, | ||
54 | + | ||
55 | + | ||
56 | + // 获取首页数据 | ||
57 | + getindexdata() { | ||
58 | + let that = this; | ||
59 | + let url = 'goods/get_all'; | ||
60 | + let param = { | ||
61 | + keyword: that.data.keyword, | ||
62 | + categories_id: that.data.categories_id, | ||
63 | + page: that.data.page, | ||
64 | + pageNum: 10 | ||
65 | + | ||
66 | + } | ||
67 | + app.post(url, param, 'post').then((res) => { | ||
68 | + console.log(res); | ||
69 | + that.setData({ | ||
70 | + goodlist: that.data.goodlist.concat(res) | ||
71 | + }) | ||
72 | + | ||
73 | + }).catch((err) => { | ||
74 | + | ||
75 | + }) | ||
76 | + }, | ||
77 | + | ||
78 | + //获取首页轮播图 | ||
79 | + getbanner() { | ||
80 | + let that = this; | ||
81 | + let url = 'sundry/get_slide'; | ||
82 | + let param = { | ||
83 | + | ||
84 | + | ||
85 | + } | ||
86 | + app.post(url, '', 'post').then((res) => { | ||
87 | + console.log(res); | ||
88 | + | ||
89 | + if(res.length>5){ | ||
90 | + let newimgUrls = [] | ||
91 | + for(var i=0;i<5;i++){ | ||
92 | + newimgUrls.push(res[i]) | ||
93 | + } | ||
94 | + | ||
95 | + that.setData({ | ||
96 | + imgUrls:newimgUrls | ||
97 | + }) | ||
98 | + | ||
99 | + }else{ | ||
100 | + that.setData({ | ||
101 | + imgUrls: res | ||
102 | + }) | ||
103 | + } | ||
104 | + | ||
105 | + | ||
106 | + | ||
107 | + | ||
108 | + }).catch((err) => { | ||
109 | + | ||
110 | + }) | ||
111 | + }, | ||
112 | + | ||
113 | + //进入商品详情页 | ||
114 | + gotogood(e) { | ||
115 | + let token = wx.getStorageSync("token"); | ||
116 | + if (token == '') { | ||
117 | + wx.showToast({ | ||
118 | + title: '请先登录', | ||
119 | + icon: 'none' | ||
120 | + }) | ||
121 | + | ||
122 | + setTimeout(function() { | ||
123 | + wx.navigateTo({ | ||
124 | + url: '/pages/login/login', | ||
125 | + }) | ||
126 | + }, 1500) | ||
127 | + } else { | ||
128 | + let goodid = e.currentTarget.dataset.id; | ||
129 | + wx.navigateTo({ | ||
130 | + url: '/pages/goodtail/goodtail?goodid=' + goodid, | ||
131 | + }) | ||
132 | + } | ||
133 | + | ||
134 | + }, | ||
135 | + | ||
136 | + /** | ||
137 | + * 生命周期函数--监听页面初次渲染完成 | ||
138 | + */ | ||
139 | + onReady: function() { | ||
140 | + | ||
141 | + }, | ||
142 | + | ||
143 | + /** | ||
144 | + * 生命周期函数--监听页面显示 | ||
145 | + */ | ||
146 | + onShow: function() { | ||
147 | + this.setData({ | ||
148 | + page:1, | ||
149 | + goodlist:[] | ||
150 | + }) | ||
151 | + this.getindexdata(); | ||
152 | + this.getbanner() | ||
153 | + }, | ||
154 | + | ||
155 | + /** | ||
156 | + * 生命周期函数--监听页面隐藏 | ||
157 | + */ | ||
158 | + onHide: function() { | ||
159 | + | ||
160 | + }, | ||
161 | + | ||
162 | + /** | ||
163 | + * 生命周期函数--监听页面卸载 | ||
164 | + */ | ||
165 | + onUnload: function() { | ||
166 | + | ||
167 | + }, | ||
168 | + | ||
169 | + /** | ||
170 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
171 | + */ | ||
172 | + onPullDownRefresh: function() { | ||
173 | + | ||
174 | + }, | ||
175 | + | ||
176 | + /** | ||
177 | + * 页面上拉触底事件的处理函数 | ||
178 | + */ | ||
179 | + onReachBottom: function() { | ||
180 | + let newpage = this.data.page; | ||
181 | + newpage++; | ||
182 | + this.setData({ | ||
183 | + page: newpage | ||
184 | + }) | ||
185 | + | ||
186 | + this.getindexdata(); | ||
187 | + }, | ||
188 | + | ||
189 | + /** | ||
190 | + * 用户点击右上角分享 | ||
191 | + */ | ||
192 | + onShareAppMessage: function() { | ||
193 | + | ||
194 | + } | ||
195 | +}) |
pages/homepage/homepage.json
0 → 100644
-
请 注册 或 登录 后发表评论