Selaa lähdekoodia

修复已知BUG

Michael_xu 4 vuotta sitten
vanhempi
commit
7ae1f9db4a

+ 7
- 1
application/admin/controller/Field.php Näytä tiedosto

@@ -183,7 +183,13 @@ class Field extends ApiCommon
183 183
         if ($errorMessage) return resultArray(['error' => $errorMessage]);
184 184
 
185 185
         # 兼容前端11.*.*版本的删除条件处理,通过比较差异,来确定谁被前端给删除了 todo 这段代码需要写在新增上面,不然会把新增的给删除掉
186
-        $oldFieldIds = Db::name('admin_field')->where('types', $types)->column('field_id');
186
+        // $oldFieldIds = Db::name('admin_field')->where('types', $types)->column('field_id');  新增自定义字段时 成交状态被删除
187
+        if($types != 'crm_customer'){
188
+            $oldFieldIds = Db::name('admin_field')->where('types', $types)->column('field_id');
189
+        }else{
190
+            $oldFieldIds = Db::name('admin_field')->where('types', $types)->where(['field'=>['not in', ['deal_status']]])->column('field_id');
191
+        }
192
+        
187 193
         $deleteIds   = array_diff($oldFieldIds, $fieldIds);
188 194
         foreach ($deleteIds AS $key => $value) {
189 195
             if (!in_array($value, $delParam)) $delParam[] = $value;

+ 5
- 0
application/admin/controller/Index.php Näytä tiedosto

@@ -61,6 +61,11 @@ class Index extends ApiCommon
61 61
             if ($value['field'] == 'deal_status')  $field_arr[$key]['form_type'] = 'deal_status';
62 62
             if ($value['field'] == 'check_status') $field_arr[$key]['form_type'] = 'check_status';
63 63
             if ($param['types'] == 'crm_visit' && $value['field'] == 'owner_user_id') $field_arr[$key]['name'] = '回访人';
64
+
65
+            if ($value['field'] == 'supplier_id') $field_arr[$key]['form_type'] = 'text';
66
+            if ($value['field'] == 'purchase_id') $field_arr[$key]['form_type'] = 'text';
67
+            if ($value['field'] == 'sale_id') $field_arr[$key]['form_type'] = 'text';
68
+            if ($value['field'] == 'collection_object') $field_arr[$key]['form_type'] = 'text';
64 69
         }
65 70
         if(in_array($param['types'],['crm_customer','crm_customer_pool','crm_contacts','crm_business','crm_contract','crm_receivables'])){
66 71
             $field=[['field'=>'team_id','name'=>'相关团队','form_type'=>'text','setting'=>[]]];

+ 13
- 14
application/admin/model/Excel.php Näytä tiedosto

@@ -399,15 +399,15 @@ class Excel extends Common
399 399
         }
400 400
         
401 401
         // 排队中
402
-        // if (!$queue->canExec()) {
403
-        //     return resultArray([
404
-        //         'data' => [
405
-        //             'page' => -2,
406
-        //             'export_queue_index' => $export_queue_index,
407
-        //             'info' => $queue->error
408
-        //         ]
409
-        //     ]);
410
-        // }
402
+        if (!$queue->canExec()) {
403
+            return resultArray([
404
+                'data' => [
405
+                    'page' => -2,
406
+                    'export_queue_index' => $export_queue_index,
407
+                    'info' => $queue->error
408
+                ]
409
+            ]);
410
+        }
411 411
         
412 412
         // 没有临时文件名,代表第一次导出,生成临时文件名称,并写入表头数据
413 413
         if ($temp_file === null) {
@@ -984,8 +984,7 @@ class Excel extends Common
984 984
                         }
