(修改了以下文件:src/views/finance/store_cash_finance_flow/index.vue,src/views/order/purchase_order/component/goodsOffer.vue,src/views/store/store_product/edit.vue,src/views/warehouse_product/edit.vue,src/views/warehouse_product/index.vue。在相应的Vue文件中添加了新的表格列,修改了部分组件的属性和方法,并引入了新的API接口。)
This commit is contained in:
parent
f91dab59cb
commit
81d52484e0
|
@ -0,0 +1,26 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 供应商户表列表
|
||||
export function apiSupplierLists(params: any) {
|
||||
return request.get({ url: '/supplier/supplier/lists', params })
|
||||
}
|
||||
|
||||
// 添加供应商户表
|
||||
export function apiSupplierAdd(params: any) {
|
||||
return request.post({ url: '/supplier/supplier/add', params })
|
||||
}
|
||||
|
||||
// 编辑供应商户表
|
||||
export function apiSupplierEdit(params: any) {
|
||||
return request.post({ url: '/supplier/supplier/edit', params })
|
||||
}
|
||||
|
||||
// 删除供应商户表
|
||||
export function apiSupplierDelete(params: any) {
|
||||
return request.post({ url: '/supplier/supplier/delete', params })
|
||||
}
|
||||
|
||||
// 供应商户表详情
|
||||
export function apiSupplierDetail(params: any) {
|
||||
return request.get({ url: '/supplier/supplier/detail', params })
|
||||
}
|
|
@ -58,6 +58,7 @@
|
|||
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
|
||||
<el-table-column label="ID" prop="id" show-overflow-tooltip />
|
||||
<el-table-column label="门店" prop="store_name" show-overflow-tooltip />
|
||||
<el-table-column label="时间" prop="create_time" show-overflow-tooltip />
|
||||
<el-table-column label="交易金额" prop="cash_price" show-overflow-tooltip />
|
||||
<el-table-column label="应收金额" prop="receivable" show-overflow-tooltip />
|
||||
<el-table-column label="实收金额" prop="receipts" show-overflow-tooltip />
|
||||
|
|
|
@ -22,20 +22,20 @@
|
|||
<el-table-column label="单位" prop="unit_name" width="80" show-overflow-tooltip />
|
||||
|
||||
<el-table-column label="需求数量" prop="need_num" show-overflow-tooltip width="100" />
|
||||
<!-- <el-table-column
|
||||
<el-table-column
|
||||
label="供应商"
|
||||
prop="supplier_name"
|
||||
show-overflow-tooltip
|
||||
width="160"
|
||||
/> -->
|
||||
width="100"
|
||||
/>
|
||||
<el-table-column label="采购数量" prop="buyer_nums" show-overflow-tooltip width="100" />
|
||||
<el-table-column label="是否需采购" prop="is_buyer" show-overflow-tooltip width="100">
|
||||
<template #default="{ row }">
|
||||
<div v-if="row.is_buyer == 0">
|
||||
<el-button type="danger" round size="small" @click="handleBuyer(-1, row.id)"
|
||||
<el-button type="danger" round size="small" @click="handleBuyer(-1, row)"
|
||||
>否</el-button
|
||||
>
|
||||
<el-button type="success" round size="small" @click="handleBuyer(1, row.id)"
|
||||
<el-button type="success" round size="small" @click="handleBuyer(1, row)"
|
||||
>是</el-button
|
||||
>
|
||||
</div>
|
||||
|
@ -44,15 +44,35 @@
|
|||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="采购人员" prop="buyer_name" show-overflow-tooltip width="100" />
|
||||
<el-table-column label="采购人员" prop="buyer_name" show-overflow-tooltip width="100">
|
||||
<template #default="{ row }">
|
||||
<span
|
||||
v-if="row.buyer_confirm == 0"
|
||||
@click="handleBuyer(1, row)"
|
||||
style="color: #67c23a; cursor: pointer"
|
||||
>{{ row.buyer_name }}</span
|
||||
>
|
||||
<span v-else>
|
||||
{{ row.buyer_name }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="采购状态"
|
||||
prop="buyer_confirm_name"
|
||||
show-overflow-tooltip
|
||||
width="100"
|
||||
/>
|
||||
<el-table-column
|
||||
label="是否入库"
|
||||
prop="is_storage_name"
|
||||
show-overflow-tooltip
|
||||
width="100"
|
||||
/>
|
||||
<el-table-column label="操作" fixed="right">
|
||||
<template #default="{ row }"> </template>
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link @click="handleWarehouse(row)"> 入库 </el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="flex mt-4 justify-end">
|
||||
|
@ -74,6 +94,14 @@
|
|||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="采购数量" prop="buyer_nums">
|
||||
<el-input
|
||||
v-model="updateInfo.buyer_nums"
|
||||
clearable
|
||||
placeholder="请输入采购数量"
|
||||
:readonly="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
|
@ -82,6 +110,12 @@
|
|||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<warehouse-edit-popup
|
||||
v-if="dialogWarehousing"
|
||||
ref="warehouseRef"
|
||||
@success="getLists"
|
||||
@close="dialogWarehousing = false"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -93,6 +127,8 @@ import {
|
|||
} from '@/api/purchase_product_offer'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { apiDeliveryServiceLists } from '@/api/delivery_service'
|
||||
import warehouseEditPopup from './warehouseEdit.vue'
|
||||
const warehouseRef = shallowRef<InstanceType<typeof warehouseEditPopup>>()
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
|
@ -115,15 +151,25 @@ const changeType = (e: any) => {
|
|||
getLists()
|
||||
}
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const dialogWarehousing = ref(false)
|
||||
const dialogBuyer = ref(false)
|
||||
const updateInfo = ref({
|
||||
id: '',
|
||||
type: '',
|
||||
is_buyer: '',
|
||||
buyer_id: ''
|
||||
buyer_id: '',
|
||||
buyer_nums: ''
|
||||
})
|
||||
|
||||
const handleWarehouse = async (row) => {
|
||||
console.log(row)
|
||||
dialogWarehousing.value = true
|
||||
await nextTick()
|
||||
warehouseRef.value?.open('edit')
|
||||
row.nums = row.buyer_nums
|
||||
row.purchase = row.price
|
||||
warehouseRef.value?.setFormData(row)
|
||||
}
|
||||
const goodsOfferUpdate = () => {
|
||||
apiPurchaseProductOfferEdit(updateInfo.value).then((res) => {
|
||||
getLists()
|
||||
|
@ -132,7 +178,7 @@ const goodsOfferUpdate = () => {
|
|||
}
|
||||
const delivery_list = ref([])
|
||||
const DeliveryService = () => {
|
||||
apiDeliveryServiceLists({}).then((res) => {
|
||||
apiDeliveryServiceLists({ type: 3 }).then((res) => {
|
||||
delivery_list.value = res.lists
|
||||
})
|
||||
}
|
||||
|
@ -141,16 +187,17 @@ const DeliveryService = () => {
|
|||
* 是否需采购
|
||||
* @param e
|
||||
*/
|
||||
const handleBuyer = (e, id) => {
|
||||
const handleBuyer = (e, row) => {
|
||||
if (e == 1) {
|
||||
updateInfo.value.id = id
|
||||
updateInfo.value.id = row.id
|
||||
updateInfo.value.buyer_nums = row.need_num
|
||||
updateInfo.value.is_buyer = '1'
|
||||
updateInfo.value.type = 'buyer'
|
||||
DeliveryService()
|
||||
dialogBuyer.value = true
|
||||
} else {
|
||||
apiPurchaseProductOfferEdit({
|
||||
id: id,
|
||||
id: row.id,
|
||||
type: 'buyer',
|
||||
is_buyer: -1
|
||||
}).then((res) => {
|
||||
|
|
|
@ -0,0 +1,310 @@
|
|||
<template>
|
||||
<div class="edit-popup">
|
||||
<popup
|
||||
ref="warehouseRef"
|
||||
:title="popupTitle"
|
||||
:async="true"
|
||||
width="550px"
|
||||
@confirm="handleSubmit"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
|
||||
<el-form-item label="仓库" prop="warehouse_id">
|
||||
<el-input
|
||||
v-model="formData.warehouse_name"
|
||||
clearable
|
||||
placeholder="请选择仓库"
|
||||
:readonly="false"
|
||||
@click="showWarehouse = true"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品" prop="product_id">
|
||||
<el-input
|
||||
v-model="formData.store_name"
|
||||
clearable
|
||||
placeholder="请选择商品"
|
||||
:readonly="false"
|
||||
@click="showProduct = true"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="供应商" prop="supplier_id">
|
||||
<el-select
|
||||
v-model="formData.supplier_id"
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
placeholder="输入供应商名称搜索"
|
||||
remote-show-suffix
|
||||
:remote-method="remoteMethodUser"
|
||||
:loading="userloading"
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in userList"
|
||||
:key="item.id"
|
||||
:label="item.mer_name"
|
||||
:value="item.id"
|
||||
selected
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="financial_pm">
|
||||
<el-select v-model="formData.financial_pm" clearable placeholder="请选择出入库">
|
||||
<el-option label="入库" value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="单号" prop="code">
|
||||
<el-input
|
||||
v-model="formData.code"
|
||||
clearable
|
||||
placeholder="请输入单号"
|
||||
:readonly="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="生产日期" prop="manufacture">
|
||||
<el-date-picker
|
||||
:readonly="false"
|
||||
class="flex-1 !flex"
|
||||
v-model="formData.manufacture"
|
||||
clearable
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="选择生产日期"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="保质期" prop="expiration_date">
|
||||
<el-date-picker
|
||||
:readonly="false"
|
||||
class="flex-1 !flex"
|
||||
v-model="formData.expiration_date"
|
||||
clearable
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="选择保质期"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="nums">
|
||||
<el-input
|
||||
v-model="formData.nums"
|
||||
clearable
|
||||
placeholder="请输入数量"
|
||||
:readonly="false"
|
||||
@change="changePrice"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<span style="color: red">注意:下面价格会同步到商品中,请仔细检查</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="采购价" prop="purchase">
|
||||
<el-input
|
||||
v-model="formData.purchase"
|
||||
clearable
|
||||
placeholder="请输入采购价"
|
||||
:readonly="false"
|
||||
@change="changePrice"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="总价" prop="total_price">
|
||||
<el-input
|
||||
v-model="formData.total_price"
|
||||
clearable
|
||||
placeholder="请输入总价"
|
||||
:readonly="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</popup>
|
||||
<el-dialog v-model="showWarehouse" title="选择仓库" width="70%">
|
||||
<warehouse-pop @onBindWarehouse="onBindWarehouse"></warehouse-pop>
|
||||
</el-dialog>
|
||||
<el-dialog v-model="showProduct" title="选择商品" width="70%">
|
||||
<product-pop @onBindStore="onBindStore"></product-pop>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="warehouseProductEdit">
|
||||
import { watermarkProps, type FormInstance } from 'element-plus'
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import {
|
||||
apiWarehouseProductAdd,
|
||||
apiWarehouseProductEdit,
|
||||
apiWarehouseProductDetail
|
||||
} from '@/api/warehouse_product'
|
||||
import { apiSupplierLists } from '@/api/supplier'
|
||||
import { timeFormat } from '@/utils/util'
|
||||
import type { PropType } from 'vue'
|
||||
defineProps({
|
||||
dictData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['success', 'close'])
|
||||
const formRef = shallowRef<FormInstance>()
|
||||
const warehouseRef = shallowRef<InstanceType<typeof Popup>>()
|
||||
const mode = ref('add')
|
||||
const showWarehouse = ref(false) // 选择仓库列表是否显示
|
||||
const showProduct = ref(false) // 选择商品列表是否显示
|
||||
// const productList = ref([])
|
||||
|
||||
const onBindWarehouse = (e: any[]) => {
|
||||
formData.warehouse_name = e.name
|
||||
formData.warehouse_id = e.id
|
||||
// e.forEach((item: any) => {
|
||||
// if (!productList.value.find((t: any) => t.id == item.id)) {
|
||||
// productList.value.push(item)
|
||||
// }
|
||||
// })
|
||||
showWarehouse.value = false
|
||||
}
|
||||
const onBindStore = (e: any[]) => {
|
||||
formData.store_name = e[0].store_name
|
||||
formData.product_id = e[0].id
|
||||
formData.purchase = e[0].purchase
|
||||
formData.cost = e[0].cost
|
||||
formData.price = e[0].price
|
||||
showProduct.value = false
|
||||
}
|
||||
// 弹窗标题
|
||||
const popupTitle = computed(() => {
|
||||
return mode.value == '新增入库'
|
||||
})
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
purchase_product_offer_id: '',
|
||||
warehouse_id: '',
|
||||
product_id: '',
|
||||
supplier_id: '',
|
||||
financial_pm: '1',
|
||||
batch: '',
|
||||
nums: '',
|
||||
price: '',
|
||||
total_price: '',
|
||||
status: '',
|
||||
warehouse_name: '',
|
||||
store_name: '',
|
||||
manufacture: '',
|
||||
expiration_date: '',
|
||||
code: '',
|
||||
purchase: '',
|
||||
cost: ''
|
||||
})
|
||||
|
||||
// 表单验证
|
||||
const formRules = reactive<any>({
|
||||
warehouse_id: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入仓库ID',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
product_id: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入商品ID',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
financial_pm: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择0 = 出库 1 = 获得',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
nums: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入数量',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
purchase: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入采购价',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
total_price: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入总价',
|
||||
trigger: ['blur']
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
// 获取详情
|
||||
const setFormData = async (data: Record<any, any>) => {
|
||||
for (const key in formData) {
|
||||
if (data[key] != null && data[key] != undefined) {
|
||||
//@ts-ignore
|
||||
formData[key] = data[key]
|
||||
}
|
||||
}
|
||||
formData.purchase_product_offer_id = data.id
|
||||
}
|
||||
|
||||
const getDetail = async (row: Record<string, any>) => {
|
||||
const data = await apiWarehouseProductDetail({
|
||||
id: row.id
|
||||
})
|
||||
setFormData(data)
|
||||
}
|
||||
const changePrice = () => {
|
||||
if (formData.purchase > 0 && formData.nums > 0) {
|
||||
formData.total_price = formData.purchase * formData.nums
|
||||
}
|
||||
}
|
||||
// 提交按钮
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate()
|
||||
const data = { ...formData }
|
||||
mode.value == (await apiWarehouseProductAdd(data))
|
||||
warehouseRef.value?.close()
|
||||
emit('success')
|
||||
}
|
||||
|
||||
//打开弹窗
|
||||
const open = (type = 'add') => {
|
||||
mode.value = type
|
||||
warehouseRef.value?.open()
|
||||
}
|
||||
|
||||
// 关闭回调
|
||||
const handleClose = () => {
|
||||
emit('close')
|
||||
}
|
||||
const userloading = ref(false)
|
||||
const userList = ref([])
|
||||
const remoteMethodUser = (e = '') => {
|
||||
userloading.value = true
|
||||
apiSupplierLists({})
|
||||
.then((res) => {
|
||||
userList.value = res.lists
|
||||
setTimeout(() => {
|
||||
userloading.value = false
|
||||
}, 300)
|
||||
})
|
||||
.catch((err) => {
|
||||
setTimeout(() => {
|
||||
userloading.value = false
|
||||
}, 300)
|
||||
})
|
||||
}
|
||||
defineExpose({
|
||||
open,
|
||||
setFormData,
|
||||
getDetail
|
||||
})
|
||||
</script>
|
|
@ -68,7 +68,7 @@
|
|||
placeholder="请选择商品单位"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="filterStockName(formData.product_type)" prop="stock">
|
||||
<!-- <el-form-item :label="filterStockName(formData.product_type)" prop="stock">
|
||||
<el-input
|
||||
v-model="formData.stock"
|
||||
type="number"
|
||||
|
@ -77,7 +77,7 @@
|
|||
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> -->
|
||||
|
@ -121,13 +121,23 @@
|
|||
:readonly="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="起批量" prop="batch">
|
||||
<el-form-item label="零售起批量" prop="batch">
|
||||
<el-input
|
||||
v-model="formData.batch"
|
||||
type="number"
|
||||
class="w-[500px]"
|
||||
clearable
|
||||
placeholder="请输入起批量"
|
||||
placeholder="请输入零售起批量"
|
||||
:readonly="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="门店起批量" prop="store_batch">
|
||||
<el-input
|
||||
v-model="formData.store_batch"
|
||||
type="number"
|
||||
class="w-[500px]"
|
||||
clearable
|
||||
placeholder="请输入门店起批量"
|
||||
:readonly="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
@ -269,7 +279,8 @@ const formData = reactive({
|
|||
swap: '',
|
||||
cost: '',
|
||||
purchase: '',
|
||||
batch: '',
|
||||
batch: 1,
|
||||
store_batch: 1,
|
||||
manufacturer_information: '',
|
||||
rose: '0',
|
||||
is_return: 1, // 1支持退货,2不支持退货
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
<template>
|
||||
<div class="edit-popup">
|
||||
<popup
|
||||
ref="popupRef"
|
||||
title="详情"
|
||||
:async="true"
|
||||
width="550px"
|
||||
:cancelButtonText="false"
|
||||
:confirmButtonText="false"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" label-width="90px">
|
||||
<el-form-item label="商户名称" prop="mer_name">
|
||||
<el-input v-model="formData.mer_name" clearable placeholder="请输入商户名称" :readonly="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商户电话" prop="phone">
|
||||
<el-input v-model="formData.phone" clearable placeholder="请输入商户电话" :readonly="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="结算周期,单位天" prop="settle_cycle">
|
||||
<el-input v-model="formData.settle_cycle" clearable placeholder="请输入结算周期,单位天" :readonly="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商户地址" prop="address">
|
||||
<el-input v-model="formData.address" clearable placeholder="请输入商户地址" :readonly="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商户备注" prop="mark">
|
||||
<el-input v-model="formData.mark" clearable placeholder="请输入商户备注" :readonly="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="formData.status" placeholder="请选择状态" :disabled="true">
|
||||
<el-radio
|
||||
v-for="(item, index) in dictData.show_status"
|
||||
:key="index"
|
||||
:label="parseInt(item.value)"
|
||||
>
|
||||
{{ item.name }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</popup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="supplierDETAILS">
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import { apiSupplierAdd, apiSupplierEdit, apiSupplierDetail } from '@/api/supplier'
|
||||
import { timeFormat } from '@/utils/util'
|
||||
import type { PropType } from 'vue'
|
||||
defineProps({
|
||||
dictData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['success', 'close'])
|
||||
const formRef = shallowRef<FormInstance>()
|
||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||
const mode = ref('add')
|
||||
|
||||
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
mer_name: '',
|
||||
phone: '',
|
||||
settle_cycle: '',
|
||||
address: '',
|
||||
mark: '',
|
||||
status: '',
|
||||
})
|
||||
|
||||
|
||||
|
||||
// 获取详情
|
||||
const setFormData = async (data: Record<any, any>) => {
|
||||
for (const key in formData) {
|
||||
if (data[key] != null && data[key] != undefined) {
|
||||
//@ts-ignore
|
||||
formData[key] = data[key]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
const getDetail = async (row: Record<string, any>) => {
|
||||
const data = await apiSupplierDetail({
|
||||
id: row.id
|
||||
})
|
||||
setFormData(data)
|
||||
}
|
||||
|
||||
//打开弹窗
|
||||
const open = () => {
|
||||
popupRef.value?.open()
|
||||
}
|
||||
|
||||
// 关闭回调
|
||||
const handleClose = () => {
|
||||
emit('close')
|
||||
}
|
||||
|
||||
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
setFormData,
|
||||
getDetail
|
||||
})
|
||||
</script>
|
|
@ -0,0 +1,186 @@
|
|||
<template>
|
||||
<div class="edit-popup">
|
||||
<popup
|
||||
ref="popupRef"
|
||||
:title="popupTitle"
|
||||
:async="true"
|
||||
width="550px"
|
||||
@confirm="handleSubmit"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
|
||||
<el-form-item label="商户名称" prop="mer_name">
|
||||
<el-input
|
||||
v-model="formData.mer_name"
|
||||
clearable
|
||||
placeholder="请输入商户名称"
|
||||
:readonly="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商户电话" prop="phone">
|
||||
<el-input
|
||||
v-model="formData.phone"
|
||||
clearable
|
||||
placeholder="请输入商户电话"
|
||||
:readonly="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="结算周期" prop="settle_cycle">
|
||||
<el-input
|
||||
v-model="formData.settle_cycle"
|
||||
clearable
|
||||
placeholder="请输入结算周期,单位天"
|
||||
:readonly="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商户地址" prop="address">
|
||||
<el-input
|
||||
v-model="formData.address"
|
||||
clearable
|
||||
placeholder="请输入商户地址"
|
||||
:readonly="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商户备注" prop="mark">
|
||||
<el-input
|
||||
v-model="formData.mark"
|
||||
clearable
|
||||
placeholder="请输入商户备注"
|
||||
:readonly="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group
|
||||
v-model="formData.status"
|
||||
placeholder="请选择状态"
|
||||
:disabled="false"
|
||||
>
|
||||
<el-radio
|
||||
v-for="(item, index) in dictData.show_status"
|
||||
:key="index"
|
||||
:label="parseInt(item.value)"
|
||||
>
|
||||
{{ item.name }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</popup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="supplierEdit">
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import { apiSupplierAdd, apiSupplierEdit, apiSupplierDetail } from '@/api/supplier'
|
||||
import { timeFormat } from '@/utils/util'
|
||||
import type { PropType } from 'vue'
|
||||
defineProps({
|
||||
dictData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['success', 'close'])
|
||||
const formRef = shallowRef<FormInstance>()
|
||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||
const mode = ref('add')
|
||||
|
||||
// 弹窗标题
|
||||
const popupTitle = computed(() => {
|
||||
return mode.value == 'edit' ? '编辑供应商户表' : '新增供应商户表'
|
||||
})
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
mer_name: '',
|
||||
phone: '',
|
||||
settle_cycle: '',
|
||||
address: '',
|
||||
mark: '',
|
||||
status: ''
|
||||
})
|
||||
|
||||
// 表单验证
|
||||
const formRules = reactive<any>({
|
||||
mer_name: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入商户名称',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
phone: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入商户电话',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
settle_cycle: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入结算周期,单位天',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
address: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入商户地址',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
status: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择状态',
|
||||
trigger: ['blur']
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
// 获取详情
|
||||
const setFormData = async (data: Record<any, any>) => {
|
||||
for (const key in formData) {
|
||||
if (data[key] != null && data[key] != undefined) {
|
||||
//@ts-ignore
|
||||
formData[key] = data[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const getDetail = async (row: Record<string, any>) => {
|
||||
const data = await apiSupplierDetail({
|
||||
id: row.id
|
||||
})
|
||||
setFormData(data)
|
||||
}
|
||||
|
||||
// 提交按钮
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate()
|
||||
const data = { ...formData }
|
||||
mode.value == 'edit' ? await apiSupplierEdit(data) : await apiSupplierAdd(data)
|
||||
popupRef.value?.close()
|
||||
emit('success')
|
||||
}
|
||||
|
||||
//打开弹窗
|
||||
const open = (type = 'add') => {
|
||||
mode.value = type
|
||||
popupRef.value?.open()
|
||||
}
|
||||
|
||||
// 关闭回调
|
||||
const handleClose = () => {
|
||||
emit('close')
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
setFormData,
|
||||
getDetail
|
||||
})
|
||||
</script>
|
|
@ -0,0 +1,145 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-card class="!border-none mb-4" shadow="never">
|
||||
<el-form class="mb-[-16px]" :model="queryParams" inline>
|
||||
<el-form-item label="商户名称" prop="mer_name">
|
||||
<el-input
|
||||
class="w-[280px]"
|
||||
v-model="queryParams.mer_name"
|
||||
clearable
|
||||
placeholder="请输入商户名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商户电话" prop="phone">
|
||||
<el-input
|
||||
class="w-[280px]"
|
||||
v-model="queryParams.phone"
|
||||
clearable
|
||||
placeholder="请输入商户电话"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="resetPage">查询</el-button>
|
||||
<el-button @click="resetParams">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
|
||||
<el-button v-perms="['supplier.supplier/add']" type="primary" @click="handleAdd">
|
||||
<template #icon>
|
||||
<icon name="el-icon-Plus" />
|
||||
</template>
|
||||
新增
|
||||
</el-button>
|
||||
<el-button
|
||||
v-perms="['supplier.supplier/delete']"
|
||||
:disabled="!selectData.length"
|
||||
@click="handleDelete(selectData)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<div class="mt-4">
|
||||
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column label="id" prop="id" show-overflow-tooltip />
|
||||
<!-- <el-table-column label="商户分类 id" prop="category_id" show-overflow-tooltip /> -->
|
||||
<el-table-column label="商户名称" prop="mer_name" show-overflow-tooltip />
|
||||
<el-table-column label="商户电话" prop="phone" show-overflow-tooltip />
|
||||
<el-table-column label="结算周期" prop="settle_cycle" show-overflow-tooltip />
|
||||
<el-table-column label="商户地址" prop="address" show-overflow-tooltip />
|
||||
<el-table-column label="商户备注" prop="mark" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-perms="['supplier.supplier/edit']"
|
||||
type="primary"
|
||||
link
|
||||
@click="handleEdit(row)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-perms="['supplier.supplier/delete']"
|
||||
type="danger"
|
||||
link
|
||||
@click="handleDelete(row.id)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</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"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="supplierLists">
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
import { useDictData } from '@/hooks/useDictOptions'
|
||||
import { apiSupplierLists, apiSupplierDelete } from '@/api/supplier'
|
||||
import { timeFormat } from '@/utils/util'
|
||||
import feedback from '@/utils/feedback'
|
||||
import EditPopup from './edit.vue'
|
||||
|
||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||
// 是否显示编辑框
|
||||
const showEdit = ref(false)
|
||||
|
||||
// 查询条件
|
||||
const queryParams = reactive({
|
||||
mer_name: '',
|
||||
phone: ''
|
||||
})
|
||||
|
||||
// 选中数据
|
||||
const selectData = ref<any[]>([])
|
||||
|
||||
// 表格选择后回调事件
|
||||
const handleSelectionChange = (val: any[]) => {
|
||||
selectData.value = val.map(({ id }) => id)
|
||||
}
|
||||
|
||||
// 获取字典数据
|
||||
const { dictData } = useDictData('show_status')
|
||||
|
||||
// 分页相关
|
||||
const { pager, getLists, resetParams, resetPage } = usePaging({
|
||||
fetchFun: apiSupplierLists,
|
||||
params: queryParams
|
||||
})
|
||||
|
||||
// 添加
|
||||
const handleAdd = async () => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('add')
|
||||
}
|
||||
|
||||
// 编辑
|
||||
const handleEdit = async (data: any) => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('edit')
|
||||
editRef.value?.setFormData(data)
|
||||
}
|
||||
|
||||
// 删除
|
||||
const handleDelete = async (id: number | any[]) => {
|
||||
await feedback.confirm('确定要删除?')
|
||||
await apiSupplierDelete({ id })
|
||||
getLists()
|
||||
}
|
||||
|
||||
getLists()
|
||||
</script>
|
|
@ -27,6 +27,26 @@
|
|||
@click="showProduct = true"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="供应商" prop="supplier_id">
|
||||
<el-select
|
||||
v-model="formData.supplier_id"
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
placeholder="输入供应商名称搜索"
|
||||
remote-show-suffix
|
||||
:remote-method="remoteMethodUser"
|
||||
:loading="userloading"
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in userList"
|
||||
:key="item.id"
|
||||
:label="item.mer_name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="financial_pm">
|
||||
<el-select v-model="formData.financial_pm" clearable placeholder="请选择出入库">
|
||||
<el-option label="入库" value="1" />
|
||||
|
@ -138,6 +158,7 @@ import {
|
|||
apiWarehouseProductEdit,
|
||||
apiWarehouseProductDetail
|
||||
} from '@/api/warehouse_product'
|
||||
import { apiSupplierLists } from '@/api/supplier'
|
||||
import { timeFormat } from '@/utils/util'
|
||||
import type { PropType } from 'vue'
|
||||
defineProps({
|
||||
|
@ -182,6 +203,7 @@ const formData = reactive({
|
|||
id: '',
|
||||
warehouse_id: '',
|
||||
product_id: '',
|
||||
supplier_id: '',
|
||||
financial_pm: '',
|
||||
batch: '',
|
||||
nums: '',
|
||||
|
@ -311,7 +333,23 @@ const open = (type = 'add') => {
|
|||
const handleClose = () => {
|
||||
emit('close')
|
||||
}
|
||||
|
||||
const userloading = ref(false)
|
||||
const userList = ref([])
|
||||
const remoteMethodUser = (e = '') => {
|
||||
userloading.value = true
|
||||
apiSupplierLists({})
|
||||
.then((res) => {
|
||||
userList.value = res.lists
|
||||
setTimeout(() => {
|
||||
userloading.value = false
|
||||
}, 300)
|
||||
})
|
||||
.catch((err) => {
|
||||
setTimeout(() => {
|
||||
userloading.value = false
|
||||
}, 300)
|
||||
})
|
||||
}
|
||||
defineExpose({
|
||||
open,
|
||||
setFormData,
|
||||
|
|
|
@ -33,6 +33,26 @@
|
|||
placeholder="请输入仓库"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="供应商" prop="supplier_id">
|
||||
<el-select
|
||||
v-model="queryParams.supplier_id"
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
placeholder="输入供应商名称搜索"
|
||||
remote-show-suffix
|
||||
:remote-method="remoteMethodUser"
|
||||
:loading="userloading"
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in userList"
|
||||
:key="item.id"
|
||||
:label="item.mer_name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品" prop="product_id">
|
||||
<el-input
|
||||
class="w-[280px]"
|
||||
|
@ -95,6 +115,7 @@
|
|||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column label="id" prop="id" show-overflow-tooltip />
|
||||
<el-table-column label="操作人员" prop="admin_name" show-overflow-tooltip />
|
||||
<el-table-column label="供应商" prop="supplier_name" show-overflow-tooltip />
|
||||
<el-table-column label="仓库" prop="warehouse_name" show-overflow-tooltip />
|
||||
<el-table-column label="商品" prop="store_name" show-overflow-tooltip />
|
||||
<el-table-column label="图片" prop="image" min-width="80">
|
||||
|
@ -185,6 +206,7 @@ import feedback from '@/utils/feedback'
|
|||
import EditPopup from './edit.vue'
|
||||
import { apiSystemStoreLists } from '@/api/system_store'
|
||||
import moment from 'moment'
|
||||
import { apiSupplierLists } from '@/api/supplier'
|
||||
|
||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||
// 是否显示编辑框
|
||||
|
@ -198,7 +220,8 @@ const queryParams = reactive({
|
|||
store_id: '',
|
||||
bar_code: '',
|
||||
start_time: '',
|
||||
end_time: ''
|
||||
end_time: '',
|
||||
supplier_id: ''
|
||||
})
|
||||
|
||||
// 选中数据
|
||||
|
@ -276,6 +299,24 @@ const remoteMethod = (e = '') => {
|
|||
}, 300)
|
||||
})
|
||||
}
|
||||
|
||||
const userloading = ref(false)
|
||||
const userList = ref([])
|
||||
const remoteMethodUser = (e = '') => {
|
||||
userloading.value = true
|
||||
apiSupplierLists({})
|
||||
.then((res) => {
|
||||
userList.value = res.lists
|
||||
setTimeout(() => {
|
||||
userloading.value = false
|
||||
}, 300)
|
||||
})
|
||||
.catch((err) => {
|
||||
setTimeout(() => {
|
||||
userloading.value = false
|
||||
}, 300)
|
||||
})
|
||||
}
|
||||
onMounted(() => {
|
||||
getLists()
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue