feat: 初始化雄戈商城服务端代码与Webhook自动部署配置
这个提交包含在:
@@ -0,0 +1,40 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
var Controller = {
|
||||
index: function () {
|
||||
new Vue({
|
||||
el: '#bsCompanyIndex',
|
||||
data() {
|
||||
return { listData: [], loading: false, currentPage: 1, limit: 10, total: 0 };
|
||||
},
|
||||
mounted() { this.getList(); },
|
||||
methods: {
|
||||
getList() {
|
||||
this.loading = true;
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/operating_company/company/index',
|
||||
type: 'GET',
|
||||
data: { offset: (this.currentPage - 1) * this.limit, limit: this.limit, sort: 'id', order: 'desc' }
|
||||
}, (ret, res) => {
|
||||
this.listData = (res.data && res.data.rows) || [];
|
||||
this.total = (res.data && res.data.total) || 0;
|
||||
this.loading = false;
|
||||
return false;
|
||||
}, () => { this.loading = false; });
|
||||
},
|
||||
openAdd() { Backend.api.open('shopro/operating_company/company/add', '添加运营公司', { callback: () => this.getList() }); },
|
||||
openEdit(id) { Backend.api.open('shopro/operating_company/company/edit/ids/' + id, '编辑运营公司', { callback: () => this.getList() }); },
|
||||
del(id) {
|
||||
Layer.confirm('确认禁用该运营公司?', i => {
|
||||
Fast.api.ajax({ url: 'shopro/operating_company/company/del/ids/' + id, type: 'POST' }, () => {
|
||||
Layer.close(i); this.getList();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
add: function () { Form.api.bindevent($('form[role=form]')); },
|
||||
edit: function () { Form.api.bindevent($('form[role=form]')); }
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
@@ -0,0 +1,94 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'upload'], function ($, undefined, Backend, Table, Form, Upload) {
|
||||
var Controller = {
|
||||
index: function () {
|
||||
new Vue({
|
||||
el: '#ocSettlementIndex',
|
||||
data() {
|
||||
return {
|
||||
activeTab: 'all',
|
||||
tabsList: [
|
||||
{ val: 'all', label: '全部' },
|
||||
{ val: '0', label: '草稿' },
|
||||
{ val: '1', label: '待审核' },
|
||||
{ val: '2', label: '已通过' },
|
||||
{ val: '3', label: '已驳回' }
|
||||
],
|
||||
filters: { company_name: '', pay_status: '' },
|
||||
listData: [], loading: false, currentPage: 1, limit: 10, total: 0
|
||||
};
|
||||
},
|
||||
mounted() { this.getList(); },
|
||||
methods: {
|
||||
switchTab(val) { this.activeTab = val; this.currentPage = 1; this.getList(); },
|
||||
search() { this.currentPage = 1; this.getList(); },
|
||||
getList() {
|
||||
this.loading = true;
|
||||
const filter = {};
|
||||
const op = {};
|
||||
if (this.activeTab !== 'all') { filter.audit_status = this.activeTab; op.audit_status = '='; }
|
||||
if (this.filters.company_name) { filter.company_name = this.filters.company_name; op.company_name = 'LIKE'; }
|
||||
if (this.filters.pay_status !== '' && this.filters.pay_status !== null) { filter.pay_status = this.filters.pay_status; op.pay_status = '='; }
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/operating_company/settlement/index',
|
||||
type: 'GET',
|
||||
data: { offset: (this.currentPage - 1) * this.limit, limit: this.limit, sort: 'id', order: 'desc', filter: JSON.stringify(filter), op: JSON.stringify(op) }
|
||||
}, (ret, res) => {
|
||||
this.listData = (res.data && res.data.rows) || [];
|
||||
this.total = (res.data && res.data.total) || 0;
|
||||
this.loading = false;
|
||||
return false;
|
||||
}, () => { this.loading = false; });
|
||||
},
|
||||
openAdd() { Backend.api.open('shopro/operating_company/settlement/add', '新增结算', { callback: () => this.getList() }); },
|
||||
openEdit(id) { Backend.api.open('shopro/operating_company/settlement/edit/ids/' + id, '编辑结算', { callback: () => this.getList() }); },
|
||||
openImport() { Backend.api.open('shopro/operating_company/settlement/import', '分成导入', { callback: () => this.getList() }); },
|
||||
downloadTemplate() { window.open(Fast.api.fixurl('shopro/operating_company/settlement/downloadTemplate')); },
|
||||
exportData() { window.open(Fast.api.fixurl('shopro/operating_company/settlement/export')); },
|
||||
submit(id) {
|
||||
Fast.api.ajax({ url: 'shopro/operating_company/settlement/submit', type: 'POST', data: { id } }, () => this.getList());
|
||||
},
|
||||
audit(id, action) {
|
||||
Layer.prompt({ title: action === 'approve' ? '审核通过备注' : '驳回原因', formType: 2 }, (val, index) => {
|
||||
Fast.api.ajax({ url: 'shopro/operating_company/settlement/audit', type: 'POST', data: { id, action, remark: val } }, () => {
|
||||
Layer.close(index); this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
markPay(id, payStatus) {
|
||||
Layer.prompt({ title: payStatus === 1 ? '打款备注' : '失败原因', formType: 2 }, (val, index) => {
|
||||
Fast.api.ajax({ url: 'shopro/operating_company/settlement/markPay', type: 'POST', data: { id, pay_status: payStatus, remark: val } }, () => {
|
||||
Layer.close(index); this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
viewLogs(id) {
|
||||
Fast.api.ajax({ url: 'shopro/operating_company/settlement/logs', type: 'GET', data: { id } }, (ret, res) => {
|
||||
const logs = (res.data || []).map(l => l.action + ' - ' + Moment(l.createtime * 1000).format('YYYY-MM-DD HH:mm:ss')).join('<br>');
|
||||
Layer.alert(logs || '暂无日志');
|
||||
return false;
|
||||
});
|
||||
},
|
||||
auditText(s) { return { 0: '草稿', 1: '待审核', 2: '已通过', 3: '已驳回' }[s] || '-'; },
|
||||
payText(s) { return { 0: '未打款', 1: '已打款', 2: '打款失败' }[s] || '-'; },
|
||||
formatTime(ts) { return ts ? Moment(ts * 1000).format('YYYY-MM-DD HH:mm:ss') : '-'; }
|
||||
}
|
||||
});
|
||||
},
|
||||
add: function () { Form.api.bindevent($('form[role=form]')); },
|
||||
edit: function () { Form.api.bindevent($('form[role=form]')); },
|
||||
import: function () {
|
||||
Form.api.bindevent($('form[role=form]'));
|
||||
Upload.api.upload($('#faupload-file'));
|
||||
$('#btn-import').on('click', function () {
|
||||
var file = $('#c-file').val();
|
||||
if (!file) { Layer.msg('请先上传文件'); return; }
|
||||
Fast.api.ajax({ url: 'shopro/operating_company/settlement/import', type: 'POST', data: { file } }, function () {
|
||||
parent.$('.btn-refresh').trigger('click');
|
||||
var index = parent.Layer.getFrameIndex(window.name);
|
||||
parent.Layer.close(index);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
在新工单中引用
屏蔽一个用户