店员和超级管理员都提示没有核销权限
修复文件:app\controller\cashier\Order
修改方法:writeoffFrom()
public function writeoffFrom(WriteOffOrderServices $writeOffOrderServices, $id)
{
if (!$id) {
return $this->fail('缺少核销订单ID');
}
$orderInfo = $this->services->getOne(['id' => $id, 'is_del' => 0], '*', ['pink']);
if (!$orderInfo) {
return $this->fail('核销订单未查到!');
}
$data = $this->request->postMore([
['cart_id', ''],//核销订单商品cart_id
['cart_num', 0]
]);
$cart_ids[] = $data;
if ($cart_ids) {
foreach ($cart_ids as $cart) {
if (!isset($cart['cart_id']) || !$cart['cart_id'] || !isset($cart['cart_num']) || !$cart['cart_num'] || $cart['cart_num'] <= 0) {
return $this->fail('请重新选择发货商品,或发货件数');
}
}
}
return app('json')->success('核销成功', $writeOffOrderServices->writeoffOrder(0, $orderInfo->toArray(), $cart_ids, 0, (int)$this->cashierId));
}