# -*- coding:utf-8 -*-
# 作者：齐振鋆
# 日期：2023/2/27
# 描述: 仓库上架
import logging
import allure

from component.GuKeYiTiHua import iframe, menu, list_page, button, order_detail_main, modal
from component.GuKeYiTiHua.StorageManage import first_menu
from page.GuKeYiTiHua.Public.orderDetailPage import OrderDetailTable

log = logging.getLogger(__name__)


class WarehouseUp(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.order_detail_table = OrderDetailTable()
        self.modal = modal

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

    @allure.step('查询：{}'.format(third_menu))
    def up_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 up_confirm(self, order_code):
        log.info('上架办理')
        self.up_order_search(order_code=order_code)
        self.list_page.open_order('订单号')
        self.button.transact()
        self.list_page.edit_iframe_is_show()
