1.复选框
<td><input type="checkbox" name="checkbox_name_sel_ids" value="{{item.uid}}"></td>
2.获取复选框选中状态
fn.distributeAll = function() {
var checkbox=$("input[name='checkbox_name_sel_ids']"); //复选框对象
var selId = new Array();
for(var i = 0; i < checkbox.length; i++){
if(checkbox[i].checked){
selId.push(checkbox[i].value);
}
}
layer.confirm('确认分配优惠券吗?', {icon: 3, title:'提示'}, function(index){
index && http.POST('user/roleCouponUser/saveALL', {
selId : selId.join(),
pre_id:pre_id
}).then(function(res) {
layer.msg(res.message);
});
layer.close(index);
});
}
3.以字符串的形式(以逗号分隔)在后台获取
/**
* 保存优惠券信息
*/
@ValidateToken(isValidate = false)
public void saveALL() {
String selId = getPara("selId");
String[] ids=selId.split(",");
String pre_id = getPara("pre_id");
Record re = RoleCouponService.findInfo(pre_id);
int days = re.getInt("days");
for(String s:ids){
JSONObject where = getJsonWhere();
where.put("uid", s);
where.put("coupon_id", pre_id);
where.put("describe", re.getStr("describe"));
where.put("coupon_money", re.getStr("coupon_money"));
where.put("name", re.getStr("name"));
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String currdate = format.format(date);
System.out.println("当前日期是:" + currdate);
where.put("start_date", currdate);
Date addDate = addDate(days);
where.put("end_date", format.format(addDate));
System.out.println(where);
System.out.println("到期时间是:"+format.format(addDate));
renderJson(srv.modify(where));
}
}
使用微信小程序云开发写的个人简历小程序和好玩的关联微信运动遛狗的小程序,内置天气查询功能。欢迎大家扫码体验,项目详情也可到我的置顶博客查看。项目都已在码云上开源,欢迎大家star。wx_superpet这个小程序项目特别适合对微信小程序云开发技术感兴趣的同学参考。
个人简历源码:个人简历码云地址
wx_superpet源码:wx_superpet码云地址