Commit 0508098fe3faede3cf579398b0077a8bceb50585
1 parent
e2eaa8a22b
Exists in
master
首页筛选列表接口获取
Showing
8 changed files
with
84 additions
and
103 deletions
Show diff stats
src/components/CommodityCard/CommodityCard.vue
src/pages.json
1 | 1 | { |
2 | 2 | "pages": [ |
3 | 3 | { |
4 | - "path": "pages/cart/cart", | |
5 | - "style": { | |
6 | - "navigationBarTitleText": "购物车" | |
7 | - } | |
8 | - }, | |
9 | - { | |
10 | 4 | "path": "pages/index/index", |
11 | 5 | "style": { |
12 | 6 | "navigationBarTitleText": "商城一览" |
... | ... | @@ -24,6 +18,12 @@ |
24 | 18 | "navigationBarTitleText": "产品详情" |
25 | 19 | } |
26 | 20 | }, |
21 | + { | |
22 | + "path": "pages/cart/cart", | |
23 | + "style": { | |
24 | + "navigationBarTitleText": "购物车" | |
25 | + } | |
26 | + }, | |
27 | 27 | { |
28 | 28 | "path" : "pages/purchaseLenses/purchaseLenses", |
29 | 29 | "style" : { |
... | ... | @@ -71,7 +71,10 @@ |
71 | 71 | "path": "pages/customerService/customerService" |
72 | 72 | }, |
73 | 73 | { |
74 | - "path": "pages/myOrderPaying/myOrderPaying" | |
74 | + "path": "pages/myOrderPaying/myOrderPaying", | |
75 | + "style": { | |
76 | + "navigationBarTitleText": "待付款" | |
77 | + } | |
75 | 78 | } |
76 | 79 | |
77 | 80 | ], | ... | ... |
src/pages/index/index.vue
... | ... | @@ -102,18 +102,7 @@ export default { |
102 | 102 | showRight: false, |
103 | 103 | indexArr: "", |
104 | 104 | valueArr: "", |
105 | - // //商品数据 | |
106 | - // goodsList: [ | |
107 | - // { | |
108 | - // // goods_id: 0, | |
109 | - // // img: "/static/img/goods/p1.jpg", | |
110 | - // // name: "商品名称", | |
111 | - // // originCost: "¥198", | |
112 | - // // price: "¥168", | |
113 | - // // slogan: "1235人浏览" | |
114 | - // } | |
115 | - // ], | |
116 | - loadingText: "正在加载...", | |
105 | + loadingText: "~~到底了~~", | |
117 | 106 | filterDropdownValue: [], |
118 | 107 | filterData: [] |
119 | 108 | }; |
... | ... | @@ -123,7 +112,11 @@ export default { |
123 | 112 | // 也可以从 getters 获取 |
124 | 113 | console.log(this.$store.getters.list); |
125 | 114 | return this.$store.state.test.list; |
126 | - } | |
115 | + }, | |
116 | + categoryList(){ | |
117 | + console.log(JSON.stringify(this.$store.state.categoryOrder.categoryList)); | |
118 | + } | |
119 | + | |
127 | 120 | }, |
128 | 121 | filters: { |
129 | 122 | outData(value) { |
... | ... | @@ -132,53 +125,20 @@ export default { |
132 | 125 | }, |
133 | 126 | onLoad: function() { |
134 | 127 | store.dispatch('test/fetch'); |
135 | - // uni.request({ | |
136 | - // url: "https://api.glass.xiuyetang.com/app/prod/list", | |
137 | - // method: "post", | |
138 | - // data: { | |
139 | - // // text: 'uni.request' | |
140 | - // }, | |
141 | - // header: { | |
142 | - // // 'custom-header': 'hello', //自定义请求头信息 | |
143 | - // "Content-Type": "application/x-www-form-urlencoded" | |
144 | - // // 'Content-Type':'multipart/form-data' | |
145 | - // // 'Content-Type':'ext/plain' | |
146 | - // }, | |
147 | - // timeout: 3000, | |
148 | - // // dataType:'json' | |
149 | - // // responseType:'text', | |
150 | - // // sslVerify: true, //验证 ssl 证书 | |
151 | - // withCredentials: false, //跨域请求时是否携带凭证(cookies) | |
152 | - // success: res => { | |
153 | - // console.error("success status === > ", res); | |
154 | - // this.goodsList = res.data.data; | |
155 | - // // console.log('res.data', res.data); | |
156 | - // // this.text = 'request success'; | |
157 | - // }, | |
158 | - // fail: res => { | |
159 | - // console.log("fail status === > ", res); | |
160 | - // }, | |
161 | - // complete: res => { | |
162 | - // console.log("complete status === > ", res); | |
163 | - // } | |
164 | - // }); | |
128 | + store.dispatch('categoryOrder/fetch') | |
129 | + | |
165 | 130 | //定时器模拟ajax异步请求数据 |
166 | - // setTimeout(()=>{ | |
167 | - // //传入defaultSelected的结构不能错,错了就报错运行异常。 不选中的项目传入null | |
168 | - // this.filterDropdownValue = [ | |
169 | - // [1,1,0], //第0个菜单选中 一级菜单的第1项,二级菜单的第1项,三级菜单的第3项 | |
170 | - // [null,null], //第1个菜单选中 都不选中 | |
171 | - // [1], //第2个菜单选中 一级菜单的第1项 | |
172 | - // [[0],[1,2,7],[1,0]], //筛选菜单选中 第一个筛选的第0项,第二个筛选的第1,2,7项,第三个筛选的第1,0项 | |
173 | - // [[0],[1],[1]], //单选菜单选中 第一个筛选的第0项,第二个筛选的第1项,第三个筛选的第1项 | |
174 | - // ]; | |
175 | - // this.filterData = data; | |
176 | - // },100); | |
177 | - // 模拟ajax请求子菜单数据。 | |
178 | - // setTimeout(()=>{ | |
179 | - // console.log('发起请求','ddddddd'); | |
180 | - // // this.filterData[1].submenu[0].submenu = [{"name": "附近","value": "附近"},{"name": "1km","value": "1km"},{"name": "2km","value": "2km"},{"name": "3km","value": "3km"},{"name": "4km","value": "4km"},{"name": "5km","value": "5km"}]; | |
181 | - // },3000); | |
131 | + setTimeout(()=>{ | |
132 | + //传入defaultSelected的结构不能错,错了就报错运行异常。 不选中的项目传入null | |
133 | + // this.filterDropdownValue = [ | |
134 | + // [1,1,0], //第0个菜单选中 一级菜单的第1项,二级菜单的第1项,三级菜单的第3项 | |
135 | + // [null,null], //第1个菜单选中 都不选中 | |
136 | + // [1], //第2个菜单选中 一级菜单的第1项 | |
137 | + // [[0],[1,2,7],[1,0]], //筛选菜单选中 第一个筛选的第0项,第二个筛选的第1,2,7项,第三个筛选的第1,0项 | |
138 | + // [[0],[1],[1]], //单选菜单选中 第一个筛选的第0项,第二个筛选的第1项,第三个筛选的第1项 | |
139 | + // ]; | |
140 | + this.filterData = data; | |
141 | + },100); | |
182 | 142 | }, |
183 | 143 | methods: { |
184 | 144 | showDrawer(e) { |
... | ... | @@ -210,36 +170,7 @@ export default { |
210 | 170 | }; |
211 | 171 | } |
212 | 172 | }, |
213 | - onNavigationBarButtonTap(e) { | |
214 | - this.showRight = !this.showRight; | |
215 | - }, | |
216 | - //上拉加载, | |
217 | - onReachBottom() { | |
218 | - console.log("到底加载"); | |
219 | - let len = this.goodsList.length; | |
220 | - if (len >= 30) { | |
221 | - this.loadingText = "~~到底了~~"; | |
222 | - return false; | |
223 | - } else { | |
224 | - this.loadingText = "正在加载..."; | |
225 | - } | |
226 | - let end_goods_id = this.goodsList[len - 1].goods_id; | |
227 | - for (let i = 1; i <= 10; i++) { | |
228 | - let goods_id = end_goods_id + i; | |
229 | - let p = { | |
230 | - goods_id: goods_id, | |
231 | - img: | |
232 | - "/static/img/goods/p" + | |
233 | - (goods_id % 10 == 0 ? 10 : goods_id % 10) + | |
234 | - ".jpg", | |
235 | - name: "商品名称", | |
236 | - originCost: "¥198", | |
237 | - price: "¥168", | |
238 | - slogan: "1235人付款" | |
239 | - }; | |
240 | - this.goodsList.push(p); | |
241 | - } | |
242 | - } | |
173 | + | |
243 | 174 | }; |
244 | 175 | </script> |
245 | 176 | ... | ... |
src/pages/myOrder/myOrder.vue
src/pages/myOrderPaying/myOrderPaying.vue
1 | 1 | <template> |
2 | 2 | <view class="content"> |
3 | - <view class="header"> | |
3 | + <!-- <view class="header"> | |
4 | 4 | <view class="header-name"> |
5 | 5 | <navigator open-type="navigateBack" hover-class="navigator-hover"> |
6 | 6 | <image src="/static/back.png"></image> |
7 | 7 | </navigator> |
8 | 8 | <text>我的订单</text> |
9 | 9 | </view> |
10 | - </view> | |
10 | + </view> --> | |
11 | 11 | <scroll-view scroll-y class="scroll-view" :style="{ height: scrollHeight?1000:800 + 'px' }"> |
12 | 12 | <view class="order-hr"></view> |
13 | 13 | <view class="order-time"> | ... | ... |
src/pages/user/user.vue
... | ... | @@ -93,7 +93,7 @@ |
93 | 93 | methods: { |
94 | 94 | toMyOrder(){ |
95 | 95 | uni.navigateTo({ |
96 | - url: '../myOrder/myOrder', | |
96 | + url: '../myOrder/myOrder?current=0', | |
97 | 97 | success: res => {}, |
98 | 98 | fail: () => {}, |
99 | 99 | complete: () => {} |
... | ... | @@ -101,7 +101,7 @@ |
101 | 101 | }, |
102 | 102 | toPredelivery(){ |
103 | 103 | uni.navigateTo({ |
104 | - url: '../Predelivery/Predelivery', | |
104 | + url: '../myOrder/myOrder?current=2', | |
105 | 105 | success: res => {}, |
106 | 106 | fail: () => {}, |
107 | 107 | complete: () => {} |
... | ... | @@ -109,7 +109,7 @@ |
109 | 109 | }, |
110 | 110 | toMyOrderPaying(){ |
111 | 111 | uni.navigateTo({ |
112 | - url: '../myorder-paying/myorder-paying', | |
112 | + url: '../myOrder/myOrder?current=1', | |
113 | 113 | success: res => {}, |
114 | 114 | fail: () => {}, |
115 | 115 | complete: () => {} | ... | ... |
src/store/modules/categoryOrder.js
... | ... | @@ -0,0 +1,40 @@ |
1 | + import urlAlias from '../url'; | |
2 | + import request from '../request'; | |
3 | + | |
4 | + const { | |
5 | + category | |
6 | + } = urlAlias; | |
7 | + | |
8 | +const state = { | |
9 | + categoryList: [], | |
10 | +}; | |
11 | + | |
12 | +const mutations = { | |
13 | + INIT: (state, categoryList) => { | |
14 | + state.categoryList = categoryList; | |
15 | + }, | |
16 | +}; | |
17 | + | |
18 | +const actions = { | |
19 | + fetch({ commit }, param) { | |
20 | + request({ | |
21 | + url: category, | |
22 | + success: (res) => { | |
23 | + commit('INIT', res.data.data) | |
24 | + }, | |
25 | + fail: (res) => { | |
26 | + console.log("fail status === > ", res); | |
27 | + }, | |
28 | + complete: (res) => { | |
29 | + console.log("complete status === > ", res); | |
30 | + }, | |
31 | + }) | |
32 | + }, | |
33 | +}; | |
34 | + | |
35 | +export default { | |
36 | + namespaced: true, | |
37 | + state, | |
38 | + mutations, | |
39 | + actions, | |
40 | +}; | ... | ... |