|
@@ -1,53 +1,368 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<el-row>
|
|
|
- <el-col :span="6">
|
|
|
+ <el-col :span="8">
|
|
|
<el-form-item
|
|
|
label="收款日期:"
|
|
|
>
|
|
|
<el-date-picker
|
|
|
- v-model="paymentTime"
|
|
|
- type="date"
|
|
|
- placeholder="请选择收款日期"
|
|
|
- format="YYYY-MM-DD"
|
|
|
- value-format="YYYY-MM-DD"
|
|
|
+ v-model="condition.time"
|
|
|
+ type="month"
|
|
|
+ placeholder="请选择收款月份"
|
|
|
+ format="YYYY-MM"
|
|
|
+ value-format="YYYY-MM"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="3">
|
|
|
+ <el-col :span="2">
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
:icon="Search"
|
|
|
+ @click="searchCollection"
|
|
|
>查询</el-button>
|
|
|
</el-col>
|
|
|
+ <el-col
|
|
|
+ :span="2"
|
|
|
+ style="margin-left: 30px"
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ :icon="Plus"
|
|
|
+ @click="paymentAddShow = true"
|
|
|
+ >
|
|
|
+ 新增
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
- <el-col :span="12">
|
|
|
- <el-table v-model="pay.paymentList">
|
|
|
- <el-table-column
|
|
|
- label="收款时间"
|
|
|
- prop="collectionTime"
|
|
|
+ <el-col :span="23">
|
|
|
+ <el-row>
|
|
|
+ <el-table
|
|
|
+ :data="pay.paymentList"
|
|
|
+ stripe
|
|
|
+ >
|
|
|
+ <el-table-column
|
|
|
+ label="收款时间"
|
|
|
+ prop="collectionTime"
|
|
|
+ align="center"
|
|
|
+ width="180px"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ label="收款金额(元)"
|
|
|
+ prop="price"
|
|
|
+ align="center"
|
|
|
+ width="250px"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ label="收款金额(元)"
|
|
|
+ prop="price"
|
|
|
+ align="center"
|
|
|
+ width="250px"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ label="操作"
|
|
|
+ align="center"
|
|
|
+ >
|
|
|
+ <template #default="scope">
|
|
|
+ <el-popover
|
|
|
+ placement="top-start"
|
|
|
+ title="收款备注"
|
|
|
+ :width="200"
|
|
|
+ trigger="click"
|
|
|
+ :content="scope.row.remarks"
|
|
|
+ >
|
|
|
+ <template #reference>
|
|
|
+ <el-button
|
|
|
+ text
|
|
|
+ type="primary"
|
|
|
+ :icon="Notebook"
|
|
|
+ >
|
|
|
+ 备注
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-popover>
|
|
|
+ <el-button
|
|
|
+ text
|
|
|
+ type="primary"
|
|
|
+ :icon="Edit"
|
|
|
+ @click="openPaymentEdit(scope.row)"
|
|
|
+ >
|
|
|
+ 编辑
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ text
|
|
|
+ type="primary"
|
|
|
+ :icon="Delete"
|
|
|
+ @click="paymentDelete(scope.row)"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-row>
|
|
|
+ <el-row justify="end">
|
|
|
+ <el-pagination
|
|
|
+ background
|
|
|
+ layout="prev, pager, next"
|
|
|
+ :page-size="8"
|
|
|
+ :total="pay.paymentTotal"
|
|
|
+ @change=""
|
|
|
/>
|
|
|
- <el-table-column
|
|
|
- label="收款金额"
|
|
|
- prop="price"
|
|
|
- />
|
|
|
- </el-table>
|
|
|
+ </el-row>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
+ <el-dialog
|
|
|
+ v-model="paymentEditShow"
|
|
|
+ title="收款编辑"
|
|
|
+ width="40%"
|
|
|
+ >
|
|
|
+ <el-form>
|
|
|
+ <el-form-item
|
|
|
+ label="收款金额:"
|
|
|
+ size="large"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="editAmount"
|
|
|
+ placeholder="请输入收款金额"
|
|
|
+ clearable
|
|
|
+ type="number"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="收款日期:"
|
|
|
+ size="large"
|
|
|
+ >
|
|
|
+ <el-date-picker
|
|
|
+ v-model="paymentEditData.collectionTime"
|
|
|
+ type="date"
|
|
|
+ placeholder="请选择收款日期"
|
|
|
+ format="YYYY-MM-DD"
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
+ clearable
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="收款备注:"
|
|
|
+ size="large"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="paymentEditData.remarks"
|
|
|
+ placeholder="请输入收款备注"
|
|
|
+ clearable
|
|
|
+ type="textarea"
|
|
|
+ maxlength="100"
|
|
|
+ show-word-limit
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="large"
|
|
|
+ @click="paymentEdit"
|
|
|
+ >
|
|
|
+ 确认
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+ <el-dialog
|
|
|
+ v-model="paymentAddShow"
|
|
|
+ title="新增收款"
|
|
|
+ width="40%"
|
|
|
+ >
|
|
|
+ <el-form>
|
|
|
+ <el-form-item
|
|
|
+ label="收款金额:"
|
|
|
+ size="large"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="addAmount"
|
|
|
+ placeholder="请输入收款金额"
|
|
|
+ clearable
|
|
|
+ type="number"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="收款日期:"
|
|
|
+ size="large"
|
|
|
+ >
|
|
|
+ <el-date-picker
|
|
|
+ v-model="paymentAddData.collectionTime"
|
|
|
+ type="date"
|
|
|
+ placeholder="请选择收款日期"
|
|
|
+ format="YYYY-MM-DD"
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
+ clearable
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="收款备注:"
|
|
|
+ size="large"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="paymentAddData.remarks"
|
|
|
+ placeholder="请输入收款备注(选填)"
|
|
|
+ clearable
|
|
|
+ type="textarea"
|
|
|
+ maxlength="100"
|
|
|
+ show-word-limit
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="large"
|
|
|
+ @click="paymentAdd"
|
|
|
+ >
|
|
|
+ 确认
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref } from 'vue'
|
|
|
-import { Search } from '@element-plus/icons-vue'
|
|
|
+import { reactive, ref } from 'vue'
|
|
|
+import { Search, Delete, Edit, Notebook, Plus } from '@element-plus/icons-vue'
|
|
|
+import { retrievalCollection, updateCollection, deleteCollection, createCollection } from '@/api/collection'
|
|
|
import { collectionOperate } from '@/pinia/collection/Collection'
|
|
|
+import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
defineOptions({
|
|
|
name: 'Payment'
|
|
|
})
|
|
|
-const paymentTime = ref('')
|
|
|
const pay = collectionOperate()
|
|
|
-console.log(pay.paymentList)
|
|
|
+// 数据
|
|
|
+const condition = reactive({
|
|
|
+ pageInfo: {
|
|
|
+ page: 1,
|
|
|
+ pageSize: 10
|
|
|
+ },
|
|
|
+ code: '',
|
|
|
+ time: ''
|
|
|
+})
|
|
|
+
|
|
|
+const paymentEditShow = ref(false)
|
|
|
+const paymentEditData = reactive({
|
|
|
+ id: 0,
|
|
|
+ projectCode: '',
|
|
|
+ price: 0,
|
|
|
+ remarks: '',
|
|
|
+ collectionTime: ''
|
|
|
+})
|
|
|
+const editAmount = ref('')
|
|
|
+
|
|
|
+const paymentAddShow = ref(false)
|
|
|
+
|
|
|
+const paymentAddData = reactive({
|
|
|
+ projectCode: '',
|
|
|
+ price: 0,
|
|
|
+ remarks: '',
|
|
|
+ collectionTime: ''
|
|
|
+})
|
|
|
+const addAmount = ref('')
|
|
|
+// 方法
|
|
|
+const openPaymentEdit = (row) => {
|
|
|
+ paymentEditShow.value = true
|
|
|
+ paymentEditData.projectCode = row.projectCode
|
|
|
+ paymentEditData.collectionTime = row.collectionTime
|
|
|
+ paymentAmount.value = row.price
|
|
|
+ paymentEditData.id = row.ID
|
|
|
+ paymentEditData.remarks = row.remarks
|
|
|
+}
|
|
|
+
|
|
|
+const paymentEdit = () => {
|
|
|
+ paymentEditData.price = parseFloat(paymentAmount.value)
|
|
|
+ updateCollection(paymentEditData).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ ElMessage({
|
|
|
+ message: '编辑成功',
|
|
|
+ type: 'success',
|
|
|
+ showClose: true,
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ paymentEditShow.value = false
|
|
|
+ pay.getPaymentList(paymentEditData.projectCode)
|
|
|
+}
|
|
|
+const paymentDelete = (row) => {
|
|
|
+ console.log(row)
|
|
|
+ ElMessageBox.confirm(
|
|
|
+ '确定要删除该收款记录吗?',
|
|
|
+ '删除记录',
|
|
|
+ {
|
|
|
+ confirmButtonText: '删除',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then(() => {
|
|
|
+ const id = { id: row.ID }
|
|
|
+ deleteCollection(id).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ if (res.code === 0) {
|
|
|
+ ElMessage({
|
|
|
+ message: '删除成功',
|
|
|
+ type: 'success',
|
|
|
+ showClose: true,
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ pay.getPaymentList(row.projectCode)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(() => {})
|
|
|
+}
|
|
|
+
|
|
|
+const searchCollection = () => {
|
|
|
+ condition.code = pay.paymentCode
|
|
|
+ retrievalCollection(condition).then(res => {
|
|
|
+ console.log(res.data)
|
|
|
+ if (res.code === 0) {
|
|
|
+ pay.changePaymentList(res.data.list)
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const paymentAdd = () => {
|
|
|
+ const addData = paymentAddData
|
|
|
+ addData.price = addAmount.value.length === 0 ? 0 : parseFloat(addAmount.value)
|
|
|
+ addData.projectCode = pay.paymentCode
|
|
|
+ const summary = {
|
|
|
+ 'price': '请输入收款金额',
|
|
|
+ 'collectionTime': '请选择收款日期'
|
|
|
+ }
|
|
|
+ for (const item in addData) {
|
|
|
+ if (item === 'remarks') {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if (addData[item] === '' || addData[item] === 0 || addData[item] === null) {
|
|
|
+ ElMessage({
|
|
|
+ message: summary[item],
|
|
|
+ type: 'error',
|
|
|
+ showClose: true,
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ createCollection(addData).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ if (res.code === 0) {
|
|
|
+ ElMessage({
|
|
|
+ message: '新增成功',
|
|
|
+ type: 'success',
|
|
|
+ showClose: true,
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ addAmount.value = ''
|
|
|
+ paymentAddData.collectionTime = ''
|
|
|
+ pay.getPaymentList(pay.paymentCode)
|
|
|
+ paymentAddShow.value = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
</script>
|
|
|
|