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
1 | <template> | 1 | <template> |
2 | <view class="container"> | 2 | <view class="container"> |
3 | <!-- 基础信息 --> | 3 | <!-- 基础信息 --> |
4 | <view class="basic_info"> | 4 | <view class="basic_info"> |
5 | <!-- 轮播图 --> | 5 | <!-- 轮播图 --> |
6 | <swiper | 6 | <swiper |
7 | class="swiperImage" | 7 | class="swiperImage" |
8 | :indicator-dots="true" | 8 | :indicator-dots="true" |
9 | :autoplay="true" | 9 | :autoplay="true" |
10 | :interval="4000" | 10 | :interval="4000" |
11 | :duration="500" | 11 | :duration="500" |
12 | > | 12 | > |
13 | <swiper-item | 13 | <swiper-item |
14 | v-for="(item, index) in carousel" | 14 | v-for="(item, index) in carousel" |
15 | :key="index" | 15 | :key="index" |
16 | > | 16 | > |
17 | <image | 17 | <image |
18 | :src="item" | 18 | :src="item" |
19 | mode="scaleToFill" | 19 | mode="scaleToFill" |
20 | ></image> | 20 | ></image> |
21 | </swiper-item> | 21 | </swiper-item> |
22 | </swiper> | 22 | </swiper> |
23 | <!-- 产品价格及购买人数 --> | 23 | <!-- 产品价格及购买人数 --> |
24 | <view class="info_pay"> | 24 | <view class="info_pay"> |
25 | <view>¥{{goodsInfo.price || '暂无'}}<span | 25 | <view>¥{{goodsInfo.price || '暂无'}}<span |
26 | v-if="goodsInfo.discountPrice" | 26 | v-if="goodsInfo.discountPrice" |
27 | class="info_pay_discount" | 27 | class="info_pay_discount" |
28 | >¥{{goodsInfo.discountPrice}}</span></view> | 28 | >¥{{goodsInfo.discountPrice}}</span></view> |
29 | <span class="info_pay_number">{{goodsInfo.tradeNumber || '暂无'}}人购买过</span> | 29 | <span class="info_pay_number">{{goodsInfo.tradeNumber || '暂无'}}人购买过</span> |
30 | </view> | 30 | </view> |
31 | <!-- 产品名称 --> | 31 | <!-- 产品名称 --> |
32 | <view class="info_name"> | 32 | <view class="info_name"> |
33 | <text class="info_name_name">{{goodsInfo.name || '暂无'}}</text> | 33 | <text class="info_name_name">{{goodsInfo.name || '暂无'}}</text> |
34 | <view | 34 | <view |
35 | @tap="confirmShare" | 35 | @tap="confirmShare" |
36 | class="info_name_share" | 36 | class="info_name_share" |
37 | > | 37 | > |
38 | <image src="/static/img/detail/share-icon.png"></image> | 38 | <image src="/static/img/detail/share-icon.png"></image> |
39 | <text>分享</text> | 39 | <text>分享</text> |
40 | </view> | 40 | </view> |
41 | </view> | 41 | </view> |
42 | <!-- 产品售后信息 --> | 42 | <!-- 产品售后信息 --> |
43 | <view class="info_after"> | 43 | <view class="info_after"> |
44 | <span>支持7天无理由退货</span> | 44 | <span>支持7天无理由退货</span> |
45 | <span>顺丰发货</span> | 45 | <span>顺丰发货</span> |
46 | <span>30天质量保证</span> | 46 | <span>30天质量保证</span> |
47 | </view> | 47 | </view> |
48 | </view> | 48 | </view> |
49 | <!-- 详细信息 --> | 49 | <!-- 详细信息 --> |
50 | <view class="detail_info"> | 50 | <view class="detail_info"> |
51 | <!-- 详细信息菜单 --> | 51 | <!-- 详细信息菜单 --> |
52 | <view class="screen_bar"> | 52 | <view class="screen_bar"> |
53 | <view | 53 | <view |
54 | v-for="(item, index) in screenItems" | 54 | v-for="(item, index) in screenItems" |
55 | :key="index" | 55 | :key="index" |
56 | @click="tabChange(index)" | 56 | @click="tabChange(index)" |
57 | > | 57 | > |
58 | <view | 58 | <view |
59 | class="screen_item" | 59 | class="screen_item" |
60 | v-bind:class="{ item_active: item_current === index }" | 60 | v-bind:class="{ item_active: item_current === index }" |
61 | >{{ screenItems[index] || '暂无' }}</view> | 61 | >{{ screenItems[index] || '暂无' }}</view> |
62 | </view> | 62 | </view> |
63 | </view> | 63 | </view> |
64 | <!-- 商品介绍 --> | 64 | <!-- 商品介绍 --> |
65 | <view | 65 | <view |
66 | class="screen_item" | 66 | class="screen_item" |
67 | v-if="item_current === 0" | 67 | v-if="item_current === 0" |
68 | > | 68 | > |
69 | <Introduce :tag="tag" /> | 69 | <Introduce :tag="tag" /> |
70 | </view> | 70 | </view> |
71 | <!-- 规格参数 --> | 71 | <!-- 规格参数 --> |
72 | <view | 72 | <view |
73 | class="screen_item" | 73 | class="screen_item" |
74 | v-if="item_current === 1" | 74 | v-if="item_current === 1" |
75 | > | 75 | > |
76 | <view class="specification"> | 76 | <view class="specification"> |
77 | <view | 77 | <view |
78 | class="spe_item" | 78 | class="spe_item" |
79 | v-for="(item, index) in specification" | 79 | v-for="(item, index) in specification" |
80 | :key="index" | 80 | :key="index" |
81 | > | 81 | > |
82 | <image | 82 | <image |
83 | class="spe_image" | 83 | class="spe_image" |
84 | v-bind:src="item.img" | 84 | v-bind:src="item.img" |
85 | ></image> | 85 | ></image> |
86 | <span>{{item.standard || '暂无'}}</span> | 86 | <span>{{item.standard || '暂无'}}</span> |
87 | <span>{{item.slength || '暂无'}}</span> | 87 | <span>{{item.slength || '暂无'}}</span> |
88 | </view> | 88 | </view> |
89 | </view> | 89 | </view> |
90 | </view> | 90 | </view> |
91 | <!-- 售后保障 --> | 91 | <!-- 售后保障 --> |
92 | <view | 92 | <view |
93 | class="screen_item" | 93 | class="screen_item" |
94 | v-if="item_current === 2" | 94 | v-if="item_current === 2" |
95 | > | 95 | > |
96 | <AfterSails /> | 96 | <AfterSails /> |
97 | </view> | 97 | </view> |
98 | </view> | 98 | </view> |
99 | <!-- 评价 --> | 99 | <!-- 评价 --> |
100 | <template v-if="item_current !== 2"> | 100 | <template v-if="item_current !== 2"> |
101 | <view class="evaluate"> | 101 | <view class="evaluate"> |
102 | <!-- 标题 --> | 102 | <!-- 标题 --> |
103 | <view class="evaluate_title"> | 103 | <view class="evaluate_title"> |
104 | <view><span>宝贝好评率</span><span class="title_rate">{{evaluate.rate}}</span></view> | 104 | <view><span>宝贝好评率</span><span class="title_rate">{{evaluate.rate}}</span></view> |
105 | <!-- 星星 --> | 105 | <!-- 星星 --> |
106 | <view class="evaluate_star"> | 106 | <view class="evaluate_star"> |
107 | <view | 107 | <view |
108 | class="star" | 108 | class="star" |
109 | v-for="(item, index) in evaluate.star" | 109 | v-for="(item, index) in evaluate.star" |
110 | :key="index" | 110 | :key="index" |
111 | > | 111 | > |
112 | <image | 112 | <image |
113 | src="../../static/img/detail/d_star.png" | 113 | src="../../static/img/detail/d_star.png" |
114 | mode="aspectFill" | 114 | mode="aspectFill" |
115 | style="height: 26rpx; width: 28rpx;" | 115 | style="height: 26rpx; width: 28rpx;" |
116 | ></image> | 116 | ></image> |
117 | </view> | 117 | </view> |
118 | </view> | 118 | </view> |
119 | </view> | 119 | </view> |
120 | <!-- 标签 --> | 120 | <!-- 标签 --> |
121 | <view class="evaluate_tag"> | 121 | <view class="evaluate_tag"> |
122 | <view | 122 | <view |
123 | v-for="(item, index) in evaluate.tag" | 123 | v-for="(item, index) in evaluate.tag" |
124 | :key="index" | 124 | :key="index" |
125 | >{{item.name}}</view> | 125 | >{{item.name}}</view> |
126 | </view> | 126 | </view> |
127 | </view> | 127 | </view> |
128 | </template> | 128 | </template> |
129 | <!-- 商品详情页 --> | 129 | <!-- 商品详情页 --> |
130 | <template v-if="current !==2"> | 130 | <template v-if="current !==2"> |
131 | <view class="more_info"> | 131 | <view class="more_info"> |
132 | <view | 132 | <view |
133 | class="more_fixed1" | 133 | class="more_fixed1" |
134 | @click="consolg(goodInfo.prodIntro1)" | 134 | @click="consolg(goodInfo.prodIntro1)" |
135 | > | 135 | > |
136 | <image src="/static/img/detail/hr.png"></image> | 136 | <image src="/static/img/detail/hr.png"></image> |
137 | <view>商品详情</view> | 137 | <view>商品详情</view> |
138 | <image src="/static/img/detail/hr.png"></image> | 138 | <image src="/static/img/detail/hr.png"></image> |
139 | </view> | 139 | </view> |
140 | <view | 140 | <view |
141 | class="more_all" | 141 | class="more_all" |
142 | v-html="more" | 142 | v-html="more" |
143 | > | 143 | > |
144 | </view> | 144 | </view> |
145 | </view> | 145 | </view> |
146 | </template> | 146 | </template> |
147 | <!-- 底部菜单 --> | 147 | <!-- 底部菜单 --> |
148 | <view class="menu"> | 148 | <view class="menu"> |
149 | <view | 149 | <view |
150 | @tap="toCart()" | 150 | @tap="toCart()" |
151 | class="menu_1" | 151 | class="menu_1" |
152 | > | 152 | > |
153 | <view class="cart_icon"> | 153 | <view class="cart_icon"> |
154 | <image src="/static/tab-cart.png" /> | 154 | <image src="/static/tab-cart.png" /> |
155 | <text>{{cartNumber}}</text> | 155 | <text>{{cartNumber}}</text> |
156 | </view> | 156 | </view> |
157 | <view class="menu_image">购物车</view> | 157 | <view class="menu_image">购物车</view> |
158 | </view> | 158 | </view> |
159 | <view class="menu_2"> | 159 | <view class="menu_2"> |
160 | <view | 160 | <view |
161 | class="menu_input" | 161 | class="menu_input" |
162 | @tap="showBottom(1)" | 162 | @tap="showBottom(1)" |
163 | >加入购物车</view> | 163 | >加入购物车</view> |
164 | <view | 164 | <view |
165 | class="menu_now" | 165 | class="menu_now" |
166 | @click="showBottom(2)" | 166 | @click="showBottom(2)" |
167 | >立即购买</view> | 167 | >立即购买</view> |
168 | </view> | 168 | </view> |
169 | </view> | 169 | </view> |
170 | <!-- 参数选择 --> | 170 | <!-- 参数选择 --> |
171 | <template v-if="isShowBottom"> | 171 | <template v-if="isShowBottom"> |
172 | <BottomSheet | 172 | <BottomSheet |
173 | :isCart="isCart" | 173 | :isCart="isCart" |
174 | @addCart="addCart" | 174 | @addCart="addCart" |
175 | :pid="pid" | 175 | :pid="pid" |
176 | :goodInfo="goodInfo" | 176 | :goodInfo="goodInfo" |
177 | :isShowBottom="isShowBottom" | 177 | :isShowBottom="isShowBottom" |
178 | @closeBottom="closeBottom" | 178 | @closeBottom="closeBottom" |
179 | ></BottomSheet> | 179 | ></BottomSheet> |
180 | </template> | 180 | </template> |
181 | <!-- 分享 --> | 181 | <!-- 分享 --> |
182 | <template> | 182 | <template> |
183 | <uni-popup | 183 | <uni-popup |
184 | ref="popupShare" | 184 | ref="popupShare" |
185 | type="share" | 185 | type="share" |
186 | > | 186 | > |
187 | <uni-popup-share @select="selectShare"></uni-popup-share> | 187 | <uni-popup-share @select="selectShare"></uni-popup-share> |
188 | </uni-popup> | 188 | </uni-popup> |
189 | </template> | 189 | </template> |
190 | <!-- 分享海报 --> | 190 | <!-- 分享海报 --> |
191 | <template> | 191 | <template> |
192 | <uni-popup | 192 | <uni-popup |
193 | ref="uniPopupPost" | 193 | ref="uniPopupPost" |
194 | type="center" | 194 | type="center" |
195 | > | 195 | > |
196 | <uni-popup-post :postUrl="postUrl"></uni-popup-post> | 196 | <uni-popup-post :postUrl="postUrl"></uni-popup-post> |
197 | </uni-popup> | 197 | </uni-popup> |
198 | </template> | 198 | </template> |
199 | </view> | 199 | </view> |
200 | </template> | 200 | </template> |
201 | 201 | ||
202 | <script> | 202 | <script> |
203 | import store from '@/store' | 203 | import store from '@/store' |
204 | import Introduce from './components/Introduce' // 商品介绍基本信息组件 | 204 | import Introduce from './components/Introduce' // 商品介绍基本信息组件 |
205 | import AfterSails from './components/AfterSails' // 售后保障组件 | 205 | import AfterSails from './components/AfterSails' // 售后保障组件 |
206 | import uniPopupShare from '@/components/uni-popup/uni-popup-share.vue' // 分享组件 | 206 | import uniPopupShare from '@/components/uni-popup/uni-popup-share.vue' // 分享组件 |
207 | import uniPopupPost from '@/components/uni-popup/uni-popup-post.vue' // 分享组件 | 207 | import uniPopupPost from '@/components/uni-popup/uni-popup-post.vue' // 分享组件 |
208 | import BottomSheet from '@/components/BottomSheet/BottomSheet.vue' // 参数选择组件 | 208 | import BottomSheet from '@/components/BottomSheet/BottomSheet.vue' // 参数选择组件 |
209 | 209 | ||
210 | export default { | 210 | export default { |
211 | components: { | 211 | components: { |
212 | Introduce, | 212 | Introduce, |
213 | AfterSails, | 213 | AfterSails, |
214 | BottomSheet, | 214 | BottomSheet, |
215 | uniPopupShare, | 215 | uniPopupShare, |
216 | uniPopupPost, | 216 | uniPopupPost, |
217 | }, | 217 | }, |
218 | data () { | 218 | data () { |
219 | return { | 219 | return { |
220 | pid: 7, // 产品ID | 220 | pid: 7, // 产品ID |
221 | skId: undefined, // skuId | 221 | skId: undefined, // skuId |
222 | // 详细信息菜单 | 222 | // 详细信息菜单 |
223 | item_current: 0, | 223 | item_current: 0, |
224 | screenItems: [ | 224 | screenItems: [ |
225 | '商品介绍', | 225 | '商品介绍', |
226 | '规格参数', | 226 | '规格参数', |
227 | '售后保障', | 227 | '售后保障', |
228 | ], | 228 | ], |
229 | showPostImg: false, // 是否展示分享海报 | 229 | showPostImg: false, // 是否展示分享海报 |
230 | isShowBottom: false, // 是否展示参数选择 | 230 | isShowBottom: false, // 是否展示参数选择 |
231 | isCart: 1, // 参数选择 按钮判断 | 231 | isCart: 1, // 参数选择 按钮判断 |
232 | } | 232 | } |
233 | }, | 233 | }, |
234 | onLoad({ pid = this.pid, sk_id: skId }) { | 234 | onLoad({ pid = this.pid, sk_id: skId }) { |
235 | // 根据页面传参请求页面数据 | 235 | // 根据页面传参请求页面数据 |
236 | this.pid = pid | 236 | this.pid = pid |
237 | this.skId = skId | 237 | this.skId = skId |
238 | 238 | ||
239 | // 获取产品详情 | 239 | // 获取产品详情 |
240 | this.getDetails({ pid, skId }) | 240 | this.getDetails({ pid, skId }) |
241 | // 获取购物车数据 | 241 | // 获取购物车数据 |
242 | this.getCartNum() | 242 | this.getCartNum() |
243 | }, | 243 | }, |
244 | computed: { | 244 | computed: { |
245 | // 获取轮播图数据 | 245 | // 获取轮播图数据 |
246 | goodInfo() { | 246 | goodInfo() { |
247 | return this.$store.state.details.goodInfo | 247 | return this.$store.state.details.goodInfo |
248 | }, | 248 | }, |
249 | // 获取轮播图数据 | 249 | // 获取轮播图数据 |
250 | carousel() { | 250 | carousel() { |
251 | return this.$store.state.details.carousel | 251 | return this.$store.state.details.carousel |
252 | }, | 252 | }, |
253 | // 商品基本信息 | 253 | // 商品基本信息 |
254 | goodsInfo() { | 254 | goodsInfo() { |
255 | return this.$store.state.details.goodsInfo | 255 | return this.$store.state.details.goodsInfo |
256 | }, | 256 | }, |
257 | // 商品介绍商品标签 | 257 | // 商品介绍商品标签 |
258 | tag() { | 258 | tag() { |
259 | return this.$store.state.details.tag | 259 | return this.$store.state.details.tag |
260 | }, | 260 | }, |
261 | // 规格参数 | 261 | // 规格参数 |
262 | specification() { | 262 | specification() { |
263 | return this.$store.state.details.specification | 263 | return this.$store.state.details.specification |
264 | }, | 264 | }, |
265 | // 评价 | 265 | // 评价 |
266 | evaluate() { | 266 | evaluate() { |
267 | return this.$store.state.details.evaluate | 267 | return this.$store.state.details.evaluate |
268 | }, | 268 | }, |
269 | // 商品详情 | 269 | // 商品详情 |
270 | more() { | 270 | more() { |
271 | return this.$store.state.details.more | 271 | return this.$store.state.details.more |
272 | }, | 272 | }, |
273 | // 购物车数目 | 273 | // 购物车数目 |
274 | cartNumber() { | 274 | cartNumber() { |
275 | return this.$store.state.details.cartNumber | 275 | return this.$store.state.details.cartNumber |
276 | }, | 276 | }, |
277 | // 购物车数目 | 277 | // 购物车数目 |
278 | skuList() { | 278 | skuList() { |
279 | return this.$store.state.details.skuList | 279 | return this.$store.state.details.skuList |
280 | }, | 280 | }, |
281 | // 分享海报 | 281 | // 分享海报 |
282 | postUrl() { | 282 | postUrl() { |
283 | return this.$store.state.details.postUrl | 283 | return this.$store.state.details.postUrl |
284 | }, | 284 | }, |
285 | }, | 285 | }, |
286 | methods: { | 286 | methods: { |
287 | // 获取产品详情 | 287 | // 获取产品详情 |
288 | getDetails({ pid, skId }) { | 288 | getDetails({ pid, skId }) { |
289 | store.dispatch('details/details', { | 289 | store.dispatch('details/details', { |
290 | pid, | 290 | pid, |
291 | sk_id: skId, | 291 | sk_id: skId, |
292 | }) | 292 | }) |
293 | store.dispatch('read/fetch', { | 293 | store.dispatch('read/fetch', { |
294 | pid, | 294 | pid, |
295 | sk_id: skId, | 295 | sk_id: skId, |
296 | }) | 296 | }) |
297 | }, | 297 | }, |
298 | // 获取购物车数目 | 298 | // 获取购物车数目 |
299 | getCartNum() { | 299 | getCartNum() { |
300 | store.dispatch('details/getCartNumber') | 300 | store.dispatch('details/getCartNumber') |
301 | }, | 301 | }, |
302 | // 切换详细信息菜单 | 302 | // 切换详细信息菜单 |
303 | tabChange (e) { | 303 | tabChange (e) { |
304 | if (this.current !== e) { | 304 | if (this.current !== e) { |
305 | this.item_current = e | 305 | this.item_current = e |
306 | } | 306 | } |
307 | }, | 307 | }, |
308 | // 打开分享界面 | 308 | // 打开分享界面 |
309 | confirmShare() { | 309 | confirmShare() { |
310 | this.$refs.popupShare.open() | 310 | this.$refs.popupShare.open() |
311 | }, | 311 | }, |
312 | // 选择分享 | 312 | // 选择分享 |
313 | selectShare(e, done) { | 313 | selectShare(e, done) { |
314 | switch (e.item.name) { | 314 | switch (e.item.name) { |
315 | // 分享到好物圈 | 315 | // 分享到好物圈 |
316 | case 'recommend': | 316 | case 'recommend': |
317 | this.shareRecommend() | 317 | this.shareRecommend() |
318 | break | 318 | break |
319 | // 分享到朋友圈 | 319 | // 分享到朋友圈 |
320 | case 'friend': | 320 | case 'friend': |
321 | break | 321 | break |
322 | // 生成海报 | 322 | // 生成海报 |
323 | case 'poster': | 323 | case 'poster': |
324 | uni.showLoading({ | 324 | uni.showLoading({ |
325 | title: '生成图片中', | 325 | title: '生成图片中', |
326 | }) | 326 | }) |
327 | this.sharePost() | 327 | this.sharePost() |
328 | break | 328 | break |
329 | default: | 329 | default: |
330 | break | 330 | break |
331 | } | 331 | } |
332 | done() | 332 | done() |
333 | }, | 333 | }, |
334 | // 分享到好物圈 | 334 | // 分享到好物圈 |
335 | shareRecommend() { | 335 | shareRecommend() { |
336 | if (wx.openBusinessView) { | 336 | if (wx.openBusinessView) { |
337 | wx.openBusinessView({ | 337 | wx.openBusinessView({ |
338 | businessType: 'friendGoodsRecommend', | 338 | businessType: 'friendGoodsRecommend', |
339 | extraData: { | 339 | extraData: { |
340 | product: { | 340 | product: { |
341 | item_code: '58_68', | 341 | item_code: '58_68', |
342 | title: this.goodsInfo.name, | 342 | title: this.goodsInfo.name, |
343 | image_list: this.carousel, | 343 | image_list: this.carousel, |
344 | }, | 344 | }, |
345 | }, | 345 | }, |
346 | success: function (res) { | 346 | success: function (res) { |
347 | uni.showToast({ | 347 | uni.showToast({ |
348 | title: '好物圈分享成功!', | 348 | title: '好物圈分享成功!', |
349 | icon: 'none', | 349 | icon: 'none', |
350 | duration: 2000, | 350 | duration: 2000, |
351 | }) | 351 | }) |
352 | // 向服务器报告这个事情 | 352 | // 向服务器报告这个事情 |
353 | // TODO:::记录这个用户的推广过程。 | 353 | // TODO:::记录这个用户的推广过程。 |
354 | console.log('好物圈分享成功!', res) | 354 | console.log('好物圈分享成功!', res) |
355 | }, | 355 | }, |
356 | fail: function (res) { | 356 | fail: function (res) { |
357 | console.log('好物圈分享失败!', res) | 357 | console.log('好物圈分享失败!', res) |
358 | }, | 358 | }, |
359 | }) | 359 | }) |
360 | } | 360 | } |
361 | }, | 361 | }, |
362 | // 分享到朋友/圈 | 362 | // 分享到朋友/圈 |
363 | shareFriend() { | 363 | shareFriend() { |
364 | this.onShareAppMessage() | 364 | this.onShareAppMessage() |
365 | }, | 365 | }, |
366 | // 朋友圈设置页面 | 366 | // 朋友圈设置页面 |
367 | onShareAppMessage() { | 367 | onShareAppMessage() { |
368 | let myName = this.$store.state.user.userInfo.nickName | 368 | let myName = this.$store.state.user.userInfo.nickName |
369 | if (myName === '' || myName.length < 1 || myName === '匿名用户' || typeof myName === 'undefined') { | 369 | if (myName === '' || myName.length < 1 || myName === '匿名用户' || typeof myName === 'undefined') { |
370 | myName = '【神秘人】' | 370 | myName = '【神秘人】' |
371 | } else { | 371 | } else { |
372 | myName = '【' + myName + '】' | 372 | myName = '【' + myName + '】' |
373 | } | 373 | } |
374 | return { | 374 | return { |
375 | title: 'Hi,' + myName + '送你300元来试戴最新潮流眼镜!', // 默认是小程序的名称(可以写slogan等) | 375 | title: 'Hi,' + myName + '送你300元来试戴最新潮流眼镜!', // 默认是小程序的名称(可以写slogan等) |
376 | path: '/pages/details/details?sid=0&pid=' + this.pid, | 376 | path: '/pages/details/details?sid=0&pid=' + this.pid, |
377 | imageUrl: this.skuList[0].pic, // 不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4 | 377 | imageUrl: this.skuList[0].pic, // 不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4 |
378 | success: function (res) { | 378 | success: function (res) { |
379 | if (res.errMsg === 'shareAppMessage:ok') { | 379 | if (res.errMsg === 'shareAppMessage:ok') { |
380 | console.log('分享成功!', res) | 380 | console.log('分享成功!', res) |
381 | } | 381 | } |
382 | }, | 382 | }, |
383 | fail: function (res) { | 383 | fail: function (res) { |
384 | if (res.errMsg === 'shareAppMessage:fail cancel') { | 384 | if (res.errMsg === 'shareAppMessage:fail cancel') { |
385 | console.log('fail', '放弃分享') | 385 | console.log('fail', '放弃分享') |
386 | } else if (res.errMsg === 'shareAppMessage:fail') { | 386 | } else if (res.errMsg === 'shareAppMessage:fail') { |
387 | console.log('fail', '分享失败') | 387 | console.log('fail', '分享失败') |
388 | } | 388 | } |
389 | }, | 389 | }, |
390 | } | 390 | } |
391 | }, | 391 | }, |
392 | // 生成海报 | 392 | // 生成海报 |
393 | sharePost() { | 393 | sharePost() { |
394 | const fromsid = this.$store.state.user.fromInfo.fromsid || 'undefined' | 394 | const fromsid = this.$store.state.user.fromInfo.fromsid || 'undefined' |
395 | 395 | ||
396 | store.dispatch('details/post', { | 396 | store.dispatch('details/post', { |
397 | pid: this.pid, | 397 | pid: this.pid, |
398 | sid: fromsid === 'undefined' ? 0 : fromsid, | 398 | sid: fromsid === 'undefined' ? 0 : fromsid, |
399 | }).then((data) => { | 399 | }).then((data) => { |
400 | uni.hideLoading() | 400 | uni.hideLoading() |
401 | this.$refs.uniPopupPost.open() | 401 | this.$refs.uniPopupPost.open() |
402 | }) | 402 | }) |
403 | }, | 403 | }, |
404 | // 参数选择弹窗开关 | 404 | // 参数选择弹窗开关 |
405 | showBottom(isCart) { | 405 | showBottom(isCart) { |
406 | this.isCart = isCart | 406 | this.isCart = isCart |
407 | this.isShowBottom = true | 407 | this.isShowBottom = true |
408 | }, | 408 | }, |
409 | closeBottom() { | 409 | closeBottom() { |
410 | this.isShowBottom = false | 410 | this.isShowBottom = false |
411 | }, | 411 | }, |
412 | // 前往购物车 | 412 | // 前往购物车 |
413 | toCart() { | 413 | toCart() { |
414 | uni.switchTab({ | 414 | uni.switchTab({ |
415 | url: '/pages/cart/cart', | 415 | url: '/pages/cart/cart', |
416 | success: res => {}, | 416 | success: res => {}, |
417 | fail: (error) => { console.log('跳转购物车失败======>', error) }, | 417 | fail: (error) => { console.log('跳转购物车失败======>', error) }, |
418 | complete: () => { console.log('toCart') }, | 418 | complete: () => { console.log('toCart') }, |
419 | }) | 419 | }) |
420 | }, | 420 | }, |
421 | // 加入购物车 | 421 | // 加入购物车 |
422 | addCart (mpId, num, checkedSKU, skId, price) { | 422 | addCart (mpId, num, checkedSKU, skId, price) { |
423 | const addCartList = {} | 423 | const addCartList = {} |
424 | addCartList.mp_id = mpId | 424 | addCartList.mp_id = mpId |
425 | addCartList.sk_id = skId | 425 | addCartList.sk_id = skId |
426 | addCartList.num = num | 426 | addCartList.num = num |
427 | addCartList.checkedSKU = checkedSKU | 427 | addCartList.checkedSKU = checkedSKU |
428 | addCartList.pid = this.pid | 428 | addCartList.pid = this.pid |
429 | addCartList.price = price | 429 | addCartList.price = price |
430 | console.log('添加购物车的参数', addCartList) | 430 | console.log('添加购物车的参数', addCartList) |
431 | store.dispatch('cart/addCart', addCartList).then((res) => { | 431 | store.dispatch('cart/addCart', addCartList).then((res) => { |
432 | if (res.code === 1) { | 432 | if (res.code === 1) { |
433 | uni.showToast({ | 433 | uni.showToast({ |
434 | title: '添加成功~', | 434 | title: '添加成功~', |
435 | icon: 'success', | 435 | icon: 'success', |
436 | }) | 436 | }) |
437 | } | 437 | } |
438 | // 再次请求购物车接口,实现实时更新 | 438 | // 再次请求购物车接口,实现实时更新 |
439 | store.dispatch('details/getCartNumber') | 439 | store.dispatch('details/getCartNumber') |
440 | }) | 440 | }) |
441 | }, | 441 | }, |
442 | }, | 442 | }, |
443 | } | 443 | } |
444 | </script> | 444 | </script> |
445 | 445 | ||
446 | <style lang="scss"> | 446 | <style lang="scss"> |
447 | .container { | 447 | .container { |
448 | background-color: #f8f8f8; | 448 | background-color: #f8f8f8; |
449 | font-family: "PingFangSC-Regular"; | 449 | font-family: "PingFangSC-Regular"; |
450 | // 板块样式 | 450 | // 板块样式 |
451 | > view { | 451 | > view { |
452 | background: #ffffff; | 452 | background: #ffffff; |
453 | margin-bottom: 10px; | 453 | margin-bottom: 10px; |
454 | padding: 8px 20px 8px 20px; | 454 | padding: 8px 20px 8px 20px; |
455 | box-sizing: border-box; | 455 | box-sizing: border-box; |
456 | } | 456 | } |
457 | // 基础信息板块 | 457 | // 基础信息板块 |
458 | .basic_info { | 458 | .basic_info { |
459 | // 轮播图 | 459 | // 轮播图 |
460 | .swiperImage { | 460 | .swiperImage { |
461 | width: 684rpx; | 461 | width: 684rpx; |
462 | height: 480rpx; | 462 | height: 480rpx; |
463 | text-align: center; | 463 | text-align: center; |
464 | image { | 464 | image { |
465 | max-width: 100%; | 465 | max-width: 100%; |
466 | max-height: 100%; | 466 | max-height: 100%; |
467 | border-radius: 16rpx; | 467 | border-radius: 16rpx; |
468 | } | 468 | } |
469 | } | 469 | } |
470 | // 产品价格及购买人数 | 470 | // 产品价格及购买人数 |
471 | .info_pay { | 471 | .info_pay { |
472 | color: #eb5d3b; | 472 | color: #eb5d3b; |
473 | font-size: 18px; | 473 | font-size: 18px; |
474 | margin-top: 5px; | 474 | margin-top: 5px; |
475 | font-family: "PingFangSC-Semibold"; | 475 | font-family: "PingFangSC-Semibold"; |
476 | display: flex; | 476 | display: flex; |
477 | justify-content: space-between; | 477 | justify-content: space-between; |
478 | .info_pay_discount { | 478 | .info_pay_discount { |
479 | text-decoration: line-through; | 479 | text-decoration: line-through; |
480 | margin-left: 8rpx; | 480 | margin-left: 8rpx; |
481 | color: #999; | 481 | color: #999; |
482 | font-size: 14px; | 482 | font-size: 14px; |
483 | } | 483 | } |
484 | .info_pay_number { | 484 | .info_pay_number { |
485 | color: #999; | 485 | color: #999; |
486 | font-size: 14px; | 486 | font-size: 14px; |
487 | font-family: PingFangSC-Regular; | 487 | font-family: PingFangSC-Regular; |
488 | } | 488 | } |
489 | } | 489 | } |
490 | // 产品名称 | 490 | // 产品名称 |
491 | .info_name { | 491 | .info_name { |
492 | margin-top: 5px; | 492 | margin-top: 5px; |
493 | display: flex; | 493 | display: flex; |
494 | justify-content: space-between; | 494 | justify-content: space-between; |
495 | .info_name_name { | 495 | .info_name_name { |
496 | margin-right: 10px; | 496 | margin-right: 10px; |
497 | font-size: 16px; | 497 | font-size: 16px; |
498 | font-family: "PingFangSC-Semibold"; | 498 | font-family: "PingFangSC-Semibold"; |
499 | max-width: 592rpx; | 499 | max-width: 592rpx; |
500 | } | 500 | } |
501 | .info_name_share { | 501 | .info_name_share { |
502 | display: flex; | 502 | display: flex; |
503 | flex-direction: column; | 503 | flex-direction: column; |
504 | justify-content: space-between; | 504 | justify-content: space-between; |
505 | align-items: center; | 505 | align-items: center; |
506 | margin-top: 14rpx; | 506 | margin-top: 14rpx; |
507 | > image { | 507 | > image { |
508 | height: 40rpx; | 508 | height: 40rpx; |
509 | width: 40rpx; | 509 | width: 40rpx; |
510 | } | 510 | } |
511 | > text { | 511 | > text { |
512 | font-family: PingFangSC-Regular; | 512 | font-family: PingFangSC-Regular; |
513 | font-size: 12px; | 513 | font-size: 12px; |
514 | color: #999; | 514 | color: #999; |
515 | letter-spacing: -0.23px; | 515 | letter-spacing: -0.23px; |
516 | } | 516 | } |
517 | } | 517 | } |
518 | } | 518 | } |
519 | // 售后服务 | 519 | // 售后服务 |
520 | .info_after { | 520 | .info_after { |
521 | font-size: 10px; | 521 | font-size: 10px; |
522 | color: #999; | 522 | color: #999; |
523 | margin-top: 20rpx; | 523 | margin-top: 20rpx; |
524 | > span { | 524 | > span { |
525 | height: 14px; | 525 | height: 14px; |
526 | margin-right: 10px; | 526 | margin-right: 10px; |
527 | } | 527 | } |
528 | } | 528 | } |
529 | } | 529 | } |
530 | // 详细信息 | 530 | // 详细信息 |
531 | .detail_info { | 531 | .detail_info { |
532 | margin-bottom: 20rpx; | 532 | margin-bottom: 20rpx; |
533 | .screen_bar { | 533 | .screen_bar { |
534 | width: 670rpx; | 534 | width: 670rpx; |
535 | margin-top: 20rpx; | 535 | margin-top: 20rpx; |
536 | margin-bottom: 24rpx; | 536 | margin-bottom: 24rpx; |
537 | display: flex; | 537 | display: flex; |
538 | flex-direction: row; | 538 | flex-direction: row; |
539 | justify-content: space-between; | 539 | justify-content: space-between; |
540 | align-items: center; | 540 | align-items: center; |
541 | font-size: 14px; | 541 | font-size: 14px; |
542 | color: #333333; | 542 | color: #333333; |
543 | transition: all 0.2s; | 543 | transition: all 0.2s; |
544 | } | 544 | } |
545 | .item_active { | 545 | .item_active { |
546 | border-bottom: 4rpx solid #ff6b4a; | 546 | border-bottom: 4rpx solid #ff6b4a; |
547 | } | 547 | } |
548 | .screen_item { | 548 | .screen_item { |
549 | font-size: 32rpx; | 549 | font-size: 32rpx; |
550 | color: #333333; | 550 | color: #333333; |
551 | display: flex; | 551 | display: flex; |
552 | transition: all 0.2s; | 552 | transition: all 0.2s; |
553 | // 规格参数 | 553 | // 规格参数 |
554 | .specification { | 554 | .specification { |
555 | margin-bottom: 4px; | 555 | margin-bottom: 4px; |
556 | .spe_item { | 556 | .spe_item { |
557 | image { | 557 | image { |
558 | width: 50px; | 558 | width: 50px; |
559 | height: 25px; | 559 | height: 25px; |
560 | margin-right: 6px; | 560 | margin-right: 6px; |
561 | vertical-align: middle; | 561 | vertical-align: middle; |
562 | } | 562 | } |
563 | span { | 563 | span { |
564 | margin-left: 24rpx; | 564 | margin-left: 24rpx; |
565 | } | 565 | } |
566 | } | 566 | } |
567 | } | 567 | } |
568 | } | 568 | } |
569 | // | 569 | // |
570 | } | 570 | } |
571 | // 宝贝好评率 | 571 | // 宝贝好评率 |
572 | .evaluate { | 572 | .evaluate { |
573 | .evaluate_title { | 573 | .evaluate_title { |
574 | font-size: 14px; | 574 | font-size: 14px; |
575 | color: #333333; | 575 | color: #333333; |
576 | display: flex; | 576 | display: flex; |
577 | justify-content: space-between; | 577 | justify-content: space-between; |
578 | .title_rate { | 578 | .title_rate { |
579 | margin-left: 10rpx; | 579 | margin-left: 10rpx; |
580 | } | 580 | } |
581 | .evaluate_star { | 581 | .evaluate_star { |
582 | width: 90px; | 582 | width: 90px; |
583 | display: flex; | 583 | display: flex; |
584 | align-items: center; | 584 | align-items: center; |
585 | justify-content: space-between; | 585 | justify-content: space-between; |
586 | } | 586 | } |
587 | view { | 587 | view { |
588 | font-size: 14px; | 588 | font-size: 14px; |
589 | color: #333333; | 589 | color: #333333; |
590 | font-weight: bold; | 590 | font-weight: bold; |
591 | } | 591 | } |
592 | } | 592 | } |
593 | .evaluate_tag { | 593 | .evaluate_tag { |
594 | view { | 594 | view { |
595 | display: inline-block; | 595 | display: inline-block; |
596 | margin-right: 20rpx; | 596 | margin-right: 20rpx; |
597 | min-width: 180rpx; | 597 | min-width: 180rpx; |
598 | margin-top: 10px; | 598 | margin-top: 10px; |
599 | height: 48rpx; | 599 | height: 48rpx; |
600 | background: #f2f2f2; | 600 | background: #f2f2f2; |
601 | border-radius: 2px; | 601 | border-radius: 2px; |
602 | font-family: PingFangSC-Regular; | 602 | font-family: PingFangSC-Regular; |
603 | font-size: 12px; | 603 | font-size: 12px; |
604 | color: #666666; | 604 | color: #666666; |
605 | letter-spacing: -0.23px; | 605 | letter-spacing: -0.23px; |
606 | text-align: center; | 606 | text-align: center; |
607 | padding: 0 48rpx; | 607 | padding: 0 48rpx; |
608 | line-height: 48rpx; | 608 | line-height: 48rpx; |
609 | } | 609 | } |
610 | } | 610 | } |
611 | } | 611 | } |
612 | // 商品详情 | 612 | // 商品详情 |
613 | .more_info { | 613 | .more_info { |
614 | .more_fixed1 { | 614 | .more_fixed1 { |
615 | display: flex; | 615 | display: flex; |
616 | justify-content: space-between; | 616 | justify-content: space-between; |
617 | align-content: center; | 617 | align-content: center; |
618 | margin-bottom: 12px; | 618 | margin-bottom: 12px; |
619 | view { | 619 | view { |
620 | font-size: 14px; | 620 | font-size: 14px; |
621 | color: #333333; | 621 | color: #333333; |
622 | font-weight: bold; | 622 | font-weight: bold; |
623 | font-family: "PingFangSC-Medium"; | 623 | font-family: "PingFangSC-Medium"; |
624 | line-height: 24px; | 624 | line-height: 24px; |
625 | } | 625 | } |
626 | image { | 626 | image { |
627 | width: 240rpx; | 627 | width: 240rpx; |
628 | height: 3px; | 628 | height: 3px; |
629 | margin-top: 10px; | 629 | margin-top: 10px; |
630 | } | 630 | } |
631 | } | 631 | } |
632 | .more_all { | 632 | .more_all { |
633 | width: 100%; | 633 | width: 100%; |
634 | margin-top: 30rpx; | 634 | margin-top: 30rpx; |
635 | margin-right: 30rpx; | 635 | margin-right: 30rpx; |
636 | margin-bottom: 180rpx; | 636 | margin-bottom: 180rpx; |
637 | font-family: "PingFangSC-Regular"; | 637 | font-family: "PingFangSC-Regular"; |
638 | } | 638 | } |
639 | } | 639 | } |
640 | // 菜单 | 640 | // 菜单 |
641 | .menu { | 641 | .menu { |
642 | position: fixed; | 642 | position: fixed; |
643 | bottom: 0; | 643 | bottom: 0; |
644 | min-height: 74px; | 644 | min-height: 74px; |
645 | width: 100%; | 645 | width: 100%; |
646 | background: #ffffff; | 646 | background: #ffffff; |
647 | padding: 20px 20px 8px 20px; | 647 | padding: 20px 20px 8px 20px; |
648 | font-family: "PingFangSC-Regular"; | 648 | font-family: "PingFangSC-Regular"; |
649 | box-sizing: border-box; | 649 | box-sizing: border-box; |
650 | display: flex; | 650 | display: flex; |
651 | justify-content: space-between; | 651 | justify-content: space-between; |
652 | align-content: center; | 652 | align-content: center; |
653 | margin: 0; | 653 | margin: 0; |
654 | /* iphonex 等安全区设置,底部安全区适配 */ | 654 | /* iphonex 等安全区设置,底部安全区适配 */ |
655 | /* #ifndef APP-NVUE */ | 655 | /* #ifndef APP-NVUE */ |
656 | padding-bottom: constant(safe-area-inset-bottom); | 656 | padding-bottom: constant(safe-area-inset-bottom); |
657 | padding-bottom: env(safe-area-inset-bottom); | 657 | padding-bottom: env(safe-area-inset-bottom); |
658 | /* #endif */ | ||
658 | .menu_1 { | 659 | .menu_1 { |
659 | width: 20%; | 660 | width: 20%; |
660 | height: 100%; | 661 | height: 100%; |
661 | text-align: center; | 662 | text-align: center; |
662 | color: #989898; | 663 | color: #989898; |
663 | .cart_icon { | 664 | .cart_icon { |
664 | position: relative; | 665 | position: relative; |
665 | text { | 666 | text { |
666 | position: absolute; | 667 | position: absolute; |
667 | color: white; | 668 | color: white; |
668 | font-size: 17px; | 669 | font-size: 17px; |
669 | background-color: red; | 670 | background-color: red; |
670 | min-height: 24px; | 671 | min-height: 24px; |
671 | min-width: 24px; | 672 | min-width: 24px; |
672 | line-height: 24px; | 673 | line-height: 24px; |
673 | right: -12%; | 674 | right: -12%; |
674 | top: -12px; | 675 | top: -12px; |
675 | text-align: center; | 676 | text-align: center; |
676 | border-radius: 24px; | 677 | border-radius: 24px; |
677 | padding: 2px; | 678 | padding: 2px; |
678 | } | 679 | } |
679 | } | 680 | } |
680 | } | 681 | } |
681 | image { | 682 | image { |
682 | width: 42%; | 683 | width: 42%; |
683 | height: 26px; | 684 | height: 26px; |
684 | } | 685 | } |
685 | .menu_image { | 686 | .menu_image { |
686 | font-size: 12px; | 687 | font-size: 12px; |
687 | text-align: center; | 688 | text-align: center; |
688 | } | 689 | } |
689 | .menu_2 { | 690 | .menu_2 { |
690 | width: 74%; | 691 | width: 74%; |
691 | height: 80rpx; | 692 | height: 80rpx; |
692 | display: grid; | 693 | display: grid; |
693 | grid-template-columns: 50% 50%; | 694 | grid-template-columns: 50% 50%; |
694 | } | 695 | } |
695 | .menu_input { | 696 | .menu_input { |
696 | display: inline-flex; | 697 | display: inline-flex; |
697 | align-items: center; | 698 | align-items: center; |
698 | justify-content: space-around; | 699 | justify-content: space-around; |
699 | background: #fff0ec; | 700 | background: #fff0ec; |
700 | font-size: 16px; | 701 | font-size: 16px; |
701 | color: #ff6b4a; | 702 | color: #ff6b4a; |
702 | border-radius: 20px 0 0 20px; | 703 | border-radius: 20px 0 0 20px; |
703 | } | 704 | } |
704 | .menu_now { | 705 | .menu_now { |
705 | display: inline-flex; | 706 | display: inline-flex; |
706 | align-items: center; | 707 | align-items: center; |
707 | justify-content: space-around; | 708 | justify-content: space-around; |
708 | background: #ff6b4a; | 709 | background: #ff6b4a; |
709 | font-size: 16px; | 710 | font-size: 16px; |
710 | color: #ffffff; | 711 | color: #ffffff; |
711 | border-radius: 0 20px 20px 0; | 712 | border-radius: 0 20px 20px 0; |
712 | } | 713 | } |
713 | } | 714 | } |
714 | } | 715 | } |
715 | </style> | 716 | </style> |
716 | 717 |
src/pages/index/index.vue
1 | <template> | 1 | <template> |
2 | <view class="container"> | 2 | <view class="container"> |
3 | <view | 3 | <view |
4 | class="content skeleton" | 4 | class="content skeleton" |
5 | v-show="showContent" | 5 | v-show="showContent" |
6 | > | 6 | > |
7 | <view class="header"> | 7 | <view class="header"> |
8 | <!-- 搜索--> | 8 | <!-- 搜索--> |
9 | <view class="searchBar skeleton-rect"> | 9 | <view class="searchBar skeleton-rect"> |
10 | <icon | 10 | <icon |
11 | class="searchIcon" | 11 | class="searchIcon" |
12 | type="search" | 12 | type="search" |
13 | size="14" | 13 | size="14" |
14 | ></icon> | 14 | ></icon> |
15 | <input | 15 | <input |
16 | v-model="searchText" | 16 | v-model="searchText" |
17 | class="searchIpt" | 17 | class="searchIpt" |
18 | placeholder="老花镜" | 18 | placeholder="老花镜" |
19 | confirm-type="search" | 19 | confirm-type="search" |
20 | @blur="searchKey" | 20 | @blur="searchKey" |
21 | /> | 21 | /> |
22 | </view> | 22 | </view> |
23 | 23 | ||
24 | <!-- 筛选栏--> | 24 | <!-- 筛选栏--> |
25 | <!-- <view class="screenBar"> | 25 | <!-- <view class="screenBar"> |
26 | <view | 26 | <view |
27 | v-for="item in screenItems" | 27 | v-for="item in screenItems" |
28 | :key="item.current" | 28 | :key="item.current" |
29 | @click="onClickItem(item.current)" | 29 | @click="onClickItem(item.current)" |
30 | > | 30 | > |
31 | <view | 31 | <view |
32 | class="screenItem" | 32 | class="screenItem" |
33 | v-bind:class="{ active: current === item.current }" | 33 | v-bind:class="{ active: current === item.current }" |
34 | v-if="item.current === 2" | 34 | v-if="item.current === 2" |
35 | @click="dropDown" | 35 | @click="dropDown" |
36 | > | 36 | > |
37 | {{ item.text }} | 37 | {{ item.text }} |
38 | <icon | 38 | <icon |
39 | type="info" | 39 | type="info" |
40 | size="14" | 40 | size="14" |
41 | ></icon> | 41 | ></icon> |
42 | </view> | 42 | </view> |
43 | <view | 43 | <view |
44 | class="screenItem" | 44 | class="screenItem" |
45 | v-bind:class="{ active: current === item.current }" | 45 | v-bind:class="{ active: current === item.current }" |
46 | v-if="item.current === 4" | 46 | v-if="item.current === 4" |
47 | @click="showDrawer('showRight')" | 47 | @click="showDrawer('showRight')" |
48 | > | 48 | > |
49 | {{ item.text }} | 49 | {{ item.text }} |
50 | <icon | 50 | <icon |
51 | type="info" | 51 | type="info" |
52 | size="14" | 52 | size="14" |
53 | ></icon> | 53 | ></icon> |
54 | </view> | 54 | </view> |
55 | <view v-if="item.current !== 2&&item.current!==4"> | 55 | <view v-if="item.current !== 2&&item.current!==4"> |
56 | <view | 56 | <view |
57 | class="screenItem" | 57 | class="screenItem" |
58 | v-bind:class="{ active: current === item.current }" | 58 | v-bind:class="{ active: current === item.current }" |
59 | >{{ item.text }}</view> | 59 | >{{ item.text }}</view> |
60 | </view> | 60 | </view> |
61 | </view> | 61 | </view> |
62 | </view> --> | 62 | </view> --> |
63 | </view> | 63 | </view> |
64 | <Uni-drawer | 64 | <Uni-drawer |
65 | ref="showRight" | 65 | ref="showRight" |
66 | mask="true" | 66 | mask="true" |
67 | maskClick="true" | 67 | maskClick="true" |
68 | mode="right" | 68 | mode="right" |
69 | :width="320" | 69 | :width="320" |
70 | @change="change($event,'showRight')" | 70 | @change="change($event,'showRight')" |
71 | > | 71 | > |
72 | <view class="close"> | 72 | <view class="close"> |
73 | <view @click="closeDrawer('showRight')"> | 73 | <view @click="closeDrawer('showRight')"> |
74 | <text class="word-btn-white">关闭</text> | 74 | <text class="word-btn-white">关闭</text> |
75 | </view> | 75 | </view> |
76 | </view> | 76 | </view> |
77 | </Uni-drawer> | 77 | </Uni-drawer> |
78 | 78 | ||
79 | <!-- 筛选菜单--> | 79 | <!-- 筛选菜单--> |
80 | <view class="content-wrap skeleton-rect"> | 80 | <view class="content-wrap skeleton-rect"> |
81 | <view> | 81 | <view> |
82 | <HMfilterDropdown | 82 | <HMfilterDropdown |
83 | :filterData="categoryList" | 83 | :filterData="categoryList" |
84 | :defaultSelected="filterDropdownValue" | 84 | :defaultSelected="filterDropdownValue" |
85 | :updateMenuName="true" | 85 | :updateMenuName="true" |
86 | @search="search" | 86 | @search="search" |
87 | @getList="getList" | 87 | @getList="getList" |
88 | data-format="Object" | 88 | data-format="Object" |
89 | ></HMfilterDropdown> | 89 | ></HMfilterDropdown> |
90 | <!-- 商品列表 --> | 90 | <!-- 商品列表 --> |
91 | <!-- <scroll-view | 91 | <!-- <scroll-view |
92 | enable-flex | 92 | enable-flex |
93 | @scrolltolower="handleScrolltolower" | 93 | @scrolltolower="handleScrolltolower" |
94 | scroll-y | 94 | scroll-y |
95 | style="height: 1000px;margin-bottom: 20px;" | 95 | style="height: 1000px;margin-bottom: 20px;" |
96 | > --> | 96 | > --> |
97 | <view class="goods-list"> | 97 | <view class="goods-list"> |
98 | <view class="product-list"> | 98 | <view class="product-list"> |
99 | <view | 99 | <view |
100 | class="product skeleton-rect" | 100 | class="product skeleton-rect" |
101 | v-for="(goods) in goodsList" | 101 | v-for="(goods) in goodsList" |
102 | :key="goods.id" | 102 | :key="goods.id" |
103 | > | 103 | > |
104 | <Card | 104 | <Card |
105 | :goods="goods" | 105 | :goods="goods" |
106 | :scrollTop="scrollTop" | 106 | :scrollTop="scrollTop" |
107 | :viewHeight="viewHeight" | 107 | :viewHeight="viewHeight" |
108 | ></Card> | 108 | ></Card> |
109 | </view> | 109 | </view> |
110 | </view> | 110 | </view> |
111 | <view class="loading-text"> | 111 | <view class="loading-text"> |
112 | <text v-if="isLoading==true">{{loadingText}}</text> | 112 | <text v-if="isLoading==true">{{loadingText}}</text> |
113 | <text v-else>{{loadedText}}</text> | 113 | <text v-else>{{loadedText}}</text> |
114 | </view> | 114 | </view> |
115 | </view> | 115 | </view> |
116 | <!-- </scroll-view> --> | 116 | <!-- </scroll-view> --> |
117 | </view> | 117 | </view> |
118 | </view> | 118 | </view> |
119 | </view> | 119 | </view> |
120 | <!--引用组件--> | 120 | <!--引用组件--> |
121 | <skeleton | 121 | <skeleton |
122 | :show="showSkeleton" | 122 | :show="showSkeleton" |
123 | ref="skeleton" | 123 | ref="skeleton" |
124 | loading="chiaroscuro" | 124 | loading="chiaroscuro" |
125 | selector="skeleton" | 125 | selector="skeleton" |
126 | bgcolor="#FFF" | 126 | bgcolor="#FFF" |
127 | ></skeleton> | 127 | ></skeleton> |
128 | </view> | 128 | </view> |
129 | </template> | 129 | </template> |
130 | 130 | ||
131 | <script> | 131 | <script> |
132 | import UniDrawer from '@/components/UniDrawer/UniDrawer.vue' | 132 | import UniDrawer from '@/components/UniDrawer/UniDrawer.vue' |
133 | import Card from '@/components/CommodityCard/CommodityCard.vue' | 133 | import Card from '@/components/CommodityCard/CommodityCard.vue' |
134 | import HMfilterDropdown from '@/components/HMFilterDropdown/HMFilterDropdown.vue' | 134 | import HMfilterDropdown from '@/components/HMFilterDropdown/HMFilterDropdown.vue' |
135 | import skeleton from '@/components/quick-skeleton/quick-skeleton.vue' | 135 | import skeleton from '@/components/quick-skeleton/quick-skeleton.vue' |
136 | import store from '@/store' | 136 | import store from '@/store' |
137 | 137 | ||
138 | export default { | 138 | export default { |
139 | components: { | 139 | components: { |
140 | UniDrawer: UniDrawer, | 140 | UniDrawer: UniDrawer, |
141 | HMfilterDropdown: HMfilterDropdown, | 141 | HMfilterDropdown: HMfilterDropdown, |
142 | Card: Card, | 142 | Card: Card, |
143 | skeleton: skeleton, | 143 | skeleton: skeleton, |
144 | }, | 144 | }, |
145 | data() { | 145 | data() { |
146 | return { | 146 | return { |
147 | indexArr: '', | 147 | indexArr: '', |
148 | valueArr: '', | 148 | valueArr: '', |
149 | isLoading: true, // 初始化加载状态 | 149 | isLoading: true, // 初始化加载状态 |
150 | loadingText: 'data loading...', | 150 | loadingText: 'data loading...', |
151 | loadedText: '~~暂无更多数据~~', | 151 | loadedText: '~~暂无更多数据~~', |
152 | filterDropdownValue: [], | 152 | filterDropdownValue: [], |
153 | filterData: [], | 153 | filterData: [], |
154 | searchText: '', | 154 | searchText: '', |
155 | scrollTop: 0, | 155 | scrollTop: 0, |
156 | showContent: true, | 156 | showContent: true, |
157 | viewHeight: uni.getSystemInfoSync().windowHeight, | 157 | viewHeight: uni.getSystemInfoSync().windowHeight, |
158 | showSkeleton: false, // 骨架屏显示隐藏 | 158 | showSkeleton: false, // 骨架屏显示隐藏 |
159 | } | 159 | } |
160 | }, | 160 | }, |
161 | onPageScroll({ scrollTop }) { | 161 | onPageScroll({ scrollTop }) { |
162 | // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件 | 162 | // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件 |
163 | this.scrollTop = scrollTop | 163 | this.scrollTop = scrollTop |
164 | }, | 164 | }, |
165 | computed: { | 165 | computed: { |
166 | goodsList() { | 166 | goodsList() { |
167 | // 也可以从 getters 获取 | 167 | // 也可以从 getters 获取 |
168 | // console.log('index-list=====>',this.$store.state.index.list) | 168 | // console.log('index-list=====>',this.$store.state.index.list) |
169 | const list = this.$store.state.index.list | 169 | const list = this.$store.state.index.list |
170 | if (list.length == 0) { | 170 | if (list.length === 0) { |
171 | this.isLoading = false | 171 | this.isLoading = false |
172 | } | 172 | } |
173 | this.scrollTop = 0.1 | 173 | this.scrollTop = 0.1 |
174 | return list | 174 | return list |
175 | }, | 175 | }, |
176 | categoryList() { | 176 | categoryList() { |
177 | return this.$store.state.index.categoryList | 177 | return this.$store.state.index.categoryList |
178 | }, | 178 | }, |
179 | }, | 179 | }, |
180 | filters: { | 180 | filters: { |
181 | outData(value) { | 181 | outData(value) { |
182 | return JSON.stringify(value) | 182 | return JSON.stringify(value) |
183 | }, | 183 | }, |
184 | }, | 184 | }, |
185 | /** | 185 | /** |
186 | * 页面载入完成后调用子组件的方法生成预加载效果 | 186 | * 页面载入完成后调用子组件的方法生成预加载效果 |
187 | */ | 187 | */ |
188 | onReady: function() { | 188 | onReady: function() { |
189 | this.getInitData() | 189 | this.getInitData() |
190 | }, | 190 | }, |
191 | methods: { | 191 | methods: { |
192 | async getInitData () { | 192 | async getInitData () { |
193 | this.showSkeleton = true | 193 | this.showSkeleton = true |
194 | await Promise.all([store.dispatch('index/category'), store.dispatch('index/list')]) | 194 | await Promise.all([store.dispatch('index/category'), store.dispatch('index/list')]) |
195 | this.showSkeleton = false | 195 | this.showSkeleton = false |
196 | this.showContent = true | 196 | this.showContent = true |
197 | }, | 197 | }, |
198 | showDrawer(e) { | 198 | showDrawer(e) { |
199 | this.$refs[e].open() | 199 | this.$refs[e].open() |
200 | }, | 200 | }, |
201 | // 朋友圈设置页面 | 201 | // 朋友圈设置页面 |
202 | onShareAppMessage() { | 202 | onShareAppMessage() { |
203 | let myName = this.$store.state.user.userInfo.nickName | 203 | let myName = this.$store.state.user.userInfo.nickName |
204 | if (myName === '' || myName.length < 1 || myName === '匿名用户' || typeof myName === 'undefined') { | 204 | if (myName === '' || myName.length < 1 || myName === '匿名用户' || typeof myName === 'undefined') { |
205 | myName = '【神秘人】' | 205 | myName = '【神秘人】' |
206 | } else { | 206 | } else { |
207 | myName = '【' + myName + '】' | 207 | myName = '【' + myName + '】' |
208 | } | 208 | } |
209 | return { | 209 | return { |
210 | title: 'Hi,' + myName + '送你300元来试戴最新潮流眼镜!', // 默认是小程序的名称(可以写slogan等) | 210 | title: 'Hi,' + myName + '送你300元来试戴最新潮流眼镜!', // 默认是小程序的名称(可以写slogan等) |
211 | path: '/pages/index/index', | 211 | path: '/pages/index/index', |
212 | // imageUrl: '/static/img/details/d1.png', // 不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4 | 212 | // imageUrl: '/static/img/details/d1.png', // 不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4 |
213 | success: function (res) { | 213 | success: function (res) { |
214 | if (res.errMsg === 'shareAppMessage:ok') { | 214 | if (res.errMsg === 'shareAppMessage:ok') { |
215 | console.log('分享成功!', res) | 215 | console.log('分享成功!', res) |
216 | } | 216 | } |
217 | }, | 217 | }, |
218 | fail: function (res) { | 218 | fail: function (res) { |
219 | if (res.errMsg === 'shareAppMessage:fail cancel') { | 219 | if (res.errMsg === 'shareAppMessage:fail cancel') { |
220 | console.log('fail', '放弃分享') | 220 | console.log('fail', '放弃分享') |
221 | } else if (res.errMsg === 'shareAppMessage:fail') { | 221 | } else if (res.errMsg === 'shareAppMessage:fail') { |
222 | console.log('fail', '分享失败') | 222 | console.log('fail', '分享失败') |
223 | } | 223 | } |
224 | }, | 224 | }, |
225 | } | 225 | } |
226 | }, | 226 | }, |
227 | getList() { | 227 | getList() { |
228 | store.dispatch('index/list') | 228 | store.dispatch('index/list') |
229 | this.isLoading = false // TODO:::这里不知道怎么改,请同学帮忙写一下。 | 229 | this.isLoading = false // TODO:::这里不知道怎么改,请同学帮忙写一下。 |
230 | // 把data里的isLoading 改为false就可以了 | 230 | // 把data里的isLoading 改为false就可以了 |
231 | }, | 231 | }, |
232 | // search(params) { | 232 | // search(params) { |
233 | // this.$store.index. | 233 | // this.$store.index. |
234 | // }, | 234 | // }, |
235 | closeDrawer(e) { | 235 | closeDrawer(e) { |
236 | this.$refs[e].close() | 236 | this.$refs[e].close() |
237 | }, | 237 | }, |
238 | change(e, type) { | 238 | change(e, type) { |
239 | this[type] = e | 239 | this[type] = e |
240 | }, | 240 | }, |
241 | onClickItem(e) { | 241 | onClickItem(e) { |
242 | if (this.current !== e) { | 242 | if (this.current !== e) { |
243 | this.current = e | 243 | this.current = e |
244 | } | 244 | } |
245 | }, | 245 | }, |
246 | dropDown() { | 246 | dropDown() { |
247 | console.log('下拉') | 247 | console.log('下拉') |
248 | }, | 248 | }, |
249 | searchKey(e) { | 249 | searchKey(e) { |
250 | const { value: keyword } = e.detail | 250 | const { value: keyword } = e.detail |
251 | this.keyWords = keyword | 251 | this.keyWords = keyword |
252 | store.dispatch('index/search', { | 252 | store.dispatch('index/search', { |
253 | params: {}, | 253 | params: {}, |
254 | keyword, | 254 | keyword, |
255 | }) | 255 | }) |
256 | }, | 256 | }, |
257 | // 接收菜单结果 | 257 | // 接收菜单结果 |
258 | search(e) { | 258 | search(e) { |
259 | const { on, value, selectedData } = e | 259 | const { on, value, selectedData } = e |
260 | let params = {} | 260 | let params = {} |
261 | const selectedPayload = {} | 261 | const selectedPayload = {} |
262 | for (const key in selectedData) { | 262 | for (const key in selectedData) { |
263 | if (Object.prototype.hasOwnProperty.call(selectedData, key)) { | 263 | if (Object.prototype.hasOwnProperty.call(selectedData, key)) { |
264 | selectedPayload[key] = selectedData[key].toString() | 264 | selectedPayload[key] = selectedData[key].toString() |
265 | } | 265 | } |
266 | } | 266 | } |
267 | if (on[0] === 1) { | 267 | if (on[0] === 1) { |
268 | // 若点击全部 | 268 | // 若点击全部 |
269 | this.searchText = '' | 269 | this.searchText = '' |
270 | store.dispatch('index/list') | 270 | store.dispatch('index/list') |
271 | } else { | 271 | } else { |
272 | for (let i = 1; i <= on.length; i++) { | 272 | for (let i = 1; i <= on.length; i++) { |
273 | // on[0]是全部 | 273 | // on[0]是全部 |
274 | if (on[i] === 1) { | 274 | if (on[i] === 1) { |
275 | // 若该选项被选中 | 275 | // 若该选项被选中 |
276 | if (this.categoryList[i].value === 'filter') { | 276 | if (this.categoryList[i].value === 'filter') { |
277 | params = { | 277 | params = { |
278 | ...selectedPayload, | 278 | ...selectedPayload, |
279 | ...params, | 279 | ...params, |
280 | } | 280 | } |
281 | } else if (this.categoryList[i].value === 'px') { | 281 | } else if (this.categoryList[i].value === 'px') { |
282 | params.orderby = value[i][0] | 282 | params.orderby = value[i][0] |
283 | } else { | 283 | } else { |
284 | params[`${this.categoryList[i].value}`] = value[i][0] | 284 | params[`${this.categoryList[i].value}`] = value[i][0] |
285 | } | 285 | } |
286 | } | 286 | } |
287 | } | 287 | } |
288 | store.dispatch('index/search', { | 288 | store.dispatch('index/search', { |
289 | params, | 289 | params, |
290 | keyword: this.keyWords, | 290 | keyword: this.keyWords, |
291 | }) | 291 | }) |
292 | } | 292 | } |
293 | }, | 293 | }, |
294 | }, | 294 | }, |
295 | } | 295 | } |
296 | </script> | 296 | </script> |
297 | 297 | ||
298 | <style lang="scss"> | 298 | <style lang="scss"> |
299 | .content, | 299 | .content, |
300 | .container { | 300 | .container { |
301 | display: flex; | 301 | display: flex; |
302 | flex-direction: column; | 302 | flex-direction: column; |
303 | align-items: center; | 303 | align-items: center; |
304 | justify-content: center; | 304 | justify-content: center; |
305 | width: 100%; | 305 | width: 100%; |
306 | } | 306 | } |
307 | .header { | 307 | .header { |
308 | display: flex; | 308 | display: flex; |
309 | flex-direction: column; | 309 | flex-direction: column; |
310 | align-items: center; | 310 | align-items: center; |
311 | justify-content: center; | 311 | justify-content: center; |
312 | background-color: #f7f6f6; | 312 | background-color: #f7f6f6; |
313 | height: 178rpx; | 313 | height: 178rpx; |
314 | width: 100%; | 314 | width: 100%; |
315 | z-index: 999; | 315 | z-index: 999; |
316 | position: fixed; | 316 | position: fixed; |
317 | top: 0; | 317 | top: 0; |
318 | left: 0; | 318 | left: 0; |
319 | } | 319 | } |
320 | .searchBar { | 320 | .searchBar { |
321 | width: 670rpx; | 321 | width: 670rpx; |
322 | display: flex; | 322 | display: flex; |
323 | justify-content: center; | 323 | justify-content: center; |
324 | align-items: center; | 324 | align-items: center; |
325 | box-sizing: border-box; | 325 | box-sizing: border-box; |
326 | padding: 0rpx 16rpx; | 326 | padding: 0rpx 16rpx; |
327 | border: 1px solid #ff6b4a; | 327 | border: 1px solid #ff6b4a; |
328 | border-radius: 8rpx; | 328 | border-radius: 8rpx; |
329 | background-color: #ffffff; | 329 | background-color: #ffffff; |
330 | } | 330 | } |
331 | 331 | ||
332 | .searchIpt { | 332 | .searchIpt { |
333 | height: 68rpx; | 333 | height: 68rpx; |
334 | width: 670rpx; | 334 | width: 670rpx; |
335 | padding: 16rpx; | 335 | padding: 16rpx; |
336 | font-size: 28rpx; | 336 | font-size: 28rpx; |
337 | box-sizing: border-box; | 337 | box-sizing: border-box; |
338 | } | 338 | } |
339 | .screenBar { | 339 | .screenBar { |
340 | width: 670rpx; | 340 | width: 670rpx; |
341 | height: 110rpx; | 341 | height: 110rpx; |
342 | display: flex; | 342 | display: flex; |
343 | flex-direction: row; | 343 | flex-direction: row; |
344 | justify-content: space-between; | 344 | justify-content: space-between; |
345 | align-items: center; | 345 | align-items: center; |
346 | color: #333333; | 346 | color: #333333; |
347 | font-size: 32rpx; | 347 | font-size: 32rpx; |
348 | } | 348 | } |
349 | .active { | 349 | .active { |
350 | color: #ff6b4a; | 350 | color: #ff6b4a; |
351 | } | 351 | } |
352 | .screenItem { | 352 | .screenItem { |
353 | display: flex; | 353 | display: flex; |
354 | justify-content: center; | 354 | justify-content: center; |
355 | align-items: center; | 355 | align-items: center; |
356 | } | 356 | } |
357 | .content-wrap { | 357 | .content-wrap { |
358 | width: 100%; | 358 | width: 100%; |
359 | background-color: #ffffff; | 359 | background-color: #ffffff; |
360 | } | 360 | } |
361 | 361 | ||
362 | .HMfilterDropdown { | 362 | .HMfilterDropdown { |
363 | top: 178rpx !important; | 363 | top: 178rpx !important; |
364 | } | 364 | } |
365 | 365 | ||
366 | .goods-list { | 366 | .goods-list { |
367 | padding-top: 286rpx; | 367 | padding-top: 286rpx; |
368 | .loading-text { | 368 | .loading-text { |
369 | width: 100%; | 369 | width: 100%; |
370 | display: flex; | 370 | display: flex; |
371 | justify-content: center; | 371 | justify-content: center; |
372 | align-items: center; | 372 | align-items: center; |
373 | height: 30px; | 373 | height: 30px; |
374 | color: #979797; | 374 | color: #979797; |
375 | font-size: 12px; | 375 | font-size: 12px; |
376 | } | 376 | } |
377 | .product-list { | 377 | .product-list { |
378 | width: 92%; | 378 | width: 92%; |
379 | padding: 0 4% 3vw 4%; | 379 | padding: 0 4% 3vw 4%; |
380 | display: flex; | 380 | display: flex; |
381 | justify-content: space-between; | 381 | justify-content: space-between; |
382 | flex-wrap: wrap; | 382 | flex-wrap: wrap; |
383 | .product { | 383 | .product { |
384 | width: 48%; | 384 | width: 48%; |
385 | min-height: 120rpx; | 385 | min-height: 120rpx; |
386 | margin: 0 0 20rpx 0; | 386 | margin: 0 0 20rpx 0; |
387 | background: #ffffff; | 387 | background: #ffffff; |
388 | border: 1px solid #f2f2f2; | 388 | border: 1px solid #f2f2f2; |
389 | } | 389 | } |
390 | } | 390 | } |
391 | } | 391 | } |
392 | </style> | 392 | </style> |
393 | 393 |
src/pages/myOrder/components/OrderCard.vue
1 | <template> | 1 | <template> |
2 | <view> | 2 | <view> |
3 | <view | 3 | <view |
4 | class="card" | 4 | class="card" |
5 | v-if="current == status" | 5 | v-if="current == status" |
6 | @click="toOrderInfo(status,order.pay_id)" | 6 | @click="toOrderInfo(status,order.pay_id)" |
7 | > | 7 | > |
8 | <view class="cardHeader"> | 8 | <view class="cardHeader"> |
9 | <text | 9 | <text |
10 | class="orderId" | 10 | class="orderId" |
11 | v-if="status == '0'||status == '1'" | 11 | v-if="status == '0'||status == '1'" |
12 | >订单号:{{order.pay_id}}</text> | 12 | >订单号:{{order.pay_id}}</text> |
13 | <text | 13 | <text |
14 | class="orderId" | 14 | class="orderId" |
15 | v-if="status == '2'||status == '3'" | 15 | v-if="status == '2'||status == '3'" |
16 | >下单时间:{{order.pay_time}}</text> | 16 | >下单时间:{{order.pay_time}}</text> |
17 | <text | 17 | <text |
18 | class="orderType" | 18 | class="orderType" |
19 | v-if="status=='0'" | 19 | v-if="status=='0'" |
20 | >待付款</text> | 20 | >待付款</text> |
21 | <text | 21 | <text |
22 | class="orderType" | 22 | class="orderType" |
23 | v-if="status=='1'" | 23 | v-if="status=='1'" |
24 | >待收货</text> | 24 | >待收货</text> |
25 | <text | 25 | <text |
26 | class="orderType" | 26 | class="orderType" |
27 | v-if="status == '2'||status == '3'" | 27 | v-if="status == '2'||status == '3'" |
28 | >已完成</text> | 28 | >已完成</text> |
29 | <!-- <text class="orderType" v-if="status == '3'">已评价</text> --> | 29 | <!-- <text class="orderType" v-if="status == '3'">已评价</text> --> |
30 | </view> | 30 | </view> |
31 | <view | 31 | <view |
32 | class="orderCardInfo" | 32 | class="orderCardInfo" |
33 | v-for="(orderInfo, index) in orderInfoList" | 33 | v-for="(orderInfo, index) in orderInfoList" |
34 | :key="index" | 34 | :key="index" |
35 | > | 35 | > |
36 | <image | 36 | <image |
37 | :src="orderInfo.imgUrl" | 37 | :src="orderInfo.imgUrl" |
38 | mode="aspectFill" | 38 | mode="aspectFill" |
39 | ></image> | 39 | ></image> |
40 | <view class="infoText"> | 40 | <view class="infoText"> |
41 | <view class="orderName">{{orderInfo.p_name}}</view> | 41 | <view class="orderName">{{orderInfo.p_name}}</view> |
42 | <view class="orderDescrib">{{orderInfo.p_name}}</view> | 42 | <view class="orderDescrib">{{orderInfo.p_name}}</view> |
43 | <view class="infoText-bottom"> | 43 | <view class="infoText-bottom"> |
44 | <view class="markPrice">{{orderInfo.nowPrice}}</view> | 44 | <view class="markPrice">{{orderInfo.nowPrice}}</view> |
45 | <view class="buy-num">X {{orderInfo.num}}</view> | 45 | <view class="buy-num">X {{orderInfo.num}}</view> |
46 | </view> | 46 | </view> |
47 | </view> | 47 | </view> |
48 | </view> | 48 | </view> |
49 | <view class="payPrice">实付:<text class="priceNum">{{order.total_fee}}</text> </view> | 49 | <view class="payPrice">实付:<text class="priceNum">{{order.total_fee}}</text> </view> |
50 | <!-- 0待付款 1 已付款 待收货 2 已收货待评价 3 已评价 --> | 50 | <!-- 0待付款 1 已付款 待收货 2 已收货待评价 3 已评价 --> |
51 | <view | 51 | <view |
52 | class="btns" | 52 | class="btns" |
53 | v-if="status == '0'" | 53 | v-if="status == '0'" |
54 | > | 54 | > |
55 | <view class="btn-type1">取消订单</view> | 55 | <view class="btn-type1">取消订单</view> |
56 | <view class="btn-type2">去支付</view> | 56 | <view class="btn-type2">去支付</view> |
57 | </view> | 57 | </view> |
58 | <view | 58 | <view |
59 | class="btns" | 59 | class="btns" |
60 | v-if="status == '1'" | 60 | v-if="status == '1'" |
61 | > | 61 | > |
62 | <view class="btn-type2">确认收货</view> | 62 | <view class="btn-type2">确认收货</view> |
63 | </view> | 63 | </view> |
64 | <view | 64 | <view |
65 | class="btns" | 65 | class="btns" |
66 | v-if="status == '2'" | 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 | </view> | 72 | </view> |
70 | <!-- <view class="btns" v-if="status == '3'"> | 73 | <!-- <view class="btns" v-if="status == '3'"> |
71 | <view class="btn-type2">再次购买</view> | 74 | <view class="btn-type2">再次购买</view> |
72 | </view> --> | 75 | </view> --> |
73 | </view> | 76 | </view> |
74 | <view class="card" v-if="current == '10'" @click="toOrderInfo(status,order.pay_id)"> | 77 | <view |
75 | <view class="cardHeader"> | 78 | class="card" |
76 | <text class="orderId" v-if="status == '0'||status == '1'">订单号:{{order.pay_id}}</text> | 79 | v-if="current == '10'" |
77 | <text class="orderId" v-if="status == '2'||status == '3'">下单时间:{{order.pay_time}}</text> | 80 | @click="toOrderInfo(status,order.pay_id)" |
78 | <text class="orderType" v-if="status=='0'">待付款</text> | 81 | > |
79 | <text class="orderType" v-if="status=='1'">待收货</text> | 82 | <view class="cardHeader"> |
80 | <text class="orderType" v-if="status == '2'||status == '3'">已完成</text> | 83 | <text |
81 | <!-- <text class="orderType" v-if="status == '3'">已评价</text> --> | 84 | class="orderId" |
82 | </view> | 85 | v-if="status == '0'||status == '1'" |
83 | <view class="orderCardInfo" v-for="(orderInfo) in orderInfoList" :key="orderInfo"> | 86 | >订单号:{{order.pay_id}}</text> |
84 | <image :src="orderInfo.imgUrl" mode="aspectFill"></image> | 87 | <text |
85 | <view class="infoText"> | 88 | class="orderId" |
86 | <view class="orderName">{{orderInfo.p_name}}</view> | 89 | v-if="status == '2'||status == '3'" |
87 | <view class="orderDescrib">{{orderInfo.p_name}}</view> | 90 | >下单时间:{{order.pay_time}}</text> |
88 | <view class="infoText-bottom"> | 91 | <text |
89 | <view class="markPrice">{{orderInfo.nowPrice}}</view> | 92 | class="orderType" |
90 | <view class="buy-num">X {{orderInfo.num}}</view> | 93 | v-if="status=='0'" |
91 | </view> | 94 | >待付款</text> |
92 | </view> | 95 | <text |
93 | </view> | 96 | class="orderType" |
94 | <view class="payPrice">实付:<text class="priceNum">{{order.total_fee}}</text> </view> | 97 | v-if="status=='1'" |
95 | <view class="btns" v-if="status == '0'"> | 98 | >待收货</text> |
96 | <view class="btn-type1" >取消订单</view> | 99 | <text |
97 | <view class="btn-type2">去支付</view> | 100 | class="orderType" |
98 | </view> | 101 | v-if="status == '2'||status == '3'" |
99 | <view class="btns" v-if="status == '1'"> | 102 | >已完成</text> |
100 | <view class="btn-type2">确认收货</view> | 103 | <!-- <text class="orderType" v-if="status == '3'">已评价</text> --> |
101 | </view> | 104 | </view> |
102 | <view class="btns" v-if="status == '2'||status == '3'"> | 105 | <view |
103 | <view class="btn-type2" @click="toDetail(order.order_info[0].pid)">再次购买</view> | 106 | class="orderCardInfo" |
104 | </view> | 107 | v-for="(orderInfo) in orderInfoList" |
105 | <!-- <view class="btns" v-if="status == '3'"> | 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> | 148 | <view class="btn-type2">再次购买</view> |
108 | </view> --> | 149 | </view> --> |
109 | </view> | 150 | </view> |
110 | </view> | 151 | </view> |
111 | </template> | 152 | </template> |
112 | 153 | ||
113 | <script> | 154 | <script> |
114 | export default { | 155 | export default { |
115 | props: { | 156 | props: { |
116 | /** | 157 | /** |
117 | * 订单数据 | 158 | * 订单数据 |
118 | */ | 159 | */ |
119 | order: {}, | 160 | order: {}, |
120 | /** | 161 | /** |
121 | * 当前选择 | 162 | * 当前选择 |
122 | */ | 163 | */ |
123 | current:Number | 164 | current: Number, |
124 | 165 | ||
125 | }, | 166 | }, |
126 | created() { | 167 | created() { |
127 | console.log('order',this.order); | 168 | console.log('order', this.order) |
128 | // console.log(this.order.status ); | 169 | // console.log(this.order.status ); |
129 | // console.log(this.current); | 170 | // console.log(this.current); |
130 | }, | 171 | }, |
131 | computed:{ | 172 | computed: { |
132 | status(){ | 173 | status() { |
133 | return this.order.status | 174 | return this.order.status |
134 | }, | 175 | }, |
135 | orderInfoList(){ | 176 | orderInfoList() { |
136 | return this.order.order_info | 177 | const orderInfoList = this.order.order_info |
137 | } | 178 | return Array.isArray(orderInfoList) ? orderInfoList : orderInfoList.data |
138 | }, | 179 | }, |
139 | data() { | 180 | }, |
140 | return { | 181 | data() { |
141 | }; | 182 | return { |
142 | }, | 183 | } |
143 | methods:{ | 184 | }, |
144 | toDetail(pid){ | 185 | methods: { |
145 | console.log('pid',pid) | 186 | toDetail(pid) { |
146 | uni.navigateTo({ | 187 | console.log('pid', pid) |
147 | url: '../details/details?pid='+pid, | 188 | uni.navigateTo({ |
148 | fail: (res) => {console.log(res)}, | 189 | url: '../details/details?pid=' + pid, |
149 | }); | 190 | fail: (res) => { console.log(res) }, |
150 | }, | 191 | }) |
151 | toRefundment(){ | 192 | }, |
152 | uni.navigateTo({ | 193 | toRefundment() { |
153 | url: '../refundment/refundment', | 194 | uni.navigateTo({ |
154 | success: res => {}, | 195 | url: '../refundment/refundment', |
155 | fail: () => {}, | 196 | success: res => {}, |
156 | complete: () => {} | 197 | fail: () => {}, |
157 | }); | 198 | complete: () => {}, |
158 | }, | 199 | }) |
159 | toOrderInfo(status,payId){ | 200 | }, |
160 | console.log(status,payId) | 201 | toOrderInfo(status, payId) { |
161 | switch(status){ | 202 | console.log(status, payId) |
162 | // 0待付款 1待收货 2已收货 3 已评价 | 203 | switch (status) { |
163 | case '0': | 204 | // 0待付款 1待收货 2已收货 3 已评价 |
164 | uni.navigateTo({ | 205 | case '0': |
165 | url:`../myOrderPaying/myOrderPaying?status=`+status+`&payId=`+payId, | 206 | uni.navigateTo({ |
166 | fail(errMsg) { | 207 | url: '../myOrderPaying/myOrderPaying?status=' + status + '&payId=' + payId, |
167 | console.log(errMsg) | 208 | fail(errMsg) { |
168 | } | 209 | console.log(errMsg) |
169 | }) | 210 | }, |
170 | break; | 211 | }) |
171 | case '1': | 212 | break |
172 | uni.navigateTo({ | 213 | case '1': |
173 | url:`../myOrderPaying/myOrderPaying?status=`+status+`&payId=`+payId, | 214 | uni.navigateTo({ |
174 | fail(errMsg) { | 215 | url: '../myOrderPaying/myOrderPaying?status=' + status + '&payId=' + payId, |
175 | console.log(errMsg) | 216 | fail(errMsg) { |
176 | } | 217 | console.log(errMsg) |
177 | }) | 218 | }, |
178 | 219 | }) | |
179 | break; | 220 | |
180 | case '2 || 3': | 221 | break |
181 | uni.navigateTo({ | 222 | case '2 || 3': |
182 | url:`../myOrderPaying/myOrderPaying?status=`+status+`&payId=`+payId, | 223 | uni.navigateTo({ |
183 | fail(errMsg) { | 224 | url: '../myOrderPaying/myOrderPaying?status=' + status + '&payId=' + payId, |
184 | console.log(errMsg) | 225 | fail(errMsg) { |
185 | } | 226 | console.log(errMsg) |
186 | }) | 227 | }, |
187 | break; | 228 | }) |
188 | default: | 229 | break |
189 | break; | 230 | default: |
190 | 231 | break | |
191 | } | 232 | } |
192 | } | 233 | }, |
193 | } | 234 | }, |
194 | } | 235 | } |
195 | 236 | ||
196 | </script> | 237 | </script> |
197 | 238 | ||
198 | <style lang="scss"> | 239 | <style lang="scss"> |
199 | .card { | 240 | .card { |
200 | width: 670rpx; | 241 | width: 670rpx; |
201 | height: 478rpx; | 242 | height: 478rpx; |
202 | background: #ffffff; | 243 | background: #ffffff; |
203 | box-shadow: 0 0 10px 0 rgba(177, 128, 128, 0.06); | 244 | box-shadow: 0 0 10px 0 rgba(177, 128, 128, 0.06); |
204 | border-radius: 8px; | 245 | border-radius: 8px; |
205 | border-radius: 8px; | 246 | border-radius: 8px; |
206 | margin-top: 20rpx; | 247 | margin-top: 20rpx; |
207 | padding: 40rpx; | 248 | padding: 40rpx; |
208 | box-sizing: border-box; | 249 | box-sizing: border-box; |
209 | .cardHeader { | 250 | .cardHeader { |
210 | width: 100%; | 251 | width: 100%; |
211 | height: 40rpx; | 252 | height: 40rpx; |
212 | display: flex; | 253 | display: flex; |
213 | justify-content: space-between; | 254 | justify-content: space-between; |
214 | align-items: center; | 255 | align-items: center; |
215 | .orderId { | 256 | .orderId { |
216 | font-size: 12px; | 257 | font-size: 12px; |
217 | color: #999999; | 258 | color: #999999; |
218 | } | 259 | } |
219 | .orderType { | 260 | .orderType { |
220 | font-size: 14px; | 261 | font-size: 14px; |
221 | color: #ff6b4a; | 262 | color: #ff6b4a; |
222 | } | 263 | } |
223 | } | 264 | } |
224 | .orderCardInfo { | 265 | .orderCardInfo { |
225 | width: 100%; | 266 | width: 100%; |
226 | height: 188rpx; | 267 | height: 188rpx; |
227 | display: flex; | 268 | display: flex; |
228 | flex-direction: row; | 269 | flex-direction: row; |
229 | justify-content: space-between; | 270 | justify-content: space-between; |
230 | align-items: center; | 271 | align-items: center; |
231 | margin-top: 40rpx; | 272 | margin-top: 40rpx; |
232 | image { | 273 | image { |
233 | height: 188rpx; | 274 | height: 188rpx; |
234 | width: 188rpx; | 275 | width: 188rpx; |
235 | margin-right: 24rpx; | 276 | margin-right: 24rpx; |
236 | } | 277 | } |
237 | .infoText { | 278 | .infoText { |
238 | display: flex; | 279 | display: flex; |
239 | flex-direction: column; | 280 | flex-direction: column; |
240 | justify-content: space-between; | 281 | justify-content: space-between; |
241 | align-items: flex-start; | 282 | align-items: flex-start; |
242 | height: 188rpx; | 283 | height: 188rpx; |
243 | width: 368rpx; | 284 | width: 368rpx; |
244 | } | 285 | } |
245 | .orderName { | 286 | .orderName { |
246 | font-size: 14px; | 287 | font-size: 14px; |
247 | color: #333333; | 288 | color: #333333; |
248 | display: -webkit-box; | 289 | display: -webkit-box; |
249 | overflow: hidden; | 290 | overflow: hidden; |
250 | -webkit-box-orient: vertical; | 291 | -webkit-box-orient: vertical; |
251 | -webkit-line-clamp: 2; | 292 | -webkit-line-clamp: 2; |
252 | } | 293 | } |
253 | .orderDescrib { | 294 | .orderDescrib { |
254 | font-size: 12px; | 295 | font-size: 12px; |
255 | color: #999999; | 296 | color: #999999; |
256 | display: -webkit-box; | 297 | display: -webkit-box; |
257 | overflow: hidden; | 298 | overflow: hidden; |
258 | -webkit-box-orient: vertical; | 299 | -webkit-box-orient: vertical; |
259 | -webkit-line-clamp: 2; | 300 | -webkit-line-clamp: 2; |
260 | } | 301 | } |
261 | .infoText-bottom { | 302 | .infoText-bottom { |
262 | display: flex; | 303 | display: flex; |
263 | flex-direction: row; | 304 | flex-direction: row; |
264 | justify-content: flex-start; | 305 | justify-content: flex-start; |
265 | align-items: center; | 306 | align-items: center; |
266 | width: 100%; | 307 | width: 100%; |
267 | .markPrice { | 308 | .markPrice { |
268 | font-size: 14px; | 309 | font-size: 14px; |
269 | color: #ff6b4a; | 310 | color: #ff6b4a; |
270 | margin-right: 20rpx; | 311 | margin-right: 20rpx; |
271 | } | 312 | } |
272 | .buy-num { | 313 | .buy-num { |
273 | font-size: 12px; | 314 | font-size: 12px; |
274 | color: #999999; | 315 | color: #999999; |
275 | } | 316 | } |
276 | } | 317 | } |
277 | } | 318 | } |
278 | .payPrice { | 319 | .payPrice { |
279 | text-align: right; | 320 | text-align: right; |
280 | margin: 20rpx 0; | 321 | margin: 20rpx 0; |
281 | font-size: 14px; | 322 | font-size: 14px; |
282 | color: #333333; | 323 | color: #333333; |
283 | .priceNum { | 324 | .priceNum { |
284 | font-size: 14px; | 325 | font-size: 14px; |
285 | color: #ff6b4a; | 326 | color: #ff6b4a; |
286 | } | 327 | } |
287 | } | 328 | } |
288 | .btns { | 329 | .btns { |
289 | display: flex; | 330 | display: flex; |
290 | justify-content: flex-end; | 331 | justify-content: flex-end; |
291 | align-items: center; | 332 | align-items: center; |
292 | .btn-type1 { | 333 | .btn-type1 { |
293 | height: 48rpx; | 334 | height: 48rpx; |
294 | width: 156rpx; | 335 | width: 156rpx; |
295 | border: 1px solid #ff6b4a; | 336 | border: 1px solid #ff6b4a; |
296 | border-radius: 12px; | 337 | border-radius: 12px; |
297 | border-radius: 12px; | 338 | border-radius: 12px; |
298 | text-align: center; | 339 | text-align: center; |
299 | line-height: 48rpx; | 340 | line-height: 48rpx; |
300 | font-size: 12px; | 341 | font-size: 12px; |
301 | color: #ff6b4a; | 342 | color: #ff6b4a; |
302 | } | 343 | } |
303 | .btn-type2 { | 344 | .btn-type2 { |
304 | height: 48rpx; | 345 | height: 48rpx; |
305 | width: 140rpx; | 346 | width: 140rpx; |
306 | background: #ff6b4a; | 347 | background: #ff6b4a; |
307 | border-radius: 12px; | 348 | border-radius: 12px; |
308 | border-radius: 12px; | 349 | border-radius: 12px; |
309 | text-align: center; | 350 | text-align: center; |
310 | line-height: 48rpx; | 351 | line-height: 48rpx; |
311 | font-size: 12px; | 352 | font-size: 12px; |
312 | color: #ffffff; | 353 | color: #ffffff; |
313 | margin-left: 20rpx; | 354 | margin-left: 20rpx; |
314 | } | 355 | } |
315 | } | 356 | } |
316 | } | 357 | } |
317 | </style> | 358 | </style> |
318 | 359 |
src/store/modules/index.js
1 | import urlAlias from '../url'; | 1 | import urlAlias from '../url' |
2 | import request from '../request'; | 2 | import request from '../request' |
3 | 3 | ||
4 | const { | 4 | const { |
5 | category, | 5 | category, |
6 | shopList, | 6 | shopList, |
7 | search, | 7 | search, |
8 | } = urlAlias; | 8 | } = urlAlias |
9 | 9 | ||
10 | let initData = {"name":"志平防蓝光-防辐射电脑网课眼镜","id":"9","imgurl":"", | 10 | const initData = { |
11 | "price":0,"trade_num":"102","rsSon":{"pic":"9_FDB33D.jpg","model_pic":null,"in_price":"6000","sku_value":"80_83", | 11 | name: '志平防蓝光-防辐射电脑网课眼镜', |
12 | "discount":"45","kc":"0","sku_name":"1.56非球面防蓝光_黑透+蓝纹","Max_Price":158,"Min_Price":99}} | 12 | id: '9', |
13 | var initArr = [1,2,3,4,5,6,7,8] | 13 | imgurl: '', |
14 | let list = [] | 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 | initArr.forEach(function (value) { | 30 | initArr.forEach(function (value) { |
16 | list.push(initData) | 31 | list.push(initData) |
17 | }); | 32 | }) |
18 | 33 | ||
19 | let categoryList = [ | 34 | // let categoryList = [ |
20 | { | 35 | // { |
21 | "type": "checkbox", | 36 | // "type": "checkbox", |
22 | "name": "产品", | 37 | // "name": "产品", |
23 | "value": "category", | 38 | // "value": "category", |
24 | "submenu": [ | 39 | // "submenu": [ |
25 | { | 40 | // { |
26 | "label": "镜框", | 41 | // "label": "镜框", |
27 | "name": "镜框", | 42 | // "name": "镜框", |
28 | "value": "1" | 43 | // "value": "1" |
29 | }, | 44 | // }, |
30 | { | 45 | // { |
31 | "label": "镜片", | 46 | // "label": "镜片", |
32 | "name": "镜片", | 47 | // "name": "镜片", |
33 | "value": "2" | 48 | // "value": "2" |
34 | }, | 49 | // }, |
35 | { | 50 | // { |
36 | "label": "特种镜", | 51 | // "label": "特种镜", |
37 | "name": "特种镜", | 52 | // "name": "特种镜", |
38 | "value": "146" | 53 | // "value": "146" |
39 | } | 54 | // } |
40 | ], | 55 | // ], |
41 | "groups": [ | 56 | // "groups": [ |
42 | "001" | 57 | // "001" |
43 | ] | 58 | // ] |
44 | }, | 59 | // }, |
45 | { | 60 | // { |
46 | "type": "radio", | 61 | // "type": "radio", |
47 | "name": "规则", | 62 | // "name": "规则", |
48 | "value": "px", | 63 | // "value": "px", |
49 | "submenu": [ | 64 | // "submenu": [ |
50 | { | 65 | // { |
51 | "name": "按价格排", | 66 | // "name": "按价格排", |
52 | "value": "1" | 67 | // "value": "1" |
53 | }, | 68 | // }, |
54 | { | 69 | // { |
55 | "name": "按销量排", | 70 | // "name": "按销量排", |
56 | "value": "2" | 71 | // "value": "2" |
57 | } | 72 | // } |
58 | ], | 73 | // ], |
59 | "groups": [ | 74 | // "groups": [ |
60 | "002" | 75 | // "002" |
61 | ] | 76 | // ] |
62 | }, | 77 | // }, |
63 | { | 78 | // { |
64 | "type": "radio", | 79 | // "type": "radio", |
65 | "name": "排序", | 80 | // "name": "排序", |
66 | "value": "sort", | 81 | // "value": "sort", |
67 | "submenu": [ | 82 | // "submenu": [ |
68 | { | 83 | // { |
69 | "name": "从高到低", | 84 | // "name": "从高到低", |
70 | "value": "1" | 85 | // "value": "1" |
71 | }, | 86 | // }, |
72 | { | 87 | // { |
73 | "name": "从低到高", | 88 | // "name": "从低到高", |
74 | "value": "2" | 89 | // "value": "2" |
75 | } | 90 | // } |
76 | ], | 91 | // ], |
77 | "groups": [ | 92 | // "groups": [ |
78 | "003" | 93 | // "003" |
79 | ] | 94 | // ] |
80 | }, | 95 | // }, |
81 | { | 96 | // { |
82 | "type": "filter", | 97 | // "type": "filter", |
83 | "name": "筛选", | 98 | // "name": "筛选", |
84 | "value": "filter", | 99 | // "value": "filter", |
85 | "submenu": [ | 100 | // "submenu": [ |
86 | { | 101 | // { |
87 | "type": "checkbox", | 102 | // "type": "checkbox", |
88 | "name": "性别", | 103 | // "name": "性别", |
89 | "value": "sex", | 104 | // "value": "sex", |
90 | "submenu": [ | 105 | // "submenu": [ |
91 | { | 106 | // { |
92 | "label": "男性", | 107 | // "label": "男性", |
93 | "name": "男性", | 108 | // "name": "男性", |
94 | "value": "27" | 109 | // "value": "27" |
95 | }, | 110 | // }, |
96 | { | 111 | // { |
97 | "label": "女性", | 112 | // "label": "女性", |
98 | "name": "女性", | 113 | // "name": "女性", |
99 | "value": "28" | 114 | // "value": "28" |
100 | } | 115 | // } |
101 | ] | 116 | // ] |
102 | }, | 117 | // }, |
103 | { | 118 | // { |
104 | "type": "checkbox", | 119 | // "type": "checkbox", |
105 | "name": "年龄", | 120 | // "name": "年龄", |
106 | "value": "age", | 121 | // "value": "age", |
107 | "submenu": [ | 122 | // "submenu": [ |
108 | { | 123 | // { |
109 | "label": "通用", | 124 | // "label": "通用", |
110 | "name": "通用", | 125 | // "name": "通用", |
111 | "value": "24" | 126 | // "value": "24" |
112 | } | 127 | // } |
113 | ] | 128 | // ] |
114 | }, | 129 | // }, |
115 | { | 130 | // { |
116 | "type": "checkbox", | 131 | // "type": "checkbox", |
117 | "name": "适用场景", | 132 | // "name": "适用场景", |
118 | "value": "sense", | 133 | // "value": "sense", |
119 | "submenu": [ | 134 | // "submenu": [ |
120 | { | 135 | // { |
121 | "label": "行政风", | 136 | // "label": "行政风", |
122 | "name": "行政风", | 137 | // "name": "行政风", |
123 | "value": "53" | 138 | // "value": "53" |
124 | }, | 139 | // }, |
125 | { | 140 | // { |
126 | "label": "青春学子风", | 141 | // "label": "青春学子风", |
127 | "name": "青春学子风", | 142 | // "name": "青春学子风", |
128 | "value": "54" | 143 | // "value": "54" |
129 | }, | 144 | // }, |
130 | { | 145 | // { |
131 | "label": "运动风", | 146 | // "label": "运动风", |
132 | "name": "运动风", | 147 | // "name": "运动风", |
133 | "value": "55" | 148 | // "value": "55" |
134 | }, | 149 | // }, |
135 | { | 150 | // { |
136 | "label": "简约-极简文艺范", | 151 | // "label": "简约-极简文艺范", |
137 | "name": "简约-极简文艺范", | 152 | // "name": "简约-极简文艺范", |
138 | "value": "56" | 153 | // "value": "56" |
139 | }, | 154 | // }, |
140 | { | 155 | // { |
141 | "label": "奶奶风", | 156 | // "label": "奶奶风", |
142 | "name": "奶奶风", | 157 | // "name": "奶奶风", |
143 | "value": "57" | 158 | // "value": "57" |
144 | }, | 159 | // }, |
145 | { | 160 | // { |
146 | "label": "流线洛可可", | 161 | // "label": "流线洛可可", |
147 | "name": "流线洛可可", | 162 | // "name": "流线洛可可", |
148 | "value": "58" | 163 | // "value": "58" |
149 | }, | 164 | // }, |
150 | { | 165 | // { |
151 | "label": "自然舒视角", | 166 | // "label": "自然舒视角", |
152 | "name": "自然舒视角", | 167 | // "name": "自然舒视角", |
153 | "value": "59" | 168 | // "value": "59" |
154 | }, | 169 | // }, |
155 | { | 170 | // { |
156 | "label": "无界人文系", | 171 | // "label": "无界人文系", |
157 | "name": "无界人文系", | 172 | // "name": "无界人文系", |
158 | "value": "60" | 173 | // "value": "60" |
159 | }, | 174 | // }, |
160 | { | 175 | // { |
161 | "label": "有机未来时", | 176 | // "label": "有机未来时", |
162 | "name": "有机未来时", | 177 | // "name": "有机未来时", |
163 | "value": "61" | 178 | // "value": "61" |
164 | }, | 179 | // }, |
165 | { | 180 | // { |
166 | "label": "立体巴洛克", | 181 | // "label": "立体巴洛克", |
167 | "name": "立体巴洛克", | 182 | // "name": "立体巴洛克", |
168 | "value": "62" | 183 | // "value": "62" |
169 | }, | 184 | // }, |
170 | { | 185 | // { |
171 | "label": "多元新风尚", | 186 | // "label": "多元新风尚", |
172 | "name": "多元新风尚", | 187 | // "name": "多元新风尚", |
173 | "value": "63" | 188 | // "value": "63" |
174 | }, | 189 | // }, |
175 | { | 190 | // { |
176 | "label": "理性几何派", | 191 | // "label": "理性几何派", |
177 | "name": "理性几何派", | 192 | // "name": "理性几何派", |
178 | "value": "64" | 193 | // "value": "64" |
179 | }, | 194 | // }, |
180 | { | 195 | // { |
181 | "label": "轻简北欧风", | 196 | // "label": "轻简北欧风", |
182 | "name": "轻简北欧风", | 197 | // "name": "轻简北欧风", |
183 | "value": "65" | 198 | // "value": "65" |
184 | }, | 199 | // }, |
185 | { | 200 | // { |
186 | "label": "质感哥特潮", | 201 | // "label": "质感哥特潮", |
187 | "name": "质感哥特潮", | 202 | // "name": "质感哥特潮", |
188 | "value": "66" | 203 | // "value": "66" |
189 | }, | 204 | // }, |
190 | { | 205 | // { |
191 | "label": "时尚", | 206 | // "label": "时尚", |
192 | "name": "时尚", | 207 | // "name": "时尚", |
193 | "value": "67" | 208 | // "value": "67" |
194 | }, | 209 | // }, |
195 | { | 210 | // { |
196 | "label": "复古", | 211 | // "label": "复古", |
197 | "name": "复古", | 212 | // "name": "复古", |
198 | "value": "68" | 213 | // "value": "68" |
199 | }, | 214 | // }, |
200 | { | 215 | // { |
201 | "label": "商务", | 216 | // "label": "商务", |
202 | "name": "商务", | 217 | // "name": "商务", |
203 | "value": "69" | 218 | // "value": "69" |
204 | }, | 219 | // }, |
205 | { | 220 | // { |
206 | "label": "休闲", | 221 | // "label": "休闲", |
207 | "name": "休闲", | 222 | // "name": "休闲", |
208 | "value": "70" | 223 | // "value": "70" |
209 | }, | 224 | // }, |
210 | { | 225 | // { |
211 | "label": "折射率", | 226 | // "label": "折射率", |
212 | "name": "折射率", | 227 | // "name": "折射率", |
213 | "value": "285" | 228 | // "value": "285" |
214 | } | 229 | // } |
215 | ] | 230 | // ] |
216 | }, | 231 | // }, |
217 | { | 232 | // { |
218 | "type": "checkbox", | 233 | // "type": "checkbox", |
219 | "name": "价格", | 234 | // "name": "价格", |
220 | "value": "price", | 235 | // "value": "price", |
221 | "submenu": [ | 236 | // "submenu": [ |
222 | { | 237 | // { |
223 | "name": "100以下", | 238 | // "name": "100以下", |
224 | "value": "1,100" | 239 | // "value": "1,100" |
225 | }, | 240 | // }, |
226 | { | 241 | // { |
227 | "name": "100-300", | 242 | // "name": "100-300", |
228 | "value": "100,300" | 243 | // "value": "100,300" |
229 | }, | 244 | // }, |
230 | { | 245 | // { |
231 | "name": "300-1000", | 246 | // "name": "300-1000", |
232 | "value": "300,1000" | 247 | // "value": "300,1000" |
233 | }, | 248 | // }, |
234 | { | 249 | // { |
235 | "name": "1000以上", | 250 | // "name": "1000以上", |
236 | "value": "1000,-1" | 251 | // "value": "1000,-1" |
237 | } | 252 | // } |
238 | ] | 253 | // ] |
239 | }, | 254 | // }, |
240 | { | 255 | // { |
241 | "type": "checkbox", | 256 | // "type": "checkbox", |
242 | "name": "材质", | 257 | // "name": "材质", |
243 | "value": "glasscate", | 258 | // "value": "glasscate", |
244 | "submenu": [ | 259 | // "submenu": [ |
245 | { | 260 | // { |
246 | "label": "购易", | 261 | // "label": "购易", |
247 | "name": "购易", | 262 | // "name": "购易", |
248 | "value": "72" | 263 | // "value": "72" |
249 | }, | 264 | // }, |
250 | { | 265 | // { |
251 | "label": "海俪恩", | 266 | // "label": "海俪恩", |
252 | "name": "海俪恩", | 267 | // "name": "海俪恩", |
253 | "value": "73" | 268 | // "value": "73" |
254 | }, | 269 | // }, |
255 | { | 270 | // { |
256 | "label": "沙漠风暴", | 271 | // "label": "沙漠风暴", |
257 | "name": "沙漠风暴", | 272 | // "name": "沙漠风暴", |
258 | "value": "74" | 273 | // "value": "74" |
259 | }, | 274 | // }, |
260 | { | 275 | // { |
261 | "label": "古诗", | 276 | // "label": "古诗", |
262 | "name": "古诗", | 277 | // "name": "古诗", |
263 | "value": "75" | 278 | // "value": "75" |
264 | }, | 279 | // }, |
265 | { | 280 | // { |
266 | "label": "暴龙", | 281 | // "label": "暴龙", |
267 | "name": "暴龙", | 282 | // "name": "暴龙", |
268 | "value": "76" | 283 | // "value": "76" |
269 | }, | 284 | // }, |
270 | { | 285 | // { |
271 | "label": "犀牛", | 286 | // "label": "犀牛", |
272 | "name": "犀牛", | 287 | // "name": "犀牛", |
273 | "value": "77" | 288 | // "value": "77" |
274 | }, | 289 | // }, |
275 | { | 290 | // { |
276 | "label": "Ray-Ban雷朋", | 291 | // "label": "Ray-Ban雷朋", |
277 | "name": "Ray-Ban雷朋", | 292 | // "name": "Ray-Ban雷朋", |
278 | "value": "78" | 293 | // "value": "78" |
279 | }, | 294 | // }, |
280 | { | 295 | // { |
281 | "label": "PARIM派丽蒙", | 296 | // "label": "PARIM派丽蒙", |
282 | "name": "PARIM派丽蒙", | 297 | // "name": "PARIM派丽蒙", |
283 | "value": "79" | 298 | // "value": "79" |
284 | }, | 299 | // }, |
285 | { | 300 | // { |
286 | "label": "石狼", | 301 | // "label": "石狼", |
287 | "name": "石狼", | 302 | // "name": "石狼", |
288 | "value": "80" | 303 | // "value": "80" |
289 | }, | 304 | // }, |
290 | { | 305 | // { |
291 | "label": "木九十", | 306 | // "label": "木九十", |
292 | "name": "木九十", | 307 | // "name": "木九十", |
293 | "value": "81" | 308 | // "value": "81" |
294 | } | 309 | // } |
295 | ] | 310 | // ] |
296 | }, | 311 | // }, |
297 | { | 312 | // { |
298 | "type": "checkbox", | 313 | // "type": "checkbox", |
299 | "name": "品牌", | 314 | // "name": "品牌", |
300 | "value": "brand", | 315 | // "value": "brand", |
301 | "submenu": [ | 316 | // "submenu": [ |
302 | { | 317 | // { |
303 | "label": "购易", | 318 | // "label": "购易", |
304 | "name": "购易", | 319 | // "name": "购易", |
305 | "value": "72" | 320 | // "value": "72" |
306 | }, | 321 | // }, |
307 | { | 322 | // { |
308 | "label": "海俪恩", | 323 | // "label": "海俪恩", |
309 | "name": "海俪恩", | 324 | // "name": "海俪恩", |
310 | "value": "73" | 325 | // "value": "73" |
311 | }, | 326 | // }, |
312 | { | 327 | // { |
313 | "label": "沙漠风暴", | 328 | // "label": "沙漠风暴", |
314 | "name": "沙漠风暴", | 329 | // "name": "沙漠风暴", |
315 | "value": "74" | 330 | // "value": "74" |
316 | }, | 331 | // }, |
317 | { | 332 | // { |
318 | "label": "古诗", | 333 | // "label": "古诗", |
319 | "name": "古诗", | 334 | // "name": "古诗", |
320 | "value": "75" | 335 | // "value": "75" |
321 | }, | 336 | // }, |
322 | { | 337 | // { |
323 | "label": "暴龙", | 338 | // "label": "暴龙", |
324 | "name": "暴龙", | 339 | // "name": "暴龙", |
325 | "value": "76" | 340 | // "value": "76" |
326 | }, | 341 | // }, |
327 | { | 342 | // { |
328 | "label": "犀牛", | 343 | // "label": "犀牛", |
329 | "name": "犀牛", | 344 | // "name": "犀牛", |
330 | "value": "77" | 345 | // "value": "77" |
331 | }, | 346 | // }, |
332 | { | 347 | // { |
333 | "label": "Ray-Ban雷朋", | 348 | // "label": "Ray-Ban雷朋", |
334 | "name": "Ray-Ban雷朋", | 349 | // "name": "Ray-Ban雷朋", |
335 | "value": "78" | 350 | // "value": "78" |
336 | }, | 351 | // }, |
337 | { | 352 | // { |
338 | "label": "PARIM派丽蒙", | 353 | // "label": "PARIM派丽蒙", |
339 | "name": "PARIM派丽蒙", | 354 | // "name": "PARIM派丽蒙", |
340 | "value": "79" | 355 | // "value": "79" |
341 | }, | 356 | // }, |
342 | { | 357 | // { |
343 | "label": "石狼", | 358 | // "label": "石狼", |
344 | "name": "石狼", | 359 | // "name": "石狼", |
345 | "value": "80" | 360 | // "value": "80" |
346 | }, | 361 | // }, |
347 | { | 362 | // { |
348 | "label": "木九十", | 363 | // "label": "木九十", |
349 | "name": "木九十", | 364 | // "name": "木九十", |
350 | "value": "81" | 365 | // "value": "81" |
351 | } | 366 | // } |
352 | ] | 367 | // ] |
353 | } | 368 | // } |
354 | ], | 369 | // ], |
355 | "groups": [ | 370 | // "groups": [ |
356 | "001", | 371 | // "001", |
357 | "002", | 372 | // "002", |
358 | "003" | 373 | // "003" |
359 | ], | 374 | // ], |
360 | } | 375 | // } |
361 | ] | 376 | // ] |
362 | 377 | ||
363 | //初始化数据是为了显示默认骨架 | 378 | // 初始化数据是为了显示默认骨架 |
364 | const state = { | 379 | const state = { |
365 | categoryList: [], | 380 | categoryList: [], |
366 | list: list | 381 | list: list, |
367 | }; | 382 | } |
368 | |||
369 | const mutations = { | ||
370 | LIST: (state, list) => { | ||
371 | state.list = list; | ||
372 | }, | ||
373 | CATEGORY: (state, categoryList) => { | ||
374 | state.categoryList = categoryList; | ||
375 | } | ||
376 | }; | ||
377 | 383 | ||
378 | const actions = { | 384 | const mutations = { |
379 | category({ | 385 | LIST: (state, list) => { |
380 | commit | 386 | state.list = list |
381 | }, param) { | 387 | }, |
382 | return new Promise((resolve) => request({ | 388 | CATEGORY: (state, categoryList) => { |
383 | url: category, | 389 | state.categoryList = categoryList |
384 | success: (res) => { | 390 | }, |
385 | let data = res.data.data; | 391 | } |
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 | }; | ||
449 | 392 | ||
450 | export default { | ||
451 | namespaced: true, | ||
452 | state, | ||
453 | mutations, | ||
454 | actions, |
src/store/request.js
1 | const DOMAIN = 'https://api.glass.xiuyetang.com' | 1 | const DOMAIN = 'https://api.glass.xiuyetang.com' |
2 | 2 | ||
3 | let loading = false | ||
4 | |||
3 | export default async function request({ | 5 | export default async function request({ |
4 | url, | 6 | url, |
5 | method = 'post', | 7 | method = 'post', |
6 | data = {}, | 8 | data = {}, |
7 | header = { | 9 | header = { |
8 | 'Content-Type': 'application/x-www-form-urlencoded', | 10 | 'Content-Type': 'application/x-www-form-urlencoded', |
9 | }, | 11 | }, |
10 | timeout = 3000, | 12 | timeout = 3000, |
11 | withCredentials = false, // 跨域请求时是否携带凭证(cookies) | 13 | withCredentials = false, // 跨域请求时是否携带凭证(cookies) |
12 | // sslVerify: true, // 验证 ssl 证书 | 14 | // sslVerify: true, // 验证 ssl 证书 |
13 | success, | 15 | success, |
14 | fail = (res) => { | 16 | fail = (res) => { |
15 | console.log('fail status === > ', res) | 17 | console.log('fail status === > ', res) |
16 | }, | 18 | }, |
17 | complete = (res) => { | 19 | complete = (res) => { |
18 | console.log('complete status === > ', res) | 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 | const uid = uni.getStorageSync('uid') | 34 | const uid = uni.getStorageSync('uid') |
22 | const openid = uni.getStorageSync('openid') | 35 | const openid = uni.getStorageSync('openid') |
23 | data = { | 36 | data = { |
24 | uid, | 37 | uid, |
25 | openid, | 38 | openid, |
26 | ...data, | 39 | ...data, |
27 | } | 40 | } |
28 | uni | 41 | uni |
29 | .request({ | 42 | .request({ |
30 | url: DOMAIN + url, | 43 | url: DOMAIN + url, |
31 | method, | 44 | method, |
32 | data, | 45 | data, |
33 | header, | 46 | header, |
34 | timeout, | 47 | timeout, |
35 | withCredentials, | 48 | withCredentials, |
36 | success, | 49 | success, |
37 | fail, | 50 | fail, |
38 | complete, | 51 | complete, |
39 | }) | 52 | }) |
40 | } | 53 | } |
41 | 54 |