Bladeren bron

跟进记录

moonsflyer 9 maanden geleden
bovenliggende
commit
9c116b92c0

+ 3 - 0
application/admin/controller/qingdong/customer/Cuscontract.php

@@ -55,6 +55,9 @@ class Cuscontract extends Base {
                     if(isset($otherdata['other_upnhey'])){
                         $contract_remark = $otherdata['other_upnhey'];
                     }
+                    if(isset($otherdata['other_zdywys'])){
+                        $contract_remark = $otherdata['other_zdywys'];
+                    }
                 }
                 $v['contract_remark'] = $contract_remark;
 //                outFileLog($contract_remark,'cus_contract','$v');

+ 67 - 0
application/admin/controller/qingdong/customer/Cusrecord.php

@@ -0,0 +1,67 @@
+<?php
+
+namespace app\admin\controller\qingdong\customer;
+
+use app\admin\controller\qingdong\Base;
+use think\Db;
+use think\Exception;
+
+
+/**
+ * 合同跟进记录管理
+ * 操作文档:https://doc.fastadmin.net/qingdong
+ * 软件介绍:https://www.fastadmin.net/store/qingdong.html
+ * 售后微信:qingdong_crm
+ */
+class Cusrecord extends Base {
+	protected $relationSearch = true;
+	/**
+	 * @var \addons\qingdong\model\Contract
+	 */
+	protected $model = null;
+
+
+	public function _initialize() {
+		parent::_initialize();
+		$this->model = new \addons\qingdong\model\Record();
+	}
+
+
+	/**
+	 * 查看
+	 */
+	public function index() {
+		//设置过滤方法
+		if ($this->request->isAjax()) {
+
+            $params = $this->request->get();
+
+            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+            $wheres = [];
+            $wheres['relation_id'] = $params['ids'];
+			$list = $this->model->with(['file'])->where($where)->where($wheres)
+            ->order($sort, $order)->paginate($limit);
+            $data = $list->items();
+////            foreach($data as &$v){
+////                $contract_remark='';
+////                $contract_other = $v['contract_other'];
+////                $otherdata = json_decode($contract_other['otherdata'],true);
+////                if(is_array($otherdata)){
+////                    if(isset($otherdata['other_upnhey'])){
+////                        $contract_remark = $otherdata['other_upnhey'];
+////                    }
+////                    if(isset($otherdata['other_zdywys'])){
+////                        $contract_remark = $otherdata['other_zdywys'];
+////                    }
+////                }
+////                $v['contract_remark'] = $contract_remark;
+//////                outFileLog($contract_remark,'cus_contract','$v');
+//            }
+            outFileLog($data,'custecord','record_index');
+			$result = array("total" => $list->total(), "rows" => $list->items());
+			return json($result);
+		}
+		return $this->view->fetch();
+	}
+
+}

+ 23 - 0
application/admin/view/qingdong/customer/cusrecord/index.html

@@ -0,0 +1,23 @@
+<link href="__CDN__/assets/addons/qingdong/css/index.css?v={$Think.config.site.version}" rel="stylesheet">
+
+<div class="panel panel-default panel-intro">
+    <div class="panel-heading">
+        <ul class="nav nav-tabs">
+            <li class="active"><a href="#first" data-toggle="tab">全部</a></li>
+        </ul>
+    </div>
+    {:build_heading()}
+
+    <div class="panel-body">
+        <div id="myTabContent" class="tab-content">
+            <div class="tab-pane fade active in" id="first">
+                <div class="widget-body no-padding">
+                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+        </div>
+
+    </div>
+</div>

+ 6 - 1
public/assets/js/backend/qingdong/customer/cuscontract.js

@@ -52,7 +52,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                             }
                             return '';
                         },operate:false},
-                    {field : 'contract_remark', title : '备注',operate:false},
+                    {field : 'contract_remark', title : '备注', formatter : function (value, row, index) {
+                            if(row.contract_remark){
+                                return  row.contract_remark;
+                            }
+                            return '';
+                        },operate:false},
                     // {field : 'customer_id', title : '客户名称', visible: false, addClass: "selectpage", extend: "data-source='qingdong/customer/customer/index' data-field='name'"},
                     {field : 'remark', title : '备注',operate:false},
                     {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},

+ 128 - 0
public/assets/js/backend/qingdong/customer/cusrecord.js

