Authored by weiqingting

限购商品修改

... ... @@ -14,7 +14,8 @@ var urlObj={
'maxSort': '/goods/query/maxSort',
'shopsRest':'/ShopsRest/getShopsByName',
'sortlist':'/product/class/queryAllProductSortList',
'productPool':'queryBaseProductPoolList'
'productPool':'queryBaseProductPoolList',
'xiangouID':'/limit/xiangouID/selectActivityListForSelect'//限购ID
};
var dropDown=function(option){
... ...
... ... @@ -42,7 +42,7 @@ var util={
if (res.code != 200) {
util.__tip(res.message,"danger");
} else {
callback.bind(this,res)();
return callback.bind(this,res)();
}
}
});
... ... @@ -92,6 +92,69 @@ var util={
}
return result;
},
__template2:function(str,source){
// console.log(str);
//获取参数
var keys=[];
for(var key in source){
if(typeof source[key]=="boolean"){
keys.push(key+"="+source[key]);
}else{
keys.push(key+"="+JSON.stringify(source[key]));
}
}
var result="var "+keys.join(',')+";";
var html="";
html=str.replace(/\{\{(.*?)\}\}/igm,function(name,$1){
var trim=$1.replace(/^\s+|\s+$/,'');
if(/^each/.test(trim))
{
trim=trim.replace(/^each\s+(\w+)\s+as\s+(\w+)\s+(\w+)/,'Util.Fun.each\( $1,function($3,$2){');
return "{{"+trim+"}}";
}else
if(/^\/each/.test(trim)){
trim=trim.replace(/^\/each/,'});')
return "{{"+trim+"}}";
}
else if(/^if/.test(trim)){
trim=trim.replace(/^if(.+)/,'if($1){');
return "{{"+trim+"}}";
}
else if(/^\/if/.test(trim)){
trim=trim.replace(/^\/if/,'};')
return "{{"+trim+"}}";
}
else if(/^else$/.test(trim)){
trim=trim.replace(/else/,'}else{');
return "{{"+trim+"}}";
}
else{
return "{{+"+trim+"+}}";
}
});
html=html.replace(/(^|\}\})(.*?)(\{\{|$)/igm,function(name,$1,$2){
var trim=$2.replace(/^\s+|\s+$/,'');
return trim?Util.String.formstr($2):'';
});
// var result="var result='';result+=";
var arr=html.split(/\n+/igm);
result+="var p=[];\n";
for(var i=0;i<arr.length;i++){
if(/^'/.test(arr[i])){
result+="p.push("+(arr[i])+");\n";
}else{
result+=(arr[i]);
}
}
result+="return p.join('');\n";
var fn=new Function(result);
var b=fn.call(source);
return b;
},
__input:function(id){
return !!~$.trim($('#'+id).val())?$('#'+id).val():""
}
... ...
... ... @@ -19,7 +19,6 @@ var ENMA = {
}
//测试数据
var g = new common.grid({
el: "#baseTable",
... ... @@ -106,29 +105,39 @@ e.on("validate", function() {
e.on("validate", function() {
var limitProductType = $("#limitProductType").val();
var activityId = $.trim($("#activityId").val());
if (limitProductType == 2 && activityId == "") {
return "请填写排队限购ID";
if (limitProductType == 2) {
if(activityId == ""){
return "请填写排队限购ID";
}else{
var exists=false;
common.util.__ajax2({
url:'/limit/DrawlineActivityRest/checkActivityIdExists',
async:false,
data:{activityId:activityId}
},function(res){
if(res.code==200){
if(res.data.exists){
exists=true;
}
}
return true;
});
if(!exists){
return "排队限购ID不存在";
}
}
}
});
e.on("validate", function() {
var orderBy = $("#orderBy").val();
if (!/^(?:[1-9][0-9]*|0)$/.test(orderBy)) {
var hotFlag=$("#hotFlag").val();
if (hotFlag=="1"&&!/^(?:[1-9][0-9]*|0)$/.test(orderBy)) {
return '热门排序值输入格式不正确';
}
});
e.on("validate", function() {
var notSaleOrderBy = $('#notSaleOrderBy').val();
if (!/^(?:[1-9][0-9]*|0)$/.test(notSaleOrderBy)) {
return '未发售排序值输入格式不正确';
}
});
e.on("validate", function() {
var limitProductType = $("#limitProductType").val();
var activityId = $.trim($("#activityId").val());
if (limitProductType == 2 && activityId == "") {
return "请填写排队限购ID";
}
});
e.init();
... ... @@ -143,6 +152,7 @@ $('.limit-add-btn').click(function(option) {
saleTime = new Date(option.data.saleTime.slice(0, -3).replace(/-/g, '/'));
}*/
console.log(option.data);
// option.debug=true;
option.beforeSend = function() {
$('#limit-add-btn').addClass('disabled');
};
... ...
... ... @@ -94,17 +94,19 @@ var tableGird = new common.grid({
return '-';
}
}
}, {
display: "未发售排序",
name: "notSaleSort",
render: function(item) {
if (item.saleFlag == 1) {
return '-';
} else {
return ('<input class="order-input width50" data-id="' + item.id + '" data-type="notSaleOrderBy" type="text" value="' + item.notSaleOrderBy + '"/>');
}
}
}, {
},
// {
// display: "未发售排序",
// name: "notSaleSort",
// render: function(item) {
// if (item.saleFlag == 1) {
// return '-';
// } else {
// return ('<input class="order-input width50" data-id="' + item.id + '" data-type="notSaleOrderBy" type="text" value="' + item.notSaleOrderBy + '"/>');
// }
// }
// },
{
display: "封面图",
render: function(item) {
... ...
exports.domain = require('../config/common.js').domain;
//exports.domain = 'http://172.16.6.240:8088/platform';
// exports.domain = 'http://172.16.6.246:8081/platform/';
//exports.domain = 'http://172.16.6.182:8080/yohobuy-platform-web'; //曹燕
//路由配置
... ... @@ -207,4 +207,18 @@ exports.res = [{
name: 'type',
type: 'String'
}]
},{//模糊查询
route:'/limit/xiangouID/selectActivityListForSelect',
method:'POST',
url:'/DrawlineActivityRest/selectActivityListForSelect',
params:[
{name:"idName",type:'String'}
]
},{
route:'/limit/DrawlineActivityRest/checkActivityIdExists',
method:'POST',
url:'/DrawlineActivityRest/checkActivityIdExists',
params:[
{name:"activityId",type:"Number"}
]
}];
\ No newline at end of file
... ...
... ... @@ -235,7 +235,7 @@
<div class="form-group">
<!-- <label class="col-sm-1 red">*</label> -->
<div class="col-sm-2">
<select class="form-control" data-index={index} class="btn-sort-chima">
<select class="form-control" data-index={#index#} class="btn-sort-chima">
<option value="-1">选择尺码</option>
<option value="XS">XS</option>
<option value="S">S</option>
... ... @@ -245,10 +245,10 @@
</select>
</div>
<div class="col-sm-2">
<input class="form-control" class="btn-sort-xiaoshou" placeholder="默认销售价" data-index={index}></input>
<input class="form-control" class="btn-sort-xiaoshou" placeholder="默认销售价" data-index={#index#}></input>
</div>
<div class="col-sm-2">
<input class="form-control" class="btn-sort-tiaoma" placeholder="条码" data-index={index}></input>
<input class="form-control" class="btn-sort-tiaoma" placeholder="条码" data-index={#index#}></input>
</div>
<div class="col-sm-2">
<select class="form-control" class="btn-sort-kebu">
... ... @@ -258,8 +258,8 @@
</select>
</div>
<div class="col-sm-2">
<button type="button" class="btn btn-info btn-xs btn-sort-add" data-index={index}>+</button>
<button type="button" class="btn btn-info btn-xs btn-sort-remove" data-index={index} data-eq={__index}>-</button>
<button type="button" class="btn btn-info btn-xs btn-sort-add" data-index={#index#}>+</button>
<button type="button" class="btn btn-info btn-xs btn-sort-remove" data-index={#index#} data-eq={#__index#}>-</button>
</div>
</div>
</script>
\ No newline at end of file
... ...
... ... @@ -47,9 +47,9 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">排队限购ID</label>
<label class="col-sm-2 control-label">排队限购ID</label>
<div class="col-sm-8">
<input type="text" id="activityId" placeholder="排队限购ID" class="form-control" maxlength="30" value="{{activityId}}">
<input id="activityId" type="{{activityId}}" class="form-control" />
</div>
</div>
<div class="form-group">
... ... @@ -87,14 +87,14 @@
<input type="hidden" value="{{hotFlag}}" id="hotFlag" for="radio">
</div>
<div class="col-md-3 height60">
<label>热门发售排序<span class="red">*</span></label>
<label><input id="orderBy" value="{{orderBy}}" type="text" class="form-control" placeholder="热门发售排序" placeholder="" required></label>
<label>热门排序<span class="red">*</span></label>
<label><input id="orderBy" value="{{orderBy}}" type="text" class="form-control" placeholder="热门排序" placeholder=""></label>
<p>(提示:数字越大越靠前)</p>
</div>
<div class="col-md-3">
<!-- <div class="col-md-3">
<label>未发售排序:</label>
<label><input id="notSaleOrderBy" value="{{notSaleOrderBy}}" placeholder="未发售排序" type="text" class="form-control" placeholder=""></label>
</div>
</div> -->
</div>
</div>
</div>
... ...