This commit is contained in:
weipengfei 2024-06-15 19:03:23 +08:00
parent 6cc78efbd0
commit 3e07b1dd8c
6 changed files with 41 additions and 23 deletions

View File

@ -1,11 +1,8 @@
<template> <template>
<div> <div>
<el-form class="mb-[-16px]" :model="queryParams" inline> <el-form class="mb-[-16px]" :model="queryParams" inline>
<el-form-item label="门店名称" prop="name"> <el-form-item label="商品名称" prop="store_name">
<el-input class="w-[200px]" v-model="queryParams.name" clearable placeholder="请输入门店名称" /> <el-input class="w-[200px]" v-model="queryParams.store_name" clearable placeholder="请输入商品名称" />
</el-form-item>
<el-form-item label="手机号码" prop="phone">
<el-input class="w-[200px]" v-model="queryParams.phone" clearable placeholder="请输入手机号码" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button> <el-button type="primary" @click="resetPage">查询</el-button>
@ -27,10 +24,10 @@
<el-table-column label="商品价格" prop="price" min-width="100" show-overflow-tooltip /> <el-table-column label="商品价格" prop="price" min-width="100" show-overflow-tooltip />
<el-table-column label="成本价" prop="cost" min-width="100" show-overflow-tooltip /> <el-table-column label="成本价" prop="cost" min-width="100" show-overflow-tooltip />
<el-table-column label="采购价" prop="purchase" min-width="100" show-overflow-tooltip /> <el-table-column label="采购价" prop="purchase" min-width="100" show-overflow-tooltip />
<el-table-column label="库存" prop="stock" min-width="100" show-overflow-tooltip /> <el-table-column label="售卖库存" prop="stock" min-width="100" show-overflow-tooltip />
<el-table-column label="兑换库存" prop="swap" min-width="100" show-overflow-tooltip />
<el-table-column label="销量" prop="sales" min-width="100" show-overflow-tooltip /> <el-table-column label="销量" prop="sales" min-width="100" show-overflow-tooltip />
</el-table> </el-table>
</div> </div>
<div class="flex mt-4 justify-end"> <div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" /> <pagination v-model="pager" @change="getLists" />
@ -50,8 +47,7 @@ import { ElMessage } from 'element-plus'
// //
const queryParams = reactive({ const queryParams = reactive({
name: '', store_name: '',
phone: ''
}) })
// //

View File

@ -49,7 +49,8 @@
<el-table-column label="价格" prop="price" show-overflow-tooltip /> <el-table-column label="价格" prop="price" show-overflow-tooltip />
<el-table-column label="商品条码" prop="bar_code" show-overflow-tooltip /> <el-table-column label="商品条码" prop="bar_code" show-overflow-tooltip />
<el-table-column label="销量" prop="sales" show-overflow-tooltip /> <el-table-column label="销量" prop="sales" show-overflow-tooltip />
<el-table-column label="库存" prop="stock" show-overflow-tooltip /> <el-table-column label="售卖库存" prop="stock" show-overflow-tooltip />
<el-table-column label="兑换库存" prop="swap" show-overflow-tooltip />
<el-table-column label="单位" prop="unit_name" show-overflow-tooltip /> <el-table-column label="单位" prop="unit_name" show-overflow-tooltip />
<el-table-column label="状态" prop="status" > <el-table-column label="状态" prop="status" >
<template #default="{ row }"> <template #default="{ row }">

View File

@ -24,14 +24,14 @@
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="适用门店" name="second"> <el-tab-pane label="适用门店" name="second">
<div class="flex justify-between mb-4"> <div class="flex justify-between mb-4">
<div class="flex"> <!-- <div class="flex">
<el-button type="warning" v-if="!isEidt && !isEidtStock" <el-button type="warning" v-if="!isEidt && !isEidtStock"
@click="isEidt = true">编辑门店</el-button> @click="isEidt = true">编辑门店</el-button>
<el-button type="primary" v-if="isEidt && !isEidtStock" <el-button type="primary" v-if="isEidt && !isEidtStock"
@click="showStore = true">添加门店</el-button> @click="showStore = true">添加门店</el-button>
<el-button type="primary" v-if="!isEidtStock && !isEidt" <el-button type="primary" v-if="!isEidtStock && !isEidt"
@click="isEidtStock = true">编辑库存</el-button> @click="isEidtStock = true">编辑库存</el-button>
</div> </div> -->
<div class="flex" v-if="isEidt"> <div class="flex" v-if="isEidt">
<el-button type="primary" @click="submitStore">确认</el-button> <el-button type="primary" @click="submitStore">确认</el-button>
<el-button @click="isEidt = false; getLists()">取消</el-button> <el-button @click="isEidt = false; getLists()">取消</el-button>

View File

