Authored by 马力

Merge branch 'dev-weibo-card' into grey

... ... @@ -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'%>
... ...
... ... @@ -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() {
... ...