一、问题
35 个后台接口此前无任何可用界面:FastAdmin PC 后台 110 条菜单里 0 条业务菜单,
小程序端仅有 1 个 LOGO/图标设置页 → 后台功能实际上无处可操作。
二、方案(FastAdmin 原生机制)
- 用 `php think crud` 为 17 张业务表生成管理模块:
控制器 application/admin/controller/fc/*.php(继承 Backend)
模型 application/admin/model/Fc*.php
视图 application/admin/view/fc/*/{index,add,edit}.html
后台 JS public/assets/js/backend/fc/*.js
语言包 application/admin/lang/zh-cn/fc/*.php
- 菜单结构固化进安装器 application/admin/command/FcInstall.php 的 menu()(幂等):
同城业务 ├─ 内容管理 分类管理/轮播管理/信息管理/评价管理/举报处理
├─ 用户与商家 商家管理/会员管理/消息管理
├─ 交易管理 订单管理/会员套餐/资金流水/佣金明细/付费查看记录
├─ 分销管理 分销关系/提现审核
└─ 基础数据 服务区域/草稿箱
三、业务动作(一键操作,含列表页按钮)
- fc/post: audit(审核通过/驳回 + 分类信息量 + 站内信) / offline(下架)
- fc/merchant: audit(资质审核 + 同步用户身份 + 店铺状态)
- fc/withdraw: pay(打款/驳回 + 资金流水 + 拒绝须填原因)
- fc/order: refund(退款) / supplement(按订单号补单 + 流水)
- fc/comment: reply(回复) / top(置顶)
- fc/report: handle(标记已处理)
四、验证
- 后台登录后业务页 HTTP 200,controllername/jsname 正确解析
- 列表数据真实加载:分类 8 / 信息 6 / 订单 4 / 提现 3 / 商家 4
- 侧边栏 5 个中文分组菜单正常渲染
104 行
4.8 KiB
JavaScript
104 行
4.8 KiB
JavaScript
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|
|
|
var Controller = {
|
|
index: function () {
|
|
// 初始化表格参数配置
|
|
Table.api.init({
|
|
extend: {
|
|
index_url: 'fc/order/index' + location.search,
|
|
add_url: 'fc/order/add',
|
|
edit_url: 'fc/order/edit',
|
|
del_url: 'fc/order/del',
|
|
multi_url: 'fc/order/multi',
|
|
import_url: 'fc/order/import',
|
|
table: 'fc_order',
|
|
}
|
|
});
|
|
|
|
var table = $("#table");
|
|
|
|
// 初始化表格
|
|
table.bootstrapTable({
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
pk: 'id',
|
|
sortName: 'id',
|
|
fixedColumns: true,
|
|
fixedRightNumber: 1,
|
|
columns: [
|
|
[
|
|
{checkbox: true},
|
|
{field: 'id', title: __('Id')},
|
|
{field: 'order_no', title: __('Order_no'), operate: 'LIKE'},
|
|
{field: 'user_id', title: __('User_id')},
|
|
{field: 'type', title: __('Type'), operate: 'LIKE'},
|
|
{field: 'title', title: __('Title'), operate: 'LIKE'},
|
|
{field: 'amount', title: __('Amount'), operate:'BETWEEN'},
|
|
{field: 'pay_type', title: __('Pay_type'), operate: 'LIKE'},
|
|
{field: 'status', title: __('Status'), searchList: {"16":__('Status 16')}, formatter: Table.api.formatter.status},
|
|
{field: 'paytime', title: __('Paytime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
{field: 'refund_amount', title: __('Refund_amount'), operate:'BETWEEN'},
|
|
{field: 'refund_reason', title: __('Refund_reason'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'related_id', title: __('Related_id')},
|
|
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
|
]
|
|
]
|
|
});
|
|
|
|
// 为表格绑定事件
|
|
Table.api.bindevent(table);
|
|
|
|
// 退款
|
|
$(document).on('click', '.btn-refund', function () {
|
|
var ids = Table.api.selectedids(table);
|
|
Layer.prompt({title: __('请输入退款金额'), formType: 0}, function (value, index) {
|
|
var amount = parseFloat(value);
|
|
if (!amount || amount <= 0) {
|
|
Layer.msg(__('退款金额需大于 0'));
|
|
return;
|
|
}
|
|
Layer.prompt({title: __('请输入退款原因(可选)'), formType: 2}, function (reason, index2) {
|
|
Fast.api.ajax({
|
|
url: 'fc/order/refund',
|
|
data: {ids: ids.join(','), amount: amount, reason: reason}
|
|
}, function (data) {
|
|
table.bootstrapTable('refresh');
|
|
return false;
|
|
});
|
|
Layer.close(index2);
|
|
});
|
|
Layer.close(index);
|
|
});
|
|
});
|
|
|
|
// 补单
|
|
$(document).on('click', '.btn-supplement', function () {
|
|
Layer.prompt({title: __('请输入需要补单的订单号'), formType: 0}, function (value, index) {
|
|
Fast.api.ajax({
|
|
url: 'fc/order/supplement',
|
|
data: {orderNo: value}
|
|
}, function (data) {
|
|
table.bootstrapTable('refresh');
|
|
return false;
|
|
});
|
|
Layer.close(index);
|
|
});
|
|
});
|
|
|
|
},
|
|
add: function () {
|
|
Controller.api.bindevent();
|
|
},
|
|
edit: function () {
|
|
Controller.api.bindevent();
|
|
},
|
|
api: {
|
|
bindevent: function () {
|
|
Form.api.bindevent($("form[role=form]"));
|
|
}
|
|
}
|
|
};
|
|
return Controller;
|
|
});
|