| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <template>
- <app-view class="contract">
- <template #header>
- <app-navbar class="contract__header" title="合同转让">
- <template #footer>
- <Search shape="round" placeholder="商品搜索" v-model="keyword" @search="pullRefreshRef.refresh()" />
- </template>
- </app-navbar>
- </template>
- <app-pull-refresh ref="pullRefreshRef" class="contract__container" v-model:loading="loading" v-model:error="error"
- v-model:pageIndex="pageIndex" :page-count="pageCount" @refresh="onRefresh">
- <ul class="list">
- <li class="list-item g-block--bg" v-for="(item, index) in dataList" :key="index">
- <div class="block">
- <img :src="getFirstImage(item.thumurls)" />
- <span>{{ item.wrstandardname }}</span>
- </div>
- <div class="block">
- <Button type="primary" size="small" round
- @click="$router.push({ name: 'contract-details', query: { wrstandardid: item.wrstandardid } })">查看详情</Button>
- </div>
- </li>
- </ul>
- </app-pull-refresh>
- </app-view>
- </template>
-
- <script lang="ts" setup>
- import { shallowRef, onActivated } from 'vue'
- import { Search, Button } from 'vant'
- import { getFileUrl } from '@/filters'
- import { useRequest } from '@/hooks/request'
- import { queryTHJPurchaseTransfer } from '@/services/api/contract'
- import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
- const dataList = shallowRef<Model.THJPurchaseTransferRsp[]>([])
- const error = shallowRef(false)
- const pullRefreshRef = shallowRef()
- const keyword = shallowRef('')
- const { loading, pageIndex, pageCount, run } = useRequest(queryTHJPurchaseTransfer, {
- manual: true,
- params: {
- pagesize: 20,
- },
- onSuccess: (res) => {
- if (pageIndex.value === 1) {
- dataList.value = []
- }
- dataList.value.push(...res.data)
- },
- onError: () => {
- error.value = true
- }
- })
- // 获取产品首图
- const getFirstImage = (url: string) => {
- const images = url.split(',').map((path) => getFileUrl(path))
- return images[0] ?? ''
- }
- const onRefresh = () => {
- run({ wrstandardname: keyword.value })
- }
- onActivated(() => {
- pullRefreshRef.value?.refresh()
- })
- </script>
-
- <style lang="less">
- @import './index.less';
- </style>
|