Skip to content

Commit

Permalink
referehs
Browse files Browse the repository at this point in the history
  • Loading branch information
qinmingyuan committed Dec 3, 2024
1 parent c6210df commit 89b7a6e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
10 changes: 10 additions & 0 deletions app/controllers/trade/admin/desk/items_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ def history
@items = Item.includes(:user, :item_promotes, :order).default_where(q_params).order(order_id: :desc).page(params[:page]).per(params[:per])
end

def done
q_params = {
status: 'ordered'
}
q_params.merge! default_params
q_params.merge! params.permit(:cart_id, :order_id, :good_type, :good_id, :desk_id, :aim, :address_id, :status)

@items = Item.default_where(q_params).update_all status: 'done'
end

private
def set_desk
@desk = Space::Desk.default_where(default_params).find params[:desk_id]
Expand Down
10 changes: 3 additions & 7 deletions app/views/trade/admin/desk/items/_index/_button_actions.html.erb
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
<div class="buttons are-small">
<%= form_with url: { controller: 'orders', action: 'batch_pay' }, data: { controller: 'check-commit', check_commit_check_outlet: 'th' }, class: 'button_to display-none' do |f| %>
<%= f.hidden_field :ids, data: { check_commit_target: 'ids' } %>
<%= button_tag data: { action: 'check-commit#doSubmit' }, class: 'button text-warning' do %>
<i class="fa-brands fa-weixin"></i>
<span class="ml-1"><%= t('.orders.batch_pay.title') %></span>
<% end %>
<% end if false %>
<%= button_to({ controller: 'payments', action: 'desk_scan', desk_id: @desk.id }, class: 'button is-link') do %>
<span><%= t('.payments.desk_scan.title') %></span>
<% end %>
<%= button_to({ controller: 'payments', action: 'desk_hand', desk_id: @desk.id }, class: 'button is-link') do %>
<span><%= t('.payments.desk_hand.title') %></span>
<% end %>
<%= button_to({ action: 'done' }, class: 'button is-link') do %>
<span><%= t('.done.title') %></span>
<% end %>
<%= button_to({ controller: 'space/admin/desks', action: 'print_all', station_id: @desk.room.station_id, room_id: @desk.room_id, id: @desk.id }, class: 'button is-primary') do %>
<i class="fa-solid fa-print"></i>
<span class="ml-1"><%= t('space.admin.desks.print_all.title') %></span>
Expand Down
1 change: 1 addition & 0 deletions app/views/trade/admin/desk/items/done.turbo_stream.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= turbo_stream.append 'body', partial: 'visit', locals: { url: url_for(action: 'index') } %>
4 changes: 3 additions & 1 deletion config/locales/zh.controller.admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,6 @@ zh:
index:
title: 点单详情
history:
title: 订单历史
title: 订单历史
done:
title: 清台
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
resources :items, controller: 'desk/items' do
collection do
get :history
post :done
end
end
end
Expand Down

0 comments on commit 89b7a6e

Please sign in to comment.