停用套餐提示在用订单数
This commit is contained in:
@ -13,6 +13,8 @@ import com.ruoyi.operation.domain.ZcRentCarRuleBattery;
|
||||
import com.ruoyi.operation.service.ICompanyService;
|
||||
import com.ruoyi.operation.service.IZcCarModelService;
|
||||
import com.ruoyi.operation.service.IZcRentCarRuleBatteryService;
|
||||
import com.ruoyi.orders.domain.ZcOrderMain;
|
||||
import com.ruoyi.orders.service.IZcOrderMainService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@ -47,6 +49,8 @@ public class ZcRentCarRuleController extends BaseController
|
||||
private IZcRentCarRuleBatteryService zcRentCarRuleBatteryService;
|
||||
@Autowired
|
||||
private IZcCarModelService zcCarModelService;
|
||||
@Autowired
|
||||
private IZcOrderMainService zcOrderMainService;
|
||||
|
||||
@RequiresPermissions("operation:rentCarRule:view")
|
||||
@GetMapping()
|
||||
@ -223,6 +227,14 @@ public class ZcRentCarRuleController extends BaseController
|
||||
return zcRentCarRuleService.selectZcRentCarRuleList(zcRentCarRule);
|
||||
}
|
||||
|
||||
@PostMapping("/orderCountByCarRuleId")
|
||||
@ResponseBody
|
||||
public AjaxResult orderCountByCarRuleId(Long carRuleId) {
|
||||
int count = zcOrderMainService.selectOrderCountByCarRuleId(carRuleId);
|
||||
return AjaxResult.success(count);
|
||||
|
||||
}
|
||||
|
||||
public static String generateTimestampBasedCode() {
|
||||
Random random = new Random();
|
||||
// 获取当前时间戳的后6位
|
||||
|
||||
@ -101,4 +101,6 @@ public interface ZcOrderMainMapper
|
||||
* @return 门店订单统计列表
|
||||
*/
|
||||
List<StoreOrderStats> selectTopStoreOrderStats(@Param("limit") int limit);
|
||||
|
||||
int selectOrderCountByCarRuleId(@Param("carRuleId")Long carRuleId);
|
||||
}
|
||||
|
||||
@ -72,4 +72,6 @@ public interface IZcOrderMainService
|
||||
*/
|
||||
List<StoreOrderStats> getTopStoreOrderStats(int limit);
|
||||
|
||||
public int selectOrderCountByCarRuleId(Long carRuleId);
|
||||
|
||||
}
|
||||
|
||||
@ -345,4 +345,9 @@ public class ZcOrderMainServiceImpl implements IZcOrderMainService
|
||||
return zcOrderMainMapper.selectTopStoreOrderStats(limit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int selectOrderCountByCarRuleId(Long carRuleId) {
|
||||
return zcOrderMainMapper.selectOrderCountByCarRuleId(carRuleId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -294,5 +294,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
ORDER BY orderAmount DESC
|
||||
LIMIT #{limit}
|
||||
</select>
|
||||
<select id="selectOrderCountByCarRuleId" resultType="java.lang.Integer">
|
||||
SELECT count(1) as orderCount FROM zc_order_main where rent_car_rule_id = #{carRuleId} and order_status in ('WAIT_PAY','WAIT_PICK','RENT_ING','WAIT_RETURN','RENT_OVERDUE')
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@ -190,7 +190,7 @@
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-primary btn-xs btnOption" href="javascript:void(0)" onClick="$.operate.editCustomize(\''+row.id+'\', 1300, 800)"><i class="fa fa-sticky-note-o"></i> 应用至车型</a>');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
// actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
if (row.status == 1) {
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="enable(\'' + row.id + '\',\'' + row.phone + '\')"><i class="fa fa-edit"></i>启用</a> ');
|
||||
} else {
|
||||
@ -205,9 +205,26 @@
|
||||
|
||||
/* 停用 */
|
||||
function disable(id, phone) {
|
||||
$.modal.confirm("确认是否停用该套餐?<span style='color: red'>此套餐停用后正在租用订单继续生效,续租订单继续以原订单为准</span>", function() {
|
||||
$.operate.post(prefix + "/changeStatus", { "id": id, "status": 1 });
|
||||
})
|
||||
$.ajax({
|
||||
url: prefix + "/orderCountByCarRuleId",
|
||||
type: "POST",
|
||||
data: {
|
||||
carRuleId: id
|
||||
},
|
||||
success: function(result) {
|
||||
if (result.code == 0) { // 密码验证通过
|
||||
$.modal.confirm("确认是否停用该套餐?<span style='color: red'>此套餐正在租用订单"+result.data+"辆,停用后正在租用订单继续生效,续租订单继续以原订单为准</span>", function() {
|
||||
$.operate.post(prefix + "/changeStatus", { "id": id, "status": 1 });
|
||||
})
|
||||
}else{
|
||||
layer.msg('操作失败', {icon: 5});
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
layer.msg('操作失败', {icon: 5});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/* 启用 */
|
||||
|
||||
Reference in New Issue
Block a user