985 985
                     } else {
986 986
                         if ($types == 'crm_customer' && !empty($param['pool_id'])) {
987
-                            if (!in_array($param['create_user_id'], trim(stringToArray($owner), ','))  && $param['create_user_id'] != 1) {
988
-    
987
+                            if (in_array($param['create_user_id'], stringToArray($owner)) || $param['create_user_id'] == 1) {
989 988
                                 $data = array_merge($data, $default_data);
990 989
                                 $data['excel'] = 1;
991 990
                                 if (!$resData = $dataModel->createData($data)) {
@@ -1295,10 +1294,10 @@ class Excel extends Common
1295 1294
             //获取总行数
1296 1295
             $sheetCount = $ExcelObj->getSheet(0)->getHighestRow();
1297 1296
             
1298
-            // 		if ($sheetCount > 2002) {
1297
+            //      if ($sheetCount > 2002) {
1299 1298
             // $this->error = '单文件一次最多导入2000条数据';
1300
-            //  		return false;
1301
-            // 		}
1299
+            //          return false;
1300
+            //      }
1302 1301
             //读取表头
1303 1302
             $excelHeader = $sheetContent[1];
1304 1303
             unset($sheetContent[0]);

+ 1
- 1
application/admin/model/Field.php Näytä tiedosto

@@ -1855,7 +1855,7 @@ class Field extends Model
1855 1855
         $fieldArr = $this
1856 1856
             ->where($where)
1857 1857
             ->field(['field', 'name', 'form_type', 'is_hidden'])
1858
-            ->order('field_id', 'asc')
1858
+            ->order('order_id', 'asc')
1859 1859
             ->select();
1860 1860
 
1861 1861
         $res = [];

+ 1
- 1
application/bi/controller/Customer.php Näytä tiedosto

@@ -138,7 +138,7 @@ class Customer extends ApiCommon
138 138
             $sql[] = $customerModel->getAddDealSql($whereArr);
139 139
         }
140 140
         $sql = implode(' UNION ALL ', $sql);
141
-
141
+p($sql);
142 142
         $list = queryCache($sql);
143 143
         return resultArray(['data' => $list]);
144 144
     }

+ 151
- 5
application/common.php Näytä tiedosto

@@ -400,10 +400,130 @@ function advancedQuery($param, $m = '', $c = '', $a = '')
400 400
                $result[$c . $key] = ['neq', ''];
401 401
             }
402 402
         }
403
-
404 403
         // 模块、审核状态、成交状态、产品分类、单行文本、多行文本、网址、手机、邮箱、下拉框、布尔值、多选、定位、创建人、负责人
405 404
         if (isset($value['form_type']) && in_array($value['form_type'], ['module', 'check_status', 'deal_status', 'category', 'text', 'textarea', 'mobile', 'email', 'select', 'boolean_value', 'checkbox', 'location', 'website','user',])) {
406
-            $result[$c . $key] = advancedQueryFormatForCommon($value['value'], $value['condition'], $value['form_type'], $key);
405
+            $res = advancedQueryFormatForCommon($value['value'], $value['condition'], $value['form_type'], $key);
406
+            if($key == 'order_id'){
407
+                $arr = [];
408
+                if($c == 'outbound.'){
409
+                    $retreatOutboundIds =  db('jxc_retreat')
410
+                                    ->alias('a')
411
+                                    ->join('jxc_outbound b','a.retreat_id = b.order_id')
412
+                                    ->where('a.order_number', [$res[0], $res[1]])
413
+                                    ->where('b.outbound_type', '采购退货出库')
414
+                                    // ->fetchSql()
415
+                                    ->column('outbound_id');
416
+                    $saleOutboundIds =  db('jxc_sale')
417
+                                    ->alias('a')
418
+                                    ->join('jxc_outbound b','a.sale_id = b.order_id')
419
+                                    ->where('a.order_number', [$res[0], $res[1]])
420
+                                    ->where('b.outbound_type', '销售出库')
421
+                                    // ->fetchSql()
422
+                                    ->column('outbound_id');
423
+                    $arr = empty($retreatOutboundIds) ? $saleOutboundIds : array_merge($retreatOutboundIds,$saleOutboundIds);
424
+                    $result[$c . 'outbound_id'] = ['in', $arr];
425
+                }elseif ($c == 'receipt.') {
426
+                    $purchaseOutboundIds =  db('jxc_purchase')
427
+                                    ->alias('a')
428
+                                    ->join('jxc_receipt b','a.purchase_id = b.order_id')
429
+                                    ->where('a.order_number', [$res[0], $res[1]])
430
+                                    ->where('b.receipt_type', '采购入库')
431
+                                    // ->fetchSql()
432
+                                    ->column('b.receipt_id');
433
+                    $salereturnOutboundIds =  db('jxc_salereturn')
434
+                                    ->alias('a')
435
+                                    ->join('jxc_receipt b','a.salereturn_id = b.order_id')
436
+                                    ->where('a.order_number', [$res[0], $res[1]])
437
+                                    ->where('b.receipt_type', '销售退货入库')
438
+                                    // ->fetchSql()
439
+                                    ->column('b.receipt_id');
440
+                    $arr = empty($purchaseOutboundIds) ? $salereturnOutboundIds : array_merge($purchaseOutboundIds,$salereturnOutboundIds);
441
+                    $result[$c . 'receipt_id'] = ['in', $arr];
442
+                }
443
+            }else if($key == 'related_id'){
444
+                $arr = [];
445
+                if($c == 'collection.'){
446
+                    $retreatOutboundIds =  db('jxc_retreat')
447
+                                    ->alias('a')
448
+                                    ->join('jxc_collection b','a.retreat_id = b.related_id')
449
+                                    ->where('a.order_number', [$res[0], $res[1]])
450
+                                    ->where('b.collection_type', '采购退货')
451
+                                    // ->fetchSql()
452
+                                    ->column('collection_note_id');
453
+                    $saleOutboundIds =  db('jxc_sale')
454
+                                    ->alias('a')
455
+                                    ->join('jxc_collection b','a.sale_id = b.related_id')
456
+                                    ->where('a.order_number', [$res[0], $res[1]])
457
+                                    ->where('b.collection_type', '销售回款')
458
+                                    // ->fetchSql()
459
+                                    ->column('collection_note_id');
460
+                    $arr = empty($retreatOutboundIds) ? $saleOutboundIds : array_merge($retreatOutboundIds,$saleOutboundIds);
461
+                    $result[$c . 'collection_note_id'] = ['in', $arr];
462
+                }elseif ($c == 'payment.') {
463
+                    $purchaseOutboundIds =  db('jxc_purchase')
464
+                                    ->alias('a')
465
+                                    ->join('jxc_payment b','a.purchase_id = b.related_id')
466
+                                    ->where('a.order_number', [$res[0], $res[1]])
467
+                                    ->where('b.payment_type', '采购')
468
+                                    // ->fetchSql()
469
+                                    ->column('b.payment_note_id');
470
+                    $salereturnOutboundIds =  db('jxc_salereturn')
471
+                                    ->alias('a')
472
+                                    ->join('jxc_payment b','a.salereturn_id = b.related_id')
473
+                                    ->where('a.order_number', [$res[0], $res[1]])
474
+                                    ->where('b.payment_type', '销售退货')
475
+                                    // ->fetchSql()
476
+                                    ->column('b.payment_note_id');
477
+                    $arr = empty($purchaseOutboundIds) ? $salereturnOutboundIds : array_merge($purchaseOutboundIds,$salereturnOutboundIds);
478
+                    $result[$c . 'payment_note_id'] = ['in', $arr];
479
+                }
480
+            }else if($key == 'collection_object'){
481
+                $arr = [];
482
+                if($c == 'collection.'){
483
+                    $supplierOutboundIds =  db('jxc_supplier')
484
+                                    ->alias('a')
485
+                                    ->join('jxc_collection b','a.supplier_id = b.collection_object')
486
+                                    ->where('a.supplier_name', [$res[0], $res[1]])
487
+                                    ->where('b.collection_type', '采购退货')
488
+                                    // ->fetchSql()
489
+                                    ->column('collection_note_id');
490
+                    $customerOutboundIds =  db('crm_customer')
491
+                                    ->alias('a')
492
+                                    ->join('jxc_collection b','a.customer_id = b.collection_object')
493
+                                    ->where('a.name', [$res[0], $res[1]])
494
+                                    ->where('b.collection_type', '销售回款')
495
+                                    // ->fetchSql()
496
+                                    ->column('collection_note_id');
497
+                    $arr = empty($supplierOutboundIds) ? $customerOutboundIds : array_merge($supplierOutboundIds,$customerOutboundIds);
498
+                    $result[$c . 'collection_note_id'] = ['in', $arr];
499
+                }elseif ($c == 'payment.') {
500
+                    $supplierOutboundIds =  db('jxc_supplier')
501
+                                    ->alias('a')
502
+                                    ->join('jxc_payment b','a.supplier_id = b.collection_object')
503
+                                    ->where('a.supplier_name', [$res[0], $res[1]])
504
+                                    ->where('b.payment_type', '采购')
505
+                                    // ->fetchSql()
506
+                                    ->column('b.payment_note_id');
507
+                    $customerOutboundIds =  db('crm_customer')
508
+                                    ->alias('a')
509
+                                    ->join('jxc_payment b','a.customer_id = b.collection_object')
510
+                                    ->where('a.name', [$res[0], $res[1]])
511
+                                    ->where('b.payment_type', '销售退货')
512
+                                    // ->fetchSql()
513
+                                    ->column('b.payment_note_id');
514
+                    $arr = empty($supplierOutboundIds) ? $customerOutboundIds : array_merge($supplierOutboundIds,$customerOutboundIds);
515
+                    $result[$c . 'payment_note_id'] = ['in', $arr];
516
+                }
517
+            // }else if($key == 'sp_data_value'){
518
+            //     foreach ($res[1] as $key => $v) {
519
+            //        $arr[] = '%'.$v.'%';
520
+            //     }
521
+            //     $w['sp_data_value'] = ['like', $arr, 'OR'];
522
+            //     $product_ids = db('jxc_product')->where($w)->fetchSql()->column('product_id');
523
+            //     $result[$c . 'sp_data_value'] = [$res[0], $product_ids];
524
+            }else{
525
+                $result[$c . $key] = advancedQueryFormatForCommon($value['value'], $value['condition'], $value['form_type'], $key);
526
+            }
407 527
         }
408 528
 
409 529
         // 日期、日期时间、数字、货币、百分数、下次联系时间
@@ -459,8 +579,34 @@ function advancedQueryParam($prefix, $field, $name)
459 579
         'business_name' => 'business.',
460 580
         'contract_name' => 'contract.',
461 581
         'business_id' => 'business.',
462
-        'contacts_id' => 'contacts.'
582
+        'contacts_id' => 'contacts.',
583
+
584
+        'supplier_id' => 'supplier.',
585
+        'purchase_id' => 'purchase.',
586
+        'sale_id' => 'sale.',
587
+        'warehouse_id' => 'warehouse.',
588
+        'original_warehouse_id' => 'warehouse.',
589
+        'current_warehouse_id' => 'warehouse.',
463 590
     ];
