123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- <script>
- import {getEnterpriseList} from "@/api/commitment";
- export default {
- props:{
- propDataList: {
- type: Array,
- default: () => []
- },
-
- noRequest: {
- type: Boolean,
- default: false
- }
- },
- data() {
- return {
- enterpriseList: [],
- loading: false,
- finished: false,
- current: 0,
- size: 10
- };
- },
- mounted() {
- if(this.noRequest) {
- this.finished = true;
- this.loading = false;
- }
- },
- watch: {
- propDataList: {
- handler(val) {
- if(this.noRequest) {
- this.enterpriseList = val
- }
- },
- deep:true
- }
- },
- methods: {
-
- async handleGetEnterpriseList() {
- this.loading = true;
- try {
- const res = await getEnterpriseList({
- current: this.current + 1,
- size: this.size
- });
- if (res.data.records) {
- this.enterpriseList = this.enterpriseList.concat(res.data.records || [])
- this.current++;
- this.finished = res.data.records.length < this.size;
- }
- this.loading = false;
- } catch (e) {
- console.log(e);
- this.loading = false;
- }
- },
- handleClick(item) {
- this.$router.push({
- path: '/subPages/pages/commitment/enterpriseCommitment/index',
- query: {
- uuid: item.uuid
- }
- })
- }
- }
- };
- </script>
- <template>
- <van-list
- v-model="loading"
- @load="handleGetEnterpriseList"
- :finished="finished"
- finished-text="没有更多数据了"
- >
- <van-cell
- v-for="(item, index) in enterpriseList"
- :key="item.uuid"
- class="box"
- @click="handleClick(item)"
- >
- <template #default>
- <view class="top">
- <view class="name">
- {{ item.companyName }}
-
- {{item.creditGoal || '暂无' }}
- </view>
- </view>
- <view class="details">
- 最新承诺时间 : {{ item.createTime | date("YYYY-MM-DD HH:mm:ss") }}
- </view>
- </template>
- </van-cell>
- </van-list>
- </template>
- <style scoped lang="scss">
- .box {
- min-height: 78px;
- background: #FFFFFF;
- border-radius: 6px;
- margin: 12px 10px;
- width: auto;
- .top {
- display: flex;
- justify-content: space-between;
- .name {
- font-size: 16px;
- font-weight: bold;
- flex: 1;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- display: flex;
- }
- }
- .details {
- font-size: 14px;
- color: #666666;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- </style>
|