cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java
@@ -441,7 +441,7 @@ } coupon.setAuditStatus(1); coupon.setStatus(1); coupon.setState(2); coupon.setState(1); coupon.setInsertTime(new Date()); coupon.setCover(dataVo.getGoodImg()); String goodImgs = dataVo.getGoodImgs(); cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java
@@ -14,6 +14,7 @@ import com.dsh.activity.model.PointMerchandiseVo; import com.dsh.activity.model.request.AppUserGoodResp; import com.dsh.activity.model.request.CommodityRequest; import com.dsh.activity.model.request.IntegralGoodsOfSearch; import com.dsh.activity.service.*; import com.dsh.activity.util.GDMapGeocodingUtil; import com.dsh.activity.util.StrUtils; @@ -23,7 +24,10 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.xml.crypto.Data; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.util.*; import java.util.stream.Collectors; @@ -527,4 +531,79 @@ } @ResponseBody @PostMapping("/base/pointMerchars/queryGoodsListSearch") public List<Map<String,Object>> getIntegralGoodsListOfSearch(@RequestBody IntegralGoodsOfSearch ofSearch){ System.out.println(ofSearch); List<Map<String, Object>> mapList = pmdsService.queryGoodsListOfSearch(ofSearch); if (mapList.size() > 0){ for (Map<String, Object> stringObjectMap : mapList) { Integer o = (Integer) stringObjectMap.get("id"); Object startTime = stringObjectMap.get("startTime"); Object endTime = stringObjectMap.get("endTime"); stringObjectMap.put("timeValue",startTime + "至"+endTime); int count1 = upmseService.count(new LambdaQueryWrapper<UserPointsMerchandise>() .eq(UserPointsMerchandise::getPointsMerchandiseId, o)); int count2 = upmseService.count(new LambdaQueryWrapper<UserPointsMerchandise>() .eq(UserPointsMerchandise::getPointsMerchandiseId, o) .eq(UserPointsMerchandise::getStatus,2)); stringObjectMap.put("hasExchangeQty",count1); stringObjectMap.put("hasPickQty",count2); } if (ToolUtil.isNotEmpty(ofSearch.getActiveStatus())){ mapList = dealTimeData(mapList,ofSearch.getActiveStatus()); } } // TODO: 2023/8/14 state 活动状态 System.out.println("mapList->"+mapList); return mapList; } /** * * @param mapLists * @param timeType 1=未开始 2=已开始 3=已结束 * @return */ public List<Map<String, Object>> dealTimeData(List<Map<String, Object>> mapLists,Integer timeType){ Date currentDate = new Date(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); switch (timeType){ case 1: return mapLists.stream() .filter(event -> { try { return simpleDateFormat.parse((String) event.get("startTime")).after(currentDate); } catch (ParseException e) { throw new RuntimeException(e); } }) .collect(Collectors.toList()); case 2: return mapLists.stream() .filter(event -> { try { return simpleDateFormat.parse((String) event.get("startTime")).before(currentDate) && simpleDateFormat.parse((String) event.get("endTime")).after(currentDate); } catch (ParseException e) { throw new RuntimeException(e); } }) .collect(Collectors.toList()); case 3: return mapLists.stream() .filter(event -> { try { return simpleDateFormat.parse((String) event.get("endTime")).before(currentDate); } catch (ParseException e) { throw new RuntimeException(e); } }) .collect(Collectors.toList()); default: break; } return null; } } cloud-server-activity/src/main/java/com/dsh/activity/mapper/PointsMerchandiseMapper.java
@@ -1,7 +1,12 @@ package com.dsh.activity.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.dsh.activity.entity.PointsMerchandise; import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; /** * <p> @@ -13,4 +18,12 @@ */ public interface PointsMerchandiseMapper extends BaseMapper<PointsMerchandise> { List<Map<String, Object>> queryGoodsListOfSearch(@Param("name")String name, @Param("type")Integer type, @Param("redemptionMethod")Integer redemptionMethod, @Param("userPopulation") Integer userPopulation, @Param("activeStatus") Integer activeStatus, @Param("state") Integer state, @Param("page") Page<Map<String, Object>> page); } cloud-server-activity/src/main/java/com/dsh/activity/model/request/IntegralGoodsOfSearch.java
New file @@ -0,0 +1,29 @@ package com.dsh.activity.model.request; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.util.Map; @Data @AllArgsConstructor @NoArgsConstructor public class IntegralGoodsOfSearch { private String name; private Integer type; private Integer redemptionMethod; private Integer userPopulation; private Integer activeStatus; private Integer state; private Page<Map<String, Object>> page; } cloud-server-activity/src/main/java/com/dsh/activity/service/PointsMerchandiseService.java
@@ -2,6 +2,10 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.dsh.activity.entity.PointsMerchandise; import com.dsh.activity.model.request.IntegralGoodsOfSearch; import java.util.List; import java.util.Map; /** * <p> @@ -13,4 +17,6 @@ */ public interface PointsMerchandiseService extends IService<PointsMerchandise> { List<Map<String, Object>> queryGoodsListOfSearch(IntegralGoodsOfSearch ofSearch); } cloud-server-activity/src/main/java/com/dsh/activity/service/impl/PointsMerchandiseServiceImpl.java
@@ -3,8 +3,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.dsh.activity.entity.PointsMerchandise; import com.dsh.activity.mapper.PointsMerchandiseMapper; import com.dsh.activity.model.request.IntegralGoodsOfSearch; import com.dsh.activity.service.PointsMerchandiseService; import org.springframework.stereotype.Service; import java.util.List; import java.util.Map; /** * <p> @@ -17,4 +21,9 @@ @Service public class PointsMerchandiseServiceImpl extends ServiceImpl<PointsMerchandiseMapper, PointsMerchandise> implements PointsMerchandiseService { @Override public List<Map<String, Object>> queryGoodsListOfSearch(IntegralGoodsOfSearch ofSearch) { return this.baseMapper.queryGoodsListOfSearch(ofSearch.getName(),ofSearch.getType(),ofSearch.getRedemptionMethod(), ofSearch.getUserPopulation(),ofSearch.getActiveStatus(),ofSearch.getState(),ofSearch.getPage()); } } cloud-server-activity/src/main/resources/mapper/PointsMerchandiseMapper.xml
@@ -3,4 +3,36 @@ <mapper namespace="com.dsh.activity.mapper.PointsMerchandiseMapper"> <select id="queryGoodsListOfSearch" resultType="java.util.Map"> SELECT id, `name`, `cover`, `type`, date_format(startTime ,'%Y-%m-%d') as startTime, date_format(endTime ,'%Y-%m-%d') as endTime, useScope, userPopulation, quantityIssued, pickUpQuantity, `sort`, shelves from t_points_merchandise where 1 = 1 <if test="name != null"> and `name` like concat('%', #{name}, '%') </if> <if test="type != null"> and type = #{type} </if> <if test="redemptionMethod != null"> and redemptionMethod = #{redemptionMethod} </if> <if test="userPopulation != null"> and userPopulation = #{userPopulation} </if> <if test="state != null"> and `state` = #{state} </if> order by insertTime desc </select> </mapper> cloud-server-management/src/main/java/com/dsh/course/feignClient/activity/PointMercharsClient.java
New file @@ -0,0 +1,18 @@ package com.dsh.course.feignClient.activity; import com.dsh.course.feignClient.activity.model.IntegralGoodsOfSearch; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.Map; @FeignClient(value = "mb-cloud-activity") public interface PointMercharsClient { @PostMapping("/base/pointMerchars/queryGoodsListSearch") List<Map<String,Object>> getIntegralGoodsListOfSearch(@RequestBody IntegralGoodsOfSearch ofSearch); } cloud-server-management/src/main/java/com/dsh/course/feignClient/activity/model/IntegralGoodsOfSearch.java
New file @@ -0,0 +1,29 @@ package com.dsh.course.feignClient.activity.model; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.util.Map; @Data @AllArgsConstructor @NoArgsConstructor public class IntegralGoodsOfSearch { private String name; private Integer type; private Integer redemptionMethod; private Integer userPopulation; private Integer activeStatus; private Integer state; private Page<Map<String, Object>> page; } cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TGoodsController.java
@@ -10,10 +10,8 @@ import com.dsh.course.feignClient.account.model.QueryByNamePhone; import com.dsh.course.feignClient.account.model.TAppUser; import com.dsh.course.feignClient.activity.CouponClient; import com.dsh.course.feignClient.activity.model.Coupon; import com.dsh.course.feignClient.activity.model.CouponCity; import com.dsh.course.feignClient.activity.model.CouponListOfSearch; import com.dsh.course.feignClient.activity.model.CouponRecordQuery; import com.dsh.course.feignClient.activity.PointMercharsClient; import com.dsh.course.feignClient.activity.model.*; import com.dsh.guns.config.UserExt; import com.dsh.guns.core.base.tips.SuccessTip; import com.dsh.guns.core.common.constant.factory.PageFactory; @@ -71,6 +69,9 @@ private AppUserClient appUserClient; @Autowired private ICityService cityService; @Resource private PointMercharsClient pointMercharsClient; @@ -214,23 +215,23 @@ return storeList; } /** * 获取 优惠券管理 */ @RequestMapping(value = "/list") @ResponseBody public Object listOfDatas(String name, Integer type, Integer distributionMethod , Integer userPopulation, Integer status, Integer state) { Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); CouponListOfSearch ofSearch = new CouponListOfSearch(); ofSearch.setPage(page); ofSearch.setName(name); ofSearch.setType(type); ofSearch.setDistributionMethod(distributionMethod); ofSearch.setUserPopulation(userPopulation); ofSearch.setStatus(status); ofSearch.setState(state); return client.getCouponListOfSearch(ofSearch); } // /** // * 获取 优惠券管理 // */ // @RequestMapping(value = "/list") // @ResponseBody // public Object listOfDatas(String name, Integer type, Integer distributionMethod , Integer userPopulation, Integer status, Integer state) { // Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); // CouponListOfSearch ofSearch = new CouponListOfSearch(); // ofSearch.setPage(page); // ofSearch.setName(name); // ofSearch.setType(type); // ofSearch.setDistributionMethod(distributionMethod); // ofSearch.setUserPopulation(userPopulation); // ofSearch.setStatus(status); // ofSearch.setState(state); // return client.getCouponListOfSearch(ofSearch); // } @RequestMapping(value = "/listRecord") @ResponseBody public Object listRecord(Integer id,String name, Integer type, String phone) { @@ -327,4 +328,28 @@ client.updateCouponData(coupon); return new SuccessTip<>(); } /** * 获取 积分商品列表 */ @RequestMapping(value = "/list") @ResponseBody public Object listOfIntegralGoods(String name, Integer type, Integer redemptionMethod , Integer userPopulation, Integer activeStatus, Integer state) { Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); IntegralGoodsOfSearch ofSearch = new IntegralGoodsOfSearch(); ofSearch.setPage(page); ofSearch.setName(name); ofSearch.setType(type); ofSearch.setRedemptionMethod(redemptionMethod); ofSearch.setUserPopulation(userPopulation); ofSearch.setActiveStatus(activeStatus); ofSearch.setState(state); System.out.println(ofSearch); return pointMercharsClient.getIntegralGoodsListOfSearch(ofSearch); } } cloud-server-management/src/main/webapp/WEB-INF/view/system/tCity/TCity_edit.html
@@ -27,7 +27,7 @@ </select> </div> </div> <#input id="name" name="管理员姓名" type="text" value="${item.name}"/> <#input id="name" name="发放数量" type="text" value="${item.name}"/> <#input id="phone" name="管理员手机号" type="text" value="${item.phone}"/> cloud-server-management/src/main/webapp/WEB-INF/view/system/tGoods/TGoods.html
@@ -12,33 +12,62 @@ <div class="row"> <div class="col-sm-3"> <#NameCon id="name" name="优惠券名称" /> <#NameCon id="name" name="商品名称" /> </div> <div class="col-sm-3"> <#SelectCon id="type" name="优惠券类型"> <#SelectCon id="type" name="商品类型"> <option value="">全部</option> <option value="1">满减券</option> <option value="2">体验券</option> <option value="3">代金券</option> <option value="1">实体商品</option> <option value="2">课包商品</option> <option value="3">门票商品</option> <option value="4">优惠券</option> </#SelectCon> </div> <div class="col-sm-3"> <#NameCon id="phone" name="管理员手机号" /> <#SelectCon id="redemptionMethod" name="兑换方式"> <option value="">全部</option> <option value="1">积分</option> <option value="2">现金+积分</option> <option value="3">现金</option> </#SelectCon> </div> <div class="col-sm-3"> <#button name="搜索" icon="fa-search" clickFun="TCompetition.search()"/> <#button name="重置" icon="fa-trash" clickFun="TCompetition.resetSearch()" space="true"/> <#SelectCon id="userPopulation" name="用户人群"> <option value="">全部</option> <option value="1">全部用户</option> <option value="2">年度会员</option> <option value="3">已有学员用户</option> </#SelectCon> </div> <div class="col-sm-3"> <#SelectCon id="activeStatus" name="活动状态"> <option value="">全部</option> <option value="1">未开始</option> <option value="2">已开始</option> <option value="3">已结束</option> </#SelectCon> </div> <div class="col-sm-3"> <#SelectCon id="state" name="可售状态"> <option value="">全部</option> <option value="1">上架</option> <option value="2">下架</option> </#SelectCon> </div> <div class="col-sm-3"> <#button name="搜索" icon="fa-search" clickFun="TPointProducts.search()"/> <#button name="重置" icon="fa-trash" clickFun="TPointProducts.resetSearch()" space="true"/> </div> </div> <div class="hidden-xs" id="TCompetitionTableToolbar" role="group"> <#button name="添加" icon="fa-plus" clickFun="TCompetition.openAddTCompetition()"/> <#button name="编辑" icon="fa-edit" clickFun="TCompetition.openTCompetitionDetail()" space="true"/> <#button name="冻结" icon="fa-remove" clickFun="TCompetition.freeze()" space="true"/> <#button name="解冻" icon="fa-remove" clickFun="TCompetition.unfreeze()" space="true"/> <#button name="重置密码" icon="fa-remove" clickFun="TCompetition.reload()" space="true"/> <div class="hidden-xs" id="TPointProductsTableToolbar" role="group"> <#button name="添加" icon="fa-plus" clickFun="TPointProducts.openAddTPointProducts()"/> <#button name="编辑" icon="fa-edit" clickFun="TPointProducts.openEditPage()" space="true"/> <#button name="上架" icon="fa-remove" clickFun="TPointProducts.grounding(1)" space="true"/> <#button name="下架" icon="fa-remove" clickFun="TPointProducts.grounding(2)" space="true"/> <#button name="查看详情" icon="fa-remove" clickFun="TPointProducts.detail()" space="true"/> <#button name="购买详情" icon="fa-remove" clickFun="TPointProducts.payDetail()" space="true"/> </div> <#table id="TCompetitionTable"/> <#table id="TPointProductsTable"/> </div> </div> </div> @@ -46,11 +75,4 @@ </div> </div> <script src="${ctxPath}/modular/system/tGoods/tGoods.js"></script> <script> laydate.render({ elem: '#createTime' ,range: true ,lang:"en" }); </script> @} cloud-server-management/src/main/webapp/static/modular/system/tGoods/tGoods.js
@@ -1,8 +1,8 @@ /** * 车辆管理管理初始化 */ var TCompetition = { id: "TCompetitionTable", //表格id var TPointProducts = { id: "TPointProductsTable", //表格id seItem: null, //选中的条目 table: null, layerIndex: -1 @@ -11,42 +11,51 @@ /** * 初始化表格的列 */ TCompetition.initColumn = function () { TPointProducts.initColumn = function () { return [ {field: 'selectItem', radio: true}, {title: '商品类型', field: 'province', visible: true, align: 'center', valign: 'middle' {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'}, {title: '商品类型', field: 'type', visible: true, align: 'center', valign: 'middle', formatter: function (value, row, index) { return {1: "实体商品", 2: "课包商品", 3: "门票商品", 4: "优惠券"}[value] } }, {title: '商品名称', field: 'city', visible: true, align: 'center', valign: 'middle'}, {title: '商品封面', field: 'name', visible: true, align: 'center', valign: 'middle' {title: '商品名称', field: 'name', visible: true, align: 'center', valign: 'middle'}, {title: '商品封面', field: 'cover', visible: true, align: 'center', valign: 'middle', formatter: function (value, row, index) { value = typeof value == "undefined" || value == '' ? '/static/img/NoPIC.png' : value; return '<img src="' + value + '" style="height: 100px;"/>' } }, {title: '有效期', field: 'phone', visible: true, align: 'center', valign: 'middle' {title: '有效期', field: 'timeValue', visible: true, align: 'center', valign: 'middle' }, {title: '兑换地点', field: 'state', visible: true, align: 'center', valign: 'middle' {title: '兑换地点', field: 'useScope', visible: true, align: 'center', valign: 'middle', formatter: function (value, row, index) { return {1: "全国", 2: "指定城市", 3: "指定门店"}[value] } }, {title: '用户人群', field: 'state', visible: true, align: 'center', valign: 'middle' {title: '用户人群', field: 'userPopulation', visible: true, align: 'center', valign: 'middle', formatter: function (value, row, index) { return {1: "全部用户", 2: "年度会员", 3: "已有学员用户"}[value] } }, {title: '发放数量', field: 'state', visible: true, align: 'center', valign: 'middle' {title: '发放数量', field: 'quantityIssued', visible: true, align: 'center', valign: 'middle' }, {title: '限领数量', field: 'state', visible: true, align: 'center', valign: 'middle' {title: '限领数量', field: 'pickUpQuantity', visible: true, align: 'center', valign: 'middle' }, {title: '已领数量', field: 'state', visible: true, align: 'center', valign: 'middle' {title: '已领数量', field: 'hasPickQty', visible: true, align: 'center', valign: 'middle' }, {title: '已兑换数量', field: 'state', visible: true, align: 'center', valign: 'middle' {title: '已兑换数量', field: 'hasExchangeQty', visible: true, align: 'center', valign: 'middle' }, {title: '排序', field: 'state', visible: true, align: 'center', valign: 'middle' {title: '排序', field: 'sort', visible: true, align: 'center', valign: 'middle' }, {title: '活动状态', field: 'state', visible: true, align: 'center', valign: 'middle' }, {title: '可售状态', field: 'state', visible: true, align: 'center', valign: 'middle' {title: '可售状态', field: 'shelves', visible: true, align: 'center', valign: 'middle', formatter: function (value, row, index) { return {1: "上架", 2: "下架"}[value] } }, ]; }; @@ -86,21 +95,21 @@ /** * 检查是否选中 */ TCompetition.check = function () { TPointProducts.check = function () { var selected = $('#' + this.id).bootstrapTable('getSelections'); if(selected.length == 0){ Feng.info("请先选中表格中的某一记录!"); return false; }else{ TCompetition.seItem = selected[0]; TPointProducts.seItem = selected[0]; return true; } }; /** * 点击添加车辆管理 * 添加 */ TCompetition.openAddTCompetition = function () { TPointProducts.openAddTPointProducts = function () { var index = layer.open({ type: 2, title: '添加', @@ -113,9 +122,9 @@ }; /** * 打开查看车辆管理详情 * 查看详情 */ TCompetition.openTCompetitionDetail = function () { TPointProducts.detail = function () { if (this.check()) { var index = layer.open({ type: 2, @@ -123,132 +132,62 @@ area: ['100%', '100%'], //宽高 fix: false, //不固定 maxmin: true, content: Feng.ctxPath + '/tCity/tCity_update/' + TCompetition.seItem.id content: Feng.ctxPath + '/tGoods/tCity_update/' + TPointProducts.seItem.id }); this.layerIndex = index; } }; /** * 删除车辆管理 * 购买详情 */ TCompetition.delete = function () { if (this.check()) { var nickname = TCompetition.seItem.carLicensePlate; if (nickname == "" || nickname == null || nickname == undefined){ nickname = "该车辆"; }else{ nickname = "【"+nickname+"】"; } swal({ title: language==1?"您是否确认删除" + nickname + "?":(language==2?"Are you sure to delete the" + nickname + "?":"Apakah Anda pasti akan menghapus" + nickname + "?"), text: language==1?"请谨慎操作!":(language==2?' Please operate with caution!':'Harap beroperasi dengan hati -hati!'), type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: language==1?"删除":(language==2?'Delete':'Hapus'), closeOnConfirm: true }, function () { var ajax = new $ax(Feng.ctxPath + "/TCompetition/delete", function (data) { if(language==1){ swal("删除成功", "您已经成功删除了" + nickname + "。", "success"); }else if(language==2){ swal("Delete succeeded!", "You have successfully deleted it" + nickname + "。", "success"); }else { swal("Hapus berhasil!", "Anda berhasil menghapus" + nickname + "。", "success"); } TCompetition.table.refresh(); }, function (data) { if(language==1){ swal("删除失败", data.responseJSON.message + "!", "warning"); }else if(language==2){ swal("Failed to delete", data.responseJSON.message + "!", "warning"); }else { swal("Hapus Gagal", data.responseJSON.message + "!", "warning"); } }); ajax.set("TCompetitionId",TCompetition.seItem.id); ajax.start(); }); } }; TCompetition.oneChange = function (e) { console.log(111) var oneId=$(e).val(); var ajax = new $ax(Feng.ctxPath + "/tCompetition/onChange", function(data){ if(data!=null){ if(language==1){ var content='<option value="">选择市</option>'; }else if(language==2){ var content='<option value="">Choose your franchisee</option>'; }else { var content='<option value="">Pilih franchisee Anda</option>'; } $.each(data, function(k,v) { content += "<option value='"+v.code+"'>"+v.name+"</option>"; }); $("#cCode").empty().append(content); } }); ajax.set("oneId",oneId); ajax.start(); } TCompetition.freeze = function () { if (this.check()) { var ajax = new $ax(Feng.ctxPath + "/tCity/freeze", function (data) { Feng.success("冻结成功!"); TCompetition.table.refresh(); }, function (data) { Feng.error("冻结失败!" + data.responseJSON.message + "!"); }); ajax.set("id",this.seItem.id); ajax.start(); } }; TCompetition.unfreeze = function () { if (this.check()) { var ajax = new $ax(Feng.ctxPath + "/tCity/unfreeze", function (data) { Feng.success("解冻成功!"); TCompetition.table.refresh(); }, function (data) { Feng.error("解冻失败!" + data.responseJSON.message + "!"); }); ajax.set("id",this.seItem.id); ajax.start(); } }; TCompetition.reload = function () { if (this.check()) { let id = this.seItem.id var operation = function(){ var ajax = new $ax(Feng.ctxPath + "/tCity/pwd", function (data) { Feng.success("重置成功!"); TCompetition.table.refresh(); }, function (data) { Feng.error("重置失败!" + data.responseJSON.message + "!"); }); ajax.set("id",id); ajax.start(); } Feng.confirm("确认重置密码?重置后密码为:a123456", operation); } }; TCompetition.carInsurance = function () { TPointProducts.payDetail = function () { if (this.check()) { var index = layer.open({ type: 2, title: language==1?'车辆保险':(language==2?'Vehicle insurance':'Asuransi kendaraan'), title:'编辑', area: ['100%', '100%'], //宽高 fix: false, //不固定 maxmin: true, content: Feng.ctxPath + '/TCompetition/carInsurance?carId=' + TCompetition.seItem.id content: Feng.ctxPath + '/tGoods/tCity_update/' + TPointProducts.seItem.id }); this.layerIndex = index; } }; /** * 编辑页面 */ TPointProducts.openEditPage = function () { if (this.check()) { var index = layer.open({ type: 2, title:'编辑', area: ['100%', '100%'], //宽高 fix: false, //不固定 maxmin: true, content: Feng.ctxPath + '/tGoods/tCity_update/' + TPointProducts.seItem.id }); this.layerIndex = index; } } /** * 上下架处理 * @param m */ TPointProducts.grounding = function (m) { console.log('m:',m); // if (this.check()) { // var ajax = new $ax(Feng.ctxPath + "/tGoods/freeze", function (data) { // Feng.success("冻结成功!"); // TPointProducts.table.refresh(); // }, function (data) { // Feng.error("冻结失败!" + data.responseJSON.message + "!"); // }); // ajax.set("id",this.seItem.id); // ajax.start(); // } }; @@ -256,129 +195,30 @@ /** * 查询车辆管理列表 */ TCompetition.search = function () { TPointProducts.search = function () { var queryData = {}; queryData['provinceCode'] = $("#pCode").val(); queryData['cityCode'] = $("#cCode").val(); queryData['name'] = $("#name").val(); queryData['phone'] = $("#phone").val(); TCompetition.table.refresh({query: queryData}); queryData['type'] = $("#type").val(); queryData['redemptionMethod'] = $("#redemptionMethod").val(); queryData['userPopulation'] = $("#userPopulation").val(); queryData['activeStatus'] = $("#activeStatus").val(); queryData['state'] = $("#state").val(); TPointProducts.table.refresh({query: queryData}); }; TCompetition.resetSearch = function () { $("#pCode").val(""); $("#cCode").val(""); TPointProducts.resetSearch = function () { $("#name").val(""); $("#phone").val(""); TCompetition.search(); $("#type").val(""); $("#redemptionMethod").val(""); $("#userPopulation").val(""); $("#activeStatus").val(""); $("#state").val(""); TPointProducts.search(); }; $(function () { var defaultColunms = TCompetition.initColumn(); var table = new BSTable(TCompetition.id, "/tCity/list", defaultColunms); table.setPaginationType("server"); TCompetition.table = table.init(); var defaultColunms = TPointProducts.initColumn(); var table = new BSTable(TPointProducts.id, "/tGoods/list", defaultColunms); table.setPaginationType("client"); TPointProducts.table = table.init(); }); /** * 下载模板 */ TCompetition.uploadCarModel = function () { window.location.href = Feng.ctxPath + "/TCompetition/uploadCarModel"; } var agreement = function(){ this.init = function(){ //模拟上传excel $("#uploadEventBtn").unbind("click").bind("click",function(){ $("#uploadEventFile").click(); }); }; } /** * 导入合同 */ TCompetition.exporTCompetition = function () { var uploadEventFile = $("#uploadEventFile").val(); if(uploadEventFile == ''){ if(language==1){ Feng.info("请选择Excel,再上传"); }else if(language==2){ Feng.info("Please select Excel and upload"); }else { Feng.info("Silakan pilih Excel dan upload"); } }else if(uploadEventFile.lastIndexOf(".xls")<0){//可判断以.xls和.xlsx结尾的excel if(language==1){ Feng.info("只能上传Excel文件"); }else if(language==2){ Feng.info("Only Excel files can be uploaded"); }else { Feng.info("Hanya berkas Excel yang dapat diunggah"); } }else{ var url = Feng.ctxPath + '/TCompetition/exporTCompetition'; var file = document.querySelector('input[name=file]').files[0]; var reader = new FileReader(); if (file) { var formData = new FormData(); formData.append("myfile", file); this.sendAjaxRequest(url, 'POST', formData); } } } TCompetition.sendAjaxRequest = function(url,type,data){ $.ajax({ url : url, type : type, data : data, success : function(result) { if(result.code==500) { Feng.info(result.message); }else { if(language==1){ Feng.success("导入成功!"); }else if(language==2){ Feng.success("SUCCESSFUL IMPORT!"); }else { Feng.success("Import berhasil!"); } } TCompetition.table.refresh(); }, error : function() { if(language==1){ Feng.error("excel上传失败!"); }else if(language==2){ Feng.error("Uploading excel Fails. Procedure!"); }else { Feng.error("Gagal mengunggah excel!"); } }, cache : false, contentType : false, processData : false }); }; var agreement; $(function(){ agreement = new agreement(); agreement.init(); }); /** * 导出车辆操作 */ TCompetition.ouTCompetition = function () { var operation = function() { window.location.href = Feng.ctxPath + "/TCompetition/ouTCompetition"; }; if(language==1){ Feng.confirm("是否确认导出车辆信息?", operation); }else if(language==2){ Feng.confirm("Are you sure to export vehicle information?", operation); }else { Feng.confirm("Apakah Anda pasti akan mengekspor informasi kendaraan?", operation); } }