rabin 1 year ago
parent
commit
4f550bd5fc
3 changed files with 93 additions and 6 deletions
  1. 5 5
      database/yspay_merchant.php
  2. 1 1
      lib/Yspay.php
  3. 87 0
      yspay/Merchant.php

+ 5 - 5
database/yspay_merchant.php

@@ -20,7 +20,7 @@ if ($account_id) {
     $yspay = Dever::db('pay/yspay')->find(array('account_id' => $account_id));
     $yspay_type = $yspay['type'];
 }
-
+$set = Dever::input('set');
 $list_button = array
 (
     'edit' => array('编辑'),
@@ -85,7 +85,7 @@ return array
             'default'   => '',
             'desc'      => '商户名称',
             'match'     => 'is_string',
-            'update'    => 'text',
+            'update'    => $set ? false : 'text',
             'search'    => 'fulltext',
             'list'      => true,
         ),
@@ -98,7 +98,7 @@ return array
             'desc'      => '商户类型',
             'match'     => 'option',
             'search'    => 'select',
-            'update'    => 'radio',
+            'update'    => $set ? false : 'radio',
             'option'    => $type,
             'list'      => true,
             'control'   => 'type',
@@ -112,7 +112,7 @@ return array
             'desc'      => '所属项目',
             'match'     => 'option',
             'search'    => 'select',
-            'update'    => 'radio',
+            'update'    => $set ? false : 'radio',
             'control_url'	=> 'pay/yspay/merchant.selectRelate',
             'option'    => $project,
             //'list'      => true,
@@ -126,7 +126,7 @@ return array
             'default'   => '-1',
             'desc'      => '关联数据',
             'match'     => 'option',
-            'update'    => 'select',
+            'update'    => $set ? false : 'select',
             'show'      => 'type=1',
         ),
 

+ 1 - 1
lib/Yspay.php

@@ -295,7 +295,7 @@ class Yspay extends Core
 			foreach ($other as $k => $v) {
 				$subOrders = array();
 				if (isset($v['amount']) && $v['amount']) {
-					$subOrders['totalAmount'] = $v['amount'];
+					$subOrders['totalAmount'] = round($v['amount'] * 100, 2);
 					$request['platformAmount'] = round($request['platformAmount'] - $subOrders['totalAmount'], 2);
 				} elseif (isset($v['per']) && $v['per']) {
 					$v['per'] = $v['per'] && $v['per'] >= 0 ? $v['per'] : 0;

+ 87 - 0
yspay/Merchant.php

@@ -40,4 +40,91 @@ class Merchant
         $project = Dever::db('pay/yspay_project')->find($project_id);
         return Dever::search($project['table'], $where);
     }
+
+    public function up($account_id, $project_id, $id, $name)
+    {
+        $data = array();
+        $data['account_id'] = $account_id;
+        $data['project_id'] = $project_id;
+        $data['relate_id'] = $id;
+        $info = Dever::db('pay/yspay_merchant')->find($data);
+        if (!$info) {
+            $data['name'] = $name;
+            $data['type'] = 1;
+            $data['status'] = 2;
+            return Dever::db('pay/yspay_merchant')->insert($data);
+        }
+        return false;
+    }
+
+    public function getYspay($account_id, $project_id, $id, $parent)
+    {
+        $table = array();
+        $table['head'] = array('银联商户号', '银联用户号', '平台分账百分比', '操作');
+        $table['body'] = array();
+
+        $where = array();
+        $where['account_id'] = $account_id;
+        $where['project_id'] = $project_id;
+        $where['relate_id'] = $id;
+        $data = Dever::db('pay/yspay_merchant')->select($where);
+
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $status_name = '已签约';
+                $step = false;
+                if ($v['status'] == 2) {
+                    $status_name = '未签约';
+                    $sign = Dever::db('pay/yspay_sign')->one(array('merchant_id' => $v['id']));
+                    if ($sign && $sign['step']) {
+                        $step = $sign['step'];
+                    }
+                }
+                $url = Dever::url('project/database/update?project=pay&table=yspay_merchant&set=1&where_id='.$v['id'], 'manage');
+                $oper = '<a class="layui-btn" onclick="fastEdit($(this),\''.$url.'\',\'编辑信息\', \'\')">编辑</a>';
+
+                if ($v['status'] == 1) {
+                    $url = Dever::url('project/database/list?project=pay&table=yspay_cash&search_option_merchant_id='.$v['id'].'&search_option_account_id='.$v['account_id'].'&parent='.$parent, 'manage');
+                    $oper .= '<a class="layui-btn" href="'.$url.'">资金流水</a>';
+                }
+                if ($v['status'] == 2) {
+                    $url = Dever::url('project/database/update?project=pay&table=yspay_sign&search_option_merchant_id='.$v['id'].'&search_option_account_id='.$v['account_id'].'&where_id='.$v['id'].'&parent='.$parent, 'manage');
+                    $oper .= '<a class="layui-btn" onclick="fastEdit($(this),\''.$url.'\',\'签约资料\', \'\')">签约资料</a>';
+
+                    if ($step == -1) {
+                        $content = '';
+                        $title = '';
+                        $url = Dever::url('pay/yspay/sign.handle?sign_id=' . $v['id']);
+                        $oper .= '<a class="layui-btn"href="javascript:;" onclick="load(\'' . $url . '\', \'' . $content . '\', \'' . $title . '\')">签约提审</a>';
+                    }
+
+                    if ($step == 2) {
+                        $url = Dever::url('project/database/update?project=pay&table=yspay_sign&col=cashwhere_id='.$v['id'], 'manage');
+                        $oper = '<a class="layui-btn" onclick="fastEdit($(this),\''.$url.'\',\'签约打款\', \'\')">签约打款</a>';
+                    }
+
+                    if ($step == 4) {
+                        $url = Dever::load('pay/yspay/sign.getAgreement', $v['id']);
+                        $oper .= '<a style="cursor:pointer" data-clipboard-text="'.$url.'" class="clipboard"><button type="button" class="btn btn-info btn-rounded waves-effect waves-light m-b-5 ">签约合同</button></a>';
+                    }
+                }
+
+                $table['body'][$k][] = $v['mid'];
+                $table['body'][$k][] = $v['merno'];
+                $table['body'][$k][] = $v['cash_per'] . '%';
+                $table['body'][$k][] = $oper;
+            }
+        }
+        $body[''] = array
+        (
+            'type' => 'table',
+            'content' => $table,
+        );
+
+        if ($table['body']) {
+            return Dever::show('', $body);
+        } else {
+            return '暂无';
+        }
+    }
 }