This commit is contained in:
彭桃 2023-04-04 13:46:35 +08:00
parent 109bf3a6a7
commit f32a0c5d06
2 changed files with 156 additions and 4 deletions

View File

@ -40,6 +40,11 @@ class StoreProduct extends BaseController
if (isset($param['keywords']) && !empty($param['keywords'])){
$where[]=['store_name','like','%'.$param['keywords'].'%'];
}
if (isset($param['store_cate']) && !empty($param['store_cate'])){
$where[]=['cate_id','=',$param['store_cate']];
}
$list = $this->model->getStoreProductList($where,$param);
foreach ($list as $k=>$v){
$www['brand_id'] = $v['brand_id'];
@ -419,8 +424,8 @@ class StoreProduct extends BaseController
add_log('buy', $id, $param);
$app = $this->payment();
// $total_fee = env('APP_DEBUG') ? 1 : $post_price;
$total_fee = $post_price;
$total_fee = env('APP_DEBUG') ? 1 : $post_price;
// $total_fee = $post_price;
// 用 easywechat 封装的方法请求微信的统一下单接口
$result = $app->order->unify([
'trade_type' => 'NATIVE', // 原生支付即扫码支付,商户根据微信支付协议格式生成的二维码,用户通过微信“扫一扫”扫描二维码后即进入付款确认界面,输入密码即完成支付。

View File

@ -1,9 +1,45 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<style>
.layui-input-inline{
width:35% !important;
}
.layui-input-inline .layui-form-item{
display:flex;
}
.layui-input-inline .layui-form-item .layui-form-label{
width:30%;
}
.layui-input-block{
margin-left:unset !important;
width:75%;
}
#seleform{
border-color: #eee;
background-color: #fff;
color:#a39f9f;
width:100%;
}
</style>
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<form id="filterform" class="layui-form gg-form-bar border-t border-x">
<div class="layui-form-item">
<div class="layui-input-inline">
<div class="layui-form-item">
<label class="layui-form-label">商品分类</label>
<div class="layui-input-block">
<input id="store_cate" type="hidden" readonly="readonly" name="store_cate">
<button id="seleform" lay-filter="seleform" class="layui-btn">请选择</button>
<div id="removeselect"><i class="bi-x-lg" style="position: absolute;right:2px;top:10px;z-index: 9;cursor:pointer;"></i></div>
</div>
</div>
</div>
</div>
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="请输入关键字" class="layui-input" autocomplete="off" />
</div>
@ -132,6 +168,104 @@
}
});
// 商户商品分类搜索
layui.use(['rate','dropdown', 'util', 'layer', 'table'], function(){
var dropdown = layui.dropdown
,util = layui.util
,layer = layui.layer
,rate = layui.rate
// ,table = layui.table
,$ = layui.jquery;
var $ = layui.$, active = {
reload: function(){
let dataRload = getformdata();
//执行重载
table.reload('store_product', {
page: {
curr: 1 //重新从第 1 页开始
}
,where: {
...dataRload
}
});
},
};
//商户商品分类菜单
$.ajax({
url: '/admin/product.StoreCategory/getAllList',
method: "get",
data: {},
success: function(res) {
if (res.code!==0)return ;
//高级演示 - 各种组合
dropdown.render({
elem: '#seleform'
,isAllowSpread: false //禁止菜单组展开收缩
,style: 'width: 200px' //定义宽度,默认自适应
,id: 'test777' //定义唯一索引
,title: 'title1'
,data: res.data
,click: function(item){
$('#seleform').text(item.title);
$('#seleform').css({color:'rgba(0,0,0,.85)'});
$('#store_cate').val(item.id);
active['reload'] ? active['reload'].call(this) : '';
}
});
},
fail:function(){}
});
//基础效果
rate.render({
elem: '#is_good'
})
//监听搜索提交
form.on('submit(searchform)', function(data) {
layui.pageTable.reload({
where: {
...data.field
},
page: {
curr: 1
}
});
return false;
});
//监听select提交
form.on('select(seleform)', function(data) {
active['reload'] ? active['reload'].call(this) : '';
return false;
});
//监听removeselect点击
$('#removeselect').on('click', function(){
$('#seleform').text('请选择');
$('#seleform').css({color:'#a39f9f'});
$('#store_cate').val('');
active['reload'] ? active['reload'].call(this) : '';
return false;
});
// tab 状态列表切换
$('.site-demo-active').on('click', function(){
var othis = $(this), type = othis.data('type');
$('#protype').val(this.getAttribute('type'));
active[type] ? active[type].call(this, othis) : '';
});
});
//监听表格行工具事件
table.on('tool(store_product)', function(obj) {
var data = obj.data;
@ -171,6 +305,19 @@
});
return false;
});
// 获取表单所有参数
function getformdata() {
var form = $('#filterform').serializeArray();
var data = new Array();
for(let i=0;i<form.length; i++){
data[form[i].name] = form[i].value;
}
return data;
}
}
</script>
{/block}