Authored by xuhongyun

Merge branch 'master' into dev-xuhongyun

@@ -57,4 +57,8 @@ module.exports = function (app) { @@ -57,4 +57,8 @@ module.exports = function (app) {
57 57
58 // 查询优惠券操作记录 58 // 查询优惠券操作记录
59 app.post("/coupon/getOperationRecords", "CouponList_getOperationRecords"); 59 app.post("/coupon/getOperationRecords", "CouponList_getOperationRecords");
  60 +
  61 + // 更新第三方信息
  62 + app.post("/coupon/updateCouponsUseRule", "CouponList_updateCouponsUseRule");
  63 +
60 }; 64 };
@@ -81,6 +81,15 @@ module.exports = { @@ -81,6 +81,15 @@ module.exports = {
81 params: { 81 params: {
82 couponsId: {type: Number} 82 couponsId: {type: Number}
83 } 83 }
  84 + },
  85 + updateCouponsUseRule: {
  86 + title: "更新第三方信息",
  87 + url: "/coupon/updateCouponsUseRule",
  88 + params: {
  89 + couponId: {type: Number},
  90 + thirdType: {type: Number},
  91 + thirdId: {type: String}
  92 + }
84 } 93 }
85 } 94 }
86 -};  
  95 +};
@@ -235,6 +235,27 @@ @@ -235,6 +235,27 @@
235 </table> 235 </table>
236 </div> 236 </div>
237 </script> 237 </script>
  238 +<script id="third-template" type="text/template" charset="utf-8">
  239 + <div class="row" id="baseform">
  240 + <div class="form-group">
  241 + <label class="col-sm-2 control-label">第三方类型 </label>
  242 + <div class="col-sm-8">
  243 + <input type="hidden" name="couponId" id="couponId" value="{{couponId}}"/>
  244 + <select name="thirdType" id="thirdType" {{if thirdType == 1}}disabled{{/if}} tabindex="-1" class="select2-offscreen" style="width: 100px;">
  245 + <option value="1" {{if thirdType == 1}}selected{{/if}}>微信</option>
  246 + <option value="2" {{if thirdType == 2}}selected{{/if}}>支付宝</option>
  247 + <option value="3" {{if thirdType != 1 && thirdType != 2}}selected{{/if}}>微博</option>
  248 + </select>
  249 + </div>
  250 + </div>
  251 + <div class="form-group">
  252 + <label class="col-sm-2 control-label">第三方 ID</label>
  253 + <div class="col-sm-8">
  254 + <input id="thirdId" class="form-control panel-input" value="{{thirdId}}" {{if thirdType == 1}}readonly{{/if}} type="text" placeholder="第三方 ID">
  255 + </div>
  256 + </div>
  257 + </div>
  258 +</script>
238 <%include '../../../common/views/__ui/footer'%> 259 <%include '../../../common/views/__ui/footer'%>
239 260
240 261
@@ -70,4 +70,5 @@ module.exports = function (app) { @@ -70,4 +70,5 @@ module.exports = function (app) {
70 //获取店铺下的BLK商品 70 //获取店铺下的BLK商品
71 app.post("/shop/decoration/findBlkProductByShopsId","shopDecoration_findBlkProductByShopsId"); 71 app.post("/shop/decoration/findBlkProductByShopsId","shopDecoration_findBlkProductByShopsId");
72 72
  73 + app.post("/shop/decoration/findProductNotInShop", "shopDecoration_findProductNotInShop");
73 } 74 }
@@ -132,6 +132,15 @@ @@ -132,6 +132,15 @@
132 {name: 'productSkn', type: 'Number'}, 132 {name: 'productSkn', type: 'Number'},
133 {name: 'size', type: 'number'} 133 {name: 'size', type: 'number'}
134 ] 134 ]
  135 + },
  136 +
  137 + findProductNotInShop: {
  138 + title: "检查商品是否属于店铺",
  139 + url: "/ShopsDecoratorRest/findProductNotInShop",
  140 + params: [
  141 + {name: 'shopId', type: 'Number'},
  142 + {name: 'productSkns', type: 'String'}
  143 + ]
135 } 144 }
136 } 145 }
137 } 146 }
@@ -80,7 +80,16 @@ @@ -80,7 +80,16 @@
80 </div> 80 </div>
81 </div> 81 </div>
82 <!--右侧main--> 82 <!--右侧main-->
83 - <div class="model-main-right model-main-right-default"></div> 83 + <div class="model-main-right">
  84 + <div class="form-group">
  85 + <label class="col-sm-2">推荐商品(以英文逗号分隔,最多8): </label>
  86 + <div class="col-sm-10">
  87 + <input type="text" class="form-control model-default-hotproduct" placeholder="请输入推荐商品,以英文逗号分隔,最多8个SKN"
  88 + value="[[resources.defaultHotProducts && resources.defaultHotProducts.data ? resources.defaultHotProducts.data.toString() : '']]" maxlength="90">
  89 + </div>
  90 + </div>
  91 + <div class="model-main-right-default"></div>
  92 + </div>
84 <div class="clear"></div> 93 <div class="clear"></div>
85 </div> 94 </div>
86 </div> 95 </div>
@@ -3,8 +3,8 @@ @@ -3,8 +3,8 @@
3 */ 3 */
4 4
5 'use strict'; 5 'use strict';
6 -var $ = require('jquery'),  
7 - common = require('../../../common/common'); 6 +var $ = require('jquery'), common = require('../../../common/common');
  7 +var artTemplate = common.artTemplate;
8 /** 8 /**
9 * 全局变量 9 * 全局变量
10 * couponTypes 优惠券类型 10 * couponTypes 优惠券类型
@@ -18,12 +18,14 @@ var useLimitTypes = ["无限制", "货物件数限制", "订单金额限制"]; @@ -18,12 +18,14 @@ var useLimitTypes = ["无限制", "货物件数限制", "订单金额限制"];
18 // var customTypes = ["新客户", "银卡会员", "金卡会员", "白金卡会员", "普通用户(不含新客)"]; 18 // var customTypes = ["新客户", "银卡会员", "金卡会员", "白金卡会员", "普通用户(不含新客)"];
19 var customTypes={1:"新客户",2:"银卡会员", 3:"金卡会员", 4:"白金卡会员", 5:"普通用户(不含新客)",9:"学生"}; 19 var customTypes={1:"新客户",2:"银卡会员", 3:"金卡会员", 4:"白金卡会员", 5:"普通用户(不含新客)",9:"学生"};
20 var shopPriceLimitsTable={1:"成交价低于吊牌价三折",2:"限量商品"}; 20 var shopPriceLimitsTable={1:"成交价低于吊牌价三折",2:"限量商品"};
  21 +var thirdTypeEnum={1:"微信", 2:"支付宝", 3: "微薄"};
21 22
22 var ENUM = { 23 var ENUM = {
23 status: {0: '待审核', 1: '审核通过', 2: '驳回', '-1': '过期', 3: '作废'},//全部 24 status: {0: '待审核', 1: '审核通过', 2: '驳回', '-1': '过期', 3: '作废'},//全部
24 tips: {"0": 0, "1": 0, "2": 0, "3": 0, "4": 0, "all": 0} 25 tips: {"0": 0, "1": 0, "2": 0, "3": 0, "4": 0, "all": 0}
25 }; 26 };
26 var columnname = "all"; 27 var columnname = "all";
  28 +
27 /** 29 /**
28 * 初始化下拉框 30 * 初始化下拉框
29 */ 31 */
@@ -121,6 +123,9 @@ var g = new common.grid({ @@ -121,6 +123,9 @@ var g = new common.grid({
121 arr.push("<p>优惠结果:" + item.couponAmount + "</p>"); 123 arr.push("<p>优惠结果:" + item.couponAmount + "</p>");
122 arr.push("<p>数量:" + item.couponNum + "</p>"); 124 arr.push("<p>数量:" + item.couponNum + "</p>");
123 arr.push("<p>部门:" + item.departmentName + "</p>"); 125 arr.push("<p>部门:" + item.departmentName + "</p>");
  126 + if (item.couponsUseRuleVo && item.couponsUseRuleVo.thirdType) {
  127 + arr.push("<p>第三方(" + thirdTypeEnum[item.couponsUseRuleVo.thirdType] + "): " + item.couponsUseRuleVo.thirdId+ "</p>");
  128 + }
124 return arr.join(''); 129 return arr.join('');
125 } 130 }
126 }, 131 },
@@ -236,6 +241,8 @@ var Bll = { @@ -236,6 +241,8 @@ var Bll = {
236 btns.push(buttons[array[i]]) 241 btns.push(buttons[array[i]])
237 } 242 }
238 243
  244 + // 绑定第三方 id
  245 + btns.push('<a class="btn btn-warning btn-xs operation-third" data-coupon-id="' + id + '" data-index="' + index + '">绑定三方</a>');
