define(['jquery', 'bootstrap', 'backend', 'form'], function ($, undefined, Backend, Form) { var Controller = { index: function () { new Vue({ el: '#splitReceiverIndex', data: { listData: [], loading: false }, mounted() { this.getList(); }, methods: { getList() { this.loading = true; Fast.api.ajax({ url: 'shopro/split/receiver/index', type: 'GET', data: { limit: 100 } }, (ret, res) => { this.listData = (res.data && res.data.rows) || []; this.loading = false; return false; }, () => { this.loading = false; }); }, openAdd() { Backend.api.open('shopro/split/receiver/add', '添加接收方', { callback: () => this.getList() }); }, syncWx(id) { Fast.api.ajax({ url: 'shopro/split/receiver/syncWx/ids/' + id, type: 'POST' }, () => this.getList()); }, wxStatusText(s) { return { 0: '待同步', 1: '已同步', 2: '失败' }[s] || '-'; }, channelText(c) { return c === 'huifu' ? '汇付' : '微信'; }, roleTypeText(type) { const map = { platform: '平台', promoter: '推广员', regional_agent: '区域公司', }; return map[type] || type; } } }); }, add: function () { Form.api.bindevent($('form[role=form]')); } }; return Controller; });