fix(shop): 修正小程序系统客服复选框状态处理逻辑
修复复选框默认值处理问题,确保未选中时能正确提交0值。同时优化相关注释描述。
This commit is contained in:
@@ -153,7 +153,7 @@
|
|||||||
<div class="layui-form-item weapp-system-service" {if !in_array($config.weapp.type, ['aikefu', 'wxwork', 'miniprogram'])} style="display: none" {/if}>
|
<div class="layui-form-item weapp-system-service" {if !in_array($config.weapp.type, ['aikefu', 'wxwork', 'miniprogram'])} style="display: none" {/if}>
|
||||||
<label class="layui-form-label">附加设置:</label>
|
<label class="layui-form-label">附加设置:</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<input type="checkbox" name="weapp[show_system_service]" value="1" lay-skin="primary" title="同时显示小程序系统客服" {if !isset($config.weapp.show_system_service) || !empty($config.weapp.show_system_service) && $config.weapp.show_system_service == 1} checked {/if}>
|
<input type="checkbox" name="weapp[show_system_service]" value="1" lay-skin="primary" title="同时显示小程序系统客服" {if isset($config.weapp.show_system_service) && $config.weapp.show_system_service == 1} checked {/if}>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="weapp-wrap wxwork" {if $config.weapp.type != 'wxwork'} style="display: none" {/if}>
|
<div class="weapp-wrap wxwork" {if $config.weapp.type != 'wxwork'} style="display: none" {/if}>
|
||||||
@@ -182,7 +182,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label">小程序页面路径:</label>
|
<label class="layui-form-label"><span class="required">*</span>小程序页面路径:</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<input type="text" class="layui-input len-mid" name="weapp[page_path]" value="{$config.weapp.page_path ?? ''}" lay-verify="weappPagepath">
|
<input type="text" class="layui-input len-mid" name="weapp[page_path]" value="{$config.weapp.page_path ?? ''}" lay-verify="weappPagepath">
|
||||||
</div>
|
</div>
|
||||||
@@ -337,7 +337,7 @@
|
|||||||
$('.weapp-system-service').show();
|
$('.weapp-system-service').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 为复选框添加value属性
|
// 确保复选框有正确的value属性
|
||||||
$('[name="weapp[show_system_service]"]').val('1');
|
$('[name="weapp[show_system_service]"]').val('1');
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -348,6 +348,11 @@
|
|||||||
if (repeat_flag) return false;
|
if (repeat_flag) return false;
|
||||||
repeat_flag = true;
|
repeat_flag = true;
|
||||||
|
|
||||||
|
// 确保复选框的状态能正确提交
|
||||||
|
if (!data.field['weapp[show_system_service]']) {
|
||||||
|
data.field['weapp[show_system_service]'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: ns.url("shop/config/servicer"),
|
url: ns.url("shop/config/servicer"),
|
||||||
data: data.field,
|
data: data.field,
|
||||||
|
|||||||
Reference in New Issue
Block a user