|
@@ -77,7 +77,7 @@
|
|
|
mapMutations,
|
|
|
} from 'vuex'
|
|
|
import chooseProductItem from '@/pagesB/components/chooseProductItemSkline.vue'
|
|
|
- import { getShopCategoryExt, getShopProductList } from '@/api/shop.js'
|
|
|
+ import { getShopCategory, getShopProductList } from '@/api/shop.js'
|
|
|
export default {
|
|
|
components:{
|
|
|
chooseProductItem
|
|
@@ -127,17 +127,20 @@
|
|
|
|
|
|
// 一级分类id
|
|
|
this.clzId = opts.clzId
|
|
|
+ // 一级分类名称
|
|
|
+ this.title = opts.clzName
|
|
|
|
|
|
- // 搜索商品
|
|
|
- if(opts.clzId==''){
|
|
|
- this.title = '商城商品搜索'
|
|
|
- this.focus = true
|
|
|
- }else{
|
|
|
- // 分类下产品
|
|
|
- this.title = opts.clzName
|
|
|
+ // 一级分类下是二级目录
|
|
|
+ if(opts.shopCategoryCount>0){
|
|
|
// 查二级目录
|
|
|
this.getCategory()
|
|
|
}
|
|
|
+ // 一级分类下是产品
|
|
|
+ if(opts.shopProductCount>0){
|
|
|
+ this.categorySn = opts.clzId
|
|
|
+ // 目录下商品
|
|
|
+ this.searchList()
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
// 返回
|
|
@@ -152,55 +155,20 @@
|
|
|
},
|
|
|
// 获取二级目录
|
|
|
getCategory(){
|
|
|
- getShopCategoryExt({
|
|
|
- categorySn: this.clzId,
|
|
|
- status: 1
|
|
|
+ getShopCategory({
|
|
|
+ parentSn: this.clzId,
|
|
|
+ categoryLevel: 2
|
|
|
}).then(res => {
|
|
|
if(res.status == 200){
|
|
|
// 二级目录
|
|
|
- this.categoryList = res.data && res.data.shopCategoryList ? res.data.shopCategoryList : []
|
|
|
+ this.categoryList = res.data || []
|
|
|
// 如果有二级目录
|
|
|
if(this.categoryList.length > 0){
|
|
|
- // this.categoryList.unshift({
|
|
|
- // categorySn: this.clzId,
|
|
|
- // categoryName: '全部'
|
|
|
- // })
|
|
|
// 默认显示第一个
|
|
|
this.categorySn = this.categoryList[0].categorySn
|
|
|
// 目录下商品
|
|
|
this.searchList()
|
|
|
- }else{
|
|
|
- // 禁用下拉刷新
|
|
|
- this.enableRefresh = false
|
|
|
- // 只有产品
|
|
|
- const list = res.data && res.data.shopProductList ? res.data.shopProductList : []
|
|
|
- this.total = list.length
|
|
|
- // 更新已选状态
|
|
|
- for(let i=0;i<list.length;i=i+this.pageSize){
|
|
|
- // 追加数据
|
|
|
- this.list.push(list.slice(i,(i+this.pageSize)>list.length?list.length:(i+this.pageSize)).map(k=>{
|
|
|
- return {
|
|
|
- id: k.id,
|
|
|
- price: k.price,
|
|
|
- productCode: k.productCode,
|
|
|
- productSn: k.productSn,
|
|
|
- productImage: k.productMsg,
|
|
|
- productName: k.productName,
|
|
|
- productOrigCode: k.productOrigCode,
|
|
|
- categorySn: k.categorySn,
|
|
|
- hotFlag: k.hotFlag,
|
|
|
- productSn: k.productSn,
|
|
|
- priceType: k.priceType,
|
|
|
- shopProductSn: k.shopProductSn,
|
|
|
- status: k.status,
|
|
|
- statusDictValue: k.statusDictValue,
|
|
|
- dealerScopeFlag: k.dealerScopeFlag
|
|
|
- }
|
|
|
- }))
|
|
|
- }
|
|
|
- this.loadEnd = true
|
|
|
- this.loadText = '没有更多了'
|
|
|
- }
|
|
|
+ }
|
|
|
}else{
|
|
|
uni.showToast({
|
|
|
title: res.message,
|