旅居收藏

parent b1cc3330
...@@ -64,3 +64,10 @@ export function getItinerary(data) { ...@@ -64,3 +64,10 @@ export function getItinerary(data) {
data, data,
}); });
} }
// 店铺信息
export function getStoreInformation(data) {
return request({
url: `/sgyrdd/shop/getById?shopId=${data}`,
method: 'GET',
});
}
...@@ -292,9 +292,10 @@ ...@@ -292,9 +292,10 @@
</div> </div>
</scroll-view> </scroll-view>
<div class="footer flex-between"> <div class="footer flex-between">
<div class="like"> <div class="like" @click="getCollectFn">
<wd-icon name="star"></wd-icon> <wd-icon v-if="shopInfo.isCollect === 0" name="star"></wd-icon>
<p>收藏</p> <wd-icon v-else color="red" name="star-on"></wd-icon>
<p>{{ shopInfo.privateIntFcount || 0 }}</p>
</div> </div>
<button>立即预定</button> <button>立即预定</button>
</div> </div>
...@@ -313,7 +314,9 @@ import { ...@@ -313,7 +314,9 @@ import {
getMealList, getMealList,
getPriceList, getPriceList,
getItinerary, getItinerary,
getStoreInformation,
} from '@/api/assistingAgriculture/route'; } from '@/api/assistingAgriculture/route';
import { getCollect } from '@/api/packageDetail';
const swiperList = ref([ const swiperList = ref([
'https://registry.npmmirror.com/wot-design-uni-assets/*/files/redpanda.jpg', 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/redpanda.jpg',
...@@ -338,6 +341,7 @@ const priceList = ref([]); ...@@ -338,6 +341,7 @@ const priceList = ref([]);
const viewPriceList = ref([]); const viewPriceList = ref([]);
const activePrice = ref({}); const activePrice = ref({});
const show = ref(false); const show = ref(false);
const shopIds = ref('');
watch(show, (value) => { watch(show, (value) => {
let index = priceList.value.indexOf(activePrice.value); let index = priceList.value.indexOf(activePrice.value);
index = Math.max(1, index); index = Math.max(1, index);
...@@ -355,9 +359,22 @@ const getPriceListFn = (mealId) => { ...@@ -355,9 +359,22 @@ const getPriceListFn = (mealId) => {
viewPriceList.value = res.data.slice(0, 4); 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([]); const itineraryData = ref([]);
onLoad(({ shopId, prodId }) => { onLoad(({ shopId, prodId }) => {
shopIds.value = shopId;
getProd({ getProd({
prodId, prodId,
}).then((res) => { }).then((res) => {
...@@ -387,7 +404,22 @@ onLoad(({ shopId, prodId }) => { ...@@ -387,7 +404,22 @@ onLoad(({ shopId, prodId }) => {
getItinerary({ prodId }).then((res) => { getItinerary({ prodId }).then((res) => {
itineraryData.value = res.data; 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() { function back() {
xma.navigateBack({ 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