diff --git a/pkg_product/views/famousQianxianShop.vue b/pkg_product/views/famousQianxianShop.vue index e50ba47..048f8f1 100644 --- a/pkg_product/views/famousQianxianShop.vue +++ b/pkg_product/views/famousQianxianShop.vue @@ -538,6 +538,9 @@ /> + + + { item.isOldBrand = 0 item.isLandmarkGoods = 0 - item.isCountyFamous = 1 if (index % 2 === 0) { this.leftList.push(item) } if (index % 2 === 1) { + item.isFarmer = 1 this.rightList.push(item) } }) } }) }, + shuffleArray(array) { + for (let i = array.length - 1; i > 0; i--) { + let j = Math.floor(Math.random() * (i + 1)); + [array[i], array[j]] = [array[j], array[i]]; + } + return array; + }, + sortProductsAndStores(products, stores) { + const randomMap = [] + const randomProduct = products.length === 0 ? null : products.length === 1 ? products[0] : products[Math.floor(Math.random() * products.length)] + const store = stores.length === 0 ? null : stores.length === 1 ? stores[0] : stores[Math.floor(Math.random() * stores.length)] + if(!randomProduct && !store) { + return [] + } + if(!randomProduct && store) { + return stores + } + if(randomProduct && !store) { + return products + } + if(randomProduct && store) { + randomMap[0] = randomProduct + randomMap[1] = store + const _p = products.filter(e => e !== randomProduct) + const _s = stores.filter(e => e !== store) + const concatArr = this.shuffleArray(_p.concat(_s)) + return randomMap.concat(concatArr); + } + }, getShopDetailReq() { const _this = this getCountyFamousCityShop({ countyFamousDataId: _this.id }).then((res) => {