diff --git a/app/Dicts.php b/app/Dicts.php index c92c89ef..ca3710d8 100644 --- a/app/Dicts.php +++ b/app/Dicts.php @@ -25,8 +25,9 @@ class Dicts extends Repository 'bloc_channel' => ['运营商', '中间商'], 'package_type' => ['基础套餐', '续费包', '加油包', '可选包', '附加包'], 'tables' => ['real' => 'RD', 'virtual' => 'VD'], - 'order_status' => ['已下单', '已取消', '已出库', '已签收'], + 'order_status' => ['已下单', '已取消', '已出库', '已发货', '已签收'], 'transaction_status' => ['未收款', '已收款'], + 'company_transaction_status' => ['未付款', '已付款'], 'logistics' => ['sf' => '顺丰速运', 'sto' => '申通快递','yto' => '圆通速递', 'zto' => '中通快递', 'best' => '百世快递', 'yunda' => '韵达快递', 'ttkd'=> '天天快递', 'ems' => 'EMS邮政特快专递'], ]; diff --git a/app/Domains/Company/Http/Controllers/OrderController.php b/app/Domains/Company/Http/Controllers/OrderController.php index 96b7f20a..5a19b954 100644 --- a/app/Domains/Company/Http/Controllers/OrderController.php +++ b/app/Domains/Company/Http/Controllers/OrderController.php @@ -83,7 +83,7 @@ class OrderController extends Controller $carrierOperators = $dicts->get('carrier_operator'); $orderStatues = $dicts->get('order_status'); - $transactionStatuses = $dicts->get('transaction_status'); + $transactionStatuses = $dicts->get('company_transaction_status'); $order->load(['package:id,name,carrier_operator']); @@ -121,4 +121,18 @@ class OrderController extends Controller return res(true, '取消成功'); } + + /** + * 确认收货 + */ + public function received() + { + $ids = $this->request->ids(); + + foreach ($ids as $id) { + $res = $this->orderService->received($id); + } + + return res(true, '修改成功'); + } } diff --git a/app/Domains/Virtual/Services/OrderService.php b/app/Domains/Virtual/Services/OrderService.php index 82ff15a1..5dda6f6d 100644 --- a/app/Domains/Virtual/Services/OrderService.php +++ b/app/Domains/Virtual/Services/OrderService.php @@ -169,6 +169,26 @@ class OrderService extends Service return $node; } + /** + * 确认收货 + * + * @return bool + */ + public function received($id) + { + if (!$node = $this->orderRepository->find($id)) { + throw new NotExistException('订单不存在或已删除'); + } + + if ($node->order_status !== 3) { + throw new NotExistException('订单未发货,不能修改'); + } + + $this->orderRepository->setModel($node)->update(['order_status' => 4]); + + return $node; + } + /** * 生成订单编号 * diff --git a/database/migrations/2018_12_12_170419_create_virtual_orders_table.php b/database/migrations/2018_12_12_170419_create_virtual_orders_table.php index 4b9c5ab1..3883c1fe 100644 --- a/database/migrations/2018_12_12_170419_create_virtual_orders_table.php +++ b/database/migrations/2018_12_12_170419_create_virtual_orders_table.php @@ -33,7 +33,7 @@ class CreateVirtualOrdersTable extends Migration $table->string('mobile')->default('')->comment('电话'); $table->string('logistics_company', '20')->default('')->comment('物流公司'); $table->string('logistics_no', 64)->default('')->comment('物流单号'); - $table->tinyInteger('order_status')->unsigned()->default(0)->after('mobile')->comment('订单状态(0:已下单 1:已取消 2:已出库 3:已签收)'); + $table->tinyInteger('order_status')->unsigned()->default(0)->after('mobile')->comment('订单状态(0:已下单 1:已取消 2:已出库 3:已发货 4:已签收)'); $table->tinyInteger('transaction_status')->unsigned()->default(0)->after('order_status')->comment('收款状态(0:未收款 1:已收款)'); $table->text('logistics_remark')->nullable()->comment('物流备注'); $table->text('remark')->nullable()->comment('订单备注'); diff --git a/frontend/src/views/virtual/orders/js/index.js b/frontend/src/views/virtual/orders/js/index.js index 4273e1a6..ccd97bab 100644 --- a/frontend/src/views/virtual/orders/js/index.js +++ b/frontend/src/views/virtual/orders/js/index.js @@ -253,7 +253,7 @@ export default { click: () => { this.getLogistics().then(logistics => { this.$Modal.confirm({ - title: '请确认订单是否已签收?', + title: '请填写发货信息', render: (h) => { let Options = []; for (const key in logistics) { @@ -305,7 +305,36 @@ export default { }); } } - }, '确认签收')); + }, '订单发货')); + } + + if (row.order_status === 3) { + html.push(h('Button', { + props: { + type: 'warning', + size: 'small', + disabled: false + }, + class: ['btn'], + on: { + click: () => { + this.$Modal.confirm({ + title: '提示', + content: '请确认订单是否已收货?', + onOk: () => { + API.update({ + order_status: 4 + }, row.id).then(res => { + if (res.code == 0) { + this.$Message.success('修改成功'); + this.request(); + } + }); + } + }); + } + } + }, '确认收货')); } }