旅居收藏

parent b1cc3330
......@@ -64,3 +64,10 @@ export function getItinerary(data) {
data,
});
}
// 店铺信息
export function getStoreInformation(data) {
return request({
url: `/sgyrdd/shop/getById?shopId=${data}`,
method: 'GET',
});
}
......@@ -292,9 +292,10 @@
</div>
</scroll-view>
<div class="footer flex-between">
<div class="like">
<wd-icon name="star"></wd-icon>
<p>收藏</p>
<div class="like" @click="getCollectFn">
<wd-icon v-if="shopInfo.isCollect === 0" name="star"></wd-icon>
<wd-icon v-else color="red" name="star-on"></wd-icon>
<p>{{ shopInfo.privateIntFcount || 0 }}</p>
</div>
<button>立即预定</button>
</div>
......@@ -313,7 +314,9 @@ import {
getMealList,
getPriceList,
getItinerary,
getStoreInformation,
} from '@/api/assistingAgriculture/route';
import { getCollect } from '@/api/packageDetail';
const swiperList = ref([
'https://registry.npmmirror.com/wot-design-uni-assets/*/files/redpanda.jpg',
......@@ -338,6 +341,7 @@ const priceList = ref([]);
const viewPriceList = ref([]);
const activePrice = ref({});
const show = ref(false);
const shopIds = ref('');
watch(show, (value) => {
let index = priceList.value.indexOf(activePrice.value);
index = Math.max(1, index);
......@@ -355,9 +359,22 @@ const getPriceListFn = (mealId) => {
viewPriceList.value = res.data.slice(0, 4);
});
};
const shopInfo = ref({});
// 获取店铺信息
const getStoreInformationFn = (id) => {
return new Promise((resolve, reject) => {
getStoreInformation(id).then((res) => {
if (res.code === 0) {
shopInfo.value = res.data.shop;
resolve();
}
});
});
};
// 行程
const itineraryData = ref([]);
onLoad(({ shopId, prodId }) => {
shopIds.value = shopId;
getProd({
prodId,
}).then((res) => {
......@@ -387,7 +404,22 @@ onLoad(({ shopId, prodId }) => {
getItinerary({ prodId }).then((res) => {
itineraryData.value = res.data;
});
// 获取店铺信息
getStoreInformationFn(shopId);
});
function getCollectFn() {
getCollect(shopIds.value).then((res) => {
if (res.code === 0) {
if (shopInfo.value.isCollect === 0) {
shopInfo.value.privateIntFcount++;
shopInfo.value.isCollect = 1;
} else {
shopInfo.value.privateIntFcount--;
shopInfo.value.isCollect = 0;
}
}
});
}
// 返回上一级
function back() {
xma.navigateBack({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment