This repository has been archived by the owner on Oct 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from Jzow/master
Add product stock modal views
- Loading branch information
Showing
5 changed files
with
414 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export interface ProductStockResp { | ||
id: number | string; | ||
warehouseId: number | string; | ||
warehouseName: string; | ||
initStockQuantity: number; | ||
lowStockQuantity: number; | ||
highStockQuantity: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 122 additions & 0 deletions
122
src/views/product/info/components/BatchSetPriceModal.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
<template> | ||
<a-modal | ||
:title="title" | ||
:width="500" | ||
v-model:open="openPriceModal" | ||
:confirm-loading="confirmLoading" | ||
:mask-style="{'top':'93px','left':'154px'}" | ||
:mask-closable="false" | ||
@ok="handleOk" | ||
@cancel="handleCancel" | ||
style="top:30%;height: 30%;"> | ||
<a-spin :spinning="confirmLoading"> | ||
<a-form ref="formRef" :rules="rules" :label-col="labelCol" :wrapper-col="wrapperCol"> | ||
<a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="请输入价格"> | ||
<a-input-number placeholder="请输入价格" v-model:value="batchPrice" /> | ||
</a-form-item> | ||
</a-form> | ||
</a-spin> | ||
</a-modal> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { ref, reactive, UnwrapRef } from 'vue'; | ||
import {Button, Form, FormItem, InputNumber, Modal, Spin} from "ant-design-vue"; | ||
import {Rule} from 'ant-design-vue/es/form'; | ||
interface FormState { | ||
batchPrice: number; | ||
} | ||
export default { | ||
name: 'BatchSetPriceModal', | ||
components: { | ||
'a-modal': Modal, | ||
'a-button': Button, | ||
'a-spin': Spin, | ||
'a-form': Form, | ||
'a-form-item': FormItem, | ||
'a-input-number': InputNumber | ||
}, | ||
setup(_, context) { | ||
const title = ref('批量设置'); | ||
const openPriceModal = ref(false); | ||
const isReadOnly = ref(false); | ||
const batchPrice = ref(''); | ||
const batchType = ref(''); | ||
const model = reactive({}); | ||
const labelCol = { | ||
xs: { span: 24 }, | ||
sm: { span: 5 }, | ||
}; | ||
const wrapperCol = { | ||
xs: { span: 24 }, | ||
sm: { span: 16 }, | ||
}; | ||
const confirmLoading = ref(false); | ||
const formRef = ref(); | ||
const rules: Record<string, Rule[]> = { | ||
batchPrice: [ | ||
{required: true, message: '请输入价格', trigger: 'change'}, | ||
] | ||
} | ||
const add = (type) => { | ||
openPriceModal.value = true | ||
batchType.value = type; | ||
if (type === 'purchase') { | ||
title.value = '采购价-批量设置'; | ||
} else if (type === 'retail') { | ||
title.value = '零售价-批量设置'; | ||
} else if (type === 'sale') { | ||
title.value = '销售价-批量设置'; | ||
} else if (type === 'low') { | ||
title.value = '最低售价-批量设置'; | ||
} | ||
// formRef.value.resetFields(); | ||
}; | ||
const edit = (record) => { | ||
openPriceModal.value = true | ||
}; | ||
const close = () => { | ||
openPriceModal.value = false | ||
}; | ||
const handleOk = () => { | ||
const price = batchPrice.value | ||
context.emit('ok', price, batchType.value); | ||
openPriceModal.value = false | ||
}; | ||
const handleCancel = () => { | ||
close(); | ||
}; | ||
return { | ||
title, | ||
isReadOnly, | ||
batchType, | ||
model, | ||
labelCol, | ||
wrapperCol, | ||
confirmLoading, | ||
formRef, | ||
add, | ||
edit, | ||
close, | ||
handleOk, | ||
handleCancel, | ||
openPriceModal, | ||
batchPrice, | ||
rules | ||
}; | ||
} | ||
}; | ||
</script> | ||
|
||
<style scoped> | ||
</style> |
107 changes: 107 additions & 0 deletions
107
src/views/product/info/components/BatchSetStockModal.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<template> | ||
<a-modal | ||
:title="title" | ||
:width="500" | ||
v-model:open="openStockModal" | ||
:confirm-loading="confirmLoading" | ||
:mask-style="{'top':'93px','left':'154px'}" | ||
:mask-closable="false" | ||
@ok="handleOk" | ||
@cancel="handleCancel" | ||
style="top:30%;height: 30%;"> | ||
<a-spin :spinning="confirmLoading"> | ||
<a-form ref="formRef" :label-col="labelCol" :wrapper-col="wrapperCol"> | ||
<a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="请输入数量"> | ||
<a-input-number placeholder="请输入数量" v-model:value="batchNumber" /> | ||
</a-form-item> | ||
</a-form> | ||
</a-spin> | ||
</a-modal> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { ref, reactive, UnwrapRef } from 'vue'; | ||
import {Button, Form, FormItem, InputNumber, Modal, Spin} from "ant-design-vue"; | ||
export default { | ||
name: 'BatchSetStockModal', | ||
components: { | ||
'a-modal': Modal, | ||
'a-button': Button, | ||
'a-spin': Spin, | ||
'a-form': Form, | ||
'a-form-item': FormItem, | ||
'a-input-number': InputNumber | ||
}, | ||
setup(_, context) { | ||
const title = ref('批量设置'); | ||
const openStockModal = ref(false); | ||
const isReadOnly = ref(false); | ||
const batchNumber = ref(''); | ||
const batchType = ref(''); | ||
const model = reactive({}); | ||
const labelCol = { | ||
xs: { span: 24 }, | ||
sm: { span: 5 }, | ||
}; | ||
const wrapperCol = { | ||
xs: { span: 24 }, | ||
sm: { span: 16 }, | ||
}; | ||
const confirmLoading = ref(false); | ||
const formRef = ref(); | ||
const add = (type) => { | ||
openStockModal.value = true | ||
batchType.value = type; | ||
if (type === 'initStock') { | ||
title.value = '期初库存-批量设置'; | ||
} else if (type === 'lowSafeStock') { | ||
title.value = '最低安全库存-批量设置'; | ||
} else if (type === 'highSafeStock') { | ||
title.value = '最高安全库存-批量设置'; | ||
} | ||
}; | ||
const edit = (record) => { | ||
openStockModal.value = true | ||
}; | ||
const close = () => { | ||
openStockModal.value = false | ||
}; | ||
const handleOk = () => { | ||
const stockNumber = batchNumber.value | ||
context.emit('ok', stockNumber, batchType.value); | ||
openStockModal.value = false | ||
}; | ||
const handleCancel = () => { | ||
close(); | ||
}; | ||
return { | ||
title, | ||
isReadOnly, | ||
batchType, | ||
model, | ||
labelCol, | ||
wrapperCol, | ||
confirmLoading, | ||
formRef, | ||
add, | ||
edit, | ||
close, | ||
handleOk, | ||
handleCancel, | ||
openStockModal, | ||
batchNumber, | ||
}; | ||
} | ||
}; | ||
</script> | ||
|
||
<style scoped> | ||
</style> |
Oops, something went wrong.