123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <template>
- <van-nav-bar :title="$t('priceSheet.name')" left-text="" left-arrow @click-left="onClickLeft" @click-right="onClickRight">
- <template #right>{{ $t("common.add") }}</template>
- </van-nav-bar>
- <van-search v-model="req.keyword" :placeholder="$t('common.pleaseEnterKeywords')" @search="onRefresh" />
- <van-pull-refresh v-model="loading" @refresh="onRefresh">
- <div class="list">
- <van-list v-model:loading="loading" :finished="finished" :finished-text="$t('common.noMore')" @load="getList('load')" style="margin-bottom: 60px">
- <commonList :data="listData" @onClick="toDtl" :config="listConfig"></commonList>
- </van-list>
- </div>
- </van-pull-refresh>
- </template>
- <script setup>
- import { ref, getCurrentInstance } from "vue";
- import commonList from "@/components/common-list.vue";
- const proxy = getCurrentInstance().proxy;
- const onClickLeft = () => proxy.$router.push("/main/working");
- const onClickRight = () => {
- proxy.$router.push({
- path: "/main/processDtl",
- query: {
- flowKey: "sale_quotation_flow",
- },
- });
- };
- const req = ref({
- pageNum: 1,
- keyword: null,
- });
- const finished = ref(false);
- const onRefresh = () => {
- req.value.pageNum = 1;
- finished.value = false;
- getList("refresh");
- };
- const loading = ref(false);
- const listData = ref([]);
- const status = ref([
- {
- label: "草稿",
- value: 0,
- },
- {
- label: "审批中",
- value: 10,
- },
- {
- label: "驳回",
- value: 20,
- },
- {
- label: "审批通过",
- value: 30,
- },
- {
- label: "作废",
- value: 70,
- },
- {
- label: "终止",
- value: 99,
- },
- ]);
- const getList = (type) => {
- loading.value = true;
- proxy
- .post("/saleQuotation/page", req.value)
- .then((res) => {
- if (res.data.rows && res.data.rows.length > 0) {
- res.data.rows = res.data.rows.map((item) => {
- let statusText = "";
- if (item.status) {
- let list = status.value.filter((itemStatus) => itemStatus.value == item.status);
- if (list && list.length > 0) {
- statusText = list[0].label;
- }
- }
- return {
- ...item,
- currencyAmount: item.currency + " " + item.amount,
- statusText: statusText,
- };
- });
- }
- console.log(type);
- listData.value = type === "refresh" ? res.data.rows : listData.value.concat(res.data.rows);
- if (req.value.pageNum * 10 >= res.data.total) {
- finished.value = true;
- }
- req.value.pageNum++;
- loading.value = false;
- })
- .catch(() => {
- loading.value = false;
- });
- };
- const toDtl = (row) => {
- // proxy.$router.push({
- // path: "/main/processDtl",
- // query: {
- // flowKey: "sale_quotation_flow",
- // id: row.flowInfoId,
- // processType: 20,
- // },
- // });
- };
- const listConfig = ref([
- {
- label: proxy.t("priceSheet.sellCorporation"),
- prop: "sellCorporationName",
- },
- {
- label: proxy.t("priceSheet.code"),
- prop: "code",
- },
- {
- label: proxy.t("priceSheet.buyCorporation"),
- prop: "buyCorporationName",
- },
- {
- label: proxy.t("priceSheet.amount"),
- prop: "currencyAmount",
- },
- {
- label: proxy.t("priceSheet.status"),
- prop: "statusText",
- },
- ]);
- </script>
- <style lang="scss" scoped>
- .list {
- min-height: 70vh;
- }
- </style>
|