作者 李铮
1 个管道 的构建 通过 耗费 8 秒

Merge branch 'master' of http://114.215.101.231:8099/guosheng/store into Branch_liuzhen

# Conflicts:
#	application/admin/controller/Store.php
... ... @@ -79,12 +79,12 @@
<input id="c-inventory" data-rule="required" class="form-control" name="row[inventory]" type="number">
</div>
</div>
<div class="form-group">
<!--<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Freight')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-freight" data-rule="required" class="form-control" step="0.01" name="row[freight]" type="number">
</div>
</div>
</div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
... ...
... ... @@ -76,12 +76,12 @@
<input id="c-inventory" data-rule="required" class="form-control" name="row[inventory]" type="number" value="{$row.inventory|htmlentities}">
</div>
</div>
<div class="form-group">
<!--<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Freight')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-freight" class="form-control" step="0.01" name="row[freight]" type="number" value="{$row.freight|htmlentities}">
</div>
</div>
</div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
... ...
... ... @@ -11,6 +11,7 @@ namespace app\index\controller;
use app\common\controller\Frontend;
use app\index\model\Area;
use app\index\model\Consult;
use app\index\model\Province;
use fast\Http;
... ... @@ -21,7 +22,7 @@ use fast\Http;
*/
class Sundry extends Frontend
{
protected $noNeedLogin = ['*'];
protected $noNeedLogin = ['get_address','get_province_id','get_area'];
protected $noNeedRight = ['*'];
/**
... ... @@ -71,4 +72,27 @@ class Sundry extends Frontend
$data = $areaModel->selectData($where);
$this->success('SUCCESS','',$data);
}
public function consult(){
$user_id = $this->auth->id;
$goods_id = $this->request->param('goods_id',0,'intval');
if(empty($goods_id)){
$this->error('缺少必要参数');
}
$arr['user_id'] = $user_id;
$arr['goods_id'] = $goods_id;
$arr['status'] = '1';
$arr['createtime'] = time();
$consultModel = new Consult();
$data = $consultModel->findData(['user_id'=>$user_id,'goods_id'=>$goods_id,'status'=>'1']);
if(!empty($data)){
$result = $consultModel->updateData(['id'=>$data['id']],$arr);
}else{
$result = $consultModel->insertData($arr);
}
if(empty($result)){
$this->error('sql执行失败');
}
$this->success('SUCCESS');
}
}
\ No newline at end of file
... ...
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2020/5/19
* Time: 21:45
*/
namespace app\index\model;
use think\Model;
class Consult extends Model
{
public function insertData($data){
$result = $this->insert($data);
return $result;
}
public function updateData($where,$data){
$result = $this->where($where)->update($data);
return $result;
}
public function findData($where){
$data = $this->where($where)->find();
return $data;
}
}
\ No newline at end of file
... ...
... ... @@ -589,7 +589,7 @@
</div>
<div class="numberBox">
<div class="input-group spinner">
<input id="numberInput" type="text" class="form-control" value="1" oninput = "value=value.replace(/[^\d]/g,'')" onkeyup="onkeyupNumberInput(event)"/>
<input id="numberInput" type="text" min="1" max="{$data.inventory}" class="form-control" value="1" oninput = "value=value.replace(/[^\d]/g,'')" onkeyup="onkeyupNumberInput(event)"/>
<div class="input-group-btn-vertical">
<button class="btn btn-default" type="button"><img src="__CDN__/assets/store/images/spinner_up.png" alt="img"></button>
<button class="btn btn-default" type="button"><img src="__CDN__/assets/store/images/spinner_down.png" alt="img"></button>
... ... @@ -873,7 +873,7 @@
" <button class=\"btn addToCart\" onclick=\"addToCart("+goods_id+")\">\n" +
" 加入购物车\n" +
" </button>";
var html2 = "<button class=\"btn buy\" onclick=\"buy()\">\n" +
var html2 = "<button class=\"btn buy\" onclick=\"buyConsult()\">\n" +
" 购买咨询\n" +
" </button>";
var insurance1 = "<div class=\"nsuranceBox\">\n" +
... ... @@ -886,6 +886,25 @@
evaluateVal({$probability1}, {$probability1}, {$probability2}, {$probability3});//调用此方法显示好评度
initLocation();
});
//购买咨询
function buyConsult(){
$.ajax({
url:"{:url('index/sundry/consult')}",
type:"POST",
data:{"goods_id":goods_id},
async:false,
success:function(res){
if(res.code == 1){
toast('提交成功~');
}else{
toast(res.msg);
}
},
error:function(res){
toast('与服务器断开连接');
}
});
}
//定位当前位置
function initLocation(){
... ... @@ -964,11 +983,17 @@
//初始化数字框点击事件
function initPinnerClick() {
$('.spinner .btn:first-of-type').on('click', function() {
if($('#numberInput').val() >= $('#inventory').text()){
return false;
}
$('.spinner input').val( parseFloat($('.spinner input').val(), 10) + 1);
var totalPrice = parseFloat($('.spinner input').val()) * parseFloat($('#price').html().split('¥')[1]);
$('#totalPrice').html('¥'+totalPrice.toFixed(2));
});
$('.spinner .btn:last-of-type').on('click', function() {
if($('#numberInput').val() == 1){
return false;
}
if(parseInt($('.spinner input').val()) <= 0){
$('.spinner input').val(0);
}else{
... ... @@ -989,7 +1014,7 @@
// Netscape/Firefox/Opera
keyCode = e.which
}
$('.spinner input').val(isNaN(parseFloat($('.spinner input').val()))?0:parseFloat($('.spinner input').val()));
$('.spinner input').val(isNaN(parseFloat($('.spinner input').val()))?1:parseFloat($('.spinner input').val()));
$('#totalPrice').html('¥0.00');
if (keyCode>=48&&keyCode<=57 || keyCode>=96&&keyCode<=105 || keyCode==8){
var totalPrice = parseFloat($('.spinner input').val()) * parseFloat($('#price').html().split('¥')[1]);
... ... @@ -1013,10 +1038,11 @@
//加入购物车
function addToCart(goods_id) {
var number = $('#numberInput').val();
$.ajax({
url:"{:url('index/car/add')}",
type:"POST",
data:{"goods_id":goods_id,"type":1,'province_id':province_id},
data:{"goods_id":goods_id,"number":number,"type":1,'province_id':province_id},
success:function(res){
if(res.code == 1){
toast('操作成功');
... ...
... ... @@ -40,6 +40,7 @@
z-index: 9;
background: rgba(255,255,255,1);
opacity: 0.9;
overflow: scroll;
}
.content .bannerBox .suspensionNavBox ul{
width: 100%;
... ... @@ -69,6 +70,11 @@
.content .bannerBox .suspensionNavBox ul li .typeBox .arrow{
float: right;
}
.content .bannerBox .suspensionNavBox ul li .typeDetailBox{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.content .bannerBox .suspensionNavBox ul li .typeDetailBox p{
display: inline-block;
height: 20px;
... ... @@ -85,7 +91,7 @@
.content .bannerBox .secondLevelBox{
display: none;
position: absolute;
width: 133px;
width: 455px;
height: 540px;
top: 0;
left: 644px;
... ... @@ -112,7 +118,7 @@
.content .bannerBox .secondLevelBox #secondLevelList li{
list-style-type: none;
cursor: pointer;
width: 100%;
width: 100px;
height: 42px;
line-height: 42px;
text-align: center;
... ... @@ -120,6 +126,11 @@
font-family: PingFang SC;
font-weight: 500;
color: rgba(6,18,30,1);
float: left;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-left: 10px;
}
.content .bannerBox .secondLevelBox #secondLevelList li a{
color: rgba(6,18,30,1);
... ...
... ... @@ -37,6 +37,7 @@
z-index: 9;
background: rgba(255,255,255,1);
opacity: 0.9;
overflow: scroll;
}
.content .bannerBox .suspensionNavBox ul{
width: 100%;
... ... @@ -66,6 +67,11 @@
.content .bannerBox .suspensionNavBox ul li .typeBox .arrow{
float: right;
}
.content .bannerBox .suspensionNavBox ul li .typeDetailBox{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.content .bannerBox .suspensionNavBox ul li .typeDetailBox p{
display: inline-block;
height: 20px;
... ... @@ -82,7 +88,7 @@
.content .bannerBox .secondLevelBox{
display: none;
position: absolute;
width: 133px;
width: 455px;
height: 540px;
top: 0;
left: 644px;
... ... @@ -109,7 +115,7 @@
.content .bannerBox .secondLevelBox #secondLevelList li{
list-style-type: none;
cursor: pointer;
width: 100%;
width: 100px;
height: 42px;
line-height: 42px;
text-align: center;
... ... @@ -117,6 +123,11 @@
font-family: PingFang SC;
font-weight: 500;
color: rgba(6,18,30,1);
float: left;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-left: 10px;
}
.content .bannerBox .secondLevelBox #secondLevelList li a{
color: rgba(6,18,30,1);
... ...
... ... @@ -838,7 +838,7 @@
$(obj).find('img').attr('src', '__CDN__/assets/store/images/dropDwon_select.png');
$('.priceBtn').attr('data-sort',0);
$('.priceBtn').find('img').eq(0).attr('src', '__CDN__/assets/store/images/dropDwon_up.png');
$('.priceBtn').find('img').eq(0).attr('src', '__CDN__/assets/store/images/dropDwon.png');
$('.priceBtn').find('img').eq(1).attr('src', '__CDN__/assets/store/images/dropDwon.png');
}else{
if($.inArray($(obj).attr('data-sort'),['0','5']) != -1){
$(obj).find('img').eq(1).attr('src', '__CDN__/assets/store/images/dropDwon_select.png');
... ...
... ... @@ -36,7 +36,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'inventory', title: __('Inventory')},
{field: 'is_impose', title: __('Is_impose'),formatter: Table.api.formatter.status,searchList:{'0':'不限购','1': '限购'}},
{field: 'imposenum', title: __('Imposenum')},
{field: 'freight', title: __('Freight'), operate:'BETWEEN'},
// {field: 'freight', title: __('Freight'), operate:'BETWEEN'},
{field: 'sale', title: __('Sale')},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
... ...
... ... @@ -31,7 +31,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'type', title: __('Type'),formatter:Table.api.formatter.label,searchList:{'1':'个人店铺','2':'企业店铺'}},
{field: 'property', title: __('Property')},
{field: 'thumbnail', title: __('Thumbnail'), operate:false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'money', title: __('Money')},
{field: 'money', title: __('满免运费价格')},
{field: 'freight', title: __('运费')},
{field: 'phone', title: __('Phone')},
{field: 'address', title: __('Address'), operate:false},
{field: 'viptype', title: __('Viptype'),formatter:Table.api.formatter.label,searchList:{'1':'普通会员','2':'超级会员'}},
... ...