nickchange
2023-11-01 bbee9271b06ede8c00f795be690835e28a142d4a
cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCouponInfo.js
@@ -395,15 +395,18 @@
    if ($('#userType').val()==1){
    // 兑换方式
    let exchangeMethod = $(':radio[name="exchangeMethod"]:checked').val();
    if (exchangeMethod === '' || exchangeMethod === undefined || exchangeMethod === null){
        return Feng.error('兑换方式不能为空');
    if (distributionMethod === '1') {
        if (exchangeMethod === '' || exchangeMethod === undefined || exchangeMethod === null) {
            return Feng.error('兑换方式不能为空');
        }
    }
    if (exchangeMethod === '1'){
    if (exchangeMethod === '1' ){
        if (requiredPoints === undefined || requiredPoints === '' || requiredPoints === null){
            return Feng.error('所需积分不能为空');
        }
    }
    if (exchangeMethod === '2'){
    if (exchangeMethod === '2' && distributionMethod === '1'){
        if (requiredPoints === undefined || requiredPoints === '' || requiredPoints === null){
            return Feng.error('所需积分不能为空');
        }
@@ -411,7 +414,7 @@
            return Feng.error('所需现金不能为空');
        }
    }
    if (exchangeMethod === '3'){
    if (exchangeMethod === '3' && distributionMethod === '1'){
        if (requiredCash === undefined || requiredCash === '' || requiredCash === null){
            return Feng.error('所需现金不能为空');
        }
@@ -520,6 +523,9 @@
$(function () {
    getProvince(null);
    radio1();
    var OBJradio = document.getElementsByName("prescription")
@@ -604,4 +610,34 @@
        $('#app1').show();
        // 适用范围
    }
    const distributionMethodOptions = document.getElementsByName('distributionMethod');
// 监听distributionMethod选项的变化
    for (let i = 0; i < distributionMethodOptions.length; i++) {
        distributionMethodOptions[i].addEventListener('change', function() {
            // 获取选中的distributionMethod值
            const selectedDistributionMethod = document.querySelector('input[name="distributionMethod"]:checked').value;
            // 判断选中的值是否不等于1
            if (selectedDistributionMethod !== '1') {
                console.log("已经选择1")
                // 隐藏exchangeType
                document.getElementById('exchangeType').style.display = 'none';
                document.getElementById('needAmount').style.display = 'none';
                document.getElementById('needIntegral').style.display = 'none';
            } else {
                // 显示exchangeType
                document.getElementById('exchangeType').style.display = 'block';
                document.getElementById('needAmount').style.display = 'block';
                document.getElementById('needIntegral').style.display = 'block';
            }
        });
    }
});