|
|
@@ -6,25 +6,27 @@
|
|
|
</template>
|
|
|
<Form ref="formRef" class="g-form__container" @submit="onSubmit">
|
|
|
<CellGroup inset>
|
|
|
- <Field label="商品" readonly :model-value="`${selectedRow.goodscode}/${selectedRow.goodsname}`"></Field>
|
|
|
- <Field label="数量" type="number" name="Qty" v-model.trim="formData.Qty" placeholder="请输入数量" :rules="formRules.Qty">
|
|
|
+ <Field label="商品" readonly :model-value="`${selectedRow.goodscode}/${selectedRow.goodsname}`">
|
|
|
+ </Field>
|
|
|
+ <Field label="数量" type="number" name="Qty" v-model.trim="formData.Qty" placeholder="请输入"
|
|
|
+ :rules="formRules.Qty">
|
|
|
<template #button>
|
|
|
<span>{{ selectedRow.goodunit }}</span>
|
|
|
</template>
|
|
|
</Field>
|
|
|
- <Field label="库存量" v-if="inOutType != 1" readonly :model-value="`${selectedRow.curqty}${selectedRow.goodunit}`"></Field>
|
|
|
- <Field label="方式" v-if="inOutType != 1" v-model="InOutModel" name="InOutModel" :rules="formRules.InOutModel" is-link @click-input="show = true" />
|
|
|
- <Field type="textarea" maxlength="250" autosize show-word-limit name="Remark" label="备注" v-model.trim="formData.Remark" placeholder="请输入备注" />
|
|
|
- </CellGroup>
|
|
|
- <Popup v-model:show="show" position="bottom" teleport="body" round>
|
|
|
- <Picker :columns="datalist" @cancel="onCancel" @confirm="onConfirm" >
|
|
|
- <template #option="{ text, index }">
|
|
|
- <slot name="option" :row="datalist[index]" :index="index">
|
|
|
- <span>{{ text }}</span>
|
|
|
- </slot>
|
|
|
+ <Field label="库存量" v-if="inOutType != 1" readonly
|
|
|
+ :model-value="`${selectedRow.curqty}${selectedRow.goodunit}`">
|
|
|
+ </Field>
|
|
|
+ <Field name="InOutModel" label="方式" :rules="formRules.InOutModel" is-link>
|
|
|
+ <template #input>
|
|
|
+ <app-select v-model="formData.InOutModel" :options="getAppointmentModelOutList()"
|
|
|
+ :optionProps="{ label: 'label', value: 'value' }"
|
|
|
+ @confirm="formRef?.validate('InOutModel')" />
|
|
|
</template>
|
|
|
- </Picker>
|
|
|
- </Popup>
|
|
|
+ </Field>
|
|
|
+ <Field type="textarea" maxlength="250" autosize show-word-limit name="Remark" label="备注"
|
|
|
+ v-model.trim="formData.Remark" placeholder="请输入" />
|
|
|
+ </CellGroup>
|
|
|
</Form>
|
|
|
<template #footer>
|
|
|
<div class="g-form__footer inset">
|
|
|
@@ -37,16 +39,15 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { shallowRef, PropType, computed, onMounted } from 'vue'
|
|
|
-import { Popup, Picker, PickerConfirmEventParams, Form, Field, CellGroup, FormInstance, Button, FieldRule } from 'vant'
|
|
|
+import { shallowRef, PropType } from 'vue'
|
|
|
+import { Form, Field, CellGroup, FormInstance, Button, FieldRule } from 'vant'
|
|
|
import { fullloading } from '@/utils/vant'
|
|
|
import { useGoodsInventoryApply } from '@/business/trade';
|
|
|
import { getAppointmentModelOutList } from '@/constants/order';
|
|
|
import AppModal from '@/components/base/modal/index.vue'
|
|
|
+import AppSelect from '@mobile/components/base/select/index.vue'
|
|
|
import { useFuturesStore } from '@/stores';
|
|
|
|
|
|
-// 是否弹出选择器
|
|
|
-const show = shallowRef(false)
|
|
|
const showModal = shallowRef(true)
|
|
|
const refresh = shallowRef(false) // 是否刷新父组件数据
|
|
|
const formRef = shallowRef<FormInstance>()
|
|
|
@@ -54,20 +55,6 @@ const formRef = shallowRef<FormInstance>()
|
|
|
const { formData, formSubmit } = useGoodsInventoryApply()
|
|
|
const futuresStore = useFuturesStore()
|
|
|
|
|
|
-const datalist = computed(() => {
|
|
|
- return getAppointmentModelOutList().map(e => {
|
|
|
- return { text: e.label, value: e.value }
|
|
|
- })
|
|
|
-})
|
|
|
-
|
|
|
-const InOutModel = shallowRef(datalist.value[0].text)
|
|
|
-
|
|
|
-const onConfirm = ({ selectedOptions: [option] }: PickerConfirmEventParams) => {
|
|
|
- show.value = false
|
|
|
- formData.InOutModel = Number(option?.value)
|
|
|
- InOutModel.value = option?.text?.toString() ?? ''
|
|
|
-}
|
|
|
-
|
|
|
const props = defineProps({
|
|
|
selectedRow: {
|
|
|
type: Object as PropType<Model.UserGoodsInventoryRsp>,
|
|
|
@@ -80,10 +67,10 @@ const props = defineProps({
|
|
|
})
|
|
|
|
|
|
// 表单验证规则
|
|
|
-const formRules: { [key in keyof Proto.GoodsInventoryApplyReq]?: FieldRule[] } = {
|
|
|
+const formRules: { [key: string]: FieldRule[] } = {
|
|
|
Qty: [{
|
|
|
- message: '请输入数量',
|
|
|
required: true,
|
|
|
+ message: '请输入数量',
|
|
|
validator: (val) => {
|
|
|
if (props.inOutType === 2 && val > props.selectedRow.curqty) {
|
|
|
return '超过库存量'
|
|
|
@@ -91,15 +78,16 @@ const formRules: { [key in keyof Proto.GoodsInventoryApplyReq]?: FieldRule[] } =
|
|
|
return !!formData.Qty
|
|
|
}
|
|
|
}],
|
|
|
-}
|
|
|
-
|
|
|
-const onCancel = () => {
|
|
|
- show.value = false
|
|
|
+ InOutModel: [{
|
|
|
+ message: '请选择方式',
|
|
|
+ validator: () => {
|
|
|
+ return !!formData.InOutModel
|
|
|
+ }
|
|
|
+ }]
|
|
|
}
|
|
|
|
|
|
const onSubmit = () => {
|
|
|
-
|
|
|
- const { goodsid } = props.selectedRow
|
|
|
+ const { goodsid } = props.selectedRow
|
|
|
const { marketid } = futuresStore.getGoods(goodsid) ?? {}
|
|
|
formData.Header = { GoodsID: goodsid, MarketID: marketid }
|
|
|
formData.InoutType = props.inOutType
|
|
|
@@ -125,8 +113,4 @@ const closed = (isRefresh = false) => {
|
|
|
defineExpose({
|
|
|
closed,
|
|
|
})
|
|
|
-
|
|
|
-onMounted(() => {
|
|
|
- formData.InOutModel = getAppointmentModelOutList()[0]?.value
|
|
|
-})
|
|
|
</script>
|