diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java index b0138c63c..3236e16dc 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java @@ -120,9 +120,9 @@ public interface RetailAppService { void useCoupon(JSONObject device, String coupon_log_id); - JSONObject getAd(JSONObject device); + JSONObject getAd(); - JSONObject getAdDetail(JSONObject device, String article_id); + JSONObject getAdDetail(String article_id); JSONObject getCheckClientInfo(JSONObject device); @@ -163,4 +163,6 @@ public interface RetailAppService { JSONObject getCouponCusCouponLog(String client_moniker, AppQueryBean appQueryBean); void saveCouponAccuessLog(int client_id, String coupon_id); + + JSONObject getStyle(); } diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index f8f3a01a9..375d3d42d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -498,6 +498,11 @@ public class RetailAppServiceImp implements RetailAppService { couponAccuessLogMapper.save(couponAccuessLog); } + @Override + public JSONObject getStyle() { + return royalPayCMSSupport.getStyle(); + } + @Override public void updateClient(JSONObject device, AppClientBean appClientBean) { String clientType = device.getString("client_type"); @@ -1765,23 +1770,44 @@ public class RetailAppServiceImp implements RetailAppService { } @Override - public JSONObject getAd(JSONObject device) { - String clientType = device.getString("client_type"); - deviceSupport.findRegister(clientType); + public JSONObject getAd() { JSONObject res = royalPayCMSSupport.listArticles("app_ad", false, true, 1, 10); JSONArray acts = res.getJSONArray("data"); if (acts.size() > 0) { int selectNo = RandomUtils.nextInt(0, acts.size()); - return acts.getJSONObject(selectNo); + JSONObject getActs = acts.getJSONObject(selectNo); + getActs.put("ad_cover", getActs.getString("page_desc")); + getActs.put("ad_mode", getActs.getString("page_keywords")); + getActs.put("ad_link", getActs.getString("summery")); + getActs.put("publish_date", DateFormatUtils.format(getActs.getDate("publish_time"),"yyyy/MM/dd HH:mm:ss")); + String reference = getActs.getString("reference"); + JSONObject referenceObj = JSONObject.parseObject(reference); + if (reference != null) { + if (referenceObj.getString("ad_type") != null) { + getActs.put("ad_type", referenceObj.getString("ad_type")); + } + if (referenceObj.getString("expire_date") != null) { + getActs.put("expire_date", referenceObj.getString("expire_date")); + } + if (referenceObj.getString("duration_time") != null) { + getActs.put("duration_time", referenceObj.getString("duration_time")); + } + }else { + getActs.put("message", "mess : (ad_type && expire_date && duration_time) not set"); + } + getActs.remove("reference"); + getActs.remove("page_desc"); + getActs.remove("page_keywords"); + getActs.remove("summery"); + getActs.remove("publish_time"); + return getActs; } return null; } @Override - public JSONObject getAdDetail(JSONObject device, String article_id) { - String clientType = device.getString("client_type"); - deviceSupport.findRegister(clientType); + public JSONObject getAdDetail(String article_id) { JSONObject res = royalPayCMSSupport.getArticle("app_ad", article_id); Document doc = Jsoup.parse(res.getString("content")); String father = "
"; diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java index 003e7b8ca..d8cf99f17 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java @@ -395,19 +395,6 @@ public class RetailAppController { } /* 优惠券End */ - /** - * 广告位 - */ - @RequestMapping(value = "/ads", method = RequestMethod.GET) - public JSONObject getAd(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { - return retailAppService.getAd(device); - } - - @RequestMapping(value = "/ads/{article_id}", method = RequestMethod.GET) - public JSONObject getAdDetail(@PathVariable String article_id, @ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { - return retailAppService.getAdDetail(device, article_id); - } - @RequestMapping(value = "/bills/{bill_id}", method = RequestMethod.GET) public JSONObject getBill(@PathVariable("bill_id") String bill_id, @ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { return billService.getBillDetail(bill_id, device.getIntValue("client_id")); @@ -574,4 +561,9 @@ public class RetailAppController { retailAppService.saveCouponAccuessLog(client_id, coupon_id); } + @RequestMapping(value = "/style", method = RequestMethod.GET) + public JSONObject getStyle() { + return retailAppService.getStyle(); + } + } diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailValidationController.java b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailValidationController.java index d00114502..5194f557a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailValidationController.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailValidationController.java @@ -1,7 +1,9 @@ package au.com.royalpay.payment.manage.appclient.web; import au.com.royalpay.payment.manage.appclient.beans.RetailLoginInfo; +import au.com.royalpay.payment.manage.appclient.core.RetailAppService; import au.com.royalpay.payment.manage.signin.core.SignInStatusManager; +import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.device.DeviceSupport; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.http.HttpUtils; @@ -32,6 +34,8 @@ public class RetailValidationController { private SignInStatusManager signInStatusManager; @Resource private DeviceSupport deviceSupport; + @Resource + private RetailAppService retailAppService; @RequestMapping(value = "/devices/{devType}/register", method = RequestMethod.POST) public JSONObject register(@RequestBody String registeration, @PathVariable String devType) { @@ -91,4 +95,17 @@ public class RetailValidationController { } return res; } + + /** + * 广告位 + */ + @RequestMapping(value = "/ads", method = RequestMethod.GET) + public JSONObject getAd() { + return retailAppService.getAd(); + } + + @RequestMapping(value = "/ads/{article_id}", method = RequestMethod.GET) + public JSONObject getAdDetail(@PathVariable String article_id) { + return retailAppService.getAdDetail( article_id); + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskAttentionMerchantsMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskAttentionMerchantsMapper.java index 3cd1d943f..b97ddb822 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskAttentionMerchantsMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskAttentionMerchantsMapper.java @@ -34,11 +34,11 @@ public interface RiskAttentionMerchantsMapper { PageList query(JSONObject params, PageBounds pagination); @Select("SELECT client_moniker FROM risk_attention_merchants " + - "WHERE (abn LIKE CONCAT('%',#{abn},'%') ) OR (acn LIKE CONCAT('%',#{acn},'%') ) " + - " OR (contact_phone LIKE CONCAT('%',#{contact_phone},'%') ) " + - " OR (contact_person LIKE CONCAT('%',#{contact_person},'%') ) " + - " OR (client_moniker LIKE CONCAT('%',#{client_moniker},'%') ) " + - " OR (bank_account_no LIKE CONCAT('%',#{bank_account_no},'%') ) AND is_valid=1") + "WHERE (abn = #{abn} ) OR (acn = #{acn} ) " + + " OR (contact_phone = #{contact_phone} ) " + + " OR (contact_person = #{contact_person} ) " + + " OR (client_moniker = #{client_moniker} ) " + + " OR (bank_account_no = #{bank_account_no} ) AND is_valid=1") List listRiskySimilarMerchants(JSONObject params); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index 96e4b9fac..6e3121e91 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -591,8 +591,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (clientMapper.findClientByMoniker(registery.getClientMoniker()) != null) { throw new BadRequestException("error.partner.valid.dumplicate_client_moniker"); } - //检查商户是否进入系统黑名单 - isRiskyMerchant(partner, null); + //2018-09-10,新建商户不检查是否在系统黑名单 + //isRiskyMerchant(partner, null); try { @@ -1184,6 +1184,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_hf_email_notice", allow)); } clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_" + channel.toLowerCase(), allow)); + + if (channel.equals("wechat") || channel.equals("alipay")) { + + isRiskyMerchant(client,null); + } logger.info(manager.getString("display_name") + "(" + manager.getString("manager_id") + ") switched client " + clientMoniker + " channel " + channel + " to " + allow); return; diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.xml index addc41843..26ec3bbbf 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.xml @@ -6,7 +6,7 @@ from act_charity left JOIN pmt_transactions on act_charity.client_id = pmt_transactions.client_id and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=act_charity.active_time - and pmt_transactions.transaction_time<'2018-09-01' and pmt_transactions.transaction_time>='2018-07-09' + and pmt_transactions.transaction_time<'2018-10-31' and pmt_transactions.transaction_time>='2018-07-09' and pmt_transactions.channel != 'Settlement' GROUP BY act_charity.client_id order by count_ordernum desc @@ -14,7 +14,7 @@ select count(DISTINCT order_id) as count_ordernum,date_format(pmt_transactions.transaction_time,'%Y-%m-%d') as orderdate,client_moniker,ifnull(sum(pmt_transactions.clearing_amount),0) as sum_ordernum from act_charity inner JOIN pmt_transactions ON act_charity.client_id = pmt_transactions.client_id and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=#{begin} and pmt_transactions.transaction_time<=#{end} and pmt_transactions.transaction_time>=act_charity.active_time and pmt_transactions.channel != 'Settlement' - and pmt_transactions.transaction_time<'2018-09-01' and pmt_transactions.transaction_time>='2018-07-09' + and pmt_transactions.transaction_time<'2018-10-31' and pmt_transactions.transaction_time>='2018-07-09' group by date_format(pmt_transactions.transaction_time,'%Y-%m-%d') @@ -22,7 +22,7 @@ \ No newline at end of file diff --git a/src/main/ui/static/cms/cms.js b/src/main/ui/static/cms/cms.js index 2c6363284..3ab730034 100644 --- a/src/main/ui/static/cms/cms.js +++ b/src/main/ui/static/cms/cms.js @@ -109,6 +109,7 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu app.controller('cmsAddArticleCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog', function ($scope, $http, $state, $stateParams, commonDialog) { $scope.saveArticle = function () { + $scope.article.reference =$scope.reference; $http.post('/app/cms/categories/' + $stateParams.catId + '/articles', $scope.article).then(function (resp) { $state.go('^.article_view', {articleId: resp.data.article_id}); }, function (resp) { @@ -119,7 +120,14 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu app.controller('cmsArticleEditCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog', 'article', function ($scope, $http, $state, $stateParams, commonDialog, article) { $scope.article = article.data; + if ($scope.article.reference) { + $scope.reference = JSON.parse($scope.article.reference); + }else { + $scope.reference = {}; + } + $scope.saveArticle = function () { + $scope.article.reference =$scope.reference; $http.put('/app/cms/categories/' + $stateParams.catId + '/articles/' + $stateParams.articleId, $scope.article).then(function (resp) { $state.go('^.article_view', {articleId: $stateParams.articleId}); }, function (resp) { diff --git a/src/main/ui/static/cms/templates/article_editor.html b/src/main/ui/static/cms/templates/article_editor.html index 0ead12acb..7c9cd1bf5 100644 --- a/src/main/ui/static/cms/templates/article_editor.html +++ b/src/main/ui/static/cms/templates/article_editor.html @@ -20,7 +20,7 @@
-

(重要!!!0:不允许跳转 1:跳转编辑内容 2:跳转到外链)

+

(重要!!!0:不允许跳转 1:跳转到外链)

@@ -40,7 +40,27 @@

(若有外链,则填,否则留空)

- +
+ +
+ +

(广告封面 type=0时 为图片地址 type=1时 为视频地址)

+
+
+
+ +
+ +

(广告过期时间 格式为: 2018/10/01 00:00:00)

+
+
+
+ +
+ +

(广告展示时间(s))

+
+
diff --git a/src/main/ui/static/cms/templates/articles.html b/src/main/ui/static/cms/templates/articles.html index bb4489ce7..046393f0a 100644 --- a/src/main/ui/static/cms/templates/articles.html +++ b/src/main/ui/static/cms/templates/articles.html @@ -31,7 +31,7 @@ Title Add Time Published - Recommended + Operation @@ -44,11 +44,11 @@ - + diff --git a/src/main/ui/static/images/hfpaylink_intro/app_bank_hf_pay_step1.png b/src/main/ui/static/images/hfpaylink_intro/app_bank_hf_pay_step1.png new file mode 100644 index 000000000..b235f85bb Binary files /dev/null and b/src/main/ui/static/images/hfpaylink_intro/app_bank_hf_pay_step1.png differ diff --git a/src/main/ui/static/images/hfpaylink_intro/app_bank_hf_pay_step2.png b/src/main/ui/static/images/hfpaylink_intro/app_bank_hf_pay_step2.png new file mode 100644 index 000000000..cd6bc3ef3 Binary files /dev/null and b/src/main/ui/static/images/hfpaylink_intro/app_bank_hf_pay_step2.png differ diff --git a/src/main/ui/static/images/hfpaylink_intro/hf_pay_end.png b/src/main/ui/static/images/hfpaylink_intro/hf_pay_end.png new file mode 100644 index 000000000..f554a39aa Binary files /dev/null and b/src/main/ui/static/images/hfpaylink_intro/hf_pay_end.png differ diff --git a/src/main/ui/static/images/hfpaylink_intro/pc_bank_hf_pay_step1.png b/src/main/ui/static/images/hfpaylink_intro/pc_bank_hf_pay_step1.png new file mode 100644 index 000000000..4e039c90b Binary files /dev/null and b/src/main/ui/static/images/hfpaylink_intro/pc_bank_hf_pay_step1.png differ diff --git a/src/main/ui/static/images/hfpaylink_intro/pc_bank_hf_pay_step2.png b/src/main/ui/static/images/hfpaylink_intro/pc_bank_hf_pay_step2.png new file mode 100644 index 000000000..7ea8eee05 Binary files /dev/null and b/src/main/ui/static/images/hfpaylink_intro/pc_bank_hf_pay_step2.png differ diff --git a/src/main/ui/static/images/hfpaylink_intro/pc_bank_hf_pay_step3.png b/src/main/ui/static/images/hfpaylink_intro/pc_bank_hf_pay_step3.png new file mode 100644 index 000000000..8a6f0aea7 Binary files /dev/null and b/src/main/ui/static/images/hfpaylink_intro/pc_bank_hf_pay_step3.png differ diff --git a/src/main/ui/static/images/hfpaylink_intro/pc_hf_pay_step1.png b/src/main/ui/static/images/hfpaylink_intro/pc_hf_pay_step1.png new file mode 100644 index 000000000..4e039c90b Binary files /dev/null and b/src/main/ui/static/images/hfpaylink_intro/pc_hf_pay_step1.png differ diff --git a/src/main/ui/static/images/hfpaylink_intro/pc_hf_pay_step2.png b/src/main/ui/static/images/hfpaylink_intro/pc_hf_pay_step2.png new file mode 100644 index 000000000..0e7d02302 Binary files /dev/null and b/src/main/ui/static/images/hfpaylink_intro/pc_hf_pay_step2.png differ diff --git a/src/main/ui/static/images/hfpaylink_intro/pc_hf_pay_step3.png b/src/main/ui/static/images/hfpaylink_intro/pc_hf_pay_step3.png new file mode 100644 index 000000000..a8f5d006a Binary files /dev/null and b/src/main/ui/static/images/hfpaylink_intro/pc_hf_pay_step3.png differ diff --git a/src/main/ui/static/lib/rpay/app_pay_2.js b/src/main/ui/static/lib/rpay/app_pay_2.js new file mode 100644 index 000000000..7db103b93 --- /dev/null +++ b/src/main/ui/static/lib/rpay/app_pay_2.js @@ -0,0 +1,391 @@ +/** + * Created by yixian on 2017-05-08 + */ + +$(function () { + 'use strict'; + var dataCache = {price: '0', coupons: [], coupon_groups:{}}; + var exchangeRate = parseFloat(window.exchange_rate); + + dataCache.paying = false; + var ctrl = {}; + + $('.weui_grid.key').bind('touchstart', function () { + if (dataCache.paying) { + return; + } + var char = $(this).attr('data-char'); + appendChar(char); + }); + + $('.coupons .use-check').click(function () { + if ($(this).hasClass('disabled')) { + return; + } + var couponId = $(this).attr('data-coupon-id'); + var couponGroup = $(this).attr('data-coupon-group'); + if (couponGroup) { + var prevCouponId = dataCache.coupon_groups[couponGroup]; + if (prevCouponId) { + var prevIdx = dataCache.coupons.indexOf(prevCouponId); + if (prevIdx >= 0) { + dataCache.coupons.splice(prevIdx, 1); + } + if (prevCouponId!=couponId) { + $('.coupons .use-check[data-coupon-id="' + prevCouponId + '"]').removeClass('checked').addClass('unchecked'); + dataCache.coupon_groups[couponGroup] = couponId; + }else { + dataCache.coupon_groups[couponGroup]= null; + } + }else { + dataCache.coupon_groups[couponGroup] = couponId; + } + + } + + if ($(this).is('.checked')) { + $(this).removeClass('checked').addClass('unchecked'); + } else { + $(this).removeClass('unchecked').addClass('checked'); + } + var checked = $(this).is('.checked'); + if (checked) { + dataCache.coupons.push(couponId); + updatePrice(); + } else { + var idx = dataCache.coupons.indexOf(couponId); + dataCache.coupons.splice(idx, 1); + updatePrice(); + } + }); + + $('#key_B').bind('touchstart', function () { + backspace(); + }); + + function updatePoundage(price) { + if (window.extensions.indexOf('customerrate') >= 0 && window.rateValue != null) { + if (window.use_customised_rate) { + var rate = new Decimal(100).plus(window.rateValue).div(100); + var poundageValue = new Decimal(dataCache.price).mul(rate).sub(dataCache.price); + } else { + var rateRemain = new Decimal(100).sub(window.rateValue).div(100); + poundageValue = new Decimal(dataCache.price).div(rateRemain).sub(dataCache.price); + } + dataCache.poundageValue = poundageValue.toFixed(2, Decimal.ROUND_HALF_UP); + return poundageValue.plus(price).toFixed(2, Decimal.ROUND_HALF_UP); + } + return price; + } + + function updatePrice() { + $('#audVal').html(dataCache.price); + var realPrice = dataCache.price; + $('#audValReal').html(realPrice); + var surchargeData = calculateSurcharge(realPrice); + + dataCache.tax = surchargeData.tax; + dataCache.surcharge = surchargeData.surcharge; + var price = surchargeData.newPrice || realPrice; + var priceBeforeDiscount = price; + dataCache.discounts = []; + $(window.coupons).each(function () { + price = this.handleDiscount(price, dataCache.price, dataCache.discounts, dataCache.coupons); + }); + dataCache.customSurcharge = new Decimal(price).sub(realPrice).toFixed(2,Decimal.ROUND_HALF_UP); + dataCache.finalPrice = new Decimal(price).toFixed(2, Decimal.ROUND_FLOOR); + var rate = 'CNY' == window.currency ? 1 : exchangeRate; + var cnyVal = Decimal.mul(price, rate).toFixed(2, Decimal.ROUND_HALF_UP); + $('#cnyVal').html(cnyVal); + dataCache.currencyPrice = 'CNY' == window.currency ? Decimal.div(priceBeforeDiscount, exchangeRate).toFixed(2, Decimal.ROUND_FLOOR) : priceBeforeDiscount; + } + + function updatePoundageStatus() { + $(window.coupons).each(function () { + var coupon = this; + var couponId = coupon.couponId(); + if (coupon.isEnable(dataCache.currencyPrice||0)) { + $('.coupons .use-check[data-coupon-id=' + couponId + ']').removeClass('disabled'); + } else { + var dom = $('.coupons .use-check[data-coupon-id=' + couponId + ']').addClass('disabled'); + var couponGroup = dom.attr('data-coupon-group'); + if (couponGroup) { + if (dataCache.coupon_groups[couponGroup] == couponId) { + dataCache.coupon_groups[couponGroup] = null; + } + } + var idx = dataCache.coupons.indexOf(couponId); + if (idx >= 0) { + dataCache.coupons.splice(idx, 1); + } + dom.removeClass('checked').addClass('unchecked'); + } + }) + } + updatePoundageStatus(); + + function backspace() { + dataCache.price = dataCache.price.substring(0, dataCache.price.length - 1); + if (dataCache.price.length == 0) { + dataCache.price = '0'; + } + updatePrice(); + updatePoundageStatus(); + } + + function appendChar(char) { + var pointLocation = dataCache.price.indexOf('.'); + if (pointLocation >= 0 || char == '.' || dataCache.price.length < 5) { + if (pointLocation >= 0 && char == '.') { + return; + } + if (pointLocation >= 0 && pointLocation <= dataCache.price.length - 3) { + return; + } + if (dataCache.price == '0' && char != '.') { + dataCache.price = ''; + } + dataCache.price += char; + updatePrice(); + updatePoundageStatus(); + } + } + + $('#coupon-box-toggle').click(function () { + $('.coupons-container').addClass('show') + }); + $('.coupons-container>.coupons-mask,.coupons-container #close-coupon-box').click(function () { + $(this).parents('.coupons-container').removeClass('show'); + }); + + + + $('.remark-btn').click(function () { + var cfg = { + title: '备注 Remark', + template: '', + initialize: function (dialog) { + $('').addClass('remark-input').attr('name', 'remark').val(dataCache.remark || '').appendTo($('.weui_dialog_bd', dialog)); + }, + confirm: function (dialog, chosen) { + if (chosen) { + var remark = $('textarea[name="remark"]', dialog).val(); + if (remark) { + $('#remark-box').text('备注:' + remark).show() + } else { + $('#remark-box').text('').hide(); + } + dataCache.remark = remark; + } + + } + }; + showWeuiDialog(cfg); + }); + + $('.paydetail').click(function () { + var config = { + title: 'Payment Detail', + template: '', + initialize: function (dialog) { + var bd = $('.weui_dialog_bd', dialog); + var currencySymbol = window.currency == 'AUD' ? '$' : '¥'; + $('

').html('Input Price 输入金额:' + currencySymbol + dataCache.price).appendTo(bd); + if (parseFloat(dataCache.customSurcharge) > 0) { + $('

').html('Surcharge 手续费(' + window.rateValue + '%):+' + currencySymbol + dataCache.customSurcharge).appendTo(bd); + } + $(dataCache.discounts).each(function () { + $('

').html(this.title + ':-' + currencySymbol + this.amount).appendTo(bd); + }); + $('

').addClass('final').html('Final 支付金额:' + currencySymbol + (dataCache.finalPrice || 0)).appendTo(bd); + } + }; + showWeuiDialog(config); + }); + + $('#key_P').bind('touchstart', function () { + + pay(); + + // $('#key_P').addClass('hidden'); + // $('#key_Loading').removeClass('hidden'); + // if (dataCache.paying) { + // return; + // } + // dataCache.paying = true; + // var data = {price: dataCache.price + '', original_number: true, currency: window.currency}; + // if (dataCache.remark) { + // data.description = dataCache.remark; + // } + // if (window.extensions.indexOf('preauthorize') >= 0) { + // data.preauthorize = true; + // } + // if (window.extensions.indexOf('qrcodemode') >= 0) { + // data.qrmode = true; + // } + // if (window.extensions.indexOf('customerrate') >= 0) { + // data.customerrate = true; + // } + // data.coupons = dataCache.coupons; + // dataCache.remark = ''; + // data.account_id = User.getProduct(); + // data.qrcodeVersion = window.qrcodeVersion; + // $.ajax({ + // url: '/api/v1.0/bestpay/partners/' + window.client_moniker + '/app_order', + // method: 'POST', + // data: JSON.stringify(data), + // dataType: 'json', + // contentType: 'application/json', + // success: function (pay) { + // if (pay.direct_paid) { + // window.location = '/api/v1.0/bestpay/partners/' + window.client_moniker + '/orders/' + pay.order_id; + // return; + // } + // var paydata = pay.params; + // try { + // Payment.onPay(paydata, function () { + // window.location = '/api/v1.0/bestpay/partners/' + window.client_moniker + '/orders/' + pay.order_id; + // dataCache.paying = false; + // $('#key_P').removeClass('hidden'); + // $('#key_Loading').addClass('hidden'); + // }, function (rescode) { + // dataCache.paying = false; + // if (rescode === "cancel") { + // Dialog.alert("支付取消" + rescode) + // } else { + // Dialog.alert("支付失败" + rescode) + // } + // $('#key_P').removeClass('hidden'); + // $('#key_Loading').addClass('hidden'); + // }) + // } catch (e) { + // Dialog.alert(e); + // dataCache.paying = false; + // $('#key_P').removeClass('hidden'); + // $('#key_Loading').addClass('hidden'); + // } + // Dialog.dismissDialog(dataCache.process); + // }, + // error: function (jqXhr) { + // Dialog.alert(jqXhr.responseJSON.message); + // Dialog.dismissDialog(dataCache.process); + // dataCache.paying = false; + // $('#key_P').removeClass('hidden'); + // $('#key_Loading').addClass('hidden'); + // } + // }); + }); + + function showWeuiDialog(config) { + if (config.templateUrl) { + $.ajax({ + url: config.templateUrl, + dataType: 'html', + success: function (template) { + buildDialog(template); + } + }); + } else { + buildDialog(config.template); + } + + + function buildDialog(template) { + var defaultConfig = {backdrop: true}; + config = $.extend({}, defaultConfig, config); + var dialog = $("
", {class: 'weui_dialog_confirm'}); + var mask = $('
', {class: 'weui_mask'}).appendTo(dialog); + if (config.backdrop) { + mask.click(function () { + dialog.remove(); + if ($.isFunction(config.dismiss)) { + config.dismiss(); + } + }) + } + var dialogBox = $("
", {class: 'weui_dialog'}).appendTo(dialog); + if (config.title) { + $('
', {class: 'weui_dialog_hd'}).append($('', {class: 'weui_dialog_title'}).html(config.title)).appendTo(dialogBox); + } + var dialogBody = $("
", {class: 'weui_dialog_bd'}).appendTo(dialogBox); + if (template) { + dialogBody.append(template); + } + if ($.isFunction(config.initialize)) { + config.initialize(dialog); + } + var ft = $('
').appendTo(dialogBox); + if ($.isFunction(config.confirm)) { + var yes = $('', {class: 'weui_btn_dialog primary', text: 'OK'}).appendTo(ft); + yes.click(function () { + config.confirm(dialog, true); + dialog.remove(); + }); + var no = $('', {class: 'weui_btn_dialog default', text: 'Cancel'}).appendTo(ft); + no.click(function () { + config.confirm(dialog, false); + dialog.remove(); + }) + } else { + var ok = $('', {class: 'weui_btn_dialog primary', text: 'OK'}).appendTo(ft); + ok.click(function () { + dialog.remove(); + }) + } + dialog.appendTo($('body')); + } + + } + + + function getUserId(){ + alert(12); + window.RPayPlus.send("getUserId", null, function(data){ + alert(data); + }); + } + + function pay(){ + var order={ + orderId:'00002', + amount:'$100.07', + title:'Gift card purchase' + }; + window.RPayPlus.send('pay', order, function(data){ + alert('this is callback from native and data='+JSON.stringify(data)); + }); + } + + function back(){ + window.RPayPlus.send("back", null, null); + } + + function jsInvoke(){ + window.RPayPlus.send("jsInvoke", 'Native Test', null); + } + + function createOrder(msg){ + alert('create order information='+JSON.stringify(msg)); + } + + function queryOrder(msg){ + alert('query order information='+JSON.stringify(msg)); + + var order={ + orderId:'00001', + amount:'$10.98', + title:'Balance Top-UP' + }; + setTimeout("window.RPayPlus.onResult("+JSON.stringify(order)+");", 1500); + } + + function registerJs(){ + window.RPayPlus.register('createOrder', function(data){ + createOrder(data); + }); + window.RPayPlus.register('queryOrder', function(data){ + queryOrder(data); + }); + } + getUserId(); +}); \ No newline at end of file diff --git a/src/main/ui/static/lib/rpay/rpay_jssdk.js b/src/main/ui/static/lib/rpay/rpay_jssdk.js new file mode 100644 index 000000000..72f374696 --- /dev/null +++ b/src/main/ui/static/lib/rpay/rpay_jssdk.js @@ -0,0 +1,58 @@ +$(function (){ + var callbacks = {}; + var functions = {}; + + window.RPayPlus = { + // 向Native端发送消息,用于实现:JS->Native + send: function(methodName, param, callback) { + alert(1); + var thisId = 0; + if(callback){ + thisId = new Date().getTime();; // 获取唯一id + callbacks[thisId] = callback; // 存储Callback + } + var json = { + method: methodName, + data: param || {}, + callbackId: thisId // 传到 Native 端 + }; + var msg = JSON.stringify(json); + var u = navigator.userAgent; + var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); + if(isiOS){ + window.webkit.messageHandlers.rpayplus.postMessage(msg); + } else{ + rpayplus.send(msg); + } + }, + + // 接收来自Native发送的消息,用于实现Native->JS + receive: function(msg) { + var method = msg.methodName, + data = msg.data || {}, + callbackId = msg.callbackId; // JS->Native的回调函数ID + + // 具体逻辑 bridgeName 和 callbackId 不会同时存在; + // callbackId有效,表示此接收信息源自JS->Native的回调 + // callbackId无效,且method有效,表示是Native->JS的直接调用 + if (callbackId && callbacks[callbackId]) { + callbacks[callbackId](msg.data); // 执行调用 + return; + } + if (method && functions[method]) { + functions[method](msg); + } + }, + // 注册JS方法,供Native调用,未被注册的方法,Native无法调用 + register: function(methodName, callback) { + if (!functions[methodName]) { + functions[methodName] = callback; + } + }, + + // JS端逻辑处理完成后,回调给Native的数据 + onResult: function(data){ + window.RPayPlus.send("jsCallback", data, null); + } + }; + }); \ No newline at end of file diff --git a/src/main/ui/static/lib/rpay/rrlogo.png b/src/main/ui/static/lib/rpay/rrlogo.png new file mode 100644 index 000000000..bd87d97d2 Binary files /dev/null and b/src/main/ui/static/lib/rpay/rrlogo.png differ diff --git a/src/main/ui/static/payment/partner/partner.js b/src/main/ui/static/payment/partner/partner.js index 12fe7c3ce..275b1190e 100644 --- a/src/main/ui/static/payment/partner/partner.js +++ b/src/main/ui/static/payment/partner/partner.js @@ -701,50 +701,128 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], funct }; $scope.myInterval = 2000; - $scope.first = true; + $scope.pcfirst = true; + $scope.bankfirst = true; + $scope.appfirst = true; $scope.active = 0; - $scope.show = false; - var slides = $scope.slides = []; - var addSlide = function () { - slides.push({ - image: '/static/images/hfpaylink_intro/hf_pay_step1.png', + $scope.pcshow = false; + $scope.appshow = false; + $scope.bankshow = false; + var slidesPc = $scope.slidesPc = []; + var slidesPcBank = $scope.slidesBank = []; + var slidesApp = $scope.slidesApp = []; + var addSlidePc = function () { + slidesPc.push({ + image: '/static/images/hfpaylink_intro/pc_hf_pay_step1.png', text: '第一次打开支付链接进行下单,第一步用微信扫码页面弹出的二维码,确认您的身份', id:0 }); - slides.push({ - image: '/static/images/hfpaylink_intro/hf_pay_step2.png', + slidesPc.push({ + image: '/static/images/hfpaylink_intro/pc_hf_pay_step2.png', text: '下一步,填写订单信息。注意订单金额货币单位是澳元(AUD)。请认真填写商品名称,否则可能导致交易不成功。填写完成,最后提交订单。', id:1 }); - slides.push({ - image: '/static/images/hfpaylink_intro/hf_pay_step3.png', - text: '跳转到汇付支付页面,选择您的支付方式,同时填写姓名、身份证、银行卡号、手机号信息,完成身份验证,最后点击“确认支付”', + slidesPc.push({ + image: '/static/images/hfpaylink_intro/pc_hf_pay_step3.png', + text: '页面显示支付二维码,使用相应的支付app进行扫码支付。如订单有误,请点击"返回上一步"修改订单。', id:2 }); - slides.push({ - image: '/static/images/hfpaylink_intro/hf_pay_step4.png', - text: '页面弹出支付二维码,使用相应的支付app进行扫码支付。', + slidesPc.push({ + image: '/static/images/hfpaylink_intro/hf_pay_end.png', + text: '完成支付,跳转到支付成功页面。', id:3 }); - slides.push({ - image: '/static/images/hfpaylink_intro/hf_pay_step5.png', + }; + var addSlidePcBank = function () { + slidesPcBank.push({ + image: '/static/images/hfpaylink_intro/pc_bank_hf_pay_step1.png', + text: '第一次打开支付链接进行下单,第一步用微信扫码页面弹出的二维码,确认您的身份', + id:0 + }); + slidesPcBank.push({ + image: '/static/images/hfpaylink_intro/pc_bank_hf_pay_step2.png', + text: '下一步,填写订单信息。注意订单金额货币单位是澳元(AUD)。请认真填写商品名称,否则可能导致交易不成功。填写完成,最后提交订单。', + id:1 + }); + slidesPcBank.push({ + image: '/static/images/hfpaylink_intro/pc_bank_hf_pay_step3.png', + text: '提交订单后,页面跳转到对应银行,请填写相关信息完成支付。', + id:2 + }); + slidesPcBank.push({ + image: '/static/images/hfpaylink_intro/hf_pay_end.png', text: '完成支付,跳转到支付成功页面。', - id:4 + id:3 + }); + }; + var addSlideApp = function () { + slidesApp.push({ + image: '/static/images/hfpaylink_intro/app_bank_hf_pay_step1.png', + text: '使用微信客户端,填写订单信息。注意订单金额货币单位是澳元(AUD)。请认真填写商品名称,否则可能导致交易不成功。填写完成,最后提交订单。', + id:0 + }); + slidesApp.push({ + image: '/static/images/hfpaylink_intro/app_bank_hf_pay_step2.png', + text: '提交订单后,页面跳转到汇付天下支付页面,请填写相关信息完成支付。', + id:1 }); }; - $scope.toFirst = function () { - if(!$scope.first) { + $scope.toPcFirst = function () { + $scope.reset(); + if(!$scope.pcfirst) { return; } - addSlide(); - $scope.first = false; + addSlidePc(); + $scope.pcfirst = false; }; - $scope.toShow = function () { - $scope.show = true; + $scope.toBankFirst = function () { + $scope.reset(); + if(!$scope.bankfirst) { + return; + } + addSlidePcBank(); + $scope.bankfirst = false; + }; + $scope.toAppFirst = function () { + $scope.reset(); + if(!$scope.appfirst) { + return; + } + addSlideApp(); + $scope.appfirst = false; + }; + + $scope.toPcShow = function () { + $scope.pcshow = true; + }; + $scope.toAppShow = function () { + $scope.appshow = true; }; + $scope.toBankShow = function () { + $scope.bankshow = true; + }; + $scope.toHide = function () { - $scope.show = false - } + $scope.pcshow = false; + $scope.bankshow = false; + $scope.appshow = false; + }; + + $scope.reset = function () { + slidesPc = $scope.slidesPc = []; + slidesPcBank = $scope.slidesBank = []; + slidesApp = $scope.slidesApp = []; + $scope.myInterval = 2000; + $scope.pcfirst = true; + $scope.bankfirst = true; + $scope.appfirst = true; + $scope.active = 0; + $scope.pcshow = false; + $scope.appshow = false; + $scope.bankshow = false; + }; + + }]); app.controller('clientPaymentMaterialCtrl', ['$scope', '$http', 'partner', function ($scope, $http, partner) { diff --git a/src/main/ui/static/payment/partner/templates/client_payment_info.html b/src/main/ui/static/payment/partner/templates/client_payment_info.html index b1c2ad043..534d6ca61 100644 --- a/src/main/ui/static/payment/partner/templates/client_payment_info.html +++ b/src/main/ui/static/payment/partner/templates/client_payment_info.html @@ -1,8 +1,8 @@