Compare commits
2 Commits
93f1b3c4a0
...
3243671719
Author | SHA1 | Date |
---|---|---|
mkm | 3243671719 | |
mkm | 1bb586ba3f |
|
@ -2,9 +2,9 @@ NODE_ENV = 'production'
|
|||
# Base API
|
||||
|
||||
# 测试域名
|
||||
# VITE_NOW_TYPE = 'dist/admin'
|
||||
VITE_NOW_TYPE = 'dist/admin'
|
||||
# VITE_APP_BASE_URL='https://test-multi-store.lihaink.cn'
|
||||
# VITE_APP_BASE_URL='http://127.0.0.1:8545'
|
||||
VITE_APP_BASE_URL='http://127.0.0.1:8545'
|
||||
|
||||
# 正式域名
|
||||
VITE_NOW_TYPE = 'build/admin'
|
||||
|
|
|
@ -1,16 +1,26 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-card class="!border-none mb-4" shadow="never">
|
||||
<el-form
|
||||
class="mb-[-16px]"
|
||||
:model="queryParams"
|
||||
inline
|
||||
>
|
||||
<el-form class="mb-[-16px]" :model="queryParams" inline>
|
||||
<el-form-item label="门店" prop="store_id">
|
||||
<el-select v-model="queryParams.store_id" filterable remote reserve-keyword
|
||||
placeholder="输入门店名称搜索" remote-show-suffix :remote-method="remoteMethod" :loading="storeloading"
|
||||
style="width: 240px" @change="resetPage">
|
||||
<el-option v-for="item in storeList" :key="item.id" :label="item.name" :value="item.id" />
|
||||
<el-select
|
||||
v-model="queryParams.store_id"
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
placeholder="输入门店名称搜索"
|
||||
remote-show-suffix
|
||||
:remote-method="remoteMethod"
|
||||
:loading="storeloading"
|
||||
style="width: 240px"
|
||||
@change="resetPage"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in storeList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="导入人员" prop="admin_name">
|
||||
|
@ -20,10 +30,22 @@
|
|||
<el-input class="w-[280px]" v-model="queryParams.staff_name" @keydown.enter="resetPage" clearable placeholder="请输入门店确认人员" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status"
|
||||
placeholder="输入门店名称搜索"
|
||||
style="width: 240px" @change="resetPage">
|
||||
<el-option v-for="item in [{id:1,name:'已入库'},{id:0,name:'待确认'},{id:-1,name:'库存不足'}]" :key="item.id" :label="item.name" :value="item.id" />
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="输入门店名称搜索"
|
||||
style="width: 240px"
|
||||
@change="resetPage"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in [
|
||||
{ id: 1, name: '已入库' },
|
||||
{ id: 0, name: '待确认' },
|
||||
{ id: -1, name: '库存不足' }
|
||||
]"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
|
@ -42,15 +64,12 @@
|
|||
<el-table-column label="门店" prop="system_store_name" />
|
||||
<el-table-column label="导入人员" prop="admin_name" show-overflow-tooltip />
|
||||
<el-table-column label="门店确认人员" prop="staff_name" show-overflow-tooltip />
|
||||
<el-table-column label="商品图" prop="image" show-overflow-tooltip >
|
||||
<el-table-column label="商品图" prop="image" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-image
|
||||
class="w-[40px] h-[40px]"
|
||||
:src="row.image"
|
||||
/>
|
||||
<el-image class="w-[40px] h-[40px]" :src="row.image" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品" prop="store_name"/>
|
||||
<el-table-column label="商品" prop="store_name" />
|
||||
<el-table-column label="数量" prop="nums" show-overflow-tooltip />
|
||||
<el-table-column label="状态" prop="status">
|
||||
<template #default="{ row }">
|
||||
|
@ -60,7 +79,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" prop="mark" />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<!-- <el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-if="row.status !== 1"
|
||||
|
@ -72,14 +91,20 @@
|
|||
编辑库存
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="flex mt-4 justify-end">
|
||||
<pagination v-model="pager" @change="getLists" />
|
||||
</div>
|
||||
</el-card>
|
||||
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
|
||||
<edit-popup
|
||||
v-if="showEdit"
|
||||
ref="editRef"
|
||||
:dict-data="dictData"
|
||||
@success="getLists"
|
||||
@close="showEdit = false"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -97,7 +122,6 @@ const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
|||
// 是否显示编辑框
|
||||
const showEdit = ref(false)
|
||||
|
||||
|
||||
// 查询条件
|
||||
const queryParams = reactive({
|
||||
store_id: '',
|
||||
|
@ -148,23 +172,24 @@ const handleDelete = async (id: number | any[]) => {
|
|||
|
||||
getLists()
|
||||
|
||||
const storeloading = ref(false);
|
||||
const storeList = ref([]);
|
||||
const remoteMethod = (e:string='') => {
|
||||
storeloading.value = true;
|
||||
const storeloading = ref(false)
|
||||
const storeList = ref([])
|
||||
const remoteMethod = (e = '') => {
|
||||
storeloading.value = true
|
||||
apiSystemStoreLists({
|
||||
name: e,
|
||||
page_size: 50
|
||||
}).then(res => {
|
||||
storeList.value = res.lists;
|
||||
setTimeout(()=>{
|
||||
storeloading.value = false;
|
||||
},300)
|
||||
}).catch(err => {
|
||||
setTimeout(()=>{
|
||||
storeloading.value = false;
|
||||
},300)
|
||||
})
|
||||
.then((res) => {
|
||||
storeList.value = res.lists
|
||||
setTimeout(() => {
|
||||
storeloading.value = false
|
||||
}, 300)
|
||||
})
|
||||
.catch((err) => {
|
||||
setTimeout(() => {
|
||||
storeloading.value = false
|
||||
}, 300)
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -88,6 +88,12 @@
|
|||
min-width="100"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="库存"
|
||||
prop="stock"
|
||||
min-width="100"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="分配库存" min-width="150">
|
||||
<template #default="{ row }">
|
||||
<el-input-number
|
||||
|
@ -95,6 +101,7 @@
|
|||
:min="1"
|
||||
:max="row.stock"
|
||||
v-if="row.stock > 0"
|
||||
@change="handleStock"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -162,6 +169,7 @@ const formRef = shallowRef<FormInstance>()
|
|||
const { removeTab } = useMultipleTabs()
|
||||
const mode = ref('add')
|
||||
const warehouse_id = ref('')
|
||||
const stock = ref(0)
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
|
@ -184,6 +192,7 @@ const onBindStore = (e: any[]) => {
|
|||
storeList.value.push(item)
|
||||
}
|
||||
})
|
||||
handleStock()
|
||||
showStore.value = false
|
||||
}
|
||||
|
||||
|
@ -213,6 +222,34 @@ const getUnitList = () => {
|
|||
getUnitList()
|
||||
|
||||
const stock_type = ref(1)
|
||||
const isSubmit = ref(true)
|
||||
|
||||
const handleStock = () => {
|
||||
// const counts = storeList.value.length
|
||||
const product_arr = productList.value.map((item: any) => {
|
||||
return {
|
||||
id: item.product_id,
|
||||
stock: item.new_stock || 0,
|
||||
stocks: item.stock || 0
|
||||
}
|
||||
})
|
||||
const store_arr = storeList.value.length
|
||||
if (store_arr > 0 && product_arr.length > 0) {
|
||||
try {
|
||||
product_arr.forEach((item) => {
|
||||
const stock = item.stock * store_arr
|
||||
if (stock > item.stocks) {
|
||||
isSubmit.value = false
|
||||
throw new Error('超出仓库库存,请重新设置')
|
||||
}
|
||||
})
|
||||
} catch (e) {
|
||||
ElMessage.error('超出仓库库存,请重新设置')
|
||||
return
|
||||
}
|
||||
}
|
||||
isSubmit.value = true
|
||||
}
|
||||
|
||||
const router = useRouter()
|
||||
// 提交按钮
|
||||
|
@ -221,6 +258,10 @@ const handleSubmit = async () => {
|
|||
ElMessage.error('请选择仓库')
|
||||
return
|
||||
}
|
||||
handleStock()
|
||||
if (isSubmit.value == false) {
|
||||
return
|
||||
}
|
||||
const product_arr = productList.value.map((item: any) => {
|
||||
return {
|
||||
id: item.product_id,
|
||||
|
@ -236,7 +277,6 @@ const handleSubmit = async () => {
|
|||
warehouse_id: warehouse_id.value
|
||||
}).then((res) => {
|
||||
removeTab()
|
||||
return false
|
||||
if (res.code == 1) {
|
||||
ElMessage.success(res.msg)
|
||||
setTimeout(() => {
|
||||
|
|
|
@ -125,7 +125,6 @@
|
|||
type="danger"
|
||||
link
|
||||
@click="handleDelete(row.id)"
|
||||
v-if="row.status == 0"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
|
|
Loading…
Reference in New Issue