162 行
7.2 KiB
JavaScript
162 行
7.2 KiB
JavaScript
define(['jquery', 'bootstrap', 'backend'], function ($, undefined, Backend) {
|
|
|
|
function withVue(callback) {
|
|
if (typeof Vue !== 'undefined') {
|
|
callback(Vue);
|
|
return;
|
|
}
|
|
require.config({
|
|
paths: {
|
|
'vue': '../addons/shopro/libs/vue',
|
|
'ELEMENT': '../addons/shopro/libs/element/element'
|
|
},
|
|
shim: {
|
|
'ELEMENT': {
|
|
deps: ['css!../addons/shopro/libs/element/element.css', 'vue']
|
|
}
|
|
}
|
|
});
|
|
require(['vue', 'ELEMENT'], function (Vue, ELEMENT) {
|
|
Vue.use(ELEMENT);
|
|
callback(Vue);
|
|
});
|
|
}
|
|
|
|
var Controller = {
|
|
index: function () {
|
|
withVue(function (Vue) {
|
|
new Vue({
|
|
el: '#huifuOnboardIndex',
|
|
data: {
|
|
listData: [],
|
|
loading: false,
|
|
filterStatus: '',
|
|
detailVisible: false,
|
|
detailLoading: false,
|
|
detailData: null,
|
|
detailId: 0
|
|
},
|
|
computed: {
|
|
previewList: function () {
|
|
if (!this.detailData || !this.detailData.form) {
|
|
return [];
|
|
}
|
|
var f = this.detailData.form;
|
|
return [f.id_card_front_url, f.id_card_back_url, f.bank_card_url].filter(function (u) { return !!u; });
|
|
}
|
|
},
|
|
mounted: function () {
|
|
this.getList();
|
|
},
|
|
methods: {
|
|
getList: function () {
|
|
var vm = this;
|
|
vm.loading = true;
|
|
Fast.api.ajax({
|
|
url: 'shopro_huifu/onboard/index',
|
|
type: 'GET',
|
|
data: { limit: 200, status: vm.filterStatus }
|
|
}, function (ret, res) {
|
|
vm.listData = (res.data && res.data.rows) || [];
|
|
vm.loading = false;
|
|
return false;
|
|
}, function () {
|
|
vm.loading = false;
|
|
});
|
|
},
|
|
openDetail: function (id) {
|
|
var vm = this;
|
|
vm.detailId = id;
|
|
vm.detailVisible = true;
|
|
vm.detailLoading = true;
|
|
vm.detailData = null;
|
|
Fast.api.ajax({
|
|
url: 'shopro_huifu/onboard/index',
|
|
type: 'GET',
|
|
data: { detail_id: id }
|
|
}, function (ret, res) {
|
|
vm.detailData = res.data || null;
|
|
vm.detailLoading = false;
|
|
return false;
|
|
}, function () {
|
|
vm.detailLoading = false;
|
|
});
|
|
},
|
|
goAudit: function (url) {
|
|
if (!url) return;
|
|
Backend.api.addtabs(url, '业务审核');
|
|
},
|
|
submitRow: function (id) {
|
|
var vm = this;
|
|
Layer.confirm('确认资料无误并提交汇付进件?', function (index) {
|
|
Layer.close(index);
|
|
Fast.api.ajax({ url: 'shopro_huifu/onboard/submit/ids/' + id, type: 'POST' }, function () {
|
|
vm.getList();
|
|
if (vm.detailVisible && vm.detailId === id) {
|
|
vm.openDetail(id);
|
|
}
|
|
});
|
|
});
|
|
},
|
|
pollRow: function (id) {
|
|
var vm = this;
|
|
Fast.api.ajax({ url: 'shopro_huifu/onboard/poll/ids/' + id, type: 'POST' }, function () {
|
|
vm.getList();
|
|
if (vm.detailVisible && vm.detailId === id) {
|
|
vm.openDetail(id);
|
|
}
|
|
});
|
|
},
|
|
retryRow: function (id) {
|
|
var vm = this;
|
|
Fast.api.ajax({ url: 'shopro_huifu/onboard/retry/ids/' + id, type: 'POST' }, function () {
|
|
vm.getList();
|
|
if (vm.detailVisible && vm.detailId === id) {
|
|
vm.openDetail(id);
|
|
}
|
|
});
|
|
},
|
|
submitFromDetail: function () {
|
|
if (this.detailId) {
|
|
this.submitRow(this.detailId);
|
|
}
|
|
},
|
|
pollFromDetail: function () {
|
|
if (this.detailId) {
|
|
this.pollRow(this.detailId);
|
|
}
|
|
},
|
|
retryFromDetail: function () {
|
|
if (this.detailId) {
|
|
this.retryRow(this.detailId);
|
|
}
|
|
},
|
|
statusText: function (status) {
|
|
var map = {
|
|
draft: '待后台审核',
|
|
submitting: '提交中',
|
|
basic_ok: '开户成功',
|
|
busi_pending: '汇付审核中',
|
|
approved: '已通过',
|
|
rejected: '已驳回',
|
|
failed: '失败'
|
|
};
|
|
return map[status] || status || '-';
|
|
},
|
|
roleText: function (role) {
|
|
return role === 'regional_agent' ? '区域代理' : (role === 'promoter' ? '推广员' : role);
|
|
},
|
|
formatTime: function (ts) {
|
|
if (!ts) return '-';
|
|
var d = new Date(ts * 1000);
|
|
var p = function (n) { return n < 10 ? '0' + n : n; };
|
|
return d.getFullYear() + '-' + p(d.getMonth() + 1) + '-' + p(d.getDate()) + ' ' + p(d.getHours()) + ':' + p(d.getMinutes());
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
};
|
|
return Controller;
|
|
});
|