Commit c7cac04955e324880cda13b20139350d86a8ef99
1 parent
a650e7ab
数据联调
Showing
2 changed files
with
30 additions
and
47 deletions
src/components/columnCommodityListBox/columnCommodityListBox.vue
| @@ -68,7 +68,7 @@ | @@ -68,7 +68,7 @@ | ||
| 68 | export default { | 68 | export default { |
| 69 | data() { | 69 | data() { |
| 70 | return { | 70 | return { |
| 71 | - | 71 | + |
| 72 | }; | 72 | }; |
| 73 | }, | 73 | }, |
| 74 | props: ["columnLists"], | 74 | props: ["columnLists"], |
| @@ -88,7 +88,7 @@ | @@ -88,7 +88,7 @@ | ||
| 88 | */ | 88 | */ |
| 89 | getDecimal() { | 89 | getDecimal() { |
| 90 | return (number) => { | 90 | return (number) => { |
| 91 | - | 91 | + |
| 92 | // 拆分数字 | 92 | // 拆分数字 |
| 93 | let numberArr = number.toString().split("."); | 93 | let numberArr = number.toString().split("."); |
| 94 | 94 | ||
| @@ -101,8 +101,11 @@ | @@ -101,8 +101,11 @@ | ||
| 101 | } | 101 | } |
| 102 | } | 102 | } |
| 103 | }, | 103 | }, |
| 104 | + created(){ | ||
| 105 | + console.log(this.columnLists) | ||
| 106 | + }, | ||
| 104 | methods: { | 107 | methods: { |
| 105 | - | 108 | + |
| 106 | /** | 109 | /** |
| 107 | * 跳转详情 | 110 | * 跳转详情 |
| 108 | * @param {object} item [对象] | 111 | * @param {object} item [对象] |
| @@ -117,4 +120,4 @@ | @@ -117,4 +120,4 @@ | ||
| 117 | <!-- Add "scoped" attribute to limit CSS to this component only --> | 120 | <!-- Add "scoped" attribute to limit CSS to this component only --> |
| 118 | <style rel="stylesheet/less" lang='less' scoped> | 121 | <style rel="stylesheet/less" lang='less' scoped> |
| 119 | @import './columnCommodityListBox'; | 122 | @import './columnCommodityListBox'; |
| 120 | -</style> | ||
| 121 | \ No newline at end of file | 123 | \ No newline at end of file |
| 124 | +</style> |
src/components/tabBox/tabBox.vue
| @@ -7,25 +7,25 @@ | @@ -7,25 +7,25 @@ | ||
| 7 | <div class="tabbar" v-for="(item, index) in tabbaromponents.ads" :key="index"> | 7 | <div class="tabbar" v-for="(item, index) in tabbaromponents.ads" :key="index"> |
| 8 | <!-- 关爱屋简介 --> | 8 | <!-- 关爱屋简介 --> |
| 9 | <html-box | 9 | <html-box |
| 10 | - v-if="item.style == '14'" | 10 | + v-if="item.style === '14'" |
| 11 | :htmls="item.content"> | 11 | :htmls="item.content"> |
| 12 | </html-box> | 12 | </html-box> |
| 13 | <!-- 精品推荐 --> | 13 | <!-- 精品推荐 --> |
| 14 | <!-- 精品推荐 --> | 14 | <!-- 精品推荐 --> |
| 15 | - <div class="boutique-list" v-infinite-scroll="loadBoutique" infinite-scroll-disabled="paging.boutique.loading" :infinite-scroll-distance="paging.distance"> | 15 | + <!--<div class="boutique-list" v-infinite-scroll="loadBoutique" infinite-scroll-disabled="paging.boutique.loading" :infinite-scroll-distance="paging.distance">--> |
| 16 | <img-list-box | 16 | <img-list-box |
| 17 | - v-if="item.style == '1'" | 17 | + v-if="item.style === '1'" |
| 18 | @detail="toDetail" | 18 | @detail="toDetail" |
| 19 | :imgLists="item.img"> | 19 | :imgLists="item.img"> |
| 20 | </img-list-box> | 20 | </img-list-box> |
| 21 | - </div> | 21 | + <!--</div>--> |
| 22 | <!-- 商品推荐 --> | 22 | <!-- 商品推荐 --> |
| 23 | <!-- 商品推荐 --> | 23 | <!-- 商品推荐 --> |
| 24 | - <div class="column-commodity-list" v-infinite-scroll="loadCommodity" infinite-scroll-disabled="paging.commodity.loading" :infinite-scroll-distance="paging.distance"> | 24 | + <div class="column-commodity-list" v-infinite-scroll="loadCommodity" infinite-scroll-disabled="paging.commodity.loading" :infinite-scroll-distance="paging.distance"> |
| 25 | <column-commodity-list-box | 25 | <column-commodity-list-box |
| 26 | - v-if="item.style == '15'" | 26 | + v-if="item.style === '15'" |
| 27 | @detail="toCommodityDetail" | 27 | @detail="toCommodityDetail" |
| 28 | - :columnLists="item"> | 28 | + :columnLists="commoditys"> |
| 29 | </column-commodity-list-box> | 29 | </column-commodity-list-box> |
| 30 | </div> | 30 | </div> |
| 31 | <!--优惠专区--> | 31 | <!--优惠专区--> |
| @@ -40,6 +40,7 @@ | @@ -40,6 +40,7 @@ | ||
| 40 | </template> | 40 | </template> |
| 41 | 41 | ||
| 42 | <script> | 42 | <script> |
| 43 | + import { Toast, Indicator } from "mint-ui"; | ||
| 43 | import htmlBox from "@/components/htmlBox/htmlBox"; | 44 | import htmlBox from "@/components/htmlBox/htmlBox"; |
| 44 | import imgListBox from "@/components/imgListBox/imgListBox"; | 45 | import imgListBox from "@/components/imgListBox/imgListBox"; |
| 45 | import columnCommodityListBox from "@/components/columnCommodityListBox/columnCommodityListBox"; | 46 | import columnCommodityListBox from "@/components/columnCommodityListBox/columnCommodityListBox"; |
| @@ -50,6 +51,9 @@ | @@ -50,6 +51,9 @@ | ||
| 50 | return { | 51 | return { |
| 51 | active: 0, | 52 | active: 0, |
| 52 | tabbaromponents: null, // 组件库 | 53 | tabbaromponents: null, // 组件库 |
| 54 | + commoditys: { // 全部推荐 | ||
| 55 | + list: [] | ||
| 56 | + }, | ||
| 53 | paging: { // 分页 | 57 | paging: { // 分页 |
| 54 | boutique: { | 58 | boutique: { |
| 55 | loading: true, | 59 | loading: true, |
| @@ -76,7 +80,7 @@ | @@ -76,7 +80,7 @@ | ||
| 76 | return item.title === "关爱屋" | 80 | return item.title === "关爱屋" |
| 77 | }); | 81 | }); |
| 78 | // 获取领头雁电商精品推荐 | 82 | // 获取领头雁电商精品推荐 |
| 79 | - this.getActivityAdsGoods(this.paging.boutique.page); | 83 | +// this.getActivityAdsGoods(this.paging.boutique.page); |
| 80 | }, | 84 | }, |
| 81 | methods: { | 85 | methods: { |
| 82 | onChange(name, title) { | 86 | onChange(name, title) { |
| @@ -84,6 +88,11 @@ | @@ -84,6 +88,11 @@ | ||
| 84 | this.tabbaromponents = this.tabbar.find((item)=>{ | 88 | this.tabbaromponents = this.tabbar.find((item)=>{ |
| 85 | return item.title === title | 89 | return item.title === title |
| 86 | }); | 90 | }); |
| 91 | + if(title==='全部商品'){ | ||
| 92 | + // 店铺商品推荐 | ||
| 93 | + this.shopRecommendGoods(this.paging.commodity.page); | ||
| 94 | + } | ||
| 95 | + | ||
| 87 | }, | 96 | }, |
| 88 | /** | 97 | /** |
| 89 | * 调用通用跳转 | 98 | * 调用通用跳转 |
| @@ -114,28 +123,13 @@ | @@ -114,28 +123,13 @@ | ||
| 114 | this.toDetail(item); | 123 | this.toDetail(item); |
| 115 | }, | 124 | }, |
| 116 | /** | 125 | /** |
| 117 | - * 上拉加载“精品推荐” | ||
| 118 | - */ | ||
| 119 | - loadBoutique() { | ||
| 120 | - | ||
| 121 | - // 判断是“精品推荐”页才加载 | ||
| 122 | - if (this.activeTabIndex === 1) { | ||
| 123 | - | ||
| 124 | - // 设置“精品推荐”页码 | ||
| 125 | - this.$set(this.paging.boutique, "page", ++this.paging.boutique.page); | ||
| 126 | - | ||
| 127 | - // 调用接口 | ||
| 128 | - this.getActivityAdsGoods(this.paging.boutique.page); | ||
| 129 | - } | ||
| 130 | - }, | ||
| 131 | - /** | ||
| 132 | * 店铺商品推荐 | 126 | * 店铺商品推荐 |
| 133 | * @param {int} page [页码] | 127 | * @param {int} page [页码] |
| 134 | */ | 128 | */ |
| 135 | shopRecommendGoods(page) { | 129 | shopRecommendGoods(page) { |
| 136 | - | 130 | + console.log(this.tabbaromponents) |
| 137 | // 判断必要参数 | 131 | // 判断必要参数 |
| 138 | - if (this.shopId) { | 132 | + if (this.tabbaromponents.ads[0].id) { |
| 139 | 133 | ||
| 140 | // 加载中 | 134 | // 加载中 |
| 141 | this.$set(this.paging.commodity, "loading", true); | 135 | this.$set(this.paging.commodity, "loading", true); |
| @@ -144,8 +138,8 @@ | @@ -144,8 +138,8 @@ | ||
| 144 | Indicator.open('加载中...'); | 138 | Indicator.open('加载中...'); |
| 145 | 139 | ||
| 146 | // 请求接口 | 140 | // 请求接口 |
| 147 | - this.http("/Api/" + (this.getApiVersion().index) + "/shopRecommendGoods", { | ||
| 148 | - shop_id: this.shopId, | 141 | + this.http("/Api/" + (this.getApiVersion().index) + "/shopGoodsList", { |
| 142 | + shop_id: this.tabbaromponents.ads[0].id, | ||
| 149 | page: page | 143 | page: page |
| 150 | }, this.shopRecommendGoodsCallback, { | 144 | }, this.shopRecommendGoodsCallback, { |
| 151 | method: "POST" | 145 | method: "POST" |
| @@ -159,7 +153,6 @@ | @@ -159,7 +153,6 @@ | ||
| 159 | * @param {object} ext [扩展参数] | 153 | * @param {object} ext [扩展参数] |
| 160 | */ | 154 | */ |
| 161 | shopRecommendGoodsCallback(res, ext) { | 155 | shopRecommendGoodsCallback(res, ext) { |
| 162 | - | ||
| 163 | // 加载完成 | 156 | // 加载完成 |
| 164 | Indicator.close(); | 157 | Indicator.close(); |
| 165 | 158 | ||
| @@ -172,26 +165,13 @@ | @@ -172,26 +165,13 @@ | ||
| 172 | /* 设置商品推荐数据 开始 */ | 165 | /* 设置商品推荐数据 开始 */ |
| 173 | 166 | ||
| 174 | // 判断是否有数据 | 167 | // 判断是否有数据 |
| 175 | - if (datas.list && datas.list.length) { | 168 | + if (datas && datas.length) { |
| 176 | 169 | ||
| 177 | // 追加列表 | 170 | // 追加列表 |
| 178 | - this.$set(this.commoditys, "list", [...this.commoditys.list, ...datas.list]); | 171 | + this.$set(this.commoditys, "list", [...this.commoditys.list, ...datas]); |
| 179 | 172 | ||
| 180 | // 设置还有需要加载的内容 | 173 | // 设置还有需要加载的内容 |
| 181 | this.$set(this.paging.commodity, "loading", false); | 174 | this.$set(this.paging.commodity, "loading", false); |
| 182 | - | ||
| 183 | - // 如果当前显示“全部商品”,设置swiper高度 | ||
| 184 | - if (this.activeTabIndex === 2) { | ||
| 185 | - | ||
| 186 | - this.$nextTick(() => { | ||
| 187 | - | ||
| 188 | - setTimeout(() => { | ||
| 189 | - | ||
| 190 | - // 重新设置swiper高度 | ||
| 191 | - this.$set(this.swiperExce, "offsetHeight", this.$refs.commodity.offsetHeight); | ||
| 192 | - }, 500); | ||
| 193 | - }); | ||
| 194 | - } | ||
| 195 | } else { | 175 | } else { |
| 196 | 176 | ||
| 197 | // 没有需要加载的内容,停止上拉加载 | 177 | // 没有需要加载的内容,停止上拉加载 |