确认收货

This commit is contained in:
邓皓元 2018-12-19 13:42:17 +08:00
parent d70dd935e5
commit faa517c3df
5 changed files with 69 additions and 5 deletions

View File

@ -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邮政特快专递'],
];

View File

@ -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, '修改成功');
}
}

View File

@ -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;
}
/**
* 生成订单编号
*

View File

@ -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('订单备注');

View File

@ -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();
}
});
}
});
}
}
}, '确认收货'));
}
}