Commit 3dbe9e76734e9893999d81c0bad1614f5ec64ab1
1 parent
bbb58a95
购好物,新店铺首页,提测~
Showing
2 changed files
with
32 additions
and
57 deletions
src/pages/shopList/shopList.less
src/pages/shopList/shopList.vue
| ... | ... | @@ -179,10 +179,10 @@ |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | // 获取页面头部数据 |
| 182 | - this.ghIndex(); | |
| 182 | + this.getActShopIndex(); | |
| 183 | 183 | |
| 184 | - // 工会商品列表(初始化) | |
| 185 | - this.ghGoodsList(this.CALL_STATUS.INIT); | |
| 184 | + // 商品列表(初始化) | |
| 185 | + this.shopNewGoodsList(this.CALL_STATUS.INIT); | |
| 186 | 186 | }, |
| 187 | 187 | methods: { |
| 188 | 188 | |
| ... | ... | @@ -214,15 +214,15 @@ |
| 214 | 214 | // 设置初始化页码 |
| 215 | 215 | this.$set(this.tabs.list[this.tabs.active], 'page', 1); |
| 216 | 216 | |
| 217 | - // 工会商品列表 | |
| 218 | - this.ghGoodsList(this.CALL_STATUS.INIT); | |
| 217 | + // 商品列表 | |
| 218 | + this.shopNewGoodsList(this.CALL_STATUS.INIT); | |
| 219 | 219 | } else { |
| 220 | 220 | |
| 221 | 221 | // 判断页面是数字再执行 |
| 222 | 222 | if (!isNaN(parseInt(this.tabs.list[this.tabs.active].page))) { |
| 223 | 223 | |
| 224 | - // 工会商品列表 | |
| 225 | - this.ghGoodsList(this.CALL_STATUS.LOAD_MORE); | |
| 224 | + // 商品列表 | |
| 225 | + this.shopNewGoodsList(this.CALL_STATUS.LOAD_MORE); | |
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | } |
| ... | ... | @@ -244,8 +244,8 @@ |
| 244 | 244 | // 根据参数判断请求哪个接口,获取哪个列表 |
| 245 | 245 | if (this.tabs.list[this.tabs.active].type == '1' && (!this.tabs.list[this.tabs.active].page || this.tabs.list[this.tabs.active].page == 1)) { |
| 246 | 246 | |
| 247 | - // 工会商品列表(初始化) | |
| 248 | - this.ghGoodsList(this.CALL_STATUS.INIT); | |
| 247 | + // 商品列表(初始化) | |
| 248 | + this.shopNewGoodsList(this.CALL_STATUS.INIT); | |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | // 回到顶部 |
| ... | ... | @@ -267,19 +267,18 @@ |
| 267 | 267 | /** |
| 268 | 268 | * 获取页面头部数据 |
| 269 | 269 | */ |
| 270 | - ghIndex() { | |
| 270 | + getActShopIndex() { | |
| 271 | 271 | |
| 272 | 272 | // 判断必要参数 |
| 273 | - if (this.$route.query.ghId) { | |
| 273 | + if (this.$route.query.shop_id) { | |
| 274 | 274 | |
| 275 | 275 | // 加载中提示 |
| 276 | 276 | Indicator.open("加载中..."); |
| 277 | 277 | |
| 278 | 278 | // 获取证书请求接口 |
| 279 | - this.http("/Api/" + (this.getApiVersion().index) + "/ghIndex", { | |
| 280 | - id: this.$route.query.ghId, | |
| 281 | - uid: (this.$route.query.uid || 0) | |
| 282 | - }, this.ghIndexCallback, { | |
| 279 | + this.http("/Api/" + (this.getApiVersion().index) + "/getActShopIndex", { | |
| 280 | + id: this.$route.query.shop_id | |
| 281 | + }, this.getActShopIndexCallback, { | |
| 283 | 282 | method: "POST" |
| 284 | 283 | }); |
| 285 | 284 | } |
| ... | ... | @@ -290,7 +289,7 @@ |
| 290 | 289 | * @param {Object} res [服务器返回数据] |
| 291 | 290 | * @param {Object} ext [扩展参数] |
| 292 | 291 | */ |
| 293 | - ghIndexCallback(res, ext) { | |
| 292 | + getActShopIndexCallback(res, ext) { | |
| 294 | 293 | |
| 295 | 294 | // 加载完成 |
| 296 | 295 | Indicator.close(); |
| ... | ... | @@ -317,35 +316,11 @@ |
| 317 | 316 | } |
| 318 | 317 | |
| 319 | 318 | // 获取头部swiper的banner |
| 319 | + if (datas.banner && typeof datas.banner === 'object' && datas.banner.length) { | |
| 320 | 320 | |
| 321 | - | |
| 322 | - | |
| 323 | - // 临时,测试swiper | |
| 324 | - this.$set(this, 'swipers', [ | |
| 325 | - { | |
| 326 | - id: "251", | |
| 327 | - shop_type: "1", | |
| 328 | - simg: "https://wjjtest.ys2.cnliveimg.com/802/shop/img/2019/09/05/5d70b6ec83d77.jpg", | |
| 329 | - title: "123123321", | |
| 330 | - to: "https://wjjshop.cnlive.com/html/vaccines/2/#/pages/main/detail/detail?id=14", | |
| 331 | - type: "5" | |
| 332 | - }, | |
| 333 | - { | |
| 334 | - id: "252", | |
| 335 | - shop_type: "", | |
| 336 | - simg: "https://wjjtest.ys2.cnliveimg.com/802/shop/img/2019/09/05/5d70b7546f20f.jpg", | |
| 337 | - title: "达人", | |
| 338 | - to: "daren_10455685", | |
| 339 | - type: "11" | |
| 340 | - } | |
| 341 | - ]); | |
| 342 | - | |
| 343 | - | |
| 344 | - | |
| 345 | - | |
| 346 | - | |
| 347 | - | |
| 348 | - | |
| 321 | + // 设置banner | |
| 322 | + this.$set(this, 'swipers', datas.banner); | |
| 323 | + } | |
| 349 | 324 | |
| 350 | 325 | // 获取tabs数据 |
| 351 | 326 | if (datas.list && datas.list.length) { |
| ... | ... | @@ -372,13 +347,13 @@ |
| 372 | 347 | }, |
| 373 | 348 | |
| 374 | 349 | /** |
| 375 | - * 工会商品列表 | |
| 350 | + * 商品列表 | |
| 376 | 351 | * @param {Object} CALL_STATUS [何处触发请求] |
| 377 | 352 | */ |
| 378 | - ghGoodsList(CALL_STATUS = this.CALL_STATUS.LOAD_MORE) { | |
| 353 | + shopNewGoodsList(CALL_STATUS = this.CALL_STATUS.LOAD_MORE) { | |
| 379 | 354 | |
| 380 | 355 | // 判断必要参数 |
| 381 | - if (this.$route.query.ghId && this.tabs.list[this.tabs.active].id >= 0) { | |
| 356 | + if (this.$route.query.shop_id && this.tabs.list[this.tabs.active].id >= 0) { | |
| 382 | 357 | |
| 383 | 358 | // 设置开始加载 |
| 384 | 359 | this.$set(this.tabs.list[this.tabs.active], "loading", true); |
| ... | ... | @@ -387,11 +362,11 @@ |
| 387 | 362 | Indicator.open('加载中...'); |
| 388 | 363 | |
| 389 | 364 | // 请求接口 |
| 390 | - this.http("/Api/" + (this.getApiVersion().index) + "/ghGoodsList", { | |
| 391 | - id: this.$route.query.ghId, | |
| 392 | - group_id: this.tabs.list[this.tabs.active].id, | |
| 365 | + this.http("/Api/" + (this.getApiVersion().index) + "/shopNewGoodsList", { | |
| 366 | + shopId: this.$route.query.shop_id, | |
| 367 | + groupid: this.tabs.list[this.tabs.active].id, | |
| 393 | 368 | page: this.tabs.list[this.tabs.active].page |
| 394 | - }, this.ghGoodsListCallback, { | |
| 369 | + }, this.shopNewGoodsListCallback, { | |
| 395 | 370 | method: "POST", |
| 396 | 371 | CALL_STATUS |
| 397 | 372 | }); |
| ... | ... | @@ -399,11 +374,11 @@ |
| 399 | 374 | }, |
| 400 | 375 | |
| 401 | 376 | /** |
| 402 | - * 工会商品列表回调 | |
| 377 | + * 商品列表回调 | |
| 403 | 378 | * @param {Object} res [服务器返回数据] |
| 404 | 379 | * @param {Object} ext [扩展参数] |
| 405 | 380 | */ |
| 406 | - ghGoodsListCallback(res, ext) { | |
| 381 | + shopNewGoodsListCallback(res, ext) { | |
| 407 | 382 | |
| 408 | 383 | // 加载完成 |
| 409 | 384 | Indicator.close(); |
| ... | ... | @@ -415,19 +390,19 @@ |
| 415 | 390 | let {data: datas} = res; |
| 416 | 391 | |
| 417 | 392 | // 判断如果有数据 |
| 418 | - if (datas.list && datas.list.length) { | |
| 393 | + if (datas && datas.length) { | |
| 419 | 394 | |
| 420 | 395 | /* 设置列表数据 开始 */ |
| 421 | 396 | switch (ext.CALL_STATUS) { |
| 422 | 397 | case this.CALL_STATUS.INIT: |
| 423 | 398 | |
| 424 | 399 | // 设置推荐商品列表 |
| 425 | - this.$set(this.lists, this.tabs.active, datas.list); | |
| 400 | + this.$set(this.lists, this.tabs.active, datas); | |
| 426 | 401 | break; |
| 427 | 402 | case this.CALL_STATUS.LOAD_MORE: |
| 428 | 403 | |
| 429 | 404 | // 添加数据到数组 |
| 430 | - this.$set(this.lists, this.tabs.active, [...this.lists[this.tabs.active], ...datas.list]); | |
| 405 | + this.$set(this.lists, this.tabs.active, [...this.lists[this.tabs.active], ...datas]); | |
| 431 | 406 | break; |
| 432 | 407 | } |
| 433 | 408 | ... | ... |