Compare View
Commits (2)
Showing
5 changed files
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
... | ... | @@ -3,7 +3,6 @@ |
3 | 3 | <view |
4 | 4 | class="card" |
5 | 5 | v-if="current == status" |
6 | - | |
7 | 6 | > |
8 | 7 | <view class="cardHeader"> |
9 | 8 | <text |
... | ... | @@ -30,7 +29,7 @@ |
30 | 29 | </view> |
31 | 30 | <view |
32 | 31 | class="orderCardInfo" |
33 | - @click="toOrderInfo(status,order.pay_id)" | |
32 | + @click="toOrderInfo(status,order.pay_id)" | |
34 | 33 | v-for="(orderInfo, index) in orderInfoList" |
35 | 34 | :key="index" |
36 | 35 | > |
... | ... | @@ -53,8 +52,14 @@ |
53 | 52 | class="btns" |
54 | 53 | v-if="status == '0'" |
55 | 54 | > |
56 | - <view class="btn-type1" @click="cancleOrder">取消订单</view> | |
57 | - <view class="btn-type2" @click="paylog">去支付</view> | |
55 | + <view | |
56 | + class="btn-type1" | |
57 | + @click="cancleOrder" | |
58 | + >取消订单</view> | |
59 | + <view | |
60 | + class="btn-type2" | |
61 | + @click="paylog" | |
62 | + >去支付</view> | |
58 | 63 | </view> |
59 | 64 | <view |
60 | 65 | class="btns" |
... | ... | @@ -66,268 +71,314 @@ |
66 | 71 | class="btns" |
67 | 72 | v-if="status == '2'" |
68 | 73 | > |
69 | - <view class="btn-type2" @click="toDetail(order.order_info[0].pid)">再次购买</view> | |
74 | + <view | |
75 | + class="btn-type2" | |
76 | + @click="toDetail(order.order_info[0].pid)" | |
77 | + >再次购买</view> | |
78 | + </view> | |
79 | + <!-- <view class="btns" v-if="status == '3'"> | |
80 | + <view class="btn-type2">再次购买</view> | |
81 | + </view> --> | |
82 | + </view> | |
83 | + <view | |
84 | + class="card" | |
85 | + v-if="current == '10'" | |
86 | + > | |
87 | + <view class="cardHeader"> | |
88 | + <text | |
89 | + class="orderId" | |
90 | + v-if="status == '0'||status == '1'" | |
91 | + >订单号:{{order.pay_id}}</text> | |
92 | + <text | |
93 | + class="orderId" | |
94 | + v-if="status == '2'||status == '3'" | |
95 | + >下单时间:{{order.pay_time}}</text> | |
96 | + <text | |
97 | + class="orderType" | |
98 | + v-if="status=='0'" | |
99 | + >待付款</text> | |
100 | + <text | |
101 | + class="orderType" | |
102 | + v-if="status=='1'" | |
103 | + >待收货</text> | |
104 | + <text | |
105 | + class="orderType" | |
106 | + v-if="status == '2'||status == '3'" | |
107 | + >已完成</text> | |
108 | + <!-- <text class="orderType" v-if="status == '3'">已评价</text> --> | |
109 | + </view> | |
110 | + <view | |
111 | + class="orderCardInfo" | |
112 | + @click="toOrderInfo(status,order.pay_id)" | |
113 | + v-for="(orderInfo) in orderInfoList" | |
114 | + :key="orderInfo" | |
115 | + > | |
116 | + <image | |
117 | + :src="orderInfo.imgUrl" | |
118 | + mode="aspectFill" | |
119 | + ></image> | |
120 | + <view class="infoText"> | |
121 | + <view class="orderName">{{orderInfo.p_name}}</view> | |
122 | + <view class="orderDescrib">{{orderInfo.p_name}}</view> | |
123 | + <view class="infoText-bottom"> | |
124 | + <view class="markPrice">{{orderInfo.nowPrice}}</view> | |
125 | + <view class="buy-num">X {{orderInfo.num}}</view> | |
126 | + </view> | |
127 | + </view> | |
128 | + </view> | |
129 | + <view class="payPrice">实付:<text class="priceNum">{{order.total_fee}}</text> </view> | |
130 | + <view | |
131 | + class="btns" | |
132 | + v-if="status == '0'" | |
133 | + > | |
134 | + <view | |
135 | + class="btn-type1" | |
136 | + @click="cancleOrder" | |
137 | + >取消订单</view> | |
138 | + <view | |
139 | + class="btn-type2" | |
140 | + @click="paylog" | |
141 | + >去支付</view> | |
142 | + </view> | |
143 | + <view | |
144 | + class="btns" | |
145 | + v-if="status == '1'" | |
146 | + > | |
147 | + <view class="btn-type2">确认收货</view> | |
148 | + </view> | |
149 | + <view | |
150 | + class="btns" | |
151 | + v-if="status == '2'||status == '3'" | |
152 | + > | |
153 | + <view | |
154 | + class="btn-type2" | |
155 | + @click="toDetail(order.order_info[0].pid)" | |
156 | + >再次购买</view> | |
70 | 157 | </view> |
71 | - <!-- <view class="btns" v-if="status == '3'"> | |
72 | - <view class="btn-type2">再次购买</view> | |
73 | - </view> --> | |
74 | - </view> | |
75 | - <view class="card" v-if="current == '10'" > | |
76 | - <view class="cardHeader"> | |
77 | - <text class="orderId" v-if="status == '0'||status == '1'">订单号:{{order.pay_id}}</text> | |
78 | - <text class="orderId" v-if="status == '2'||status == '3'">下单时间:{{order.pay_time}}</text> | |
79 | - <text class="orderType" v-if="status=='0'">待付款</text> | |
80 | - <text class="orderType" v-if="status=='1'">待收货</text> | |
81 | - <text class="orderType" v-if="status == '2'||status == '3'">已完成</text> | |
82 | - <!-- <text class="orderType" v-if="status == '3'">已评价</text> --> | |
83 | - </view> | |
84 | - <view class="orderCardInfo" @click="toOrderInfo(status,order.pay_id)" v-for="(orderInfo) in orderInfoList" :key="orderInfo"> | |
85 | - <image :src="orderInfo.imgUrl" mode="aspectFill"></image> | |
86 | - <view class="infoText"> | |
87 | - <view class="orderName">{{orderInfo.p_name}}</view> | |
88 | - <view class="orderDescrib">{{orderInfo.p_name}}</view> | |
89 | - <view class="infoText-bottom"> | |
90 | - <view class="markPrice">{{orderInfo.nowPrice}}</view> | |
91 | - <view class="buy-num">X {{orderInfo.num}}</view> | |
92 | - </view> | |
93 | - </view> | |
94 | - </view> | |
95 | - <view class="payPrice">实付:<text class="priceNum">{{order.total_fee}}</text> </view> | |
96 | - <view class="btns" v-if="status == '0'"> | |
97 | - <view class="btn-type1" @click="cancleOrder">取消订单</view> | |
98 | - <view class="btn-type2" @click="paylog">去支付</view> | |
99 | - </view> | |
100 | - <view class="btns" v-if="status == '1'"> | |
101 | - <view class="btn-type2">确认收货</view> | |
102 | - </view> | |
103 | - <view class="btns" v-if="status == '2'||status == '3'"> | |
104 | - <view class="btn-type2" @click="toDetail(order.order_info[0].pid)">再次购买</view> | |
105 | - </view> | |
106 | 158 | </view> |
107 | 159 | </view> |
108 | 160 | </template> |
109 | 161 | |
110 | 162 | <script> |
111 | - import MD5Util from '../../../utils/md5' | |
112 | - import store from "@/store"; | |
113 | - export default { | |
114 | - data() { | |
115 | - return { | |
116 | - | |
117 | - }; | |
118 | - }, | |
119 | - props: { | |
120 | - /** | |
121 | - * 订单数据 | |
122 | - */ | |
123 | - order: {}, | |
124 | - /** | |
125 | - * 当前选择 | |
126 | - */ | |
127 | - current:Number | |
128 | - | |
129 | - }, | |
130 | - created() { | |
131 | - console.log('order',this.order); | |
132 | - // console.log(this.order.status ); | |
133 | - // console.log(this.current); | |
134 | - }, | |
135 | - computed:{ | |
136 | - status(){ | |
137 | - return this.order.status | |
138 | - }, | |
139 | - orderInfoList(){ | |
140 | - return this.order.order_info | |
141 | - } | |
142 | - }, | |
143 | - methods:{ | |
144 | - async paylog() { | |
145 | - const openid = uni.getStorageSync('openid') | |
146 | - const uid = this.order.uid; | |
147 | - //先拿订单详情 | |
148 | - await store.dispatch('orderRead/getOrderInfo', { | |
149 | - pay_id: this.order.pay_id, | |
150 | - uid: uid, | |
151 | - openid: openid | |
152 | - }).then((res)=>{ | |
153 | - // console.log(res) | |
154 | - const { data, exKeyName: keyName } = res.order_info | |
155 | - const timeStamp = new Date().getTime().toString() | |
156 | - const total_fee = res.total_fee | |
157 | - const payId = res.pay_id | |
158 | - const nonceStr = 'asfafasfasfasfasf' | |
159 | - // 支付参数 | |
160 | - const fieldSet = { | |
161 | - openid: openid, | |
162 | - uid: uid, | |
163 | - shopid: 0, | |
164 | - payCate: 2020, | |
165 | - payMoney: total_fee, | |
166 | - payWoodId: `fcdj-${uid}-${keyName}`, | |
167 | - payWoodDesc: '在【非常戴镜】的微信付款凭证', | |
168 | - nonceStr, | |
169 | - signType: 'MD5', | |
170 | - app_uid: 2020, | |
171 | - timeStamp, | |
172 | - keyname: keyName, | |
173 | - billInfo: JSON.stringify(data), | |
174 | - } | |
175 | - // 请求后台支付接口 | |
176 | - store.dispatch('order/pay', fieldSet).then(({ data, data2, pay_id: payId }) => { | |
177 | - if (data.return_code === 'SUCCESS' && data.result_code === 'SUCCESS') { | |
178 | - const stringA = `appId=wx115b25aa396d27ac&nonceStr=${nonceStr}&package=prepay_id=${data.prepay_id}&signType=MD5&timeStamp=${timeStamp}` | |
179 | - const stringSignTemp = stringA + '&key=NewMoney2017hatemydaddy123456789' | |
180 | - | |
181 | - // 微信支付接口 | |
182 | - uni.requestPayment({ | |
183 | - appId: data.appid, | |
184 | - timeStamp, | |
185 | - nonceStr, | |
186 | - total_fee: total_fee, | |
187 | - package: `prepay_id=${data.prepay_id}`, | |
188 | - signType: 'MD5', | |
189 | - paySign: MD5Util.MD5(stringSignTemp).toUpperCase(), | |
190 | - success: (res) => { | |
191 | - // 支付成功 | |
192 | - uni.showModal({ | |
193 | - content: '支付成功', | |
194 | - showCancel: false, | |
195 | - }) | |
196 | - // //修改订单状态 待付款==>待收货 | |
197 | - // store.dispatch("statusConfirm/confirm", { | |
198 | - // uid: this.uid, | |
199 | - // openid: this.openid, | |
200 | - // oldway: "0", | |
201 | - // way: "1", | |
202 | - // pay_id: payId, | |
203 | - // judgeContent: "", | |
204 | - // orderInfo: this.orderInfo.order_info | |
205 | - // }) | |
206 | - }, | |
207 | - fail: (res) => { | |
208 | - // 支付失败 | |
209 | - uni.showModal({ | |
210 | - content: '支付失败', | |
211 | - showCancel: false, | |
212 | - }) | |
213 | - }, | |
214 | - complete: () => { | |
215 | - uni.hideLoading() | |
216 | - }, | |
217 | - }) | |
218 | - } else { | |
219 | - uni.showModal({ | |
220 | - content: '支付失败', | |
221 | - showCancel: false, | |
222 | - }) | |
223 | - console.log('支付失败') | |
224 | - uni.hideLoading() | |
225 | - } | |
226 | - }) | |
227 | - //修改订单状态 待付款==>待收货 | |
228 | - // store.dispatch("statusConfirm/confirm", { | |
229 | - // uid: this.uid, | |
230 | - // openid: this.openid, | |
231 | - // oldway: "0", | |
232 | - // way: "1", | |
233 | - // pay_id: this.payId, | |
234 | - // judgeContent: "", | |
235 | - // orderInfo: this.orderInfo.order_info | |
236 | - // }) | |
237 | - }) | |
238 | - }, | |
239 | - | |
240 | - async cancleOrder(e) { | |
241 | - const openid = uni.getStorageSync('openid') | |
242 | - const uid = this.order.uid; | |
243 | - //先从订单详情中拿到keyname | |
244 | - await store.dispatch('orderRead/getOrderInfo', { | |
245 | - pay_id: this.order.pay_id, | |
246 | - uid: uid, | |
247 | - openid: openid | |
248 | - }).then((res)=>{ | |
249 | - const keyname = res.order_info.keyname | |
250 | - uni.showModal({ | |
251 | - title: "提示", | |
252 | - content: "现在取消,订单不可恢复哦,确认取消吗?", | |
253 | - success: function(res) { | |
254 | - if (res.confirm) { | |
255 | - store.dispatch("cancelOrder/cancel", { | |
256 | - keyname: keyname, | |
257 | - uid: uid, | |
258 | - openid: openid | |
259 | - }).then((res)=>{ | |
260 | - console.log(res) | |
261 | - if(res.code == 1){ | |
262 | - store.dispatch("myOrder/getList", { | |
263 | - way: "" | |
264 | - }); | |
265 | - }else{ | |
266 | - uni.showToast({ | |
267 | - title:'取消失败,服务器错误!', | |
268 | - icon:'none' | |
269 | - }) | |
270 | - } | |
271 | - }); | |
272 | - } else if (res.cancel) { | |
273 | - console.log("用户点击取消"); | |
274 | - } | |
275 | - } | |
276 | - }); | |
277 | - }); | |
278 | - | |
279 | - }, | |
280 | - toDetail(pid){ | |
281 | - console.log('pid',pid) | |
282 | - uni.navigateTo({ | |
283 | - url: '../details/details?pid='+pid, | |
284 | - fail: (res) => {console.log(res)}, | |
285 | - }); | |
286 | - }, | |
287 | - toRefundment(){ | |
288 | - uni.navigateTo({ | |
289 | - url: '../refundment/refundment', | |
290 | - success: res => {}, | |
291 | - fail: () => {}, | |
292 | - complete: () => {} | |
293 | - }); | |
294 | - }, | |
295 | - toOrderInfo(status,payId){ | |
296 | - console.log(status,payId) | |
297 | - switch(status){ | |
298 | - // 0待付款 1待收货 2已收货 3 已评价 | |
299 | - case '0': | |
300 | - uni.navigateTo({ | |
301 | - url:`../myOrderPaying/myOrderPaying?status=`+status+`&payId=`+payId, | |
302 | - fail(errMsg) { | |
303 | - console.log(errMsg) | |
304 | - } | |
305 | - }) | |
306 | - break; | |
307 | - case '1': | |
308 | - uni.navigateTo({ | |
309 | - url:`../myOrderPaying/myOrderPaying?status=`+status+`&payId=`+payId, | |
310 | - fail(errMsg) { | |
311 | - console.log(errMsg) | |
312 | - } | |
313 | - }) | |
314 | - | |
315 | - break; | |
316 | - case '2' || '3': | |
317 | - uni.navigateTo({ | |
318 | - url:`../myOrderPaying/myOrderPaying?status=`+status+`&payId=`+payId, | |
319 | - fail(errMsg) { | |
320 | - console.log(errMsg) | |
321 | - } | |
322 | - }) | |
323 | - break; | |
324 | - default: | |
325 | - break; | |
326 | - | |
327 | - } | |
328 | - } | |
329 | - } | |
330 | - } | |
163 | +import MD5Util from '../../../utils/md5' | |
164 | +import store from '@/store' | |
165 | +export default { | |
166 | + data() { | |
167 | + return { | |
168 | + | |
169 | + } | |
170 | + }, | |
171 | + props: { | |
172 | + /** | |
173 | + * 订单数据 | |
174 | + */ | |
175 | + order: {}, | |
176 | + /** | |
177 | + * 当前选择 | |
178 | + */ | |
179 | + current: Number, | |
180 | + | |
181 | + }, | |
182 | + created() { | |
183 | + console.log('order', this.order) | |
184 | + // console.log(this.order.status ); | |
185 | + // console.log(this.current); | |
186 | + }, | |
187 | + computed: { | |
188 | + status() { | |
189 | + return this.order.status | |
190 | + }, | |
191 | + orderInfoList() { | |
192 | + const orderInfoList = this.order.order_info | |
193 | + return Array.isArray(orderInfoList) ? orderInfoList : orderInfoList.data | |
194 | + }, | |
195 | + }, | |
196 | + methods: { | |
197 | + async paylog() { | |
198 | + const openid = uni.getStorageSync('openid') | |
199 | + const uid = this.order.uid | |
200 | + // 先拿订单详情 | |
201 | + await store.dispatch('orderRead/getOrderInfo', { | |
202 | + pay_id: this.order.pay_id, | |
203 | + uid: uid, | |
204 | + openid: openid, | |
205 | + }).then((res) => { | |
206 | + // console.log(res) | |
207 | + const { data, exKeyName: keyName } = res.order_info | |
208 | + const timeStamp = new Date().getTime().toString() | |
209 | + const total_fee = res.total_fee | |
210 | + const payId = res.pay_id | |
211 | + const nonceStr = 'asfafasfasfasfasf' | |
212 | + // 支付参数 | |
213 | + const fieldSet = { | |
214 | + openid: openid, | |
215 | + uid: uid, | |
216 | + shopid: 0, | |
217 | + payCate: 2020, | |
218 | + payMoney: total_fee, | |
219 | + payWoodId: `fcdj-${uid}-${keyName}`, | |
220 | + payWoodDesc: '在【非常戴镜】的微信付款凭证', | |
221 | + nonceStr, | |
222 | + signType: 'MD5', | |
223 | + app_uid: 2020, | |
224 | + timeStamp, | |
225 | + keyname: keyName, | |
226 | + billInfo: JSON.stringify(data), | |
227 | + } | |
228 | + // 请求后台支付接口 | |
229 | + store.dispatch('order/pay', fieldSet).then(({ data, data2, pay_id: payId }) => { | |
230 | + if (data.return_code === 'SUCCESS' && data.result_code === 'SUCCESS') { | |
231 | + const stringA = `appId=wx115b25aa396d27ac&nonceStr=${nonceStr}&package=prepay_id=${data.prepay_id}&signType=MD5&timeStamp=${timeStamp}` | |
232 | + const stringSignTemp = stringA + '&key=NewMoney2017hatemydaddy123456789' | |
233 | + | |
234 | + // 微信支付接口 | |
235 | + uni.requestPayment({ | |
236 | + appId: data.appid, | |
237 | + timeStamp, | |
238 | + nonceStr, | |
239 | + total_fee: total_fee, | |
240 | + package: `prepay_id=${data.prepay_id}`, | |
241 | + signType: 'MD5', | |
242 | + paySign: MD5Util.MD5(stringSignTemp).toUpperCase(), | |
243 | + success: (res) => { | |
244 | + // 支付成功 | |
245 | + uni.showModal({ | |
246 | + content: '支付成功', | |
247 | + showCancel: false, | |
248 | + }) | |
249 | + // //修改订单状态 待付款==>待收货 | |
250 | + // store.dispatch("statusConfirm/confirm", { | |
251 | + // uid: this.uid, | |
252 | + // openid: this.openid, | |
253 | + // oldway: "0", | |
254 | + // way: "1", | |
255 | + // pay_id: payId, | |
256 | + // judgeContent: "", | |
257 | + // orderInfo: this.orderInfo.order_info | |
258 | + // }) | |
259 | + }, | |
260 | + fail: (res) => { | |
261 | + // 支付失败 | |
262 | + uni.showModal({ | |
263 | + content: '支付失败', | |
264 | + showCancel: false, | |
265 | + }) | |
266 | + }, | |
267 | + complete: () => { | |
268 | + uni.hideLoading() | |
269 | + }, | |
270 | + }) | |
271 | + } else { | |
272 | + uni.showModal({ | |
273 | + content: '支付失败', | |
274 | + showCancel: false, | |
275 | + }) | |
276 | + console.log('支付失败') | |
277 | + uni.hideLoading() | |
278 | + } | |
279 | + }) | |
280 | + // 修改订单状态 待付款==>待收货 | |
281 | + // store.dispatch("statusConfirm/confirm", { | |
282 | + // uid: this.uid, | |
283 | + // openid: this.openid, | |
284 | + // oldway: "0", | |
285 | + // way: "1", | |
286 | + // pay_id: this.payId, | |
287 | + // judgeContent: "", | |
288 | + // orderInfo: this.orderInfo.order_info | |
289 | + // }) | |
290 | + }) | |
291 | + }, | |
292 | + | |
293 | + async cancleOrder(e) { | |
294 | + const openid = uni.getStorageSync('openid') | |
295 | + const uid = this.order.uid | |
296 | + // 先从订单详情中拿到keyname | |
297 | + await store.dispatch('orderRead/getOrderInfo', { | |
298 | + pay_id: this.order.pay_id, | |
299 | + uid: uid, | |
300 | + openid: openid, | |
301 | + }).then((res) => { | |
302 | + const keyname = res.order_info.keyname | |
303 | + uni.showModal({ | |
304 | + title: '提示', | |
305 | + content: '现在取消,订单不可恢复哦,确认取消吗?', | |
306 | + success: function(res) { | |
307 | + if (res.confirm) { | |
308 | + store.dispatch('cancelOrder/cancel', { | |
309 | + keyname: keyname, | |
310 | + uid: uid, | |
311 | + openid: openid, | |
312 | + }).then((res) => { | |
313 | + console.log(res) | |
314 | + if (res.code == 1) { | |
315 | + store.dispatch('myOrder/getList', { | |
316 | + way: '', | |
317 | + }) | |
318 | + } else { | |
319 | + uni.showToast({ | |
320 | + title: '取消失败,服务器错误!', | |
321 | + icon: 'none', | |
322 | + }) | |
323 | + } | |
324 | + }) | |
325 | + } else if (res.cancel) { | |
326 | + console.log('用户点击取消') | |
327 | + } | |
328 | + }, | |
329 | + }) | |
330 | + }) | |
331 | + }, | |
332 | + toDetail(pid) { | |
333 | + console.log('pid', pid) | |
334 | + uni.navigateTo({ | |
335 | + url: '../details/details?pid=' + pid, | |
336 | + fail: (res) => { console.log(res) }, | |
337 | + }) | |
338 | + }, | |
339 | + toRefundment() { | |
340 | + uni.navigateTo({ | |
341 | + url: '../refundment/refundment', | |
342 | + success: res => {}, | |
343 | + fail: () => {}, | |
344 | + complete: () => {}, | |
345 | + }) | |
346 | + }, | |
347 | + toOrderInfo(status, payId) { | |
348 | + console.log(status, payId) | |
349 | + switch (status) { | |
350 | + // 0待付款 1待收货 2已收货 3 已评价 | |
351 | + case '0': | |
352 | + uni.navigateTo({ | |
353 | + url: '../myOrderPaying/myOrderPaying?status=' + status + '&payId=' + payId, | |
354 | + fail(errMsg) { | |
355 | + console.log(errMsg) | |
356 | + }, | |
357 | + }) | |
358 | + break | |
359 | + case '1': | |
360 | + uni.navigateTo({ | |
361 | + url: '../myOrderPaying/myOrderPaying?status=' + status + '&payId=' + payId, | |
362 | + fail(errMsg) { | |
363 | + console.log(errMsg) | |
364 | + }, | |
365 | + }) | |
366 | + | |
367 | + break | |
368 | + case '2' || '3': | |
369 | + uni.navigateTo({ | |
370 | + url: '../myOrderPaying/myOrderPaying?status=' + status + '&payId=' + payId, | |
371 | + fail(errMsg) { | |
372 | + console.log(errMsg) | |
373 | + }, | |
374 | + }) | |
375 | + break | |
376 | + default: | |
377 | + break | |
378 | + } | |
379 | + }, | |
380 | + }, | |
381 | +} | |
331 | 382 | |
332 | 383 | </script> |
333 | 384 | ... | ... |
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 = { | ... | ... |