material_510

This commit is contained in:
dengbw
2022-05-10 15:56:18 +08:00
parent 77d287b592
commit 8db8ea688f
2 changed files with 167 additions and 12 deletions
+165 -11
View File
@@ -83,7 +83,7 @@
<div class="am-form-group">
<label class="am-para-label">活动规则:</label>
<div class="am-para-input" style="width: 80%">
<textarea rows="3" v-model="info.rule"></textarea>
<textarea rows="4" v-model="info.rule"></textarea>
</div>
</div>
<div class="am-form-group">
@@ -109,19 +109,102 @@
</div>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">奖品说明:</label>
<div class="am-para-input" style="width: 80%">
<input type="text" v-model="info.prizes_note">
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">配置奖品:</label>
<div class="am-para-input">
<div v-for="(v,i) in info.kpi_list" class="am-form-inline" style="padding-bottom: 10px;">
<div class="am-form-group">{{v.title}}</div>
<div class="am-form-group" style="width: 10%">
<input type="text" v-model="v.num">
<div class="col-sm-10">
<table class="table table-hover table-middle" style="table-layout:fixed">
<colgroup>
<col width="80px"/>
<col width="30%">
<col width="15%">
<col width="30%"/>
<col width="">
</colgroup>
<thead>
<tr>
<th class="text-center">图片</th>
<th class="text-center">标题</th>
<th class="text-center">排序</th>
<th class="text-center">链接</th>
<th class="text-right">
<a href="javascript:" style="margin-top: 2px;" class="btn btn-primary btn-sm"
@click='adModal()'>添加</a>
</th>
</tr>
</thead>
<tbody>
<template v-for="(item,index) in ad_list">
<tr>
<td><img data-tips-image :src="item.img_url"></td>
<td class="text-center">{{item.title}}</td>
<td class="text-center">
<div :id="'group_name_txt_'+index">{{item.order_view}} <a href="javascript:"
@click="showGroupEditForm(index)"><i
class="fa fa-edit"></i></a></div>
<input :id="'group_name_'+index" @blur="editGroupName(index,item.id)"
style="display: none;" type="number" class="form-control"
v-model="item.order_view" placeholder="请输入排序值">
</td>
<td class="text-center" v-if="item.jump_type==1">报名弹窗</td>
<td class="text-center" v-else>{{item.link}}</td>
<td class="text-right">
<a href="javascript:void(0);" style="margin-top:2px;"
class="btn btn-default btn-sm" @click='adModal(item)'>编辑</a>
<a href="javascript:void(0);" style="margin-top:2px;"
class="btn btn-danger btn-sm" @click='removeAd(index)'>删除</a>
</td>
</tr>
</template>
</tbody>
</table>
<template v-if="ad_list.length <=0">
<div style="text-align: center;">无数据</div>
</template>
</div>
<div id="ad-modal" style="display: none;">
<div class="form-horizontal" style="padding-top: 20px;">
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
<label class="col-sm-2 control-label">标题</label>
<div class="col-sm-8">
<input type="text" class="form-control" v-model="ad_item.title"
placeholder="请输入标题">
</div>
</div>
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
<label class="col-sm-2 control-label">图片</label>
<div class="col-sm-8">
<div class="input-group" style="width: 100%">
<input type="text" style="width: 60%" name="ad_img" id="ad_img"
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
class="form-control">
<img data-tips-image name="ad_img_url" id="ad_img_url"
style="height:auto;max-height:31px;min-width:31px;margin-left: 5px;margin-right: 5px;"
/>
<button type="button" class="am-btn am-btn-default am-btn-sm"
data-file="1" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-field="ad_img">上传图片
</button>
</div>
</div>
</div>
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
<label class="col-sm-2 control-label">排序值</label>
<div class="col-sm-4">
<input type="number" class="form-control" v-model="ad_item.order_view"
placeholder="请输入排序">
</div>
<div style="padding-top:7px;">
<small class="text-muted">越大越靠前</small>
</div>
</div>
</div>
<div class="am-form-group">{{v.num_tag}}</div>
<div class="am-form-group" style="width: 10%;margin-left: 15px;">
<input type="text" v-model="v.score">
</div>
<div class="am-form-group">{{v.score_tag}}</div>
</div>
</div>
</div>
@@ -159,7 +242,9 @@
el: '#vue-edit',
data: {
info: {},
status_list: []
status_list: [],
ad_list: [],
ad_item: {},
},
mounted() {
var that = this;
@@ -172,6 +257,75 @@
updated: function () {
},
methods: {
// 修改排序
showGroupEditForm: function (index) {
$("#group_name_" + index).show();
$("#group_name_txt_" + index).hide();
$('#group_name_' + index).focus();
},
// 排序
editGroupName: function (index, group_id) {
var order_view = $("#group_name_" + index).val();
if (order_view == '') {
layer.msg("排序值不能为空!", {icon: 2});
return false;
}
this.ad_list.sort(function (a, b) {
return b.order_view - a.order_view;
});
$("#group_name_" + index).hide();
$("#group_name_txt_" + index).show();
},
adModal: function (item) {
var that = this;
var _title = '新增广告';
that.ad_item = {};
var _img = '';
var _img_url = '';
if (item) {
that.ad_item = item;
_title = '编辑广告';
_img = item.img;
_img_url = item.img_url;
} else {
that.ad_item = {"order_view": 50, "jump_type": 0};
}
$('#ad_img').val(_img);
$("#ad_img_url").attr('src', _img_url);
layer.open({
type: 1,
area: ['50%', '38%'], //宽高
content: $('#ad-modal'),
title: _title,
shade: false,
btn: ['确定', '取消'],
yes: function (index) {
_img = $('#ad_img').val();
_img_url = $("#ad_img_url")[0].src;
if (!item) {
that.ad_list.push({
title: that.ad_item.title,
img: _img,
img_url: _img_url,
link: that.ad_item.link,
order_view: that.ad_item.order_view,
jump_type: that.ad_item.jump_type
});
} else {
item.img = _img;
item.img_url = _img_url;
}
that.ad_list.sort(function (a, b) {
return b.order_view - a.order_view;
})
layer.close(index);
}
});
},
removeAd: function (index) {
var vm = this;
vm.ad_list.splice(index, 1);
},
editType: function (index) {
var vm = this;
if (index == 1) {
+2 -1
View File
@@ -38,7 +38,8 @@ class Home extends Wxapp
*/
protected function get_tabs()
{
$distribute = intval($this->input_param('distribute'));
//$distribute = intval($this->input_param('distribute'));
$distribute = 1;//显示所有品牌
$list = array();
$res = [];
if ($distribute == 1) {//分销