@ -25,9 +25,12 @@
emitPath: false, emitPath: false,
}" placeholder="请选择商品单位" /> }" placeholder="请选择商品单位" />
</el-form-item> </el-form-item>
<el-form-item label="库存" prop="stock"> <el-form-item label="售卖库存" prop="stock">
<el-input v-model="formData.stock" type="number" class="w-[500px]" clearable placeholder="请输入库存" :readonly="false" /> <el-input v-model="formData.stock" type="number" class="w-[500px]" clearable placeholder="请输入库存" :readonly="false" />
</el-form-item> </el-form-item>
<el-form-item label="兑换库存" prop="swap">
<el-input v-model="formData.swap" type="number" class="w-[500px]" clearable placeholder="请输入库存" :readonly="false" />
</el-form-item>
<el-form-item label="会员零售价" prop="price"> <el-form-item label="会员零售价" prop="price">
<el-input v-model="formData.price" type="number" class="w-[500px]" clearable placeholder="请输入会员零售价" :readonly="false" /> <el-input v-model="formData.price" type="number" class="w-[500px]" clearable placeholder="请输入会员零售价" :readonly="false" />
</el-form-item> </el-form-item>
@ -133,6 +136,7 @@ const formData = reactive({
vip_price: "", vip_price: "",
unit: "", unit: "",
stock: "", stock: "",
swap: "",
cost: "", cost: "",
purchase: "", purchase: "",
rose: "0", rose: "0",
@ -288,7 +292,14 @@ const formRules = reactive<any>({
stock: [ stock: [
{ {
required: true, required: true,
message: "请输入库存", message: "请输入售卖库存",
trigger: ["blur"],
},
],
swap: [
{
required: true,
message: "请输入兑换库存",
trigger: ["blur"], trigger: ["blur"],
}, },
], ],

View File

@ -52,7 +52,7 @@
<el-table-column label="分类" prop="cate_name" min-width="120" show-overflow-tooltip /> <el-table-column label="分类" prop="cate_name" min-width="120" show-overflow-tooltip />
<el-table-column label="单位" prop="unit_name" min-width="80" show-overflow-tooltip /> <el-table-column label="单位" prop="unit_name" min-width="80" show-overflow-tooltip />
<el-table-column label="商品价格" prop="price" min-width="100" show-overflow-tooltip /> <el-table-column label="商品价格" prop="price" min-width="100" show-overflow-tooltip />
<el-table-column label="分配库存" fixed="right" min-width="150"> <el-table-column label="分配库存" min-width="150">
<template #default="{ row }"> <template #default="{ row }">
<el-input-number v-model="row.new_stock" :min="1" /> <el-input-number v-model="row.new_stock" :min="1" />
</template> </template>
@ -68,6 +68,13 @@
</el-table> </el-table>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="库存类型" prop="stock_type">
<el-radio-group v-model="stock_type" class="ml-6">
<el-radio :value="1" :label="1">分配售卖库存</el-radio>
<el-radio :value="2" :label="2">分配兑换库存</el-radio>
</el-radio-group>
<span class="text-info text-xs ml-6">默认为分配售卖库存, 如需分配兑换库存请选择分配兑换库存</span>
</el-form-item>
<el-form-item label=""> <el-form-item label="">
<el-button @click="handleSubmit" type="primary" class="w-40">提交</el-button> <el-button @click="handleSubmit" type="primary" class="w-40">提交</el-button>
</el-form-item> </el-form-item>
@ -76,7 +83,7 @@
<el-dialog v-model="showStore" title="选择门店" width="70%"> <el-dialog v-model="showStore" title="选择门店" width="70%">
<store-pop @onBindStore="onBindStore"></store-pop> <store-pop @onBindStore="onBindStore"></store-pop>
</el-dialog> </el-dialog>
<el-dialog v-model="showProduct" title="选择门店" width="70%"> <el-dialog v-model="showProduct" title="选择商品" width="70%">
<product-pop @onBindStore="onBindProduct"></product-pop> <product-pop @onBindStore="onBindProduct"></product-pop>
</el-dialog> </el-dialog>
</el-card> </el-card>
@ -143,10 +150,6 @@ const onBindProduct = (e: any[]) => {
}); });
showProduct.value = false; showProduct.value = false;
} }
const handleChange = (row: any) => {
stockList.value.set(row.id, row.new_stock);
}
const unitList = ref([]); const unitList = ref([]);
const getUnitList = () => { const getUnitList = () => {
@ -156,7 +159,7 @@ const getUnitList = () => {
}; };
getUnitList(); getUnitList();
const stock_type = ref(1);
const router = useRouter(); const router = useRouter();
// //
@ -171,7 +174,8 @@ const handleSubmit = async () => {
console.log(product_arr, store_arr); console.log(product_arr, store_arr);
apiStoreProductImport({ apiStoreProductImport({
product_arr, product_arr,
store_arr store_arr,
stock_type: stock_type.value
}).then(res => { }).then(res => {
removeTab(); removeTab();
router.push({ router.push({

View File

@ -33,6 +33,10 @@
</el-form> </el-form>
</el-card> </el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never"> <el-card class="!border-none" v-loading="pager.loading" shadow="never">
<el-radio-group v-model="queryParams.type" @change="resetPage">
<el-radio-button :label="1" :value="1">售卖库存</el-radio-button>
<el-radio-button :label="2" :value="2">兑换库存</el-radio-button>
</el-radio-group>
<div class="mt-4"> <div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange"> <el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column label="门店" prop="system_store_name" /> <el-table-column label="门店" prop="system_store_name" />
@ -87,6 +91,7 @@ import { apiSystemStoreLists } from '@/api/system_store'
import { timeFormat } from '@/utils/util' import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback' import feedback from '@/utils/feedback'
import EditPopup from './edit.vue' import EditPopup from './edit.vue'
import { size } from 'lodash-es'
const editRef = shallowRef<InstanceType<typeof EditPopup>>() const editRef = shallowRef<InstanceType<typeof EditPopup>>()
// //
@ -98,7 +103,8 @@ const queryParams = reactive({
store_id: '', store_id: '',
admin_name: '', admin_name: '',
staff_name: '', staff_name: '',
status: '' status: '',
type: 1
}) })
// //