--[[ @module tsb_bsk_page @summary 报税口演示页面 @version 1.0 @date 2026.03.04 @author 李一玮 @usage 本文件是报税口演示页面,展示报税口的各种用法。 ]] local tsb_bsk_page = {} -- 页面UI元素 local main_container = nil local common_ui = require("tsb_common_page") -- 创建UI function tsb_bsk_page.create_ui() main_container = airui.container({ x = 0, y = 0, w = 480, h = 320, color = 0xF5F5F5, }) --------------------- 标题栏 ------------------------ local title_bar = airui.container({ parent = main_container, x = 0, y = 0, w = 480, h = 30, color = 0x007AFF, }) airui.label({ parent = title_bar, text = "报税口", x = 210, y = 8, w = 80, h = 20, font_size = 16, color = 0xFFFFFF, }) -- 标题栏公共信息展示 common_ui.add_battery_display(title_bar) common_ui.create_back_button(title_bar, tsb_bsk_page.cleanup) --------------------------------------------------- -- 滚动容器 local scroll_container = airui.container({ parent = main_container, x = 0, y = 30, w = 480, h = 270, color = 0xF5F5F5, }) local keyboard1 = airui.keyboard({ x = 0, y = 0, w = 480, h = 160, -- x, y, 键盘默认打开ALIGN_BOTTOM_MID,位置从中下方开始计算 mode = "numeric", -- 键盘模式,可选 "text"/"upper"/"lower"/"numeric" auto_hide = true, -- 自动隐藏键盘 bg_color = 0xf1f1f1, -- 键盘背景颜色为灰色,可选,不设置则透明 on_commit = function() -- 确认事件回调,只有在按下确认键时才会触发 log.info("keyboard", "commit") end }) --------------------- 接口号 ------------------------ airui.label({ parent = scroll_container, text = "接口号:", x = 5, y = 17, w = 55, h = 20, font_size = 15, }) local tax_dropdown = airui.dropdown({ parent = scroll_container, x = 60, y = 7, w = 55, h = 35, options = {"A", "B"}, default_index = 0, on_change = function(self,idx) -- local texts = {"选项1", "选项2", "选项3", "选项4", "选项5"} -- selected_label1:set_text("当前选中: " .. texts[idx + 1]) end }) --------------------------------------------------- --------------------- 枪号 ------------------------ airui.label({ parent = scroll_container, text = "枪号:", x = 120, y = 17, w = 40, h = 20, font_size = 15, }) local gunnum_input = airui.textarea({ parent = scroll_container, x = 160, y = 7, w = 55, h = 35, text = "1", -- placeholder = "...", max_len = 1, keyboard = keyboard1 }) --------------------------------------------------- --------------------- 新国标开关 ------------------- airui.label({ parent = scroll_container, text = "新国标", x = 217, y = 17, w = 50, h = 20, font_size = 15, }) local switch_new_tax = airui.switch({ parent = scroll_container, x = 267, y = 12, w = 50, h = 25, checked = false, on_change = function(self) log.info("NEW_TAX", self:get_state() and "开启" or "关闭") end }) --------------------------------------------------- -------------------- 新国标报税口 ------------------ airui.label({ parent = scroll_container, text = "新国标报税口", x = 320, y = 17, w = 95, h = 40, font_size = 15, }) local new_tax_num_input = airui.textarea({ parent = scroll_container, x = 415, y = 7, w = 55, h = 35, text = "1", -- placeholder = "...", max_len = 1, keyboard = keyboard1 }) --------------------------------------------------- ----------------- 查询税控序列号区域 --------------- local tax_serial_container = airui.container({ parent = scroll_container, x = 10, y = 50, w = 160, h = 210, color = 0xFFFFFF, radius = 5, }) local tax_serial_btn = airui.button({ parent = tax_serial_container, x = 20, y = 12, w = 120, h = 35, text = "查询税控序列号", stype = { bg_color = 0x2B6FF1,border_color = 0x2B6FF1, text_color = 0xFFFFFF, radius = 8 }, on_click = function(self) log.info("button", "基本按钮被点击") end }) -- 查询结果显示 airui.label({ parent = tax_serial_container, text = "税控序列号:", x = 10, y = 60, w = 120, h = 20, font_size = 14, }) local label_tax_serial = airui.label({ parent = tax_serial_container, text = "0123456789", x = 10, y = 80, w = 150, h = 20, font_size = 14, }) airui.label({ parent = tax_serial_container, text = "厂家:", x = 10, y = 110, w = 40, h = 20, font_size = 14, }) local label_company = airui.label({ parent = tax_serial_container, text = "拓盛", x = 50, y = 110, w = 90, h = 20, font_size = 14, }) airui.label({ parent = tax_serial_container, text = "枪个数:", x = 10, y = 150, w = 60, h = 20, font_size = 14, }) local label_gunnum = airui.label({ parent = tax_serial_container, text = "2", x = 70, y = 150, w = 80, h = 20, font_size = 14, }) airui.label({ parent = tax_serial_container, text = "执行结果:", x = 10, y = 190, w = 70, h = 20, font_size = 14, }) local label_tax_serial_result = airui.label({ parent = tax_serial_container, text = "执行成功", x = 80, y = 190, w = 80, h = 20, font_size = 14, }) --------------------------------------------------- ----------------- 日累月累总累 ------------------ local tax_msg_container = airui.container({ parent = scroll_container, x = 180, y = 50, w = 290, h = 210, color = 0xFFFFFF, radius = 5, }) local year_input = airui.textarea({ parent = tax_msg_container, x = 10, y = 7, w = 70, h = 35, text = os.date('%Y'), -- placeholder = "...", max_len = 4, keyboard = keyboard1 }) airui.label({ parent = tax_msg_container, text = "年", x = 85, y = 18, w = 20, h = 20, font_size = 15, }) local month_dropdown = airui.dropdown({ parent = tax_msg_container, x = 105, y = 7, w = 65, h = 35, options = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"}, default_index = 0, on_change = function(self,idx) -- local texts = {"选项1", "选项2", "选项3", "选项4", "选项5"} -- selected_label1:set_text("当前选中: " .. texts[idx + 1]) end }) airui.label({ parent = tax_msg_container, text = "月", x = 175, y = 18, w = 20, h = 20, font_size = 15, }) local day_dropdown = airui.dropdown({ parent = tax_msg_container, x = 195, y = 7, w = 65, h = 35, options = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"}, default_index = 0, on_change = function(self,idx) -- local texts = {"选项1", "选项2", "选项3", "选项4", "选项5"} -- selected_label1:set_text("当前选中: " .. texts[idx + 1]) end }) airui.label({ parent = tax_msg_container, text = "日", x = 265, y = 18, w = 20, h = 20, font_size = 15, }) local check_total_btn = airui.button({ parent = tax_msg_container, x = 10, y = 50, w = 120, h = 35, text = "查当次及总累", stype = { bg_color = 0x2B6FF1,border_color = 0x2B6FF1, text_color = 0xFFFFFF, radius = 8 }, on_click = function(self) log.info("button", "基本按钮被点击") end }) local check_day_btn = airui.button({ parent = tax_msg_container, x = 140, y = 50, w = 60, h = 35, text = "查日累", stype = { bg_color = 0x2B6FF1,border_color = 0x2B6FF1, text_color = 0xFFFFFF, radius = 8 }, on_click = function(self) log.info("button", "基本按钮被点击") end }) local check_month_btn = airui.button({ parent = tax_msg_container, x = 210, y = 50, w = 60, h = 35, text = "查月累", stype = { bg_color = 0x2B6FF1,border_color = 0x2B6FF1, text_color = 0xFFFFFF, radius = 8 }, on_click = function(self) log.info("button", "基本按钮被点击") end }) airui.label({ parent = tax_msg_container, text = "金额:", x = 10, y = 100, w = 50, h = 20, font_size = 14, }) local label_money = airui.label({ parent = tax_msg_container, text = "9999.99", x = 50, y = 100, w = 70, h = 20, font_size = 14, }) airui.label({ parent = tax_msg_container, text = "油量:", x = 10, y = 120, w = 50, h = 20, font_size = 14, }) local label_oil = airui.label({ parent = tax_msg_container, text = "9999.99", x = 50, y = 120, w = 70, h = 20, font_size = 14, }) airui.label({ parent = tax_msg_container, text = "单价:", x = 10, y = 140, w = 50, h = 20, font_size = 14, }) local label_price = airui.label({ parent = tax_msg_container, text = "99.99", x = 50, y = 140, w = 50, h = 20, font_size = 14, }) airui.label({ parent = tax_msg_container, text = "是否密文:", x = 10, y = 160, w = 70, h = 20, font_size = 14, }) local label_encryption = airui.label({ parent = tax_msg_container, text = "是", x = 80, y = 160, w = 30, h = 20, font_size = 14, }) airui.label({ parent = tax_msg_container, text = "总金额", x = 185, y = 100, w = 70, h = 20, font_size = 14, }) local label_total_money = airui.label({ parent = tax_msg_container, text = "1234567891234.99", x = 140, y = 120, w = 150, h = 30, font_size = 14, }) airui.label({ parent = tax_msg_container, text = "总油量", x = 185, y = 140, w = 70, h = 20, font_size = 14, }) local label_total_oil = airui.label({ parent = tax_msg_container, text = "1234567891234.99", x = 140, y = 160, w = 150, h = 30, font_size = 14, }) airui.label({ parent = tax_msg_container, text = "执行结果:", x = 10, y = 190, w = 70, h = 20, font_size = 14, }) local label_check_result = airui.label({ parent = tax_msg_container, text = "执行成功", x = 80, y = 190, w = 120, h = 20, font_size = 14, }) -- 底部信息栏 common_ui.create_status_bar(main_container) end -- 初始化页面 function tsb_bsk_page.init(params) tsb_bsk_page.create_ui() end -- 清理页面 function tsb_bsk_page.cleanup() if main_container then main_container:destroy() main_container = nil end end return tsb_bsk_page