# Conflicts: # src/main/ui/static/payment/partner/partner-manage.jsmaster
@ -0,0 +1,20 @@
|
||||
package au.com.royalpay.payment.manage.mappers.system.aps;
|
||||
|
||||
import au.com.royalpay.payment.manage.merchants.entity.ApsConfigData;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper;
|
||||
import com.yixsoft.support.mybatis.autosql.annotations.AutoSql;
|
||||
import com.yixsoft.support.mybatis.autosql.annotations.SqlType;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@AutoMapper(tablename = "sys_client_aps_config", pkName = "id")
|
||||
public interface ApsConfigMapper {
|
||||
|
||||
@AutoSql(SqlType.SELECT)
|
||||
ApsConfigData findByClientId(@Param("client_id") String clientId);
|
||||
|
||||
@AutoSql(SqlType.INSERT)
|
||||
void saveApsConfigClientId(ApsConfigData apsConfigData);
|
||||
|
||||
void updateApsConfigClientId(JSONObject apsConfigData);
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package au.com.royalpay.payment.manage.merchants.core;
|
||||
|
||||
import au.com.royalpay.payment.manage.merchants.deacriptor.ApsConfigDescriptor;
|
||||
import au.com.royalpay.payment.manage.merchants.entity.ApsConfigData;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
public interface ApsConfigService {
|
||||
ApsConfigData getApsConfigByClientId(String clientId);
|
||||
|
||||
ApsConfigData saveApsConfigClientId(String managerId, String clientId, ApsConfigDescriptor apsConfigDescriptor);
|
||||
|
||||
ApsConfigData updateApsConfigClientId(String managerId,String clientId, JSONObject apsConfig);
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package au.com.royalpay.payment.manage.merchants.core.impls;
|
||||
|
||||
import au.com.royalpay.payment.manage.mappers.system.aps.ApsConfigMapper;
|
||||
import au.com.royalpay.payment.manage.merchants.core.ApsConfigService;
|
||||
import au.com.royalpay.payment.manage.merchants.deacriptor.ApsConfigDescriptor;
|
||||
import au.com.royalpay.payment.manage.merchants.entity.ApsConfigData;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Service
|
||||
public class ApsConfigServiceImpl implements ApsConfigService {
|
||||
|
||||
@Resource
|
||||
private ApsConfigMapper apsConfigMapper;
|
||||
|
||||
@Override
|
||||
public ApsConfigData getApsConfigByClientId(String clientId) {
|
||||
return apsConfigMapper.findByClientId(clientId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApsConfigData saveApsConfigClientId(String managerId, String clientId, ApsConfigDescriptor apsConfigDescriptor) {
|
||||
ApsConfigData apsConfigData = ApsConfigData.saveData(managerId, clientId, apsConfigDescriptor);
|
||||
apsConfigMapper.saveApsConfigClientId(apsConfigData);
|
||||
return apsConfigMapper.findByClientId(clientId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApsConfigData updateApsConfigClientId(String managerId, String clientId, JSONObject apsConfig) {
|
||||
apsConfig.put("clientId", clientId);
|
||||
apsConfig.put("modifier", managerId);
|
||||
apsConfigMapper.updateApsConfigClientId(apsConfig);
|
||||
return apsConfigMapper.findByClientId(clientId);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package au.com.royalpay.payment.manage.merchants.deacriptor;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class ApsConfigDescriptor {
|
||||
|
||||
private Boolean alipayCnSwitch = false;
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package au.com.royalpay.payment.manage.merchants.entity;
|
||||
|
||||
|
||||
import au.com.royalpay.payment.manage.merchants.deacriptor.ApsConfigDescriptor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class ApsConfigData implements Serializable {
|
||||
|
||||
private String id;
|
||||
|
||||
private String creator;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private String modifier;
|
||||
|
||||
private Date modifyTime;
|
||||
|
||||
private String clientId;
|
||||
|
||||
private Boolean enableAlipayAps;
|
||||
|
||||
private Boolean alipayCnSwitch;
|
||||
|
||||
public static ApsConfigData saveData(String managerId, String clientId, ApsConfigDescriptor apsConfigDescriptor) {
|
||||
return new ApsConfigData()
|
||||
.setClientId(clientId)
|
||||
.setId(UUID.randomUUID().toString().replace("-", ""))
|
||||
.setAlipayCnSwitch(apsConfigDescriptor.getAlipayCnSwitch())
|
||||
.setCreator(managerId)
|
||||
.setCreateTime(new Date());
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package au.com.royalpay.payment.manage.merchants.entity.impls;
|
||||
|
||||
import au.com.royalpay.payment.manage.merchants.entity.ClientModifyOperation;
|
||||
import au.com.royalpay.payment.tools.merchants.core.MerchantChannelPermissionResolver;
|
||||
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
|
||||
import au.com.royalpay.payment.tools.utils.JsonUtils;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class SwitchChannelPermissionModify extends ClientModifyOperation {
|
||||
private final MerchantInfoProvider mchInfoProvider;
|
||||
private final MerchantChannelPermissionResolver channelResolver;
|
||||
private final boolean enableFlag;
|
||||
|
||||
public SwitchChannelPermissionModify(JSONObject account, String clientMoniker, MerchantInfoProvider mchInfoProvider, MerchantChannelPermissionResolver channelResolver, boolean enableFlag) {
|
||||
super(account, clientMoniker);
|
||||
this.mchInfoProvider = mchInfoProvider;
|
||||
this.channelResolver = channelResolver;
|
||||
this.enableFlag = enableFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String business() {
|
||||
return (enableFlag ? "开启 " : "关闭 ") + "渠道[" + channelResolver.payChannel().getChannelCode() + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JSONObject getModifyResult() {
|
||||
return JsonUtils.newJson(json -> json.put("enable_" + channelResolver.payChannel().getChannelCode(), enableFlag + ""));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Consumer<JSONObject> getModifyProcess() {
|
||||
return client -> channelResolver.switchPermission(mchInfoProvider, client.getIntValue("client_id"), enableFlag);
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package au.com.royalpay.payment.manage.merchants.web;
|
||||
|
||||
import au.com.royalpay.payment.manage.merchants.core.ApsConfigService;
|
||||
import au.com.royalpay.payment.manage.merchants.deacriptor.ApsConfigDescriptor;
|
||||
import au.com.royalpay.payment.manage.merchants.entity.ApsConfigData;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/sys/partners/aps")
|
||||
public class ApsConfigController {
|
||||
|
||||
@Resource
|
||||
private ApsConfigService apsConfigService;
|
||||
|
||||
/**
|
||||
* 获取aps配置信息
|
||||
*
|
||||
* @param clientId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/{clientId}")
|
||||
public ApsConfigData getApsConfigByClientId(@PathVariable("clientId") String clientId) {
|
||||
return apsConfigService.getApsConfigByClientId(clientId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化aps配置
|
||||
*
|
||||
* @param clientId
|
||||
* @param apsConfigDescriptor
|
||||
* @return
|
||||
*/
|
||||
@ManagerMapping(value = "/{clientId}", method = RequestMethod.POST, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.SITE_MANAGER})
|
||||
public ApsConfigData saveApsConfigClientId(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable("clientId") String clientId, @RequestBody ApsConfigDescriptor apsConfigDescriptor) {
|
||||
return apsConfigService.saveApsConfigClientId(manager.getString("managerId"), clientId, apsConfigDescriptor);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改aps配置
|
||||
*
|
||||
* @param clientId
|
||||
* @param apsConfig
|
||||
* @return
|
||||
*/
|
||||
@ManagerMapping(value = "/{clientId}", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.SITE_MANAGER})
|
||||
public ApsConfigData updateApsConfigClientId(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable("clientId") String clientId, @RequestBody JSONObject apsConfig) {
|
||||
return apsConfigService.updateApsConfigClientId(manager.getString("managerId"), clientId, apsConfig);
|
||||
}
|
||||
}
|
@ -1,23 +1,23 @@
|
||||
app:
|
||||
wechatpay:
|
||||
api-host: https://apihk.mch.weixin.qq.com
|
||||
api-host: https://api.mch.weixin.qq.com
|
||||
merchants:
|
||||
'1307485301':
|
||||
app-id: wx703febcbd34dae38
|
||||
example-sub-merchant-id: 11755174
|
||||
key-file: classpath:apiclient_cert.p12
|
||||
key-file: /Users/qingjiaoxuan/extra/apiclient_cert.p12
|
||||
mch-key: 7e2d8c4aab15e4cabec1207ba79086b1
|
||||
merchant-id: 1307485301
|
||||
'1431999902':
|
||||
app-id: wx703febcbd34dae38
|
||||
example-sub-merchant-id: 42991963
|
||||
key-file: classpath:apiclient_new_cert.p12
|
||||
key-file: /Users/qingjiaoxuan/extra/apiclient_new_cert.p12
|
||||
mch-key: p3tgzrAJbe6eQrunbv8jb8gz5yXxvJdE
|
||||
merchant-id: 1431999902
|
||||
'1487387142':
|
||||
app-id: wx3e14d1144d898197
|
||||
example-sub-merchant-id: 117551742
|
||||
key-file: classpath:napclient_cert.p12
|
||||
key-file: /Users/qingjiaoxuan/extra/napclient_cert.p12
|
||||
mch-key: OuvLIL93STqFhTngNaBGT8751ZJn4FKL
|
||||
merchant-id: 1487387142
|
||||
mp-id: globalpay
|
||||
|
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.aps.ApsConfigMapper">
|
||||
|
||||
<resultMap type="au.com.royalpay.payment.manage.merchants.entity.ApsConfigData" id="ApsConfigResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="creator" column="creator"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="modifier" column="modifier"/>
|
||||
<result property="modifyTime" column="modify_time"/>
|
||||
<result property="enableAlipayAps" column="enable_alipayaps"/>
|
||||
<result property="alipayCnSwitch" column="alipay_cn_switch"/>
|
||||
<result property="clientId" column="client_id"/>
|
||||
</resultMap>
|
||||
|
||||
<update id="updateApsConfigClientId">
|
||||
UPDATE sys_client_aps_config SET modify_time = now(), modifier = #{modifier}
|
||||
<if test="alipayCnSwitch !=null">, alipay_cn_switch = #{alipayCnSwitch}</if>
|
||||
<if test="enableAlipayAps !=null">, enable_alipayaps = #{enableAlipayAps}</if>
|
||||
WHERE client_id = #{clientId}
|
||||
</update>
|
||||
|
||||
</mapper>
|
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 499 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 5.6 KiB |
@ -0,0 +1,285 @@
|
||||
<div class="content">
|
||||
<form novalidate name="subForm">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading" > {{title}}</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-horizontal">
|
||||
|
||||
<div class="form-group"
|
||||
ng-class="{'has-error':subForm.merchantDisplayName.$invalid && subForm.merchant_storename.$dirty}">
|
||||
<label class="control-label col-sm-4" for="merchantDisplayName_input">Merchant DisplayName</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" ng-model="subMerchantInfo.merchantDisplayName"
|
||||
type="text" name="merchantDisplayName" id="merchantDisplayName_input" required maxlength="64">
|
||||
<div ng-messages="subForm.merchantDisplayName.$error" ng-if="subForm.merchantDisplayName.$dirty">
|
||||
<p class="small text-danger" ng-message="required">Required Field</p>
|
||||
<p class="small text-danger" ng-message="maxlength">Length is more than 64</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--<div class="form-group"-->
|
||||
<!--ng-class="{'has-error':subForm.merchant_name.$invalid && subForm.merchant_name.$dirty}">-->
|
||||
<!--<label class="control-label col-sm-4">* Payment Type</label>-->
|
||||
<!--<div class="col-sm-8">-->
|
||||
<!--<span class="checkbox-inline">-->
|
||||
<!--<input type="checkbox" ng-model="subMerchantInfo.payment_type_online"> <p>Online Payment</p>-->
|
||||
<!--</span>-->
|
||||
<!--<span class="checkbox-inline">-->
|
||||
|
||||
<!--<input type="checkbox" ng-model="subMerchantInfo.business_type_offline"><p>Offline Payment</p>-->
|
||||
|
||||
<!--</span>-->
|
||||
<!--<span class="checkbox-inline">-->
|
||||
|
||||
<!--<input type="checkbox" ng-model="subMerchantInfo.business_type_agreement"><p>Agreement Payment</p>-->
|
||||
|
||||
<!--</span>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
|
||||
<div class="form-group"
|
||||
ng-class="{'has-error':partnerForm.alipay_category.$invalid && partnerForm.alipay_category.$dirty}">
|
||||
<label class="control-label col-sm-4"
|
||||
for="alipay_category">* Merchant MCC</label>
|
||||
<div class="col-sm-8" >
|
||||
<input class="form-control" id="alipay_category" required
|
||||
name="alipay_category" readonly
|
||||
ng-model="subMerchantInfo.alipayindustry|partner_alipay_industry"
|
||||
multi-level-select-popup="alipayMccCategory"
|
||||
on-select="onAlipayMccSelect($selected)"
|
||||
chose-one-level="false">
|
||||
<div ng-messages="partnerForm.alipay_category.$error"
|
||||
ng-if="partnerForm.alipay_category.$dirty">
|
||||
<p class="small text-danger" ng-message="required">Required
|
||||
Field</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group" ng-if="subMerchantInfo.online"
|
||||
ng-class="{'has-error':subForm.websites.$invalid && subForm.websites.$dirty}">
|
||||
<label class="control-label col-sm-4" for="websites_input">* Web site</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" ng-model="subMerchantInfo.website"
|
||||
type="text" name="websites" id="websites_input" required maxlength="1000">
|
||||
<div ng-messages="subForm.websites.$error" ng-if="subForm.websites.$dirty">
|
||||
<p class="small text-danger" ng-message="required">Required Field</p>
|
||||
<p class="small text-danger" ng-message="maxlength">Length is more than 1000</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" ng-if="subMerchantInfo.online"
|
||||
ng-class="{'has-error':subForm.websiteType.$invalid && subForm.websiteType.$dirty}">
|
||||
<label class="control-label col-sm-4">* WebsiteType</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio-inline">
|
||||
<input type="radio" name="websiteType" value="WEB" ng-model="subMerchantInfo.websiteType"/>
|
||||
<label>Web</label>
|
||||
</div>
|
||||
<div class="radio-inline">
|
||||
<input type="radio" name="websiteType" value="APP" ng-model="subMerchantInfo.websiteType"/>
|
||||
<label>App</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group"
|
||||
ng-class="{'has-error':subForm.legalName.$invalid && subForm.legalName.$dirty}">
|
||||
<label class="control-label col-sm-4" for="legalName_input">* Legal Name</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" ng-model="subMerchantInfo.legalName"
|
||||
type="text" name="legalName" id="legalName_input" required maxlength="256">
|
||||
<div ng-messages="subForm.legalName.$error" ng-if="subForm.legalName.$dirty">
|
||||
<p class="small text-danger" ng-message="required">Required Field</p>
|
||||
<p class="small text-danger" ng-message="maxlength">Length is more than 256</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group"
|
||||
ng-class="{'has-error':subForm.registrationType.$invalid && subForm.registrationType.$dirty}">
|
||||
<label class="control-label col-sm-4">* Registration Type</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio-inline">
|
||||
<input type="radio" name="registrationType" value="US_FEDERAL_EIN" ng-model="subMerchantInfo.registrationType"/>
|
||||
<label> (Employer Identification Number) EIN of US merchant.</label>
|
||||
</div>
|
||||
<div class="radio-inline">
|
||||
<input type="radio" name="registrationType" value="ENTERPRISE_REGISTRATION_NO" ng-model="subMerchantInfo.registrationType"/>
|
||||
<label>Merchant registration ID.</label>
|
||||
</div>
|
||||
<div class="radio-inline">
|
||||
<input type="radio" name="registrationType" value="INDEPENDENT_CONTRACTOR_LICENSE_NO" ng-model="subMerchantInfo.registrationType"/>
|
||||
<label>The license number of ride-share driver or taxi driver.</label>
|
||||
</div>
|
||||
<div class="radio-inline">
|
||||
<input type="radio" name="registrationType" value="OTHER_IDENTIFICATION_NO" ng-model="subMerchantInfo.registrationType"/>
|
||||
<label>Other registration type. </label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group"
|
||||
ng-class="{'has-error':subForm.registrationNo.$invalid && subForm.registrationNo.$dirty}">
|
||||
<label class="control-label col-sm-4" for="registrationNo_input">* Registration No</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" ng-model="subMerchantInfo.registrationNo"
|
||||
type="text" name="registrationNo" id="registrationNo_input" required maxlength="64">
|
||||
<div ng-messages="subForm.registrationNo.$error" ng-if="subForm.registrationNo.$dirty">
|
||||
<p class="small text-danger" ng-message="required">Required Field</p>
|
||||
<p class="small text-danger" ng-message="maxlength">Length is more than 64</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group"
|
||||
ng-class="{'has-error':subForm.registrationAddress.$invalid && subForm.registrationAddress.$dirty}">
|
||||
<label class="control-label col-sm-4" for="registrationAddress_input">* Registration Address</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" ng-model="subMerchantInfo.registrationAddress"
|
||||
type="text" name="registrationAddress" id="registrationAddress_input" required maxlength="256">
|
||||
<div ng-messages="subForm.registrationAddress.$error" ng-if="subForm.registrationAddress.$dirty">
|
||||
<p class="small text-danger" ng-message="required">Required Field</p>
|
||||
<p class="small text-danger" ng-message="maxlength">Length is more than 256</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- 店铺名称 -->
|
||||
<div class="form-group" ng-if="!subMerchantInfo.online"
|
||||
ng-class="{'has-error':subForm.storeName.$invalid && subForm.storeName.$dirty}">
|
||||
<label class="control-label col-sm-4" for="storeName_input">* Store Name</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" ng-model="subMerchantInfo.storeName"
|
||||
type="text" name="storeName" id="storeName_input" required maxlength="256">
|
||||
<div ng-messages="subForm.storeName.$error" ng-if="subForm.storeName.$dirty">
|
||||
<p class="small text-danger" ng-message="required">Required Field</p>
|
||||
<p class="small text-danger" ng-message="maxlength">Length is more than 256</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 店铺MCC -->
|
||||
<div class="form-group" ng-if="!subMerchantInfo.online"
|
||||
ng-class="{'has-error':partnerForm.storeMCC.$invalid && partnerForm.storeMCC.$dirty}">
|
||||
<label class="control-label col-sm-4"
|
||||
for="storeMCC">*Store MCC</label>
|
||||
<div class="col-sm-8" >
|
||||
<input class="form-control" id="storeMCC" required
|
||||
name="storeMCC" readonly
|
||||
ng-model="subMerchantInfo.storeMCC|partner_alipay_industry"
|
||||
multi-level-select-popup="alipayMccCategory"
|
||||
on-select="onAlipayStoreMccSelect($selected)"
|
||||
chose-one-level="false">
|
||||
<div ng-messages="partnerForm.storeMCC.$error"
|
||||
ng-if="partnerForm.storeMCC.$dirty">
|
||||
<p class="small text-danger" ng-message="required">Required
|
||||
Field</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- 商店地址-->
|
||||
<div class="form-group" ng-if="!subMerchantInfo.online"
|
||||
ng-class="{'has-error':subForm.storeAddress.$invalid && subForm.storeAddress.$dirty}">
|
||||
<label class="control-label col-sm-4" for="storeAddress_input">* Store Address</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" ng-model="subMerchantInfo.storeAddress"
|
||||
type="text" name="storeAddress" id="storeAddress_input" maxlength="256" required>
|
||||
<div ng-messages="subForm.storeAddress.$error" ng-if="subForm.storeAddress.$dirty">
|
||||
<p class="small text-danger" ng-message="required">Required Field</p>
|
||||
<p class="small text-danger" ng-message="maxlength">Length is more than 256</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group"
|
||||
ng-class="{'has-error':subForm.businessType.$invalid && subForm.businessType.$dirty}">
|
||||
<label class="control-label col-sm-4"
|
||||
for="businessType_select">* Business Type</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control" ng-model="subMerchantInfo.businessType"
|
||||
id="businessType_select"
|
||||
name="businessType" required>
|
||||
<option value="">Please Choose</option>
|
||||
<option value="ENTERPRISE" >ENTERPRISE</option>
|
||||
<option value="INDIVIDUAL">INDIVIDUAL</option>
|
||||
</select>
|
||||
<div ng-messages="subForm.businessType.$error" ng-if="subForm.businessType.$dirty">
|
||||
<p class="small text-danger" ng-message="required">Required Field</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--ng-if="subMerchantInfo.businessType == 'ENTERPRISE'"-->
|
||||
<div class="form-group" ng-if="subMerchantInfo.businessType == 'ENTERPRISE'"
|
||||
ng-class="{'has-error':subForm.shareholderName.$invalid && subForm.shareholderName.$dirty}">
|
||||
<label class="control-label col-sm-4" for="shareholderName_input">Shareholder Name</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" ng-model="subMerchantInfo.shareholderName"
|
||||
type="text" name="shareholderName" id="shareholderName_input" maxlength="128">
|
||||
<div ng-messages="subForm.shareholderName.$error" ng-if="subForm.shareholderName.$dirty">
|
||||
<p class="small text-danger" ng-message="required">Required Field</p>
|
||||
<p class="small text-danger" ng-message="maxlength">Length is more than 128</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" ng-if="subMerchantInfo.businessType == 'ENTERPRISE'"
|
||||
ng-class="{'has-error':subForm.shareholderId.$invalid && subForm.shareholderId.$dirty}">
|
||||
<label class="control-label col-sm-4" for="shareholderId_input">Shareholder Id</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" ng-model="subMerchantInfo.shareholderId"
|
||||
type="text" name="shareholderId" id="shareholderId_input" maxlength="128">
|
||||
<div ng-messages="subForm.shareholderId.$error" ng-if="subForm.shareholderId.$dirty">
|
||||
<p class="small text-danger" ng-message="required">Required Field</p>
|
||||
<p class="small text-danger" ng-message="maxlength">Length is more than 128</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" ng-if="subMerchantInfo.businessType == 'INDIVIDUAL'"
|
||||
ng-class="{'has-error':subForm.representativeName.$invalid && subForm.representativeName.$dirty}">
|
||||
<label class="control-label col-sm-4" for="representativeName_input">Representative Name</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" ng-model="subMerchantInfo.representativeName"
|
||||
type="text" name="representativeName" id="representativeName_input" maxlength="128">
|
||||
<div ng-messages="subForm.representativeName.$error" ng-if="subForm.representativeName.$dirty">
|
||||
<p class="small text-danger" ng-message="required">Required Field</p>
|
||||
<p class="small text-danger" ng-message="maxlength">Length is more than 128</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" ng-if="subMerchantInfo.businessType == 'INDIVIDUAL'"
|
||||
ng-class="{'has-error':subForm.representativeId.$invalid && subForm.representativeId.$dirty}">
|
||||
<label class="control-label col-sm-4" for="representativeId_input">Representative Id</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" ng-model="subMerchantInfo.representativeId"
|
||||
type="text" name="representativeId" id="representativeId_input" maxlength="128">
|
||||
<div ng-messages="subForm.representativeId.$error" ng-if="subForm.representativeId.$dirty">
|
||||
<p class="small text-danger" ng-message="required">Required Field</p>
|
||||
<p class="small text-danger" ng-message="maxlength">Length is more than 128</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="btn-group margin-bottom margin-top">
|
||||
<button class="btn btn-success" type="button"
|
||||
ng-click="saveAlipayApply(subForm)">Submit
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
@ -0,0 +1,152 @@
|
||||
<div class="modal-header">
|
||||
<h4>New Alipay+ APS Rate</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="alert alert-danger" ng-if="errmsg" ng-bind="errmsg"></div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<form class="form-horizontal" novalidate name="rate_form">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4">Clear Days</label>
|
||||
<div class="col-sm-6">
|
||||
<div class="input-group">
|
||||
<select class="form-control" ng-model="rate.clean_days" id="citySelect" ng-change="changeDays()">
|
||||
<option value="1">T+1</option>
|
||||
<option value="2">T+2</option>
|
||||
<option value="3">T+3</option>
|
||||
</select>
|
||||
<div>{{rateConfig}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- retail interchange fee -->
|
||||
<div class="form-group"
|
||||
ng-class="{'has-error':rate_from.retail_interchange_fee_value.$invalid && rate_from.retail_interchange_fee_value.$dirty}">
|
||||
<label class="control-label col-sm-4" for="retail_interchange_fee_value_input">Retail Interchange Fee</label>
|
||||
<div class="col-sm-6">
|
||||
<div class="input-group">
|
||||
<input type="number" name="retail_interchange_fee_value" stringToNumber2 class="form-control" ng-model="rate.retail_interchange_fee_value"
|
||||
min="0.6" max="10" step="0.1" id="retail_interchange_fee_value_input" required>
|
||||
<div class="input-group-addon">%</div>
|
||||
</div>
|
||||
<div ng-messages="rate_from.retail_interchange_fee_value.$error" ng-if="rate_from.retail_interchange_fee_value.$dirty">
|
||||
<div class="small text-danger" ng-message="max">
|
||||
<i class="glyphicon glyphicon-alert"></i> No more than 10.0%
|
||||
</div>
|
||||
<div class="small text-danger" ng-message="min">
|
||||
<i class="glyphicon glyphicon-alert"></i> No less than 0.6%
|
||||
</div>
|
||||
<div class="small text-danger" ng-message="required">
|
||||
<i class="glyphicon glyphicon-alert"></i> Required Field
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- retail service fee -->
|
||||
<div class="form-group"
|
||||
ng-class="{'has-error':rate_from.retail_service_fee_value.$invalid && rate_from.retail_service_fee_value.$dirty}">
|
||||
<label class="control-label col-sm-4" for="retail_service_fee_value_input">Retail Service Fee</label>
|
||||
<div class="col-sm-6">
|
||||
<div class="input-group">
|
||||
<input type="number" name="retail_service_fee_value" stringToNumber2 class="form-control" ng-model="rate.retail_service_fee_value"
|
||||
min="0.6" max="10" step="0.1" id="retail_service_fee_value_input" required>
|
||||
<div class="input-group-addon">%</div>
|
||||
</div>
|
||||
<div ng-messages="rate_from.retail_service_fee_value.$error" ng-if="rate_from.retail_service_fee_value.$dirty">
|
||||
<div class="small text-danger" ng-message="max">
|
||||
<i class="glyphicon glyphicon-alert"></i> No more than 10.0%
|
||||
</div>
|
||||
<div class="small text-danger" ng-message="min">
|
||||
<i class="glyphicon glyphicon-alert"></i> No less than 0.6%
|
||||
</div>
|
||||
<div class="small text-danger" ng-message="required">
|
||||
<i class="glyphicon glyphicon-alert"></i> Required Field
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- online interchange fee -->
|
||||
<div class="form-group"
|
||||
ng-class="{'has-error':rate_from.online_interchange_fee_value.$invalid && rate_from.online_interchange_fee_value.$dirty}">
|
||||
<label class="control-label col-sm-4" for="online_interchange_fee_value_input">Online Interchange Fee</label>
|
||||
<div class="col-sm-6">
|
||||
<div class="input-group">
|
||||
<input type="number" name="online_interchange_fee_value" stringToNumber2 class="form-control" ng-model="rate.online_interchange_fee_value"
|
||||
min="0.6" max="10" step="0.1" id="online_interchange_fee_value_input" required>
|
||||
<div class="input-group-addon">%</div>
|
||||
</div>
|
||||
<div ng-messages="rate_from.online_interchange_fee_value.$error" ng-if="rate_from.online_interchange_fee_value.$dirty">
|
||||
<div class="small text-danger" ng-message="max">
|
||||
<i class="glyphicon glyphicon-alert"></i> No more than 10.0%
|
||||
</div>
|
||||
<div class="small text-danger" ng-message="min">
|
||||
<i class="glyphicon glyphicon-alert"></i> No less than 0.6%
|
||||
</div>
|
||||
<div class="small text-danger" ng-message="required">
|
||||
<i class="glyphicon glyphicon-alert"></i> Required Field
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- online service fee -->
|
||||
<div class="form-group"
|
||||
ng-class="{'has-error':rate_from.online_service_fee_value.$invalid && rate_from.online_service_fee_value.$dirty}">
|
||||
<label class="control-label col-sm-4" for="online_service_fee_value_input">Online Service Fee</label>
|
||||
<div class="col-sm-6">
|
||||
<div class="input-group">
|
||||
<input type="number" name="online_service_fee_value" stringToNumber2 class="form-control" ng-model="rate.online_service_fee_value"
|
||||
min="0.6" max="10" step="0.1" id="online_service_fee_value_input" required>
|
||||
<div class="input-group-addon">%</div>
|
||||
</div>
|
||||
<div ng-messages="rate_from.online_service_fee_value.$error" ng-if="rate_from.online_service_fee_value.$dirty">
|
||||
<div class="small text-danger" ng-message="max">
|
||||
<i class="glyphicon glyphicon-alert"></i> No more than 10.0%
|
||||
</div>
|
||||
<div class="small text-danger" ng-message="min">
|
||||
<i class="glyphicon glyphicon-alert"></i> No less than 0.6%
|
||||
</div>
|
||||
<div class="small text-danger" ng-message="required">
|
||||
<i class="glyphicon glyphicon-alert"></i> Required Field
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" for="active_time_input">Active Date</label>
|
||||
<div class="col-sm-6">
|
||||
<input class="form-control" ng-model="rate.active_time" id="active_time_input"
|
||||
uib-datepicker-popup size="10" placeholder="Active Date"
|
||||
is-open="activeDate.open" ng-click="activeDate.open=true"
|
||||
datepicker-options="{maxDate:rate.expiry_time}" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" for="expire_time_input">Expire Date</label>
|
||||
<div class="col-sm-6">
|
||||
<input class="form-control" ng-model="rate.expiry_time" id="expire_time_input"
|
||||
uib-datepicker-popup size="10" placeholder="Expire Date"
|
||||
is-open="expireDate.open" ng-click="expireDate.open=true"
|
||||
datepicker-options="{minDate:rate.active_time}" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" for="remark_text">Remark</label>
|
||||
<div class="col-sm-6">
|
||||
<input class="form-control" ng-model="rate.remark" id="remark_text" type="text">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-success" type="button" ng-click="saveRate(rate_form)" ng-disabled="ctrl.sending">Submit</button>
|
||||
<button class="btn btn-danger" type="button" ng-click="$dismiss()">Cancel</button>
|
||||
</div>
|
@ -0,0 +1,73 @@
|
||||
$(document).ready(function (){
|
||||
|
||||
decode();
|
||||
|
||||
function decode() {
|
||||
if (window.client_moniker == 'PINE') {
|
||||
alert('debug:origin redirect:' + window.redirect);
|
||||
}
|
||||
let redirect = window.redirect;
|
||||
if (window.redirect !=null) {
|
||||
while (redirect.indexOf('://') < 0) {
|
||||
redirect = decodeURIComponent(redirect);
|
||||
if (redirect == window.redirect) {
|
||||
break;
|
||||
}
|
||||
window.redirect = redirect;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
let dataCache = {paying: false};
|
||||
$('#key_P').bind('touchstart', startPay);
|
||||
function startPay() {
|
||||
$('#wdiv').show();
|
||||
if (dataCache.paying) {
|
||||
return;
|
||||
}
|
||||
dataCache.paying = true;
|
||||
|
||||
$.ajax({
|
||||
url: './preorder',
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
success: function (pay) {
|
||||
if (pay.direct_paid) {
|
||||
startCheckOrder(window.client_moniker, window.merchant_orderid);
|
||||
return;
|
||||
}
|
||||
if (pay.mweb_url){
|
||||
location.href = pay.mweb_url
|
||||
}
|
||||
|
||||
},
|
||||
error: function (jqXhr) {
|
||||
alert(jqXhr.responseJSON.message);
|
||||
$('#wdiv').hide();
|
||||
dataCache.paying = false;
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
function startCheckOrder(clientMoniker, merchantOrderId) {
|
||||
function checkOrderStd() {
|
||||
$.ajax({
|
||||
url: '/api/v1.0/payment/clients/' + clientMoniker + '/orders/' + merchantOrderId + '/status',
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.paid) {
|
||||
location.href = window.redirect + (window.redirect.indexOf('?') < 0 ? '?' : '&') + 'success=true&time=' + res.time + '&nonce_str=' + res.nonce_str + '&sign=' + res.sign;
|
||||
} else {
|
||||
setTimeout(checkOrderStd, 500);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
checkOrderStd();
|
||||
}
|
||||
})
|
@ -0,0 +1,444 @@
|
||||
/**
|
||||
* Created by yixian on 2017-05-08
|
||||
*/
|
||||
$(function () {
|
||||
'use strict';
|
||||
// document.querySelector('body').addEventListener('touchmove', function (e) {
|
||||
// if (!document.querySelector('.coupons').contains(e.target)) {
|
||||
// e.preventDefault();
|
||||
// }
|
||||
// })
|
||||
var dataCache = {price: '0', coupons: [], coupon_groups: {}};
|
||||
var exchangeRate = parseFloat(window.exchange_rate);
|
||||
|
||||
if (window.AlipayJSBridge) {
|
||||
AlipayJSBridge.call('hideOptionMenu');
|
||||
} else {
|
||||
document.addEventListener('AlipayJSBridgeReady', function () {
|
||||
AlipayJSBridge.call('hideOptionMenu');
|
||||
}, false);
|
||||
}
|
||||
dataCache.paying = false;
|
||||
var ctrl = {};
|
||||
|
||||
$('.ff.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);
|
||||
|
||||
var price = surchargeData.newPrice || realPrice;
|
||||
var priceBeforeDiscount = price;
|
||||
dataCache.discounts = [];
|
||||
dataCache.tax = surchargeData.tax;
|
||||
dataCache.surcharge = surchargeData.surcharge;
|
||||
|
||||
$(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) {
|
||||
$('<textarea rows="2" autofocus="autofocus"></textarea>').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' ? '$' : '¥';
|
||||
$('<p></p>').html('Input Price 输入金额:' + currencySymbol + dataCache.price).appendTo(bd);
|
||||
if (parseFloat(dataCache.customSurcharge) > 0) {
|
||||
$('<p></p>').html('Surcharge 手续费(' + window.rateValue + '%):+' + currencySymbol + dataCache.customSurcharge).appendTo(bd);
|
||||
$('<p></p>').addClass('warning-sm').html('温馨提示:商户将向您收取本次消费手续费' + window.rateValue + '%').appendTo(bd);
|
||||
}
|
||||
$(dataCache.discounts).each(function () {
|
||||
$('<p></p>').html(this.title + ':-' + currencySymbol + this.amount).appendTo(bd);
|
||||
});
|
||||
$('<p></p>').addClass('final').html('Final 支付金额:' + currencySymbol + (dataCache.finalPrice || 0)).appendTo(bd);
|
||||
}
|
||||
};
|
||||
showWeuiDialog(config);
|
||||
});
|
||||
|
||||
$('#key_P').click(function () {
|
||||
if (window.requireRemark) {
|
||||
if (!dataCache.remark) {
|
||||
var config = {
|
||||
title: '请先输入备注',
|
||||
template: ''
|
||||
};
|
||||
showWeuiDialog(config);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$('#key_P').bind('touchstart', function () {
|
||||
if (window.requireRemark) {
|
||||
if (!dataCache.remark) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
$('#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;
|
||||
data.qrcodeVersion = window.qrcodeVersion;
|
||||
|
||||
$.ajax({
|
||||
url: '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders',
|
||||
method: 'POST',
|
||||
data: JSON.stringify(data),
|
||||
contentType: 'application/json',
|
||||
dataType: 'json',
|
||||
success: function (pay) {
|
||||
if (pay.direct_paid) {
|
||||
location.href = '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result';
|
||||
return;
|
||||
}
|
||||
if (pay.mweb_url){
|
||||
location.href = pay.mweb_url;
|
||||
return;
|
||||
}
|
||||
if (window.AlipayJSBridge) {
|
||||
callPayment();
|
||||
} else {
|
||||
// 如果没有注入则监听注入的事件
|
||||
document.addEventListener('AlipayJSBridgeReady', callPayment, false);
|
||||
}
|
||||
|
||||
function callPayment() {
|
||||
try {
|
||||
AlipayJSBridge.call('tradePay', {
|
||||
tradeNO: pay.trade_no
|
||||
}, function (res) {
|
||||
dataCache.paying = false;
|
||||
if (res.resultCode == '9000') {
|
||||
AlipayJSBridge.call('startApp', {
|
||||
appId: '20000056',
|
||||
param: {
|
||||
actionType: 'showSuccPage',
|
||||
payResult: res.result
|
||||
},
|
||||
closeCurrentApp: false
|
||||
});
|
||||
startCheckOrder(pay.order_id, '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result');
|
||||
} else if (res.resultCode == '6001') {
|
||||
//do nothing
|
||||
} else {
|
||||
if (res.memo) {
|
||||
weuiAlert(res.memo);
|
||||
}
|
||||
}
|
||||
$('#key_P').removeClass('hidden');
|
||||
$('#key_Loading').addClass('hidden');
|
||||
})
|
||||
} catch (err) {
|
||||
weuiAlert(err)
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (jqXhr) {
|
||||
weuiAlert(jqXhr.responseJSON.message);
|
||||
$('#key_P').removeClass('hidden');
|
||||
$('#key_Loading').addClass('hidden');
|
||||
dataCache.paying = false;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
function startCheckOrder(orderId, url) {
|
||||
function checkOrderStd() {
|
||||
$.ajax({
|
||||
url: '/api/v1.0/payment/orders/' + orderId + '/status',
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.paid) {
|
||||
location.href = url;
|
||||
} else {
|
||||
setTimeout(checkOrderStd, 500);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
checkOrderStd();
|
||||
}
|
||||
|
||||
function weuiAlert(msg) {
|
||||
var config = {
|
||||
template: msg
|
||||
};
|
||||
showWeuiDialog(config);
|
||||
}
|
||||
|
||||
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 = $("<div></div>", {class: 'weui_dialog_confirm'});
|
||||
var mask = $('<div></div>', {class: 'weui_mask'}).appendTo(dialog);
|
||||
if (config.backdrop) {
|
||||
mask.click(function () {
|
||||
dialog.remove();
|
||||
if ($.isFunction(config.dismiss)) {
|
||||
config.dismiss();
|
||||
}
|
||||
})
|
||||
}
|
||||
var dialogBox = $("<div></div>", {class: 'weui_dialog'}).appendTo(dialog);
|
||||
if (config.title) {
|
||||
$('<div></div>', {class: 'weui_dialog_hd'}).append($('<strong></strong>', {class: 'weui_dialog_title'}).html(config.title)).appendTo(dialogBox);
|
||||
}
|
||||
var dialogBody = $("<div></div>", {class: 'weui_dialog_bd'}).appendTo(dialogBox);
|
||||
if (template) {
|
||||
dialogBody.append(template);
|
||||
}
|
||||
if ($.isFunction(config.initialize)) {
|
||||
config.initialize(dialog);
|
||||
}
|
||||
var ft = $('<div class="weui_dialog_ft"></div>').appendTo(dialogBox);
|
||||
if(window.paypad_version !== 'v3'){
|
||||
if ($.isFunction(config.confirm)) {
|
||||
var yes = $('<a></a>', {
|
||||
class: 'weui_btn_dialog primary',
|
||||
text: 'OK',
|
||||
style: 'background: #108ee9;color: #fff;'
|
||||
}).appendTo(ft);
|
||||
yes.click(function () {
|
||||
config.confirm(dialog, true);
|
||||
dialog.remove();
|
||||
});
|
||||
var no = $('<a></a>', {class: 'weui_btn_dialog default', text: 'Cancel'}).appendTo(ft);
|
||||
no.click(function () {
|
||||
config.confirm(dialog, false);
|
||||
dialog.remove();
|
||||
})
|
||||
} else {
|
||||
var ok = $('<a></a>', {
|
||||
class: 'weui_btn_dialog primary',
|
||||
text: 'OK',
|
||||
style: 'background: #108ee9;color: #fff;'
|
||||
}).appendTo(ft);
|
||||
ok.click(function () {
|
||||
dialog.remove();
|
||||
})
|
||||
}
|
||||
}else{
|
||||
if ($.isFunction(config.confirm)) {
|
||||
var yes = $('<a></a>', {
|
||||
class: 'weui_btn_dialog primary',
|
||||
text: 'OK',
|
||||
style: 'background: #FF9705;color: #fff;'
|
||||
}).appendTo(ft);
|
||||
yes.click(function () {
|
||||
config.confirm(dialog, true);
|
||||
dialog.remove();
|
||||
});
|
||||
var no = $('<a></a>', {class: 'weui_btn_dialog default', text: 'Cancel'}).appendTo(ft);
|
||||
no.click(function () {
|
||||
config.confirm(dialog, false);
|
||||
dialog.remove();
|
||||
})
|
||||
} else {
|
||||
var ok = $('<a></a>', {
|
||||
class: 'weui_btn_dialog primary',
|
||||
text: 'OK',
|
||||
style: 'background: #FF9705;color: #fff;'
|
||||
}).appendTo(ft);
|
||||
ok.click(function () {
|
||||
dialog.remove();
|
||||
})
|
||||
}
|
||||
}
|
||||
dialog.appendTo($('body'));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
@ -0,0 +1,488 @@
|
||||
/**
|
||||
* Created by yixian on 2017-05-08
|
||||
*/
|
||||
var num = function(obj){
|
||||
obj.value = obj.value.replace(/[^\d.]/g,""); //清除"数字"和"."以外的字符
|
||||
obj.value = obj.value.replace(/^\./g,""); //验证第一个字符是数字
|
||||
obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个, 清除多余的
|
||||
obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
|
||||
obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3'); //只能输入两个小数
|
||||
};
|
||||
|
||||
$(function () {
|
||||
'use strict';
|
||||
// document.querySelector('body').addEventListener('touchmove', function(e) {
|
||||
// if (!document.querySelector('.coupons').contains(e.target)) {
|
||||
// e.preventDefault();
|
||||
// }
|
||||
// });
|
||||
var dataCache = {price: '0', coupons: [], coupon_groups: {}};
|
||||
var exchangeRate = parseFloat(window.exchange_rate);
|
||||
|
||||
if (window.AlipayJSBridge) {
|
||||
AlipayJSBridge.call('hideOptionMenu');
|
||||
} else {
|
||||
document.addEventListener('AlipayJSBridgeReady', function () {
|
||||
AlipayJSBridge.call('hideOptionMenu');
|
||||
}, false);
|
||||
}
|
||||
dataCache.paying = false;
|
||||
var ctrl = {};
|
||||
|
||||
$('.ff.key').bind('touchstart', function () {
|
||||
if (dataCache.paying) {
|
||||
return;
|
||||
}
|
||||
var char = $(this).attr('data-char');
|
||||
appendChar(char);
|
||||
});
|
||||
|
||||
$('#audVal').bind('input porpertychange', function () {
|
||||
if (dataCache.paying) {
|
||||
return;
|
||||
}
|
||||
var char = $(this).val();
|
||||
if (parseFloat(char) >= 100000) {
|
||||
char = char.slice(0, char.length - 1);
|
||||
$(this).val(char);
|
||||
return;
|
||||
}
|
||||
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();
|
||||
}
|
||||
});
|
||||
$('.cb_bankpay').click(function () {
|
||||
$.ajax({
|
||||
url: '/sys/partners/' + window.client_moniker + '/jump/link',
|
||||
method: 'GET',
|
||||
success: function (res) {
|
||||
location.href = res;
|
||||
},
|
||||
error: function (resp) {
|
||||
var config = {
|
||||
template: resp
|
||||
};
|
||||
showWeuiDialog(config);
|
||||
}
|
||||
})
|
||||
});
|
||||
$('#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);
|
||||
|
||||
var price = surchargeData.newPrice || realPrice;
|
||||
var priceBeforeDiscount = price;
|
||||
dataCache.discounts = [];
|
||||
dataCache.tax = surchargeData.tax;
|
||||
dataCache.surcharge = surchargeData.surcharge;
|
||||
$(window.coupons).each(function () {
|
||||
price = this.handleDiscount(price, dataCache.price, dataCache.discounts, dataCache.coupons);
|
||||
});
|
||||
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_FLOOR);
|
||||
dataCache.currencyPrice = 'CNY' == window.currency ? Decimal.div(priceBeforeDiscount, exchangeRate).toFixed(2, Decimal.ROUND_FLOOR) : priceBeforeDiscount;
|
||||
$('#cnyVal').html(cnyVal)
|
||||
}
|
||||
|
||||
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) {
|
||||
if (char == "") {
|
||||
char = '0';
|
||||
}
|
||||
var check = /[^\d.]/g;
|
||||
if (check.test(char)) {
|
||||
return;
|
||||
}
|
||||
var tmpChar = (char.split('.')).length-1;
|
||||
if (tmpChar > 1) {
|
||||
return;
|
||||
}
|
||||
var pointLocation = dataCache.price.indexOf('.');
|
||||
if (char == '.' || char.length > 8) {
|
||||
return;
|
||||
}
|
||||
if (pointLocation >= 0 && pointLocation <= char.length - 4) {
|
||||
return;
|
||||
}
|
||||
if (dataCache.price == '0' && char != '.') {
|
||||
dataCache.price = '';
|
||||
}
|
||||
dataCache.price = char;
|
||||
updatePrice();
|
||||
updatePoundageStatus();
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
$('#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) {
|
||||
$('<textarea rows="2" autofocus="autofocus"></textarea>').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 == 'CNY' ? '¥' : '$';
|
||||
$('<p></p>').html('Input Price 输入金额:' + currencySymbol + dataCache.price).appendTo(bd);
|
||||
if (parseFloat(dataCache.surcharge) > 0) {
|
||||
$('<p></p>').html('Surcharge 手续费(' + window.rateValue + '%):+' + currencySymbol + dataCache.surcharge).appendTo(bd);
|
||||
}
|
||||
if (parseFloat(dataCache.tax) > 0) {
|
||||
$('<p></p>').html('GST(10%):' + currencySymbol + dataCache.tax).appendTo(bd);
|
||||
}
|
||||
$(dataCache.discounts).each(function () {
|
||||
$('<p></p>').html(this.title + ':-' + currencySymbol + this.amount).appendTo(bd);
|
||||
});
|
||||
$('<p></p>').addClass('final').html('Final 支付金额:' + currencySymbol + (dataCache.finalPrice || 0)).appendTo(bd);
|
||||
}
|
||||
};
|
||||
showWeuiDialog(config);
|
||||
});
|
||||
|
||||
$('#key_P').click(function () {
|
||||
dataCache.remark = $('.remark-textarea-new').val();
|
||||
if (window.requireRemark) {
|
||||
if (!dataCache.remark) {
|
||||
var config = {
|
||||
title: '请先输入备注',
|
||||
template: ''
|
||||
};
|
||||
showWeuiDialog(config);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$('#key_P').bind('touchstart', function () {
|
||||
dataCache.remark = $('.remark-textarea-new').val();
|
||||
if (window.requireRemark) {
|
||||
if (!dataCache.remark) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
$('#key_P_div').addClass('hidden');
|
||||
$('#key_Loading_div').removeClass('hidden');
|
||||
if (dataCache.paying) {
|
||||
return;
|
||||
}
|
||||
dataCache.paying = true;
|
||||
var data = {price: dataCache.price + '', 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;
|
||||
data.qrcodeVersion = window.qrcodeVersion;
|
||||
$.ajax({
|
||||
url: '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders',
|
||||
method: 'POST',
|
||||
data: JSON.stringify(data),
|
||||
contentType: 'application/json',
|
||||
dataType: 'json',
|
||||
success: function (pay) {
|
||||
if (pay.direct_paid) {
|
||||
location.href = '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result';
|
||||
return;
|
||||
}
|
||||
if (pay.mweb_url){
|
||||
location.href = pay.mweb_url;
|
||||
return;
|
||||
}
|
||||
if (window.AlipayJSBridge) {
|
||||
callPayment();
|
||||
} else {
|
||||
// 如果没有注入则监听注入的事件
|
||||
document.addEventListener('AlipayJSBridgeReady', callPayment, false);
|
||||
}
|
||||
|
||||
function callPayment() {
|
||||
try {
|
||||
AlipayJSBridge.call('tradePay', {
|
||||
tradeNO: pay.trade_no
|
||||
}, function (res) {
|
||||
dataCache.paying = false;
|
||||
if (res.resultCode == '9000') {
|
||||
AlipayJSBridge.call('startApp', {
|
||||
appId: '20000056',
|
||||
param: {
|
||||
actionType: 'showSuccPage',
|
||||
payResult: res.result
|
||||
},
|
||||
closeCurrentApp: false
|
||||
});
|
||||
startCheckOrder(pay.order_id, '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result');
|
||||
} else if (res.resultCode == '6001') {
|
||||
//do nothing
|
||||
} else {
|
||||
if (res.memo) {
|
||||
weuiAlert(res.memo);
|
||||
}
|
||||
}
|
||||
$('#key_P_div').removeClass('hidden');
|
||||
$('#key_Loading_div').addClass('hidden');
|
||||
})
|
||||
} catch (err) {
|
||||
weuiAlert(err)
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (jqXhr) {
|
||||
weuiAlert(jqXhr.responseJSON.message);
|
||||
$('#key_P_div').removeClass('hidden');
|
||||
$('#key_Loading_div').addClass('hidden');
|
||||
dataCache.paying = false;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
function startCheckOrder(orderId, url) {
|
||||
function checkOrderStd() {
|
||||
$.ajax({
|
||||
url: '/api/v1.0/payment/orders/' + orderId + '/status',
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.paid) {
|
||||
location.href = url;
|
||||
} else {
|
||||
setTimeout(checkOrderStd, 500);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
checkOrderStd();
|
||||
}
|
||||
|
||||
function weuiAlert(msg) {
|
||||
var config = {
|
||||
template: msg
|
||||
};
|
||||
showWeuiDialog(config);
|
||||
}
|
||||
|
||||
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 = $("<div></div>", {class: 'weui_dialog_confirm'});
|
||||
var mask = $('<div></div>', {class: 'weui_mask'}).appendTo(dialog);
|
||||
if (config.backdrop) {
|
||||
mask.click(function () {
|
||||
dialog.remove();
|
||||
if ($.isFunction(config.dismiss)) {
|
||||
config.dismiss();
|
||||
}
|
||||
})
|
||||
}
|
||||
var dialogBox = $("<div></div>", {class: 'weui_dialog'}).appendTo(dialog);
|
||||
if (config.title) {
|
||||
$('<div></div>', {class: 'weui_dialog_hd'}).append($('<strong></strong>', {class: 'weui_dialog_title'}).html(config.title)).appendTo(dialogBox);
|
||||
}
|
||||
var dialogBody = $("<div></div>", {class: 'weui_dialog_bd'}).appendTo(dialogBox);
|
||||
if (template) {
|
||||
dialogBody.append(template);
|
||||
}
|
||||
if ($.isFunction(config.initialize)) {
|
||||
config.initialize(dialog);
|
||||
}
|
||||
var ft = $('<div class="weui_dialog_ft"></div>').appendTo(dialogBox);
|
||||
if(window.paypad_version !== 'v3'){
|
||||
if ($.isFunction(config.confirm)) {
|
||||
var yes = $('<a></a>', {
|
||||
class: 'weui_btn_dialog primary',
|
||||
text: 'OK',
|
||||
style: 'background: #0bb20c;color: #fff;'
|
||||
}).appendTo(ft);
|
||||
yes.click(function () {
|
||||
config.confirm(dialog, true);
|
||||
dialog.remove();
|
||||
});
|
||||
var no = $('<a></a>', {class: 'weui_btn_dialog default', text: 'Cancel'}).appendTo(ft);
|
||||
no.click(function () {
|
||||
config.confirm(dialog, false);
|
||||
dialog.remove();
|
||||
})
|
||||
} else {
|
||||
var ok = $('<a></a>', {
|
||||
class: 'weui_btn_dialog primary',
|
||||
text: 'OK',
|
||||
style: 'background: #0bb20c;color: #fff;'
|
||||
}).appendTo(ft);
|
||||
ok.click(function () {
|
||||
dialog.remove();
|
||||
})
|
||||
}
|
||||
} else {
|
||||
if ($.isFunction(config.confirm)) {
|
||||
var yes = $('<a></a>', {
|
||||
class: 'weui_btn_dialog primary',
|
||||
text: 'OK',
|
||||
style: 'background: #FF9705;color: #fff;'
|
||||
}).appendTo(ft);
|
||||
yes.click(function () {
|
||||
config.confirm(dialog, true);
|
||||
dialog.remove();
|
||||
});
|
||||
var no = $('<a></a>', {class: 'weui_btn_dialog default', text: 'Cancel'}).appendTo(ft);
|
||||
no.click(function () {
|
||||
config.confirm(dialog, false);
|
||||
dialog.remove();
|
||||
})
|
||||
} else {
|
||||
var ok = $('<a></a>', {
|
||||
class: 'weui_btn_dialog primary',
|
||||
text: 'OK',
|
||||
style: 'background: #FF9705;color: #fff;'
|
||||
}).appendTo(ft);
|
||||
ok.click(function () {
|
||||
dialog.remove();
|
||||
})
|
||||
}
|
||||
}
|
||||
dialog.appendTo($('body'));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
@ -0,0 +1,452 @@
|
||||
/**
|
||||
* Created by yixian on 2017-05-08
|
||||
*/
|
||||
|
||||
$(function () {
|
||||
'use strict';
|
||||
// document.querySelector('body').addEventListener('touchmove', function(e) {
|
||||
// if (!document.querySelector('.coupons').contains(e.target)) {
|
||||
// e.preventDefault();
|
||||
// }
|
||||
// });
|
||||
var dataCache = {price: '0', coupons: [], coupon_groups: {}};
|
||||
var exchangeRate = 'CNY' == window.currency ? 1 : parseFloat(window.exchange_rate);
|
||||
dataCache.paying = false;
|
||||
var ctrl = {};
|
||||
|
||||
if (window.AlipayJSBridge) {
|
||||
AlipayJSBridge.call('hideOptionMenu');
|
||||
} else {
|
||||
document.addEventListener('AlipayJSBridgeReady', function () {
|
||||
AlipayJSBridge.call('hideOptionMenu');
|
||||
}, false);
|
||||
}
|
||||
dataCache.paying = false;
|
||||
var ctrl = {};
|
||||
|
||||
$('.ff.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();
|
||||
}
|
||||
});
|
||||
$('.cb_bankpay').click(function () {
|
||||
$.ajax({
|
||||
url: '/sys/partners/' + window.client_moniker + '/jump/link',
|
||||
method: 'GET',
|
||||
success: function (res) {
|
||||
location.href = res;
|
||||
},
|
||||
error: function (resp) {
|
||||
var config = {
|
||||
template: resp
|
||||
};
|
||||
showWeuiDialog(config);
|
||||
}
|
||||
})
|
||||
});
|
||||
$('#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);
|
||||
|
||||
var price = surchargeData.newPrice || realPrice;
|
||||
var priceBeforeDiscount = price;
|
||||
dataCache.discounts = [];
|
||||
dataCache.tax = surchargeData.tax;
|
||||
dataCache.surcharge = surchargeData.surcharge;
|
||||
$(window.coupons).each(function () {
|
||||
price = this.handleDiscount(price, dataCache.price, dataCache.discounts, dataCache.coupons);
|
||||
});
|
||||
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_FLOOR);
|
||||
dataCache.currencyPrice = 'CNY' == window.currency ? Decimal.div(priceBeforeDiscount, exchangeRate).toFixed(2, Decimal.ROUND_FLOOR) : priceBeforeDiscount;
|
||||
$('#cnyVal').html(cnyVal)
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
$('#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');
|
||||
});
|
||||
|
||||
$('.paydetail').click(function () {
|
||||
var config = {
|
||||
title: 'Payment Detail',
|
||||
template: '',
|
||||
initialize: function (dialog) {
|
||||
var bd = $('.weui_dialog_bd', dialog);
|
||||
var currencySymbol = window.currency == 'CNY' ? '¥' : '$';
|
||||
$('<p></p>').html('Input Price 输入金额:' + currencySymbol + dataCache.price).appendTo(bd);
|
||||
if (parseFloat(dataCache.surcharge) > 0) {
|
||||
$('<p></p>').html('Surcharge 手续费(' + window.rateValue + '%):+' + currencySymbol + dataCache.surcharge).appendTo(bd);
|
||||
}
|
||||
if (parseFloat(dataCache.tax) > 0) {
|
||||
$('<p></p>').html('GST(10%):' + currencySymbol + dataCache.tax).appendTo(bd);
|
||||
}
|
||||
$(dataCache.discounts).each(function () {
|
||||
$('<p></p>').html(this.title + ':-' + currencySymbol + this.amount).appendTo(bd);
|
||||
});
|
||||
$('<p></p>').addClass('final').html('Final 支付金额:' + currencySymbol + (dataCache.finalPrice || 0)).appendTo(bd);
|
||||
}
|
||||
};
|
||||
showWeuiDialog(config);
|
||||
});
|
||||
|
||||
$('#key_P').click(function () {
|
||||
if (window.requireRemark) {
|
||||
if (!dataCache.remark) {
|
||||
var config = {
|
||||
title: '请先输入备注',
|
||||
template: ''
|
||||
};
|
||||
showWeuiDialog(config);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
function addBlurListen() {
|
||||
$('.remark-input').on('blur', function (event) {
|
||||
dataCache.remark = $('textarea[name="remark"]').val();
|
||||
});
|
||||
}
|
||||
addBlurListen();
|
||||
|
||||
$('#audVal').bind('DOMNodeInserted', function(e) {
|
||||
if(dataCache.price==0){
|
||||
$('.pay_button').css({"background-color":"#eee",}).attr('disabled',true);
|
||||
$('.bank_button').css({"background-color":"#eee",}).attr('disabled',true);
|
||||
}else{
|
||||
$('.pay_button').css({"background-color":"#108ee9",}).attr('disabled',false);
|
||||
$('.bank_button').css({"background-color":"#FF6600",}).attr('disabled',false);
|
||||
}
|
||||
});
|
||||
$('#key_P').bind('touchstart', function () {
|
||||
if (window.requireRemark) {
|
||||
if ($('textarea[name="remark"]').val()=="") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
$('#key_P').addClass('hidden');
|
||||
$('#key_Loading').removeClass('hidden');
|
||||
if (dataCache.paying) {
|
||||
return;
|
||||
}
|
||||
dataCache.paying = true;
|
||||
var data = {price: dataCache.price + '', 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;
|
||||
data.qrcodeVersion = window.qrcodeVersion;
|
||||
$.ajax({
|
||||
url: '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders',
|
||||
method: 'POST',
|
||||
data: JSON.stringify(data),
|
||||
contentType: 'application/json',
|
||||
dataType: 'json',
|
||||
success: function (pay) {
|
||||
if (pay.direct_paid) {
|
||||
location.href = '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result';
|
||||
return;
|
||||
}
|
||||
if (pay.mweb_url){
|
||||
location.href = pay.mweb_url;
|
||||
return;
|
||||
}
|
||||
if (window.AlipayJSBridge) {
|
||||
callPayment();
|
||||
} else {
|
||||
// 如果没有注入则监听注入的事件
|
||||
document.addEventListener('AlipayJSBridgeReady', callPayment, false);
|
||||
}
|
||||
|
||||
function callPayment() {
|
||||
try {
|
||||
AlipayJSBridge.call('tradePay', {
|
||||
tradeNO: pay.trade_no
|
||||
}, function (res) {
|
||||
dataCache.paying = false;
|
||||
if (res.resultCode == '9000') {
|
||||
AlipayJSBridge.call('startApp', {
|
||||
appId: '20000056',
|
||||
param: {
|
||||
actionType: 'showSuccPage',
|
||||
payResult: res.result
|
||||
},
|
||||
closeCurrentApp: false
|
||||
});
|
||||
startCheckOrder(pay.order_id, '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result');
|
||||
} else if (res.resultCode == '6001') {
|
||||
//do nothing
|
||||
} else {
|
||||
if (res.memo) {
|
||||
weuiAlert(res.memo);
|
||||
}
|
||||
}
|
||||
$('#key_P_div').removeClass('hidden');
|
||||
$('#key_Loading_div').addClass('hidden');
|
||||
})
|
||||
} catch (err) {
|
||||
weuiAlert(err)
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (jqXhr) {
|
||||
weuiAlert(jqXhr.responseJSON.message);
|
||||
$('#key_P_div').removeClass('hidden');
|
||||
$('#key_Loading_div').addClass('hidden');
|
||||
dataCache.paying = false;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
function startCheckOrder(orderId, url) {
|
||||
function checkOrderStd() {
|
||||
$.ajax({
|
||||
url: '/api/v1.0/payment/orders/' + orderId + '/status',
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.paid) {
|
||||
location.href = url;
|
||||
} else {
|
||||
setTimeout(checkOrderStd, 500);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
checkOrderStd();
|
||||
}
|
||||
|
||||
function weuiAlert(msg) {
|
||||
var config = {
|
||||
template: msg
|
||||
};
|
||||
showWeuiDialog(config);
|
||||
}
|
||||
|
||||
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 = $("<div></div>", {class: 'weui_dialog_confirm'});
|
||||
var mask = $('<div></div>', {class: 'weui_mask'}).appendTo(dialog);
|
||||
if (config.backdrop) {
|
||||
mask.click(function () {
|
||||
dialog.remove();
|
||||
if ($.isFunction(config.dismiss)) {
|
||||
config.dismiss();
|
||||
}
|
||||
})
|
||||
}
|
||||
var dialogBox = $("<div></div>", {class: 'weui_dialog'}).appendTo(dialog);
|
||||
if (config.title) {
|
||||
$('<div></div>', {class: 'weui_dialog_hd'}).append($('<strong></strong>', {class: 'weui_dialog_title'}).html(config.title)).appendTo(dialogBox);
|
||||
}
|
||||
var dialogBody = $("<div></div>", {class: 'weui_dialog_bd'}).appendTo(dialogBox);
|
||||
if (template) {
|
||||
dialogBody.append(template);
|
||||
}
|
||||
if ($.isFunction(config.initialize)) {
|
||||
config.initialize(dialog);
|
||||
}
|
||||
var ft = $('<div class="weui_dialog_ft"></div>').appendTo(dialogBox);
|
||||
if(window.paypad_version !== 'v3'){
|
||||
if ($.isFunction(config.confirm)) {
|
||||
var yes = $('<a></a>', {
|
||||
class: 'weui_btn_dialog primary',
|
||||
text: 'OK',
|
||||
style: 'background: #0bb20c;color: #fff;'
|
||||
}).appendTo(ft);
|
||||
yes.click(function () {
|
||||
config.confirm(dialog, true);
|
||||
dialog.remove();
|
||||
});
|
||||
var no = $('<a></a>', {class: 'weui_btn_dialog default', text: 'Cancel'}).appendTo(ft);
|
||||
no.click(function () {
|
||||
config.confirm(dialog, false);
|
||||
dialog.remove();
|
||||
})
|
||||
} else {
|
||||
var ok = $('<a></a>', {
|
||||
class: 'weui_btn_dialog primary',
|
||||
text: 'OK',
|
||||
style: 'background: #0bb20c;color: #fff;'
|
||||
}).appendTo(ft);
|
||||
ok.click(function () {
|
||||
dialog.remove();
|
||||
})
|
||||
}
|
||||
} else {
|
||||
if ($.isFunction(config.confirm)) {
|
||||
var yes = $('<a></a>', {
|
||||
class: 'weui_btn_dialog primary',
|
||||
text: 'OK',
|
||||
style: 'background: #FF9705;color: #fff;'
|
||||
}).appendTo(ft);
|
||||
yes.click(function () {
|
||||
config.confirm(dialog, true);
|
||||
dialog.remove();
|
||||
});
|
||||
var no = $('<a></a>', {class: 'weui_btn_dialog default', text: 'Cancel'}).appendTo(ft);
|
||||
no.click(function () {
|
||||
config.confirm(dialog, false);
|
||||
dialog.remove();
|
||||
})
|
||||
} else {
|
||||
var ok = $('<a></a>', {
|
||||
class: 'weui_btn_dialog primary',
|
||||
text: 'OK',
|
||||
style: 'background: #FF9705;color: #fff;'
|
||||
}).appendTo(ft);
|
||||
ok.click(function () {
|
||||
dialog.remove();
|
||||
})
|
||||
}
|
||||
}
|
||||
dialog.appendTo($('body'));
|
||||
addBlurListen();
|
||||
}
|
||||
|
||||
}
|
||||
});
|