WIN-2308041133\Administrator vor 1 Jahr
Ursprung
Commit
faa80347e1

+ 12 - 0
addons/wechat/Wechat.php

@@ -85,8 +85,20 @@ class Wechat extends Addons
                             ['name' => 'wechat/plan/del', 'title' => '删除'],
                             ['name' => 'wechat/plan/multi', 'title' => '批量更新'],
                         ]
+                    ],
+                    [
+                    'name'    => 'wechat/planRecord',
+                    'title'   => '微信签约记录',
+                    'icon'    => 'fa fa-list',
+                    'sublist' => [
+                        ['name' => 'wechat/planRecord/index', 'title' => '查看'],
+//                        ['name' => 'wechat/plan/add', 'title' => '添加'],
+//                        ['name' => 'wechat/plan/edit', 'title' => '修改'],
+//                        ['name' => 'wechat/plan/del', 'title' => '删除'],
+//                        ['name' => 'wechat/plan/multi', 'title' => '批量更新'],
                     ]
                 ]
+                ]
             ]
         ];
         Menu::create($menu);

+ 66 - 0
application/admin/controller/wechat/PlanRecord.php

@@ -0,0 +1,66 @@
+<?php
+
+namespace app\admin\controller\wechat;
+
+use app\common\controller\Backend;
+use app\admin\model\WechatResponse;
+
+/**
+ * 扣款服务签约列表
+ *
+ * @icon fa fa-circle-o
+ */
+class PlanRecord extends Backend
+{
+
+    protected $model = null;
+//    protected $noNeedRight = ['check_text_unique'];
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        $this->model = model('WechatPlanRecord');
+    }
+
+//    /**
+//     * 编辑
+//     */
+//    public function edit($ids = null)
+//    {
+//        $row = $this->model->get(['id' => $ids]);
+//        if (!$row) {
+//            $this->error(__('No Results were found'));
+//        }
+//        if ($this->request->isPost()) {
+//            $params = $this->request->post("row/a");
+//            if ($params) {
+//                $row->save($params);
+//                $this->success();
+//            }
+//            $this->error();
+//        }
+//        $this->view->assign("row", $row);
+//        return $this->view->fetch();
+//    }
+//
+//    /**
+//     * 判断价格是否唯一
+//     * @internal
+//     */
+//    public function check_text_unique()
+//    {
+//        $row = $this->request->post("row/a");
+//        $except = $this->request->post("except");
+//        $text = isset($row['price']) ? $row['price'] : '';
+//        if ($this->model->where('price', $text)->where(function ($query) use ($except) {
+//                if ($except) {
+//                    $query->where('price', '<>', $except);
+//                }
+//            })->count() == 0) {
+//            $this->success();
+//        } else {
+//            $this->error(__('Text already exists'));
+//        }
+//    }
+
+}

+ 35 - 0
application/admin/view/wechat/plan_record/index.html

@@ -0,0 +1,35 @@
+<div class="panel panel-default panel-intro">
+    {:build_heading()}
+
+    <div class="panel-body">
+        <div id="myTabContent" class="tab-content">
+            <div class="tab-pane fade active in" id="one">
+                <div class="widget-body no-padding">
+                    <div id="toolbar" class="toolbar">
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+<!--                        <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('wechat/plan/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>-->
+<!--                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('wechat/plan/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>-->
+<!--                        <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('wechat/plan/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
+<!--                        <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('wechat/plan/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>-->
+
+                        <div class="dropdown btn-group {:$auth->check('wechat/planRecord/multi')?'':'hide'}">
+                            <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
+                            <ul class="dropdown-menu text-left" role="menu">
+                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
+                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
+                            </ul>
+                        </div>
+
+
+                    </div>
+<!--                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"-->
+<!--                           data-operate-edit="{:$auth->check('wechat/plan/edit')}"-->
+<!--                           data-operate-del="{:$auth->check('wechat/plan/del')}"-->
+<!--                           width="100%">-->
+<!--                    </table>-->
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 78 - 0
public/assets/js/backend/wechat/plan_record.js

@@ -0,0 +1,78 @@
+define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefined, Backend, Form, Table) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'wechat/plan_record/index',
+                    // add_url: 'wechat/plan/add',
+                    // edit_url: 'wechat/plan/edit',
+                    // del_url: 'wechat/plan/del',
+                    // multi_url: 'wechat/plan/multi',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                sortName: 'id',
+                columns: [
+                    [
+                        // {field: 'state', checkbox: true, },
+                        {field: 'id', title: __('Id')},
+                        {field: 'cid', title: __('Cid')},
+                        {field: 'plan_id', title: __('Plan_id')},
+                        {field: 'wechat_plan_id', title: __('Wechat_Plan_id')},
+                        // {field: 'text', title: __('Text')},
+                        {field: 'price', title: __('price')},
+                        {field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
+                        // {field: 'updatetime', title: __('Update time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
+                        // {field: 'status', title: __('Status'), formatter: Table.api.formatter.status},
+                        // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                    ]
+                ]
+            });
+
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+
+        },
+        add: function () {
+            Controller.api.bindevent();
+        },
+        edit: function () {
+            Controller.api.bindevent();
+        },
+        // api: {
+        //     bindevent: function () {
+        //         Form.api.bindevent($("form[role=form]"));
+        //
+        //         var refreshkey = function (data) {
+        //             $("input[name='row[price]']").val(data.eventkey).trigger("change");
+        //             Layer.closeAll();
+        //             var keytitle = data.text;
+        //             var cont = $(".clickbox .create-click:first");
+        //             $(".keytitle", cont).remove();
+        //             if (keytitle) {
+        //                 cont.append('<div class="keytitle">' + __('Event key') + ':' + keytitle + '</div>');
+        //             }
+        //         };
+        //         $(document).on('click', "#select-resources", function () {
+        //             var key = $("input[name='row[eventkey]']").val();
+        //             parent.Backend.api.open($(this).attr("href") + "?key=" + key, __('Select'), {callback: refreshkey});
+        //             return false;
+        //         });
+        //
+        //         $(document).on('click', "#add-resources", function () {
+        //             parent.Backend.api.open($(this).attr("href") + "?key=", __('Add'), {callback: refreshkey});
+        //             return false;
+        //         });
+        //     }
+        // }
+
+    };
+    return Controller;
+});