Commit a8b43f6e authored by 石建新(贵阳日报)'s avatar 石建新(贵阳日报)
parents 57778c10 6373dea3
...@@ -64,6 +64,10 @@ function timestampToDateBasic(timestamp) { ...@@ -64,6 +64,10 @@ function timestampToDateBasic(timestamp) {
const day = date.getDate().toString().padStart(2, '0'); const day = date.getDate().toString().padStart(2, '0');
return `${year}/${month}/${day}`; return `${year}/${month}/${day}`;
} }
const reset = () => {
selectedItem.value = null;
};
defineExpose({ reset });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
<li <li
v-for="(item, index) in placeList" v-for="(item, index) in placeList"
:key="index" :key="index"
:class="{ active: selectedItem === index }" :class="{ active: selectedItem.includes(index) }"
@tap="selectItem(index, item)" @click="selectItem(index, item)"
> >
{{ item.attractionName }} {{ item.attractionName }}
</li> </li>
...@@ -14,30 +14,46 @@ ...@@ -14,30 +14,46 @@
</template> </template>
<script setup> <script setup>
import { defineProps, onMounted } from 'vue'; import { ref, defineProps, defineEmits, onMounted } from 'vue';
import { getTour } from '@/api/assistingAgriculture/village'; import { getTour } from '@/api/assistingAgriculture/village';
const placeList = ref([]); const placeList = ref([]);
const emit = defineEmits(['placeParams']); const emit = defineEmits(['placeParams']);
const selectedItem = ref(null); const selectedItem = ref([]);
const props = defineProps({ const props = defineProps({
width: { width: {
type: String, type: String,
default: '100%', default: '100%',
}, },
}); });
onMounted(async () => { onMounted(async () => {
getTourList(); getTourList();
}); });
const selectItem = (index, item) => { const selectItem = (index, item) => {
selectedItem.value = index; const itemIndex = selectedItem.value.indexOf(index);
emit('placeParams', item); if (itemIndex === -1) {
selectedItem.value.push(index);
} else {
selectedItem.value.splice(itemIndex, 1);
}
emit(
'placeParams',
placeList.value.filter((_, i) => selectedItem.value.includes(i)),
);
}; };
// 查询景点
const getTourList = () => { const getTourList = () => {
getTour().then((res) => { getTour().then((res) => {
placeList.value = res.data; placeList.value = res.data;
}); });
}; };
const reset = () => {
selectedItem.value = [];
};
defineExpose({ reset });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<li <li
v-for="(item, index) in screenList" v-for="(item, index) in screenList"
:key="index" :key="index"
:class="{ active: selectedItem === index }" :class="{ active: selectedItem.includes(index) }"
@tap="selectItem(index, item, 'screen')" @tap="selectItem(index, item, 'screen')"
> >
{{ item.tripCity }} {{ item.tripCity }}
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<li <li
v-for="(item, index) in serveList" v-for="(item, index) in serveList"
:key="index" :key="index"
:class="{ active: selectedItem1 === index }" :class="{ active: selectedItem1.includes(index) }"
@tap="selectItem(index, item, 'serve')" @tap="selectItem(index, item, 'serve')"
> >
{{ item.labelName }} {{ item.labelName }}
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<li <li
v-for="(item, index) in peopleList" v-for="(item, index) in peopleList"
:key="index" :key="index"
:class="{ active: selectedItem2 === index }" :class="{ active: selectedItem2.includes(index) }"
@tap="selectItem(index, item, 'people')" @tap="selectItem(index, item, 'people')"
> >
{{ item.labelName }} {{ item.labelName }}
...@@ -40,9 +40,9 @@ ...@@ -40,9 +40,9 @@
import { defineProps, onMounted, ref } from 'vue'; import { defineProps, onMounted, ref } from 'vue';
import { screeningConditions } from '@/api/assistingAgriculture/village'; import { screeningConditions } from '@/api/assistingAgriculture/village';
const emit = defineEmits(['screenParams']); const emit = defineEmits(['screenParams']);
const selectedItem = ref(null); const selectedItem = ref([]);
const selectedItem1 = ref(null); const selectedItem1 = ref([]);
const selectedItem2 = ref(null); const selectedItem2 = ref([]);
const screenList = ref([]); const screenList = ref([]);
const serveList = ref([]); const serveList = ref([]);
const peopleList = ref([]); const peopleList = ref([]);
...@@ -56,16 +56,32 @@ onMounted(async () => { ...@@ -56,16 +56,32 @@ onMounted(async () => {
getScreeningConditions(); getScreeningConditions();
}); });
const selectItem = (index, item, type) => { const selectItem = (index, item, type) => {
let selectedRef, itemList;
if (type === 'screen') { if (type === 'screen') {
selectedItem.value = index; selectedRef = selectedItem;
itemList = screenList.value;
} else if (type === 'serve') { } else if (type === 'serve') {
selectedItem1.value = index; selectedRef = selectedItem1;
itemList = serveList.value;
} else if (type === 'people') { } else if (type === 'people') {
selectedItem2.value = index; selectedRef = selectedItem2;
itemList = peopleList.value;
} }
emit('screenParams', item, type);
const position = selectedRef.value.indexOf(index);
if (position > -1) {
selectedRef.value.splice(position, 1);
} else {
selectedRef.value.push(index);
}
// 使用map创建一个新数组,从itemList中根据索引获取正确的item
emit(
'screenParams',
selectedRef.value.map((i) => ({ ...itemList[i], index: i })),
type,
);
}; };
// 查询出发日期
const getScreeningConditions = () => { const getScreeningConditions = () => {
screeningConditions().then((res) => { screeningConditions().then((res) => {
screenList.value = res.data.startCityList; screenList.value = res.data.startCityList;
...@@ -73,6 +89,12 @@ const getScreeningConditions = () => { ...@@ -73,6 +89,12 @@ const getScreeningConditions = () => {
peopleList.value = res.data.forPeopleList; peopleList.value = res.data.forPeopleList;
}); });
}; };
const reset = () => {
selectedItem.value = [];
selectedItem1.value = [];
selectedItem2.value = [];
};
defineExpose({ reset });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -34,6 +34,10 @@ const selectItem = (index, item) => { ...@@ -34,6 +34,10 @@ const selectItem = (index, item) => {
selectedItem.value = index; selectedItem.value = index;
emit('sortParams', item); emit('sortParams', item);
}; };
const reset = () => {
selectedItem.value = null;
};
defineExpose({ reset });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -20,7 +20,7 @@ export function getPopularList(data) { ...@@ -20,7 +20,7 @@ export function getPopularList(data) {
export function getProdList(data) { export function getProdList(data) {
return request({ return request({
url: `/sgyrdd/prod/prodList`, url: `/sgyrdd/prod/prodList`,
method: 'GET', method: 'POST',
data, data,
}); });
} }
......
...@@ -124,10 +124,10 @@ ...@@ -124,10 +124,10 @@
<wd-icon size="24rpx" class="icons"></wd-icon> <wd-icon size="24rpx" class="icons"></wd-icon>
</view> </view>
</view> </view>
<Sort v-show="rotate" @sortParams="sortParams" /> <Sort v-show="rotate" ref="sortRef" @sortParams="sortParams" />
<DepartureDate v-show="rotate2" @dataParams="dataParams" /> <DepartureDate v-show="rotate2" ref="departureDateRef" @dataParams="dataParams" />
<ScenicSpots v-show="rotate3" @placeParams="placeParams" /> <ScenicSpots v-show="rotate3" ref="scenicSpotsRef" @placeParams="placeParams" />
<Screen v-show="rotate4" @screenParams="screenParams" /> <Screen v-show="rotate4" ref="screenRef" @screenParams="screenParams" />
</view> </view>
<view class="list-card"> <view class="list-card">
<view <view
...@@ -186,13 +186,17 @@ const rotate4 = ref(false); ...@@ -186,13 +186,17 @@ const rotate4 = ref(false);
const cardList = ref([]); const cardList = ref([]);
const popularRouterData = ref([]); const popularRouterData = ref([]);
const sortType = ref(null); const sortType = ref(null);
const attractionId = ref(null); const attractionIdList = ref([]);
const startCity = ref(null); const startCityList = ref([]);
const dateType = ref(null); const dateType = ref(null);
const allocateDate = ref(null); const allocateDate = ref(null);
const serviceCommitment = ref(null); const serviceList = ref([]);
const keyword = ref(''); const keyword = ref('');
const labelId = ref(null); const forPeopleList = ref([]);
const sortRef = ref(null);
const departureDateRef = ref(null);
const scenicSpotsRef = ref(null);
const screenRef = ref(null);
const locationFiltering = (index) => { const locationFiltering = (index) => {
switch (index) { switch (index) {
case 0: case 0:
...@@ -222,11 +226,11 @@ const locationFiltering = (index) => { ...@@ -222,11 +226,11 @@ const locationFiltering = (index) => {
} }
if (index === 0) { if (index === 0) {
sortType.value = null; sortType.value = null;
attractionId.value = null; attractionIdList.value = [];
dateType.value = null; dateType.value = null;
startCity.value = null; startCityList.value = [];
serviceCommitment.value = null; serviceList.value = [];
labelId.value = null; forPeopleList.value = [];
} }
}; };
onPullDownRefresh(() => { onPullDownRefresh(() => {
...@@ -256,28 +260,41 @@ const dataParams = (item, datePart) => { ...@@ -256,28 +260,41 @@ const dataParams = (item, datePart) => {
dateType.value = item.key; dateType.value = item.key;
getProd(); getProd();
} else if (item === undefined) { } else if (item === undefined) {
console.log(item, 3333333);
dateType.value = 8; dateType.value = 8;
allocateDate.value = datePart; allocateDate.value = datePart;
getProd(); getProd();
} }
}; };
// 景点 // 景点
const placeParams = (id) => { // const placeParams = (item) => {
attractionId.value = id; // console.log(item, 222);
// attractionIdList.value = item.id;
// getProd();
// };
const placeParams = (item) => {
const ids = item.map((i) => i.id);
const arr = ids.join(',');
attractionIdList.value = arr.split(',').map(Number);
getProd(); getProd();
}; };
// 筛选 // 筛选
const screenParams = (item, type) => { const screenParams = (selectedItems, type) => {
console.log(item, type, 111); console.log(selectedItems, type, 111);
if (type === 'screen') { if (type === 'screen') {
startCity.value = item.tripCity; const ids = selectedItems.map((i) => i.tripCity);
const arr = ids.join(',');
startCityList.value = arr.split(',').map(String);
getProd(); getProd();
} else if (type === 'serve') { } else if (type === 'serve') {
serviceCommitment.value = item.labelName; const ids = selectedItems.map((i) => i.labelName);
const arr = ids.join(',');
serviceList.value = arr.split(',').map(String);
getProd(); getProd();
} else if (type === 'people') { } else if (type === 'people') {
labelId.value = item.labelName; const ids = selectedItems.map((i) => i.labelName);
const arr = ids.join(',');
forPeopleList.value = arr.split(',').map(String);
getProd(); getProd();
} }
}; };
...@@ -292,12 +309,20 @@ const getProd = (searchKeyword = '') => { ...@@ -292,12 +309,20 @@ const getProd = (searchKeyword = '') => {
const params = { const params = {
current: 1, current: 1,
size: 10, size: 10,
...(sortType.value !== null && { sortType: sortType.value.sortMode }), ...(sortType.value && { sortType: sortType.value.sortMode }),
...(attractionId.value !== null && { attractionId: attractionId.value.id }), ...(attractionIdList.value &&
...(dateType.value !== null && { dateType: dateType.value }), attractionIdList.value.length > 0 &&
...(startCity.value !== null && { startCity: startCity.value }), attractionIdList.value[0] !== 0 && { attractionIdList: attractionIdList.value }),
...(serviceCommitment.value !== null && { serviceCommitment: serviceCommitment.value }), ...(dateType.value && { dateType: dateType.value }),
...(labelId.value !== null && { labelId: labelId.value }), ...(startCityList.value &&
startCityList.value.length > 0 && { startCityList: startCityList.value }),
...(serviceList.value && serviceList.value.length > 0 && { serviceList: serviceList.value }),
...(forPeopleList.value &&
forPeopleList.value.length > 0 && { forPeopleList: forPeopleList.value }),
// ...(startCityList.value && { startCityList: startCityList.value.split(',') }),
// ...(serviceList.value && { serviceList: serviceList.value.split(',') }),
// ...(forPeopleList.value && { forPeopleList: forPeopleList.value.split(',') }),
...(dateType.value === 8 && { allocateDate: allocateDate.value }), ...(dateType.value === 8 && { allocateDate: allocateDate.value }),
...(searchKeyword && { keyword: searchKeyword }), ...(searchKeyword && { keyword: searchKeyword }),
}; };
...@@ -309,17 +334,32 @@ const getProd = (searchKeyword = '') => { ...@@ -309,17 +334,32 @@ const getProd = (searchKeyword = '') => {
cardList.value = res.data.records; cardList.value = res.data.records;
}); });
}; };
const resetParams = () => { const resetParams = () => {
sortType.value = null; if (sortRef.value || departureDateRef.value || scenicSpotsRef.value || screenRef.value) {
attractionId.value = null; sortType.value = null;
dateType.value = null; dateType.value = null;
startCity.value = null; allocateDate.value = null;
serviceCommitment.value = null; attractionIdList.value = [];
labelId.value = null; startCityList.value = [];
allocateDate.value = null; serviceList.value = [];
getProd(); forPeopleList.value = [];
sortRef.value.reset();
departureDateRef.value.reset();
scenicSpotsRef.value.reset();
screenRef.value.reset();
getProd();
}
}; };
// const resetParams = () => {
// sortType.value = null;
// attractionIdList.value = [];
// dateType.value = null;
// startCityList.value = [];
// serviceList.value = [];
// forPeopleList.value = [];
// allocateDate.value = null;
// getProd();
// };
function toRouteDetails(item) { function toRouteDetails(item) {
console.log(item, 22222); console.log(item, 22222);
// TODO: 跳转到线路详情 // TODO: 跳转到线路详情
......
...@@ -464,6 +464,11 @@ const getShopInfoByIdFun = async (data) => { ...@@ -464,6 +464,11 @@ const getShopInfoByIdFun = async (data) => {
qualifications: item.qualifications, qualifications: item.qualifications,
}); });
}); });
try {
xma.setStorageSync('storage_choosedShopInfo', JSON.stringify(choosedShopInfo.value));
} catch (e) {
console.log(e);
}
testFileList.value = choosedShopInfo.value.reduce((obj, item) => { testFileList.value = choosedShopInfo.value.reduce((obj, item) => {
if (item.qualifications === '') { if (item.qualifications === '') {
obj[item.areaId] = []; obj[item.areaId] = [];
...@@ -487,7 +492,14 @@ const show = ref(false); ...@@ -487,7 +492,14 @@ const show = ref(false);
// 关闭店铺分类弹出层 // 关闭店铺分类弹出层
const handleClose = () => { const handleClose = () => {
show.value = false; show.value = false;
try {
const value = xma.getStorageSync('storage_choosedShopInfo');
if (value) {
choosedShopInfo.value = JSON.parse(value);
}
} catch (e) {
// error
}
setTimeout(() => { setTimeout(() => {
testFileList.value = choosedShopInfo.value.reduce((obj, item) => { testFileList.value = choosedShopInfo.value.reduce((obj, item) => {
if (item.qualifications === '') { if (item.qualifications === '') {
...@@ -508,7 +520,11 @@ const originChooseCategoryLength = 0; ...@@ -508,7 +520,11 @@ const originChooseCategoryLength = 0;
// 根据choosedShopInfo,更新categoryShopsList的值 // 根据choosedShopInfo,更新categoryShopsList的值
const chooseCategory = () => { const chooseCategory = () => {
show.value = false; show.value = false;
try {
xma.setStorageSync('storage_choosedShopInfo', JSON.stringify(choosedShopInfo.value));
} catch (e) {
console.log(e);
}
testFileList.value = choosedShopInfo.value.reduce((obj, item) => { testFileList.value = choosedShopInfo.value.reduce((obj, item) => {
if (item.qualifications === '') { if (item.qualifications === '') {
obj[item.areaId] = []; obj[item.areaId] = [];
...@@ -661,6 +677,19 @@ const submitData = () => { ...@@ -661,6 +677,19 @@ const submitData = () => {
categoryShops: dealCategoryData.value, categoryShops: dealCategoryData.value,
}); });
} }
try {
xma.setStorageSync('storage_choosedShopInfo', {});
xma.showToast({
title: '修改成功',
icon: 'success',
duration: 3000,
success: (res) => {
xma.redirectTo({ url: '/pages/storeEntry/index' });
},
});
} catch (e) {
console.log(e);
}
} }
}) })
.catch((error) => { .catch((error) => {
......
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