import Magix from 'magix' import * as View from '../../view' Magix.applyStyle('@./back-old-confirm.less') export default View.extend({ tmpl: '@back-old-confirm.html', init (options) { this.options = options }, render () { const reasonList = [{ text: '标签不容易找到', value: '1' }, { text: '人群圈选过程较复杂', value: '2' }, { text: '旧版人群还需要再编辑修改', value: '3' }, { text: '习惯旧版操作', value: '4' }] this.updater.digest({ reason: '', reasonList, selectedReasons: [] }) }, async 'goOld' (e) { try { const { reason, selectedReasons } = this.updater.get() if (!selectedReasons.length) { return this.alert('提示', '至少选择一个原因', null, { mask: true }) } const params = { select: selectedReasons.join(','), reason } const models = [{ name: 'api_user_old_version_post', params, isJson: true }] await this.fetch(models) this.options.callback(true) } catch (error) { this.alert('错误提示', error.msg || error.message || error, null, { mask: true }) } }, 'cancel' (e) { this.options.callback(false) this.options.dialog.close() } })