分渠道清算 配置

master
dalong306 3 years ago
parent a3e5a4beb7
commit cc960e5103

@ -5,11 +5,11 @@
<parent>
<groupId>au.com.royalpay.payment</groupId>
<artifactId>payment-parent</artifactId>
<version>2.3.7</version>
<version>2.3.8</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId>
<version>2.4.12</version>
<version>2.4.13</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>2.4.0</jib-maven-plugin.version>
@ -242,7 +242,11 @@
<artifactId>commons-codec</artifactId>
<version>1.12</version>
</dependency>
<dependency>
<groupId>com.cronutils</groupId>
<artifactId>cron-utils</artifactId>
<version>9.1.6</version>
</dependency>
</dependencies>
<build>
<plugins>

@ -781,3 +781,10 @@ ALTER TABLE `sys_clients`
-- 微信子商户表 字段长度修改 2021.04.07
ALTER TABLE sys_wx_merchant_apply MODIFY merchant_name varchar(128);
ALTER TABLE sys_wx_merchant_apply MODIFY merchant_shortname varchar(64);
-- 添加清算规则 2022-03-21
ALTER TABLE sys_clients add `settle_rule` varchar(20) DEFAULT '* * ?' COMMENT '清算时间规则' AFTER min_settle;
ALTER TABLE sys_clients add `settle_rule_ext` text COMMENT '清算规则扩展,分组清算规则' AFTER settle_rule;
-- 表 sys_permission_functions 字段class_name长度改为255 2022-03-21

@ -0,0 +1,118 @@
package au.com.royalpay.payment.manage.merchants.beans;
import au.com.royalpay.payment.core.exceptions.ParamInvalidException;
import au.com.royalpay.payment.tools.merchants.beans.BalanceGroup;
import com.alibaba.fastjson.annotation.JSONField;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.math.BigDecimal;
/**
* Create by yixian at 2018-01-07 22:25
*/
public class SettleDetail {
private Integer hour;
@JSONField(name = "rule_type")
@Pattern(regexp = "^(DAY_OF_MONTH)|(DAY_OF_WEEK)$", message = "Invalid Rule Type")
@NotNull(message = "error.payment.valid.param_missing")
private String rule_type;
private String rule;
private boolean manual;
private boolean everyday;
private BigDecimal min = BigDecimal.ZERO;
private int max_settle_days;
private String group= BalanceGroup.RPAY_SVC_CARD.toString();
public String ruleToCron() {
if (everyday) {
return "* * ?";
}
if (!manual && rule_type == null) {
throw new ParamInvalidException("rule_type", "error.payment.valid.param_missing");
}
if (rule_type != null) {
switch (rule_type) {
case "DAY_OF_MONTH":
return rule + " * ?";
case "DAY_OF_WEEK":
return "? * " + rule;
default:
throw new ParamInvalidException("rule_type", "Invalid Rule Type");
}
}
return null;
}
public Integer getHour() {
return hour;
}
public SettleDetail setHour(Integer hour) {
this.hour = hour;
return this;
}
public String getRule_type() {
return rule_type;
}
public SettleDetail setRule_type(String rule_type) {
this.rule_type = rule_type;
return this;
}
public String getRule() {
return rule;
}
public SettleDetail setRule(String rule) {
this.rule = rule;
return this;
}
public BigDecimal getMin() {
return min;
}
public SettleDetail setMin(BigDecimal min) {
this.min = min;
return this;
}
public boolean isManual() {
return manual;
}
public SettleDetail setManual(boolean manual) {
this.manual = manual;
return this;
}
public boolean isEveryday() {
return everyday;
}
public SettleDetail setEveryday(boolean everyday) {
this.everyday = everyday;
return this;
}
public int getMax_settle_days() {
return max_settle_days;
}
public void setMax_settle_days(int max_settle_days) {
this.max_settle_days = max_settle_days;
}
public String getGroup() {
return group;
}
public void setGroup(String group) {
this.group = group;
}
}

@ -619,4 +619,9 @@ public interface ClientManager {
JSONObject getApsKycClient(JSONObject account, String clientMoniker);
void updateApsKycClient(JSONObject account, JSONObject item);
JSONObject getSettleConfig(String clientMoniker, JSONObject manager);
void configSettleDetail(JSONObject manager, String clientMoniker, SettleDetail settleDetail);
}

