|  |  |  | 
|---|
|  |  |  | <select name="gainType" class="gain-type" lay-filter="gain-type-select"> | 
|---|
|  |  |  | <option value="1">会员日</option> | 
|---|
|  |  |  | <option value="2">会员生日</option> | 
|---|
|  |  |  | <option value="3">其他</option> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | 
|---|
|  |  |  | <input type="text" id="awardImage{{d.index}}" name="awardImage{{d.index}}" autocomplete="off" value="{{d.image}}" class="layui-input febs-hide"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--<script type="text/html" id="seqInput">--> | 
|---|
|  |  |  | <!--    <input type="text" name="seq" autocomplete="off" class="layui-input">--> | 
|---|
|  |  |  | <!--</script>--> | 
|---|
|  |  |  | <!-- 表格操作栏 end --> | 
|---|
|  |  |  | <script data-th-inline="javascript"> | 
|---|
|  |  |  | layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree','dropdown', 'laydate', 'layedit', 'upload', 'element', 'table', 'xmSelect'], function () { | 
|---|
|  |  |  | 
|---|
|  |  |  | benefitsData = [[${benefitsData}]], | 
|---|
|  |  |  | element = layui.element; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var tableBenefitsItemsData=[]; | 
|---|
|  |  |  | form.render(); | 
|---|
|  |  |  | formSelects.render(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function initValue() { | 
|---|
|  |  |  | form.val("goods-detail-form", { | 
|---|
|  |  |  | "id": benefitsData.id, | 
|---|
|  |  |  | "goodsNo": mailGoodsDetail.name, | 
|---|
|  |  |  | "categoryId": mailGoodsDetail.categoryId, | 
|---|
|  |  |  | "mailGoodsSkuDetailVo": mailGoodsDetail.mailGoodsSkuDetailVo, | 
|---|
|  |  |  | "unit": mailGoodsDetail.unit, | 
|---|
|  |  |  | "originalPrice": mailGoodsDetail.originalPrice, | 
|---|
|  |  |  | "presentPrice": mailGoodsDetail.presentPrice, | 
|---|
|  |  |  | "goodsIntrodution": mailGoodsDetail.goodsIntrodution, | 
|---|
|  |  |  | "thumb": mailGoodsDetail.thumb, | 
|---|
|  |  |  | "goodsDetails": mailGoodsDetail.goodsDetails, | 
|---|
|  |  |  | "isHot": mailGoodsDetail.isHot, | 
|---|
|  |  |  | "goodsName": mailGoodsDetail.goodsName | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //图片上传 | 
|---|
|  |  |  | upload.render({ | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var tableBenefitsItemsData=[]; | 
|---|
|  |  |  | var tableIns = table.render({ | 
|---|
|  |  |  | elem: '#benefitsDetailsItem' | 
|---|
|  |  |  | ,limit:999 | 
|---|
|  |  |  | 
|---|
|  |  |  | $(".linkContent").each(function(index, elem) { | 
|---|
|  |  |  | var dataIndex = $(this).attr('data-index'); | 
|---|
|  |  |  | var $this = $(this); | 
|---|
|  |  |  | $(this).off('blur') | 
|---|
|  |  |  | $(this).on('blur', function() { | 
|---|
|  |  |  | var data = $this.val(); | 
|---|
|  |  |  | hasData[dataIndex - 1].content = data; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | $(".goodsSelect").each(function(index, elem) { | 
|---|
|  |  |  | var dataIndex = $(this).attr('data-index'); | 
|---|
|  |  |  | $(this).off('click') | 
|---|
|  |  |  | $(this).on('click', function() { | 
|---|
|  |  |  | febs.modal.open('选择商品', 'modules/vip/config/goodsSelect/' + dataIndex, { | 
|---|
|  |  |  | btn: ['提交', '取消'], | 
|---|
|  |  |  | 
|---|
|  |  |  | function listenerCouponSelect() { | 
|---|
|  |  |  | $(".couponSelect").each(function(index, elem) { | 
|---|
|  |  |  | var dataIndex = $(this).attr('data-index'); | 
|---|
|  |  |  | $(this).off('click') | 
|---|
|  |  |  | $(this).on('click', function() { | 
|---|
|  |  |  | febs.modal.open('选择优惠券', 'modules/vip/config/couponSelect/' + dataIndex, { | 
|---|
|  |  |  | btn: ['提交', '取消'], | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var data = {}; | 
|---|
|  |  |  | data.linkType = linkTypeVal; | 
|---|
|  |  |  | if (isClickVal == 1) { | 
|---|
|  |  |  | data.linkType = linkTypeVal; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | data.isClick = isClickVal; | 
|---|
|  |  |  | addTableDate(data); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | form.on('submit(vipBenefits-edit-form-submit)', function (data) { | 
|---|
|  |  |  | data.field.details = tableBenefitsItemsData; | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | 'url':ctx + 'admin/vip/benefits/addBenefits', | 
|---|
|  |  |  | 'url':ctx + 'admin/vip/benefits/addOrEditBenefits', | 
|---|
|  |  |  | 'type':'post', | 
|---|
|  |  |  | 'dataType':'json', | 
|---|
|  |  |  | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | tableBenefitsItemsData = hasData; | 
|---|
|  |  |  | console.log(tableBenefitsItemsData) | 
|---|
|  |  |  | $(".couponSelect").each(function(index, elem) { | 
|---|
|  |  |  | var dataIndex = $(this).attr('data-index'); | 
|---|
|  |  |  | if (dataIndex == tableIndex) { | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | initValue(); | 
|---|
|  |  |  | function initValue() { | 
|---|
|  |  |  | form.val("vipBenefits-edit-form", { | 
|---|
|  |  |  | "id": benefitsData.id, | 
|---|
|  |  |  | "name": benefitsData.name, | 
|---|
|  |  |  | "gainType": benefitsData.gainType, | 
|---|
|  |  |  | "type": benefitsData.type, | 
|---|
|  |  |  | "scoreMultiple": benefitsData.scoreMultiple, | 
|---|
|  |  |  | "remark": benefitsData.remark, | 
|---|
|  |  |  | "icon":benefitsData.icon, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | $('#demo2').attr('src', benefitsData.icon); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var details = benefitsData.details; | 
|---|
|  |  |  | for(var i = 0; i < details.length; i++) { | 
|---|
|  |  |  | details[i].index = i + 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | reloadTable(details); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | tableBenefitsItemsData = details; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|