修复内容
This commit is contained in:
@@ -298,43 +298,86 @@
|
||||
|
||||
setSelectFirst();
|
||||
function setSelectFirst(default_id) {
|
||||
console.log('setSelectFirst 被调用,default_id:', default_id);
|
||||
var category_select_html = '<option value="">请选择分类</option>';
|
||||
var foundMatch = false;
|
||||
for (var i in categorys) {
|
||||
if (categorys[i]['level'] == 1) {
|
||||
category_select_html += '<option value="' + categorys[i]['id'] + '">' + categorys[i]['name'] + '</option>';
|
||||
var selected = '';
|
||||
if (default_id && String(categorys[i]['id']) == String(default_id)) {
|
||||
selected = ' selected';
|
||||
foundMatch = true;
|
||||
console.log('找到匹配的省份:', categorys[i]['name'], 'ID:', categorys[i]['id']);
|
||||
}
|
||||
category_select_html += '<option value="' + categorys[i]['id'] + '"' + selected + '>' + categorys[i]['name'] + '</option>';
|
||||
}
|
||||
}
|
||||
$('select[name="first_category_id"]').html(category_select_html);
|
||||
$('select[name="first_category_id"]').val(default_id);
|
||||
if (default_id) {
|
||||
$('select[name="first_category_id"]').val(String(default_id));
|
||||
console.log('设置省份值:', String(default_id), '是否找到匹配:', foundMatch);
|
||||
}
|
||||
form.render('select');
|
||||
}
|
||||
function setSelectSecond(default_id, parent_id) {
|
||||
console.log('setSelectSecond 被调用,default_id:', default_id, 'parent_id:', parent_id);
|
||||
parent_id = parent_id === undefined ? $('select[name="first_category_id"]').val() : parent_id;
|
||||
if (!parent_id) {
|
||||
console.log('setSelectSecond: parent_id 为空,返回');
|
||||
return;
|
||||
}
|
||||
parent_id = String(parent_id);
|
||||
$('select[name="second_category_id"]').html('<option value="">请选择分类</option>');
|
||||
$('select[name="third_category_id"]').html('<option value="">请选择分类</option>');
|
||||
var category_select_html = '<option value="">请选择分类</option>';
|
||||
var foundMatch = false;
|
||||
|
||||
for (var i in categorys) {
|
||||
if (categorys[i]['parent_id'] == parent_id) {
|
||||
category_select_html += '<option value="' + categorys[i]['id'] + '">' + categorys[i]['name'] + '</option>';
|
||||
if (String(categorys[i]['parent_id']) == parent_id) {
|
||||
var selected = '';
|
||||
if (default_id && String(categorys[i]['id']) == String(default_id)) {
|
||||
selected = ' selected';
|
||||
foundMatch = true;
|
||||
console.log('找到匹配的城市:', categorys[i]['name'], 'ID:', categorys[i]['id']);
|
||||
}
|
||||
category_select_html += '<option value="' + categorys[i]['id'] + '"' + selected + '>' + categorys[i]['name'] + '</option>';
|
||||
}
|
||||
}
|
||||
$('select[name="second_category_id"]').html(category_select_html);
|
||||
$('select[name="second_category_id"]').val(default_id);
|
||||
if (default_id) {
|
||||
$('select[name="second_category_id"]').val(String(default_id));
|
||||
console.log('设置城市值:', String(default_id), '是否找到匹配:', foundMatch);
|
||||
}
|
||||
form.render('select');
|
||||
}
|
||||
function setSelectThird(default_id, parent_id) {
|
||||
console.log('setSelectThird 被调用,default_id:', default_id, 'parent_id:', parent_id);
|
||||
parent_id = parent_id === undefined ? $('select[name="second_category_id"]').val() : parent_id;
|
||||
if (!parent_id) {
|
||||
console.log('setSelectThird: parent_id 为空,返回');
|
||||
return;
|
||||
}
|
||||
parent_id = String(parent_id);
|
||||
$('select[name="third_category_id"]').html('<option value="">请选择分类</option>');
|
||||
var first_category_id = $('select[name="first_category_id"]').val();
|
||||
var category_select_html = '<option value="">请选择分类</option>';
|
||||
var foundMatch = false;
|
||||
|
||||
for (var i in categorys) {
|
||||
if (categorys[i]['parent_id'] == parent_id) {
|
||||
category_select_html += '<option value="' + categorys[i]['id'] + '">' + categorys[i]['name'] + '</option>';
|
||||
if (String(categorys[i]['parent_id']) == parent_id) {
|
||||
var selected = '';
|
||||
if (default_id && String(categorys[i]['id']) == String(default_id)) {
|
||||
selected = ' selected';
|
||||
foundMatch = true;
|
||||
console.log('找到匹配的区县:', categorys[i]['name'], 'ID:', categorys[i]['id']);
|
||||
}
|
||||
category_select_html += '<option value="' + categorys[i]['id'] + '"' + selected + '>' + categorys[i]['name'] + '</option>';
|
||||
}
|
||||
}
|
||||
$('select[name="third_category_id"]').html(category_select_html);
|
||||
$('select[name="third_category_id"]').val(default_id);
|
||||
if (default_id) {
|
||||
$('select[name="third_category_id"]').val(String(default_id));
|
||||
console.log('设置区县值:', String(default_id), '是否找到匹配:', foundMatch);
|
||||
}
|
||||
form.render('select');
|
||||
}
|
||||
|
||||
@@ -465,7 +508,7 @@
|
||||
}
|
||||
{notempty name='info'}
|
||||
var goods_info= {$info|raw|default=''};
|
||||
console.log(goods_info);
|
||||
console.log('订单数据:', goods_info);
|
||||
$('input[name="id"]').val(goods_info['id']);
|
||||
$('input[name="address"]').val(goods_info['address']);
|
||||
$('input[name="total_amount"]').val(goods_info['total_amount']);
|
||||
@@ -474,9 +517,89 @@
|
||||
$('input[name="phone"]').val(goods_info['mobile']);
|
||||
$('input[name="store_latitude"]').val(goods_info['lng']);
|
||||
$('input[name="store_longitude"]').val(goods_info['lat']);
|
||||
setSelectFirst(goods_info['province']);
|
||||
setSelectSecond(goods_info['city']);
|
||||
setSelectThird(goods_info['district']);
|
||||
|
||||
// 设置地区选择器,根据返回的 province、city、district 字段
|
||||
// 注意:需要检查值是否存在,包括0的情况(0是有效的ID值)
|
||||
var province_id = '';
|
||||
var city_id = '';
|
||||
var district_id = '';
|
||||
|
||||
// 检查province字段(包括0值)
|
||||
if (goods_info['province'] !== undefined && goods_info['province'] !== null && goods_info['province'] !== '') {
|
||||
province_id = goods_info['province'];
|
||||
}
|
||||
// 检查city字段(包括0值)
|
||||
if (goods_info['city'] !== undefined && goods_info['city'] !== null && goods_info['city'] !== '') {
|
||||
city_id = goods_info['city'];
|
||||
}
|
||||
// 检查district字段(包括0值)
|
||||
if (goods_info['district'] !== undefined && goods_info['district'] !== null && goods_info['district'] !== '') {
|
||||
district_id = goods_info['district'];
|
||||
}
|
||||
|
||||
console.log('地区数据:', {
|
||||
province: goods_info['province'],
|
||||
city: goods_info['city'],
|
||||
district: goods_info['district'],
|
||||
province_id: province_id,
|
||||
city_id: city_id,
|
||||
district_id: district_id
|
||||
});
|
||||
|
||||
// 初始化地区选择器的函数
|
||||
function initRegionSelectors() {
|
||||
if (province_id !== '') {
|
||||
// 转换为字符串,确保类型匹配
|
||||
province_id = String(province_id);
|
||||
|
||||
// 先设置省份
|
||||
setSelectFirst(province_id);
|
||||
|
||||
// 等待省份选择器渲染完成后再设置城市
|
||||
setTimeout(function() {
|
||||
// 验证省份值是否设置成功
|
||||
var selectedProvince = $('select[name="first_category_id"]').val();
|
||||
console.log('已选省份ID:', selectedProvince, '期望:', province_id);
|
||||
|
||||
if (city_id !== '' && selectedProvince == province_id) {
|
||||
city_id = String(city_id);
|
||||
setSelectSecond(city_id, province_id);
|
||||
|
||||
// 等待城市选择器渲染完成后再设置区县
|
||||
setTimeout(function() {
|
||||
// 验证城市值是否设置成功
|
||||
var selectedCity = $('select[name="second_category_id"]').val();
|
||||
console.log('已选城市ID:', selectedCity, '期望:', city_id);
|
||||
|
||||
if (district_id !== '' && selectedCity == city_id) {
|
||||
district_id = String(district_id);
|
||||
setSelectThird(district_id, city_id);
|
||||
|
||||
setTimeout(function() {
|
||||
var selectedDistrict = $('select[name="third_category_id"]').val();
|
||||
console.log('已选区县ID:', selectedDistrict, '期望:', district_id);
|
||||
// 最后重新渲染一次,确保所有选择器都正确显示
|
||||
form.render('select');
|
||||
}, 100);
|
||||
} else {
|
||||
form.render('select');
|
||||
}
|
||||
}, 300);
|
||||
} else {
|
||||
form.render('select');
|
||||
}
|
||||
}, 300);
|
||||
} else {
|
||||
form.render('select');
|
||||
}
|
||||
}
|
||||
|
||||
// 延迟执行,确保页面完全加载和选择器初始化完成
|
||||
setTimeout(function() {
|
||||
console.log('开始初始化地区选择器...');
|
||||
initRegionSelectors();
|
||||
}, 200);
|
||||
|
||||
setBrand(goods_info['channel_id']); //部门的修改
|
||||
setBrandss(goods_info['gord_id']); //部门的修改
|
||||
|
||||
|
||||
@@ -73,12 +73,19 @@
|
||||
height: 62px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
/* 退款状态标红样式 */
|
||||
.refund-status-row {
|
||||
background-color: #ffebee !important;
|
||||
/* 退款中状态绿色背景 */
|
||||
.refunding-row {
|
||||
background-color: #c8e6c9 !important;
|
||||
}
|
||||
.refund-status-row:hover {
|
||||
background-color: #ffcdd2 !important;
|
||||
.refunding-row:hover {
|
||||
background-color: #a5d6a7 !important;
|
||||
}
|
||||
/* 同意退款后淡绿色背景 */
|
||||
.order-status-4-row {
|
||||
background-color: #e8f5e9 !important;
|
||||
}
|
||||
.order-status-4-row:hover {
|
||||
background-color: #c8e6c9 !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -206,6 +213,7 @@
|
||||
<li data-type="1">已支付</li>
|
||||
<li data-type="2">已退款</li>
|
||||
<li data-type="3">拒退款</li>
|
||||
<li data-type="66">已删除</li>
|
||||
</ul>
|
||||
|
||||
<div class="layui-tab-item layui-show">
|
||||
@@ -338,7 +346,11 @@
|
||||
<a class="layui-btn-primary layui-btn-sm" lay-event="channel" style="display: inline-block;">渠道</a>
|
||||
<a class="layui-btn layui-btn-primary layui-btn-sm operation-btn" lay-event="remarks">备注</a>
|
||||
<a class="layui-btn-primary layui-btn-sm" style="display: inline-block;" lay-event="allocation"> 分配</a>
|
||||
{{# if(d.del == 0){ }}
|
||||
<a class="layui-btn layui-btn-primary layui-btn-sm operation-btn" style="display: inline-block;background-color:#fd4634;color:#fff" lay-event="cancel">删除</a>
|
||||
{{# } else { }}
|
||||
<a class="layui-btn layui-btn-primary layui-btn-sm operation-btn" style="display: inline-block;background-color:#1E9FFF;color:#fff" lay-event="recover">恢复</a>
|
||||
{{# } }}
|
||||
{{# if(d.order_status == 1){ }}
|
||||
<a class="layui-btn-primary layui-btn-sm" style="display: inline-block;" lay-event="delivery">发货</a>
|
||||
{{# } }}
|
||||
@@ -637,19 +649,36 @@
|
||||
$($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height());
|
||||
});
|
||||
|
||||
// 如果 refund_status > 0,整行标红显示
|
||||
// 如果 order_status == 4(同意退款),整行淡绿色显示
|
||||
// 如果 refund_status > 0 但 order_status != 4(退款中),整行绿色显示
|
||||
if (res && res.data && res.data.length > 0) {
|
||||
res.data.forEach(function(item, index) {
|
||||
if (item.refund_status && parseInt(item.refund_status) > 0) {
|
||||
// 给主表格行添加红色背景
|
||||
var orderStatus = item.order_status ? parseInt(item.order_status) : 0;
|
||||
var refundStatus = item.refund_status ? parseInt(item.refund_status) : 0;
|
||||
|
||||
// 同意退款后,order_status == 4,显示淡绿色
|
||||
if (orderStatus == 4) {
|
||||
// 给主表格行添加淡绿色背景
|
||||
var $mainRow = $(".layui-table-main tbody tr").eq(index);
|
||||
$mainRow.addClass('refund-status-row');
|
||||
$mainRow.addClass('order-status-4-row');
|
||||
|
||||
// 给固定列的行也添加红色背景
|
||||
// 给固定列的行也添加淡绿色背景
|
||||
var $fixedLeftRow = $(".layui-table-fixed-l .layui-table-body tbody tr").eq(index);
|
||||
var $fixedRightRow = $(".layui-table-fixed-r .layui-table-body tbody tr").eq(index);
|
||||
$fixedLeftRow.addClass('refund-status-row');
|
||||
$fixedRightRow.addClass('refund-status-row');
|
||||
$fixedLeftRow.addClass('order-status-4-row');
|
||||
$fixedRightRow.addClass('order-status-4-row');
|
||||
}
|
||||
// 退款中,refund_status > 0 但 order_status != 4,显示绿色
|
||||
else if (refundStatus > 0) {
|
||||
// 给主表格行添加绿色背景
|
||||
var $mainRow = $(".layui-table-main tbody tr").eq(index);
|
||||
$mainRow.addClass('refunding-row');
|
||||
|
||||
// 给固定列的行也添加绿色背景
|
||||
var $fixedLeftRow = $(".layui-table-fixed-l .layui-table-body tbody tr").eq(index);
|
||||
var $fixedRightRow = $(".layui-table-fixed-r .layui-table-body tbody tr").eq(index);
|
||||
$fixedLeftRow.addClass('refunding-row');
|
||||
$fixedRightRow.addClass('refunding-row');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -835,7 +864,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
//取消订单
|
||||
// 退款订单
|
||||
if(obj.event === 'cancelss'){
|
||||
layer.confirm('确认订单退款吗?', {
|
||||
btn: ['确认','取消'] //按钮
|
||||
@@ -860,7 +889,7 @@
|
||||
}
|
||||
|
||||
|
||||
//取消订单
|
||||
// 删除订单(逻辑删除,del 设置为 1)
|
||||
if(obj.event === 'cancel'){
|
||||
layer.confirm('确定删除订单的数据?', {
|
||||
btn: ['确认','取消'] //按钮
|
||||
@@ -882,6 +911,35 @@
|
||||
});
|
||||
}
|
||||
|
||||
// 恢复订单(del 设置为 0)
|
||||
if(obj.event === 'recover'){
|
||||
layer.confirm('确定恢复该订单吗?', {
|
||||
btn: ['确认','取消'] //按钮
|
||||
}, function(){
|
||||
like.ajax({
|
||||
url: '{:url("order/recover")}?id='+id
|
||||
, type: 'get'
|
||||
, success: function (res) {
|
||||
if (res.code == 1) {
|
||||
layui.layer.msg(res.msg, {
|
||||
offset: '15px'
|
||||
, icon: 1
|
||||
, time: 1000
|
||||
},function () {
|
||||
table.reload('order-lists');
|
||||
});
|
||||
} else {
|
||||
layui.layer.msg(res.msg || '恢复失败', {
|
||||
offset: '15px'
|
||||
, icon: 2
|
||||
, time: 1500
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//商家备注
|
||||
if(obj.event === 'remarks') {
|
||||
like.ajax({
|
||||
|
||||
Reference in New Issue
Block a user