@ -0,0 +1,134 @@
package au.com.royalpay.payment.manage.merchants.core.impls;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.merchants.beans.SettleDetail;
import au.com.royalpay.payment.manage.merchants.core.ClientInfoCacheSupport;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.utils.CurrencyAmountUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cronutils.model.Cron;
import com.cronutils.model.CronType;
import com.cronutils.model.definition.CronDefinition;
import com.cronutils.model.definition.CronDefinitionBuilder;
import com.cronutils.model.field.CronFieldName;
import com.cronutils.parser.CronParser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
/**
*
*/
@Component
public class ClientChannelSettlement {
private final Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private ClientManager clientManager;
@Resource
private ClientMapper clientMapper;
// @Autowired
// private ClientManagerApplication application;
@Resource
private ClientInfoCacheSupport clientInfoCacheSupport;
public JSONObject getClientChannelSettleConfig(String clientMoniker, JSONObject manager, String group) {
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
JSONObject card = this.getGroup(client, group);
if (card == null) {
return null;
}
String settleRule = card.getString("date_rule");
String minSettle = card.getString("min_settle");
JSONObject config = new JSONObject();
config.put("max_settle_days", card.getInteger("max_settle_days"));
config.put("min", new BigDecimal(minSettle).toPlainString());
if ("* * ?".equals(settleRule)) {
config.put("everyday", true);
} else {
config.put("everyday", false);
CronDefinition cronDefinition =
CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ);
CronParser parser = new CronParser(cronDefinition);
Cron cron = parser.parse("0 0 0 " + settleRule);
if (settleRule.startsWith("? * ")) {
String dayOfWeek = cron.retrieve(CronFieldName.DAY_OF_WEEK).getExpression().asString();
logger.info("DAY_OF_WEEK CRON => " + dayOfWeek);
config.put("rule_type", "DAY_OF_WEEK");
config.put("days", dayOfWeek.split(","));
}
if (settleRule.endsWith(" * ?")) {
String dayOfMon = cron.retrieve(CronFieldName.DAY_OF_MONTH).getExpression().asString();
logger.info("DAY_OF_WEEK CRON => " + dayOfMon);
config.put("rule_type", "DAY_OF_MONTH");
config.put("days", dayOfMon.split(","));
}
}
logger.info("=====>getClientChannelSettleConfig:{}",config.toJSONString());
return config;
}
public void configClientChannelSettleDetails(JSONObject manager, String clientMoniker, SettleDetail detail) {
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
JSONArray ruleExt = client.getJSONArray("settle_rule_ext");
if (ruleExt == null) {
ruleExt = new JSONArray();
JSONObject object = new JSONObject();
this.setSettleRuleExt(detail, object);
ruleExt.add(object);
} else {
JSONObject card = this.getGroup(client, detail.getGroup());
if (card == null) {
JSONObject object = new JSONObject();
this.setSettleRuleExt(detail, object);
ruleExt.add(object);
} else {
ruleExt.remove(card);
this.setSettleRuleExt(detail, card);
ruleExt.add(card);
}
}
JSONObject update = new JSONObject();
update.put("client_id", client.getIntValue("client_id"));
logger.info("SETTLE RULE EXT => " + ruleExt.toString());
update.put("settle_rule_ext", ruleExt.toString());
clientMapper.update(update);
clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id"));
}
private void setSettleRuleExt(SettleDetail detail, JSONObject object) {
object.put("date_rule", detail.ruleToCron());
object.put("min_settle", CurrencyAmountUtils.scale(detail.getMin(), PlatformEnvironment.getEnv().getForeignCurrency()));
object.put("group", detail.getGroup());
// object.put("max_settle_days", detail.getMax_settle_days()); //max_settle_days 在rp中去掉
}
private JSONObject getGroup(JSONObject client, String group) {
JSONArray ruleExt = client.getJSONArray("settle_rule_ext");
if (ruleExt == null) {
return null;
}
for (Object o : ruleExt) {
JSONObject item = (JSONObject) o;
if (group.equalsIgnoreCase(item.getString("group"))) {
return item;
}
}
return null;
}
}

