const { DataTypes } = require('sequelize'); const sequelize = require('../config/db'); const Bill = require('./Bill'); const BillPayment = sequelize.define('BillPayment', { id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, comment: '支付流水ID' }, billId: { type: DataTypes.INTEGER, allowNull: false, references: { model: Bill, key: 'id' }, comment: '账单ID' }, amount: { type: DataTypes.DECIMAL(10, 2), allowNull: false, comment: '本次支付金额' }, paymentMethod: { type: DataTypes.ENUM('cash', 'bank_transfer', 'alipay', 'wechat', 'other'), allowNull: false, comment: '支付方式(cash-现金, bank_transfer-银行转账, alipay-支付宝, wechat-微信支付, other-其他)' }, paymentTime: { type: DataTypes.DATE, allowNull: false, comment: '支付时间' }, transactionNo: { type: DataTypes.STRING(100), allowNull: true, comment: '交易流水号/凭证号' }, remark: { type: DataTypes.TEXT, allowNull: true, comment: '备注' }, createBy: { type: DataTypes.INTEGER, allowNull: true, comment: '创建人ID' }, createTime: { type: DataTypes.DATE, defaultValue: DataTypes.NOW, comment: '创建时间' }, tenantId: { type: DataTypes.INTEGER, allowNull: false, comment: '租户ID' }, isDeleted: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 0, comment: '删除状态(0:未删除,1:已删除)' } }, { tableName: 'bill_payments', timestamps: false, comment: '账单支付流水表' }); module.exports = BillPayment;