Commit 31b5bebd40ee3a2ead019e8f0c5074943e429c51
1 parent
a658edc461
Exists in
master
订单样式修改
Showing
5 changed files
with
650 additions
and
582 deletions
Show diff stats
src/pages/details/details.vue
src/pages/index/index.vue
... | ... | @@ -88,12 +88,12 @@ |
88 | 88 | data-format="Object" |
89 | 89 | ></HMfilterDropdown> |
90 | 90 | <!-- 商品列表 --> |
91 | - <!-- <scroll-view | |
92 | - enable-flex | |
93 | - @scrolltolower="handleScrolltolower" | |
94 | - scroll-y | |
95 | - style="height: 1000px;margin-bottom: 20px;" | |
96 | - > --> | |
91 | + <!-- <scroll-view | |
92 | + enable-flex | |
93 | + @scrolltolower="handleScrolltolower" | |
94 | + scroll-y | |
95 | + style="height: 1000px;margin-bottom: 20px;" | |
96 | + > --> | |
97 | 97 | <view class="goods-list"> |
98 | 98 | <view class="product-list"> |
99 | 99 | <view |
... | ... | @@ -153,9 +153,9 @@ export default { |
153 | 153 | filterData: [], |
154 | 154 | searchText: '', |
155 | 155 | scrollTop: 0, |
156 | - showContent: true, | |
156 | + showContent: true, | |
157 | 157 | viewHeight: uni.getSystemInfoSync().windowHeight, |
158 | - showSkeleton: false, // 骨架屏显示隐藏 | |
158 | + showSkeleton: false, // 骨架屏显示隐藏 | |
159 | 159 | } |
160 | 160 | }, |
161 | 161 | onPageScroll({ scrollTop }) { |
... | ... | @@ -167,11 +167,11 @@ export default { |
167 | 167 | // 也可以从 getters 获取 |
168 | 168 | // console.log('index-list=====>',this.$store.state.index.list) |
169 | 169 | const list = this.$store.state.index.list |
170 | - if (list.length == 0) { | |
171 | - this.isLoading = false | |
172 | - } | |
173 | - this.scrollTop = 0.1 | |
174 | - return list | |
170 | + if (list.length === 0) { | |
171 | + this.isLoading = false | |
172 | + } | |
173 | + this.scrollTop = 0.1 | |
174 | + return list | |
175 | 175 | }, |
176 | 176 | categoryList() { |
177 | 177 | return this.$store.state.index.categoryList |
... | ... | @@ -186,7 +186,7 @@ export default { |
186 | 186 | * 页面载入完成后调用子组件的方法生成预加载效果 |
187 | 187 | */ |
188 | 188 | onReady: function() { |
189 | - this.getInitData() | |
189 | + this.getInitData() | |
190 | 190 | }, |
191 | 191 | methods: { |
192 | 192 | async getInitData () { | ... | ... |
src/pages/myOrder/components/OrderCard.vue
... | ... | @@ -65,133 +65,174 @@ |
65 | 65 | class="btns" |
66 | 66 | v-if="status == '2'" |
67 | 67 | > |
68 | - <view class="btn-type2" @click="toDetail">再次购买</view> | |
68 | + <view | |
69 | + class="btn-type2" | |
70 | + @click="toDetail" | |
71 | + >再次购买</view> | |
69 | 72 | </view> |
70 | - <!-- <view class="btns" v-if="status == '3'"> | |
71 | - <view class="btn-type2">再次购买</view> | |
72 | - </view> --> | |
73 | - </view> | |
74 | - <view class="card" v-if="current == '10'" @click="toOrderInfo(status,order.pay_id)"> | |
75 | - <view class="cardHeader"> | |
76 | - <text class="orderId" v-if="status == '0'||status == '1'">订单号:{{order.pay_id}}</text> | |
77 | - <text class="orderId" v-if="status == '2'||status == '3'">下单时间:{{order.pay_time}}</text> | |
78 | - <text class="orderType" v-if="status=='0'">待付款</text> | |
79 | - <text class="orderType" v-if="status=='1'">待收货</text> | |
80 | - <text class="orderType" v-if="status == '2'||status == '3'">已完成</text> | |
81 | - <!-- <text class="orderType" v-if="status == '3'">已评价</text> --> | |
82 | - </view> | |
83 | - <view class="orderCardInfo" v-for="(orderInfo) in orderInfoList" :key="orderInfo"> | |
84 | - <image :src="orderInfo.imgUrl" mode="aspectFill"></image> | |
85 | - <view class="infoText"> | |
86 | - <view class="orderName">{{orderInfo.p_name}}</view> | |
87 | - <view class="orderDescrib">{{orderInfo.p_name}}</view> | |
88 | - <view class="infoText-bottom"> | |
89 | - <view class="markPrice">{{orderInfo.nowPrice}}</view> | |
90 | - <view class="buy-num">X {{orderInfo.num}}</view> | |
91 | - </view> | |
92 | - </view> | |
93 | - </view> | |
94 | - <view class="payPrice">实付:<text class="priceNum">{{order.total_fee}}</text> </view> | |
95 | - <view class="btns" v-if="status == '0'"> | |
96 | - <view class="btn-type1" >取消订单</view> | |
97 | - <view class="btn-type2">去支付</view> | |
98 | - </view> | |
99 | - <view class="btns" v-if="status == '1'"> | |
100 | - <view class="btn-type2">确认收货</view> | |
101 | - </view> | |
102 | - <view class="btns" v-if="status == '2'||status == '3'"> | |
103 | - <view class="btn-type2" @click="toDetail(order.order_info[0].pid)">再次购买</view> | |
104 | - </view> | |
105 | - <!-- <view class="btns" v-if="status == '3'"> | |
73 | + <!-- <view class="btns" v-if="status == '3'"> | |
74 | + <view class="btn-type2">再次购买</view> | |
75 | + </view> --> | |
76 | + </view> | |
77 | + <view | |
78 | + class="card" | |
79 | + v-if="current == '10'" | |
80 | + @click="toOrderInfo(status,order.pay_id)" | |
81 | + > | |
82 | + <view class="cardHeader"> | |
83 | + <text | |
84 | + class="orderId" | |
85 | + v-if="status == '0'||status == '1'" | |
86 | + >订单号:{{order.pay_id}}</text> | |
87 | + <text | |
88 | + class="orderId" | |
89 | + v-if="status == '2'||status == '3'" | |
90 | + >下单时间:{{order.pay_time}}</text> | |
91 | + <text | |
92 | + class="orderType" | |
93 | + v-if="status=='0'" | |
94 | + >待付款</text> | |
95 | + <text | |
96 | + class="orderType" | |
97 | + v-if="status=='1'" | |
98 | + >待收货</text> | |
99 | + <text | |
100 | + class="orderType" | |
101 | + v-if="status == '2'||status == '3'" | |
102 | + >已完成</text> | |
103 | + <!-- <text class="orderType" v-if="status == '3'">已评价</text> --> | |
104 | + </view> | |
105 | + <view | |
106 | + class="orderCardInfo" | |
107 | + v-for="(orderInfo) in orderInfoList" | |
108 | + :key="orderInfo" | |
109 | + > | |
110 | + <image | |
111 | + :src="orderInfo.imgUrl" | |
112 | + mode="aspectFill" | |
113 | + ></image> | |
114 | + <view class="infoText"> | |
115 | + <view class="orderName">{{orderInfo.p_name}}</view> | |
116 | + <view class="orderDescrib">{{orderInfo.p_name}}</view> | |
117 | + <view class="infoText-bottom"> | |
118 | + <view class="markPrice">{{orderInfo.nowPrice}}</view> | |
119 | + <view class="buy-num">X {{orderInfo.num}}</view> | |
120 | + </view> | |
121 | + </view> | |
122 | + </view> | |
123 | + <view class="payPrice">实付:<text class="priceNum">{{order.total_fee}}</text> </view> | |
124 | + <view | |
125 | + class="btns" | |
126 | + v-if="status == '0'" | |
127 | + > | |
128 | + <view class="btn-type1">取消订单</view> | |
129 | + <view class="btn-type2">去支付</view> | |
130 | + </view> | |
131 | + <view | |
132 | + class="btns" | |
133 | + v-if="status == '1'" | |
134 | + > | |
135 | + <view class="btn-type2">确认收货</view> | |
136 | + </view> | |
137 | + <view | |
138 | + class="btns" | |
139 | + v-if="status == '2'||status == '3'" | |
140 | + > | |
141 | + <view | |
142 | + class="btn-type2" | |
143 | + @click="toDetail(order.order_info[0].pid)" | |
144 | + >再次购买</view> | |
145 | + </view> | |
146 | + <!-- <view class="btns" v-if="status == '3'"> | |
106 | 147 | |
107 | - <view class="btn-type2">再次购买</view> | |
108 | - </view> --> | |
148 | + <view class="btn-type2">再次购买</view> | |
149 | + </view> --> | |
109 | 150 | </view> |
110 | 151 | </view> |
111 | 152 | </template> |
112 | 153 | |
113 | 154 | <script> |
114 | - export default { | |
115 | - props: { | |
116 | - /** | |
117 | - * 订单数据 | |
118 | - */ | |
119 | - order: {}, | |
120 | - /** | |
121 | - * 当前选择 | |
122 | - */ | |
123 | - current:Number | |
124 | - | |
125 | - }, | |
126 | - created() { | |
127 | - console.log('order',this.order); | |
128 | - // console.log(this.order.status ); | |
129 | - // console.log(this.current); | |
130 | - }, | |
131 | - computed:{ | |
132 | - status(){ | |
133 | - return this.order.status | |
134 | - }, | |
135 | - orderInfoList(){ | |
136 | - return this.order.order_info | |
137 | - } | |
138 | - }, | |
139 | - data() { | |
140 | - return { | |
141 | - }; | |
142 | - }, | |
143 | - methods:{ | |
144 | - toDetail(pid){ | |
145 | - console.log('pid',pid) | |
146 | - uni.navigateTo({ | |
147 | - url: '../details/details?pid='+pid, | |
148 | - fail: (res) => {console.log(res)}, | |
149 | - }); | |
150 | - }, | |
151 | - toRefundment(){ | |
152 | - uni.navigateTo({ | |
153 | - url: '../refundment/refundment', | |
154 | - success: res => {}, | |
155 | - fail: () => {}, | |
156 | - complete: () => {} | |
157 | - }); | |
158 | - }, | |
159 | - toOrderInfo(status,payId){ | |
160 | - console.log(status,payId) | |
161 | - switch(status){ | |
162 | - // 0待付款 1待收货 2已收货 3 已评价 | |
163 | - case '0': | |
164 | - uni.navigateTo({ | |
165 | - url:`../myOrderPaying/myOrderPaying?status=`+status+`&payId=`+payId, | |
166 | - fail(errMsg) { | |
167 | - console.log(errMsg) | |
168 | - } | |
169 | - }) | |
170 | - break; | |
171 | - case '1': | |
172 | - uni.navigateTo({ | |
173 | - url:`../myOrderPaying/myOrderPaying?status=`+status+`&payId=`+payId, | |
174 | - fail(errMsg) { | |
175 | - console.log(errMsg) | |
176 | - } | |
177 | - }) | |
178 | - | |
179 | - break; | |
180 | - case '2 || 3': | |
181 | - uni.navigateTo({ | |
182 | - url:`../myOrderPaying/myOrderPaying?status=`+status+`&payId=`+payId, | |
183 | - fail(errMsg) { | |
184 | - console.log(errMsg) | |
185 | - } | |
186 | - }) | |
187 | - break; | |
188 | - default: | |
189 | - break; | |
190 | - | |
191 | - } | |
192 | - } | |
193 | - } | |
194 | - } | |
155 | +export default { | |
156 | + props: { | |
157 | + /** | |
158 | + * 订单数据 | |
159 | + */ | |
160 | + order: {}, | |
161 | + /** | |
162 | + * 当前选择 | |
163 | + */ | |
164 | + current: Number, | |
165 | + | |
166 | + }, | |
167 | + created() { | |
168 | + console.log('order', this.order) | |
169 | + // console.log(this.order.status ); | |
170 | + // console.log(this.current); | |
171 | + }, | |
172 | + computed: { | |
173 | + status() { | |
174 | + return this.order.status | |
175 | + }, | |
176 | + orderInfoList() { | |
177 | + const orderInfoList = this.order.order_info | |
178 | + return Array.isArray(orderInfoList) ? orderInfoList : orderInfoList.data | |
179 | + }, | |
180 | + }, | |
181 | + data() { | |
182 | + return { | |
183 | + } | |
184 | + }, | |
185 | + methods: { | |
186 | + toDetail(pid) { | |
187 | + console.log('pid', pid) | |
188 | + uni.navigateTo({ | |
189 | + url: '../details/details?pid=' + pid, | |
190 | + fail: (res) => { console.log(res) }, | |
191 | + }) | |
192 | + }, | |
193 | + toRefundment() { | |
194 | + uni.navigateTo({ | |
195 | + url: '../refundment/refundment', | |
196 | + success: res => {}, | |
197 | + fail: () => {}, | |
198 | + complete: () => {}, | |
199 | + }) | |
200 | + }, | |
201 | + toOrderInfo(status, payId) { | |
202 | + console.log(status, payId) | |
203 | + switch (status) { | |
204 | + // 0待付款 1待收货 2已收货 3 已评价 | |
205 | + case '0': | |
206 | + uni.navigateTo({ | |
207 | + url: '../myOrderPaying/myOrderPaying?status=' + status + '&payId=' + payId, | |
208 | + fail(errMsg) { | |
209 | + console.log(errMsg) | |
210 | + }, | |
211 | + }) | |
212 | + break | |
213 | + case '1': | |
214 | + uni.navigateTo({ | |
215 | + url: '../myOrderPaying/myOrderPaying?status=' + status + '&payId=' + payId, | |
216 | + fail(errMsg) { | |
217 | + console.log(errMsg) | |
218 | + }, | |
219 | + }) | |
220 | + | |
221 | + break | |
222 | + case '2 || 3': | |
223 | + uni.navigateTo({ | |
224 | + url: '../myOrderPaying/myOrderPaying?status=' + status + '&payId=' + payId, | |
225 | + fail(errMsg) { | |
226 | + console.log(errMsg) | |
227 | + }, | |
228 | + }) | |
229 | + break | |
230 | + default: | |
231 | + break | |
232 | + } | |
233 | + }, | |
234 | + }, | |
235 | +} | |
195 | 236 | |
196 | 237 | </script> |
197 | 238 | ... | ... |
src/store/modules/index.js
1 | - import urlAlias from '../url'; | |
2 | - import request from '../request'; | |
1 | +import urlAlias from '../url' | |
2 | +import request from '../request' | |
3 | 3 | |
4 | - const { | |
5 | - category, | |
6 | - shopList, | |
7 | - search, | |
8 | - } = urlAlias; | |
4 | +const { | |
5 | + category, | |
6 | + shopList, | |
7 | + search, | |
8 | +} = urlAlias | |
9 | 9 | |
10 | -let initData = {"name":"志平防蓝光-防辐射电脑网课眼镜","id":"9","imgurl":"", | |
11 | - "price":0,"trade_num":"102","rsSon":{"pic":"9_FDB33D.jpg","model_pic":null,"in_price":"6000","sku_value":"80_83", | |
12 | - "discount":"45","kc":"0","sku_name":"1.56非球面防蓝光_黑透+蓝纹","Max_Price":158,"Min_Price":99}} | |
13 | -var initArr = [1,2,3,4,5,6,7,8] | |
14 | -let list = [] | |
10 | +const initData = { | |
11 | + name: '志平防蓝光-防辐射电脑网课眼镜', | |
12 | + id: '9', | |
13 | + imgurl: '', | |
14 | + price: 0, | |
15 | + trade_num: '102', | |
16 | + rsSon: { | |
17 | + pic: '9_FDB33D.jpg', | |
18 | + model_pic: null, | |
19 | + in_price: '6000', | |
20 | + sku_value: '80_83', | |
21 | + discount: '45', | |
22 | + kc: '0', | |
23 | + sku_name: '1.56非球面防蓝光_黑透+蓝纹', | |
24 | + Max_Price: 158, | |
25 | + Min_Price: 99, | |
26 | + }, | |
27 | +} | |
28 | +var initArr = [1, 2, 3, 4, 5, 6, 7, 8] | |
29 | +const list = [] | |
15 | 30 | initArr.forEach(function (value) { |
16 | - list.push(initData) | |
17 | -}); | |
31 | + list.push(initData) | |
32 | +}) | |
18 | 33 | |
19 | -let categoryList = [ | |
20 | - { | |
21 | - "type": "checkbox", | |
22 | - "name": "产品", | |
23 | - "value": "category", | |
24 | - "submenu": [ | |
25 | - { | |
26 | - "label": "镜框", | |
27 | - "name": "镜框", | |
28 | - "value": "1" | |
29 | - }, | |
30 | - { | |
31 | - "label": "镜片", | |
32 | - "name": "镜片", | |
33 | - "value": "2" | |
34 | - }, | |
35 | - { | |
36 | - "label": "特种镜", | |
37 | - "name": "特种镜", | |
38 | - "value": "146" | |
39 | - } | |
40 | - ], | |
41 | - "groups": [ | |
42 | - "001" | |
43 | - ] | |
44 | - }, | |
45 | - { | |
46 | - "type": "radio", | |
47 | - "name": "规则", | |
48 | - "value": "px", | |
49 | - "submenu": [ | |
50 | - { | |
51 | - "name": "按价格排", | |
52 | - "value": "1" | |
53 | - }, | |
54 | - { | |
55 | - "name": "按销量排", | |
56 | - "value": "2" | |
57 | - } | |
58 | - ], | |
59 | - "groups": [ | |
60 | - "002" | |
61 | - ] | |
62 | - }, | |
63 | - { | |
64 | - "type": "radio", | |
65 | - "name": "排序", | |
66 | - "value": "sort", | |
67 | - "submenu": [ | |
68 | - { | |
69 | - "name": "从高到低", | |
70 | - "value": "1" | |
71 | - }, | |
72 | - { | |
73 | - "name": "从低到高", | |
74 | - "value": "2" | |
75 | - } | |
76 | - ], | |
77 | - "groups": [ | |
78 | - "003" | |
79 | - ] | |
80 | - }, | |
81 | - { | |
82 | - "type": "filter", | |
83 | - "name": "筛选", | |
84 | - "value": "filter", | |
85 | - "submenu": [ | |
86 | - { | |
87 | - "type": "checkbox", | |
88 | - "name": "性别", | |
89 | - "value": "sex", | |
90 | - "submenu": [ | |
91 | - { | |
92 | - "label": "男性", | |
93 | - "name": "男性", | |
94 | - "value": "27" | |
95 | - }, | |
96 | - { | |
97 | - "label": "女性", | |
98 | - "name": "女性", | |
99 | - "value": "28" | |
100 | - } | |
101 | - ] | |
102 | - }, | |
103 | - { | |
104 | - "type": "checkbox", | |
105 | - "name": "年龄", | |
106 | - "value": "age", | |
107 | - "submenu": [ | |
108 | - { | |
109 | - "label": "通用", | |
110 | - "name": "通用", | |
111 | - "value": "24" | |
112 | - } | |
113 | - ] | |
114 | - }, | |
115 | - { | |
116 | - "type": "checkbox", | |
117 | - "name": "适用场景", | |
118 | - "value": "sense", | |
119 | - "submenu": [ | |
120 | - { | |
121 | - "label": "行政风", | |
122 | - "name": "行政风", | |
123 | - "value": "53" | |
124 | - }, | |
125 | - { | |
126 | - "label": "青春学子风", | |
127 | - "name": "青春学子风", | |
128 | - "value": "54" | |
129 | - }, | |
130 | - { | |
131 | - "label": "运动风", | |
132 | - "name": "运动风", | |
133 | - "value": "55" | |
134 | - }, | |
135 | - { | |
136 | - "label": "简约-极简文艺范", | |
137 | - "name": "简约-极简文艺范", | |
138 | - "value": "56" | |
139 | - }, | |
140 | - { | |
141 | - "label": "奶奶风", | |
142 | - "name": "奶奶风", | |
143 | - "value": "57" | |
144 | - }, | |
145 | - { | |
146 | - "label": "流线洛可可", | |
147 | - "name": "流线洛可可", | |
148 | - "value": "58" | |
149 | - }, | |
150 | - { | |
151 | - "label": "自然舒视角", | |
152 | - "name": "自然舒视角", | |
153 | - "value": "59" | |
154 | - }, | |
155 | - { | |
156 | - "label": "无界人文系", | |
157 | - "name": "无界人文系", | |
158 | - "value": "60" | |
159 | - }, | |
160 | - { | |
161 | - "label": "有机未来时", | |
162 | - "name": "有机未来时", | |
163 | - "value": "61" | |
164 | - }, | |
165 | - { | |
166 | - "label": "立体巴洛克", | |
167 | - "name": "立体巴洛克", | |
168 | - "value": "62" | |
169 | - }, | |
170 | - { | |
171 | - "label": "多元新风尚", | |
172 | - "name": "多元新风尚", | |
173 | - "value": "63" | |
174 | - }, | |
175 | - { | |
176 | - "label": "理性几何派", | |
177 | - "name": "理性几何派", | |
178 | - "value": "64" | |
179 | - }, | |
180 | - { | |
181 | - "label": "轻简北欧风", | |
182 | - "name": "轻简北欧风", | |
183 | - "value": "65" | |
184 | - }, | |
185 | - { | |
186 | - "label": "质感哥特潮", | |
187 | - "name": "质感哥特潮", | |
188 | - "value": "66" | |
189 | - }, | |
190 | - { | |
191 | - "label": "时尚", | |
192 | - "name": "时尚", | |
193 | - "value": "67" | |
194 | - }, | |
195 | - { | |
196 | - "label": "复古", | |
197 | - "name": "复古", | |
198 | - "value": "68" | |
199 | - }, | |
200 | - { | |
201 | - "label": "商务", | |
202 | - "name": "商务", | |
203 | - "value": "69" | |
204 | - }, | |
205 | - { | |
206 | - "label": "休闲", | |
207 | - "name": "休闲", | |
208 | - "value": "70" | |
209 | - }, | |
210 | - { | |
211 | - "label": "折射率", | |
212 | - "name": "折射率", | |
213 | - "value": "285" | |
214 | - } | |
215 | - ] | |
216 | - }, | |
217 | - { | |
218 | - "type": "checkbox", | |
219 | - "name": "价格", | |
220 | - "value": "price", | |
221 | - "submenu": [ | |
222 | - { | |
223 | - "name": "100以下", | |
224 | - "value": "1,100" | |
225 | - }, | |
226 | - { | |
227 | - "name": "100-300", | |
228 | - "value": "100,300" | |
229 | - }, | |
230 | - { | |
231 | - "name": "300-1000", | |
232 | - "value": "300,1000" | |
233 | - }, | |
234 | - { | |
235 | - "name": "1000以上", | |
236 | - "value": "1000,-1" | |
237 | - } | |
238 | - ] | |
239 | - }, | |
240 | - { | |
241 | - "type": "checkbox", | |
242 | - "name": "材质", | |
243 | - "value": "glasscate", | |
244 | - "submenu": [ | |
245 | - { | |
246 | - "label": "购易", | |
247 | - "name": "购易", | |
248 | - "value": "72" | |
249 | - }, | |
250 | - { | |
251 | - "label": "海俪恩", | |
252 | - "name": "海俪恩", | |
253 | - "value": "73" | |
254 | - }, | |
255 | - { | |
256 | - "label": "沙漠风暴", | |
257 | - "name": "沙漠风暴", | |
258 | - "value": "74" | |
259 | - }, | |
260 | - { | |
261 | - "label": "古诗", | |
262 | - "name": "古诗", | |
263 | - "value": "75" | |
264 | - }, | |
265 | - { | |
266 | - "label": "暴龙", | |
267 | - "name": "暴龙", | |
268 | - "value": "76" | |
269 | - }, | |
270 | - { | |
271 | - "label": "犀牛", | |
272 | - "name": "犀牛", | |
273 | - "value": "77" | |
274 | - }, | |
275 | - { | |
276 | - "label": "Ray-Ban雷朋", | |
277 | - "name": "Ray-Ban雷朋", | |
278 | - "value": "78" | |
279 | - }, | |
280 | - { | |
281 | - "label": "PARIM派丽蒙", | |
282 | - "name": "PARIM派丽蒙", | |
283 | - "value": "79" | |
284 | - }, | |
285 | - { | |
286 | - "label": "石狼", | |
287 | - "name": "石狼", | |
288 | - "value": "80" | |
289 | - }, | |
290 | - { | |
291 | - "label": "木九十", | |
292 | - "name": "木九十", | |
293 | - "value": "81" | |
294 | - } | |
295 | - ] | |
296 | - }, | |
297 | - { | |
298 | - "type": "checkbox", | |
299 | - "name": "品牌", | |
300 | - "value": "brand", | |
301 | - "submenu": [ | |
302 | - { | |
303 | - "label": "购易", | |
304 | - "name": "购易", | |
305 | - "value": "72" | |
306 | - }, | |
307 | - { | |
308 | - "label": "海俪恩", | |
309 | - "name": "海俪恩", | |
310 | - "value": "73" | |
311 | - }, | |
312 | - { | |
313 | - "label": "沙漠风暴", | |
314 | - "name": "沙漠风暴", | |
315 | - "value": "74" | |
316 | - }, | |
317 | - { | |
318 | - "label": "古诗", | |
319 | - "name": "古诗", | |
320 | - "value": "75" | |
321 | - }, | |
322 | - { | |
323 | - "label": "暴龙", | |
324 | - "name": "暴龙", | |
325 | - "value": "76" | |
326 | - }, | |
327 | - { | |
328 | - "label": "犀牛", | |
329 | - "name": "犀牛", | |
330 | - "value": "77" | |
331 | - }, | |
332 | - { | |
333 | - "label": "Ray-Ban雷朋", | |
334 | - "name": "Ray-Ban雷朋", | |
335 | - "value": "78" | |
336 | - }, | |
337 | - { | |
338 | - "label": "PARIM派丽蒙", | |
339 | - "name": "PARIM派丽蒙", | |
340 | - "value": "79" | |
341 | - }, | |
342 | - { | |
343 | - "label": "石狼", | |
344 | - "name": "石狼", | |
345 | - "value": "80" | |
346 | - }, | |
347 | - { | |
348 | - "label": "木九十", | |
349 | - "name": "木九十", | |
350 | - "value": "81" | |
351 | - } | |
352 | - ] | |
353 | - } | |
354 | - ], | |
355 | - "groups": [ | |
356 | - "001", | |
357 | - "002", | |
358 | - "003" | |
359 | - ], | |
360 | - } | |
361 | - ] | |
34 | +// let categoryList = [ | |
35 | +// { | |
36 | +// "type": "checkbox", | |
37 | +// "name": "产品", | |
38 | +// "value": "category", | |
39 | +// "submenu": [ | |
40 | +// { | |
41 | +// "label": "镜框", | |
42 | +// "name": "镜框", | |
43 | +// "value": "1" | |
44 | +// }, | |
45 | +// { | |
46 | +// "label": "镜片", | |
47 | +// "name": "镜片", | |
48 | +// "value": "2" | |
49 | +// }, | |
50 | +// { | |
51 | +// "label": "特种镜", | |
52 | +// "name": "特种镜", | |
53 | +// "value": "146" | |
54 | +// } | |
55 | +// ], | |
56 | +// "groups": [ | |
57 | +// "001" | |
58 | +// ] | |
59 | +// }, | |
60 | +// { | |
61 | +// "type": "radio", | |
62 | +// "name": "规则", | |
63 | +// "value": "px", | |
64 | +// "submenu": [ | |
65 | +// { | |
66 | +// "name": "按价格排", | |
67 | +// "value": "1" | |
68 | +// }, | |
69 | +// { | |
70 | +// "name": "按销量排", | |
71 | +// "value": "2" | |
72 | +// } | |
73 | +// ], | |
74 | +// "groups": [ | |
75 | +// "002" | |
76 | +// ] | |
77 | +// }, | |
78 | +// { | |
79 | +// "type": "radio", | |
80 | +// "name": "排序", | |
81 | +// "value": "sort", | |
82 | +// "submenu": [ | |
83 | +// { | |
84 | +// "name": "从高到低", | |
85 | +// "value": "1" | |
86 | +// }, | |
87 | +// { | |
88 | +// "name": "从低到高", | |
89 | +// "value": "2" | |
90 | +// } | |
91 | +// ], | |
92 | +// "groups": [ | |
93 | +// "003" | |
94 | +// ] | |
95 | +// }, | |
96 | +// { | |
97 | +// "type": "filter", | |
98 | +// "name": "筛选", | |
99 | +// "value": "filter", | |
100 | +// "submenu": [ | |
101 | +// { | |
102 | +// "type": "checkbox", | |
103 | +// "name": "性别", | |
104 | +// "value": "sex", | |
105 | +// "submenu": [ | |
106 | +// { | |
107 | +// "label": "男性", | |
108 | +// "name": "男性", | |
109 | +// "value": "27" | |
110 | +// }, | |
111 | +// { | |
112 | +// "label": "女性", | |
113 | +// "name": "女性", | |
114 | +// "value": "28" | |
115 | +// } | |
116 | +// ] | |
117 | +// }, | |
118 | +// { | |
119 | +// "type": "checkbox", | |
120 | +// "name": "年龄", | |
121 | +// "value": "age", | |
122 | +// "submenu": [ | |
123 | +// { | |
124 | +// "label": "通用", | |
125 | +// "name": "通用", | |
126 | +// "value": "24" | |
127 | +// } | |
128 | +// ] | |
129 | +// }, | |
130 | +// { | |
131 | +// "type": "checkbox", | |
132 | +// "name": "适用场景", | |
133 | +// "value": "sense", | |
134 | +// "submenu": [ | |
135 | +// { | |
136 | +// "label": "行政风", | |
137 | +// "name": "行政风", | |
138 | +// "value": "53" | |
139 | +// }, | |
140 | +// { | |
141 | +// "label": "青春学子风", | |
142 | +// "name": "青春学子风", | |
143 | +// "value": "54" | |
144 | +// }, | |
145 | +// { | |
146 | +// "label": "运动风", | |
147 | +// "name": "运动风", | |
148 | +// "value": "55" | |
149 | +// }, | |
150 | +// { | |
151 | +// "label": "简约-极简文艺范", | |
152 | +// "name": "简约-极简文艺范", | |
153 | +// "value": "56" | |
154 | +// }, | |
155 | +// { | |
156 | +// "label": "奶奶风", | |
157 | +// "name": "奶奶风", | |
158 | +// "value": "57" | |
159 | +// }, | |
160 | +// { | |
161 | +// "label": "流线洛可可", | |
162 | +// "name": "流线洛可可", | |
163 | +// "value": "58" | |
164 | +// }, | |
165 | +// { | |
166 | +// "label": "自然舒视角", | |
167 | +// "name": "自然舒视角", | |
168 | +// "value": "59" | |
169 | +// }, | |
170 | +// { | |
171 | +// "label": "无界人文系", | |
172 | +// "name": "无界人文系", | |
173 | +// "value": "60" | |
174 | +// }, | |
175 | +// { | |
176 | +// "label": "有机未来时", | |
177 | +// "name": "有机未来时", | |
178 | +// "value": "61" | |
179 | +// }, | |
180 | +// { | |
181 | +// "label": "立体巴洛克", | |
182 | +// "name": "立体巴洛克", | |
183 | +// "value": "62" | |
184 | +// }, | |
185 | +// { | |
186 | +// "label": "多元新风尚", | |
187 | +// "name": "多元新风尚", | |
188 | +// "value": "63" | |
189 | +// }, | |
190 | +// { | |
191 | +// "label": "理性几何派", | |
192 | +// "name": "理性几何派", | |
193 | +// "value": "64" | |
194 | +// }, | |
195 | +// { | |
196 | +// "label": "轻简北欧风", | |
197 | +// "name": "轻简北欧风", | |
198 | +// "value": "65" | |
199 | +// }, | |
200 | +// { | |
201 | +// "label": "质感哥特潮", | |
202 | +// "name": "质感哥特潮", | |
203 | +// "value": "66" | |
204 | +// }, | |
205 | +// { | |
206 | +// "label": "时尚", | |
207 | +// "name": "时尚", | |
208 | +// "value": "67" | |
209 | +// }, | |
210 | +// { | |
211 | +// "label": "复古", | |
212 | +// "name": "复古", | |
213 | +// "value": "68" | |
214 | +// }, | |
215 | +// { | |
216 | +// "label": "商务", | |
217 | +// "name": "商务", | |
218 | +// "value": "69" | |
219 | +// }, | |
220 | +// { | |
221 | +// "label": "休闲", | |
222 | +// "name": "休闲", | |
223 | +// "value": "70" | |
224 | +// }, | |
225 | +// { | |
226 | +// "label": "折射率", | |
227 | +// "name": "折射率", | |
228 | +// "value": "285" | |
229 | +// } | |
230 | +// ] | |
231 | +// }, | |
232 | +// { | |
233 | +// "type": "checkbox", | |
234 | +// "name": "价格", | |
235 | +// "value": "price", | |
236 | +// "submenu": [ | |
237 | +// { | |
238 | +// "name": "100以下", | |
239 | +// "value": "1,100" | |
240 | +// }, | |
241 | +// { | |
242 | +// "name": "100-300", | |
243 | +// "value": "100,300" | |
244 | +// }, | |
245 | +// { | |
246 | +// "name": "300-1000", | |
247 | +// "value": "300,1000" | |
248 | +// }, | |
249 | +// { | |
250 | +// "name": "1000以上", | |
251 | +// "value": "1000,-1" | |
252 | +// } | |
253 | +// ] | |
254 | +// }, | |
255 | +// { | |
256 | +// "type": "checkbox", | |
257 | +// "name": "材质", | |
258 | +// "value": "glasscate", | |
259 | +// "submenu": [ | |
260 | +// { | |
261 | +// "label": "购易", | |
262 | +// "name": "购易", | |
263 | +// "value": "72" | |
264 | +// }, | |
265 | +// { | |
266 | +// "label": "海俪恩", | |
267 | +// "name": "海俪恩", | |
268 | +// "value": "73" | |
269 | +// }, | |
270 | +// { | |
271 | +// "label": "沙漠风暴", | |
272 | +// "name": "沙漠风暴", | |
273 | +// "value": "74" | |
274 | +// }, | |
275 | +// { | |
276 | +// "label": "古诗", | |
277 | +// "name": "古诗", | |
278 | +// "value": "75" | |
279 | +// }, | |
280 | +// { | |
281 | +// "label": "暴龙", | |
282 | +// "name": "暴龙", | |
283 | +// "value": "76" | |
284 | +// }, | |
285 | +// { | |
286 | +// "label": "犀牛", | |
287 | +// "name": "犀牛", | |
288 | +// "value": "77" | |
289 | +// }, | |
290 | +// { | |
291 | +// "label": "Ray-Ban雷朋", | |
292 | +// "name": "Ray-Ban雷朋", | |
293 | +// "value": "78" | |
294 | +// }, | |
295 | +// { | |
296 | +// "label": "PARIM派丽蒙", | |
297 | +// "name": "PARIM派丽蒙", | |
298 | +// "value": "79" | |
299 | +// }, | |
300 | +// { | |
301 | +// "label": "石狼", | |
302 | +// "name": "石狼", | |
303 | +// "value": "80" | |
304 | +// }, | |
305 | +// { | |
306 | +// "label": "木九十", | |
307 | +// "name": "木九十", | |
308 | +// "value": "81" | |
309 | +// } | |
310 | +// ] | |
311 | +// }, | |
312 | +// { | |
313 | +// "type": "checkbox", | |
314 | +// "name": "品牌", | |
315 | +// "value": "brand", | |
316 | +// "submenu": [ | |
317 | +// { | |
318 | +// "label": "购易", | |
319 | +// "name": "购易", | |
320 | +// "value": "72" | |
321 | +// }, | |
322 | +// { | |
323 | +// "label": "海俪恩", | |
324 | +// "name": "海俪恩", | |
325 | +// "value": "73" | |
326 | +// }, | |
327 | +// { | |
328 | +// "label": "沙漠风暴", | |
329 | +// "name": "沙漠风暴", | |
330 | +// "value": "74" | |
331 | +// }, | |
332 | +// { | |
333 | +// "label": "古诗", | |
334 | +// "name": "古诗", | |
335 | +// "value": "75" | |
336 | +// }, | |
337 | +// { | |
338 | +// "label": "暴龙", | |
339 | +// "name": "暴龙", | |
340 | +// "value": "76" | |
341 | +// }, | |
342 | +// { | |
343 | +// "label": "犀牛", | |
344 | +// "name": "犀牛", | |
345 | +// "value": "77" | |
346 | +// }, | |
347 | +// { | |
348 | +// "label": "Ray-Ban雷朋", | |
349 | +// "name": "Ray-Ban雷朋", | |
350 | +// "value": "78" | |
351 | +// }, | |
352 | +// { | |
353 | +// "label": "PARIM派丽蒙", | |
354 | +// "name": "PARIM派丽蒙", | |
355 | +// "value": "79" | |
356 | +// }, | |
357 | +// { | |
358 | +// "label": "石狼", | |
359 | +// "name": "石狼", | |
360 | +// "value": "80" | |
361 | +// }, | |
362 | +// { | |
363 | +// "label": "木九十", | |
364 | +// "name": "木九十", | |
365 | +// "value": "81" | |
366 | +// } | |
367 | +// ] | |
368 | +// } | |
369 | +// ], | |
370 | +// "groups": [ | |
371 | +// "001", | |
372 | +// "002", | |
373 | +// "003" | |
374 | +// ], | |
375 | +// } | |
376 | +// ] | |
362 | 377 | |
363 | -//初始化数据是为了显示默认骨架 | |
364 | - const state = { | |
365 | - categoryList: [], | |
366 | - list: list | |
367 | - }; | |
368 | - | |
369 | - const mutations = { | |
370 | - LIST: (state, list) => { | |
371 | - state.list = list; | |
372 | - }, | |
373 | - CATEGORY: (state, categoryList) => { | |
374 | - state.categoryList = categoryList; | |
375 | - } | |
376 | - }; | |
378 | +// 初始化数据是为了显示默认骨架 | |
379 | +const state = { | |
380 | + categoryList: [], | |
381 | + list: list, | |
382 | +} | |
377 | 383 | |
378 | - const actions = { | |
379 | - category({ | |
380 | - commit | |
381 | - }, param) { | |
382 | - return new Promise((resolve) => request({ | |
383 | - url: category, | |
384 | - success: (res) => { | |
385 | - let data = res.data.data; | |
386 | - for (let i = 0; i <= data.length; i++) { | |
387 | - if (data[i] && data[i].type !== 'filter') { | |
388 | - data[i].type = 'hierarchy'; | |
389 | - } | |
390 | - } | |
391 | - data.unshift({ | |
392 | - type: "hierarchy", | |
393 | - name: "全部", | |
394 | - value: "all", | |
395 | - isNoPull: true, | |
396 | - }); | |
397 | - commit('CATEGORY', data); | |
398 | - resolve(data) | |
399 | - }, | |
400 | - fail: (res) => { | |
401 | - console.log("fail status === > ", res); | |
402 | - } | |
403 | - })) | |
404 | - | |
405 | - }, | |
406 | - list({ | |
407 | - commit | |
408 | - }, param) { | |
409 | - return new Promise((resolve) => request({ | |
410 | - url: shopList, | |
411 | - success: (res) => { | |
412 | - commit('LIST', res.data.data) | |
413 | - resolve(res.data) | |
414 | - }, | |
415 | - fail: (res) => { | |
416 | - console.log("fail status === > ", res); | |
417 | - }, | |
418 | - complete: (res) => { | |
419 | - state.isLoading = false; | |
420 | - }, | |
421 | - })) | |
422 | - }, | |
423 | - search({ | |
424 | - commit | |
425 | - }, { | |
426 | - params, | |
427 | - keyword | |
428 | - }) { | |
429 | - const uid = uni.getStorageSync('uid'); | |
430 | - return new Promise((resolve) => request({ | |
431 | - url: search, | |
432 | - data: { | |
433 | - params: JSON.stringify(params), | |
434 | - uid, | |
435 | - way: 1, | |
436 | - keyword, | |
437 | - }, | |
438 | - success: (res) => { | |
439 | - commit('LIST', res.data.data); | |
440 | - resolve(res.data) | |
441 | - }, | |
442 | - fail: (res) => { | |
443 | - console.log("fail status === > ", res); | |
444 | - } | |
445 | - })) | |
446 | - | |
447 | - }, | |
448 | - }; | |
384 | +const mutations = { | |
385 | + LIST: (state, list) => { | |
386 | + state.list = list | |
387 | + }, | |
388 | + CATEGORY: (state, categoryList) => { | |
389 | + state.categoryList = categoryList | |
390 | + }, | |
391 | +} | |
449 | 392 | |
450 | - export default { | |
451 | - namespaced: true, | |
452 | - state, | |
453 | - mutations, | |
454 | - actions, | |
455 | - }; | |
456 | 393 | \ No newline at end of file |
394 | +const actions = { | |
395 | + category({ | |
396 | + commit, | |
397 | + }, param) { | |
398 | + return new Promise((resolve) => request({ | |
399 | + url: category, | |
400 | + success: (res) => { | |
401 | + const data = res.data.data | |
402 | + for (let i = 0; i <= data.length; i++) { | |
403 | + if (data[i] && data[i].type !== 'filter') { | |
404 | + data[i].type = 'hierarchy' | |
405 | + } | |
406 | + } | |
407 | + data.unshift({ | |
408 | + type: 'hierarchy', | |
409 | + name: '全部', | |
410 | + value: 'all', | |
411 | + isNoPull: true, | |
412 | + }) | |
413 | + commit('CATEGORY', data) | |
414 | + resolve(data) | |
415 | + }, | |
416 | + fail: (res) => { | |
417 | + console.log('fail status === > ', res) | |
418 | + }, | |
419 | + })) | |
420 | + }, | |
421 | + list({ | |
422 | + commit, | |
423 | + }, param) { | |
424 | + return new Promise((resolve) => request({ | |
425 | + url: shopList, | |
426 | + success: (res) => { | |
427 | + commit('LIST', res.data.data) | |
428 | + resolve(res.data) | |
429 | + }, | |
430 | + fail: (res) => { | |
431 | + console.log('fail status === > ', res) | |
432 | + }, | |
433 | + complete: (res) => { | |
434 | + state.isLoading = false | |
435 | + }, | |
436 | + })) | |
437 | + }, | |
438 | + search({ | |
439 | + commit, | |
440 | + }, { | |
441 | + params, | |
442 | + keyword, | |
443 | + }) { | |
444 | + const uid = uni.getStorageSync('uid') | |
445 | + return new Promise((resolve) => request({ | |
446 | + url: search, | |
447 | + data: { | |
448 | + params: JSON.stringify(params), | |
449 | + uid, | |
450 | + way: JSON.stringify(params) === '{}' ? 0 : 1, | |
451 | + keyword, | |
452 | + }, | |
453 | + success: (res) => { | |
454 | + commit('LIST', res.data.data) | |
455 | + resolve(res.data) | |
456 | + }, | |
457 | + fail: (res) => { | |
458 | + console.log('fail status === > ', res) | |
459 | + }, | |
460 | + })) | |
461 | + }, | |
462 | +} | |
463 | + | |
464 | +export default { | |
465 | + namespaced: true, | |
466 | + state, | |
467 | + mutations, | |
468 | + actions, | |
469 | +} | ... | ... |
src/store/request.js
1 | 1 | const DOMAIN = 'https://api.glass.xiuyetang.com' |
2 | 2 | |
3 | +let loading = false | |
4 | + | |
3 | 5 | export default async function request({ |
4 | 6 | url, |
5 | 7 | method = 'post', |
... | ... | @@ -16,8 +18,19 @@ export default async function request({ |
16 | 18 | }, |
17 | 19 | complete = (res) => { |
18 | 20 | console.log('complete status === > ', res) |
21 | + if (loading) { | |
22 | + uni.hideLoading() | |
23 | + } | |
19 | 24 | }, |
25 | + isLoading = false, | |
26 | + loadingText = '加载中', | |
20 | 27 | }) { |
28 | + if (isLoading) { | |
29 | + loading = isLoading | |
30 | + uni.showLoading({ | |
31 | + title: loadingText, | |
32 | + }) | |
33 | + } | |
21 | 34 | const uid = uni.getStorageSync('uid') |
22 | 35 | const openid = uni.getStorageSync('openid') |
23 | 36 | data = { | ... | ... |