@ -177,7 +177,12 @@ import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import com.cronutils.model.Cron;
import com.cronutils.model.CronType;
import com.cronutils.model.definition.CronDefinition;
import com.cronutils.model.definition.CronDefinitionBuilder;
import com.cronutils.model.field.CronFieldName;
import com.cronutils.parser.CronParser;
import static au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils.checkOrgPermission;
/**
@ -7496,5 +7501,99 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
representativeInfo.put("marketing_wechatid", partner.getString("marketing_wechatid"));
sysClientLegalPersonMapper.save(representativeInfo);
}
@Override
public JSONObject getSettleConfig(String clientMoniker, JSONObject manager) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
return getSettleConfigIgnoreValid(client, manager);
}
/**
*
*
* @param client
* @param manager
* @return
*/
private JSONObject getSettleConfigIgnoreValid(JSONObject client, JSONObject manager) {
OrgCheckUtils.checkOrgPermission(manager, client);
JSONObject clientConfig = clientConfigService.find(client.getIntValue("client_id"));
JSONObject config = new JSONObject();
config.put("enable_cross_payment",clientConfig.getBoolean("enable_cross_payment"));
config.put("enable_card_payment",clientConfig.getBoolean("enable_card_payment"));
config.put("manual", client.getBooleanValue("manual_settle") );
config.put("min", client.getBigDecimal("min_settle"));
config.put("settle_hour", client.getInteger("settle_hour"));
if (clientConfig == null) {
clientConfig = new JSONObject();
clientConfig.put("client_id", client.getIntValue("client_id"));
clientConfig.put("terminal_charge_rule", "1 * ?");
clientConfig.put("terminal_charge_skip", 1);
clientConfig.put("free_charge_amount", 0);
clientConfig.put("terminal_per_amount", 0);
clientConfig.put("creation_date", new Date());
clientConfig.put("creation_by", "System");
clientConfig.put("last_update_date", new Date());
clientConfig.put("enable_org_rate_value", 0);
clientConfig.put("ladder_charge", 0);
clientConfig.put("max_settle_days", 0);
clientConfigService.save(clientConfig);
}
// config.put("max_settle_days", clientConfig.getInteger("max_settle_days"));
String settleRule = client.getString("settle_rule");
if ("* * ?".equals(settleRule)) {
config.put("everyday", true);
} else {
config.put("everyday", false);
CronDefinition cronDefinition =
CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ);
CronParser parser = new CronParser(cronDefinition);
Cron cron = parser.parse("0 0 0 " + settleRule);
if (settleRule.startsWith("? * ")) {
String dayOfWeek = cron.retrieve(CronFieldName.DAY_OF_WEEK).getExpression().asString();
// logger.info("DAY_OF_WEEK CRON => " + dayOfWeek);
config.put("rule_type", "DAY_OF_WEEK");
config.put("days", dayOfWeek.split(","));
}
if (settleRule.endsWith(" * ?")) {
String dayOfMon = cron.retrieve(CronFieldName.DAY_OF_MONTH).getExpression().asString();
// logger.info("DAY_OF_WEEK CRON => " + dayOfMon);
config.put("rule_type", "DAY_OF_MONTH");
config.put("days", dayOfMon.split(","));
}
}
logger.info("=====>config:"+config.toJSONString());
return config;
}
@Override
public void configSettleDetail(JSONObject manager, String clientMoniker, SettleDetail detail) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
OrgCheckUtils.checkOrgPermission(manager, client);
logger.info(manager.getString("username") + " changed settle hour to " + detail.getHour());
JSONObject update = new JSONObject();
update.put("client_id", client.getIntValue("client_id"));
update.put("settle_hour", detail.getHour());
update.put("settle_rule", detail.ruleToCron());
// if (detail.isManual()) {
// update.put("allow_settle", 1);
// update.put("skip_clearing", 1);
// }
update.put("min_settle", CurrencyAmountUtils.scale(detail.getMin(), PlatformEnvironment.getEnv().getForeignCurrency()));
clientMapper.update(update);
logger.info("=====>update:{}",update.toJSONString());
// JSONObject clientConfig = clientConfigService.find(client.getIntValue("client_id"));
// clientConfig.put("max_settle_days", detail.getMax_settle_days());
// clientConfigService.update(clientConfig);
clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id"));
}
}

@ -0,0 +1,48 @@
package au.com.royalpay.payment.manage.merchants.web;
import au.com.royalpay.payment.manage.merchants.beans.SettleDetail;
import au.com.royalpay.payment.manage.merchants.core.impls.ClientChannelSettlement;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
*
*/
@RestController
@RequestMapping("/sys/partners/{clientMoniker}/channel_settle_config")
public class PartnerChannelSettlementController {
@Autowired
private ClientChannelSettlement channelSettlement;
/**
*
*
* @param clientMoniker
* @param manager
* @return
*/
@ManagerMapping(method = RequestMethod.GET)
public JSONObject getClientChannelSettleConfig(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @RequestParam(value = "group") String group) {
return channelSettlement.getClientChannelSettleConfig(clientMoniker, manager, group);
}
/**
*
*
* @param clientMoniker
* @param settleDetail
* @param manager
*/
@ManagerMapping(method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.FINANCIAL_STAFF})
public void configClientChannelSettleDetails(@PathVariable String clientMoniker, @RequestBody SettleDetail settleDetail, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
channelSettlement.configClientChannelSettleDetails(manager, clientMoniker, settleDetail);
}
}

@ -1095,4 +1095,29 @@ public class PartnerManageController {
result.put("response_str", clientManager.queryAlipayPlusOnlineStatus(true,clientMoniker, manager));
return result;
}
/**
*
*
* @param clientMoniker
* @param manager
* @return
*/
@ManagerMapping(value = "/{clientMoniker}/settle_config", method = RequestMethod.GET)
public JSONObject getClientSettleConfig(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.getSettleConfig(clientMoniker, manager);
}
/**
*
*
* @param clientMoniker
* @param settleDetail
* @param manager
*/
// @PartnerChangesLog(description = "配置解决细节")
@ManagerMapping(value = "/{clientMoniker}/settle_config", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.FINANCIAL_STAFF})
public void configSettleDetails(@PathVariable String clientMoniker, @RequestBody SettleDetail settleDetail, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.configSettleDetail(manager, clientMoniker, settleDetail);
}
}

@ -874,3 +874,49 @@
.menu-group .is-hide {
display: none;
}
.date-box {
display: block;
margin: -5px;
}
.date-box:after {
content: '';
display: block;
clear: both;
}
.date-box > .day {
position: relative;
float: left;
display: block;
width: 40px;
height: 40px;
margin: 5px;
text-align: center;
font-size: 26px;
line-height: 40px;
}
.date-box > .day > .del-btn {
position: absolute;
opacity: 0;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, .4);
color: #fff;
font-size: 26px;
line-height: 40px;
-webkit-transition: opacity 0.5s;
-moz-transition: opacity 0.5s;
-ms-transition: opacity 0.5s;
-o-transition: opacity 0.5s;
transition: opacity 0.5s;
}
.date-box > .day:hover > .del-btn{
opacity: 1;
}

