define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: () => { const { reactive, onMounted } = Vue const index = { setup() { const state = reactive({ data: [] }) const pagination = reactive({ page: 1, list_rows: 10, total: 0 }) const logs = reactive({ visible: false, plan: null, rows: [] }) function getData() { Fast.api.ajax({ url: 'shopro/partner/voucher', type: 'GET', data: { page: pagination.page, list_rows: pagination.list_rows }, }, function (ret, res) { state.data = res.data.data pagination.total = res.data.total return false }, function () { }) } function onClose(row) { Fast.api.ajax({ url: 'shopro/partner/voucher/close', type: 'POST', data: { id: row.id }, }, function () { getData() }) } function onLogs(row) { Fast.api.ajax({ url: 'shopro/partner/voucher/logs', type: 'GET', data: { id: row.id }, }, function (ret, res) { logs.plan = res.data.plan logs.rows = res.data.logs || [] logs.visible = true return false }, function () { }) } onMounted(() => { getData() }) return { state, pagination, getData, onClose, onLogs, logs } } } createApp('index', index); }, }; return Controller; });