Commit 526fd2be authored by 彭佳妮(贵阳日报)'s avatar 彭佳妮(贵阳日报)
parents b9199c46 2fbaf903
<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>
......@@ -11,10 +11,12 @@
/>
<input
type="text"
:value="test"
class="text"
:placeholder="placeholderText"
placeholder-style="font-size:16rpx;"
:value="modelValue"
@input="updateModelValue"
@keyup.enter="toSearch"
@focus="toSearch"
/>
</view>
......@@ -33,9 +35,13 @@ const props = defineProps({
type: String,
default: '',
},
modelValue: String,
});
const toSearch = () => {
emit('search');
const updateModelValue = (event) => {
emit('update:modelValue', event.target.value);
};
const toSearch = (test) => {
emit('search', test);
};
// 返回上一级
function back() {
......
import { request } from '../../utils/request';
// 筑农首页-分类查询商品列表
export function queryOfferProdList(data) {
return request({
url: `/sgyrdd/prod/queryOfferProdList`,
method: 'GET',
data,
});
}
<template>
<view class="search" :style="{ background: background }">
<wd-icon name="thin-arrow-left" class="icon" @tap="back" :style="{ color: backIcon }"></wd-icon>
<wd-icon
v-if="show"
name="thin-arrow-left"
class="icon"
@tap="back"
:style="{ color: backIcon }"
></wd-icon>
<slot></slot>
<view class="searchBox">
<image
......@@ -25,6 +31,10 @@ const props = defineProps({
type: String,
default: 'white',
},
show: {
type: Boolean,
default: true,
},
});
const emit = defineEmits(['toSearch']);
const title = ref('小程序平台');
......
......@@ -152,7 +152,9 @@
"path": "pages/assistingAgriculture/RuralTravel/specialOfferZoneList",
"style": {
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#ffffff"
"navigationBarBackgroundColor": "#ffffff",
"enablePullDownRefresh": true,
"onReachBottomDistance": 50
}
},
{
......@@ -227,7 +229,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,24 +428,24 @@ 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;
groupBuyUpdate({
key: orderInfo.value.key,
couponUserId,
receiverTime: formatDate(activePrice.value.priceDay),
}).then((res) => {
if (res.code === 0) {
orderInfo.value = res.data;
}
return new Promise((resolve, reject) => {
groupBuyUpdate({
key: orderInfo.value.key,
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({
......
......@@ -7,6 +7,8 @@
backIcon="black"
iconSrc="/static/assistingAgriculture/assets/left.png"
placeholderText="请输入要搜索的关键词"
@search="toSearch"
v-model="keyword"
></Search>
</view>
<view class="bac-img">
......@@ -189,6 +191,7 @@ const startCity = ref(null);
const dateType = ref(null);
const allocateDate = ref(null);
const serviceCommitment = ref(null);
const keyword = ref('');
const labelId = ref(null);
const locationFiltering = (index) => {
switch (index) {
......@@ -227,8 +230,8 @@ const locationFiltering = (index) => {
}
};
onPullDownRefresh(() => {
keyword.value = '';
getProd();
getPopular();
setTimeout(() => {
uni.stopPullDownRefresh();
}, 1000);
......@@ -278,8 +281,14 @@ const screenParams = (item, type) => {
getProd();
}
};
// 搜索
const toSearch = (data) => {
keyword.value = data.detail.value;
getProd(keyword.value);
};
// 查询列表
const getProd = () => {
const getProd = (searchKeyword = '') => {
const params = {
current: 1,
size: 10,
......@@ -290,6 +299,7 @@ const getProd = () => {
...(serviceCommitment.value !== null && { serviceCommitment: serviceCommitment.value }),
...(labelId.value !== null && { labelId: labelId.value }),
...(dateType.value === 8 && { allocateDate: allocateDate.value }),
...(searchKeyword && { keyword: searchKeyword }),
};
getProdList(params).then((res) => {
res.data.records.forEach((item) => {
......
<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,84 +68,196 @@
></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">红枫湖+青岩古镇+云漫湖+云顶高坡景区一日游</text>
<text class="subtitle">赠价值59元特产伴手礼一份</text>
<text class="title multi-line">{{ item.prodName }}</text>
<!-- <text class="subtitle">{{ item.brief }}</text> -->
<text class="subtitle"></text>
<view class="tag-list">
<!-- <text class="tag">可定明日</text>
<text class="tag">可定明日</text>
<text class="tag">可定明日</text>
<text class="tag">可定明日</text>
<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" v-if="item.score">{{ item.score }}分</text>
<text style="margin-left: 20rpx" class="sales-volume">
月销{{ item.monthSoldNum }}
</text>
</view>
<text class="address">云岩出发</text>
<text class="address">{{ item.tripArea }}出发</text>
</view>
<text class="price">¥299.00</text>
<text class="price">¥{{ item.price }}</text>
</view>
</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,
});
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 = (info) => {
params.value.attractionIdList = [info.id];
refresh().then(() => {
queryOfferProdListFn();
});
}; // 筛选
const screenParams = (item, type) => {
if (type === 'screen') {
params.value.startCityList = [item.tripCity];
} else if (type === 'serve') {
params.value.serviceList = [item.labelName];
} else if (type === 'people') {
params.value.forPeopleList = [item.labelName];
}
refresh().then(() => {
queryOfferProdListFn();
});
};
const resetParams = () => {
params.value = {
size: 15,
current: 1,
isEnd: false,
};
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 +269,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;
......@@ -272,6 +441,7 @@ page {
font-weight: bold;
/* 主题色 */
color: #fa5151;
margin-left: auto;
align-self: flex-end;
}
}
......
......@@ -2,7 +2,12 @@
<view class="container">
<view class="top">
<!-- 搜索 -->
<Search background="rgba(255, 255, 255, 0.8)" backIcon="black" @toSearch="toSearch">
<Search
background="rgba(255, 255, 255, 0.8)"
backIcon="black"
@toSearch="toSearch"
:show="false"
>
<image class="food" src="../../static/index/food.png" mode="widthFix" />
</Search>
<!-- 类别选择 -->
......
......@@ -9,10 +9,26 @@ import testJson from '../../static/json/test.json';
import { getTokenUser } from '../../api/index';
import { getToken } from '../../utils/auth';
onMounted(async () => {
onLoad(async (options) => {
// await signIn();
if (!getToken()) await signIn2();
xma.reLaunch({ url: '/pages/index/index' });
const { type } = options;
switch (type) {
case '0':
xma.reLaunch({ url: '/pages/assistingAgriculture/index/index' });
break;
case '1':
xma.reLaunch({ url: '/pages/index/index' });
break;
case '2':
xma.reLaunch({ url: '/pages/assistingAgriculture/index/building?categoryId=3266' });
break;
case '3':
xma.reLaunch({ url: '/pages/assistingAgriculture/RuralTravel/RuralTravel?categoryId=3268' });
}
});
onMounted(async () => {
// xma.reLaunch({ url: '/pages/index/index' });
});
// 登录
......
......@@ -253,8 +253,7 @@ const cardBackwardNull = ref(false);
const qualificationsNull = ref(false);
// 用户选择的分类
const choosedShopInfo = ref([]);
// 临时创建的用户选择分类
const tempChoosedData = ref([]);
// 确保choosedShopInfo内是用户最新选择的分类
const chooseShopType = (id, name) => {
let hasSameData = false;
......@@ -265,7 +264,6 @@ const chooseShopType = (id, name) => {
});
if (!hasSameData) {
choosedShopInfo.value.push({ areaId: id, areaName: name, qualifications: '' });
tempChoosedData.value.push(id);
} else {
choosedShopInfo.value = choosedShopInfo.value.filter((item) => {
return item.areaId !== id;
......@@ -277,7 +275,7 @@ const chooseShopType = (id, name) => {
const beforeRemove = ({ file, fileList, resolve }) => {
xma.showModal({
title: '提示',
content: '确定删除图片' + file.name + '吗',
content: '确定删除图片吗?',
success: function (res) {
if (res.confirm) {
xma.showToast({ title: '删除成功', duration: 2000 });
......@@ -489,6 +487,18 @@ const show = ref(false);
// 关闭店铺分类弹出层
const handleClose = () => {
show.value = false;
setTimeout(() => {
testFileList.value = choosedShopInfo.value.reduce((obj, item) => {
if (item.qualifications === '') {
obj[item.areaId] = [];
} else {
obj[item.areaId] = [{ url: fileDomain + item.qualifications }];
}
return obj;
}, {});
}, 1000);
};
// 原添加的店铺分类个数
const originChooseCategoryLength = 0;
......
......@@ -72,7 +72,7 @@ const getList = async () => {
};
const shopGto = (item) => {
xma.navigateTo({
url: `/pages/storeEntry/detail${item ? `?content=${JSON.stringify(item)}` : ''}`,
url: `/pages/storeEntry/detail${item ? `?content=${item}` : ''}`,
success: function (res) {
// 通过eventChannel向被打开页面传送数据
res.eventChannel.emit('acceptDataFromOpenerPage', { data: item });
......
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