From de4ac959d99138074276563d6d4ca44d76b17705 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 20 五月 2026 16:44:25 +0800
Subject: [PATCH] Merge branch 'dev_NEW_pro' into dev_天津_宝东
---
src/pages/sales/salesQuotation/index.vue | 236 +++++++++++++++++++++++++++++++++-------------------------
1 files changed, 135 insertions(+), 101 deletions(-)
diff --git a/src/pages/sales/salesQuotation/index.vue b/src/pages/sales/salesQuotation/index.vue
index e9f6be3..4ecf910 100644
--- a/src/pages/sales/salesQuotation/index.vue
+++ b/src/pages/sales/salesQuotation/index.vue
@@ -1,90 +1,107 @@
<template>
<view class="sales-account">
- <PageHeader title="閿�鍞姤浠�" @back="goBack" />
-
+ <PageHeader title="閿�鍞姤浠�"
+ @back="goBack" />
<view class="search-section">
<view class="search-bar">
<view class="search-input">
- <up-input
- class="search-text"
- v-model="searchForm.product"
- placeholder="璇疯緭鍏ヤ骇鍝佸悕绉版悳绱�"
- clearable
- @change="getList(true)"
- />
+ <up-input class="search-text"
+ v-model="quotationNo"
+ placeholder="璇疯緭鍏ユ姤浠峰崟鍙锋悳绱�"
+ clearable
+ @change="getList" />
</view>
- <view class="filter-button" @click="getList(true)">
- <up-icon name="search" size="24" color="#999"></up-icon>
+ <view class="filter-button"
+ @click="getList">
+ <up-icon name="search"
+ size="24"
+ color="#999"></up-icon>
</view>
</view>
</view>
-
- <view v-if="quotationList.length > 0" class="ledger-list">
- <view v-for="item in quotationList" :key="item.id" class="ledger-item">
+ <view class="tabs-section">
+ <up-tabs v-model="tabValue"
+ :list="tabList"
+ itemStyle="width: 20%;height: 80rpx;"
+ @change="onTabChange" />
+ </view>
+ <view v-if="quotationList.length > 0"
+ class="ledger-list">
+ <view v-for="item in quotationList"
+ :key="item.id"
+ class="ledger-item">
<view class="item-header">
<view class="item-left">
<view class="document-icon">
- <up-icon name="file-text" size="16" color="#ffffff"></up-icon>
+ <up-icon name="file-text"
+ size="16"
+ color="#ffffff"></up-icon>
</view>
- <text class="item-id">{{ item.product || "-" }}</text>
+ <text class="item-id">{{ item.quotationNo || "-" }}</text>
</view>
+ <up-tag :text="item.status || '寰呭鎵�'"
+ :type="getStatusType(item.status)"
+ size="mini"
+ shape="circle" />
</view>
-
<up-divider></up-divider>
-
<view class="item-details">
<view class="detail-row">
- <text class="detail-label">瑙勬牸</text>
- <text class="detail-value">{{ item.specification || "-" }}</text>
+ <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.paper || "-" }}</text>
+ <text class="detail-label">涓氬姟鍛�</text>
+ <text class="detail-value">{{ item.salesperson || "-" }}</text>
</view>
<view class="detail-row">
- <text class="detail-label">瀹氶噺</text>
- <text class="detail-value">{{ item.paperWeight || "-" }}</text>
+ <text class="detail-label">鎶ヤ环鏃ユ湡</text>
+ <text class="detail-value">{{ item.quotationDate || "-" }}</text>
</view>
<view class="detail-row">
- <text class="detail-label">鍗曚环</text>
- <text class="detail-value">{{ formatAmount(item.unitPrice) }}</text>
+ <text class="detail-label">鏈夋晥鏈熻嚦</text>
+ <text class="detail-value">{{ item.validDate || "-" }}</text>
</view>
<view class="detail-row">
- <text class="detail-label">鍗扮増璐�</text>
- <text class="detail-value">{{ formatAmount(item.printingFee) }}</text>
+ <text class="detail-label">鎶ヤ环閲戦</text>
+ <text class="detail-value highlight">{{ formatAmount(item.totalAmount) }}</text>
</view>
- <view class="detail-row">
- <text class="detail-label">鍒�鐗堣垂</text>
- <text class="detail-value">{{ formatAmount(item.dieCuttingFee) }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">纾ㄥ叿璐�</text>
- <text class="detail-value">{{ formatAmount(item.grindingFee) }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">鏁伴噺</text>
- <text class="detail-value">{{ Number(item.quantity || 0) }}</text>
- </view>
- <view class="detail-row">
+ <view class="detail-row"
+ v-if="item.remark">
<text class="detail-label">澶囨敞</text>
- <text class="detail-value">{{ item.remark || "-" }}</text>
+ <text class="detail-value">{{ item.remark }}</text>
</view>
</view>
-
<view class="action-buttons">
- <up-button class="action-btn" size="small" type="primary" @click="goEdit(item)">缂栬緫</up-button>
- <up-button class="action-btn" size="small" @click="goDetail(item)">璇︽儏</up-button>
- <up-button class="action-btn" size="small" type="error" plain @click="handleDelete(item)">鍒犻櫎</up-button>
+ <up-button class="action-btn"
+ size="small"
+ type="primary"
+ :disabled="!canEdit(item)"
+ @click="goEdit(item)">
+ 缂栬緫
+ </up-button>
+ <up-button class="action-btn"
+ size="small"
+ @click="goDetail(item)">璇︽儏</up-button>
+ <up-button class="action-btn"
+ size="small"
+ type="error"
+ plain
+ @click="handleDelete(item)">
+ 鍒犻櫎
+ </up-button>
</view>
</view>
</view>
-
- <view v-else class="no-data">
- <text>鏆傛棤鏁版嵁</text>
+ <view v-else
+ class="no-data">
+ <text>鏆傛棤閿�鍞姤浠锋暟鎹�</text>
</view>
-
- <view class="fab-button" @click="goAdd">
- <up-icon name="plus" size="28" color="#ffffff"></up-icon>
+ <view class="fab-button"
+ @click="goAdd">
+ <up-icon name="plus"
+ size="28"
+ color="#ffffff"></up-icon>
</view>
</view>
</template>
@@ -93,73 +110,85 @@
import { reactive, ref } from "vue";
import { onShow } from "@dcloudio/uni-app";
import PageHeader from "@/components/PageHeader.vue";
- import { deleteQuotation } from "@/api/salesManagement/salesQuotation";
- import { quotationProductListPage } from "@/api/salesManagement/salesQuotationProduct";
+ import {
+ deleteQuotation,
+ getQuotationList,
+ } from "@/api/salesManagement/salesQuotation";
- const searchForm = reactive({ product: "" });
+ const quotationNo = ref("");
const quotationList = ref([]);
- const goBack = () => uni.navigateBack();
- const goAdd = () => uni.navigateTo({ url: "/pages/sales/salesQuotation/edit" });
+
+ const tabList = reactive([
+ { name: "鍏ㄩ儴", value: "" },
+ { name: "寰呭鎵�", value: "寰呭鎵�" },
+ { name: "瀹℃牳涓�", value: "瀹℃牳涓�" },
+ { name: "閫氳繃", value: "閫氳繃" },
+ { name: "鎷掔粷", value: "鎷掔粷" },
+ ]);
+ const tabValue = ref(0);
+
+ const page = {
+ current: -1,
+ size: -1,
+ };
+
+ const goBack = () => {
+ uni.navigateBack();
+ };
+
+ const goAdd = () => {
+ uni.removeStorageSync("salesQuotationDetail");
+ uni.navigateTo({ url: "/pages/sales/salesQuotation/edit" });
+ };
+
const goEdit = item => {
- const source = item?.__raw || item || {};
- uni.setStorageSync("salesQuotationEdit", source);
+ if (!canEdit(item)) return;
+ uni.setStorageSync("salesQuotationDetail", item || {});
uni.navigateTo({ url: `/pages/sales/salesQuotation/edit?id=${item.id}` });
};
+
const goDetail = item => {
uni.setStorageSync("salesQuotationDetail", item || {});
uni.navigateTo({ url: `/pages/sales/salesQuotation/detail?id=${item.id}` });
};
- const formatAmount = amount => `楼${Number(amount || 0).toFixed(2)}`;
+ const canEdit = item => ["寰呭鎵�", "鎷掔粷"].includes(item?.status);
- const calcTotalAmountFromProducts = products =>
- Number(
- (products || [])
- .reduce((sum, product) => {
- const unitPrice = Number(product?.unitPrice || 0);
- const printingFee = Number(product?.printingFee || 0);
- const dieCuttingFee = Number(product?.dieCuttingFee || 0);
- const grindingFee = Number(product?.grindingFee || 0);
- return sum + unitPrice + printingFee + dieCuttingFee + grindingFee;
- }, 0)
- .toFixed(2)
- );
+ const onTabChange = val => {
+ tabValue.value = val.index;
+ getList();
+ };
- const normalizeQuotation = row => {
- const sourceProducts = Array.isArray(row?.products) && row.products.length ? row.products : [row];
- const first = sourceProducts[0] || {};
- return {
- ...row,
- __raw: row,
- customer: row?.customer || row?.customerName || first?.customer || first?.customerName || "",
- salesperson: row?.salesperson || row?.salesman || row?.salesPerson || first?.salesperson || "",
- quotationDate: row?.quotationDate || row?.quoteDate || first?.quotationDate || "",
- validDate: row?.validDate || row?.expireDate || first?.validDate || "",
- paymentMethod: row?.paymentMethod || row?.paymentType || first?.paymentMethod || "",
- product: first.product || first.productName || row?.product || "",
- specification: first.specification || row?.specification || "",
- paper: first.paper || row?.paper || "",
- paperWeight: first.paperWeight || row?.paperWeight || "",
- unitPrice: Number(first.unitPrice || row?.unitPrice || 0),
- printingFee: Number(first.printingFee || row?.printingFee || 0),
- dieCuttingFee: Number(first.dieCuttingFee || row?.dieCuttingFee || 0),
- grindingFee: Number(first.grindingFee || row?.grindingFee || 0),
- quantity: Number(first.quantity || row?.quantity || 0),
- quotationNo: row?.quotationNo || first?.quotationNo || "",
- totalAmount: Number(row?.totalAmount || calcTotalAmountFromProducts(sourceProducts)),
+ const getCurrentStatus = () => {
+ const currentTab = tabList[tabValue.value];
+ return currentTab?.value || "";
+ };
+
+ const formatAmount = amount => {
+ const num = Number(amount || 0);
+ return `楼${num.toFixed(2)}`;
+ };
+
+ const getStatusType = status => {
+ const statusMap = {
+ 寰呭鎵�: "info",
+ 瀹℃牳涓�: "primary",
+ 閫氳繃: "success",
+ 鎷掔粷: "danger",
};
+ return statusMap[status] || "info";
};
const getList = () => {
uni.showLoading({ title: "鍔犺浇涓�...", mask: true });
- quotationProductListPage({
- current: -1,
- size: -1,
- product: String(searchForm.product || "").trim(),
+ getQuotationList({
+ ...page,
+ quotationNo: quotationNo.value,
+ status: getCurrentStatus(),
})
.then(res => {
const records = res?.data?.records || res?.records || [];
- quotationList.value = Array.isArray(records) ? records.map(normalizeQuotation) : [];
+ quotationList.value = Array.isArray(records) ? records : [];
})
.catch(() => {
uni.showToast({ title: "鏌ヨ澶辫触", icon: "error" });
@@ -173,11 +202,11 @@
if (!item?.id) return;
uni.showModal({
title: "鍒犻櫎纭",
- content: "纭鍒犻櫎璇ユ姤浠峰悧锛�",
+ content: "纭鍒犻櫎璇ユ姤浠峰崟鍚楋紵",
success: res => {
if (!res.confirm) return;
uni.showLoading({ title: "澶勭悊涓�...", mask: true });
- deleteQuotation([item.id])
+ deleteQuotation(item.id)
.then(() => {
uni.showToast({ title: "鍒犻櫎鎴愬姛", icon: "success" });
getList();
@@ -200,6 +229,11 @@
<style scoped lang="scss">
@import "@/styles/sales-common.scss";
+ .tabs-section {
+ background: #ffffff;
+ padding: 0 12px 8px 12px;
+ }
+
.item-index {
max-width: 180rpx;
text-align: center;
--
Gitblit v1.9.3