feat: 初始化雄戈商城服务端代码与Webhook自动部署配置
这个提交包含在:
@@ -0,0 +1,51 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'form'], function ($, undefined, Backend, Form) {
|
||||
var Controller = {
|
||||
index: function () {
|
||||
new Vue({
|
||||
el: '#wxTradeConfigIndex',
|
||||
data: {
|
||||
form: {
|
||||
wechat_trade_enable: '1',
|
||||
order_detail_path: 'pages/order/detail?order_sn=${商品订单号}',
|
||||
max_retry: '5',
|
||||
retry_interval: '300',
|
||||
mini_program_app_id: ''
|
||||
},
|
||||
checkResult: ''
|
||||
},
|
||||
mounted: function () {
|
||||
var vm = this;
|
||||
$.getJSON('shopro_wechat_trade/config/index', function (ret) {
|
||||
if (ret.code === 1 && ret.data) {
|
||||
vm.form = Object.assign(vm.form, ret.data);
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
save: function () {
|
||||
var vm = this;
|
||||
$.post('shopro_wechat_trade/config/save', { row: vm.form }, function (ret) {
|
||||
Backend.api.toastr[ret.code === 1 ? 'success' : 'error'](ret.msg);
|
||||
});
|
||||
},
|
||||
check: function () {
|
||||
var vm = this;
|
||||
$.getJSON('shopro_wechat_trade/config/check', function (ret) {
|
||||
if (ret.code === 1) {
|
||||
vm.checkResult = JSON.stringify(ret.data, null, 2);
|
||||
} else {
|
||||
Backend.api.toastr.error(ret.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
initPath: function () {
|
||||
$.post('shopro_wechat_trade/config/initPath', {}, function (ret) {
|
||||
Backend.api.toastr[ret.code === 1 ? 'success' : 'error'](ret.msg);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
@@ -0,0 +1,68 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
var Controller = {
|
||||
index: function () {
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'shopro_wechat_trade/sync/index',
|
||||
table: 'shopro_wechat_trade_sync'
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
sortOrder: 'desc',
|
||||
queryParams: function (params) {
|
||||
params.status = $('#status-filter').val();
|
||||
return params;
|
||||
},
|
||||
columns: [
|
||||
{ field: 'id', title: 'ID' },
|
||||
{ field: 'order_sn', title: '订单号' },
|
||||
{ field: 'sync_type', title: '类型' },
|
||||
{ field: 'status', title: '状态' },
|
||||
{ field: 'delivery_mode', title: '发货模式' },
|
||||
{ field: 'errcode', title: 'errcode' },
|
||||
{ field: 'errmsg', title: 'errmsg' },
|
||||
{ field: 'retry_count', title: '重试次数' },
|
||||
{
|
||||
field: 'createtime',
|
||||
title: '创建时间',
|
||||
formatter: function (value) {
|
||||
return value ? Table.api.formatter.datetime(value) : '';
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
title: '操作',
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
formatter: function (value, row) {
|
||||
if (row.status === 'success') {
|
||||
return '-';
|
||||
}
|
||||
return '<a href="javascript:;" class="btn btn-xs btn-warning btn-retry" data-id="' + row.id + '">重试</a>';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
$('#status-filter').on('change', function () {
|
||||
table.bootstrapTable('refresh');
|
||||
});
|
||||
|
||||
table.on('click', '.btn-retry', function () {
|
||||
var id = $(this).data('id');
|
||||
$.post('shopro_wechat_trade/sync/retry', { id: id }, function (ret) {
|
||||
Backend.api.toastr[ret.code === 1 ? 'success' : 'error'](ret.msg);
|
||||
table.bootstrapTable('refresh');
|
||||
});
|
||||
});
|
||||
|
||||
Table.api.bindevent(table);
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
在新工单中引用
屏蔽一个用户