| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561 |
- --[[
- @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
|