591
+    # 处理供应商
592
+    if (in_array($field, ['supplier_id'])) {
593
+        $prefix = $prefixChange[$field];
594
+        $field = 'supplier_name';
595
+    }
596
+    # 处理仓库
597
+    if (in_array($field, ['warehouse_id'])) {
598
+        $prefix = $prefixChange[$field];
599
+        $field = 'warehouse_name';
600
+    }
601
+    if (in_array($field, ['original_warehouse_id', 'current_warehouse_id'])) {
602
+        $prefix = $prefixChange[$field];
603
+        $field = 'warehouse_name';
604
+    }
605
+    # 采购单、销售单
606
+    if (in_array($field, ['purchase_id', 'sale_id'])) {
607
+        $prefix = $prefixChange[$field];
608
+        $field = 'order_number';
609
+    }
464 610
 
465 611
     // 处理客户名称、联系人名称、商机名称、合同名称字段
466 612
     if (in_array($field, ['customer_name', 'contacts_name', 'business_name', 'contract_name']) && $name != '合同编号') {
@@ -628,9 +774,9 @@ function advancedQueryWhere($condition, $data, $key='')
628 774
 
629 775
     if ($condition == "in") $result = ['in', $data];                      // 等于
630 776
     if ($condition == 'is') $result = ['in', $data];                      // 等于
631
-    if ($condition == 'isNot') $result = ['notin', $data];                   // 不等于
777
+    if ($condition == 'isNot') $result = [['notin', $data],['null'],'OR'];                   // 不等于
632 778
     if ($condition == 'contains') $result = ['like', $data, 'OR'];              // 包含
633
-    if ($condition == 'notContains') $result = ['notlike', $data, 'AND'];          // 不包含
779
+    if ($condition == 'notContains') $result = [['notlike', $data, 'AND'],['null'],'OR'];          // 不包含
634 780
     if ($condition == 'startWith') $result = ['like', $data, 'OR'];              // 开始于
635 781
     if ($condition == 'endWith') $result = ['like', $data, 'OR'];              // 结束于
636 782
     if ($condition == 'gt') $result = ['gt', $data];                      // 大于

+ 5
- 4
application/crm/controller/Customer.php Näytä tiedosto

@@ -200,7 +200,7 @@ class Customer extends ApiCommon
200 200
             $resPool = db('crm_customer')->alias('customer')->where(['customer_id' => $v])->where($wherePool)->find();
201 201
             if (!$resPool && !in_array($data['owner_user_id'], $auth_user_ids) && $isDel) {
202 202
                 $isDel = false;
203
-                $errorMessage[] = '名称为' . $data['name'] . '的客户删除失败,错误原因:无权操作';
203
+                $errorMessage[] = '无权操作';
204 204
             }
205 205
             // 公海 (原逻辑,公海仅允许管理员删除,修改为授权,不再限制)
206 206
             // if ($resPool && !in_array($data['owner_user_id'],$adminId)) {
@@ -212,21 +212,22 @@ class Customer extends ApiCommon
212 212
                 $resBusiness = db('crm_business')->where(['customer_id' => $v])->find();
213 213
                 if ($resBusiness) {
214 214
                     $isDel = false;
215
-                    $errorMessage[] = '名称为' . $data['name'] . '的客户删除失败,错误原因:客户下存在商机,不能删除';
215
+                    $errorMessage[] = '客户下存在商机,不能删除';
216 216
                 }
217 217
             }
