# -*- coding:utf-8 -*-
# 作者：齐振鋆
# 日期：2023/2/20
# 描述: 仓库拣货页面
import logging
import allure

from component.GuKeYiTiHua import iframe, menu, list_page, button, order_detail_main, modal
from component.GuKeYiTiHua.StorageManage import first_menu

log = logging.getLogger(__name__)


class WarehousePick(object):
    third_menu = '仓库拣货'

    def __init__(self):
        self.iframe = iframe
        self.menu = menu
        self.list_page = list_page
        self.button = button
        self.order_detail_main = order_detail_main
        self.modal = modal

    @allure.step('打开菜单：{}'.format(third_menu))
    def open_menu_warehouse_pick(self):
        self.iframe.out_frame()
        self.menu.open_menu(first_menu, self.third_menu)

    @allure.step('查询：{}'.format(third_menu))
    def pick_order_search(self, tap_name='待办', order_code=None, count=1):
        self.list_page.order_search(self.third_menu, tap_name, '订单号', order_code, count)

    @allure.step('{}'.format(third_menu))
    def pick_confirm(self, order_code):
        self.pick_order_search(order_code=order_code)
        self.list_page.open_order('拣货单号')
        self.button.click_button(button_name='拣货确认')
        self.list_page.edit_iframe_is_show()
