<template>
|
<view class="sales-account">
|
<PageHeader title="供应商管理" @back="goBack"/>
|
<view class="search-section">
|
<view class="search-bar">
|
<view class="search-input">
|
<up-input
|
class="search-text"
|
placeholder="请输入供应商名称"
|
v-model="supplierName"
|
@change="getList"
|
clearable
|
/>
|
</view>
|
<view class="filter-button" @click="getList">
|
<up-icon name="search" size="24" color="#999"></up-icon>
|
</view>
|
</view>
|
</view>
|
<view class="tabs-section">
|
<up-tabs
|
v-model="tabValue"
|
:list="tabList"
|
itemStyle="width: 50%;height: 80rpx;"
|
@change="onTabChange"
|
>
|
</up-tabs>
|
</view>
|
<view class="ledger-list" v-if="list.length > 0">
|
<view v-for="item in list" :key="item.id">
|
<view 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>
|
</view>
|
<text class="item-id">{{ item.supplierName || "-" }}</text>
|
</view>
|
</view>
|
<up-divider></up-divider>
|
<view class="item-details">
|
<view class="detail-row">
|
<text class="detail-label">供应商类型</text>
|
<text class="detail-value">{{ item.supplierType || "-" }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">纳税人识别号</text>
|
<text class="detail-value">{{ item.taxpayerIdentificationNum || "-" }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">公司电话</text>
|
<text class="detail-value">{{ item.companyPhone || "-" }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">联系人</text>
|
<text class="detail-value">{{ item.contactUserName || "-" }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">联系电话</text>
|
<text class="detail-value">{{ item.contactUserPhone || "-" }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">维护人</text>
|
<text class="detail-value">{{ item.maintainUserName || "-" }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">维护时间</text>
|
<text class="detail-value">{{ item.maintainTime || "-" }}</text>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
<view v-else class="no-data">
|
<text>暂无供应商数据</text>
|
</view>
|
</view>
|
</template>
|
|
<script setup>
|
import { reactive, ref } from "vue";
|
import { onShow } from "@dcloudio/uni-app";
|
import useUserStore from "@/store/modules/user";
|
import { delSupplier, listSupplier } from "@/api/basicData/supplierManageFile";
|
|
const userStore = useUserStore();
|
const supplierName = ref("");
|
const list = ref([]);
|
|
const tabList = reactive([
|
{ name: "正常供应商", value: 0 },
|
{ name: "黑名单", value: 1 },
|
]);
|
const tabValue = ref(0);
|
|
const page = {
|
current: -1,
|
size: -1,
|
};
|
|
const goBack = () => {
|
uni.navigateBack();
|
};
|
|
const goAdd = () => {
|
uni.navigateTo({ url: "/pages/basicData/supplierManage/edit" });
|
};
|
|
const goEdit = item => {
|
uni.navigateTo({ url: `/pages/basicData/supplierManage/edit?id=${item.id}` });
|
};
|
|
const onTabChange = val => {
|
tabValue.value = val.value;
|
getList();
|
};
|
|
const getList = () => {
|
uni.showLoading({ title: "加载中...", mask: true });
|
listSupplier({
|
...page,
|
supplierName: supplierName.value,
|
isWhite: tabValue.value,
|
})
|
.then(res => {
|
list.value = res?.data?.records || [];
|
})
|
.catch(() => {
|
uni.showToast({ title: "查询失败", icon: "error" });
|
})
|
.finally(() => {
|
uni.hideLoading();
|
});
|
};
|
|
const handleDelete = item => {
|
if (!item?.id) return;
|
if (item.maintainUserName && item.maintainUserName !== userStore.nickName) {
|
uni.showToast({ title: "不可删除他人维护的数据", icon: "none" });
|
return;
|
}
|
uni.showModal({
|
title: "删除提示",
|
content: "确定要删除吗?删除后无法恢复",
|
success: res => {
|
if (!res.confirm) return;
|
uni.showLoading({ title: "删除中...", mask: true });
|
delSupplier([item.id])
|
.then(() => {
|
uni.showToast({ title: "删除成功", icon: "success" });
|
getList();
|
})
|
.catch(() => {
|
uni.showToast({ title: "删除失败", icon: "error" });
|
})
|
.finally(() => {
|
uni.hideLoading();
|
});
|
},
|
});
|
};
|
|
onShow(() => {
|
userStore.getInfo();
|
getList();
|
});
|
</script>
|
|
<style scoped lang="scss">
|
@import "@/styles/procurement-common.scss";
|
|
.tabs-section {
|
background: #fff;
|
padding: 0 12px 8px 12px;
|
}
|
</style>
|