218 218
             if ($isDel) {
219 219
                 $resContacts = db('crm_contacts')->where(['customer_id' => $v])->find();
220 220
                 if ($resContacts) {
221 221
                     $isDel = false;
222
-                    $errorMessage[] = '名称为' . $data['name'] . '的客户删除失败,错误原因:客户下存在联系人,不能删除';
222
+                    // $errorMessage[] = '名称为' . $data['name'] . '的客户删除失败,错误原因:客户下存在联系人,不能删除';
223
+                    $errorMessage[] = '客户下存在联系人,不能删除';
223 224
                 }
224 225
             }
225 226
             if ($isDel) {
226 227
                 $resContract = db('crm_contract')->where(['customer_id' => $v])->find();
227 228
                 if ($resContract) {
228 229
                     $isDel = false;
229
-                    $errorMessage[] = '名称为' . $data['name'] . '的客户删除失败,错误原因:客户下存在合同,不能删除';
230
+                    $errorMessage[] = '客户下存在合同,不能删除';
230 231
                 }
231 232
             }
232 233
             if ($isDel) {

+ 1
- 1
application/crm/logic/CustomerPoolLogic.php Näytä tiedosto

@@ -954,7 +954,7 @@ class CustomerPoolLogic extends Common
954 954
     private function getPoolQueryField($poolId)
955 955
     {
956 956
         # 自定义字段
957
-        $customerFields = db('crm_customer_pool_field_setting')->where('pool_id', $poolId)->column('field_name');
957
+        $customerFields = db('crm_customer_pool_field_setting')->where('pool_id', $poolId)->where('is_hidden',0)->column('field_name');
958 958
         $customerFields[] = 'customer_id';
959 959
 
960 960
         # 自定增加表别名

+ 14
- 12
application/crm/logic/IndexLogic.php Näytä tiedosto

@@ -109,8 +109,8 @@ class IndexLogic extends Common
109 109
         $contractLastNum = (int)$resLastCount[3]['count1'] ?: 0;
110 110
         $businessLastMoneyNum = $resLastCount[2]['count2'] ?: 0;
111 111
         $contractLastMoneyNum = $resLastCount[3]['count2'] ?: 0;
112
-        $receivablesLastMoneyNum = $resLastCount[4]['count'] ?: 0;
113
-        $recordLastNum = (int)$resLastCount[5]['count'] ?: 0;
112
+        $receivablesLastMoneyNum = $resLastCount[4]['count1'] ?: 0;
113
+        $recordLastNum = (int)$resLastCount[5]['count1'] ?: 0;
114 114
         $data = [];
115 115
         $data['data']['customerNum'] = $customerNum;
116 116
         $data['prev']['customerNum'] = $this->getProportion($customerNum, $customerLastNum);
@@ -171,7 +171,7 @@ class IndexLogic extends Common
171 171
         and owner_user_id IN (" . implode(',', $param['contract_auth_user_ids']) . ")
172 172
         UNION ALL
173 173
         SELECT
174
-        sum(money) AS count,
174
+        sum(money) AS count1,
175 175
         0 count2
176 176
         FROM 5kcrm_crm_receivables
177 177
         WHERE create_time BETWEEN " . $param['start_time'] . " AND " . $param['end_time'] . "
@@ -179,7 +179,7 @@ class IndexLogic extends Common
179 179
         and owner_user_id IN (" . implode(',', $param['receivables_auth_user_ids']) . ")
180 180
         UNION ALL
181 181
         SELECT
182
-        count(1) AS count,
182
+        count(1) AS count1,
183 183
         0 count2
184 184
         FROM 5kcrm_crm_activity
185 185
         WHERE create_time BETWEEN " . $param['start_time'] . " AND " . $param['end_time'] . "
@@ -890,10 +890,11 @@ class IndexLogic extends Common
890 890
                 $list[$k]['fileList'] = $fileList ?: [];
891 891
                 $list[$k]['imgList'] = $imgList ?: [];
892 892
 
893
-                $dataInfo['customerList'] = $relation_list['customerList'] ?: [];
894
-                $dataInfo['contactsList'] = $relation_list['contactsList'] ?: [];
895
-                $dataInfo['businessList'] = $relation_list['businessList'] ?: [];
896
-                $dataInfo['contractList'] = $relation_list['contractList'] ?: [];
893
+                $list[$k]['customer_list'] = $relation_list['customerList'] ?: [];
894
+                $list[$k]['contacts_list'] = $relation_list['contactsList'] ?: [];
895
+                $list[$k]['business_list'] = $relation_list['businessList'] ?: [];
896
+                $list[$k]['contract_list'] = $relation_list['contractList'] ?: [];
897
+
897 898
                 $list[$k]['business_ids'] = implode(',',array_column($relation_list['businessList'],'name'));
898 899
                 $list[$k]['contacts_ids'] = implode(',',array_column($relation_list['contactsList'],'name'));
899 900
                 $list[$k]['thumb_img'] = $v['thumb_img'] ? getFullPath($v['thumb_img']) : '';
@@ -963,10 +964,11 @@ class IndexLogic extends Common
963 964
                 }
964 965
                 $list[$k]['fileList'] = $fileList ?: [];
965 966
                 $list[$k]['imgList'] = $imgList ?: [];
966
-                $dataInfo['customerList'] = $relation_list['customerList'] ?: [];
967
-                $dataInfo['contactsList'] = $relation_list['contactsList'] ?: [];
968
-                $dataInfo['businessList'] = $relation_list['businessList'] ?: [];
969
-                $dataInfo['contractList'] = $relation_list['contractList'] ?: [];
967
+                $list[$k]['customer_list'] = $relation_list['customerList'] ?: [];
968
+                $list[$k]['contacts_list'] = $relation_list['contactsList'] ?: [];
969
+                $list[$k]['business_list'] = $relation_list['businessList'] ?: [];
970
+                $list[$k]['contract_list'] = $relation_list['contractList'] ?: [];
971
+                
970 972
                 $list[$k]['thumb_img'] = $v['thumb_img'] ? getFullPath($v['thumb_img']) : '';
971 973
                 $list[$k]['dataInfo'] = $dataInfo ?: [];
972 974
             }