239 // 增加查看操作记录按钮 246 // 增加查看操作记录按钮
240 btns.push('<a class="btn btn-primary btn-xs operation-records" data-coupon-id="' + id + '">操作记录</a>'); 247 btns.push('<a class="btn btn-primary btn-xs operation-records" data-coupon-id="' + id + '">操作记录</a>');
241 return btns; 248 return btns;
@@ -359,6 +366,47 @@ $(document).on('click', '.coupon-info', function () { @@ -359,6 +366,47 @@ $(document).on('click', '.coupon-info', function () {
359 366
360 Bll.toastInfo(item1, '优惠券详情'); 367 Bll.toastInfo(item1, '优惠券详情');
361 }); 368 });
  369 +// 绑定第三方
  370 +$(document).on('click', '.operation-third', function() {
  371 +
  372 + var item = g.rows[$(this).data("index")];
  373 + var obj = {};
  374 + if (item.couponsUseRuleVo && item.couponsUseRuleVo.thirdType) {
  375 + obj = item.couponsUseRuleVo;
  376 + }
  377 + obj["couponId"] = item.id;
  378 +
  379 + var e = new common.edit("#baseform");
  380 +
  381 + var url = "/coupon/updateCouponsUseRule";
  382 +
  383 + var dialog = common.dialog.confirm("绑定第三方 ID", artTemplate("third-template", obj), function() {
  384 +
  385 + e.submit(url, function (option) {
  386 +
  387 + console.log(option.data);
  388 +
  389 + option.success=function() {
  390 + dialog.close();
  391 + g.reload();
  392 + };
  393 + option.error=function(){};
  394 + });
  395 +
  396 + return false;
  397 + });
  398 +
  399 + // e.on("validate", function() {
  400 + // var thirdId = $("#baseform").find("#thirdId").val();
  401 + // if ($.trim(thirdId).length == 0) {
  402 + // return "请输入第三方 ID";
  403 + // }
  404 + // });
  405 +
  406 + e.init();
  407 +
  408 + new common.dropDown({ el: "#thirdType" });
  409 +});
362 410
363 // 查看操作记录 411 // 查看操作记录
364 $(document).on('click', '.operation-records', function() { 412 $(document).on('click', '.operation-records', function() {
@@ -1941,4 +1941,66 @@ function changeImgQuality() { @@ -1941,4 +1941,66 @@ function changeImgQuality() {
1941 $(this).attr("src", src); 1941 $(this).attr("src", src);
1942 } 1942 }
1943 }); 1943 });
1944 -}  
  1944 +}
  1945 +
  1946 +$(document).on('change', '.model-default-hotproduct', function() {
  1947 + let _this = $(this);
  1948 + let sknList = $(this).val().trim();
  1949 +
  1950 + // 去重
  1951 + let sknArray = sknList.split(',');
  1952 + let skns = [];
  1953 + $.each(sknArray, function(index, item) {
  1954 + item = item.trim();
  1955 + // 排除形如 ‘111,222,’ 最后一个逗号
  1956 + if(item.length === 0) {
  1957 + return;
  1958 + }
  1959 +
  1960 + item = +item;
  1961 +
  1962 + // 最多只能8个SKN
  1963 + if(skns.length >= 8) {
  1964 + return;
  1965 + }
  1966 +
  1967 + // 不能重复
  1968 + if($.inArray(item, skns) > -1) {
  1969 + return;
  1970 + }
  1971 +
  1972 + skns.push(item);
  1973 + });
  1974 +
  1975 + sknList = skns.toString();
  1976 + $(_this).val(sknList);
  1977 +
  1978 + if(sknList.length === 0) {
  1979 + if(jsonMain.resources.defaultHotProducts) {
  1980 + jsonMain.resources.defaultHotProducts.data = [];
  1981 + }
  1982 + return;
  1983 + }
  1984 +
  1985 + common.util.__ajax({
  1986 + url: '/shop/decoration/findProductNotInShop',
  1987 + data: {
  1988 + shopId: shopsId,
  1989 + productSkns: sknList
  1990 + }
  1991 + }, function(resp) {
  1992 + if(resp.code === 200) {
  1993 + let data = resp.data;
  1994 + if(data.length > 0) {
  1995 + common.util.__tip('该店铺不包含以下SKN: ' + data, 'warning');
  1996 + } else {
  1997 + let hotProductResource = jsonMain.resources.defaultHotProducts;
  1998 + if(hotProductResource === undefined) {
  1999 + hotProductResource = {};
  2000 + }
  2001 + hotProductResource.data = skns;
  2002 + jsonMain.resources.defaultHotProducts = hotProductResource;
  2003 + }
  2004 + }
  2005 + }, true);
  2006 +})
@@ -171,6 +171,11 @@ pc端店铺模板css @@ -171,6 +171,11 @@ pc端店铺模板css
171 background: url("assets/images/shop2.png"); 171 background: url("assets/images/shop2.png");
172 } 172 }
173 173
  174 +.contentpanel-pc .model-main-right .model-default-hotproduct {
  175 + min-height: 40px;
  176 + margin-bottom: 6px;
  177 +}
  178 +
174 /*------------------------slide--------------------------*/ 179 /*------------------------slide--------------------------*/
175 .contentpanel-pc .model-slide{ 180 .contentpanel-pc .model-slide{
176 float: left; 181 float: left;
@@ -304,6 +309,8 @@ pc端店铺模板css @@ -304,6 +309,8 @@ pc端店铺模板css
304 border: 5px solid #7cfc00; 309 border: 5px solid #7cfc00;
305 } 310 }
306 311
  312 +
  313 +
307 /******* showTab定制 ********/ 314 /******* showTab定制 ********/
308 .contentpanel-pc .showTab .editorBorder{ 315 .contentpanel-pc .showTab .editorBorder{
309 height: 60px; 316 height: 60px;