gaoluyang
3 小时以前 e449a5408265e4bd1f6c66f5be28a42efac444ee
src/pages/sales/salesQuotation/index.vue
@@ -6,14 +6,14 @@
      <view class="search-bar">
        <view class="search-input">
          <up-input class="search-text"
                    v-model="quotationNo"
                    v-model="query.quotationNo"
                    placeholder="请输入报价单号搜索"
                    clearable
                    @change="getList" />
        </view>
        <view class="filter-button"
              @click="getList">
          <up-icon name="search"
              @click="showFilter = true">
          <up-icon name="list"
                   size="24"
                   color="#999"></up-icon>
        </view>
@@ -49,6 +49,10 @@
          <view class="detail-row">
            <text class="detail-label">客户名称</text>
            <text class="detail-value">{{ item.customer || "-" }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">所属项目</text>
            <text class="detail-value">{{ item.projectName || "-" }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">业务员</text>
@@ -103,20 +107,50 @@
               size="28"
               color="#ffffff"></up-icon>
    </view>
    <FilterPanel v-model:show="showFilter"
                 :model-value="query"
                 title="报价筛选"
                 :fields="filterFields"
                 @search="onFilterSearch"
                 @reset="onFilterSearch" />
  </view>
</template>
<script setup>
  import { reactive, ref } from "vue";
  import { computed, reactive, ref } from "vue";
  import { onShow } from "@dcloudio/uni-app";
  import PageHeader from "@/components/PageHeader.vue";
  import FilterPanel from "@/components/FilterPanel.vue";
  import {
    deleteQuotation,
    getQuotationList,
  } from "@/api/salesManagement/salesQuotation";
  import { loadProjectOptions } from "@/utils/projectOptions";
  const quotationNo = ref("");
  const quotationList = ref([]);
  const showFilter = ref(false);
  const projectOptions = ref([]);
  const query = reactive({
    quotationNo: "",
    projectId: "",
  });
  const filterFields = computed(() => [
    {
      prop: "quotationNo",
      label: "报价单号",
      type: "input",
      placeholder: "请输入报价单号",
    },
    {
      prop: "projectId",
      label: "所属项目",
      type: "select",
      options: projectOptions.value,
    },
  ]);
  const tabList = reactive([
    { name: "全部", value: "" },
@@ -183,7 +217,8 @@
    uni.showLoading({ title: "加载中...", mask: true });
    getQuotationList({
      ...page,
      quotationNo: quotationNo.value,
      quotationNo: query.quotationNo,
      projectId: query.projectId || undefined,
      status: getCurrentStatus(),
    })
      .then(res => {
@@ -195,6 +230,26 @@
      })
      .finally(() => {
        uni.hideLoading();
      });
  };
  // FilterPanel 只回吐筛选值,写回 query 后统一查询
  const onFilterSearch = values => {
    Object.assign(query, values);
    getList();
  };
  let projectsLoaded = false;
  const loadProjects = () => {
    if (projectsLoaded) return;
    projectsLoaded = true;
    loadProjectOptions()
      .then(options => {
        projectOptions.value = options;
      })
      .catch(() => {
        projectsLoaded = false;
      });
  };
@@ -223,6 +278,7 @@
  onShow(() => {
    getList();
    loadProjects();
  });
</script>