Merge branch 'develop'

master
luoyang 8 years ago
commit c534762f60

@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -114,5 +115,6 @@ public interface ClientMapper {
JSONObject countBdApproveClients(@Param("manager_id") String manager_id); JSONObject countBdApproveClients(@Param("manager_id") String manager_id);
@Select("select client_id from sys_clients where parent_client_id=#{parent_client_id}")
List<Integer> childClientId(@Param("parent_client_id") int parent_client_id);
} }

@ -173,10 +173,8 @@ public interface ClientManager {
List<JSONObject> listSubClients(JSONObject manager, String clientMoniker); List<JSONObject> listSubClients(JSONObject manager, String clientMoniker);
List<JSONObject> listSubClients(int clientId); List<JSONObject> listSubClients(int clientId);
// void newSubClient(String clientMoniker, SubClientRegistry registry, JSONObject manager); // void newSubClient(String clientMoniker, SubClientRegistry registry, JSONObject manager);
void validateClients(int client_id, JSONObject params) throws Exception; void validateClients(int client_id, JSONObject params) throws Exception;
@ -341,6 +339,10 @@ public interface ClientManager {
String queryAlipayGmsStatus(String clientMoniker, JSONObject manager); String queryAlipayGmsStatus(String clientMoniker, JSONObject manager);
JSONObject queryAlipayGmsJson(String clientMoniker, JSONObject manager);
JSONObject queryAlipayOnlineGmsJson(String clientMoniker, JSONObject manager);
String queryAlipayOnlineGmsStatus(String clientMoniker, JSONObject manager); String queryAlipayOnlineGmsStatus(String clientMoniker, JSONObject manager);
List<JSONObject> listMerchantIds(String clientMoniker,JSONObject manager); List<JSONObject> listMerchantIds(String clientMoniker,JSONObject manager);
@ -428,4 +430,6 @@ public interface ClientManager {
void resetRefundPassword(JSONObject account, JSONObject json); void resetRefundPassword(JSONObject account, JSONObject json);
void resetRefundPasswordByManage(String clientMoniker,JSONObject manage, JSONObject json); void resetRefundPasswordByManage(String clientMoniker,JSONObject manage, JSONObject json);
List<Integer> listLevel3Client(int client_id);
} }

@ -1163,7 +1163,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
* client.getString("client_moniker"), 3, mailResult.getString("mail_id"))); } catch (Exception e) { * client.getString("client_moniker"), 3, mailResult.getString("mail_id"))); } catch (Exception e) {
* clientModifySupport.processClientModify(new EmailModify(account, client.getString("client_moniker"), 0, * clientModifySupport.processClientModify(new EmailModify(account, client.getString("client_moniker"), 0,
* null)); throw new EmailException("Email Sending Failed", e); } } }.start(); } * null)); throw new EmailException("Email Sending Failed", e); } } }.start(); }
*
*/ */
public void sendAuthInitEmail(JSONObject account, final JSONObject client) { public void sendAuthInitEmail(JSONObject account, final JSONObject client) {
@ -1409,8 +1408,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (account.getIntValue("client_id") != client.getIntValue("client_id")) { if (account.getIntValue("client_id") != client.getIntValue("client_id")) {
//登录用户所属商户 //登录用户所属商户
JSONObject clientLogin = getClientInfo(account.getIntValue("client_id")); JSONObject clientLogin = getClientInfo(account.getIntValue("client_id"));
if(!(client.getBoolean("sub_manage") && Boolean validChildClients = clientLogin.containsKey("parent_client_id") ? clientLogin.getIntValue("parent_client_id") == client.getIntValue("client_id") : false;
clientLogin.containsKey("parent_client_id")?clientLogin.getIntValue("parent_client_id")==client.getIntValue("client_id"):false)){ Boolean validLevel3Clients = listLevel3Client(client.getIntValue("client_id")).contains(clientLogin.getIntValue("parent_client_id"));
if (!(client.getBoolean("sub_manage") && (validChildClients || validLevel3Clients))) {
throw new BadRequestException("error.partner.valid.account_not_match"); throw new BadRequestException("error.partner.valid.account_not_match");
} }
} }
@ -1805,7 +1805,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
checkOrgPermission(manager, client); checkOrgPermission(manager, client);
return clientMapper.listChildClients(client.getIntValue("client_id")); JSONObject listSubClients = new JSONObject();
List<JSONObject> listChildClients = clientMapper.listChildClients(client.getIntValue("client_id"));
for (JSONObject partner : listChildClients) {
List<JSONObject> clients = clientMapper.listChildClients(partner.getIntValue("client_id"));
if (clients.size() > 0) {
partner.put("level3Clients", clients);
clients.forEach(e->{
e.put("parent_client_moniker", partner.getString("client_moniker"));
});
}
}
return listChildClients;
} }
@Override @Override
@ -1884,7 +1895,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
for (String currentClientId : client_ids) { for (String currentClientId : client_ids) {
JSONObject clientInfo = getClientInfo(Integer.parseInt(currentClientId)); JSONObject clientInfo = getClientInfo(Integer.parseInt(currentClientId));
if (clientInfo.containsKey("parent_client_id")) { if (clientInfo.containsKey("parent_client_id")) {
if (clientInfo.getIntValue("parent_client_id") != client_id) { int parentClientId = clientInfo.getIntValue("parent_client_id");
if (parentClientId != client_id && !listLevel3Client(client_id).contains(parentClientId)) {
throw new Exception("partner has no permission"); throw new Exception("partner has no permission");
} }
} }
@ -1893,6 +1905,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
} }
@Override
public List<Integer> listLevel3Client(int clientId) {
return clientMapper.childClientId(clientId);
}
@Override @Override
@Transactional @Transactional
public void updateClientBDUsers(JSONObject manager, String clientMoniker, JSONObject data) throws Exception { public void updateClientBDUsers(JSONObject manager, String clientMoniker, JSONObject data) throws Exception {
@ -3741,8 +3758,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
} }
private TemplateMessage initSendToComplianceGreenChannelTemplate(String loginUrl, String wxopenid, String templateId2, String bd_user_name, private TemplateMessage initSendToComplianceGreenChannelTemplate(String loginUrl, String wxopenid, String templateId2, String bd_user_name, JSONObject client) {
JSONObject client) {
TemplateMessage msg = new TemplateMessage(wxopenid, templateId2, loginUrl); TemplateMessage msg = new TemplateMessage(wxopenid, templateId2, loginUrl);
msg.put("first", bd_user_name + " 提交了新商户绿色通道申请,请审核", "#ff0000"); msg.put("first", bd_user_name + " 提交了新商户绿色通道申请,请审核", "#ff0000");
msg.put("keyword1", client.getString("client_moniker") + "申请绿色通道", "#0000ff"); msg.put("keyword1", client.getString("client_moniker") + "申请绿色通道", "#0000ff");
@ -4007,6 +4023,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
client.put("bank_id", client_bank.getString("account_no")); client.put("bank_id", client_bank.getString("account_no"));
if (StringUtils.isBlank(client.getString("business_structure"))) {
throw new BadRequestException("Business Structure can't be null");
}
if (StringUtils.isBlank(client.getString("alipayindustry"))) {
throw new BadRequestException("Alipay Industry can't be null");
}
if (!"Company".equals(client.getString("business_structure"))) { if (!"Company".equals(client.getString("business_structure"))) {
if (StringUtils.isBlank(representative_id.getString("representative_id"))) { if (StringUtils.isBlank(representative_id.getString("representative_id"))) {
throw new BadRequestException("ID or passport number can't be null"); throw new BadRequestException("ID or passport number can't be null");
@ -4045,6 +4069,82 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return "查询成功:" + responseElement.elementText("secondary_merchant_id") + "报备状态 : " + responseElement.elementText("status"); return "查询成功:" + responseElement.elementText("secondary_merchant_id") + "报备状态 : " + responseElement.elementText("status");
} }
@Override
public JSONObject queryAlipayGmsJson(String clientMoniker, JSONObject manager) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayRetailMerchant();
JSONObject queryGMSJson = new JSONObject(new LinkedHashMap());
queryGMSJson.put("service", "alipay.overseas.secmerchant.offline.maintain");
queryGMSJson.put("partner", mch.getPid());
queryGMSJson.put("sign_type", "MD5");
queryGMSJson.put("_input_charset", "utf-8");
queryGMSJson.put("timestamp", DateFormatUtils.format(System.currentTimeMillis(),"yyyy-MM-dd HH:mm:ss"));
queryGMSJson.put("secondary_merchant_name", client.getString("company_name"));
queryGMSJson.put("secondary_merchant_id", client.getString("client_moniker"));
queryGMSJson.put("store_id", client.getString("client_moniker"));
queryGMSJson.put("store_name", client.getString("short_name"));
queryGMSJson.put("store_country", client.getString("country").substring(0,2));
queryGMSJson.put("store_address", client.getString("country") + " "+client.getString("state") + " "+client.getString("suburb") + " "+client.getString("address"));
queryGMSJson.put("store_industry", client.getString("alipayindustry"));
queryGMSJson.put("internal_store_photo", client.getString("company_photo"));
queryGMSJson.put("external_storefront_photo", client.getString("store_photo"));
queryGMSJson.put("register_country", client.getString("country").substring(0,2));
queryGMSJson.put("register_address", client.getString("country") + " "+client.getString("state") + " "+client.getString("suburb") + " "+client.getString("address"));
if ("Company".equals(client.getString("business_structure"))) {
queryGMSJson.put("secondary_merchant_type", "ENTERPRISE");
queryGMSJson.put("registration_no", client.getString("acn"));
}else {
queryGMSJson.put("secondary_merchant_type", "INDIVIDUAL");
queryGMSJson.put("representative_name", client.getString("contact_person"));
}
queryGMSJson.put("contact_no",client.getString("contact_phone"));
queryGMSJson.put("contact_email",client.getString("contact_email"));
return queryGMSJson;
}
@Override
public JSONObject queryAlipayOnlineGmsJson(String clientMoniker, JSONObject manager) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
JSONObject queryGMSJson = new JSONObject(new LinkedHashMap());
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant();
queryGMSJson.put("service", "alipay.overseas.secmerchant.online.maintain");
queryGMSJson.put("partner", mch.getPid());
queryGMSJson.put("sign_type", "MD5");
queryGMSJson.put("_input_charset", "utf-8");
queryGMSJson.put("timestamp", DateFormatUtils.format(System.currentTimeMillis(),"yyyy-MM-dd HH:mm:ss"));
queryGMSJson.put("secondary_merchant_name", client.getString("company_name"));
queryGMSJson.put("secondary_merchant_id", client.getString("client_moniker"));
queryGMSJson.put("secondary_merchant_industry", client.getString("alipayindustry"));
queryGMSJson.put("register_country", client.getString("country").substring(0,2));
queryGMSJson.put("register_address", client.getString("country") + " "+client.getString("state") + " "+client.getString("suburb") + " "+client.getString("address"));
JSONObject website = new JSONObject();
List<JSONObject> websites = new ArrayList<>();
website.put("site_type", "WEB");
website.put("site_url", client.getString("company_website"));
website.put("site_name", client.getString("company_name") + " Website");
websites.add(website);
queryGMSJson.put("site_infos", websites.toString());
if ("Company".equals(client.getString("business_structure"))) {
queryGMSJson.put("secondary_merchant_type", "ENTERPRISE");
queryGMSJson.put("registration_no", client.getString("acn"));
queryGMSJson.put("shareholder_name", client.getString("contact_person"));
}else {
queryGMSJson.put("secondary_merchant_type", "INDIVIDUAL");
queryGMSJson.put("representative_name", client.getString("contact_person"));
}
queryGMSJson.put("contact_no",client.getString("contact_phone"));
queryGMSJson.put("contact_email",client.getString("contact_email"));
return queryGMSJson;
}
@Override @Override
public void registerAlipayOnlineGms(String clientMoniker, JSONObject representative_id, JSONObject manager) { public void registerAlipayOnlineGms(String clientMoniker, JSONObject representative_id, JSONObject manager) {
JSONObject client = getClientInfoByMoniker(clientMoniker); JSONObject client = getClientInfoByMoniker(clientMoniker);
@ -4055,6 +4155,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (!client.containsKey("company_website")) { if (!client.containsKey("company_website")) {
throw new InvalidParameterException("Website cannot be empty "); throw new InvalidParameterException("Website cannot be empty ");
} }
if (StringUtils.isBlank(client.getString("business_structure"))) {
throw new BadRequestException("Business Structure can't be null");
}
if (StringUtils.isBlank(client.getString("alipayindustry"))) {
throw new BadRequestException("Alipay Industry can't be null");
}
JSONObject client_bank = getBankAccountByClientId(client.getIntValue("client_id")); JSONObject client_bank = getBankAccountByClientId(client.getIntValue("client_id"));
if (client_bank == null || client_bank.size() <= 0) { if (client_bank == null || client_bank.size() <= 0) {
throw new BadRequestException("The Partner's Account is not config!"); throw new BadRequestException("The Partner's Account is not config!");
@ -4598,6 +4706,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
return ""; return "";
} }
@Override @Override
@Transactional @Transactional
public void updateAllPartnerPassword(String clientMoniker) { public void updateAllPartnerPassword(String clientMoniker) {
@ -4735,6 +4844,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
return null; return null;
} }
@Override @Override
@Transactional @Transactional
public boolean postponeClientRate(int clientId, String clientMoniker, String nextYearExipryDate) { public boolean postponeClientRate(int clientId, String clientMoniker, String nextYearExipryDate) {

@ -654,6 +654,16 @@ public class PartnerManageController {
return clientManager.queryAlipayOnlineGmsStatus(clientMoniker, manager); return clientManager.queryAlipayOnlineGmsStatus(clientMoniker, manager);
} }
@ManagerMapping(value = "/{clientMoniker}/query/alipay_gms_json", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public JSONObject queryAlipayGmsJson(@PathVariable String clientMoniker,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.queryAlipayGmsJson(clientMoniker, manager);
}
@ManagerMapping(value = "/{clientMoniker}/query/alipayOnline_gms_json", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public JSONObject queryAlipayOnlineGmsJson(@PathVariable String clientMoniker,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.queryAlipayOnlineGmsJson(clientMoniker, manager);
}
@ManagerMapping(value = "/{clientMoniker}/get_merchant_ids",method = RequestMethod.GET,role = {ManagerRole.OPERATOR,ManagerRole.ADMIN}) @ManagerMapping(value = "/{clientMoniker}/get_merchant_ids",method = RequestMethod.GET,role = {ManagerRole.OPERATOR,ManagerRole.ADMIN})
public List<JSONObject> getMerchantIds(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { public List<JSONObject> getMerchantIds(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.listMerchantIds(clientMoniker,manager); return clientManager.listMerchantIds(clientMoniker,manager);

@ -79,7 +79,7 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
JSONObject client = clientMapper.findClient(account.getIntValue("client_id")); JSONObject client = clientMapper.findClient(account.getIntValue("client_id"));
////父商户全局管理子商户时候,跳过 ////父商户全局管理子商户时候,跳过
JSONObject orderTargetClient = clientMapper.findClient(order.getIntValue("client_id")); JSONObject orderTargetClient = clientMapper.findClient(order.getIntValue("client_id"));
if (orderTargetClient.getIntValue("parent_client_id") != account.getIntValue("client_id")) { if (orderTargetClient.getIntValue("parent_client_id") != account.getIntValue("client_id") && !clientManager.listLevel3Client(account.getIntValue("client_id")).contains(orderTargetClient.getIntValue("parent_client_id"))) {
throw new ForbiddenException("Order is not belong to your shop/merchant"); throw new ForbiddenException("Order is not belong to your shop/merchant");
} else if (!client.getBooleanValue("sub_manage")) { } else if (!client.getBooleanValue("sub_manage")) {
throw new ForbiddenException("Order is not belong to your shop/merchant"); throw new ForbiddenException("Order is not belong to your shop/merchant");

@ -3,7 +3,8 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" > "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper"> <mapper namespace="au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper">
<select id="query" resultType="com.alibaba.fastjson.JSONObject"> <select id="query" resultType="com.alibaba.fastjson.JSONObject">
SELECT a.*,c.client_moniker client_moniker FROM sys_accounts a left join sys_clients c on c.client_id = a.client_id SELECT a.*,c.client_moniker client_moniker FROM sys_accounts a left join sys_clients c on c.client_id =
a.client_id
<where> <where>
<if test="clientId!=null"> <if test="clientId!=null">
and a.client_id = #{clientId} and a.client_id = #{clientId}
@ -22,6 +23,9 @@
sa.wx_unionid,sa.wechat_headimg,sa.payment_notice,sa.refund_authorised,sa.display_name sa.wx_unionid,sa.wechat_headimg,sa.payment_notice,sa.refund_authorised,sa.display_name
FROM sys_clients sc FROM sys_clients sc
INNER JOIN sys_accounts sa ON sc.client_id = sa.client_id AND sa.is_valid = 1 INNER JOIN sys_accounts sa ON sc.client_id = sa.client_id AND sa.is_valid = 1
WHERE sc.client_id = #{client_id} OR sc.parent_client_id = #{client_id} AND sc.is_valid = 1 WHERE sc.is_valid=1 AND
(sc.client_id IN (select client_id from sys_clients where client_id =#{client_id} or parent_client_id=#{client_id})
OR
sc.parent_client_id IN (select client_id from sys_clients where client_id =#{client_id} or parent_client_id=#{client_id}));
</select> </select>
</mapper> </mapper>

@ -20,6 +20,11 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts'], function (angul
var clientList = resp.data; var clientList = resp.data;
clientList.forEach(function (client) { clientList.forEach(function (client) {
$scope.clients.push(client); $scope.clients.push(client);
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.clients.push(level3Client);
});
}
}); });
$scope.clients.forEach(function (client) { $scope.clients.forEach(function (client) {
$scope.params.client_ids.push(client.client_id); $scope.params.client_ids.push(client.client_id);

@ -20,6 +20,11 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts'], function (angul
var clientList = resp.data; var clientList = resp.data;
clientList.forEach(function (client) { clientList.forEach(function (client) {
$scope.clients.push(client); $scope.clients.push(client);
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.clients.push(level3Client);
});
}
}); });
$scope.clients.forEach(function (client) { $scope.clients.forEach(function (client) {
$scope.params.client_ids.push(client.client_id); $scope.params.client_ids.push(client.client_id);

@ -59,6 +59,11 @@ define(['angular'], function (angular) {
var clientList = resp.data; var clientList = resp.data;
clientList.forEach(function (client) { clientList.forEach(function (client) {
$scope.clients.push(client); $scope.clients.push(client);
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.clients.push(level3Client);
});
}
}); });
$scope.clients.forEach(function (client) { $scope.clients.forEach(function (client) {
$scope.params.client_ids.push(client.client_id); $scope.params.client_ids.push(client.client_id);

@ -37,6 +37,7 @@ define(['../app', 'angular'], function (app, angular) {
title: cfg.title, title: cfg.title,
content: cfg.content, content: cfg.content,
contentHtml: cfg.contentHtml, contentHtml: cfg.contentHtml,
json:cfg.json,
backdrop: cfg.backdrop, backdrop: cfg.backdrop,
size: cfg.size, size: cfg.size,
choises: cfg.choises || choises choises: cfg.choises || choises
@ -121,6 +122,7 @@ define(['../app', 'angular'], function (app, angular) {
$scope.title = cfg.title; $scope.title = cfg.title;
$scope.content = cfg.content; $scope.content = cfg.content;
$scope.contentHtml = cfg.contentHtml; $scope.contentHtml = cfg.contentHtml;
$scope.jsonData = cfg.json;
$scope.bgClass = bgClasses[cfg.type]; $scope.bgClass = bgClasses[cfg.type];
$scope.glyIcon = glyIcons[cfg.type]; $scope.glyIcon = glyIcons[cfg.type];
$scope.choises = cfg.choises; $scope.choises = cfg.choises;

@ -1,5 +1,8 @@
<div class="modal-header" ng-class="bgClass"> <div class="modal-header" ng-class="bgClass">
<h4><i class="glyphicon" ng-class="glyIcon"></i> {{title}}</h4> <h4><i class="glyphicon" ng-class="glyIcon"></i> {{title}}</h4>
<a role="button" class="text-bold text-info pull-right" jsonview="jsonData" title="JSON View" ng-if="jsonData">
<i class="fa fa-code"></i>
</a>
</div> </div>
<div class="modal-body" ng-bind-html="contentHtml" ng-if="contentHtml"> <div class="modal-body" ng-bind-html="contentHtml" ng-if="contentHtml">
</div> </div>

@ -618,6 +618,11 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct
var clientList = resp.data; var clientList = resp.data;
clientList.forEach(function (client) { clientList.forEach(function (client) {
$scope.clients.push(client); $scope.clients.push(client);
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.clients.push(level3Client);
});
}
}); });
$scope.clients.forEach(function (client) { $scope.clients.forEach(function (client) {
$scope.params.client_ids.push(client.client_id); $scope.params.client_ids.push(client.client_id);

@ -22,6 +22,11 @@ define(['angular','decimal'], function (angular,decimal) {
var clientList = resp.data; var clientList = resp.data;
clientList.forEach(function (client) { clientList.forEach(function (client) {
$scope.clients.push(client); $scope.clients.push(client);
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.clients.push(level3Client);
});
}
}); });
}) })
}; };

@ -106,6 +106,13 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
$scope.loadSubPartners = function () { $scope.loadSubPartners = function () {
$http.get('/client/partner_info/sub_partners').then(function (resp) { $http.get('/client/partner_info/sub_partners').then(function (resp) {
$scope.subPartners = resp.data; $scope.subPartners = resp.data;
$scope.subPartners.forEach(function (client) {
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.subPartners.push(level3Client);
});
}
})
}) })
}; };
$scope.partner = partner.data; $scope.partner = partner.data;

@ -399,6 +399,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
} }
return arr; return arr;
} }
$scope.loadOfflineDesc = function () { $scope.loadOfflineDesc = function () {
$http.get('/static/data/client_offline_desc.json').then(function (resp) { $http.get('/static/data/client_offline_desc.json').then(function (resp) {
$scope.client_offline_select = resp.data; $scope.client_offline_select = resp.data;
@ -775,7 +776,11 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}; };
$scope.pass2GreenChannel = function () { $scope.pass2GreenChannel = function () {
if (!$scope.partner.wechat_institution_merchant_id) { if (!$scope.partner.wechat_institution_merchant_id) {
commonDialog.alert({title: 'info', content: 'Wechat Institution Merchant Id not Refresh', type: 'info'}); commonDialog.alert({
title: 'info',
content: 'Wechat Institution Merchant Id not Refresh',
type: 'info'
});
return; return;
} }
commonDialog.confirm({ commonDialog.confirm({
@ -1598,9 +1603,12 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}); });
}; };
$scope.submitAlipaySubId = function () { $scope.submitAlipaySubId = function () {
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipay_gms_json').then(function (resp) {
$scope.alipay_gms_json = resp.data;
commonDialog.confirm({ commonDialog.confirm({
title: 'Warning', title: 'Warning',
content: '是否使用该商户的现有信息进件?' content: '是否使用该商户的现有信息进件?',
json:$scope.alipay_gms_json
}).then(function () { }).then(function () {
if ($scope.partner.business_structure == "Company") { if ($scope.partner.business_structure == "Company") {
$http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipay_gms', {representative_id: ""}).then(function () { $http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipay_gms', {representative_id: ""}).then(function () {
@ -1618,6 +1626,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}); });
} }
}) })
})
}; };
$scope.queryAlipayGms = function () { $scope.queryAlipayGms = function () {
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipay_gms').then(function (resp) { $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipay_gms').then(function (resp) {
@ -1627,9 +1636,12 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}) })
} }
$scope.submitAlipayOnlineSubId = function () { $scope.submitAlipayOnlineSubId = function () {
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipayOnline_gms_json').then(function (resp) {
$scope.alipayOnline_gms_json = resp.data;
commonDialog.confirm({ commonDialog.confirm({
title: 'Warning', title: 'Warning',
content: '是否使用该商户的现有信息进件?' content: '是否使用该商户的现有信息进件?',
json:$scope.alipayOnline_gms_json
}).then(function () { }).then(function () {
commonDialog.inputText({title: '请输入商户身份证或护照号码'}).then(function (text) { commonDialog.inputText({title: '请输入商户身份证或护照号码'}).then(function (text) {
$http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipayOnline_gms', {representative_id: text}).then(function () { $http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipayOnline_gms', {representative_id: text}).then(function () {
@ -1640,6 +1652,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}); });
}) })
});
}; };
$scope.queryAlipayOnlineGms = function () { $scope.queryAlipayOnlineGms = function () {
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipayOnline_gms').then(function (resp) { $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipayOnline_gms').then(function (resp) {
@ -1660,7 +1673,19 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}) })
}) })
}; };
$scope.init = {jsapi: false, gateway: false, offline: false, refund: false,common_sub_merchant_id:false, channel: {},gateway_alipay_online:false,hf_Link:false,enable_hf_email_notice:false,enable_yeepay_link:false,enable_yeepay_email_notice:false}; $scope.init = {
jsapi: false,
gateway: false,
offline: false,
refund: false,
common_sub_merchant_id: false,
channel: {},
gateway_alipay_online: false,
hf_Link: false,
enable_hf_email_notice: false,
enable_yeepay_link: false,
enable_yeepay_email_notice: false
};
$scope.switchCommonSubMerchantId = function () { $scope.switchCommonSubMerchantId = function () {
if (!$scope.paymentInfo) { if (!$scope.paymentInfo) {
return; return;
@ -2093,6 +2118,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.logs = logs.data; $scope.logs = logs.data;
}]); }]);
app.controller('partnerSubCtrl', ['$scope', '$http', '$uibModal', function ($scope, $http, $uibModal) { app.controller('partnerSubCtrl', ['$scope', '$http', '$uibModal', function ($scope, $http, $uibModal) {
$scope.toShow = false;
$scope.newSubClient = function () { $scope.newSubClient = function () {
$uibModal.open({ $uibModal.open({
templateUrl: '/static/payment/partner/templates/add_sub_partner_dialog.html', templateUrl: '/static/payment/partner/templates/add_sub_partner_dialog.html',
@ -2142,11 +2168,24 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}) })
}; };
$scope.showClient = function (sub_client) {
if ($scope.sub_client_id == sub_client.client_id) {
return;
}
$scope.client_monikers = sub_client.level3Clients;
$scope.sub_client_id = sub_client.client_id;
};
}]); }]);
app.controller('partnerRatesCtrl', ['$scope', '$rootScope', '$http', '$uibModal', 'commonDialog', '$sce', function ($scope, $rootScope, $http, $uibModal, commonDialog, $sce) { app.controller('partnerRatesCtrl', ['$scope', '$rootScope', '$http', '$uibModal', 'commonDialog', '$sce', function ($scope, $rootScope, $http, $uibModal, commonDialog, $sce) {
$scope.bankCtrl = {edit: true, rate_name: 'Wechat'}; $scope.bankCtrl = {edit: true, rate_name: 'Wechat'};
$scope.init = {skip_clearing:false,tax_in_surcharge:false,customer_tax_free:false,allow_surcharge_credit:false}; $scope.init = {
skip_clearing: false,
tax_in_surcharge: false,
customer_tax_free: false,
allow_surcharge_credit: false
};
$scope.getBankAccount = function () { $scope.getBankAccount = function () {
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/bank_account').then(function (resp) { $http.get('/sys/partners/' + $scope.partner.client_moniker + '/bank_account').then(function (resp) {
$scope.bankaccount = resp.data; $scope.bankaccount = resp.data;
@ -2320,7 +2359,8 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
if (isNaN($scope.bankaccount.account_no)) { if (isNaN($scope.bankaccount.account_no)) {
alert("Account No应输入数字!"); alert("Account No应输入数字!");
return; return;
}; }
;
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/bank_account', $scope.bankaccount).then(function () { $http.put('/sys/partners/' + $scope.partner.client_moniker + '/bank_account', $scope.bankaccount).then(function () {
$scope.getBankAccount(); $scope.getBankAccount();
}, function (resp) { }, function (resp) {
@ -2412,7 +2452,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.params = {}; $scope.params = {};
} }
$scope.save = function () { $scope.save = function () {
$http.post('/sys/partners/' + $scope.partner.client_moniker + '/account/save', {amount:$scope.params.amount,remark:$scope.params.remark}).then(function (resp) { $http.post('/sys/partners/' + $scope.partner.client_moniker + '/account/save', {
amount: $scope.params.amount,
remark: $scope.params.remark
}).then(function (resp) {
$scope.getTransactions(); $scope.getTransactions();
$scope.getBalance(); $scope.getBalance();
$scope.canAddDetail = false; $scope.canAddDetail = false;
@ -2853,7 +2896,9 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.params = {status: 'PAID', channel: 'ALL', textType: 'all', datefrom: new Date(), dateto: new Date()}; $scope.params = {status: 'PAID', channel: 'ALL', textType: 'all', datefrom: new Date(), dateto: new Date()};
$scope.pagination = {}; $scope.pagination = {};
$scope.isAll = true; $scope.isAll = true;
$scope.isLevel3All = true;
$scope.clients = [$scope.partner]; $scope.clients = [$scope.partner];
$scope.showLevel3Clients = false;
$scope.today = new Date(); $scope.today = new Date();
$scope.chooseToday = function () { $scope.chooseToday = function () {
@ -2926,15 +2971,41 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.$on('order_refunded', function () { $scope.$on('order_refunded', function () {
$scope.loadTradeLogs(); $scope.loadTradeLogs();
}); });
$scope.chooseClient = function (clientId) { $scope.chooseClient = function (client) {
if (clientId == 'all') { if (client == 'all') {
$scope.params.client_ids = angular.copy($scope.clientIds); $scope.params.client_ids = angular.copy($scope.clientIds);
$scope.isAll = true; $scope.isAll = true;
$scope.chooseClientId = ''; $scope.chooseClientId = '';
$scope.showLevel3Clients = false;
} else if (client.level3Clients) {
$scope.chooseClientId = client.client_id;
$scope.showLevel3Clients = true;
$scope.level3Clients = client.level3Clients;
$scope.isAll = false;
$scope.level3ClientIds = [];
$scope.level3ClientIds.push(client.client_id);
client.level3Clients.forEach(function (client) {
$scope.level3ClientIds.push(client.client_id);
});
$scope.chooseLevel3Client("all");
return;
} else { } else {
$scope.chooseClientId = clientId; $scope.chooseClientId = client.client_id;
$scope.params.client_ids = [clientId]; $scope.params.client_ids = [client.client_id];
$scope.isAll = false; $scope.isAll = false;
$scope.showLevel3Clients = false;
}
$scope.loadTradeLogs();
};
$scope.chooseLevel3Client = function (client) {
if (client == 'all') {
$scope.params.client_ids = angular.copy($scope.level3ClientIds);
$scope.isLevel3All = true;
$scope.chooseLevel3ClientId = '';
} else {
$scope.chooseLevel3ClientId = client.client_id;
$scope.params.client_ids = [client.client_id];
$scope.isLevel3All = false;
} }
$scope.loadTradeLogs(); $scope.loadTradeLogs();
}; };
@ -2947,6 +3018,11 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.clientIds = []; $scope.clientIds = [];
$scope.clients.forEach(function (client) { $scope.clients.forEach(function (client) {
$scope.clientIds.push(client.client_id); $scope.clientIds.push(client.client_id);
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.clientIds.push(level3Client.client_id);
});
}
}); });
$scope.params.client_ids = angular.copy($scope.clientIds); $scope.params.client_ids = angular.copy($scope.clientIds);
//console.log($rootScope.currentUser.client.clientList); //console.log($rootScope.currentUser.client.clientList);
@ -3247,11 +3323,9 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
if ($scope.data.users.length == 0) { if ($scope.data.users.length == 0) {
$scope.errmsg = "请选择至少一位BD"; $scope.errmsg = "请选择至少一位BD";
} } else if ($scope.data.start_date == undefined) {
else if ($scope.data.start_date == undefined) {
$scope.errmsg = "执行开始日期不能为空"; $scope.errmsg = "执行开始日期不能为空";
} } else {
else {
var isValid = true; var isValid = true;
var total = 0; var total = 0;
$scope.data.users.forEach(function (e) { $scope.data.users.forEach(function (e) {
@ -4340,7 +4414,6 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
var merchantInfo = {}; var merchantInfo = {};
$scope.saveYeepayAdd = function (form) { $scope.saveYeepayAdd = function (form) {
$scope.errmsg = null; $scope.errmsg = null;
if (form.$invalid) { if (form.$invalid) {

@ -48,7 +48,12 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','uiBoot
}).state('sub_partners', { }).state('sub_partners', {
url: '/sub_partners', url: '/sub_partners',
templateUrl: '/static/payment/partner/templates/client_sub_partners.html', templateUrl: '/static/payment/partner/templates/client_sub_partners.html',
controller: 'clientSubPartnersCtrl' controller: 'clientSubPartnersCtrl',
resolve: {
partner: ['$http', function ($http) {
return $http.get('/client/partner_info');
}]
}
}).state('devices', { }).state('devices', {
url: '/devices', url: '/devices',
templateUrl: '/static/payment/partner/templates/client_devices.html', templateUrl: '/static/payment/partner/templates/client_devices.html',
@ -968,10 +973,18 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','uiBoot
}; };
$scope.getRates(); $scope.getRates();
}]); }]);
app.controller('clientSubPartnersCtrl', ['$scope', '$http', function ($scope, $http) { app.controller('clientSubPartnersCtrl', ['$scope', '$http','partner', function ($scope, $http,partner) {
$scope.partner = partner.data;
$scope.loadSubPartners = function () { $scope.loadSubPartners = function () {
$http.get('/client/partner_info/sub_partners').then(function (resp) { $http.get('/client/partner_info/sub_partners').then(function (resp) {
$scope.subPartners = resp.data; $scope.subPartners = resp.data;
$scope.subPartners.forEach(function (client) {
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.subPartners.push(level3Client);
});
}
})
}) })
}; };
$scope.loadSubPartners(); $scope.loadSubPartners();

@ -22,7 +22,11 @@
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="subPartner in subPartners"> <tr ng-repeat="subPartner in subPartners">
<td ng-bind="subPartner.client_moniker"></td> <td>
{{subPartner.client_moniker}}
<i class="fa fa-sitemap" ng-if="subPartner.parent_client_id != partner.client_id"
title="{{subPartner.parent_client_moniker}}"></i>
</td>
<td ng-bind="subPartner.short_name"></td> <td ng-bind="subPartner.short_name"></td>
<td ng-bind="subPartner.address"></td> <td ng-bind="subPartner.address"></td>
<td>{{subPartner.contact_person}}({{subPartner.contact_phone}})</td> <td>{{subPartner.contact_person}}({{subPartner.contact_phone}})</td>

@ -146,7 +146,20 @@
<a role="button" ng-class="{'bg-primary':isAll}" ng-click="chooseClient('all')">All</a> <a role="button" ng-class="{'bg-primary':isAll}" ng-click="chooseClient('all')">All</a>
<label ng-repeat="sub in clients"> <label ng-repeat="sub in clients">
|&nbsp;<a role="button" ng-class="{'bg-primary':sub.client_id==chooseClientId}" |&nbsp;<a role="button" ng-class="{'bg-primary':sub.client_id==chooseClientId}"
ng-click="chooseClient(sub.client_id)">{{sub.short_name}}</a>&nbsp; ng-click="chooseClient(sub)">{{sub.short_name}}</a>&nbsp;
</label>
</p>
</div>
</div>
<div class="form-group col-xs-12" ng-if="level3Clients && showLevel3Clients">
<label class="control-label col-xs-4 col-sm-2">Sub-Partner of sub-partners</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':isLevel3All}" ng-click="chooseLevel3Client('all')">All</a>
<label ng-repeat="sub in level3Clients">
|&nbsp;
<a role="button" ng-class="{'bg-primary':sub.client_id==chooseLevel3ClientId}" ng-click="chooseLevel3Client(sub)">{{sub.short_name}}</a>
&nbsp;
</label> </label>
</p> </p>
</div> </div>

@ -1,3 +1,54 @@
<style>
.cursor {
cursor: pointer;
}
.div-display {
display: none;
}
.i-rotate_90 {
animation: rotate_90 1s forwards;
-webkit-animation: rotate_90 1s forwards; /* Safari and Chrome */
}
@keyframes rotate_90 {
from {
transform: rotate(0deg);
}
to {
transform: rotate(90deg);
}
}
@-webkit-keyframes rotate_90 /* Safari and Chrome */
{
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(90deg);
}
}
.popover-color{
background-color: #f7f7f7;
border-bottom: 1px solid #ebebeb;
color: black;
}
.popover-content button{
display: inline-block;
}
.position_re{
position: relative;
}
.position_re .position_ab{
position: absolute;
top: 90%;
left: 90%;
}
</style>
<div class="panel panel-default" ng-if="'111'|withRole"> <div class="panel panel-default" ng-if="'111'|withRole">
<div class="panel-body pull-right" ng-if="('10'|withRole) && partner.parent_client_id==null"> <div class="panel-body pull-right" ng-if="('10'|withRole) && partner.parent_client_id==null">
@ -29,7 +80,35 @@
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="subPartner in subPartners"> <tr ng-repeat="subPartner in subPartners">
<td ng-bind="subPartner.client_moniker"></td> <td ng-click="showClient(subPartner); toShow = !toShow" style="cursor:pointer">
{{subPartner.client_moniker}}
&nbsp;
<span class="badge pull-right position_re" ng-if="subPartner.level3Clients">
{{subPartner.level3Clients.length}}
<div ng-if="sub_client_id==subPartner.client_id&&toShow"
class="popover fade in position_ab"
role="tooltip" style="display: block;">
<div class="arrow"></div>
<h3 class="popover-title popover-color">Sub Clients</h3>
<div class="popover-content" style="width: 250px">
<button type="button" class="btn btn-link"
ng-repeat="client_moniker in client_monikers"
ng-show="$index<client_monikers.length-1"
ui-sref="partners.detail({clientMoniker:client_moniker.client_moniker})">
{{client_moniker.client_moniker}}
<span class="text-black">,</span>&nbsp;
</button>
<button type="button" class="btn btn-link"
ng-repeat="client_moniker in client_monikers"
ng-if="$last"
ui-sref="partners.detail({clientMoniker:client_moniker.client_moniker})">
{{client_moniker.client_moniker}}
</button>
</div>
</div>
</span>
</td>
<td ng-bind="subPartner.short_name"></td> <td ng-bind="subPartner.short_name"></td>
<td ng-bind="subPartner.address"></td> <td ng-bind="subPartner.address"></td>
<td>{{subPartner.contact_person}}({{subPartner.contact_phone}})</td> <td>{{subPartner.contact_person}}({{subPartner.contact_phone}})</td>

@ -23,6 +23,9 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
'</div>'); '</div>');
$scope.isAll = true; $scope.isAll = true;
$scope.clients = [$scope.currentUser.client]; $scope.clients = [$scope.currentUser.client];
$scope.showLevel3Clients = false;
$scope.isLevel3All = true;
if ($scope.currentUser.client.has_children) { if ($scope.currentUser.client.has_children) {
$scope.params.client_ids = [$scope.currentUser.client.client_id]; $scope.params.client_ids = [$scope.currentUser.client.client_id];
$http.get('/client/partner_info/sub_partners').then(function (resp) { $http.get('/client/partner_info/sub_partners').then(function (resp) {
@ -33,6 +36,11 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.clientIds = []; $scope.clientIds = [];
$scope.clients.forEach(function (client) { $scope.clients.forEach(function (client) {
$scope.clientIds.push(client.client_id); $scope.clientIds.push(client.client_id);
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.clientIds.push(level3Client.client_id);
});
}
}); });
$scope.params.client_ids = angular.copy($scope.clientIds); $scope.params.client_ids = angular.copy($scope.clientIds);
$scope.loadSettlementLogs(1); $scope.loadSettlementLogs(1);
@ -125,15 +133,42 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
}; };
getClientUnClearedAmount(); getClientUnClearedAmount();
$scope.chooseClient = function (clientId) { $scope.chooseClient = function (client) {
if (clientId == 'all') { if (client == 'all') {
$scope.params.client_ids = angular.copy($scope.clientIds); $scope.params.client_ids = angular.copy($scope.clientIds);
$scope.isAll = true; $scope.isAll = true;
$scope.chooseClientId = ''; $scope.chooseClientId = '';
$scope.showLevel3Clients = false;
} else if (client.level3Clients) {
$scope.chooseClientId = client.client_id;
$scope.showLevel3Clients = true;
$scope.level3Clients = client.level3Clients;
$scope.isAll = false;
$scope.level3ClientIds = [];
$scope.level3ClientIds.push(client.client_id);
client.level3Clients.forEach(function (client) {
$scope.level3ClientIds.push(client.client_id);
});
$scope.chooseLevel3Client("all");
return;
} else { } else {
$scope.chooseClientId = clientId; $scope.chooseClientId = client.client_id;
$scope.params.client_ids = [clientId]; $scope.params.client_ids = [client.client_id];
$scope.isAll = false; $scope.isAll = false;
$scope.showLevel3Clients = false;
}
$scope.loadSettlementLogs();
};
$scope.chooseLevel3Client = function (client) {
if (client == 'all') {
$scope.params.client_ids = angular.copy($scope.level3ClientIds);
$scope.isLevel3All = true;
$scope.chooseLevel3ClientId = '';
} else {
$scope.chooseLevel3ClientId = client.client_id;
$scope.params.client_ids = [client.client_id];
$scope.isLevel3All = false;
} }
$scope.loadSettlementLogs(); $scope.loadSettlementLogs();
}; };

@ -170,7 +170,20 @@
<label ng-repeat="sub in clients"> <label ng-repeat="sub in clients">
|&nbsp;<a role="button" |&nbsp;<a role="button"
ng-class="{'bg-primary':sub.client_id==chooseClientId}" ng-class="{'bg-primary':sub.client_id==chooseClientId}"
ng-click="chooseClient(sub.client_id)">{{sub.short_name}}</a>&nbsp; ng-click="chooseClient(sub)">{{sub.short_name}}</a>&nbsp;
</label>
</p>
</div>
</div>
<div class="form-group col-xs-12" ng-if="level3Clients && showLevel3Clients">
<label class="control-label col-xs-4 col-sm-2">Sub-Partner of sub-partners</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':isLevel3All}" ng-click="chooseLevel3Client('all')">All</a>
<label ng-repeat="sub in level3Clients">
|&nbsp;
<a role="button" ng-class="{'bg-primary':sub.client_id==chooseLevel3ClientId}" ng-click="chooseLevel3Client(sub)">{{sub.short_name}}</a>
&nbsp;
</label> </label>
</p> </p>
</div> </div>

@ -80,7 +80,20 @@
<label ng-repeat="sub in clients"> <label ng-repeat="sub in clients">
|&nbsp;<a role="button" |&nbsp;<a role="button"
ng-class="{'bg-primary':sub.client_id==chooseClientId}" ng-class="{'bg-primary':sub.client_id==chooseClientId}"
ng-click="chooseClient(sub.client_id)">{{sub.short_name}}</a>&nbsp; ng-click="chooseClient(sub)">{{sub.short_name}}</a>&nbsp;
</label>
</p>
</div>
</div>
<div class="form-group col-xs-12" ng-if="level3Clients && showLevel3Clients">
<label class="control-label col-xs-4 col-sm-2">Sub-Partner of sub-partners</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':isLevel3All}" ng-click="chooseLevel3Client('all')">All</a>
<label ng-repeat="sub in level3Clients">
|&nbsp;
<a role="button" ng-class="{'bg-primary':sub.client_id==chooseLevel3ClientId}" ng-click="chooseLevel3Client(sub)">{{sub.short_name}}</a>
&nbsp;
</label> </label>
</p> </p>
</div> </div>

@ -1,4 +1,52 @@
<style> <style>
.cursor {
cursor: pointer;
}
.div-display {
display: none;
}
.i-rotate_90 {
animation: rotate_90 1s forwards;
-webkit-animation: rotate_90 1s forwards; /* Safari and Chrome */
}
@keyframes rotate_90 {
from {
transform: rotate(0deg);
}
to {
transform: rotate(90deg);
}
}
@-webkit-keyframes rotate_90 /* Safari and Chrome */
{
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(90deg);
}
}
.popover-color{
background-color: #f7f7f7;
border-bottom: 1px solid #ebebeb;
color: black;
}
.popover-content button{
display: inline-block;
}
.position_re{
position: relative;
}
.position_re .position_ab{
position: absolute;
top: 90%;
left: 90%;
}
.box-icon_small{ .box-icon_small{
width: 70px; width: 70px;
height: 70px; height: 70px;
@ -189,7 +237,22 @@
<p class="form-control-static"> <p class="form-control-static">
<a role="button" ng-class="{'bg-primary':isAll}" ng-click="chooseClient('all')">All</a> <a role="button" ng-class="{'bg-primary':isAll}" ng-click="chooseClient('all')">All</a>
<label ng-repeat="sub in clients"> <label ng-repeat="sub in clients">
|&nbsp;<a role="button" ng-class="{'bg-primary':sub.client_id==chooseClientId}" ng-click="chooseClient(sub.client_id)">{{sub.short_name}}</a>&nbsp; |&nbsp;
<a role="button" ng-class="{'bg-primary':sub.client_id==chooseClientId}" ng-click="chooseClient(sub)">{{sub.short_name}}</a>
&nbsp;
</label>
</p>
</div>
</div>
<div class="form-group col-xs-12" ng-if="level3Clients && showLevel3Clients">
<label class="control-label col-xs-4 col-sm-2">Sub-Partner of sub-partners</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':isLevel3All}" ng-click="chooseLevel3Client('all')">All</a>
<label ng-repeat="sub in level3Clients">
|&nbsp;
<a role="button" ng-class="{'bg-primary':sub.client_id==chooseLevel3ClientId}" ng-click="chooseLevel3Client(sub)">{{sub.short_name}}</a>
&nbsp;
</label> </label>
</p> </p>
</div> </div>

@ -18,9 +18,12 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.pagination = {}; $scope.pagination = {};
$scope.today = new Date(); $scope.today = new Date();
$scope.isAll = true; $scope.isAll = true;
$scope.isLevel3All = true;
$scope.device_isAll = true; $scope.device_isAll = true;
$scope.dev_params = {client_type:'sunmi',limit:100}; $scope.dev_params = {client_type:'sunmi',limit:100};
$scope.clients = [$scope.currentUser.client]; $scope.clients = [$scope.currentUser.client];
$scope.showLevel3Clients = false;
$scope.chooseToday = function () { $scope.chooseToday = function () {
$scope.params.datefrom = $scope.params.dateto = new Date(); $scope.params.datefrom = $scope.params.dateto = new Date();
@ -109,23 +112,54 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
}, 10000); }, 10000);
$scope.loadTradeLogs(); $scope.loadTradeLogs();
}); });
$scope.chooseClient = function (clientId) { $scope.chooseClient = function (client) {
if (clientId == 'all') { if (client == 'all') {
$scope.params.client_ids = angular.copy($scope.clientIds); $scope.params.client_ids = angular.copy($scope.clientIds);
$scope.isAll = true; $scope.isAll = true;
$scope.chooseClientId = ''; $scope.chooseClientId = '';
$scope.dev_params.client_ids = angular.copy($scope.clientIds); $scope.dev_params.client_ids = angular.copy($scope.clientIds);
$scope.showLevel3Clients = false;
$scope.listDevices(); $scope.listDevices();
} else if (client.level3Clients) {
$scope.chooseClientId = client.client_id;
$scope.showLevel3Clients = true;
$scope.level3Clients = client.level3Clients;
$scope.isAll = false;
$scope.level3ClientIds = [];
$scope.level3ClientIds.push(client.client_id);
client.level3Clients.forEach(function (client) {
$scope.level3ClientIds.push(client.client_id);
});
$scope.chooseLevel3Client("all");
return;
} else { } else {
$scope.chooseClientId = clientId; $scope.chooseClientId = client.client_id;
$scope.params.client_ids = [clientId]; $scope.params.client_ids = [client.client_id];
$scope.isAll = false; $scope.isAll = false;
$scope.dev_params.client_ids = [clientId]; $scope.dev_params.client_ids = [client.client_id];
$scope.showLevel3Clients = false;
$scope.listDevices(); $scope.listDevices();
}
$scope.loadTradeLogs();
};
$scope.chooseLevel3Client = function (client) {
if (client == 'all') {
$scope.params.client_ids = angular.copy($scope.level3ClientIds);
$scope.isLevel3All = true;
$scope.chooseLevel3ClientId = '';
$scope.dev_params.client_ids = angular.copy($scope.level3ClientIds);
$scope.listDevices();
} else {
$scope.chooseLevel3ClientId = client.client_id;
$scope.params.client_ids = [client.client_id];
$scope.isLevel3All = false;
$scope.dev_params.client_ids = [client.client_id];
$scope.listDevices();
} }
$scope.loadTradeLogs(); $scope.loadTradeLogs();
}; };
$scope.listDevices = function () { $scope.listDevices = function () {
var params = angular.copy($scope.dev_params) var params = angular.copy($scope.dev_params)
$http.get('/client/partner_info/devices', {params: params}).then(function (resp) { $http.get('/client/partner_info/devices', {params: params}).then(function (resp) {
@ -156,6 +190,11 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.clientIds = []; $scope.clientIds = [];
$scope.clients.forEach(function (client) { $scope.clients.forEach(function (client) {
$scope.clientIds.push(client.client_id); $scope.clientIds.push(client.client_id);
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.clientIds.push(level3Client.client_id);
});
}
}); });
$scope.params.client_ids = angular.copy($scope.clientIds); $scope.params.client_ids = angular.copy($scope.clientIds);

@ -23,6 +23,8 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.isAll = true; $scope.isAll = true;
$scope.clients = [$scope.currentUser.client]; $scope.clients = [$scope.currentUser.client];
$scope.params.client_ids = [$scope.currentUser.client.client_id]; $scope.params.client_ids = [$scope.currentUser.client.client_id];
$scope.showLevel3Clients = false;
if ($scope.currentUser.client.has_children) { if ($scope.currentUser.client.has_children) {
$http.get('/client/partner_info/sub_partners').then(function (resp) { $http.get('/client/partner_info/sub_partners').then(function (resp) {
var clientList = resp.data; var clientList = resp.data;
@ -32,6 +34,11 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.clientIds = []; $scope.clientIds = [];
$scope.clients.forEach(function (client) { $scope.clients.forEach(function (client) {
$scope.clientIds.push(client.client_id); $scope.clientIds.push(client.client_id);
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.clientIds.push(level3Client.client_id);
});
}
}); });
$scope.params.client_ids = angular.copy($scope.clientIds); $scope.params.client_ids = angular.copy($scope.clientIds);
}) })
@ -108,19 +115,52 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
}); });
}; };
$scope.chooseLast7Days(); $scope.chooseLast7Days();
$scope.chooseClient = function (clientId) { $scope.chooseClient = function (client) {
if (clientId == 'all') { if (client == 'all') {
$scope.params.client_ids = angular.copy($scope.clientIds); $scope.params.client_ids = angular.copy($scope.clientIds);
$scope.isAll = true; $scope.isAll = true;
$scope.chooseClientId = ''; $scope.chooseClientId = '';
$scope.dev_params.client_ids = angular.copy($scope.clientIds);
$scope.showLevel3Clients = false;
$scope.listDevices();
} else if (client.level3Clients) {
$scope.chooseClientId = client.client_id;
$scope.showLevel3Clients = true;
$scope.level3Clients = client.level3Clients;
$scope.isAll = false;
$scope.level3ClientIds = [];
$scope.level3ClientIds.push(client.client_id);
client.level3Clients.forEach(function (client) {
$scope.level3ClientIds.push(client.client_id);
});
$scope.chooseLevel3Client("all");
return;
} else { } else {
$scope.chooseClientId = clientId; $scope.chooseClientId = client.client_id;
$scope.params.client_ids = [clientId]; $scope.params.client_ids = [client.client_id];
$scope.isAll = false; $scope.isAll = false;
$scope.dev_params.client_ids = [client.client_id];
$scope.showLevel3Clients = false;
$scope.listDevices();
}
$scope.loadTradeLogs();
};
$scope.chooseLevel3Client = function (client) {
if (client == 'all') {
$scope.params.client_ids = angular.copy($scope.level3ClientIds);
$scope.isLevel3All = true;
$scope.chooseLevel3ClientId = '';
$scope.dev_params.client_ids = angular.copy($scope.level3ClientIds);
$scope.listDevices();
} else {
$scope.chooseLevel3ClientId = client.client_id;
$scope.params.client_ids = [client.client_id];
$scope.isLevel3All = false;
$scope.dev_params.client_ids = [client.client_id];
$scope.listDevices();
} }
$scope.loadTradeLogs(); $scope.loadTradeLogs();
}; };
$scope.export = function (type,page) { $scope.export = function (type,page) {
var url='/client/trans_flow/report/pdf'; var url='/client/trans_flow/report/pdf';
if (type=='pdf'){ if (type=='pdf'){

Loading…
Cancel
Save