@ -3161,18 +3161,227 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.bankCtrl = {edit: true, rate_name: 'Wechat', modify_min_settle: false}
$scope.cardBankCtrl = {edit: true, rate_name: 'rpaypmt_card', modify_min_settle: false}
$scope.apsBankCtrl = {edit: true, rate_name: 'ApsInStore', modify_min_settle: false}
$scope.settle_rule_form = {edit: false}
$scope.init = {
skip_clearing: false,
tax_in_surcharge: false,
customer_tax_free: false,
allow_surcharge_credit: false,
}
$scope.loadSettleRule = function () {
$http.get("/sys/partners/" + $scope.partner.client_moniker + "/settle_config").then(function (resp) {
$scope.settleRule = resp.data
})
}
$scope.loadSettleRule()
$scope.getBankAccount = function () {
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/bank_account').then(function (resp) {
$scope.bankaccount = resp.data
$scope.bankCtrl.edit = false
})
}
$scope.toggleSettleRuleDay = function (day) {
var $idx = $scope.settleRule.days.indexOf(day)
if ($idx >= 0) {
$scope.settleRule.days.splice($idx, 1)
} else {
$scope.settleRule.days.push(day)
$scope.settleRule.days.sort()
}
}
$scope.settleAddDay = function () {
$uibModal
.open({
templateUrl: "/static/payment/partner/templates/dialog_settle_day_select.html",
size: "lg",
controller: [
"$scope",
"chosenDays",
function ($scope, chosenDays) {
$scope.chosenDays = chosenDays
$scope.formData = {}
$scope.availableDays = []
for (var d = 1; d <= 31; d++) {
$scope.availableDays.push(d)
}
$scope.choose = function () {
$scope.$close($scope.formData.chosenDay)
}
},
],
resolve: {
chosenDays: function () {
return $scope.settleRule.days
},
},
})
.result.then(function (day) {
$scope.toggleSettleRuleDay(day)
})
}
$scope.submitSettleRule = function () {
var config = angular.copy($scope.settleRule)
config.rule = !config.manual && !config.everyday ? config.days.join(",") : null
if (!config.manual && !config.everyday) {
if (config.days.length == 0) {
commonDialog.alert({
title: "Error",
content: "请选择结算日",
type: "error",
})
return
}
}
$http.put("/sys/partners/" + $scope.partner.client_moniker + "/settle_config", config).then(
function (resp) {
commonDialog.alert({
title: "Success",
content: "Rule Updated",
type: "success",
})
$state.reload()
},
function (resp) {
commonDialog.alert({
title: "Error",
content: resp.data.message,
type: "error",
})
$state.reload()
}
)
}
$scope.cancelSettleRule = function () {
$scope.loadSettleRule()
$scope.settle_rule_form.edit = false
}
// 卡支付结算规则配置
$scope.statusCtrl = {
isShowSwitchButton: true, // switch
isCanEdit: true, // 控制是否可编辑
isShowSettings: true, // 是否显示配置
}
// 加载按钮
$scope.loadSwitchButton = function () {
$("input[name='switch']").bootstrapSwitch({
onText: "ON",
offText: "OFF",
size: "mini",
state: $scope.statusCtrl.isShowSettings,
onSwitchChange: function (event, state) {
//监听switch change事件可以根据状态把相应的业务逻辑代码写在这里
$scope.statusCtrl.isShowSettings = state
$scope.statusCtrl.isCanEdit = state
$scope.$applyAsync()
},
})
}
// 初始化数据
$scope.loadCardSettings = function () {
$http.get("/sys/partners/" + $scope.partner.client_moniker + "/channel_settle_config?group=RPAY_SVC_CARD").then(function (resp) {
if (resp.data) {
$scope.cardSettings = resp.data
$scope.statusCtrl.isShowSwitchButton = false
$scope.statusCtrl.isCanEdit = false
} else {
$scope.statusCtrl.isShowSettings = false
$scope.loadSwitchButton()
$scope.cardSettings = {
max_settle_days: null,
min: 0,
rule_type: "DAY_OF_WEEK",
days: [],
manual: false,
settle_hour: null,
everyday: false,
}
}
})
}
$scope.loadCardSettings()
// 选择日期
$scope.toggleCardSettingsDay = function (day) {
var $idx = $scope.cardSettings.days.indexOf(day)
if ($idx >= 0) {
$scope.cardSettings.days.splice($idx, 1)
} else {
$scope.cardSettings.days.push(day)
$scope.cardSettings.days.sort()
}
}
// 选择月结算日
$scope.setMonthSomeday = function () {
$uibModal
.open({
templateUrl: "/static/payment/partner/templates/dialog_settle_day_select.html",
size: "lg",
controller: [
"$scope",
"chosenDays",
function ($scope, chosenDays) {
$scope.chosenDays = chosenDays
$scope.formData = {}
$scope.availableDays = []
for (var d = 1; d <= 31; d++) {
$scope.availableDays.push(d)
}
$scope.choose = function () {
$scope.$close($scope.formData.chosenDay)
}
},
],
resolve: {
chosenDays: function () {
return $scope.cardSettings.days
},
},
})
.result.then(function (day) {
$scope.toggleCardSettingsDay(day)
})
}
// 保存设置
$scope.submitCardSettings = function () {
var config = angular.copy($scope.cardSettings)
config.group = "RPAY_SVC_CARD"
config.rule = !config.manual && !config.everyday ? config.days.join(",") : null
if (!config.manual && !config.everyday) {
if (config.days.length == 0) {
commonDialog.alert({
title: "Error",
content: "请选择结算日",
type: "error",
})
return
}
}
$http.put("/sys/partners/" + $scope.partner.client_moniker + "/channel_settle_config", config).then(
function (resp) {
commonDialog.alert({
title: "Success",
content: "Rule Updated",
type: "success",
})
$scope.loadCardSettings()
},
function (resp) {
commonDialog.alert({
title: "Error",
content: resp.data.message,
type: "error",
})
}
)
}
// 取消
$scope.cancelCardSettings = function () {
if ($scope.statusCtrl.isShowSwitchButton) {
$("#switch").bootstrapSwitch("toggleState")
}
$scope.statusCtrl.isCanEdit = false
$scope.loadCardSettings()
}
$scope.switchSurchargeMode = function () {
if ($scope.partner.surcharge_mode === 'balance') {
commonDialog

@ -0,0 +1,14 @@
<div class="modal-header">
<h4>Choose Settle Day</h4>
</div>
<div class="modal-body">
<div class="alert alert-warning" ng-if="formData.chosenDay>28">Settle may not execute when the month do not have this day</div>
<div class="date-box">
<button class="day btn btn-default" style="padding: 0" ng-repeat="day in availableDays" ng-disabled="chosenDays.indexOf(day)>=0"
ng-click="formData.chosenDay = day" ng-class="{'active':formData.chosenDay == day}" ng-bind="day"></button>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-danger" ng-click="$dismiss()">Cancel</button>
<button class="btn btn-success" ng-disabled="!formData.chosenDay" ng-click="choose()">Choose</button>
</div>

@ -3,35 +3,49 @@
width: 95%;
float: left;
}
.panel-heading-new {
background-image: -webkit-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
background-image: -o-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#c4e3f3));
background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);
background-repeat: repeat-x;
color: #31708f;
background-color: #d9edf7;
border-color: #bce8f1;
padding: 10px 15px;
border-bottom: 1px solid transparent;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
</style>
<div class="row">
<div class="col-sm-12">
<h3>Bank Account
<a class="small" role="button" ng-click="bankCtrl.edit=true"
ng-if="!bankCtrl.edit && (('11'|withRole)||((!partner.approve_result||partner.approve_result>4) && ('111'|withRole)))">
<i class="fa fa-edit"></i>
</a>
</h3>
<div class="panel panel-info">
<div class="panel-heading" >
<h4>
Settle Rule Config
</h4>
</div>
<div class="form-horizontal">
<div class="form-group" ng-if="partner.surcharge_mode=='distributed'">
<label class="col-sm-4">手续费账户余额</label>
<div class="col-sm-6" style="font-size: 25px">
<label class="control-label col-sm-2">手续费账户余额</label>
<div class="col-sm-10" style="font-size: 25px">
<p>{{surcharge.balance | currency:'AUD'}}<i class="fa fa-bars"
style="font-size: 15px;color: #3c8dbc;cursor: pointer;padding-left: 15px"
ng-click="surchargeAccountDetail()"></i></p>
</div>
</div>
<div class="form-group" ng-if="partner.surcharge_mode=='distributed'">
<label class="col-sm-4">允许手续费账户欠款</label>
<div class="col-sm-6">
<label class="control-label col-sm-2">允许手续费账户欠款</label>
<div class="col-sm-10">
<input type="checkbox" ng-model="partner.allow_surcharge_credit" bs-switch
switch-change="allowSurchargeCredit(partner.allow_surcharge_credit)">
</div>
</div>
<div class="form-group">
<label class="col-sm-4">Surcharge Mode</label>
<div class="col-sm-6">
<label class="control-label col-sm-2">Surcharge Mode</label>
<div class="col-sm-10">
<p>
<span ng-if="partner.surcharge_mode=='balance'">balance
<i class="fa fa-sort" style="color: #3c8dbc;cursor: pointer"
@ -49,36 +63,36 @@
</div>
<div class="form-group" ng-if="'modify_tax_in_surcharge'|withFunc">
<label class="col-sm-4">RoyalPay Pay GST</label>
<div class="col-sm-6">
<label class="control-label col-sm-2">RoyalPay Pay GST</label>
<div class="col-sm-10">
<input type="checkbox" ng-model="partner.tax_in_surcharge" bs-switch
switch-change="taxInSurcharge(partner.tax_in_surcharge)">
</div>
</div>
<div class="form-group" ng-if="('10'|withRole)">
<label class="col-sm-4">Merchant Pay GST &ensp;<small><em>(消费者承担手续费时生效)</em></small></label>
<div class="col-sm-6">
<label class="control-label col-sm-2">Merchant Pay GST &ensp;<small><em>(消费者承担手续费时生效)</em></small></label>
<div class="col-sm-10">
<input type="checkbox" ng-model="partner.customer_tax_free" bs-switch
switch-change="customerTaxFree(partner.customer_tax_free)">
</div>
</div>
<div class="form-group" ng-if="'modify_skip_clear'|withFunc">
<label class="col-sm-4">Skip Clearing</label>
<div class="col-sm-6">
<label class="control-label col-sm-2">Skip Clearing</label>
<div class="col-sm-10">
<input type="checkbox" ng-model="partner.skip_clearing" bs-switch
switch-change="skipClearing(partner.skip_clearing)">
</div>
</div>
<div class="form-group" ng-if="'modify_skip_clear'|withFunc">
<label class="col-sm-4">Pre Settle</label>
<div class="col-sm-6">
<label class="control-label col-sm-2">Pre Settle</label>
<div class="col-sm-10">
<input type="checkbox" ng-model="partner.enable_presettle" bs-switch
switch-change="switchPreSettle(partner.enable_presettle)">
</div>
</div>
<div class="form-group" ng-if="'modify_min_settle'|withFunc">
<label class="col-sm-4" for="minSettleEdit">Min Settle</label>
<div class="col-sm-6">
<label class="control-label col-sm-2" for="minSettleEdit">Min Settle</label>
<div class="col-sm-10">
<p ng-if="!bankCtrl.modify_min_settle" class="form-control-static">
<span ng-if="partner.min_settle">AU$</span>{{partner.min_settle || 'Not Configure'}}
<a role="button" ng-click="bankCtrl.modify_min_settle=true"><i class="fa fa-edit"></i></a>
@ -101,15 +115,308 @@
</div>
<div class="form-group">
<label class="col-sm-4">Manual Settle</label>
<div class="col-sm-6">
<p>
<span ng-if="partner.manual_settle">Y</span>
<span ng-if="!partner.manual_settle">N</span>
<label class="control-label col-sm-2">Manual Settle</label>
<div class="col-sm-10">
<p style="height:30px; line-height:30px; ">
<span ng-if="partner.manual_settle" style="text-align: center">Y</span>
<span ng-if="!partner.manual_settle" style="text-align: center">N</span>
</p>
</div>
</div>
</div>
<div ng-if="settleRule.enable_cross_payment&&sysParams['app.settle-workday-only']!='true'" >
<div class="panel-heading-new" >
<h4>
Cross Payment Settle Rule Config
<a class="small" role="button" ng-if="!settle_rule_form.edit" ng-click="settle_rule_form.edit=true">
<i class="fa fa-edit"></i></a>
</h4>
</div>
<div class="panel-body">
<div class="row form-horizontal">
<!--<div class="form-group">-->
<!--<label class="control-label col-sm-2" for="settle_rule_manual">{{'settle_rule_config.manual_settle'|translate}}</label>-->
<!--<div class="col-sm-10">-->
<!--<input type="checkbox" bs-switch ng-readonly="!settle_rule_form.edit"-->
<!--ng-model="settleRule.manual" id="settle_rule_manual">-->
<!--</div>-->
<!--</div>-->
<!--<div class="form-group">-->
<!--<label class="control-label col-sm-2" for="settle_rule_hour">{{'settle_rule_config.settle_hour'|translate}}</label>-->
<!--<div class="col-sm-10">-->
<!--<select ng-model="settleRule.hour" id="settle_rule_hour" class="form-control" ng-readonly="!settle_rule_form.edit"-->
<!--ng-options="hour.value as hour.label for hour in settleHours"></select>-->
<!--</div>-->
<!--</div>-->
<div class="form-group"
ng-if="(!settleRule.manual&&settleRule.everyday&&!settle_rule_form.edit)||(!settleRule.manual&&settle_rule_form.edit)">
<div ng-if="!settle_rule_form.edit">
<label class="control-label col-sm-2"
for="settle_rule_everyday">Type</label>
<div class="col-sm-10">
<span ng-if="settleRule.everyday" readonly>Everyday</span>
</div>
</div>
<div ng-if="settle_rule_form.edit">
<label class="control-label col-sm-2"
for="settle_rule_everyday">Everyday</label>
<div class="col-sm-10">
<input type="checkbox" bs-switch ng-readonly="!settle_rule_form.edit"
ng-model="settleRule.everyday" id="settle_rule_everyday">
</div>
</div>
</div>
<div class="form-group" ng-if="!settleRule.manual && !settleRule.everyday">
<label class="control-label col-sm-2"
for="settle_rule_type">Type</label>
<div class="col-sm-10" ng-if="!settle_rule_form.edit">
<span ng-if="settleRule.rule_type=='DAY_OF_MONTH'"
readonly>Every Month</span>
<span ng-if="settleRule.rule_type=='DAY_OF_WEEK'"
readonly>Every Week</span>
</div>
<div class="col-sm-10" ng-if="settle_rule_form.edit">
<select class="form-control" ng-model="settleRule.rule_type" id="settle_rule_type"
ng-change="settleRule.days=[]">
<option value="">Select Type</option>
<option value="DAY_OF_MONTH">Every Month</option>
<option value="DAY_OF_WEEK">Every Week</option>
</select>
</div>
</div>
<div class="form-group"
ng-if="!settleRule.manual && !settleRule.everyday && settleRule.rule_type=='DAY_OF_WEEK'">
<label class="control-label col-sm-2">Days</label>
<div class="col-sm-10" ng-if="!settle_rule_form.edit">
<span ng-if="settleRule.days.indexOf('1')>=0"
readonly>Sunday</span>
<span ng-if="settleRule.days.indexOf('2')>=0" readonly>
Monday</span>
<span ng-if="settleRule.days.indexOf('3')>=0" readonly>
Tuesday</span>
<span ng-if="settleRule.days.indexOf('4')>=0"
readonly>Wednesday</span>
<span ng-if="settleRule.days.indexOf('5')>=0"
readonly>Thursday</span>
<span ng-if="settleRule.days.indexOf('6')>=0" readonly>
Friday</span>
<span ng-if="settleRule.days.indexOf('7')>=0"
readonly>Saturday</span>
</div>
<div class="col-sm-10">
<div class="btn-group" ng-if="settle_rule_form.edit">
<button class="btn btn-default" ng-class="{active:settleRule.days.indexOf('1')>=0}"
ng-click="toggleSettleRuleDay('1')">Sunday
</button>
<button class="btn btn-default" ng-class="{active:settleRule.days.indexOf('2')>=0}"
ng-click="toggleSettleRuleDay('2')">Monday
</button>
<button class="btn btn-default" ng-class="{active:settleRule.days.indexOf('3')>=0}"
ng-click="toggleSettleRuleDay('3')">Tuesday
</button>
<button class="btn btn-default" ng-class="{active:settleRule.days.indexOf('4')>=0}"
ng-click="toggleSettleRuleDay('4')">Wednesday
</button>
<button class="btn btn-default" ng-class="{active:settleRule.days.indexOf('5')>=0}"
ng-click="toggleSettleRuleDay('5')">Thursday
</button>
<button class="btn btn-default" ng-class="{active:settleRule.days.indexOf('6')>=0}"
ng-click="toggleSettleRuleDay('6')">Friday
</button>
<button class="btn btn-default" ng-class="{active:settleRule.days.indexOf('7')>=0}"
ng-click="toggleSettleRuleDay('7')">Saturday
</button>
</div>
</div>
</div>
<div class="form-group"
ng-if="!settleRule.manual && !settleRule.everyday && settleRule.rule_type=='DAY_OF_MONTH'">
<label class="control-label col-sm-2">Days</label>
<div class="col-sm-10">
<div class="date-box">
<div class="day" ng-repeat="day in settleRule.days">
<div style="padding: 0" ng-bind="day"></div>
<div class="del-btn" role="button" ng-if="settle_rule_form.edit"
ng-click="settleRule.days.splice($index,1)">
<i class="fa fa-trash"></i>
</div>
</div>
<div class="day" ng-if="settle_rule_form.edit">
<div role="button" ng-click="settleAddDay()"><i class="fa fa-calendar"></i></div>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2"
for="settle_rule_min">Min Settle Amount</label>
<div class="col-sm-10">
<input type="number" class="form-control" ng-readonly="!settle_rule_form.edit" id="settle_rule_min"
ng-model="settleRule.min">
</div>
</div>
<!--<div class="form-group" ng-if="settleRule.min > 0">-->
<!--<label class="control-label col-sm-2"-->
<!--for="settle_rule_max">Max Settle Days</label>-->
<!--<div class="col-sm-10">-->
<!--<input type="number" class="form-control" ng-readonly="!settle_rule_form.edit" id="settle_rule_max"-->
<!--ng-model="settleRule.max_settle_days">-->
<!--</div>-->
<!--</div>-->
</div>
</div>
<div class="panel-footer" ng-if="settle_rule_form.edit">
<button class="btn btn-success" ng-click="submitSettleRule()"> Save</button>
<button class="btn btn-danger" ng-click="cancelSettleRule()"> Cancel</button>
</div>
</div>
<div ng-if="settleRule.enable_card_payment&&sysParams['app.settle-workday-only']!='true'" >
<div class="panel-heading-new" >
<h4>
Card Payment Settle Rule Config
<span ng-if="statusCtrl.isShowSwitchButton" style="margin-left: 5px;">
<input type="checkbox" name="switch" id="switch">
</span>
<a class="small" role="button" ng-if="!statusCtrl.isCanEdit && !statusCtrl.isShowSwitchButton"
ng-click="statusCtrl.isCanEdit=true">
<i class="fa fa-edit"></i></a>
</h4>
</div>
<div class="panel-body" ng-if="statusCtrl.isShowSettings">
<div class="row form-horizontal">
<div class="form-group"
ng-if="(!cardSettings.manual&&cardSettings.everyday&&!statusCtrl.isCanEdit)||(!cardSettings.manual&&statusCtrl.isCanEdit)">
<div ng-if="!statusCtrl.isCanEdit">
<label class="control-label col-sm-2"
for="settle_rule_everyday">Type</label>
<div class="col-sm-10">
<span ng-if="cardSettings.everyday" readonly>Everyday</span>
</div>
</div>
<div ng-if="statusCtrl.isCanEdit">
<label class="control-label col-sm-2"
for="settle_rule_everyday">Everyday</label>
<div class="col-sm-10">
<input type="checkbox" bs-switch ng-readonly="!statusCtrl.isCanEdit"
ng-model="cardSettings.everyday" id="settle_rule_everyday">
</div>
</div>
</div>
<div class="form-group" ng-if="!cardSettings.manual && !cardSettings.everyday">
<label class="control-label col-sm-2"
for="settle_rule_type">Type</label>
<div class="col-sm-10" ng-if="!statusCtrl.isCanEdit">
<span ng-if="cardSettings.rule_type=='DAY_OF_MONTH'"
readonly>Every Month</span>
<span ng-if="cardSettings.rule_type=='DAY_OF_WEEK'"
readonly>Every Week</span>
</div>
<div class="col-sm-10" ng-if="statusCtrl.isCanEdit">
<select class="form-control" ng-model="cardSettings.rule_type" id="settle_rule_type"
ng-change="cardSettings.days=[]">
<option value="">Select Type</option>
<option value="DAY_OF_MONTH">Every Month</option>
<option value="DAY_OF_WEEK">Every Week</option>
</select>
</div>
</div>
<div class="form-group"
ng-if="!cardSettings.manual && !cardSettings.everyday && cardSettings.rule_type=='DAY_OF_WEEK'">
<label class="control-label col-sm-2">Days</label>
<div class="col-sm-10" ng-if="!statusCtrl.isCanEdit">
<span ng-if="cardSettings.days.indexOf('1')>=0"
readonly>Sunday</span>
<span ng-if="cardSettings.days.indexOf('2')>=0" readonly>
Monday</span>
<span ng-if="cardSettings.days.indexOf('3')>=0" readonly>
Tuesday</span>
<span ng-if="cardSettings.days.indexOf('4')>=0"
readonly>Wednesday</span>
<span ng-if="cardSettings.days.indexOf('5')>=0"
readonly>Thursday</span>
<span ng-if="cardSettings.days.indexOf('6')>=0" readonly>
Friday</span>
<span ng-if="cardSettings.days.indexOf('7')>=0"
readonly>Saturday</span>
</div>
<div class="col-sm-10">
<div class="btn-group" ng-if="statusCtrl.isCanEdit">
<button class="btn btn-default" ng-class="{active:cardSettings.days.indexOf('1')>=0}"
ng-click="toggleCardSettingsDay('1')">Sunday
</button>
<button class="btn btn-default" ng-class="{active:cardSettings.days.indexOf('2')>=0}"
ng-click="toggleCardSettingsDay('2')">Monday
</button>
<button class="btn btn-default" ng-class="{active:cardSettings.days.indexOf('3')>=0}"
ng-click="toggleCardSettingsDay('3')">Tuesday
</button>
<button class="btn btn-default" ng-class="{active:cardSettings.days.indexOf('4')>=0}"
ng-click="toggleCardSettingsDay('4')">Wednesday
</button>
<button class="btn btn-default" ng-class="{active:cardSettings.days.indexOf('5')>=0}"
ng-click="toggleCardSettingsDay('5')">Thursday
</button>
<button class="btn btn-default" ng-class="{active:cardSettings.days.indexOf('6')>=0}"
ng-click="toggleCardSettingsDay('6')">Friday
</button>
<button class="btn btn-default" ng-class="{active:cardSettings.days.indexOf('7')>=0}"
ng-click="toggleCardSettingsDay('7')">Saturday
</button>
</div>
</div>
</div>
<div class="form-group"
ng-if="!cardSettings.manual && !cardSettings.everyday && cardSettings.rule_type=='DAY_OF_MONTH'">
<label class="control-label col-sm-2">Days</label>
<div class="col-sm-10">
<div class="date-box">
<div class="day" ng-repeat="day in cardSettings.days">
<div style="padding: 0" ng-bind="day"></div>
<div class="del-btn" role="button" ng-if="statusCtrl.isCanEdit"
ng-click="cardSettings.days.splice($index,1)">
<i class="fa fa-trash"></i>
</div>
</div>
<div class="day" ng-if="statusCtrl.isCanEdit">
<div role="button" ng-click="setMonthSomeday()"><i class="fa fa-calendar"></i></div>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2"
for="settle_rule_min">Min Settle Amount</label>
<div class="col-sm-10">
<input type="text" onkeyup="value=value.replace(/[^\d.]/g,'')" class="form-control" ng-readonly="!statusCtrl.isCanEdit"
ng-model="cardSettings.min">
</div>
</div>
</div>
</div>
<div class="panel-footer" ng-if="statusCtrl.isShowSettings && statusCtrl.isCanEdit">
<button class="btn btn-success" ng-click="submitCardSettings()">Save</button>
<button class="btn btn-danger" ng-click="cancelCardSettings()">Cancel</button>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<h3>Bank Account
<a class="small" role="button" ng-click="bankCtrl.edit=true"
ng-if="!bankCtrl.edit && (('11'|withRole)||((!partner.approve_result||partner.approve_result>4) && ('111'|withRole)))">
<i class="fa fa-edit"></i>
</a>
</h3>
<div class="form-horizontal">
<div class="form-group" ng-if="'modify_settle_hour'|withFunc">
<label class="col-sm-4">Settle Hour</label>
<div class="col-sm-6">

Loading…
Cancel
Save