This commit is contained in:
彭桃 2023-04-04 10:28:17 +08:00
parent 4148793380
commit 109bf3a6a7
5 changed files with 420 additions and 78 deletions

View File

@ -419,7 +419,8 @@ class StoreProduct extends BaseController
add_log('buy', $id, $param);
$app = $this->payment();
$total_fee = env('APP_DEBUG') ? 1 : $post_price;
// $total_fee = env('APP_DEBUG') ? 1 : $post_price;
$total_fee = $post_price;
// 用 easywechat 封装的方法请求微信的统一下单接口
$result = $app->order->unify([
'trade_type' => 'NATIVE', // 原生支付即扫码支付,商户根据微信支付协议格式生成的二维码,用户通过微信“扫一扫”扫描二维码后即进入付款确认界面,输入密码即完成支付。

View File

@ -33,36 +33,59 @@
<!-- </select>-->
<!-- </div>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td class="layui-td-gray">平台商品分类<font>*</font></td>-->
<!-- <td colspan="3">-->
<!-- <div class="layui-col-md6">-->
<!-- <select name="cate_id" lay-verify="required" lay-search="">-->
<!-- <option value="" >请选择</option>-->
<!-- {volist name=':set_recursion(get_store_category())' id='vo'}-->
<!-- <option value="{$vo.id}" >{$vo.title}</option>-->
<!-- {/volist}-->
<!-- </select>-->
<!-- </div>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td class="layui-td-gray">品牌选择<font>*</font></td>-->
<!-- <td colspan="3">-->
<!-- <div class="layui-col-md6">-->
<!-- <select name="brand_id" lay-verify="required" lay-search="">-->
<!-- <option value="" >请选择</option>-->
<!-- {volist name='store_brand' id='vo'}-->
<!-- <option value="{$vo.brand_id}" >{$vo.brand_name}</option>-->
<!-- {/volist}-->
<!-- </select>-->
<!-- </div>-->
<!-- </td>-->
<!-- </tr>-->
<tr>
<td class="layui-td-gray">平台商品分类<font>*</font></td>
<td colspan="3">
<div class="layui-col-md6">
<select name="cate_id" lay-verify="required" lay-search="">
<option value="" >请选择</option>
{volist name=':set_recursion(get_store_category())' id='vo'}
<option value="{$vo.id}" >{$vo.title}</option>
{/volist}
</select>
</div>
<td class="layui-td-gray">平台商品分类<font>*</font>
</td>
<td>
<div id="cate_id"></div>
</td>
<td class="layui-td-gray">品牌选择<font>*</font>
</td>
<td colspan="6">
<select name="brand_id" lay-verify="required" lay-search="">
<option value="">请选择</option>
{volist name='store_brand' id='vo'}
<option value="{$vo.brand_id}">{$vo.brand_name}</option>
{/volist}
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">品牌选择<font>*</font></td>
<td class="layui-td-gray">商户分类<font>*</font>
</td>
<td colspan="3">
<div class="layui-col-md6">
<select name="brand_id" lay-verify="required" lay-search="">
<option value="" >请选择</option>
{volist name='store_brand' id='vo'}
<option value="{$vo.brand_id}" >{$vo.brand_name}</option>
{/volist}
</select>
</div>
<div id="mer_cate_id"></div>
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">商品封面图</td>
<td>
@ -220,6 +243,53 @@
}
});
function demo_cate_id () {
var demo_cate = xmSelect.render({
name: 'cate_id',
el: '#cate_id',
autoRow: true,
radio: true,
cascader: {
show: true,
indent: 200,
},
prop: {
name: 'name',
value: 'id',
},
data: [],
})
$.get('/admin/product.product/category_arr', function (result) {
demo_cate.update({
data: result.data
})
});
}
demo_cate_id()
function demo_mer_cate_id () {
var demo_cate = xmSelect.render({
name: 'mer_cate_id',
el: '#mer_cate_id',
autoRow: true,
cascader: {
show: true,
indent: 200,
},
prop: {
name: 'name',
value: 'id',
},
data: [],
radio: true,
})
$.get('/admin/product.product/category_arr?id=4', function (result) {
demo_cate.update({
data: result.data
})
});
}
demo_mer_cate_id();
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
@ -232,6 +302,17 @@
layer.msg('请先完善商品详情');
return false;
}
if (data.field.cate_id == '') {
layer.msg('请先选择平台分类');
return false;
}
if (data.field.mer_cate_id == '') {
layer.msg('请先选择商户分类');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {

View File

@ -33,34 +33,58 @@
<!-- </div>-->
<!-- </td>-->
<!-- </tr>-->
<tr>
<td class="layui-td-gray">平台商品分类<font>*</font></td>
<td colspan="3">
<div class="layui-col-md6">
<select name="cate_id" lay-verify="required" lay-search="">
<option value="" >请选择</option>
{volist name=':set_recursion(get_store_category())' id='vo'}
<option value="{$vo.id}" {if $detail.cate_id==$vo.id} selected {/if}>{$vo.title}</option>
{/volist}
</select>
</div>
</td>
</tr>
<!-- <tr>-->
<!-- <td class="layui-td-gray">平台商品分类<font>*</font></td>-->
<!-- <td colspan="3">-->
<!-- <div class="layui-col-md6">-->
<!-- <select name="cate_id" lay-verify="required" lay-search="">-->
<!-- <option value="" >请选择</option>-->
<!-- {volist name=':set_recursion(get_store_category())' id='vo'}-->
<!-- <option value="{$vo.id}" {if $detail.cate_id==$vo.id} selected {/if}>{$vo.title}</option>-->
<!-- {/volist}-->
<!-- </select>-->
<!-- </div>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td class="layui-td-gray">品牌选择<font>*</font></td>-->
<!-- <td colspan="3">-->
<!-- <div class="layui-col-md6">-->
<!-- <select name="brand_id" lay-verify="required" lay-search="">-->
<!-- <option value="" >请选择</option>-->
<!-- {volist name='store_brand' id='vo'}-->
<!-- <option value="{$vo.brand_id}" {if $detail.brand_id==$vo.brand_id} selected {/if}>{$vo.brand_name}</option>-->
<!-- {/volist}-->
<!-- </select>-->
<!-- </div>-->
<!-- </td>-->
<!-- </tr>-->
<tr>
<td class="layui-td-gray">品牌选择<font>*</font></td>
<td colspan="3">
<div class="layui-col-md6">
<select name="brand_id" lay-verify="required" lay-search="">
<option value="" >请选择</option>
{volist name='store_brand' id='vo'}
<option value="{$vo.brand_id}" {if $detail.brand_id==$vo.brand_id} selected {/if}>{$vo.brand_name}</option>
{/volist}
</select>
</div>
<td class="layui-td-gray">平台商品分类<font>*</font>
</td>
<td>
<div id="cate_id"></div>
</td>
<td class="layui-td-gray">品牌选择<font>*</font>
</td>
<td colspan="6">
<select name="brand_id" lay-verify="required" lay-search="">
<option value="">请选择</option>
{volist name='store_brand' id='vo'}
<option value="{$vo.brand_id}" {if $detail.brand_id==$vo.brand_id} selected {/if}>{$vo.brand_name}</option>
{/volist}
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">商户分类<font>*</font>
</td>
<td colspan="3">
<div id="mer_cate_id"></div>
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">商品封面图</td>
@ -165,6 +189,8 @@
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
var group_access = "{:session('gougu_admin')['group_access']}";
var multiple_images = "{$detail['slider_image']}".split(',');
var cate_id = "{$detail['cate_id']}";
var mer_cate_id = "{$detail['mer_cate_id']}";
//单击图片删除图片 【注册全局函数】
function delMultipleImgs(this_img){
//获取下标
@ -224,6 +250,56 @@
}
});
function demo_cate_id () {
var demo_cate = xmSelect.render({
name: 'cate_id',
el: '#cate_id',
initValue: [cate_id],
autoRow: true,
cascader: {
show: true,
indent: 200,
},
prop: {
name: 'name',
value: 'id',
},
data: [],
radio: true,
})
$.get('/admin/product.product/category_arr', function (result) {
demo_cate.update({
data: result.data
})
});
}
demo_cate_id()
function demo_mer_cate_id () {
var demo_cate = xmSelect.render({
name: 'mer_cate_id',
el: '#mer_cate_id',
autoRow: true,
initValue: [mer_cate_id],
cascader: {
show: true,
indent: 200,
},
prop: {
name: 'name',
value: 'id',
},
data: [],
radio: true,
})
$.get('/admin/product.product/category_arr?id=4', function (result) {
demo_cate.update({
data: result.data
})
});
}
demo_mer_cate_id()
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
@ -236,6 +312,17 @@
layer.msg('请先完善商品详情');
return false;
}
if (data.field.cate_id == '') {
layer.msg('请先选择平台分类');
return false;
}
if (data.field.mer_cate_id == '') {
layer.msg('请先选择商户分类');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {

View File

@ -27,34 +27,58 @@
<!-- </div>-->
<!-- </td>-->
<!-- </tr>-->
<tr>
<td class="layui-td-gray">商户商品分类<font>*</font></td>
<td colspan="3">
<div class="layui-col-md6">
<select name="cate_id" lay-verify="required" lay-search="">
<option value="" >请选择</option>
{volist name=':set_recursion(get_store_category())' id='vo'}
<option value="{$vo.id}" {if $detail.cate_id==$vo.id} selected {/if}>{$vo.title}</option>
{/volist}
</select>
</div>
</td>
</tr>
<!-- <tr>-->
<!-- <td class="layui-td-gray">商户商品分类<font>*</font></td>-->
<!-- <td colspan="3">-->
<!-- <div class="layui-col-md6">-->
<!-- <select name="cate_id" lay-verify="required" lay-search="">-->
<!-- <option value="" >请选择</option>-->
<!-- {volist name=':set_recursion(get_store_category())' id='vo'}-->
<!-- <option value="{$vo.id}" {if $detail.cate_id==$vo.id} selected {/if}>{$vo.title}</option>-->
<!-- {/volist}-->
<!-- </select>-->
<!-- </div>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td class="layui-td-gray">品牌选择<font>*</font></td>-->
<!-- <td colspan="3">-->
<!-- <div class="layui-col-md6">-->
<!-- <select name="brand_id" lay-verify="required" lay-search="">-->
<!-- <option value="" >请选择</option>-->
<!-- {volist name='store_brand' id='vo'}-->
<!-- <option value="{$vo.brand_id}" {if $detail.brand_id==$vo.brand_id} selected {/if}>{$vo.brand_name}</option>-->
<!-- {/volist}-->
<!-- </select>-->
<!-- </div>-->
<!-- </td>-->
<!-- </tr>-->
<tr>
<td class="layui-td-gray">品牌选择<font>*</font></td>
<td colspan="3">
<div class="layui-col-md6">
<select name="brand_id" lay-verify="required" lay-search="">
<option value="" >请选择</option>
{volist name='store_brand' id='vo'}
<option value="{$vo.brand_id}" {if $detail.brand_id==$vo.brand_id} selected {/if}>{$vo.brand_name}</option>
{/volist}
</select>
</div>
<td class="layui-td-gray">平台商品分类<font>*</font>
</td>
<td>
<div id="cate_id"></div>
</td>
<td class="layui-td-gray">品牌选择<font>*</font>
</td>
<td colspan="6">
<select name="brand_id" lay-verify="required" lay-search="" disabled>
<option value="">请选择</option>
{volist name='store_brand' id='vo'}
<option value="{$vo.brand_id}" {if $detail.brand_id==$vo.brand_id} selected {/if}>{$vo.brand_name}</option>
{/volist}
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">商户分类<font>*</font>
</td>
<td colspan="3">
<div id="mer_cate_id"></div>
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">商品封面图</td>
@ -145,4 +169,160 @@
</table>
</div>
{/block}
<!-- /主体 -->
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/xm-select.js"></script>
<script>
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
var group_access = "{:session('gougu_admin')['group_access']}";
var multiple_images = "{$detail['slider_image']}".split(',');
var cate_id = "{$detail['cate_id']}";
var mer_cate_id = "{$detail['mer_cate_id']}";
//单击图片删除图片 【注册全局函数】
function delMultipleImgs(this_img){
//获取下标
var subscript=$("#upload_box_thumb2 img").index(this_img);
//删除图片
this_img.remove();
//删除数组
multiple_images.splice(subscript, 1);
//重新排序
multiple_images.sort();
$('#upload_box_thumb2 input').attr('value', multiple_images);
//返回
return ;
}
function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker;
//上传缩略图
var upload_thumb = layui.upload.render({
elem: '#upload_btn_thumb',
url: '/admin/api/upload',
done: function (res) {
//如果上传失败
if (res.code == 1) {
layer.msg('上传失败');
return false;
}
//上传成功
$('#upload_box_thumb input').attr('value', res.data.filepath);
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
//上传商品轮播图
var upload_thumb = layui.upload.render({
elem: '#upload_btn_thumb2',
url: '/admin/api/upload',
multiple: true,
before: function(obj){
//预读本地文件示例不支持ie8
obj.preview(function(index, file, result){
$('#upload_box_thumb2').append(`
<img src="${result}"
onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;"
width="100" style="max-width: 100%; height:66px;" alt="${file.name}" onclick="delMultipleImgs(this)" title="点击删除"/>
`)
});
},
done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
//追加图片成功追加文件名至图片容器
multiple_images.push(res.data.filepath);
$('#upload_box_thumb2 input').attr('value', multiple_images);
// $('#upload_box_thumb2 img').attr('src', res.data.filepath);
}
});
function demo_cate_id () {
var demo_cate = xmSelect.render({
name: 'cate_id',
el: '#cate_id',
initValue: [cate_id],
autoRow: true,
cascader: {
show: true,
indent: 200,
},
prop: {
name: 'name',
value: 'id',
},
data: [],
radio: true,
disabled:true,
})
$.get('/admin/product.product/category_arr', function (result) {
demo_cate.update({
data: result.data
})
});
}
demo_cate_id()
function demo_mer_cate_id () {
var demo_cate = xmSelect.render({
name: 'mer_cate_id',
el: '#mer_cate_id',
autoRow: true,
initValue: [mer_cate_id],
cascader: {
show: true,
indent: 200,
},
prop: {
name: 'name',
value: 'id',
},
data: [],
radio: true,
disabled:true,
})
$.get('/admin/product.product/category_arr?id=4', function (result) {
demo_cate.update({
data: result.data
})
});
}
demo_mer_cate_id()
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.content = tinyMCE.editors['container_content'].getContent();
if (data.field.content == '') {
layer.msg('请先完善商品详情');
return false;
}
if (data.field.cate_id == '') {
layer.msg('请先选择平台分类');
return false;
}
if (data.field.mer_cate_id == '') {
layer.msg('请先选择商户分类');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
tool.post("/admin/store_product/edit", data.field, callback);
return false;
});
}
</script>
{/block}

View File

@ -1,7 +0,0 @@
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
</IfModule>