update: 更新库存卡

This commit is contained in:
admin 2024-03-16 21:26:04 +08:00
parent 05dcacd062
commit 028b83b6a8
18 changed files with 670 additions and 26 deletions

View File

@ -311,11 +311,29 @@
"navigationBarTitleText": "客户管理"
}
},
{
"path": "stockCard",
"style": {
"navigationBarTitleText": "库存卡管理"
}
},
{
"path": "components/addSupplier",
"style": {
"navigationBarTitleText": "新增供应商"
}
},
{
"path": "components/addCustomer",
"style": {
"navigationBarTitleText": "新增客户"
}
},
{
"path": "components/addStockCard",
"style": {
"navigationBarTitleText": "新增库存卡"
}
}
]
}

View File

@ -0,0 +1,211 @@
<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 { CustomerApi, StockCardApi } 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: "卡号",
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: "contacts",
type: "input",
required: true,
unit: "",
},
]);
const handleSelect = (key: string, v: any) => {
contrlModalParams[key].isShow = false;
if (key === "stockCard") {
model1.formData.stockCardName = v.name;
model1.formData.stockCardId = v.id;
}
};
const save = () => {
if (model1.formData.id) {
CustomerApi.updateCustomUser(model1.formData).then((res) => {
if (res.code === 200) {
uni.redirectTo({
url: "/pagesApp/customerMgt", //
});
}
});
} else {
CustomerApi.addCustomUser(model1.formData).then((res) => {
if (res.code === 200) {
uni.redirectTo({
url: "/pagesApp/customerMgt", //
});
}
});
}
};
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(() => {
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

@ -0,0 +1,191 @@
<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 } from "@/services";
import { formatDate } from "@/utils";
import { DeviceType, ImagesType, OrderType, StockCardType } 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>({
cardType: {
isShow: false,
title: "标题",
list: [{
id: 1,
name: '出库卡'
},{
id: 2,
name: '入库卡'
}],
}
});
const formAttrList = reactive<any>([
{
name: "卡号",
key: "cardCode",
type: "input",
required: true,
},
{
name: "类型",
key: "typeName",
type: "select",
childKey: "cardType",
required: true,
fn: () => {
contrlModalParams.cardType.isShow = true;
contrlModalParams.cardType.title = "库存卡类型";
},
},
]);
const handleSelect = (key: string, v: any) => {
contrlModalParams[key].isShow = false;
if (key === "cardType") {
model1.formData.typeName = v.name;
model1.formData.type = v.id;
}
};
const save = () => {
if (model1.formData.id) {
StockCardApi.updateStockCard(model1.formData).then((res) => {
if (res.code === 200) {
uni.redirectTo({
url: "/pagesApp/stockCard", //
});
}
});
} else {
StockCardApi.addStockCard(model1.formData).then((res) => {
if (res.code === 200) {
uni.redirectTo({
url: "/pagesApp/stockCard", //
});
}
});
}
};
onLoad((option) => {
//
const title = (option as any).title;
model1.formData = JSON.parse((option as any).item);
if (model1.formData.type === 1) {
model1.formData.typeName = '出库卡'
}else if (model1.formData.type === 2) {
model1.formData.typeName = '入库卡'
}
//
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

@ -199,7 +199,7 @@ const save = () => {
if (model1.formData.id) {
SupplierApi.updateSupplierUser(model1.formData).then((res) => {
if (res.code === 200) {
uni.navigateTo({
uni.redirectTo({
url: "/pagesApp/supplierMgt", //
});
}
@ -207,7 +207,7 @@ const save = () => {
} else {
SupplierApi.addSupplierUser(model1.formData).then((res) => {
if (res.code === 200) {
uni.navigateTo({
uni.redirectTo({
url: "/pagesApp/supplierMgt", //
});
}

View File

@ -3,28 +3,87 @@
<view class="search">
<u-search
placeholder="请输入客户名称"
v-model="keyword"
v-model="state.name"
:showAction="false"
:bgColor="'#fff'"
:borderColor="'rgba(0, 0, 0, 0.1)'"
:placeholderColor="'#C1C1C1'"
@search="handleSearch()"
></u-search>
<view class="btn"> 新增 </view>
<view class="btn" @click="add"> 新增 </view>
</view>
<view class="box">
<view v-for="item in 10" :key="item">
<view v-for="(item, index) in pageList.list" :key="index">
<view>
<view>客户名称</view>
<view>联系人张三</view>
<view>卡号235466566</view>
<view>{{ item.name }}</view>
<view>联系人{{ item.contacts }}</view>
<view>卡号{{ item.cardCode }}</view>
</view>
<view class="op-box">
<view class="btn" @click="edit(item)"> 编辑 </view>
<view class="btn" @click="deleteCustomer(item)"> 删除 </view>
</view>
<view class="btn"> 删除 </view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { CustomerApi } from "@/services";
const keyword = ref("");
const state = reactive<any>({
name: "",
});
const pageList: PageResult<Customer> = reactive({
total: 0,
list: [],
pageNum: 1,
pageSize: 10,
});
const add = () => {
uni.navigateTo({
url: "/pagesApp/components/addCustomer", //
});
};
const edit = (item: any) => {
uni.navigateTo({
url:
"/pagesApp/components/addCustomer?title=编辑客户&item=" +
JSON.stringify(item), //
});
};
const deleteCustomer = (item: any) => {
CustomerApi.updateCustomUser({ isDeleted: true, id: item.id }).then((res) => {
if (res.code === 200) {
getCustomUserPage();
}
});
};
const handleSearch = () => {
getCustomUserPage();
};
const getCustomUserPage = () => {
let params: any = {
pageSize: 10,
pageNum: 1,
name: state.name,
};
if (state.supplierTypeId > -1) {
params.supplierTypeId = state.supplierTypeId;
}
CustomerApi.getCustomUserPage(params).then((res) => {
if (res.code === 200) {
if (res.code === 200) {
(pageList as any).list = (res.data as any).list;
}
}
});
};
onMounted(() => {
getCustomUserPage();
});
</script>
<style lang="scss" scoped>
.c-card {
@ -38,7 +97,7 @@ const keyword = ref("");
border-radius: 24rpx;
border: 1px solid #00dcee;
font-weight: 500;
font-size: 24rpx;
font-size: 26rpx;
color: #ffffff;
margin-left: 50rpx;
padding: 6rpx 30rpx;
@ -50,7 +109,7 @@ const keyword = ref("");
border-radius: 13rpx;
padding: 10rpx 25rpx;
font-weight: 400;
font-size: 22rpx;
font-size: 26rpx;
color: #000000;
line-height: 41rpx;
margin-top: 30rpx;
@ -59,18 +118,19 @@ const keyword = ref("");
align-items: center;
justify-content: space-between;
padding: 20rpx 0rpx;
.btn {
background: #ff9d55;
border-radius: 24rpx;
font-weight: 500;
font-size: 24rpx;
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: 26rpx;
color: #ffffff;
padding: 6rpx 30rpx;
}
}
}
> view + view {

142
src/pagesApp/stockCard.vue Normal file
View File

@ -0,0 +1,142 @@
<template>
<view class="c-card">
<view class="search">
<u-search
placeholder="请输入库存卡号"
v-model="state.name"
:showAction="false"
:bgColor="'#fff'"
:borderColor="'rgba(0, 0, 0, 0.1)'"
:placeholderColor="'#C1C1C1'"
@search="handleSearch()"
></u-search>
<view class="btn" @click="add"> 新增 </view>
</view>
<view class="box">
<view v-for="(item, index) in pageList.list" :key="index">
<view>
<view>{{item.type === StockCardType.Shipment ? '客户' : '供应商'}}{{ item.name }}</view>
<view>卡号{{ item.cardCode }}</view>
<view>类型{{ item.type === StockCardType.Shipment ? '出库卡' : '入库卡' }}</view>
</view>
<view class="op-box">
<view class="btn" @click="edit(item)"> 编辑 </view>
<view class="btn" @click="deleteCustomer(item)"> 删除 </view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { StockCardApi } from "@/services";
import { StockCardType } from "@/utils/enum";
const keyword = ref("");
const state = reactive<any>({
name: "",
});
const pageList: PageResult<StockCard> = reactive({
total: 0,
list: [],
pageNum: 1,
pageSize: 10,
});
const add = () => {
uni.navigateTo({
url: "/pagesApp/components/addStockCard", //
});
};
const edit = (item: any) => {
uni.navigateTo({
url:
"/pagesApp/components/addStockCard?title=编辑库存卡&item=" +
JSON.stringify(item), //
});
};
const deleteCustomer = (item: any) => {
StockCardApi.updateStockCard({ isDeleted: true, id: item.id }).then((res) => {
if (res.code === 200) {
getList();
}
});
};
const handleSearch = () => {
getList();
};
const getList = () => {
let params: any = {
pageSize: 10,
pageNum: 1,
name: state.name,
};
if (state.supplierTypeId > -1) {
params.supplierTypeId = state.supplierTypeId;
}
StockCardApi.getStockCardList(params).then((res) => {
if (res.code === 200) {
if (res.code === 200) {
(pageList as any).list = (res.data as any).list;
}
}
});
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.c-card {
margin: 30rpx 25rpx;
.search {
display: flex;
align-items: center;
justify-content: space-between;
.btn {
background: #00dcee;
border-radius: 24rpx;
border: 1px solid #00dcee;
font-weight: 500;
font-size: 26rpx;
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;
padding: 10rpx 25rpx;
font-weight: 400;
font-size: 26rpx;
color: #000000;
line-height: 41rpx;
margin-top: 30rpx;
> view {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20rpx 0rpx;
.op-box {
display: flex;
.btn + .btn {
margin-left: 20rpx;
}
.btn {
background: #ff9d55;
border-radius: 24rpx;
font-weight: 500;
font-size: 26rpx;
color: #ffffff;
padding: 6rpx 30rpx;
}
}
}
> view + view {
border-top: 1px solid rgba(233, 233, 233, 0.76);
}
}
}
</style>

View File

@ -423,9 +423,9 @@ const appList = reactive([
icon: "16.png",
title: "库存卡管理",
fn: () => {
// uni.navigateTo({
// url: "/pagesApp/customerMgt", //
// });
uni.navigateTo({
url: "/pagesApp/stockCard", //
});
},
},
]);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -199,3 +199,12 @@ interface ReceiveProduct {
isDeleted?: boolean; //逻辑删除 TRUE=是 FALSE=否
}
// 库存卡
interface StockCard {
cardCode?: string,
type?: number, // 库存卡类型1=出库2=入库
cardCode?: string,
name?: string
}

7
src/types/user.d.ts vendored
View File

@ -20,3 +20,10 @@ interface User {
isDeleted: boolean;
cardCode?: string; // 卡号
}
interface Customer {
name?: string,
stockCardId?: number,
contacts?:string,
cardCode?: string,
}

View File

@ -77,3 +77,9 @@ export enum DeviceType {
Printer = 0,
Weighbridge = 1
}
// 1=出库客户2=入库(供应商)
export enum StockCardType {
Shipment = 1,
Receive = 2
}