+ 116
- 1
application/crm/model/Customer.php Näytä tiedosto

@@ -234,7 +234,7 @@ class Customer extends Common
234 234
         		->orderRaw($order)
235 235
                 // ->fetchSql()
236 236
 				->select();
237
-//	p(db('crm_customer')->getLastSql());
237
+
238 238
         $readAuthIds = $userModel->getUserByPer('crm', 'customer', 'read');
239 239
         $updateAuthIds = $userModel->getUserByPer('crm', 'customer', 'update');
240 240
 		$deleteAuthIds = $userModel->getUserByPer('crm', 'customer', 'delete');
@@ -1886,4 +1886,119 @@ class Customer extends Common
1886 1886
 
1887 1887
         return in_array($ownerUserId, $authUserIds);
1888 1888
     }
1889
+
1890
+    /**
1891
+     * 客户销售分析
1892
+     *
1893
+     * @param $id
1894
+     * @return array
1895
+     * @throws \think\db\exception\DataNotFoundException
1896
+     * @throws \think\db\exception\ModelNotFoundException
1897
+     * @throws \think\exception\DbException
1898
+     */
1899
+    public function getCustomerSaleStatistics($param, $user_id)
1900
+    {
1901
+        $userModel = new \app\admin\model\User();
1902
+        $type     = $param['type'];
1903
+        unset($param['type']);
1904
+
1905
+        # 日期条件
1906
+        if ($type) {
1907
+            $timeArr = getTimeByType($type);
1908
+            $timeData['start_time'] = $timeArr[0];
1909
+            $timeData['end_time'] = $timeArr[1];
1910
+        } else {
1911
+            if (!empty($timeData['start_time'])) $timeData['start_time'] = strtotime($timeData['start_time'] . ' 00:00:00');
1912
+            if (!empty($timeData['end_time']))   $timeData['end_time']   = strtotime($timeData['end_time'] . ' 23:59:59');
1913
+        }
1914
+
1915
+        if ($param['user_id']) {
1916
+            $map_user_ids = array($param['user_id']);
1917
+        } else {
1918
+            if ($param['structure_id']) {
1919
+                $map_user_ids = $userModel->getSubUserByStr($param['structure_id'], 2);
1920
+            }
1921
+        }
1922
+        unset($param['user_id']);
1923
+
1924
+        # 格式化参数
1925
+        $request    = $this->fmtRequest( $param );
1926
+
1927
+        $perUserIds = $userModel->getUserByPer('jxc', 'bi', 'jxcProductPurchaseStatistics'); //权限范围内userIds
1928
+        $userIds = $map_user_ids ? array_intersect($map_user_ids, $perUserIds) : $perUserIds; //数组交集
1929
+
1930
+        $dataCount = db('crm_customer')->alias('a')
1931
+                    ->where(['owner_user_id'=>['in', $userIds]])
1932
+                    ->count();
1933
+
1934
+        $list = db('crm_customer')->alias('a')
1935
+                ->where(['owner_user_id' => ['in', $userIds]])
1936
+                ->limit($request['offset'], $request['length'])
1937
+                ->field('customer_id, name')
1938
+                ->orderRaw('customer_id desc')
1939
+                ->select();
1940
+
1941
+        $userIds = implode(',', $userIds);
1942
+        $prefix = config('database.prefix');
1943
+        $start_time = date('Y-m-d', $timeData['start_time']);
1944
+        $end_time = date('Y-m-d', $timeData['end_time']);
1945
+
1946
+        $arr = [];
1947
+        foreach ($list as $key => $value) {
1948
+            $sql = "SELECT
1949
+                    a.customer_id,
1950
+                    a.`name`,
1951
+                    count(distinct b.sale_id) AS sale_num,
1952
+                    IFNULL(
1953
+                        sum(c.sale_product_number),
1954
+                        0
1955
+                    ) AS sale_product_number,
1956
+                    IFNULL(
1957
+                        sum(c.sale_product_subtotal),
1958
+                        0
1959
+                    ) AS sale_product_subtotal
1960
+                FROM
1961
+                    {$prefix}crm_customer as a
1962
+                INNER JOIN {$prefix}jxc_sale as b ON a.customer_id = b.customer_id 
1963
+                INNER JOIN {$prefix}jxc_sale_product as c ON c.sale_id = b.sale_id
1964
+                WHERE a.customer_id = {$value['customer_id']}
1965
+                    AND b.owner_user_id IN ({$userIds})
1966
+                    AND b.check_status IN (7, 2)
1967
+                    AND b.create_time BETWEEN {$timeData['start_time']} AND {$timeData['end_time']}";
1968
+            
1969
+            $data = queryCache($sql);
1970
+
1971
+            $sql1 = "SELECT
1972
+                    a.customer_id,
1973
+                    a.`name`,
1974
+                    count(distinct b.salereturn_id) AS salereturn_num,
1975
+                    IFNULL(
1976
+                        sum(c.salereturn_number),
1977
+                        0
1978
+                    ) AS salereturn_number,
1979
+                    IFNULL(
1980
+                        sum(c.salereturn_subtotal),
1981
+                        0
1982
+                    ) AS salereturn_subtotal
1983
+                FROM
1984
+                    {$prefix}crm_customer as a
1985
+                INNER JOIN {$prefix}jxc_salereturn as b ON a.customer_id = b.customer_id 
1986
+                INNER JOIN {$prefix}jxc_salereturn_product as c ON c.salereturn_id = b.salereturn_id
1987
+                WHERE a.customer_id = {$value['customer_id']}
1988
+                    AND b.owner_user_id IN ({$userIds})
1989
+                    AND b.check_status IN (7, 2)
1990
+                    AND b.create_time BETWEEN {$timeData['start_time']} AND {$timeData['end_time']}";
1991
+            $data1 = queryCache($sql1);
1992
+
1993
+            $item = [];
1994
+            foreach ($data as $key => $value) {
1995
+                $item = array_merge($value, $data1[$key]);
1996
+            }
1997
+            $arr['items'][] = $item;
1998
+        }
1999
+        $data = [];
2000
+        $data['list'] = $arr ? : [];
2001
+        $data['dataCount'] = $dataCount ? : 0;
2002
+        return $data;
2003
+    }
1889 2004
 }

