update: 供应商分类、供应商管理、客户管理、库存卡管理

This commit is contained in:
admin 2024-04-17 17:03:55 +08:00
parent 954126079a
commit 3f3b65c9a7
13 changed files with 198 additions and 31 deletions

View File

@ -31,6 +31,8 @@
:clearable="true"
:customStyle="{}"
border="none"
:disabled="item.type === 'select'"
disabledColor="#ffffff"
>
<template #suffix>
<text>
@ -110,6 +112,10 @@ const formAttrList = reactive<any>([
childKey: "stockCard",
required: true,
fn: () => {
if (contrlModalParams.stockCard.list.length === 0) {
uni.showToast({icon: 'none', title: '当前无可用卡号,请添加出库卡'})
return
}
contrlModalParams.stockCard.isShow = true;
contrlModalParams.stockCard.title = "卡号";
},
@ -183,7 +189,7 @@ const startSave = () => {
};
const getStockCardList = () => {
StockCardApi.getStockCardListInfo({ vincolante: StockCardType.Receive }).then((res) => {
StockCardApi.getStockCardListInfo({ vincolante: StockCardType.Shipment }).then((res) => {
if (res.code === 200) {
contrlModalParams.stockCard.list = (res.data as any).map(
(item: any) => {

View File

@ -23,14 +23,16 @@
:placeholder="`请输入${item.name}`"
></u-textarea>
<u-input
v-if="item.type === 'select' || item.type === 'input'"
v-if="item.type === 'select' || item.type === 'input' || item.type === 'selectCustom'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`${item.type === 'select' ? '选择' : '输入'}${
:placeholder="`${item.type.indexOf('select') > -1 ? '选择' : '输入'}${
item.name
}`"
:clearable="true"
:customStyle="{}"
border="none"
:disabled="item.type === 'selectCustom'"
disabledColor="#ffffff"
>
<template #suffix>
<text>
@ -38,14 +40,14 @@
</text>
</template>
</u-input>
<template #right v-if="item.type === 'select'">
<template #right v-if="item.type === 'select' || item.type === 'selectCustom'">
<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'"
v-if="item.type === 'select' || item.type === 'selectCustom'"
:actions="contrlModalParams[item.childKey].list"
:title="contrlModalParams[item.childKey].title"
:show="contrlModalParams[item.childKey].isShow"
@ -110,7 +112,7 @@ const formAttrList = reactive<any>([
{
name: "类型",
key: "typeName",
type: "select",
type: "selectCustom",
childKey: "cardType",
required: true,
fn: () => {

View File

@ -31,6 +31,9 @@
:clearable="true"
:customStyle="{}"
border="none"
@change="(e:any) => {handleInput(e, item)}"
:disabled="item.type === 'select'"
disabledColor="#ffffff"
>
<template #suffix>
<text>
@ -63,9 +66,17 @@
import { StockCardApi, SupplierApi } from "@/services";
import { formatDate } from "@/utils";
import { DeviceType, ImagesType, OrderType, StockCardType } from "@/utils/enum";
import valid from "@/utils/validate";
import { onLoad } from "@dcloudio/uni-app";
import _ from "underscore";
const handleInput = (e: any, item: any) => {
if (item.key === "phone" || item.key === 'bankNumber') {
const temp = e?.replace(valid.valid_number, "");
setTimeout(() => {
model1.formData[item.key] = temp;
}, 100);
}
};
const model1 = reactive<any>({
formData: {},
});
@ -114,6 +125,10 @@ const formAttrList = reactive<any>([
childKey: "stockCard",
required: true,
fn: () => {
if (contrlModalParams.stockCard.list.length === 0) {
uni.showToast({icon: 'none', title: '当前无可用卡号,请添加入库卡'})
return
}
contrlModalParams.stockCard.isShow = true;
contrlModalParams.stockCard.title = "卡号";
},
@ -221,6 +236,18 @@ const check = () => {
};
const save = () => {
if (model1.formData.phone) {
if (!valid.mobile.pattern.test(model1.formData.phone)) {
uni.showToast({ icon: "none", title: "请输入正确的手机号" });
return;
}
}
if (model1.formData.card) {
if (!valid.valid_id_card.pattern.test(model1.formData.card)) {
uni.showToast({ icon: "none", title: "请输入正确的身份证号码" });
return;
}
}
check().then((res) => {
if (res) {
startSave();

View File

@ -24,7 +24,7 @@
></u-textarea>
<u-input
v-if="item.type === 'select' || item.type === 'input'"
:password="item.name === 'password'"
:password="item.key === 'password'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`${item.type === 'select' ? '选择' : '输入'}${
item.name
@ -32,6 +32,10 @@
:clearable="true"
:customStyle="{}"
border="none"
:maxlength="item.key === 'password' ? 6 : -1"
@change="(e:any) => {handleInput(e, item)}"
:disabled="item.type === 'select'"
disabledColor="#ffffff"
>
<template #suffix>
<text>
@ -64,11 +68,20 @@
import { ProfileApi, StockCardApi } from "@/services";
import { formatDate } from "@/utils";
import { DeviceType, ImagesType, OrderType, StockCardType } from "@/utils/enum";
import valid from "@/utils/validate";
import { onLoad } from "@dcloudio/uni-app";
import _ from "underscore";
const handleInput = (e: any, item: any) => {
if (item.key === "phone") {
const temp = e?.replace(valid.valid_number, "");
setTimeout(() => {
model1.formData[item.key] = temp;
}, 100);
}
};
const model1 = reactive<any>({
formData: {},
formData: {
},
});
const rules = ref({
"formData.userName": {
@ -159,7 +172,7 @@ const handleSelect = (key: string, v: any) => {
}
if (key === "gender") {
model1.formData.genderName = v.name;
model1.formData.genderId = v.id;
model1.formData.gender = v.id;
}
};
@ -182,6 +195,12 @@ const check = () => {
};
const save = () => {
if (model1.formData.phone) {
if (!valid.mobile.pattern.test(model1.formData.phone)) {
uni.showToast({ icon: "none", title: "请输入正确的手机号" });
return;
}
}
check().then((res) => {
if (res) {
startSave();
@ -227,11 +246,11 @@ onMounted(() => {
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 = "入库卡";
const obj = JSON.parse((option as any).item)
model1.formData = {...obj, genderName: ['未知','男','女'][obj.gender]};
if (obj.roleVos.length > 0) {
model1.formData.roleIds = [obj.roleVos[0].id]
model1.formData.roleName = obj.roleVos[0].roleName
}
// ;
if (title) {

View File

@ -33,17 +33,38 @@
</view>
<view class="op-box">
<view class="btn" @click="edit(item)"> 编辑 </view>
<view class="btn" @click="deleteCustomer(item)"> 删除 </view>
<view class="btn" @click="handleModal(true, item.id)"> 删除 </view>
</view>
</view>
</view>
</page-view>
</view>
<SmallModal
:title="'确认删除吗?'"
:content="'确认删除后,不能恢复!'"
:okText="'确认删除'"
:isMain="true"
:show="isShowCancelModal"
@handleModal="(v:boolean) => {handleModal(v, deleteId)}"
@handleOk="handleOk()"
/>
</template>
<script setup lang="ts">
import { CustomerApi } from "@/services";
import { UsersType } from "@/utils/enum";
import PageView from "@/components/PageView/index.vue";
import type { Customer } from "@/types/user";
import SmallModal from "@/components/Modal/smallModal.vue";
const isShowCancelModal = ref(false);
const deleteId = ref(0);
const handleModal = (v: boolean, id: number) => {
isShowCancelModal.value = v;
deleteId.value = id;
};
const handleOk = () => {
deleteCustomer({id: deleteId.value})
};
const state = reactive<any>({
name: "",
});

View File

@ -40,17 +40,37 @@
</view>
<view class="op-box">
<view class="btn" @click="edit(item)"> 编辑 </view>
<view class="btn" @click="deleteCustomer(item)"> 删除 </view>
<view class="btn" @click="handleModal(true, item.id)"> 删除 </view>
</view>
</view>
</view>
</page-view>
</view>
<SmallModal
:title="'确认删除吗?'"
:content="'确认删除后,不能恢复!'"
:okText="'确认删除'"
:isMain="true"
:show="isShowCancelModal"
@handleModal="(v:boolean) => {handleModal(v, deleteId)}"
@handleOk="handleOk()"
/>
</template>
<script setup lang="ts">
import { StockCardApi } from "@/services";
import { StockCardType } from "@/utils/enum";
import PageView from "@/components/PageView/index.vue";
import SmallModal from "@/components/Modal/smallModal.vue";
const isShowCancelModal = ref(false);
const deleteId = ref(0);
const handleModal = (v: boolean, id: number) => {
isShowCancelModal.value = v;
deleteId.value = id;
};
const handleOk = () => {
deleteStockCard({id: deleteId.value})
};
const state = reactive<any>({
name: "",
@ -80,7 +100,7 @@ const edit = (item: any) => {
JSON.stringify(item), //
});
};
const deleteCustomer = (item: any) => {
const deleteStockCard = (item: any) => {
StockCardApi.updateStockCard({ isDeleted: true, id: item.id }).then((res) => {
if (res.code === 200) {
resetPageList();

View File

@ -35,7 +35,7 @@
</view>
<view class="op-box">
<view class="btn" @click="edit(item)"> 编辑 </view>
<view class="btn" @click="update(item)"> 删除 </view>
<view class="btn" @click="handleModal(true, item.id)"> 删除 </view>
</view>
</view>
</view>
@ -50,18 +50,38 @@
@close="state.isShowType = false"
@select="handleSelect"
></u-action-sheet>
<SmallModal
:title="'确认删除吗?'"
:content="'确认删除后,不能恢复!'"
:okText="'确认删除'"
:isMain="true"
:show="isShowCancelModal"
@handleModal="(v:boolean) => {handleModal(v, deleteId)}"
@handleOk="handleOk()"
/>
</template>
<script setup lang="ts">
import { SupplierApi } from "@/services";
import { UsersType } from "@/utils/enum";
import PageView from "@/components/PageView/index.vue";
import SmallModal from "@/components/Modal/smallModal.vue";
const isShowCancelModal = ref(false);
const deleteId = ref(0);
const handleModal = (v: boolean, id: number) => {
isShowCancelModal.value = v;
deleteId.value = id;
};
const handleOk = () => {
update({id: deleteId.value})
};
const state = reactive<any>({
name: "",
supplierTypeId: -1,
isShowType: false,
typeList: [],
});
const pageList: PageResult<User> = reactive({
const pageList: PageResult<Supplier> = reactive({
total: 0,
list: [],
pageNum: 1,

View File

@ -30,23 +30,40 @@
</view>
<view class="op-box">
<view class="btn" @click="edit(item)"> 编辑 </view>
<view class="btn" @click="deleteType(item)"> 删除 </view>
<view class="btn" @click="handleModal(true, item.id)"> 删除 </view>
</view>
</view>
</view>
</page-view>
</view>
<SmallModal
:title="'确认删除吗?'"
:content="'确认删除后,不能恢复!'"
:okText="'确认删除'"
:isMain="true"
:show="isShowCancelModal"
@handleModal="(v:boolean) => {handleModal(v, deleteId)}"
@handleOk="handleOk()"
/>
</template>
<script setup lang="ts">
import { StockCardApi, SupplierApi } from "@/services";
import PageView from "@/components/PageView/index.vue";
const keyword = ref("");
import SmallModal from "@/components/Modal/smallModal.vue";
const isShowCancelModal = ref(false);
const deleteId = ref(0);
const handleModal = (v: boolean, id: number) => {
isShowCancelModal.value = v;
deleteId.value = id;
};
const handleOk = () => {
deleteType({id: deleteId.value})
};
const state = reactive<any>({
name: "",
});
const pageList: PageResult<StockCard> = reactive({
const pageList: PageResult<SupplierType> = reactive({
noMoreData: false,
total: 0,
list: [],

View File

@ -35,20 +35,38 @@
</view>
<view class="op-box">
<view class="btn" @click="edit(item)"> 编辑 </view>
<view class="btn" @click="deleteCustomer(item)"> 下线 </view>
<view class="btn" @click="handleModal(true, item.id)"> 删除 </view>
</view>
</view>
</view>
</page-view>
</view>
<SmallModal
:title="'确认删除吗?'"
:content="'确认删除后,不能恢复!'"
:okText="'确认删除'"
:isMain="true"
:show="isShowCancelModal"
@handleModal="(v:boolean) => {handleModal(v, deleteId)}"
@handleOk="handleOk()"
/>
</template>
<script setup lang="ts">
import PageView from "@/components/PageView/index.vue";
import { ProfileApi, StockCardApi } from "@/services";
import { pageListInit } from "@/utils";
import { StockCardType } from "@/utils/enum";
import { ProfileApi } from "@/services";
import type { User } from "@/types/user";
import SmallModal from "@/components/Modal/smallModal.vue";
const keyword = ref("");
const isShowCancelModal = ref(false);
const deleteId = ref(0);
const handleModal = (v: boolean, id: number) => {
isShowCancelModal.value = v;
deleteId.value = id;
};
const handleOk = () => {
deleteCustomer({id: deleteId.value})
};
const state = reactive<any>({
name: "",
@ -75,6 +93,7 @@ const edit = (item: any) => {
const deleteCustomer = (item: any) => {
ProfileApi.updateUserByIdOffline({ id: item.id }).then((res) => {
if (res.code === 200) {
resetPageList();
getList();
}
});

10
src/types/baseInfo.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
type SupplierType = {
id: number,
name: string
}
type Supplier = {
id: number,
name: string,
cardCode: string,
}

View File

@ -207,6 +207,7 @@ interface ReceiveProduct {
// 库存卡
interface StockCard {
id: number
cardCode?: string,
type?: number, // 库存卡类型1=出库2=入库
cardCode?: string,

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

@ -16,6 +16,7 @@ export type User = {
} & BaseField;
interface Customer {
id: number,
name?: string,
stockCardId?: number,
contacts?:string,

View File

@ -24,6 +24,10 @@ const valid = {
valid_decimal: {
pattern: /[^0-9.]/g,
message: "请输入正确的数字",
},
valid_id_card: {
pattern: /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
message: '请输入正确的身份证号码'
}
};
export default valid;