回筐、账单完成

This commit is contained in:
liu
2026-08-14 01:19:47 +08:00
parent e35c951a59
commit bf8ac68391
39 changed files with 1392 additions and 963 deletions
@@ -60,6 +60,8 @@ return new class extends Migration
$table->string('phone', 20)->default('')->comment('联系电话');
$table->string('address', 255)->default('')->comment('门店地址');
$table->integer('payment_cycle_days')->default(0)->comment('回款周期(天)');
$table->integer('pending_box_num')->default(0)->comment('待回筐数量(生成账单压筐累加,回筐登记扣减)');
$table->integer('pending_tray_num')->default(0)->comment('待回托盘数量');
$table->integer('status')->default(1)->comment('状态(1正常 0停用)');
$table->string('remark', 255)->nullable()->default('')->comment('备注');
$table->timestamps();
@@ -41,6 +41,7 @@ return new class extends Migration
$table->integer('order_id')->comment('订单ID');
$table->integer('store_id')->comment('门店ID');
$table->integer('purchase_id')->default(0)->comment('归属采购单ID0=未归集)');
$table->integer('bill_id')->default(0)->comment('归属账单ID0=未出账)');
$table->integer('product_id')->comment('商品ID');
$table->integer('category_id')->default(0)->comment('分类ID');
$table->integer('supplier_id')->default(0)->comment('供应商ID');
@@ -59,6 +60,7 @@ return new class extends Migration
$table->timestamps();
$table->index(['order_id'], 'store_order_item_order_index');
$table->index(['purchase_id'], 'store_order_item_purchase_index');
$table->index(['bill_id'], 'store_order_item_bill_index');
$table->index(['store_id', 'product_id'], 'store_order_item_store_product_index');
$table->comment('门店订货明细表');
});
@@ -8,7 +8,7 @@ return new class extends Migration
{
/**
* Run the migrations.
* 对账管理(D1-D10):财务对账、门店对账单、结算表
* 财务管理(D1-D10):财务对账、结算表(门店对账单已下线,由采购单账单 bill 表替代)
*/
public function up(): void
{
@@ -58,48 +58,6 @@ return new class extends Migration
});
}
// 门店对账单表(门店在小程序端自助生成,回款周期快照决定应结算日期)
if (! Schema::hasTable('statement')) {
Schema::create('statement', function (Blueprint $table) {
$table->increments('id')->comment('对账单ID');
$table->string('statement_no', 32)->unique()->comment('对账单编号');
$table->integer('store_id')->comment('门店ID');
$table->date('period_start')->comment('对账周期开始');
$table->date('period_end')->comment('对账周期结束');
$table->decimal('total_amount', 10, 2)->default(0)->comment('对账总金额');
$table->integer('payment_cycle_days')->default(0)->comment('回款周期(天),生成时从门店快照');
$table->date('settlement_date')->nullable()->comment('应结算日期(按回款周期计算)');
$table->integer('status')->default(0)->comment('状态(0未对账 1已对账 2已结算)');
$table->timestamp('reconciled_at')->nullable()->comment('对账完成时间');
$table->timestamp('settled_at')->nullable()->comment('结算时间');
$table->string('remark', 255)->default('')->comment('备注');
$table->timestamps();
$table->index(['store_id', 'period_start'], 'statement_store_period_index');
$table->comment('门店对账单表');
});
}
// 门店对账单明细表(每个单品/订单的对账状态标识)
if (! Schema::hasTable('statement_item')) {
Schema::create('statement_item', function (Blueprint $table) {
$table->increments('id')->comment('明细ID');
$table->integer('statement_id')->comment('对账单ID');
$table->integer('order_id')->comment('订单ID');
$table->integer('order_item_id')->comment('订货明细ID');
$table->integer('product_id')->comment('商品ID');
$table->string('product_name', 100)->comment('品名(快照)');
$table->decimal('price', 10, 2)->default(0)->comment('单价');
$table->decimal('quantity', 10, 2)->default(0)->comment('订货量');
$table->decimal('weight', 10, 3)->default(0)->comment('重量');
$table->decimal('amount', 10, 2)->default(0)->comment('单品金额');
$table->integer('is_reconciled')->default(0)->comment('对账状态(1已对账 0未对账)');
$table->string('store_remark', 255)->default('')->comment('门店备注');
$table->timestamps();
$table->index(['statement_id'], 'statement_item_statement_index');
$table->comment('门店对账单明细表');
});
}
// 结算表(D9 对账结束后生成结算表/回框统计表,D10 下载存档)
if (! Schema::hasTable('settlement')) {
Schema::create('settlement', function (Blueprint $table) {
@@ -131,8 +89,6 @@ return new class extends Migration
{
Schema::dropIfExists('reconciliation');
Schema::dropIfExists('reconciliation_item');
Schema::dropIfExists('statement');
Schema::dropIfExists('statement_item');
Schema::dropIfExists('settlement');
}
};
@@ -29,11 +29,16 @@ return new class extends Migration
$table->decimal('tray_price', 10, 2)->default(0)->comment('周转托盘单价(生成时快照)');
$table->decimal('added_amount', 10, 2)->default(0)->comment('附加金额(周转筐/托盘金额)');
$table->decimal('total_amount', 10, 2)->default(0)->comment('账单总金额 = 商品金额 + 配送费 + 附加金额');
$table->integer('status')->default(0)->comment('支付状态(0未支付 1已支付)');
$table->timestamp('paid_at')->nullable()->comment('付款时间(线下收款手动登记)');
$table->string('pay_remark', 255)->default('')->comment('付款备注(线下收款信息)');
$table->integer('paid_operator_id')->default(0)->comment('收款操作人(后台系统用户ID)');
$table->integer('operator_id')->default(0)->comment('生成人(后台系统用户ID');
$table->string('remark', 255)->default('')->comment('备注');
$table->timestamps();
$table->unique(['purchase_id', 'store_id'], 'bill_purchase_store_unique');
$table->index(['store_id', 'bill_date'], 'bill_store_date_index');
$table->index(['status'], 'bill_status_index');
$table->comment('门店账单表(采购单完成后按门店生成)');
});
}
@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
* 门店回筐台账:压筐(生成账单时自动写入)+ 回筐(门店退回,后台手动登记)
*/
public function up(): void
{
if (! Schema::hasTable('container_return')) {
Schema::create('container_return', function (Blueprint $table) {
$table->increments('id')->comment('记录ID');
$table->integer('store_id')->comment('门店ID');
$table->integer('bill_id')->default(0)->comment('关联账单ID0=手动回筐登记)');
$table->integer('type')->comment('类型(1压筐-账单生成 2回筐-退回登记)');
$table->integer('box_num')->default(0)->comment('周转筐数量');
$table->integer('tray_num')->default(0)->comment('周转托盘数量');
$table->date('return_date')->comment('记录日期(压筐=账单日期,回筐=退回日期)');
$table->integer('operator_id')->default(0)->comment('操作人(后台系统用户ID');
$table->string('remark', 255)->default('')->comment('备注');
$table->timestamps();
$table->index(['store_id', 'type'], 'container_return_store_type_index');
$table->index(['bill_id'], 'container_return_bill_index');
$table->comment('门店回筐记录表(压筐=生成账单压出,回筐=门店退回登记)');
});
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('container_return');
}
};
+29 -17
View File
@@ -91,6 +91,18 @@ class PermissionSeeder extends Seeder
['type' => 'rule', 'key' => 'product.goods.batchPrice', 'name' => '批量调价'],
],
],
[
'type' => 'route',
'key' => 'customer.supplier',
'name' => '供应商',
'path' => '/customer/supplier',
'children' => [
['type' => 'rule', 'key' => 'customer.supplier.query', 'name' => '查询'],
['type' => 'rule', 'key' => 'customer.supplier.create', 'name' => '新增'],
['type' => 'rule', 'key' => 'customer.supplier.update', 'name' => '编辑'],
['type' => 'rule', 'key' => 'customer.supplier.delete', 'name' => '删除'],
],
],
],
],
[
@@ -123,18 +135,6 @@ class PermissionSeeder extends Seeder
['type' => 'rule', 'key' => 'customer.level.delete', 'name' => '删除'],
],
],
[
'type' => 'route',
'key' => 'customer.supplier',
'name' => '供应商',
'path' => '/customer/supplier',
'children' => [
['type' => 'rule', 'key' => 'customer.supplier.query', 'name' => '查询'],
['type' => 'rule', 'key' => 'customer.supplier.create', 'name' => '新增'],
['type' => 'rule', 'key' => 'customer.supplier.update', 'name' => '编辑'],
['type' => 'rule', 'key' => 'customer.supplier.delete', 'name' => '删除'],
],
],
[
'type' => 'route',
'key' => 'customer.miniUser',
@@ -202,7 +202,7 @@ class PermissionSeeder extends Seeder
[
'type' => 'menu',
'key' => 'procurement.recon',
'name' => '对账管理',
'name' => '财务管理',
'icon' => 'AccountBookOutlined',
'children' => [
[
@@ -223,11 +223,23 @@ class PermissionSeeder extends Seeder
],
[
'type' => 'route',
'key' => 'recon.statement',
'name' => '门店账单',
'path' => '/recon/statement',
'key' => 'recon.bill',
'name' => '门店账单',
'path' => '/recon/bill',
'children' => [
['type' => 'rule', 'key' => 'recon.statement.query', 'name' => '查询'],
['type' => 'rule', 'key' => 'recon.bill.query', 'name' => '查询'],
['type' => 'rule', 'key' => 'recon.bill.pay', 'name' => '确认收款'],
],
],
[
'type' => 'route',
'key' => 'recon.containerReturn',
'name' => '回筐记录',
'path' => '/recon/container-return',
'children' => [
['type' => 'rule', 'key' => 'recon.containerReturn.query', 'name' => '查询'],
['type' => 'rule', 'key' => 'recon.containerReturn.create', 'name' => '回筐登记'],
['type' => 'rule', 'key' => 'recon.containerReturn.delete', 'name' => '删除'],
],
],
[