freight-web/src/pagesApp/supplierMgt.vue

182 lines
4.2 KiB
Vue
Raw Normal View History

2024-03-04 07:10:11 +00:00
<template>
<view class="c-card">
<view class="search">
2024-03-16 11:52:23 +00:00
<view class="type" @click="state.isShowType = true"
>全部分类<u-icon name="arrow-down"></u-icon>
</view>
2024-03-04 07:10:11 +00:00
<u-search
placeholder="请输入供应商名称"
2024-03-14 03:14:12 +00:00
v-model="state.name"
2024-03-04 07:10:11 +00:00
:showAction="false"
:bgColor="'#fff'"
:borderColor="'rgba(0, 0, 0, 0.1)'"
:placeholderColor="'#C1C1C1'"
2024-03-14 03:14:12 +00:00
@search="handleSearch()"
2024-03-04 07:10:11 +00:00
></u-search>
2024-03-16 11:52:23 +00:00
<view class="btn" @click="addSupplier"> 新增 </view>
2024-03-04 07:10:11 +00:00
</view>
2024-03-16 11:52:23 +00:00
2024-03-14 03:14:12 +00:00
<view class="box" v-for="(item, index) in pageList.list" :key="index">
2024-03-04 07:10:11 +00:00
<view>
<view>
2024-03-14 03:14:12 +00:00
<view>{{ item.name }}</view>
<view>卡号{{ item.cardCode }}</view>
2024-03-04 07:10:11 +00:00
</view>
2024-03-16 11:52:23 +00:00
<view class="op-box">
<view class="btn" @click="edit(item)"> 编辑 </view>
<view class="btn" @click="update(item)"> 删除 </view>
</view>
2024-03-04 07:10:11 +00:00
</view>
</view>
</view>
2024-03-16 11:52:23 +00:00
<u-action-sheet
:actions="state.typeList"
:title="'供应商分类'"
:show="state.isShowType"
:closeOnClickOverlay="true"
:closeOnClickAction="true"
@close="state.isShowType = false"
@select="handleSelect"
></u-action-sheet>
2024-03-04 07:10:11 +00:00
</template>
<script setup lang="ts">
2024-03-16 11:52:23 +00:00
import { SupplierApi } from "@/services";
2024-03-14 03:14:12 +00:00
import { UsersType } from "@/utils/enum";
2024-03-16 11:52:23 +00:00
const state = reactive<any>({
2024-03-14 03:14:12 +00:00
name: "",
2024-03-16 11:52:23 +00:00
supplierTypeId: -1,
isShowType: false,
typeList: [],
2024-03-14 03:14:12 +00:00
});
const pageList: PageResult<User> = reactive({
total: 0,
list: [],
pageNum: 1,
pageSize: 10,
});
2024-03-16 11:52:23 +00:00
const handleSelect = (v: any) => {
state.supplierTypeId = v.id;
getUserList();
};
2024-03-14 03:14:12 +00:00
const handleSearch = () => {
2024-03-16 11:52:23 +00:00
getUserList();
};
const update = (item: any) => {
SupplierApi.updateSupplierUser({ isDeleted: true, id: item.id }).then(
(res) => {
if (res.code === 200) {
getUserList();
}
}
);
};
const edit = (item: any) => {
uni.navigateTo({
url:
"/pagesApp/components/addSupplier?title=编辑供应商&item=" +
JSON.stringify(item), // 要跳转到的页面路径
});
2024-03-14 03:14:12 +00:00
};
const getUserList = () => {
2024-03-16 11:52:23 +00:00
let params: any = {
2024-03-14 03:14:12 +00:00
pageSize: 10,
pageNum: 1,
name: state.name,
2024-03-16 11:52:23 +00:00
};
if (state.supplierTypeId > -1) {
params.supplierTypeId = state.supplierTypeId;
}
SupplierApi.getSupplierUserPage(params).then((res) => {
2024-03-14 03:14:12 +00:00
if (res.code === 200) {
if (res.code === 200) {
(pageList as any).list = (res.data as any).list;
}
}
});
};
2024-03-16 11:52:23 +00:00
const getSupplierTypeList = () => {
SupplierApi.getSupplierTypeList().then((res) => {
if (res.code === 200) {
state.typeList = res.data;
}
});
};
const addSupplier = () => {
uni.navigateTo({
url: "/pagesApp/components/addSupplier", // 要跳转到的页面路径
});
};
2024-03-14 03:14:12 +00:00
onMounted(() => {
getUserList();
2024-03-16 11:52:23 +00:00
getSupplierTypeList();
2024-03-14 03:14:12 +00:00
});
2024-03-04 07:10:11 +00:00
</script>
<style lang="scss" scoped>
.c-card {
margin: 30rpx 25rpx;
.search {
display: flex;
align-items: center;
justify-content: space-between;
2024-03-16 11:52:23 +00:00
.type {
display: flex;
margin-right: 20rpx;
font-size: 28rpx;
color: #000000;
}
2024-03-04 07:10:11 +00:00
.btn {
background: #00dcee;
border-radius: 24rpx;
border: 1px solid #00dcee;
font-weight: 500;
2024-03-16 11:52:23 +00:00
font-size: 28rpx;
2024-03-04 07:10:11 +00:00
color: #ffffff;
margin-left: 50rpx;
padding: 6rpx 30rpx;
}
}
.box {
background: #ffffff;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
2024-03-19 06:29:27 +00:00
padding: 10rpx 20rpx;
2024-03-04 07:10:11 +00:00
font-weight: 400;
2024-03-16 11:52:23 +00:00
font-size: 28rpx;
2024-03-04 07:10:11 +00:00
color: #000000;
line-height: 41rpx;
margin-top: 30rpx;
> view {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20rpx 0rpx;
2024-03-16 11:52:23 +00:00
.op-box {
display: flex;
.btn + .btn {
margin-left: 20rpx;
}
.btn {
background: #ff9d55;
border-radius: 24rpx;
font-weight: 500;
font-size: 28rpx;
color: #ffffff;
padding: 6rpx 30rpx;
}
.btn_text {
font-weight: 500;
font-size: 24rpx;
color: #00dcee;
}
2024-03-04 07:10:11 +00:00
}
}
> view + view {
border-top: 1px solid rgba(233, 233, 233, 0.76);
}
}
}
</style>