| | |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { useUser } from '@/hooks'; |
| | | import { useUser, useTaskList, HomeOrderType } from '@/hooks'; |
| | | import { useUserStore } from '@/stores/modules/user'; |
| | | import { RectDown, Location2 } from '@nutui/icons-vue-taro'; |
| | | import Taro from '@tarojs/taro'; |
| | | import { LocationUtils, trim } from '@12333/utils'; |
| | | import _ from 'lodash'; |
| | | import IconLogo from '@/assets/home/icon-logo.png'; |
| | | import { useInfiniteLoading } from '@12333/hooks'; |
| | | import { OrderInputType, Gender } from '@12333/constants'; |
| | | import * as orderServices from '@12333/services/api/Order'; |
| | | import { TaskCard, ProTabs, ProTabPane } from '@12333/components'; |
| | | import { HomeOrderType } from './constants'; |
| | | import HomeQueryMenuView from './HomeQueryMenuView.vue'; |
| | | |
| | | const { locationCity } = useUser(); |
| | | |
| | | const searchValue = ref(''); |
| | | |
| | | const queryState = reactive({ |
| | | searchValueTrim: '', |
| | | orderType: HomeOrderType.Recommend, |
| | | gender: '' as any as Gender, |
| | | }); |
| | | |
| | | const handleSearch = _.debounce(function () { |
| | | queryState.searchValueTrim = trim(searchValue.value); |
| | | }, 300); |
| | | |
| | | const userStore = useUserStore(); |
| | | |
| | | const { searchValue, queryState, handleSearch, infiniteLoadingProps } = useTaskList(); |
| | | |
| | | function goCitySelect() { |
| | | Taro.navigateTo({ |
| | |
| | | 'https://storage.360buyimg.com/jdc-article/welcomenutui.jpg', |
| | | 'https://storage.360buyimg.com/jdc-article/fristfabu.jpg', |
| | | ]); |
| | | |
| | | const { infiniteLoadingProps } = useInfiniteLoading( |
| | | ({ pageParam }) => { |
| | | let params: API.FrontOrderListInput = { |
| | | pageModel: { |
| | | rows: 20, |
| | | page: pageParam, |
| | | orderInput: [ |
| | | queryState.orderType === HomeOrderType.Recommend |
| | | ? { property: 'isRecommend', order: OrderInputType.Desc } |
| | | : { property: 'lastShelfTime', order: OrderInputType.Desc }, |
| | | ], |
| | | }, |
| | | }; |
| | | |
| | | return orderServices.getFrontOrderList(params, { |
| | | showLoading: false, |
| | | }); |
| | | }, |
| | | { |
| | | queryKey: ['orderServices/getFrontOrderList', queryState], |
| | | } |
| | | ); |
| | | |
| | | const selectItem = ref(); |
| | | |