init: import production code mss.nahaichuan.com (exclude Runtime/Uploads/backups/logs)
这个提交包含在:
@@ -0,0 +1,107 @@
|
||||
<!--[1.6.38]-->
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Retail/css/goodsList.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Retail/css/myscroll.css"/>
|
||||
<style>
|
||||
strong {
|
||||
color: orangered;
|
||||
}
|
||||
|
||||
.layui-input-inline {
|
||||
width: 258px !important;
|
||||
}
|
||||
|
||||
input[type=number] {
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
|
||||
.layui-form-label {
|
||||
width: 200px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
|
||||
input[type=number]::-webkit-inner-spin-button,
|
||||
input[type=number]::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
<div class="goodsBox">
|
||||
<div class="goods_title">
|
||||
<div class="goods_title_inner">
|
||||
收银机设置
|
||||
</div>
|
||||
</div>
|
||||
<div class="goods_edit">
|
||||
<if condition="$authArr['model'] eq true">
|
||||
<button class="layui-btn" id="syncModel" type="button" style="margin-left: 20px;">统一设置收银机模板</button>
|
||||
</if>
|
||||
<if condition="$authArr['screen'] eq true">
|
||||
<button class="layui-btn" id="screen" type="button" style="margin-left: 20px;">收银机副屏设置</button>
|
||||
</if>
|
||||
<if condition="$authArr['self_cash'] eq true">
|
||||
<button class="layui-btn" id="self" type="button" style="margin-left: 20px;">自助收银轮播设置</button>
|
||||
</if>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
layui.use(['layer', 'form'], function () {
|
||||
var layer = layui.layer;
|
||||
var form = layui.form;
|
||||
|
||||
form.on('switch(nearby_status)', function (data) {
|
||||
if (data.elem.checked == true) {
|
||||
var nearby_status = 1;
|
||||
} else if (data.elem.checked == false) {
|
||||
var nearby_status = 2;
|
||||
}
|
||||
$.ajax({
|
||||
url: "{:U('saveNearby')}",
|
||||
type: 'post',
|
||||
data: {nearby_status: nearby_status},
|
||||
success: function (res) {
|
||||
if (res.status == 1) {
|
||||
layer.msg(res.msg, {icon: 1});
|
||||
} else {
|
||||
layer.msg(res.msg, {icon: 2});
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
$('#syncModel').click(function () {
|
||||
layer.open({
|
||||
type: 2,
|
||||
content: "{:U('model')}?type=1",
|
||||
title: "统一设置-收银机模板",
|
||||
area: ['calc(100% - 160px)', 'calc(100% - 65px)'],
|
||||
shade: 0,
|
||||
offset: 'rb',
|
||||
btnAlign: 'c'
|
||||
})
|
||||
})
|
||||
$('#screen').click(function () {
|
||||
layer.open({
|
||||
type: 2,
|
||||
content: "{:U('screen')}",
|
||||
title: "统一设置-收银机副屏",
|
||||
area: ['calc(100% - 160px)', 'calc(100% - 65px)'],
|
||||
shade: 0,
|
||||
offset: 'rb',
|
||||
btnAlign: 'c'
|
||||
})
|
||||
})
|
||||
$('#self').click(function () {
|
||||
layer.open({
|
||||
type: 2,
|
||||
content: "{:U('self_cash')}",
|
||||
title: "自助收银轮播图",
|
||||
area: ['calc(100% - 160px)', 'calc(100% - 65px)'],
|
||||
shade: 0,
|
||||
offset: 'rb',
|
||||
btnAlign: 'c'
|
||||
})
|
||||
})
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,227 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<!--[1.1.96]-->
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/layui/css/layui.css"/>
|
||||
<title>收银机模板</title>
|
||||
<style>
|
||||
.label_radio {
|
||||
height: 18px;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
line-height: 19px;
|
||||
color: #313131;
|
||||
}
|
||||
|
||||
.label_radio > input {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
opacity: 0;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.label_radio > span {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
border: 2px solid #ccc;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
cursor: pointer;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.label_radio > input:checked + span:after {
|
||||
background-color: #009688 !important;
|
||||
}
|
||||
|
||||
.label_radio > input:checked + span {
|
||||
border-color: #009688 !important;
|
||||
}
|
||||
|
||||
.label_radio > span::after {
|
||||
position: absolute;
|
||||
content: "";
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background-color: #ddd;
|
||||
top: 4px;
|
||||
left: 4px;
|
||||
transition: .5s;
|
||||
}
|
||||
|
||||
.model_con {
|
||||
width: 45%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: 2.5%;
|
||||
}
|
||||
|
||||
.model_img {
|
||||
width: 100%;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.list {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.see_img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.save {
|
||||
width: 100px;
|
||||
height: 36px;
|
||||
color: white;
|
||||
background-color: #009688;
|
||||
margin: 20px auto;
|
||||
text-align: center;
|
||||
line-height: 36px;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.save:hover {
|
||||
background-color: #409688;
|
||||
}
|
||||
.layui-carousel{
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<input type="hidden" id="id" value="{$id}">
|
||||
<div class="list">
|
||||
<div class="model_con">
|
||||
<div class="layui-carousel" id="test1">
|
||||
<div carousel-item>
|
||||
<a class="see_img" target="_blank" href="__PUBLIC__/Retail/images/model/model1-01.png">
|
||||
<img class="model_img" src="__PUBLIC__/Retail/images/model/model1-01.png">
|
||||
</a>
|
||||
<a class="see_img" target="_blank" href="__PUBLIC__/Retail/images/model/model1-02.png">
|
||||
<img class="model_img" src="__PUBLIC__/Retail/images/model/model1-02.png">
|
||||
</a>
|
||||
<a class="see_img" target="_blank" href="__PUBLIC__/Retail/images/model/model1-03.png">
|
||||
<img class="model_img" src="__PUBLIC__/Retail/images/model/model1-03.png">
|
||||
</a>
|
||||
<a class="see_img" target="_blank" href="__PUBLIC__/Retail/images/model/model1-04.png">
|
||||
<img class="model_img" src="__PUBLIC__/Retail/images/model/model1-04.png">
|
||||
</a>
|
||||
<a class="see_img" target="_blank" href="__PUBLIC__/Retail/images/model/model1-05.png">
|
||||
<img class="model_img" src="__PUBLIC__/Retail/images/model/model1-05.png">
|
||||
</a>
|
||||
<a class="see_img" target="_blank" href="__PUBLIC__/Retail/images/model/model1-06.png">
|
||||
<img class="model_img" src="__PUBLIC__/Retail/images/model/model1-06.png">
|
||||
</a>
|
||||
<a class="see_img" target="_blank" href="__PUBLIC__/Retail/images/model/model1-07.png">
|
||||
<img class="model_img" src="__PUBLIC__/Retail/images/model/model1-07.png">
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<label class="label_radio" for="model1">
|
||||
<input id='model1' type="radio" name="status"
|
||||
<if condition="$status eq 1">checked</if>
|
||||
value="1">模板一(默认)
|
||||
<span></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="model_con">
|
||||
<div class="layui-carousel" id="test2">
|
||||
<div carousel-item>
|
||||
<a class="see_img" target="_blank" href="__PUBLIC__/Retail/images/model/model2-01.png">
|
||||
<img class="model_img" src="__PUBLIC__/Retail/images/model/model2-01.png">
|
||||
</a>
|
||||
<a class="see_img" target="_blank" href="__PUBLIC__/Retail/images/model/model2-02.png">
|
||||
<img class="model_img" src="__PUBLIC__/Retail/images/model/model2-02.png">
|
||||
</a>
|
||||
<a class="see_img" target="_blank" href="__PUBLIC__/Retail/images/model/model2-03.png">
|
||||
<img class="model_img" src="__PUBLIC__/Retail/images/model/model2-03.png">
|
||||
</a>
|
||||
<a class="see_img" target="_blank" href="__PUBLIC__/Retail/images/model/model2-04.png">
|
||||
<img class="model_img" src="__PUBLIC__/Retail/images/model/model2-04.png">
|
||||
</a>
|
||||
<a class="see_img" target="_blank" href="__PUBLIC__/Retail/images/model/model2-05.png">
|
||||
<img class="model_img" src="__PUBLIC__/Retail/images/model/model2-05.png">
|
||||
</a>
|
||||
<a class="see_img" target="_blank" href="__PUBLIC__/Retail/images/model/model2-06.png">
|
||||
<img class="model_img" src="__PUBLIC__/Retail/images/model/model2-06.png">
|
||||
</a>
|
||||
<a class="see_img" target="_blank" href="__PUBLIC__/Retail/images/model/model2-07.png">
|
||||
<img class="model_img" src="__PUBLIC__/Retail/images/model/model2-07.png">
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<label class="label_radio" for="model2">
|
||||
<input id='model2' type="radio" name="status"
|
||||
<if condition="$status eq 2">checked</if>
|
||||
value="2">模板二(商超版)
|
||||
<span></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="save">保存</div>
|
||||
</body>
|
||||
<script type="text/javascript" src="__PUBLIC__/jquery/js/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="__PUBLIC__/layui/layui.js"></script>
|
||||
<script>
|
||||
function useImg() {
|
||||
layui.use(['carousel', 'layer'], function () {
|
||||
var carousel = layui.carousel;
|
||||
//建造实例
|
||||
var width = $('.model_con').width();
|
||||
var heigth = 0.5625*width;
|
||||
console.log(width)
|
||||
carousel.render({
|
||||
elem: '#test1',
|
||||
width: '100%',
|
||||
height: heigth
|
||||
});
|
||||
carousel.render({
|
||||
elem: '#test2',
|
||||
width: '100%',
|
||||
height: heigth
|
||||
});
|
||||
})
|
||||
}
|
||||
useImg();
|
||||
|
||||
$(window).resize(function() {
|
||||
useImg();
|
||||
});
|
||||
|
||||
layui.use(['layer'], function () {
|
||||
$('.save').click(function () {
|
||||
if (!$("input[name='status']:checked").val()) {
|
||||
layer.msg('请选择模板', {time: 1000});
|
||||
return;
|
||||
}
|
||||
var tips = "<php>if(I('get.type')==1){</php>确认统一设置所有收银员模板吗?<php>}else{</php>确认为该收银员设置模板吗<php>}</php>";
|
||||
layer.confirm(tips, function () {
|
||||
$.post("{:U('setModel')}", {
|
||||
type: "{$type}",
|
||||
id: $('#id').val(),
|
||||
status: $("input[name='status']:checked").val()
|
||||
}, function (res) {
|
||||
layer.msg(res.msg, {time: 1000},function () {
|
||||
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
|
||||
parent.layer.close(index); //再执行关闭
|
||||
});
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
</script>
|
||||
</html>
|
||||
@@ -0,0 +1,280 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!--[1.6.48]-->
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>商品</title>
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Retail/css/myscroll.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/vue/element-ui.css">
|
||||
<link rel="stylesheet" href="__PUBLIC__/css/system-gallery.css?v=1.0.3">
|
||||
<script src="__PUBLIC__/jquery/js/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/vue/js/vue2.5.16.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/vue/element-ui.js"></script>
|
||||
<script charset="utf-8" src="__PUBLIC__/js/system-gallery.js?v=1.0.3"></script>
|
||||
<style>
|
||||
.image_slide_show {
|
||||
display: block;
|
||||
font-size: 80px;
|
||||
font-weight: 100;
|
||||
color: #bbb;
|
||||
width: 210px;
|
||||
height: 130px;
|
||||
text-align: center;
|
||||
line-height: 126px;
|
||||
margin-right: 15px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.file_label > input {
|
||||
width: 100px;
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.close {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
line-height: 20px;
|
||||
text-align: center;
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
color: white;
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
right: 15px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.close::selection {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.image_slide_show:hover > .close {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.close:hover {
|
||||
background-color: rgba(0, 0, 0, 0.8);
|
||||
}
|
||||
|
||||
body, html {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
i {
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.banner_wrap {
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" v-cloak>
|
||||
<el-radio size="mini" v-model="type" label="1" border @change="ScreenOperation">与主频一致</el-radio>
|
||||
<el-radio size="mini" v-model="type" label="2" border @change="ScreenOperation">图片/视频</el-radio>
|
||||
<form id="form" style="padding: 20px 0 100px;">
|
||||
<div style="display: none">
|
||||
<input type="file" name="image" id="image">
|
||||
<input type="hidden" name="image_id">
|
||||
<input type="hidden" name="image_type">
|
||||
</div>
|
||||
<div class="pic_set">
|
||||
<div style="margin-left: 53px">
|
||||
<el-button type="primary" size="small" @click="localImage">本地图片/视频</el-button>
|
||||
<el-button type="primary" size="small" @click="selectImage('image')">图库图片/视频</el-button>
|
||||
<i style="color: #c2ccd1;font-size: 15px;">建议尺寸:414 x 204,或等比例图片,视频小于10M</i>
|
||||
</div>
|
||||
<div style="display: flex;padding: 10px 50px;flex-wrap: wrap;">
|
||||
<div class="banner_wrap" v-for="(item,index) in checkStand">
|
||||
<img :src="item.image" class="image_slide_show" v-if="item.type == 1">
|
||||
<video v-if="item.type == 2" :src="item.image" class="image_slide_show"
|
||||
controls="controls">
|
||||
</video>
|
||||
<span class="close" @click="del(index)">X</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<el-dialog title="选择图片" :modal-append-to-body="false" :visible.sync="showSelectImage" custom-class="select-image-el-dialog" :top="'10px'">
|
||||
<template-select-image :can-select-num="1" @selectfile="selectFile"></template-select-image>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: function () {
|
||||
return {
|
||||
showSelectImage: false,
|
||||
actFileName: '',
|
||||
checkStand: {$checkStand},
|
||||
type:'{$type}'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
ScreenOperation:function(){
|
||||
var that = this;
|
||||
$.ajax({
|
||||
url:"{:U('ScreenOperation')}",
|
||||
type:"post",
|
||||
data:{
|
||||
type:that.type
|
||||
},
|
||||
success:function(res){
|
||||
if(res.status == 1){
|
||||
that.$message({
|
||||
type:"success",
|
||||
message:res.msg,
|
||||
duration:1000,
|
||||
})
|
||||
}else{
|
||||
that.$message({
|
||||
type:"warning",
|
||||
message:res.msg,
|
||||
duration:1000,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
selectFile: function (item) {
|
||||
if (item.length) {
|
||||
$('input[name="'+this.actFileName+'"]').val('');
|
||||
$("input[name='" + this.actFileName + "_id']").val(item[0].id);
|
||||
$("input[name='" + this.actFileName + "_type']").val(item[0].type);
|
||||
this.addBanner(item[0].path,item[0].type);
|
||||
}
|
||||
this.showSelectImage = false;
|
||||
},
|
||||
selectImage: function (actName) {
|
||||
this.actFileName = actName;
|
||||
this.showSelectImage = true;
|
||||
},
|
||||
localImage:function () {
|
||||
$('#image').click();
|
||||
},
|
||||
del: function (index) {
|
||||
var that = this;
|
||||
this.$confirm("确认要删除该文件吗?", "温馨提示", {
|
||||
confirmButtonText: '删除',
|
||||
cancelButtonText: '取消',
|
||||
type: 'info'
|
||||
}).then(() => {
|
||||
that.$loading({
|
||||
lock: true,
|
||||
text: '删除中,请等待',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(255, 255, 255, 0.7)'
|
||||
});
|
||||
var checkStand = JSON.parse(JSON.stringify(that.checkStand));
|
||||
$.post("{:U('checkStandDel')}", {
|
||||
id: checkStand[index].id
|
||||
}, function (res) {
|
||||
that.$loading().close();
|
||||
if (res.status == 1) {
|
||||
that.$message({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
duration: 1000
|
||||
});
|
||||
checkStand.splice(index, 1);
|
||||
that.checkStand = [];
|
||||
that.checkStand = checkStand;
|
||||
} else {
|
||||
that.$message({
|
||||
message: res.msg,
|
||||
type: 'error',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
})
|
||||
},
|
||||
addBanner:function (path,type) {
|
||||
var fd = new FormData(document.getElementById('form'));
|
||||
var that = this;
|
||||
that.$loading({
|
||||
lock: true,
|
||||
text: '上传中,请等待',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(255, 255, 255, 0.7)'
|
||||
});
|
||||
$.ajax({
|
||||
url: "{:U('addCheckStand')}",
|
||||
type: "POST",
|
||||
data: fd,
|
||||
processData: false, // jQuery不要去处理发送的数据
|
||||
contentType: false, // jQuery不要去设置Content-Type请求头
|
||||
success: function (res) {
|
||||
that.$loading().close();
|
||||
$('input[name="'+this.actFileName+'"]').val('');
|
||||
if (res.status == 1) {
|
||||
var checkStand = JSON.parse(JSON.stringify(that.checkStand));
|
||||
var obj = {
|
||||
id: res.id,
|
||||
image: path,
|
||||
type:type,
|
||||
}
|
||||
checkStand.unshift(obj);
|
||||
that.checkStand = [];
|
||||
that.checkStand = checkStand;
|
||||
that.$message({
|
||||
type: 'success',
|
||||
message: res.msg,
|
||||
duration: 1000,
|
||||
});
|
||||
} else {
|
||||
that.$message({
|
||||
type: 'error',
|
||||
message: res.msg,
|
||||
duration: 1000
|
||||
});
|
||||
}
|
||||
},
|
||||
error:function () {
|
||||
that.$loading().close();
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
$("input[type='file']").on('change', function () {
|
||||
if (this.files.length) {
|
||||
var that = this;
|
||||
var imgObj = this.files[0];
|
||||
var imgType = ['image/jpeg', 'image/jpg', 'image/png'];
|
||||
var videoType = ['video/mp4', 'video/ogg', 'video/flv', 'video/avi', 'video/wmv', 'video/rmvb'];
|
||||
if (jQuery.inArray(imgObj.type, imgType) != -1) {
|
||||
//是图片
|
||||
var reader = new FileReader();
|
||||
reader.readAsDataURL(imgObj);
|
||||
reader.onload = function () {
|
||||
app.addBanner(this.result,1);
|
||||
}
|
||||
}else if(jQuery.inArray(imgObj.type, videoType) != -1){
|
||||
//视频
|
||||
const isLt10M = imgObj.size / 1024 / 1024 < 10;
|
||||
if (!isLt10M) {
|
||||
this.$message.error('上传视频大小不能超过10MB哦!');
|
||||
return false;
|
||||
}
|
||||
var reader = new FileReader();
|
||||
reader.readAsDataURL(imgObj);
|
||||
reader.onload = function () {
|
||||
console.log(this.result);
|
||||
app.addBanner(this.result,2);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,310 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!--[1.6.48]-->
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>轮播图</title>
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Retail/css/myscroll.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/vue/element-ui.css">
|
||||
<link rel="stylesheet" href="__PUBLIC__/css/system-gallery.css?v=1.0.3">
|
||||
<script src="__PUBLIC__/jquery/js/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/vue/js/vue2.5.16.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/vue/element-ui.js"></script>
|
||||
<script charset="utf-8" src="__PUBLIC__/js/system-gallery.js?v=1.0.3"></script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<div id="Cash" v-cloak>
|
||||
<div style="margin-bottom:10px;">
|
||||
<el-button type="primary" size="mini" @click="setLabel">添加背景图</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-dialog title="背景图" :visible.sync="showSetLabel">
|
||||
<el-form id="label_form">
|
||||
<el-form-item style="text-align: center;">
|
||||
<label class="file_label" style="display: block;margin-top:10px;">
|
||||
<input type="hidden" name="label_img_id" value=""/>
|
||||
<input @change="changeLabelImage" type="file" name="label_img" placeholder="选择背景图片"
|
||||
accept="image/png,image/jpeg,image/gif"/>
|
||||
<img id="label_url" style="max-width: 200px" src=""
|
||||
onerror="this.onerror=null;this.src='__PUBLIC__/paper/images/wx_add.png'">
|
||||
</label>
|
||||
<el-button plain size="mini" @click="selectImageLabel" style="margin-left:210px">图库图片
|
||||
<el-tooltip class="item" effect="dark" content="点击图片选择本地图片,点击按钮选择图库图片"
|
||||
placement="top-start">
|
||||
<i class="el-icon-question"></i></el-tooltip>
|
||||
</el-button>
|
||||
<span class="suggest">建议尺寸:60 x 60,或等比例图片</span>
|
||||
</el-form-item>
|
||||
<el-form-item style="text-align: center;">
|
||||
<el-input v-model="order" placeholder="请输入排序" size="small"
|
||||
style="width:250px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item style="display: flex;justify-content: center;">
|
||||
<el-button type="primary" size="mini" @click="labelAdd"
|
||||
style="margin:10px;" id="loadingOne">确定
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</div>
|
||||
<div style="border: 1px solid #e6e6e6;max-width: calc(100vw - 208px);">
|
||||
<el-table :data="BackgroundList" :highlight-current-row="true" border size="mini"
|
||||
style="width: calc(100vw - 208px);box-sizing: border-box;">
|
||||
<el-table-column type="index" label="序号" align="center"></el-table-column>
|
||||
<el-table-column label="背景图" align="center">
|
||||
<template slot-scope="scope">
|
||||
<a :href="scope.row.img" target="_blank">
|
||||
<img style="width:auto;height: 200px;" :src="scope.row.img">
|
||||
</a>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
v-model="scope.row.status"
|
||||
active-value="1"
|
||||
inactive-value="0"
|
||||
:active-text="scope.row.status == 1 ? '开启' : '关闭'"
|
||||
@change="changeStatus(scope.row.id,scope.row.status)">
|
||||
</el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sort" label="排序" align="center"></el-table-column>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" @click="labelEdit(scope.$index,scope.row.sort)">编辑
|
||||
</el-button>
|
||||
<el-button size="mini" type="text" @click="delLabel(scope.row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="currentPage"
|
||||
:page-sizes="[10, 15, 20, 25, 30, 35, 40, 45, 50]"
|
||||
:page-size="100"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="currentLen">
|
||||
</el-pagination>
|
||||
</el-pagination>
|
||||
</div>
|
||||
<!-- 选择图片 -->
|
||||
<el-dialog title="选择图片" modal-append-to-body="false"
|
||||
:visible.sync="label_show_close_image" custom-class="select-image-el-dialog" :top="'10px'">
|
||||
<template-select-image :can-select-num="1" @selectfile="selectFileLabel"></template-select-image>
|
||||
</el-dialog>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
new Vue({
|
||||
el: "#Cash",
|
||||
data: {
|
||||
showSetLabel: false,
|
||||
label_show_close_image: false,
|
||||
BackgroundList: [],
|
||||
currentPage: 1,
|
||||
currentLimit: 10,
|
||||
currentLen: 0,
|
||||
editId: '',
|
||||
order: '',
|
||||
img:"__PUBLIC__/paper/images/wx_add.png"
|
||||
},
|
||||
methods: {
|
||||
handleCurrentChange: function (val) {
|
||||
this.currentPage = val;
|
||||
this.getData();
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.currentLimit = val;//切换每页数量
|
||||
this.currentPage = 1;
|
||||
this.getData();
|
||||
},
|
||||
//添加背景图
|
||||
setLabel: function () {
|
||||
this.showSetLabel = true;
|
||||
this.sort = "";
|
||||
$("input[name='label_img_id']").val('');
|
||||
},
|
||||
changeLabelImage: function () {
|
||||
if (window.event.target.files.length) {
|
||||
var that = this;
|
||||
var imgObj = window.event.target.files[0];
|
||||
var imgType = ['image/jpeg', 'image/jpg', 'image/png', 'image/gif'];
|
||||
if (jQuery.inArray(imgObj.type, imgType) != -1) {
|
||||
//是图片
|
||||
var reader = new FileReader();
|
||||
reader.readAsDataURL(imgObj);
|
||||
reader.onload = function () {
|
||||
$("input[name='label_img_id']").val('');
|
||||
$("input[name='label_img']").next('img').attr('src', this.result);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
selectImageLabel: function () {
|
||||
this.label_show_close_image = true;
|
||||
},
|
||||
selectFileLabel: function (item) {
|
||||
//选择文件
|
||||
this.label_show_close_image = false;
|
||||
if (!item.length) {
|
||||
$("input[name='label_img']").click();
|
||||
} else {
|
||||
$("input[name='label_img_id']").val(item[0].id);
|
||||
$("input[name='label_img']").val('');
|
||||
$("input[name='label_img']").next('img').attr('src', item[0].path);
|
||||
}
|
||||
},
|
||||
//添加编辑操作
|
||||
labelAdd: function () {
|
||||
var that = this;
|
||||
var form_data = new FormData(document.getElementById('label_form'));
|
||||
form_data.append("order", JSON.stringify(that.order));
|
||||
form_data.append("editId", JSON.stringify(that.editId)); // 压入data数据
|
||||
const loadsing = that.$loading({
|
||||
target:"#loadingOne",
|
||||
lock: true,
|
||||
text: '保存中,请等待',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(255, 255, 255, 0.7)'
|
||||
});
|
||||
$.ajax({
|
||||
url: "{:U('selfCashImgAdd')}",
|
||||
type: "POST",
|
||||
data: form_data,
|
||||
dataType: 'JSON',
|
||||
cache: false, // 不缓存
|
||||
processData: false, // jQuery不要去处理发送的数据
|
||||
contentType: false, // jQuery不要去设置Content-Type请求头
|
||||
success: function (res) {
|
||||
if (res.status == 1) {
|
||||
that.$message({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
duration: 1000,
|
||||
onClose: function () {
|
||||
that.editId = '';
|
||||
$("#label_url").attr('src', "__PUBLIC__/paper/images/wx_add.png");
|
||||
that.order = "";
|
||||
loadsing.close();
|
||||
that.getData();
|
||||
that.showSetLabel = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
that.$message({
|
||||
message: res.msg,
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
//列表
|
||||
getData: function () {
|
||||
var that = this;
|
||||
$.ajax({
|
||||
url: "{:U('selfCashImgList')}",
|
||||
type: "post",
|
||||
data: {
|
||||
page: that.currentPage,
|
||||
limit: that.currentLimit
|
||||
},
|
||||
success: function (res) {
|
||||
that.BackgroundList = [];
|
||||
that.BackgroundList = res.imgList;
|
||||
that.$nextTick(function () {
|
||||
that.currentLen = parseInt(res.count);
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//开启关闭
|
||||
changeStatus: function (id, status) {
|
||||
var that = this;
|
||||
$.ajax({
|
||||
url: "{:U('changeState')}",
|
||||
type: "post",
|
||||
data: {
|
||||
id: id,
|
||||
status: status
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.status == 1) {
|
||||
that.$message({
|
||||
type: "success",
|
||||
message: res.msg,
|
||||
duration: 1000
|
||||
})
|
||||
} else {
|
||||
that.$message({
|
||||
type: "warning",
|
||||
message: res.msg,
|
||||
duration: 1000
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
labelEdit: function (index, sort) {
|
||||
var that = this;
|
||||
that.showSetLabel = true;
|
||||
var data = that.BackgroundList[index];
|
||||
that.$nextTick(function () {
|
||||
that.editId = data.id;
|
||||
that.order = data.order;
|
||||
$("input[name='label_img_id']").val(data.img_id);
|
||||
$("#label_url").attr('src', data.img);
|
||||
that.order = sort;
|
||||
})
|
||||
},
|
||||
//删除
|
||||
delLabel: function (id) {
|
||||
var that = this;
|
||||
that.$confirm('此操作将删除该图片, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
$.ajax({
|
||||
url: "{:U('delList')}",
|
||||
type: "POST",
|
||||
data: {
|
||||
id: id,
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.status == 1) {
|
||||
that.$message({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
duration: 1000,
|
||||
onClose: function () {
|
||||
that.getData();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
that.$message({
|
||||
message: res.msg,
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
that.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
created: function () {
|
||||
this.getData();
|
||||
}
|
||||
})
|
||||
</script>
|
||||
在新工单中引用
屏蔽一个用户