1

parent 58154767
<template>
<view class="sort" :style="{ width: width }">
<view class="date">出发日期</view>
<ul class="ul">
<li
v-for="(item, index) in dataList"
:key="index"
:class="{ active: selectedItem === index }"
@tap="selectItem(index, item)"
>
{{ item.startDate }}
</li>
<wd-calendar use-default-slot v-model="value" @confirm="handleConfirm">
<li>选择日期</li>
</wd-calendar>
</ul>
</view>
</template>
<script setup>
import { defineProps, onMounted, ref } from 'vue';
import { getStartDate } from '@/api/assistingAgriculture/village';
const selectedItem = ref(null);
const emit = defineEmits(['dataParams']);
const dataList = ref([]);
const value = ref('');
const formatValue = ref('');
const params = {
current: 1,
size: 10,
};
const props = defineProps({
width: {
type: String,
default: '100%',
},
});
onMounted(async () => {
getStartDateList();
});
const selectItem = (index, item) => {
console.log(item, 323);
const datePart = timestampToDateBasic(value.value);
selectedItem.value = index;
emit('dataParams', item, datePart);
console.log(datePart, 'datePart');
};
const getStartDateList = () => {
getStartDate(params).then((res) => {
dataList.value = res.data;
});
};
function handleConfirm({ value }) {
const datePart = timestampToDateBasic(value);
emit('dataParams', null, datePart);
}
function timestampToDateBasic(timestamp) {
const date = new Date(timestamp);
const year = date.getFullYear();
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
return `${year}/${month}/${day}`;
}
</script>
<style lang="scss" scoped>
.sort {
width: 710rpx;
height: 192rpx;
position: absolute;
top: 100%;
// width: 100%;
// min-height: 212rpx;
border-radius: 0rpx 0rpx 16rpx 16rpx;
background: #ffffff;
box-shadow: 0rpx 16rpx 16rpx 0rpx rgba(73, 73, 73, 0.14);
margin: 0 auto;
z-index: 99;
// display: flex;
padding-bottom: 20rpx;
box-sizing: border-box;
overflow: auto;
.date {
width: 96rpx;
height: 28rpx;
font-family: Source Han Sans;
font-size: 24rpx;
font-weight: normal;
line-height: 28rpx;
letter-spacing: 0em;
font-variation-settings: 'opsz' auto;
font-feature-settings: 'kern' on;
color: #fa5151;
margin-left: 44rpx;
margin-top: 20rpx;
}
.ul {
padding-left: 20rpx;
display: flex;
flex-flow: wrap;
li {
width: 154rpx;
height: 20rpx;
border-radius: 8rpx;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 6rpx 26rpx;
margin-left: 20rpx;
background: #f3f3f3;
font-size: 24rpx;
line-height: 20rpx;
text-align: center;
list-style-type: none;
margin-top: 20rpx;
}
.active {
color: #fa5151;
background: #feeeee;
}
}
}
</style>
import { request } from '../../utils/request';
// 筑农首页-分类查询商品列表
export function queryOfferProdList(data) {
return request({
url: `/sgyrdd/prod/queryOfferProdList`,
method: 'GET',
data,
});
}
......@@ -152,7 +152,9 @@
"path": "pages/assistingAgriculture/RuralTravel/specialOfferZoneList",
"style": {
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#ffffff"
"navigationBarBackgroundColor": "#ffffff",
"enablePullDownRefresh": true,
"onReachBottomDistance": 50
}
},
{
......@@ -226,7 +228,6 @@
"navigationBarTitleText": "景点详情",
"navigationBarBackgroundColor": "#ffffff",
"navigationStyle":"",
"enablePullDownRefresh": true,
"onReachBottomDistance": 50
}
},
......
......@@ -212,6 +212,7 @@
<ul>
<li>
{{ activeMeal.mealScenery }}
<text @click="jumpPage" style="color: #0974f5">详情</text>
</li>
<!-- <li>
4个景点,约7小时
......@@ -343,6 +344,7 @@ const photoList = ref([]);
// 套餐列表
const mealList = ref([]);
const activeMeal = ref(null);
const orderInfo = ref({});
const onActiveMeal = (item) => {
activeMeal.value = item;
getPriceListFn(item.mealId);
......@@ -353,6 +355,7 @@ const viewPriceList = ref([]);
const activePrice = ref(null);
const show = ref(false);
const shopIds = ref('');
const prodIds = ref('');
watch(show, (value) => {
let index = priceList.value.indexOf(activePrice.value);
index = Math.max(1, index);
......@@ -370,7 +373,13 @@ const getPriceListFn = (mealId) => {
viewPriceList.value = res.data.slice(0, 4);
});
};
function jumpPage() {
xma.navigateTo({
url:
'/pages/assistingAgriculture/reviewDetails/scenicSpotDetails?prodId=' +
activeMeal.value.prodId,
});
}
function groupBuyConfirmFn(prodId, skuId) {
return new Promise((resolve, reject) => {
groupBuyConfirm({ prodId, skuId }).then((res) => {
......@@ -407,8 +416,8 @@ function formatDate(inputDate) {
return `${year}-${monthDay}`;
}
const payNow = async (data) => {
groupBuyConfirmFn(prodIds.value, skuIds.value).then((res) => {
groupBuyUpdateFnQg();
groupBuyConfirmFn(activeMeal.value.prodId, activeMeal.value.skuId).then((res) => {
groupBuyUpdateFnQg().then(() => {});
});
params.value.id = orderInfo.value.key;
params.value.tradeType = data.selectType;
......@@ -419,25 +428,25 @@ const payNow = async (data) => {
payWayCode: 5,
tradeType: data.selectType,
};
groupBuyCreate(qgParams).then((res) => {
if (res.code === 0) {
openUrl(res.data.result);
} else {
groupBuyConfirmFn(prodIds.value, skuIds.value);
}
});
// groupBuyCreate(qgParams).then((res) => {
// if (res.code === 0) {
// openUrl(res.data.result);
// } else {
// groupBuyConfirmFn(prodIds.value, skuIds.value);
// }
// });
};
function groupBuyUpdateFnQg(couponUserId = '') {
const { receiverName, receiverMobile, receiverAddress } = addressParams.value;
return new Promise((resolve, reject) => {
groupBuyUpdate({
key: orderInfo.value.key,
couponUserId,
receiverTime: formatDate(activePrice.value.priceDay),
}).then((res) => {
if (res.code === 0) {
orderInfo.value = res.data;
}
});
});
}
const shopInfo = ref({});
// 获取店铺信息
......@@ -457,6 +466,7 @@ const itineraryData = ref([]);
prodId:43835 */
onLoad(({ shopId, prodId }) => {
shopIds.value = shopId;
prodIds.value = prodId;
// const shopId = 1821388624367861761n;
// const prodId = 43835;
getProd({
......
<template>
<view class="special-offer-zone-list-page">
<view class="search">
<wd-icon color="#fff" name="thin-arrow-left" class="icon" @tap="back"></wd-icon>
</view>
<view class="swiper">
<wd-swiper
customClass="swiper-custom"
......@@ -65,16 +68,42 @@
></wd-icon>
</view>
</view>
<Sort v-show="rotate" />
<DepartureDate v-show="rotate2" />
<ScenicSpots v-show="rotate3" />
<Screen v-show="rotate4" />
<view class="bootom-top">
<view class="option" @tap="resetParams">
<text>清空</text>
<wd-icon size="24rpx" class="icons"></wd-icon>
</view>
</view>
<Sort v-show="rotate" @sortParams="sortParams" />
<DepartureDate v-show="rotate2" @dataParams="dataParams" />
<ScenicSpots v-show="rotate3" @placeParams="placeParams" />
<Screen v-show="rotate4" @screenParams="screenParams" />
</view>
<view class="list">
<view class="item" v-for="i in 10" :key="i">
<image mode="aspectFill" src="@/static/assistingAgriculture/reviewDetails/fj.png"></image>
<view @click="jumpPage(item)" class="item" v-for="(item, index) in cardData" :key="index">
<image mode="aspectFill" :src="imgUrl + item.pic"></image>
<view class="info">
<text class="title multi-line">{{ item.prodName }}</text>
<text class="subtitle">赠价值59元特产伴手礼一份</text>
<view class="tag-list">
<text class="tag">可定明日</text>
<text class="tag">可定明日</text>
<text class="tag">可定明日</text>
</view>
<view class="fs-box">
<text class="fs-num">{{ item.score }}分</text>
<text style="margin-left: 20rpx" class="sales-volume">
月销{{ item.monthSoldNum }}
</text>
</view>
<text class="address">{{ item.tripArea }}出发</text>
</view>
<text class="price">¥{{ item.price }}</text>
</view>
<view class="item" v-for="(item, index) in cardData" :key="index">
<image mode="aspectFill" :src="imgUrl + item.pic"></image>
<view class="info">
<text class="title multi-line">红枫湖+青岩古镇+云漫湖+云顶高坡景区一日游</text>
<text class="title multi-line">{{ item.prodName }}</text>
<text class="subtitle">赠价值59元特产伴手礼一份</text>
<view class="tag-list">
<text class="tag">可定明日</text>
......@@ -82,67 +111,181 @@
<text class="tag">可定明日</text>
</view>
<view class="fs-box">
<text class="fs-num">4.9分</text>
<text style="margin-left: 20rpx" class="sales-volume">月销2000+</text>
<text class="fs-num">{{ item.score }}分</text>
<text style="margin-left: 20rpx" class="sales-volume">
月销{{ item.monthSoldNum }}
</text>
</view>
<text class="address">{{ item.tripArea }}出发</text>
</view>
<text class="address">云岩出发</text>
<text class="price">¥{{ item.price }}</text>
</view>
<text class="price">¥299.00</text>
</view>
<view
style="width: 100%; text-align: center; font-size: 24rpx; margin-top: 10rpx; color: #888989"
v-if="params.isEnd"
>
没有更多啦~
</view>
</view>
</view>
</template>
<script setup>
import { queryOfferProdList } from '@/api/assistingAgriculture/specialOfferZoneList';
import Sort from '../../../components/assistingAgriculture/index/Sort.vue';
import DepartureDate from '../../../components/assistingAgriculture/index/DepartureDate.vue';
import DepartureDate from '../../../components/assistingAgriculture/index/Date.vue';
import ScenicSpots from '../../../components/assistingAgriculture/index/ScenicSpots.vue';
import Screen from '../../../components/assistingAgriculture/index/Screen.vue';
const rotate = ref(false);
const imgUrl = import.meta.env.VITE_APP_IMG_URL;
const rotate2 = ref(false);
const rotate3 = ref(false);
const rotate4 = ref(false);
const current = ref(0);
const isLoadReachBottom = ref(null);
const params = ref({
current: 1,
size: 15,
isEnd: false,
sortType: '',
dateType: '', // 日期
allocateDate: '',
attractionId: '',
startCity: '',
serviceCommitment: '',
labelId: '',
});
const shopSwiperList = ref([
'https://registry.npmmirror.com/wot-design-uni-assets/*/files/redpanda.jpg',
'https://registry.npmmirror.com/wot-design-uni-assets/*/files/capybara.jpg',
'https://registry.npmmirror.com/wot-design-uni-assets/*/files/panda.jpg',
]);
const locationFiltering = (index) => {
switch (index) {
case 0:
rotate.value = !rotate.value;
rotate2.value = false;
rotate3.value = false;
rotate4.value = false;
break;
case 1:
rotate2.value = !rotate2.value;
rotate.value = false;
rotate3.value = false;
rotate4.value = false;
break;
case 2:
rotate3.value = !rotate3.value;
rotate.value = false;
rotate2.value = false;
rotate4.value = false;
break;
case 3:
rotate4.value = !rotate4.value;
rotate.value = false;
rotate2.value = false;
rotate3.value = false;
break;
}
const rotates = [rotate, rotate2, rotate3, rotate4];
rotates.forEach((rotate, i) => {
rotate.value = i === index ? !rotate.value : false;
});
};
onMounted(() => {
queryOfferProdListFn();
});
function handleClick(e) {
console.log(e);
}
function jumpPage(item) {
xma.navigateTo({
url: `/pages/assistingAgriculture/RouteDetails/RouteDetails?prodId=${item.prodId}&shopId=${item.shopId}`,
});
}
function onChange(e) {
console.log(e);
}
// 智能排序
const sortParams = (sortMode) => {
params.value.sortType = sortMode.sortMode;
refresh().then(() => {
queryOfferProdListFn();
});
};
// 出发日期
const dataParams = (item, datePart) => {
if (item) {
params.value.dateType = item.key;
refresh().then(() => {
queryOfferProdListFn();
});
} else {
params.value.dateType = 8;
if (datePart && datePart !== 'NaN/NaN/NaN') {
params.value.allocateDate = datePart;
rotate2.value = false;
refresh().then(() => {
queryOfferProdListFn();
});
}
}
};
// 景点
const placeParams = (id) => {
params.value.attractionId = id;
refresh().then(() => {
queryOfferProdListFn();
});
}; // 筛选
const screenParams = (item, type) => {
if (type === 'screen') {
params.value.startCity = item.tripCity;
} else if (type === 'serve') {
params.value.serviceCommitment = item.labelName;
} else if (type === 'people') {
params.value.labelId = item.labelName;
}
refresh().then(() => {
queryOfferProdListFn();
});
};
const resetParams = () => {
params.value.sortType = null;
params.value.attractionId = null;
params.value.dateType = null;
params.value.startCity = null;
params.value.serviceCommitment = null;
params.value.labelId = null;
params.value.allocateDate = null;
refresh().then(() => {
queryOfferProdListFn();
});
};
/**
* @description: 刷新
*/
function refresh() {
return new Promise((resolve, reject) => {
cardData.value = [];
params.value.current = 1;
params.value.isEnd = false;
resolve();
});
}
onPullDownRefresh(() => {
refresh().then(() => {
queryOfferProdListFn();
});
});
function back() {
xma.navigateBack({
delta: 1,
});
}
const cardData = ref([]);
onReachBottom(() => {
if (isLoadReachBottom.value === true) return;
isLoadReachBottom.value = true;
queryOfferProdListFn().then(() => {
isLoadReachBottom.value = false;
});
});
function queryOfferProdListFn() {
if (params.value.isEnd === true)
return new Promise((resolve) => {
resolve();
});
xma.showLoading({
title: '加载中...',
mask: false,
});
return queryOfferProdList(params.value).then((res) => {
if (res.data.records.length < params.value.size) {
params.value.isEnd = true;
}
params.value.current += 1;
cardData.value = cardData.value.concat(res.data.records);
xma.stopPullDownRefresh();
xma.hideLoading();
});
}
</script>
<style lang="scss" scoped>
......@@ -154,6 +297,60 @@ page {
flex-direction: column;
align-items: center;
width: 750rpx;
.search {
width: 710rpx;
height: 80rpx;
// background: rgba(255, 255, 255, 0.8);
border-radius: 16rpx 16rpx 16rpx 16rpx;
opacity: 0.8;
margin: 0 auto;
margin-top: 44rpx;
display: flex;
align-items: center;
padding-left: 20rpx;
box-sizing: border-box;
position: absolute;
top: 0;
z-index: 99;
.arrow {
width: 15rpx;
height: 24rpx;
}
.icon {
font-size: 28rpx;
}
.searchBox {
width: 129 * 2rpx;
height: 26 * 2rpx;
background: rgba(243, 243, 243, 0.4);
border-radius: 28rpx 28rpx 28rpx 28rpx;
display: flex;
align-items: center;
padding-left: 20rpx;
margin-left: 20rpx;
.magnifyingGlass {
width: 26rpx;
height: 26rpx;
}
.text {
margin-left: 10rpx;
font-size: 24rpx;
}
}
.icon-box {
display: flex;
align-content: center;
margin-left: 86rpx;
.icon {
font-size: 40rpx;
color: #fff;
}
.icon-fenxiang {
margin-left: 20rpx;
}
}
}
.custom-indicator {
padding: 0 12rpx;
height: 48rpx;
......
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