@@ -0,0 +1,128 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index  : function () {
+        // 初始化表格参数配置
+            Table.api.init();
+            //绑定事件
+            $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
+                var panel = $($(this).attr("href"));
+                if (panel.length > 0) {
+                    Controller.table[panel.attr("id")].call(this);
+                    $(this).on('click', function (e) {
+                        $($(this).attr("href")).find(".btn-refresh").trigger("click");
+                    });
+                }
+                //移除绑定的事件
+                $(this).unbind('shown.bs.tab');
+            });
+
+            //必须默认触发shown.bs.tab事件
+            $('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab");
+        },
+        tableinfo:{
+            url          : '',
+            toolbar: '#toolbar',
+            pk           : 'id',
+            sortName     : 'id',
+            fixedColumns : true,
+            fixedNumber  : 1,
+            fixedRightNumber  : 1,
+            columns      : [
+                [
+                    {field: 'createtime', title: '跟进时间', operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
+                    {
+                        field : 'name', title : '跟进内容',  formatter : function (value, row, index) {
+                            if(value ==''){
+                                value = '无';
+                            }
+                            return 12;
+                        },operate:true
+                    },
+
+                    {field : 'content', title : '跟进内容', formatter : function (value, row, index) {
+                            if(row.content){
+                                return  row.content;
+                            }
+                            return '';
+                        },operate:false},
+                    {field : 'file', title : '文件', formatter : function (value, row, index) {
+                            $file = '';
+                           for (i=0;i<value.length;i++){
+                               $file =$file + '<a href="'+value[i]["file_path"]+'" target="_blank" style="margin-right:10px;">'+
+                                   value[i]['name']+
+                                '</a></br>';
+                           }
+                            return $file;
+                        },operate:false},
+
+                    // {field: 'createtime', title: '下次跟进时间', operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
+                ]
+            ],
+
+            pagination        : true,
+            search            : false,
+            commonSearch      : false,
+            searchFormVisible : false,
+            //显示导出按钮
+            showExport: false,
+            onLoadSuccess:function(row){
+                var role = row.role;
+
+                // 根据 role 值动态修改 columns 配置
+                var table = $("#table");
+
+                // 这里就是数据渲染结束后的回调函数
+                $(".btn-add").data("area",["80%","80%"]);
+                $(".btn-edit").data("area",["80%","80%"]);
+            }
+        },
+        table: {
+            first: function () {
+                // 初始化表格参数配置
+                Table.api.init({
+                    // extend : {
+                    //     add_url    : 'qingdong/customer/contract/add',
+                    //     detail_url : 'qingdong/customer/contract/detail',
+                    //     table      : 'contract',
+                    // }
+                });
+                if(Config.fields !='[]'){
+                    if (Config.fields && Object.keys(Config.fields).length > 0) {
+                        var fields = JSON.parse(Config.fields);
+                        var start = Controller.tableinfo.columns[0].length-2;
+                        for (var i = 0; i < fields.length; i++) {
+                            if (fields[i].hasOwnProperty('formatter'))
+                                fields[i].formatter = eval(fields[i].formatter);
+                            if (fields[i].hasOwnProperty('events'))
+                                fields[i].events = eval(fields[i].events);
+                            if (fields[i].hasOwnProperty('searchList'))
+                                fields[i].searchList = JSON.parse(fields[i].searchList);
+                            Controller.tableinfo.columns[0].splice(start + i, 0, fields[i]);
+                        }
+                    }
+
+                }
+                const q = {};
+                location.search.replace(/([^?&=]+)=([^&]+)/g,function(_,k,v){q[k]=v});
+
+                var table = $("#table");
+                Controller.tableinfo.url=location.href+'&type=0';
+                Controller.tableinfo.toolbar='#toolbar';
+                Controller.tableinfo.columns[0][Controller.tableinfo.columns[0].length-1].table=table;
+
+                if (q.isselect == 1) {
+                    Controller.tableinfo.columns[0][Controller.tableinfo.columns[0].length - 1].visible = false;
+                } else {
+                    Controller.tableinfo.columns[0][Controller.tableinfo.columns[0].length - 2].visible = false;
+                }
+
+                // 初始化表格
+                table.bootstrapTable(Controller.tableinfo);
+                // 为表格绑定事件
+                Table.api.bindevent(table);
+            },
+        },
+    };
+    return Controller;
+});

+ 12 - 0
public/assets/js/backend/qingdong/customer/customer.js

@@ -376,6 +376,18 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
 									return true;
 								}
 							},
+							{
+								name: 'contract',
+								text: __('跟进记录'),
+								title: __('跟进记录'),
+								extend:'data-area=["80%","80%"]',
+								classname: ' records btn-dialog',
+								url: 'qingdong/customer/cusrecord?ref=addtabs',
+								visible: function (row) {
+
+									return true;
+								}
+							},
                             // {
                             //     name: 'seas',
                             //     text: __('公海'),