更新财务转账表API,重构系统商店编辑页面

This commit is contained in:
zmj 2024-06-14 18:08:46 +08:00
parent 8e571a57e5
commit c57b420838
3 changed files with 100 additions and 43 deletions

View File

@ -5,22 +5,11 @@ export function apiFinancialTransfersLists(params: any) {
return request.get({ url: '/financial_transfers/financialtransfers/lists', params }) return request.get({ url: '/financial_transfers/financialtransfers/lists', params })
} }
// 添加财务转账表 // 发送
export function apiFinancialTransfersAdd(params: any) { export function apiFinancialTransfersSend(params: any) {
return request.post({ url: '/financial_transfers/financialtransfers/add', params }) return request.post({ url: '/financial_transfers/FinancialTransfers/send_transfers', params })
} }
// 编辑财务转账表 export function apiFinancialTransfersConfirm(params: any) {
export function apiFinancialTransfersEdit(params: any) { return request.post({ url: '/financial_transfers/FinancialTransfers/success_send', params })
return request.post({ url: '/financial_transfers/financialtransfers/edit', params })
} }
// 删除财务转账表
export function apiFinancialTransfersDelete(params: any) {
return request.post({ url: '/financial_transfers/financialtransfers/delete', params })
}
// 财务转账表详情
export function apiFinancialTransfersDetail(params: any) {
return request.get({ url: '/financial_transfers/financialtransfers/detail', params })
}

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<el-card class="!border-none mb-4" shadow="never"> <!-- <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="money"> <el-form-item label="金额" prop="money">
<el-input class="w-[280px]" v-model="queryParams.money" clearable placeholder="请输入金额" /> <el-input class="w-[280px]" v-model="queryParams.money" clearable placeholder="请输入金额" />
@ -10,7 +10,7 @@
<el-button @click="resetParams">重置</el-button> <el-button @click="resetParams">重置</el-button>
</el-form-item> </el-form-item>
</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">
<div class="mt-4"> <div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange"> <el-table :data="pager.lists" @selection-change="handleSelectionChange">
@ -19,11 +19,18 @@
<el-table-column label="收款方" prop="store_name" show-overflow-tooltip /> <el-table-column label="收款方" prop="store_name" show-overflow-tooltip />
<el-table-column label="结算金额" prop="money" show-overflow-tooltip /> <el-table-column label="结算金额" prop="money" show-overflow-tooltip />
<el-table-column label="结算方式" prop="extract_type" show-overflow-tooltip /> <el-table-column label="结算方式" prop="extract_type" show-overflow-tooltip />
<el-table-column label="确认时间" prop="initiation_time" show-overflow-tooltip /> <el-table-column label="确认时间" prop="initiation_time" show-overflow-tooltip>
<template #default="{ row }">
{{ timeFormat(row.initiation_time, 'yyyy-mm-dd') }}
</template>
</el-table-column>
<el-table-column label="操作" width="120" fixed="right"> <el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }"> <template #default="{ row }">
<el-button link type="primary" @click="handleDelete(row.id)"> <el-button link type="primary" @click="handleDelete(row.id)" v-if="row.status == 0">
起飞 发送
</el-button>
<el-button link type="primary" @click="handleClick(row)" v-if="row.status == 2">
确认
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -33,22 +40,42 @@
<pagination v-model="pager" @change="getLists" /> <pagination v-model="pager" @change="getLists" />
</div> </div>
</el-card> </el-card>
<el-dialog v-model="showDialog" title="确认结算" width="680px">
<el-descriptions :column="1" border>
<el-descriptions-item label="姓名"> {{ rowDate.store_realName }} </el-descriptions-item>
<el-descriptions-item label="银行卡号"> {{ rowDate.store_bank_code }} </el-descriptions-item>
<el-descriptions-item label="银行名称"> {{ rowDate.store_bank }} </el-descriptions-item>
<el-descriptions-item label="开户地址"> {{ rowDate.store_bank_address }} </el-descriptions-item>
<el-descriptions-item label="操作">
<el-radio-group v-model="form.status">
<el-radio label="1">通过</el-radio>
<el-radio label="0">不通过</el-radio>
</el-radio-group>
</el-descriptions-item>
<el-descriptions-item label="附件">
<material-picker v-model="form.transfer_picture" />
</el-descriptions-item>
<el-descriptions-item label="备注">
<el-input class="w-[280px]" v-model="form.fail_msg" clearable placeholder="请输入备注" type="textarea" />
</el-descriptions-item>
</el-descriptions>
<el-form class="mt-4">
<el-form-item>
<el-button type="primary" @click="handleConfirm">确定</el-button>
<el-button @click="showDialog = false">取消</el-button>
</el-form-item>
</el-form>
</el-dialog>
</div> </div>
</template> </template>
<script lang="ts" setup name="financialTransfersLists"> <script lang="ts" setup name="financialTransfersLists">
import { usePaging } from '@/hooks/usePaging' import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions' import { useDictData } from '@/hooks/useDictOptions'
import { apiFinancialTransfersLists } from '@/api/financial_transfers' import { apiFinancialTransfersLists, apiFinancialTransfersSend, apiFinancialTransfersConfirm } from '@/api/financial_transfers'
import { timeFormat } from '@/utils/util' import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback' import feedback from '@/utils/feedback'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
// //
const queryParams = reactive({ const queryParams = reactive({
store_id: '', store_id: '',
@ -82,11 +109,34 @@ const { pager, getLists, resetParams, resetPage } = usePaging({
// //
const handleDelete = async (id: number | any[]) => { const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要起飞吗?') await feedback.confirm('确定要发送吗?')
// await apiFinancialTransfersDelete({ id }) await apiFinancialTransfersSend({ id })
getLists() getLists()
} }
const showDialog = ref(false)
const rowDate = ref('')
const handleClick = (row: any) => {
rowDate.value = row
showDialog.value = true
}
const form = reactive({
id: "",
transfer_picture: "",
status: "",
fail_msg: ""
})
//
const handleConfirm = async (id: number | any[]) => {
form.id = rowDate.value.id
await apiFinancialTransfersConfirm({ ...form })
getLists()
showDialog.value = false
}
getLists() getLists()
</script> </script>

View File

@ -1,7 +1,6 @@
<template> <template>
<div class="edit-popup"> <div class="edit-popup">
<popup ref="popupRef" :title="popupTitle" :async="true" width="600px" @confirm="handleSubmit" <popup ref="popupRef" :title="popupTitle" :async="true" width="600px" @confirm="handleSubmit" @close="handleClose">
@close="handleClose">
<el-form ref="formRef" :model="formDataInfo" label-width="90px" :rules="formRules"> <el-form ref="formRef" :model="formDataInfo" label-width="90px" :rules="formRules">
<el-form-item label="门店logo" prop="image"> <el-form-item label="门店logo" prop="image">
<material-picker v-model="formDataInfo.image" :limit="1" /> <material-picker v-model="formDataInfo.image" :limit="1" />
@ -10,8 +9,8 @@
<el-input v-model="formDataInfo.name" clearable placeholder="请输入门店名称" :readonly="false" /> <el-input v-model="formDataInfo.name" clearable placeholder="请输入门店名称" :readonly="false" />
</el-form-item> </el-form-item>
<el-form-item label="简介" prop="introduction"> <el-form-item label="简介" prop="introduction">
<el-input v-model="formDataInfo.introduction" clearable placeholder="请输入简介" type="textarea" <el-input v-model="formDataInfo.introduction" clearable placeholder="请输入简介" type="textarea" :rows="3"
:rows="3" :readonly="false" /> :readonly="false" />
</el-form-item> </el-form-item>
<el-form-item label="负责人" prop="staff_name"> <el-form-item label="负责人" prop="staff_name">
<el-input v-model="formDataInfo.staff_name" clearable placeholder="请输入负责人姓名" :readonly="false" /> <el-input v-model="formDataInfo.staff_name" clearable placeholder="请输入负责人姓名" :readonly="false" />
@ -21,13 +20,25 @@
:readonly="mode == 'edit'" /> :readonly="mode == 'edit'" />
<div class="text-sm text-orange-400">输入的手机号将作为管理员账户登录</div> <div class="text-sm text-orange-400">输入的手机号将作为管理员账户登录</div>
</el-form-item> </el-form-item>
<el-form-item label="登录密码" prop="password" v-if="mode=='add'"> <el-form-item label="登录密码" prop="password" v-if="mode == 'add'">
<el-input v-model="formDataInfo.password" clearable placeholder="请输入登录密码" :readonly="false" /> <el-input v-model="formDataInfo.password" clearable placeholder="请输入登录密码" :readonly="false" />
</el-form-item> </el-form-item>
<el-form-item label="登录密码" v-else> <el-form-item label="登录密码" v-else>
<el-input v-model="formDataInfo.password" clearable placeholder="请输入登录密码" :readonly="false" /> <el-input v-model="formDataInfo.password" clearable placeholder="请输入登录密码" :readonly="false" />
<div class="text-sm text-orange-400">不修改请留空</div> <div class="text-sm text-orange-400">不修改请留空</div>
</el-form-item> </el-form-item>
<el-form-item label="银行卡号" prop="bank_code">
<el-input v-model="formDataInfo.bank_code" clearable placeholder="请输入银行卡号" />
</el-form-item>
<el-form-item label="银行名称" prop="bank_code">
<el-input v-model="formDataInfo.bank" clearable placeholder="请输入银行名称" />
</el-form-item>
<el-form-item label="开户地址" prop="bank_address">
<el-input v-model="formDataInfo.bank_address" clearable placeholder="请输入开户地址" />
</el-form-item>
<el-form-item label="姓名" prop="realname">
<el-input v-model="formDataInfo.realname" clearable placeholder="请输入姓名" />
</el-form-item>
<el-form-item label="营业状态" prop="is_show"> <el-form-item label="营业状态" prop="is_show">
<el-switch v-model="formDataInfo.is_show" :active-value="1" :inactive-value="0" active-text="营业" <el-switch v-model="formDataInfo.is_show" :active-value="1" :inactive-value="0" active-text="营业"
inactive-text="打烊" inline-prompt /> inactive-text="打烊" inline-prompt />
@ -38,12 +49,11 @@
start-placeholder="开始时间" end-placeholder="结束时间" /> start-placeholder="开始时间" end-placeholder="结束时间" />
</el-form-item> </el-form-item>
<el-form-item label="门店地址" prop="selectedValues"> <el-form-item label="门店地址" prop="selectedValues">
<el-cascader v-model="formDataInfo.selectedValues" :options="options" :props="props" <el-cascader v-model="formDataInfo.selectedValues" :options="options" :props="props" :load="loadOptions"
:load="loadOptions" class="w-full" /> class="w-full" />
</el-form-item> </el-form-item>
<el-form-item label="详细地址" prop="detailed_address"> <el-form-item label="详细地址" prop="detailed_address">
<el-input v-model="formDataInfo.detailed_address" clearable placeholder="请输入详细地址" <el-input v-model="formDataInfo.detailed_address" clearable placeholder="请输入详细地址" :readonly="false" />
:readonly="false" />
</el-form-item> </el-form-item>
<el-form-item label="到店自提" prop="is_store"> <el-form-item label="到店自提" prop="is_store">
<el-switch v-model="formDataInfo.is_store" :active-value="1" :inactive-value="0" active-text="开启" <el-switch v-model="formDataInfo.is_store" :active-value="1" :inactive-value="0" active-text="开启"
@ -103,7 +113,11 @@ const formData = reactive({
password: "", password: "",
staff_name: "", staff_name: "",
is_store: 1, is_store: 1,
is_send: 0 is_send: 0,
bank: "",
bank_code: "",
bank_address: "",
realname: ""
}) })
const formDataInfo = reactive({ const formDataInfo = reactive({
@ -120,7 +134,11 @@ const formDataInfo = reactive({
is_send: 0, is_send: 0,
coord: '', coord: '',
startEndTime: [], startEndTime: [],
selectedValues: [] selectedValues: [],
bank: "",
bank_code: "",
bank_address: "",
realname: ""
}) })
@ -208,10 +226,10 @@ const getDetail = async (row: Record<string, any>) => {
const handleSubmit = async () => { const handleSubmit = async () => {
await formRef.value?.validate() await formRef.value?.validate()
Object.keys(formData).forEach((key: string) => { Object.keys(formData).forEach((key: string) => {
if (formDataInfo[key]!==''&&formDataInfo[key]!==null&&formDataInfo[key]!==undefined) formData[key] = formDataInfo[key]; if (formDataInfo[key] !== '' && formDataInfo[key] !== null && formDataInfo[key] !== undefined) formData[key] = formDataInfo[key];
}) })
const data = { ...formData }; const data = { ...formData };
if(mode.value=='edit' && !data.password) data.password = ''; if (mode.value == 'edit' && !data.password) data.password = '';
const test = /^[+-]?\d*(\.\d+)?$/; const test = /^[+-]?\d*(\.\d+)?$/;
let latlng = formDataInfo.coord.split(','); let latlng = formDataInfo.coord.split(',');
if (latlng.length < 2 || !test.test(latlng[0]) || !test.test(latlng[1])) return ElMessage.error('请输入正确的坐标'); if (latlng.length < 2 || !test.test(latlng[0]) || !test.test(latlng[1])) return ElMessage.error('请输入正确的坐标');