|
@@ -18,7 +18,7 @@
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 为你推荐 -->
|
|
<!-- 为你推荐 -->
|
|
|
- <view class="recommend-section">
|
|
|
|
|
|
|
+ <view class="recommend-section" v-if="recommendList.length>0">
|
|
|
<view class="section-title">
|
|
<view class="section-title">
|
|
|
<text class="line"></text>
|
|
<text class="line"></text>
|
|
|
<text class="text">为你推荐</text>
|
|
<text class="text">为你推荐</text>
|
|
@@ -98,14 +98,7 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
],
|
|
],
|
|
|
- recommendList: [
|
|
|
|
|
- { title: '工程数学线性代数第六版', cover: 'https://k.sinaimg.cn/n/sinakd20116/234/w1000h1634/20251003/b66b-587c9ff400fcf01be52c6693594b6a6d.jpg/w700d1q75cms.jpg' },
|
|
|
|
|
- { title: '工程数学线性代数第六版', cover: 'https://k.sinaimg.cn/n/sinakd20116/234/w1000h1634/20251003/b66b-587c9ff400fcf01be52c6693594b6a6d.jpg/w700d1q75cms.jpg' },
|
|
|
|
|
- { title: '工程数学线性代数第六版', cover: 'https://k.sinaimg.cn/n/sinakd20116/234/w1000h1634/20251003/b66b-587c9ff400fcf01be52c6693594b6a6d.jpg/w700d1q75cms.jpg' },
|
|
|
|
|
- { title: '工程数学线性代数第六版', cover: 'https://k.sinaimg.cn/n/sinakd20116/234/w1000h1634/20251003/b66b-587c9ff400fcf01be52c6693594b6a6d.jpg/w700d1q75cms.jpg' },
|
|
|
|
|
- { title: '工程数学线性代数第六版', cover: 'https://k.sinaimg.cn/n/sinakd20116/234/w1000h1634/20251003/b66b-587c9ff400fcf01be52c6693594b6a6d.jpg/w700d1q75cms.jpg' },
|
|
|
|
|
- { title: '工程数学线性代数第六版', cover: 'https://k.sinaimg.cn/n/sinakd20116/234/w1000h1634/20251003/b66b-587c9ff400fcf01be52c6693594b6a6d.jpg/w700d1q75cms.jpg' }
|
|
|
|
|
- ]
|
|
|
|
|
|
|
+ recommendList: []
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
onShow() {
|
|
onShow() {
|
|
@@ -156,13 +149,11 @@
|
|
|
},
|
|
},
|
|
|
loadData() {
|
|
loadData() {
|
|
|
this.loading = true;
|
|
this.loading = true;
|
|
|
|
|
+ // 获取购物车列表
|
|
|
this.$u.api.getShopCartListAjax({}).then(res => {
|
|
this.$u.api.getShopCartListAjax({}).then(res => {
|
|
|
this.loading = false;
|
|
this.loading = false;
|
|
|
// 本地添加选中状态属性
|
|
// 本地添加选中状态属性
|
|
|
const list = res.rows || [];
|
|
const list = res.rows || [];
|
|
|
- // 如果可能,与现有的选中状态合并,或者重置?
|
|
|
|
|
- // 为简单起见,如果 id 匹配,则重置或保持选中状态。
|
|
|
|
|
- // 或者直接初始化 checked=false。
|
|
|
|
|
this.cartList = list.map(item => {
|
|
this.cartList = list.map(item => {
|
|
|
return {
|
|
return {
|
|
|
...item,
|
|
...item,
|
|
@@ -173,6 +164,13 @@
|
|
|
}).catch(() => {
|
|
}).catch(() => {
|
|
|
this.loading = false;
|
|
this.loading = false;
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+ // 获取推荐列表
|
|
|
|
|
+ this.$u.api.getSearchRecommendAjax().then(res => {
|
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
|
+ this.recommendList = res.data || [];
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
handleCheck({ id, checked }) {
|
|
handleCheck({ id, checked }) {
|
|
|
const item = this.cartList.find(i => i.id === id);
|
|
const item = this.cartList.find(i => i.id === id);
|