+ 1
- 1
application/oa/logic/ExamineLogic.php Näytä tiedosto

@@ -495,5 +495,5 @@ class ExamineLogic extends Common
495 495
         
496 496
         return true;
497 497
     }
498
-    
498
+
499 499
 }

+ 5
- 4
application/oa/logic/LogLogic.php Näytä tiedosto

@@ -808,6 +808,7 @@ class LogLogic extends Common
808 808
             $relation_list = [];
809 809
             $f_where['module'] = 'crm_activity';
810 810
             $relation_list = $recordModel->getListByRelationId('activity', $v['activity_id']);
811
+
811 812
             $dataInfo = [];
812 813
             $newFileList = [];
813 814
             $newFileList = $fileModel->getDataList($f_where, 'all');
@@ -822,10 +823,10 @@ class LogLogic extends Common
822 823
             }
823 824
             $list[$k]['fileList'] = $fileList ?: [];
824 825
             $list[$k]['imgList'] = $imgList ?: [];
825
-            $dataInfo['customerList'] = $relation_list['customer_list'] ?: [];
826
-            $dataInfo['contactsList'] = $relation_list['contacts_list'] ?: [];
827
-            $dataInfo['businessList'] = $relation_list['business_list'] ?: [];
828
-            $dataInfo['contractList'] = $relation_list['contract_list'] ?: [];
826
+            $list[$k]['customer_list'] = $relation_list['customerList'] ?: [];
827
+            $list[$k]['contacts_list'] = $relation_list['contactsList'] ?: [];
828
+            $list[$k]['business_list'] = $relation_list['businessList'] ?: [];
829
+            $list[$k]['contract_list'] = $relation_list['contractList'] ?: [];
829 830
             $list[$k]['dataInfo'] = $dataInfo ?: [];
830 831
 
831 832
         }

+ 43
- 38
public/sql/5kcrm.sql Näytä tiedosto

