钱包管理

This commit is contained in:
weiwei committed 2025-02-27 18:55:09 +08:00
1 parent 69b54f260b
commit 143c69e4fc
4 files changed
+411 -115

No files matched your search

@@ -1,113 +0,0 @@
<template>
<!-- 关联采购申请单对话框 -->
<el-dialog v-model="linkCgCodeDialogVisible" title="选择采购单" width="70%" :close-on-click-modal="false" draggable @close="onClose">
<vxe-table
v-show="step === 0"
ref="linkCgPlanTableRef"
border
v-loading="linkCodeLoading"
:row-config="{ isCurrent: true, isHover: true }"
:radio-config="{ labelField: '', trigger: 'row' }"
:data="cgddPage"
@radio-change="radioChangeEvent"
>
<vxe-column type="radio" width="60" align="center"></vxe-column>
<vxe-column field="id" title="id" align="center" width="200"></vxe-column>
<vxe-column field="planCode" title="编号" align="center" width="200"></vxe-column>
<vxe-column field="planDate" title="单据日期" align="center" width="200"></vxe-column>
<vxe-column field="handlerUserId" title="经办人" align="center" width="100"></vxe-column>
<vxe-column field="checkStatus" title="审批状态" align="center" width="100"></vxe-column>
<vxe-column field="remark" title="备注" show-overflow align="center" min-width="100"></vxe-column>
</vxe-table>
<!-- <pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
v-model:current-page="foodQueryForm.current"
v-model:page-size="foodQueryForm.size"
:total="total"
/> -->
<vxe-table
v-show="step === 1"
ref="linkCgPlanSpuTableRef"
border
:row-config="{ isCurrent: true, isHover: true }"
:checkbox-config="{ trigger: 'row' }"
:data="currRadioRowItems"
>
<vxe-column type="checkbox" width="60" align="center"></vxe-column>
<vxe-column field="erpSpuId" title="erpSpuId" align="center" width="200"></vxe-column>
<vxe-column field="unit" title="包装单位" align="center" width="200"></vxe-column>
<vxe-column field="quantity" title="数量" align="center" width="100"></vxe-column>
<vxe-column field="purchasePrice" title="进价" align="center" width="100"></vxe-column>
<vxe-column field="unitPrice" title="进价" align="center" width="100"></vxe-column>
<vxe-column field="totalAmount" title="累计总金额" align="center" width="100"></vxe-column>
<vxe-column field="remark" title="备注" show-overflow align="center" min-width="100"></vxe-column>
</vxe-table>
<template #footer>
<el-button @click="linkCgCodeDialogVisible = false">取消</el-button>
<el-button v-show="step === 1" type="primary" @click="step--">上一步</el-button>
<el-button v-show="step === 0" type="primary" @click="step++" :disabled="currRadioRowItems.length <= 0">下一步</el-button>
<el-button v-show="step === 1" type="primary" @click="getSelectedRowData" :disabled="linkCodeLoading">确认</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts" name="linkCgCodeDialog">
import { ref } from "vue"
import { VxeTableEvents } from "vxe-table"
const linkCgCodeDialogVisible = defineModel()
const emit = defineEmits(["getSelectedCgPlan"])
const linkCodeLoading = ref(false) // 关联采购申请单对话框加载状态
const linkCgPlanTableRef = ref() // 关联补货单对话框表格1ref
const linkCgPlanSpuTableRef = ref() // 关联补货单对话框表格2ref
const cgddPage = ref([]) // 采购申请列表数据
const currRadioRowItems = ref([]) // 当前单选的表格行的items
const step = ref(0) // 选择步骤
// 打开关联补货单对话框
const openLinkCodeDialog = async () => {
linkCgCodeDialogVisible.value = true
step.value = 0
linkCodeLoading.value = true
try {
const res = await getCgInventoryPage({}).finally(() => (linkCodeLoading.value = false))
if (res.code === 0) {
cgddPage.value = res.data.records
}
} catch (error) {
cgddPage.value = []
linkCodeLoading.value = false
}
}
// 单选时
const radioChangeEvent: VxeTableEvents.RadioChange<any> = ({ row }) => (currRadioRowItems.value = row.items)
// 获取选择的关联补货单对话框表格行数据
const getSelectedRowData = () => {
const $table = linkCgPlanTableRef.value
const $SpuTable = linkCgPlanSpuTableRef.value
if ($table && $SpuTable) {
const currRadioRow = $table.getRadioRecord()
console.log("currRadioRow", currRadioRow)
const currSpuRows = $SpuTable.getCheckboxRecords()
console.log("currSpuRows", currSpuRows)
emit("getSelectedCgPlan", { ...currRadioRow, items: currSpuRows })
}
}
// 对话框关闭
const onClose = () => {
linkCgCodeDialogVisible.value = false
currRadioRowItems.value = []
cgddPage.value = []
}
defineExpose({
openLinkCodeDialog,
})
</script>
@@ -171,8 +171,14 @@
@getSelectedSpuRows="getSelectedSpuRows"
/>
<linkCodeDialog ref="linkCgPlanDialogRef" v-model="state.linkCgPlanDialogVisible" title="关联采购订单"
:getTableData="getCgInventoryPage({inventoryType: "3"})" @getSelectedLinkCode="getSelectedLinkCode" />
<linkCodeDialog
ref="linkCgPlanDialogRef"
v-model="state.linkCgPlanDialogVisible"
title="关联采购订单"
:getTableData="getCgInventoryPage"
@getSelectedLinkCode="getSelectedLinkCode"
/>
<!-- {inventoryType: "3"} -->
</div>
</div>
</template>