update: 供应商管理相关对接

This commit is contained in:
admin 2024-03-16 19:52:23 +08:00
parent 6a26907192
commit 05dcacd062
6 changed files with 516 additions and 43 deletions

View File

@ -12,13 +12,14 @@
}
},
"pages": [
// {
// "path": "pages/index/index",
// "style": {
// "navigationStyle": "custom", //
// "navigationBarTitleText": "工作台"
// }
// },
{
"path": "pagesHome/index",
"style": {
"navigationStyle": "custom", //
"navigationBarTitleText": "工作台"
}
},
{
"path": "pages/login/index",
"style": {
@ -83,18 +84,18 @@
}
]
},
{
"root": "pagesHome",
"pages": [
{
"path": "index",
"style": {
"navigationStyle": "custom", //
"navigationBarTitleText": "工作台"
}
}
]
},
// {
// "root": "pagesHome",
// "pages": [
// {
// "path": "index",
// "style": {
// "navigationStyle": "custom", //
// "navigationBarTitleText": "工作台"
// }
// }
// ]
// },
{
"root": "pagesReceive",
"pages": [
@ -309,9 +310,15 @@
"style": {
"navigationBarTitleText": "客户管理"
}
},
{
"path": "components/addSupplier",
"style": {
"navigationBarTitleText": "新增供应商"
}
}
]
},
}
// {
// "root": "uni_modules",
// "pages": [

View File

