- 接口数据
{code: 1, result: {,…}, msg: null}
code: 1
msg: null
result: {,…}
distribution: {trade_scheme: “only_platform”, member: {platform: 10}, goods: {platform: 10}, course: {platform: 10},…}
activity: {platform: 10}
course: {platform: 10}
goods: {platform: 10}
member: {platform: 10}
recharge: {platform: 10}
trade_scheme: “only_platform”
- 渲染的界面样式
- 代码实现
<div class="sections">
<!--基本信息-->
<div class="goodsClassify">
<div class="goodsClassifyTitle">基本信息</div>
<div class="goodsContent" id="basic_one">
</div>
</div>
<div class="preserved">
<button type="button" id="filter-search-btn" class="zent-btn-primary zent-btn">同步</button>
</div>
</div>
<script type="text/html" id="tpl_basic_one">
{{each}}
{{if $index == 'trade_scheme'}}
<div class="messageItem">
<div class="control"><i class="xing">*</i>{{$index}}:</div>
<div class="formControls"><input type="text" readonly data-tag="{{$index}}" class="goods_name"
value="{{$value}}"></div>
</div>
{{else}}
<div class="messageItem">
<div class="control"><i class="xing">*</i>{{$index}}:</div>
<div class="formControls"><input type="text" readonly data-tag="{{$index}}" class="goods_name"
value="{{$value.platform}}"></div>
</div>
{{/if}}
{{/each}}
</script>
$(document).on("click", "#filter-search-btn", function () {
$.Ajax({
url: api.syncDistribution,
is_login: true,
success: function (res) {
console.log(res);
if (res.code == 1) {
layer.msg(res.result.msg);
$('#contentTable').bootstrapTable('refresh');
} else {
layer.msg(res.result.msg)
}
},
fail: function (res) {
layer.msg(res.result.msg)
}
})
});