@@ -334,13 +334,13 @@ INSERT INTO `5kcrm_admin_field` VALUES (87, 'oa_examine', 5, 'remark', '备注',
334 334
 INSERT INTO `5kcrm_admin_field` VALUES (88, 'oa_examine', 6, 'content', '借款事由', 'text', '', 0, 0, 1, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,1', NULL, NULL, NULL, NULL, NULL, NULL);
335 335
 INSERT INTO `5kcrm_admin_field` VALUES (89, 'oa_examine', 6, 'money', '借款金额(元)', 'floatnumber', '', 0, 0, 1, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,2', NULL, NULL, NULL, NULL, NULL, NULL);
336 336
 INSERT INTO `5kcrm_admin_field` VALUES (90, 'oa_examine', 6, 'remark', '备注', 'textarea', '', 0, 0, 0, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,3', NULL, NULL, NULL, NULL, NULL, NULL);
337
-INSERT INTO `5kcrm_admin_field` VALUES (91, 'crm_receivables_plan', 0, 'customer_id', '客户名称', 'customer', '', 0, 0, 1, '', '', 1, 3, 1553788800, 1624439466, 0, NULL, 0, 50, '0,0', NULL, NULL, NULL, NULL, '', 1001);
338
-INSERT INTO `5kcrm_admin_field` VALUES (92, 'crm_receivables_plan', 0, 'contract_id', '合同编号', 'contract', '', 0, 0, 1, '', '', 2, 3, 1553788800, 1624439466, 0, NULL, 0, 50, '0,1', NULL, NULL, NULL, NULL, '', 1002);
339
-INSERT INTO `5kcrm_admin_field` VALUES (93, 'crm_receivables_plan', 0, 'money', '计划回款金额', 'floatnumber', '', 0, 0, 1, '', '', 3, 3, 1553788800, 1624439466, 6, NULL, 0, 50, '1,0', NULL, NULL, NULL, NULL, '', 1003);
340
-INSERT INTO `5kcrm_admin_field` VALUES (94, 'crm_receivables_plan', 0, 'return_date', '计划回款日期', 'date', '', 0, 0, 1, '', '', 4, 3, 1553788800, 1624439466, 4, NULL, 0, 50, '1,1', NULL, NULL, NULL, NULL, '', 1004);
341
-INSERT INTO `5kcrm_admin_field` VALUES (95, 'crm_receivables_plan', 0, 'return_type', '计划回款方式', 'select', '', 0, 0, 1, '', '支票\n现金\n邮政汇款\n电汇\n网上转账\n支付宝\n微信支付\n其他\n在线支付\n线下支付\n预存款\n返利\n预存款+返利', 5, 3, 1553788800, 1624439466, 3, NULL, 0, 50, '2,0', 2, NULL, NULL, NULL, '支票\n现金\n邮政汇款\n电汇\n网上转账\n支付宝\n微信支付\n其他\n在线支付\n线下支付\n预存款\n返利\n预存款+返利', 1005);
342
-INSERT INTO `5kcrm_admin_field` VALUES (96, 'crm_receivables_plan', 0, 'remind', '提前几日提醒', 'number', '', 0, 0, 0, '', '', 6, 3, 1553788800, 1624439466, 5, NULL, 0, 50, '2,1', NULL, NULL, NULL, NULL, '', 1006);
343
-INSERT INTO `5kcrm_admin_field` VALUES (97, 'crm_receivables_plan', 0, 'remark', '备注', 'textarea', '', 0, 0, 0, '', '', 7, 1, 1553788800, 1624439466, 2, NULL, 0, 100, '3,0', NULL, NULL, NULL, NULL, '', 1007);
337
+INSERT INTO `5kcrm_admin_field` VALUES (91, 'crm_receivables_plan', 0, 'customer_id', '客户名称', 'customer', '', 0, 0, 1, '', '', 1, 181, 1553788800, 1624439466, 0, NULL, 0, 50, '0,0', NULL, NULL, NULL, NULL, '', 1001);
338
+INSERT INTO `5kcrm_admin_field` VALUES (92, 'crm_receivables_plan', 0, 'contract_id', '合同编号', 'contract', '', 0, 0, 1, '', '', 2, 181, 1553788800, 1624439466, 0, NULL, 0, 50, '0,1', NULL, NULL, NULL, NULL, '', 1002);
339
+INSERT INTO `5kcrm_admin_field` VALUES (93, 'crm_receivables_plan', 0, 'money', '计划回款金额', 'floatnumber', '', 0, 0, 1, '', '', 3, 181, 1553788800, 1624439466, 6, NULL, 0, 50, '1,0', NULL, NULL, NULL, NULL, '', 1003);
340
+INSERT INTO `5kcrm_admin_field` VALUES (94, 'crm_receivables_plan', 0, 'return_date', '计划回款日期', 'date', '', 0, 0, 1, '', '', 4, 183, 1553788800, 1624439466, 4, NULL, 0, 50, '1,1', NULL, NULL, NULL, NULL, '', 1004);
341
+INSERT INTO `5kcrm_admin_field` VALUES (95, 'crm_receivables_plan', 0, 'return_type', '计划回款方式', 'select', '', 0, 0, 1, '', '支票\n现金\n邮政汇款\n电汇\n网上转账\n支付宝\n微信支付\n其他\n在线支付\n线下支付\n预存款\n返利\n预存款+返利', 5, 191, 1553788800, 1624439466, 3, NULL, 0, 50, '2,0', 2, NULL, NULL, NULL, '支票\n现金\n邮政汇款\n电汇\n网上转账\n支付宝\n微信支付\n其他\n在线支付\n线下支付\n预存款\n返利\n预存款+返利', 1005);
342
+INSERT INTO `5kcrm_admin_field` VALUES (96, 'crm_receivables_plan', 0, 'remind', '提前几日提醒', 'number', '', 0, 0, 0, '', '', 6, 191, 1553788800, 1624439466, 5, NULL, 0, 50, '2,1', NULL, NULL, NULL, NULL, '', 1006);
343
+INSERT INTO `5kcrm_admin_field` VALUES (97, 'crm_receivables_plan', 0, 'remark', '备注', 'textarea', '', 0, 0, 0, '', '', 7, 191, 1553788800, 1624439466, 2, NULL, 0, 100, '3,0', NULL, NULL, NULL, NULL, '', 1007);
344 344
 INSERT INTO `5kcrm_admin_field` VALUES (99, 'crm_customer', 0, 'mobile', '手机', 'mobile', '', 0, 0, 0, '', '', 6, 191, 1553788800, 1624439032, 7, '', 0, 50, '2,1', 0, '', '', '', '', 1031);
345 345
 INSERT INTO `5kcrm_admin_field` VALUES (100, 'crm_customer', 0, 'email', '邮箱', 'email', '', 0, 0, 0, '', '', 7, 191, 1553788800, 1624439032, 14, '', 0, 50, '3,0', 0, '', '', '', '', 1032);
346 346
 INSERT INTO `5kcrm_admin_field` VALUES (101, 'crm_visit', 0, 'number', '回访编号', 'text', '', 0, 0, 1, '', NULL, 1, 177, 1553788800, 1624439600, 1, '', 0, 50, '0,0', 0, '', '', '', NULL, 1001);
@@ -1600,44 +1600,45 @@ CREATE TABLE `5kcrm_crm_contract_product`  (
1600 1600
 -- Table structure for 5kcrm_crm_customer
1601 1601
 -- ----------------------------
1602 1602
 DROP TABLE IF EXISTS `5kcrm_crm_customer`;
1603
-CREATE TABLE `5kcrm_crm_customer` (
1603
+CREATE TABLE `5kcrm_crm_customer`  (
1604 1604
   `customer_id` int(11) NOT NULL AUTO_INCREMENT,
1605
-  `name` varchar(255) DEFAULT NULL COMMENT '客户名称',
1606
-  `is_lock` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1锁定',
1605
+  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户名称',
1606
+  `is_lock` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1锁定',
1607 1607
   `deal_time` int(11) NOT NULL COMMENT '领取,分配,创建时间',
1608
-  `level` varchar(500) DEFAULT NULL COMMENT '客户级别',
1609
-  `industry` varchar(500) DEFAULT NULL COMMENT '客户行业',
1610
-  `source` varchar(500) DEFAULT NULL COMMENT '客户来源',
1611
-  `telephone` varchar(255) DEFAULT NULL COMMENT '电话',
1612
-  `mobile` varchar(255) DEFAULT NULL COMMENT '手机',
1613
-  `website` varchar(255) DEFAULT NULL COMMENT '网址',
1614
-  `remark` text COMMENT '备注',
1608
+  `level` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户级别',
1609
+  `industry` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户行业',
1610
+  `source` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户来源',
1611
+  `telephone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '电话',
1612
+  `mobile` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机',
1613
+  `website` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '网址',
1614
+  `remark` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注',
1615 1615
   `create_user_id` int(11) NOT NULL COMMENT '创建人ID',
1616 1616
   `owner_user_id` int(11) NOT NULL COMMENT '负责人ID',
1617
-  `ro_user_id` varchar(500) NOT NULL DEFAULT '' COMMENT '只读权限',
1618
-  `rw_user_id` varchar(500) NOT NULL DEFAULT '' COMMENT '读写权限',
1619
-  `address` varchar(255) NOT NULL DEFAULT '' COMMENT '省市区',
1620
-  `location` varchar(255) NOT NULL DEFAULT '' COMMENT '定位信息',
1621
-  `detail_address` varchar(255) NOT NULL DEFAULT '' COMMENT '详细地址',
1622
-  `lng` double(14,11) DEFAULT NULL COMMENT '地理位置经度',
1623
-  `lat` double(14,11) DEFAULT NULL COMMENT '地理位置维度',
1624
-  `next_time` int(11) DEFAULT NULL COMMENT '下次联系时间',
1625
-  `follow` varchar(20) DEFAULT NULL COMMENT '跟进',
1626
-  `obtain_time` int(10) NOT NULL DEFAULT '0' COMMENT '负责人获取客户时间',
1617
+  `ro_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '只读权限',
1618
+  `rw_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '读写权限',
1619
+  `address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '省市区',
1620
+  `location` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '定位信息',
1621
+  `detail_address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '详细地址',
1622
+  `lng` double(14, 11) NULL DEFAULT NULL COMMENT '地理位置经度',
1623
+  `lat` double(14, 11) NULL DEFAULT NULL COMMENT '地理位置维度',
1624
+  `next_time` int(11) NULL DEFAULT NULL COMMENT '下次联系时间',
1625
+  `follow` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '跟进',
1626
+  `obtain_time` int(10) NOT NULL DEFAULT 0 COMMENT '负责人获取客户时间',
1627 1627
   `create_time` int(11) NOT NULL COMMENT '创建时间',
1628 1628
   `update_time` int(11) NOT NULL COMMENT '更新时间',
1629
-  `is_dealt` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否已经处理(待办事项):1已处理;0未处理;',
1630
-  `is_allocation` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否是分配给我的客户:1是;0不是',
1631
-  `last_time` int(10) unsigned DEFAULT NULL COMMENT '最后跟进时间',
1632
-  `last_record` varchar(512) DEFAULT NULL COMMENT '最后跟进记录',
1633
-  `email` varchar(255) DEFAULT NULL COMMENT '邮箱',
1634
-  `before_owner_user_id` int(10) unsigned DEFAULT '0' COMMENT '前负责人',
1635
-  `into_pool_time` int(10) unsigned DEFAULT '0' COMMENT '进入公海时间',
1636
-  `pool_remain` tinyint(1) NOT NULL DEFAULT '0' COMMENT '代办事项待进入公海:1已处理,0未处理',
1637
-  `deal_status` varchar(10) NOT NULL DEFAULT '未成交' COMMENT '成交状态',
1629
+  `is_dealt` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否已经处理(待办事项):1已处理;0未处理;',
1630
+  `is_allocation` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否是分配给我的客户:1是;0不是',
1631
+  `last_time` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '最后跟进时间',
1632
+  `last_record` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '最后跟进记录',
1633
+  `email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱',
1634
+  `before_owner_user_id` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '前负责人',
1635
+  `into_pool_time` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '进入公海时间',
1636
+  `pool_remain` tinyint(1) NOT NULL DEFAULT 0 COMMENT '代办事项待进入公海:1已处理,0未处理',
1637
+  `deal_status` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '未成交' COMMENT '成交状态',
1638 1638
   PRIMARY KEY (`customer_id`) USING BTREE,
1639
-  KEY `bi_analysis` (`create_time`,`owner_user_id`) USING BTREE
1640
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='客户表';
1639
+  INDEX `bi_analysis`(`create_time`, `owner_user_id`) USING BTREE
1640
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '客户表' ROW_FORMAT = DYNAMIC;
1641
+
1641 1642
 -- ----------------------------
1642 1643
 -- Records of 5kcrm_crm_customer
1643 1644
 -- ----------------------------
@@ -2323,9 +2324,13 @@ CREATE TABLE `5kcrm_crm_receivables_plan`  (
2323 2324
   `update_time` int(11) NOT NULL COMMENT '更新时间',
2324 2325
   `file` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件',
2325 2326
   `is_dealt` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否已经处理(待办事项):1已处理;0未处理;',
2327
+  `real_money` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '实际回款金额',
2328
+  `real_data` date DEFAULT NULL COMMENT '实际回款日期',
2329
+  `un_money` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '未回金额',
2326 2330
   PRIMARY KEY (`plan_id`) USING BTREE
2327 2331
 ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '回款计划表' ROW_FORMAT = DYNAMIC;
2328 2332
 
2333
+
2329 2334
 -- ----------------------------
2330 2335
 -- Records of 5kcrm_crm_receivables_plan
2331 2336
 -- ----------------------------

+ 7
- 3
public/sql/update_sql_20210903.sql Näytä tiedosto

@@ -1,5 +1,9 @@
1
-ALTER TABLE `5kcrm_crm_receivables_plan` ADD COLUMN `real_money` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '实际回款金额';
2
-ALTER TABLE `5kcrm_crm_receivables_plan` ADD COLUMN `real_data` date DEFAULT NULL COMMENT '实际回款日期';
3
-ALTER TABLE `5kcrm_crm_receivables_plan` ADD COLUMN `un_money` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '未回金额';
1
+--
2
+--回款计划
3
+--
4
+ALTER TABLE `5kcrm_crm_receivables_plan` ADD `real_money` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '实际回款金额';
5
+ALTER TABLE `5kcrm_crm_receivables_plan` ADD `real_data` date DEFAULT NULL COMMENT '实际回款日期';
6
+ALTER TABLE `5kcrm_crm_receivables_plan` ADD `un_money` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '未回金额';
7
+DELETE `5kcrm_admin_field` where `types` = 'crm_customer' AND`field` = 'deal_status';
4 8
 INSERT INTO `5kcrm_admin_field` VALUES (18, 'crm_customer', 0, 'deal_status', '成交状态', 'select', '未成交', 0, 0, 1, '', '未成交\n已成交', 0, 191, 1553788800, 1553788800, 0, NULL, 0, 100, '', NULL, NULL, NULL, NULL, NULL, NULL);
5 9