Update payment.html

This commit is contained in:
Anyon 2020-03-27 14:30:41 +08:00
parent 2686b24568
commit 5ffb8152f6

View File

@ -56,28 +56,22 @@
{block name="script"} {block name="script"}
<script> <script>
(new function () { (new function () {
form.render();
this.type = "{:sysconf('wechat.mch_ssl_type')}" || 'pem'; this.type = "{:sysconf('wechat.mch_ssl_type')}" || 'pem';
form.val('payment', {"wechat.mch_ssl_type": this.type});
form.on('radio(data-mch-type)', function (data) {
apply(data.value);
});
apply.call(this, this.type);
// 证书文件上传控制
this.types = ['wechat.mch_ssl_p12', 'wechat.mch_ssl_key', 'wechat.mch_ssl_cer']; this.types = ['wechat.mch_ssl_p12', 'wechat.mch_ssl_key', 'wechat.mch_ssl_cer'];
for (var i in this.types) $('input[name="' + this.types[i] + '"]').on('change', function (that, $button) { layui.form.render(), layui.form.val('payment', {"wechat.mch_ssl_type": this.type});
that = this, $button = $(this).next('button'); layui.form.on('radio(data-mch-type)', apply), apply.call(this, {value: this.type});
setTimeout(function () { for (this.index in this.types) $('input[name="' + this.types[this.index] + '"]').on('change', function (that) {
that = this, that.$button = $(this).next('button'), setTimeout(function () {
if (typeof that.value === 'string' && that.value.length > 5) { if (typeof that.value === 'string' && that.value.length > 5) {
$button.find('i').addClass('color-green layui-icon-vercode').removeClass('layui-icon-upload-drag'); that.$button.find('i').addClass('color-green layui-icon-vercode').removeClass('layui-icon-upload-drag');
} else { } else {
$button.find('i').removeClass('color-green layui-icon-vercode').addClass('layui-icon-upload-drag'); that.$button.find('i').removeClass('color-green layui-icon-vercode').addClass('layui-icon-upload-drag');
} }
}, 300); }, 100);
}).trigger('change'); }).trigger('change');
function apply(type) { function apply(data) {
$('[data-mch-type="' + type + '"]').show().siblings('[data-mch-type]').hide(); $('[data-mch-type="' + data.value + '"]').show().siblings('[data-mch-type]').hide();
} }
}); });
</script> </script>