@ -0,0 +1,284 @@
<template>
<view class="c-card">
<u-form
labelPosition="left"
:model="model1"
:rules="rules"
ref="form"
:labelWidth="100"
:labelStyle="{ padding: '0rpx 10rpx' }"
>
<u-form-item
:prop="`formData[${item.key}]`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList"
:key="index"
@click="item.fn"
>
<u-textarea
v-if="item.type === 'textarea'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`请输入${item.name}`"
></u-textarea>
<u-input
v-if="item.type === 'select' || item.type === 'input'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`${item.type === 'select' ? '选择' : '输入'}${
item.name
}`"
:clearable="true"
:customStyle="{}"
border="none"
>
<template #suffix>
<text>
{{ item.unit }}
</text>
</template>
</u-input>
<template #right v-if="item.type === 'select'">
<u-icon name="arrow-right"></u-icon>
</template>
</u-form-item>
</u-form>
<block v-for="(item, index) in formAttrList" :key="index">
<u-action-sheet
v-if="item.type === 'select'"
:actions="contrlModalParams[item.childKey].list"
:title="contrlModalParams[item.childKey].title"
:show="contrlModalParams[item.childKey].isShow"
@select="(v: any) => handleSelect(item.childKey, v)"
@close="contrlModalParams[item.childKey].isShow = false"
:closeOnClickAction="true"
></u-action-sheet>
</block>
</view>
<view class="btn-box">
<u-button type="primary" text="保存" @click="save()"></u-button>
</view>
</template>
<script setup lang="ts">
import { StockCardApi, SupplierApi } from "@/services";
import { formatDate } from "@/utils";
import { DeviceType, ImagesType, OrderType } from "@/utils/enum";
import { onLoad } from "@dcloudio/uni-app";
import _ from "underscore";
const model1 = reactive<any>({
formData: {},
});
const rules = ref({
"userInfo.userName": {
type: "string",
required: true,
message: "请输入手机号",
trigger: ["blur", "change"],
},
"userInfo.password": {
type: "string",
required: true,
message: "请输入密码",
trigger: ["blur", "change"],
},
});
const contrlModalParams = reactive<any>({
supplierType: {
isShow: false,
title: "标题",
list: [],
},
stockCard: {
isShow: false,
title: "标题",
list: [],
},
});
const formAttrList = reactive<any>([
{
name: "基本信息",
type: "text",
},
{
name: "卡号",
key: "stockCardName",
type: "select",
childKey: "stockCard",
required: true,
fn: () => {
contrlModalParams.stockCard.isShow = true;
contrlModalParams.stockCard.title = "卡号";
},
},
{
name: "供应商名称",
key: "name",
type: "input",
required: true,
unit: "",
},
{
name: "供应商分类",
key: "supplierTypeName",
type: "select",
childKey: "supplierType",
required: true,
unit: "",
fn: () => {
contrlModalParams.supplierType.isShow = true;
contrlModalParams.supplierType.title = "供应商分类";
},
},
{
name: "联系人",
key: "contacts",
type: "input",
unit: "",
},
{
name: "联系电话",
key: "phone",
type: "input",
unit: "",
},
{
name: "身份证号码",
key: "card",
type: "input",
unit: "",
},
{
name: "详细地址",
key: "address",
type: "input",
unit: "",
},
{
name: "银行卡信息",
type: "text",
},
{
name: "户名",
key: "bankTitle",
type: "input",
unit: "",
},
{
name: "银行名称",
key: "bankName",
type: "input",
unit: "",
},
{
name: "银行卡号",
key: "bankNumber",
type: "input",
unit: "",
},
{
name: "开户支行",
key: "branchName",
type: "input",
unit: "",
},
]);
const handleSelect = (key: string, v: any) => {
contrlModalParams[key].isShow = false;
if (key === "supplierType") {
model1.formData.supplierTypeName = v.name;
model1.formData.supplierTypeId = v.id;
} else if (key === "stockCard") {
model1.formData.stockCardName = v.name;
model1.formData.stockCardId = v.id;
}
};
const save = () => {
if (model1.formData.id) {
SupplierApi.updateSupplierUser(model1.formData).then((res) => {
if (res.code === 200) {
uni.navigateTo({
url: "/pagesApp/supplierMgt", //
});
}
});
} else {
SupplierApi.addSupplierUser(model1.formData).then((res) => {
if (res.code === 200) {
uni.navigateTo({
url: "/pagesApp/supplierMgt", //
});
}
});
}
};
const getSupplierTypeList = () => {
SupplierApi.getSupplierTypeList().then((res) => {
if (res.code === 200) {
contrlModalParams.supplierType.list = res.data;
}
});
};
const getStockCardList = () => {
StockCardApi.getStockCardList({ pageNum: 1, pageSize: 10 }).then((res) => {
if (res.code === 200) {
contrlModalParams.stockCard.list = (res.data as any).list.map(
(item: any) => {
return { ...item, name: item.cardCode };
}
);
}
});
};
onMounted(() => {
getSupplierTypeList();
getStockCardList();
});
onLoad((option) => {
//
const title = (option as any).title;
model1.formData = JSON.parse((option as any).item);
if (model1.formData.cardCode) {
model1.formData.stockCardName = model1.formData.cardCode;
}
//
uni.setNavigationBarTitle({
title: title,
});
});
</script>
<style lang="scss" scoped>
.c-card {
background: #ffffff;
// box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
margin: 30rpx 25rpx;
padding: 10rpx 20rpx;
::v-deep .u-form-item {
height: auto;
}
::v-deep .u-form-item + .u-form-item {
border-top: 1rpx solid rgba(233, 233, 233, 0.76);
}
}
.btn-box {
margin-top: 60rpx;
display: flex;
background: #ffffff;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 56, 93, 0.12);
border-radius: 13rpx 13rpx 0rpx 0rpx;
padding: 25rpx 50rpx;
position: sticky;
bottom: 0rpx;
z-index: 999;
::v-deep button {
border-radius: 43rpx;
}
}
</style>

View File

@ -1,6 +1,9 @@
<template>
<view class="c-card">
<view class="search">
<view class="type" @click="state.isShowType = true"
>全部分类<u-icon name="arrow-down"></u-icon>
</view>
<u-search
placeholder="请输入供应商名称"
v-model="state.name"
@ -10,24 +13,40 @@
:placeholderColor="'#C1C1C1'"
@search="handleSearch()"
></u-search>
<view class="btn"> 新增 </view>
<view class="btn" @click="addSupplier"> 新增 </view>
</view>
<view class="box" v-for="(item, index) in pageList.list" :key="index">
<view>
<view>
<view>{{ item.name }}</view>
<view>卡号{{ item.cardCode }}</view>
</view>
<view class="btn"> 删除 </view>
<view class="op-box">
<view class="btn" @click="edit(item)"> 编辑 </view>
<view class="btn" @click="update(item)"> 删除 </view>
</view>
</view>
</view>
</view>
<u-action-sheet
:actions="state.typeList"
:title="'供应商分类'"
:show="state.isShowType"
:closeOnClickOverlay="true"
:closeOnClickAction="true"
@close="state.isShowType = false"
@select="handleSelect"
></u-action-sheet>
</template>
<script setup lang="ts">
import { ProfileApi } from "@/services";
import { SupplierApi } from "@/services";
import { UsersType } from "@/utils/enum";
const state = reactive({
const state = reactive<any>({
name: "",
supplierTypeId: -1,
isShowType: false,
typeList: [],
});
const pageList: PageResult<User> = reactive({
total: 0,
@ -35,16 +54,41 @@ const pageList: PageResult<User> = reactive({
pageNum: 1,
pageSize: 10,
});
const handleSelect = (v: any) => {
state.supplierTypeId = v.id;
getUserList();
};
const handleSearch = () => {
getUserList()
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), //
});
};
const getUserList = () => {
ProfileApi.getInventoryUserPage({
let params: any = {
pageSize: 10,
pageNum: 1,
userType: UsersType.Purchaser,
name: state.name,
}).then((res) => {
};
if (state.supplierTypeId > -1) {
params.supplierTypeId = state.supplierTypeId;
}
SupplierApi.getSupplierUserPage(params).then((res) => {
if (res.code === 200) {
if (res.code === 200) {
(pageList as any).list = (res.data as any).list;
@ -52,8 +96,21 @@ const getUserList = () => {
}
});
};
const getSupplierTypeList = () => {
SupplierApi.getSupplierTypeList().then((res) => {
if (res.code === 200) {
state.typeList = res.data;
}
});
};
const addSupplier = () => {
uni.navigateTo({
url: "/pagesApp/components/addSupplier", //
});
};
onMounted(() => {
getUserList();
getSupplierTypeList();
});
</script>
<style lang="scss" scoped>
@ -63,12 +120,18 @@ onMounted(() => {
display: flex;
align-items: center;
justify-content: space-between;
.type {
display: flex;
margin-right: 20rpx;
font-size: 28rpx;
color: #000000;
}
.btn {
background: #00dcee;
border-radius: 24rpx;
border: 1px solid #00dcee;
font-weight: 500;
font-size: 26rpx;
font-size: 28rpx;
color: #ffffff;
margin-left: 50rpx;
padding: 6rpx 30rpx;
@ -80,7 +143,7 @@ onMounted(() => {
border-radius: 13rpx;
padding: 10rpx 25rpx;
font-weight: 400;
font-size: 26rpx;
font-size: 28rpx;
color: #000000;
line-height: 41rpx;
margin-top: 30rpx;
@ -89,18 +152,25 @@ onMounted(() => {
align-items: center;
justify-content: space-between;
padding: 20rpx 0rpx;
.btn {
background: #ff9d55;
border-radius: 24rpx;
font-weight: 500;
font-size: 26rpx;
color: #ffffff;
padding: 6rpx 30rpx;
}
.btn_text {
font-weight: 500;
font-size: 24rpx;
color: #00dcee;
.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;
}
}
}
> view + view {

38
src/services/customer.ts Normal file
View File

@ -0,0 +1,38 @@
import { http } from '@/utils/http'
// 添加客户
export const addCustomUser = (data: any) => {
return http({
method: 'POST',
url: '/api/custom/user/addCustomUser',
data,
})
}
// 修改客户
export const updateCustomUser = (data: any) => {
return http({
method: 'POST',
url: '/api/custom/user/updateCustomUser',
data,
})
}
// 查询客户分页
export const getCustomUserPage = (data: any) => {
return http({
method: 'GET',
url: '/api/custom/user/getCustomUserPage',
data,
})
}
// 查询客户列表
export const getCustomUserList = (data: any) => {
return http({
method: 'GET',
url: '/api/custom/user/getCustomUserList',
data,
})
}

View File

@ -6,3 +6,5 @@ export * as ReceiveProductApi from './receiveProduct'
export * as DeviceApi from './device'
export * as StockCardApi from './stockCard'
export * as GoodsApi from './goods'
export * as SupplierApi from './supplier'
export * as CustomerApi from './customer'

72
src/services/supplier.ts Normal file
View File

@ -0,0 +1,72 @@
import { http } from '@/utils/http'
// 供应商分类
export const addSupplierType = (data: any) => {
return http({
method: 'POST',
url: '/api/supplier/type/addSupplierType',
data,
})
}
// 供应商分类修改
export const updateSupplierType = (data: any) => {
return http({
method: 'POST',
url: '/api/supplier/type/updateSupplierType',
data,
})
}
// 查询供应商分类分页
export const getSupplierTypePage = (data: any) => {
return http({
method: 'GET',
url: '/api/supplier/type/getSupplierTypePage',
data,
})
}
// 查询供应商分类列表
export const getSupplierTypeList = () => {
return http({
method: 'GET',
url: '/api/supplier/type/getSupplierTypeList',
})
}
// 查询供应商分类列表
export const addSupplierUser = (data: any) => {
return http({
method: 'POST',
url: '/api/supplier/user/addSupplierUser',
data,
})
}
// 修改供应商
export const updateSupplierUser = (data: any) => {
return http({
method: 'POST',
url: '/api/supplier/user/updateSupplierUser',
data,
})
}
//查询供应商分页
export const getSupplierUserPage = (data: any) => {
return http({
method: 'GET',
url: '/api/supplier/user/getSupplierUserPage',
data,
})
}
//查询供应商列表
export const getSupplierUserList = (data: any) => {
return http({
method: 'GET',
url: '/api/supplier/user/getSupplierUserList',
data,
})
}