Files
liche/admin/views/biz/brand/edit.php
T

111 lines
4.4 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<form id="vue-edit" class="am-form am-form-horizontal" :action="action" data-auto="true" method="post" style="width: 90%;padding-top: 10px">
<div class="am-form-group">
<label class="am-para-label">品牌名称:</label>
<div class="am-para-input">
<input type="text" placeholder="输入品牌名称" name="brand_name" v-model="info.brand_name"/>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 0">
<label class="am-para-label">logo</label>
<div class="am-para-input">
<div class="am-form-group am-form-file">
<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="img"><i class="am-icon-cloud-upload"></i> 选择要上传的文件
</button>
<input type="hidden" id="brand_logo" name="img" value="<?= $info['brand_logo'] ?>" class="layui-input">
<img data-tips-image style="height:auto;max-height:32px;max-width:32px"
src="<?= $info['brand_logo'] ? build_qiniu_image_url($info['brand_logo']) : '' ?>"/>
尺寸100x100
</div>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">类型:</label>
<div class="am-para-input wp40">
<select name="type" v-model="info.type">
<option value="0">选择类型</option>
<option v-for="(v,i) in typeAry" :value="i">{{v}}</option>
</select>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">公司:</label>
<div class="am-para-input wp40">
<select name="type" v-model="info.company_id">
<option value="0">选择公司</option>
<option v-for="(v,i) in companyAry" :value="i">{{v}}</option>
</select>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 2rem">
<div class="am-para-input">
<button class="am-btn am-btn-secondary" type="button" @click="saveEdit">保存</button>
</div>
</div>
</form>
<script>
var loading = 0;
var vue_obj;
$(function(){
vue_obj = new Vue({
el: '#vue-edit',
data: {
info:{},
action:'',
typeAry:[]
},
mounted:function(){
var vm = this;
vm.info = <?=json_encode($info)?>;
vm.action = '<?=$action?>';
vm.typeAry = <?=json_encode($typeAry)?>;
vm.companyAry = <?=json_encode($companyAry)?>;
},
methods:{
saveEdit:function(){
var vm = this;
if(1 == loading){
return 0;
}
loading = 1;
vm.info.brand_logo = $("#brand_logo").val();
$.ajax({
url: vm.action,
type: 'post',
dataType: 'json',
data: {info:vm.info},
beforeSend: function () {
layer.load(1, {
shade: [0.1, '#fff'] //0.1透明度的白色背景
});
},
success: function (data) {
loading = 0;
if (1 == data.code) {
layer.msg(data.msg, {
icon: 1,
time: 2000
}, function () {
window.location.reload();
});
} else {
layer.msg(data.msg, {icon: 2});
}
},
complete: function () {
loading = 0;
layer.closeAll('loading');
}
});
}
},
watch:{}
});
});
</script>