229 行
8.4 KiB
HTML
可执行文件
229 行
8.4 KiB
HTML
可执行文件
<!--[1.6.48]-->
|
||
<style>
|
||
table {
|
||
border: 1px solid #f1f1f1;
|
||
margin-top: 40px;
|
||
}
|
||
|
||
.layui-table-cell {
|
||
height: 85px;
|
||
line-height: 85px;
|
||
padding: 0 15px;
|
||
position: relative;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
box-sizing: border-box;
|
||
}
|
||
</style>
|
||
<div class="goodsBox">
|
||
<div id="Da">
|
||
<div class="goods_edit" v-if="!add_status">
|
||
<if condition="$authArr['addDamerchant'] eq true">
|
||
<button type="button" class="layui-btn" id="add">添加</button>
|
||
</if>
|
||
</div>
|
||
</div>
|
||
<table class="layui-hide" id="test" lay-filter="demo"></table>
|
||
<script type="text/html" id="barDemo">
|
||
<if condition="$authArr['recharge'] eq true">
|
||
<button class="layui-btn layui-btn-xs" lay-event="recharge">充值</button>
|
||
</if>
|
||
<if condition="$authArr['query'] eq true">
|
||
<button class="layui-btn layui-btn-xs" lay-event="record">金额查询</button>
|
||
</if>
|
||
</script>
|
||
<!--充值-->
|
||
<div style="display: none;margin-top:25px;" id="remoney">
|
||
<form class="layui-form" action="">
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">金额</label>
|
||
<div class="layui-input-inline">
|
||
<input type="text" name="money" value="" id="money" required lay-verify="required" placeholder="达达商户金额"
|
||
autocomplete="off" class="layui-input">
|
||
</div>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
|
||
<script>
|
||
layui.use(['form', 'layedit', 'laydate', 'table'], function () {
|
||
var App = new Vue({
|
||
el:'#Da',
|
||
data:{
|
||
add_status:false
|
||
}
|
||
})
|
||
// 日期
|
||
var laydate = layui.laydate;
|
||
var table = layui.table;
|
||
var form = layui.form;
|
||
//展示已知数据
|
||
table.render({
|
||
elem: '#test',
|
||
url: "{:U('getDamerchant')}",
|
||
method: 'post',
|
||
cols: [
|
||
[ //标题栏
|
||
{
|
||
field: 'mobile',
|
||
title: '手机号',
|
||
align: 'center',
|
||
}, {
|
||
field: 'city_name',
|
||
title: '商户城市名称',
|
||
align: 'center',
|
||
}, {
|
||
field: 'enterprise_name',
|
||
title: '企业全称',
|
||
align: 'center',
|
||
}, {
|
||
field: 'enterprise_address',
|
||
title: '企业地址',
|
||
align: 'center',
|
||
}, {
|
||
field: 'contact_name',
|
||
title: '联系人姓名',
|
||
align: 'center',
|
||
}, {
|
||
field: 'contact_phone',
|
||
title: '联系人电话',
|
||
align: 'center',
|
||
}, {
|
||
field: 'email',
|
||
title: '邮箱地址',
|
||
align: 'center',
|
||
}, {
|
||
field: 'resultid',
|
||
title: '商户编号',
|
||
align: 'center',
|
||
}, {
|
||
field: 'addtime',
|
||
title: '注册时间',
|
||
align: 'center',
|
||
}, {
|
||
field: 'right',
|
||
title: '操作',
|
||
align: 'center',
|
||
toolbar: '#barDemo',
|
||
width: 260,
|
||
}]
|
||
],
|
||
page: {
|
||
layout: ['count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
|
||
}, //是否开启分页
|
||
id: 'DaInfo',
|
||
done:function(res){
|
||
App.add_status = res.add_status;
|
||
}
|
||
});
|
||
// 日期
|
||
lay('.test-item').each(function () {
|
||
laydate.render({
|
||
elem: this,
|
||
trigger: 'click'
|
||
});
|
||
});
|
||
//查询
|
||
$('#Preservation').click(function () {
|
||
// console.log(111);
|
||
//执行重载
|
||
table.reload('test', {
|
||
page: {
|
||
curr: 1 //重新从第 1 页开始
|
||
}
|
||
, where: {
|
||
// type:$('#discountType option:selected').val(),
|
||
keyword: $('#keyword').val(),
|
||
discountid: $('#discountid').val()
|
||
}
|
||
});
|
||
})
|
||
table.on('tool(demo)', function (obj) { //注:tool是工具条事件名,test是table原始容器的属性 lay-filter="对应的值"
|
||
var data = obj.data; //获得当前行数据
|
||
var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值)
|
||
var tr = obj.tr; //获得当前行 tr 的DOM对象
|
||
if (layEvent === 'recharge') {
|
||
layer.open({
|
||
type: 1,
|
||
content: $('#remoney'),
|
||
title: "充值",
|
||
shade: false,
|
||
area: ["500px", '200px'],
|
||
btn: ['提交', '取消'],
|
||
yes: function () {
|
||
var id = data.id;
|
||
var money = $('#money').val();
|
||
if (isNaN(Number(money))) { //当输入不是数字的时候,Number后返回的值是NaN;然后用isNaN判断。
|
||
layer.msg('请输入正确金额', {time: 2000})
|
||
return false;
|
||
}
|
||
if (!money) {
|
||
layer.msg('请先完善您的表单信息', {time: 2000})
|
||
return false;
|
||
}
|
||
if (money < 0.01) {
|
||
layer.msg('金额不能低于0.01', {time: 2000})
|
||
return false;
|
||
}
|
||
if (id == '') {
|
||
layer.msg('参数错误', {time: 2000})
|
||
return false;
|
||
}
|
||
$.ajax({
|
||
url: "{:U('recharge')}",
|
||
type: 'post',
|
||
data: {
|
||
id: id,
|
||
money: money
|
||
},
|
||
success: function (res) {
|
||
console.log(res)
|
||
if (res.status == 1) {
|
||
layer.open({
|
||
type: 2,
|
||
title: '支付',
|
||
area: ['calc(100% - 160px)', 'calc(100% - 65px)'],
|
||
offset: 'rb',
|
||
content: res.result
|
||
});
|
||
//window.location.href=res.result;
|
||
} else {
|
||
layer.msg(res.msg, {time: 1200})
|
||
}
|
||
},
|
||
error: function (error) {
|
||
console.log(error);
|
||
}
|
||
})
|
||
}
|
||
})
|
||
} else if (layEvent === 'record') {
|
||
top.layer.open({
|
||
type: 2,
|
||
content: "{:U('query')}",
|
||
title: "金额查询",
|
||
area: ["40%", '35%'],
|
||
end: function () {
|
||
|
||
}
|
||
})
|
||
}
|
||
});
|
||
$('#add').click(function () {
|
||
top.layer.open({
|
||
type: 2,
|
||
content: "{:U('addDamerchant')}",
|
||
title: "添加达达商户",
|
||
area: ["45%", '68%'],
|
||
btnAlign: 'c',
|
||
end: function () {
|
||
table.reload('DaInfo');
|
||
}
|
||
})
|
||
|
||
})
|
||
})
|
||
</script>
|