Authored by xuhongyun

Merge branch 'master' into dev-xuhongyun

... ... @@ -57,4 +57,8 @@ module.exports = function (app) {
// 查询优惠券操作记录
app.post("/coupon/getOperationRecords", "CouponList_getOperationRecords");
// 更新第三方信息
app.post("/coupon/updateCouponsUseRule", "CouponList_updateCouponsUseRule");
};
\ No newline at end of file
... ...
... ... @@ -81,6 +81,15 @@ module.exports = {
params: {
couponsId: {type: Number}
}
},
updateCouponsUseRule: {
title: "更新第三方信息",
url: "/coupon/updateCouponsUseRule",
params: {
couponId: {type: Number},
thirdType: {type: Number},
thirdId: {type: String}
}
}
}
};
\ No newline at end of file
};
... ...
... ... @@ -235,6 +235,27 @@
</table>
</div>
</script>
<script id="third-template" type="text/template" charset="utf-8">
<div class="row" id="baseform">
<div class="form-group">
<label class="col-sm-2 control-label">第三方类型 </label>
<div class="col-sm-8">
<input type="hidden" name="couponId" id="couponId" value="{{couponId}}"/>
<select name="thirdType" id="thirdType" {{if thirdType == 1}}disabled{{/if}} tabindex="-1" class="select2-offscreen" style="width: 100px;">
<option value="1" {{if thirdType == 1}}selected{{/if}}>微信</option>
<option value="2" {{if thirdType == 2}}selected{{/if}}>支付宝</option>
<option value="3" {{if thirdType != 1 && thirdType != 2}}selected{{/if}}>微博</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">第三方 ID</label>
<div class="col-sm-8">
<input id="thirdId" class="form-control panel-input" value="{{thirdId}}" {{if thirdType == 1}}readonly{{/if}} type="text" placeholder="第三方 ID">
</div>
</div>
</div>
</script>
<%include '../../../common/views/__ui/footer'%>
... ...
... ... @@ -70,4 +70,5 @@ module.exports = function (app) {
//获取店铺下的BLK商品
app.post("/shop/decoration/findBlkProductByShopsId","shopDecoration_findBlkProductByShopsId");
app.post("/shop/decoration/findProductNotInShop", "shopDecoration_findProductNotInShop");
}
... ...
... ... @@ -132,6 +132,15 @@
{name: 'productSkn', type: 'Number'},
{name: 'size', type: 'number'}
]
},
findProductNotInShop: {
title: "检查商品是否属于店铺",
url: "/ShopsDecoratorRest/findProductNotInShop",
params: [
{name: 'shopId', type: 'Number'},
{name: 'productSkns', type: 'String'}
]
}
}
}
... ...
... ... @@ -80,7 +80,16 @@
</div>
</div>
<!--右侧main-->
<div class="model-main-right model-main-right-default"></div>
<div class="model-main-right">
<div class="form-group">
<label class="col-sm-2">推荐商品(以英文逗号分隔,最多8): </label>
<div class="col-sm-10">
<input type="text" class="form-control model-default-hotproduct" placeholder="请输入推荐商品,以英文逗号分隔,最多8个SKN"
value="[[resources.defaultHotProducts && resources.defaultHotProducts.data ? resources.defaultHotProducts.data.toString() : '']]" maxlength="90">
</div>
</div>
<div class="model-main-right-default"></div>
</div>
<div class="clear"></div>
</div>
</div>
... ...
... ... @@ -3,8 +3,8 @@
*/
'use strict';
var $ = require('jquery'),
common = require('../../../common/common');
var $ = require('jquery'), common = require('../../../common/common');
var artTemplate = common.artTemplate;
/**
* 全局变量
* couponTypes 优惠券类型
... ... @@ -18,12 +18,14 @@ var useLimitTypes = ["无限制", "货物件数限制", "订单金额限制"];
// var customTypes = ["新客户", "银卡会员", "金卡会员", "白金卡会员", "普通用户(不含新客)"];
var customTypes={1:"新客户",2:"银卡会员", 3:"金卡会员", 4:"白金卡会员", 5:"普通用户(不含新客)",9:"学生"};
var shopPriceLimitsTable={1:"成交价低于吊牌价三折",2:"限量商品"};
var thirdTypeEnum={1:"微信", 2:"支付宝", 3: "微薄"};
var ENUM = {
status: {0: '待审核', 1: '审核通过', 2: '驳回', '-1': '过期', 3: '作废'},//全部
tips: {"0": 0, "1": 0, "2": 0, "3": 0, "4": 0, "all": 0}
};
var columnname = "all";
/**
* 初始化下拉框
*/
... ... @@ -121,6 +123,9 @@ var g = new common.grid({
arr.push("<p>优惠结果:" + item.couponAmount + "</p>");
arr.push("<p>数量:" + item.couponNum + "</p>");
arr.push("<p>部门:" + item.departmentName + "</p>");
if (item.couponsUseRuleVo && item.couponsUseRuleVo.thirdType) {
arr.push("<p>第三方(" + thirdTypeEnum[item.couponsUseRuleVo.thirdType] + "): " + item.couponsUseRuleVo.thirdId+ "</p>");
}
return arr.join('');
}
},
... ... @@ -236,6 +241,8 @@ var Bll = {
btns.push(buttons[array[i]])
}
// 绑定第三方 id
btns.push('<a class="btn btn-warning btn-xs operation-third" data-coupon-id="' + id + '" data-index="' + index + '">绑定三方</a>');
// 增加查看操作记录按钮
btns.push('<a class="btn btn-primary btn-xs operation-records" data-coupon-id="' + id + '">操作记录</a>');
return btns;
... ... @@ -359,6 +366,47 @@ $(document).on('click', '.coupon-info', function () {
Bll.toastInfo(item1, '优惠券详情');
});
// 绑定第三方
$(document).on('click', '.operation-third', function() {
var item = g.rows[$(this).data("index")];
var obj = {};
if (item.couponsUseRuleVo && item.couponsUseRuleVo.thirdType) {
obj = item.couponsUseRuleVo;
}
obj["couponId"] = item.id;
var e = new common.edit("#baseform");
var url = "/coupon/updateCouponsUseRule";
var dialog = common.dialog.confirm("绑定第三方 ID", artTemplate("third-template", obj), function() {
e.submit(url, function (option) {
console.log(option.data);
option.success=function() {
dialog.close();
g.reload();
};
option.error=function(){};
});
return false;
});
// e.on("validate", function() {
// var thirdId = $("#baseform").find("#thirdId").val();
// if ($.trim(thirdId).length == 0) {
// return "请输入第三方 ID";
// }
// });
e.init();
new common.dropDown({ el: "#thirdType" });
});
// 查看操作记录
$(document).on('click', '.operation-records', function() {
... ...
... ... @@ -1941,4 +1941,66 @@ function changeImgQuality() {
$(this).attr("src", src);
}
});
}
\ No newline at end of file
}
$(document).on('change', '.model-default-hotproduct', function() {
let _this = $(this);
let sknList = $(this).val().trim();
// 去重
let sknArray = sknList.split(',');
let skns = [];
$.each(sknArray, function(index, item) {
item = item.trim();
// 排除形如 ‘111,222,’ 最后一个逗号
if(item.length === 0) {
return;
}
item = +item;
// 最多只能8个SKN
if(skns.length >= 8) {
return;
}
// 不能重复
if($.inArray(item, skns) > -1) {
return;
}
skns.push(item);
});
sknList = skns.toString();
$(_this).val(sknList);
if(sknList.length === 0) {
if(jsonMain.resources.defaultHotProducts) {
jsonMain.resources.defaultHotProducts.data = [];
}
return;
}
common.util.__ajax({
url: '/shop/decoration/findProductNotInShop',
data: {
shopId: shopsId,
productSkns: sknList
}
}, function(resp) {
if(resp.code === 200) {
let data = resp.data;
if(data.length > 0) {
common.util.__tip('该店铺不包含以下SKN: ' + data, 'warning');
} else {
let hotProductResource = jsonMain.resources.defaultHotProducts;
if(hotProductResource === undefined) {
hotProductResource = {};
}
hotProductResource.data = skns;
jsonMain.resources.defaultHotProducts = hotProductResource;
}
}
}, true);
})
\ No newline at end of file
... ...
... ... @@ -171,6 +171,11 @@ pc端店铺模板css
background: url("assets/images/shop2.png");
}
.contentpanel-pc .model-main-right .model-default-hotproduct {
min-height: 40px;
margin-bottom: 6px;
}
/*------------------------slide--------------------------*/
.contentpanel-pc .model-slide{
float: left;
... ... @@ -304,6 +309,8 @@ pc端店铺模板css
border: 5px solid #7cfc00;
}
/******* showTab定制 ********/
.contentpanel-pc .showTab .editorBorder{
height: 60px;
... ...