作者 SHW\戥岁。。

同步

... ... @@ -284,7 +284,7 @@
<label class="control-label col-xs-12 col-sm-2">{:__('Detail_images')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-detail_images" data-rule="required" class="form-control form-control" size="50" name="row[detail_images]" placeholder="图片最多添加十张" type="text">
<input id="c-detail_images" class="form-control form-control" size="50" name="row[detail_images]" placeholder="图片最多添加十张" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-detail_images" data-maxcount="10" class="btn btn-danger plupload" data-input-id="c-detail_images" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="true" data-preview-id="p-detail_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-detail_images" data-maxcount="10" class="btn btn-primary fachoose" data-input-id="c-detail_images" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
... ...
... ... @@ -284,7 +284,7 @@
<label class="control-label col-xs-12 col-sm-2">{:__('Detail_images')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-detail_images" data-rule="required" placeholder="图片最多添加十张" class="form-control form-control" size="50" name="row[detail_images]" type="text" value="{$row.detail_images}">
<input id="c-detail_images" placeholder="图片最多添加十张" class="form-control form-control" size="50" name="row[detail_images]" type="text" value="{$row.detail_images}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-detail_images" class="btn btn-danger plupload" data-input-id="c-detail_images" data-mimetype="image/jpeg,image/png,image/jpg" data-maxcount="10" data-multiple="true" data-preview-id="p-detail_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-detail_images" class="btn btn-primary fachoose" data-input-id="c-detail_images" data-mimetype="image/jpeg,image/png,image/jpg" data-maxcount="10" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
... ...
... ... @@ -32,11 +32,11 @@ class Cart extends Api
*/
public function addCart()
{
$sku_id = $this->request->post('sku_id');
$goods_id = $this->request->post('goods_id');
$number = $this->request->post('number');
$sku_id = $this->request->param('sku_id');
$goods_id = $this->request->param('goods_id');
$number = $this->request->param('number');
if (!is_numeric($sku_id) || !is_numeric($goods_id) || !is_numeric($number)) $this->error('参数不合法');
// if (!is_numeric($sku_id) || !is_numeric($goods_id) || !is_numeric($number)) $this->error('参数不合法');
$category_id = (new \app\api\model\Goods())->where('goods_id', $goods_id)->value('category_id');
$where = [
'goods_id' => $goods_id,
... ... @@ -61,13 +61,12 @@ class Cart extends Api
} else {
$model->where($where)->update(['number'=>$number]);
}
} else {
if ($spec_info['stock_num'] > $number) {
if ($number > $spec_info['stock_num']) {
$this->error('库存不足');
} else {
$data['number'] = $number;
$model->isUpdate(false)->save($data);
$where['number'] = $number;
$model->isUpdate(false)->save($where);
}
}
... ...
... ... @@ -20,13 +20,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'litestor
var table = $("#table");
table.on('post-common-search.bs.table', function (event, table) {
var form = $("form", table.$commonsearch);
$("input[name='category_id']", form).addClass("selectpage").data("source", "litestore/litestorecategory/index").data("primaryKey", "id").data("field", "name").data("orderBy", "id desc").data("pageSize",1);
$("input[name='category_id']", form).addClass("selectpage").data("source", "litestore/litestorecategory/index").data("primaryKey", "id").data("field", "name").data("orderBy", "id asc").data("pageSize",20);
Form.events.cxselect(form);
Form.events.selectpage(form);
});
table.on('post-common-search.bs.table', function (event, table) {
var form = $("form", table.$commonsearch);
$("input[name='activity_id']", form).addClass("selectpage").data("source", "activity/index").data("primaryKey", "id").data("field", "name").data("orderBy", "id desc").data("pageSize",1);
$("input[name='activity_id']", form).addClass("selectpage").data("source", "activity/index").data("primaryKey", "id").data("field", "name").data("orderBy", "id asc").data("pageSize",20);
Form.events.cxselect(form);
Form.events.selectpage(form);
});
... ... @@ -45,7 +45,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'litestor
{field: 'goods_name', title: __('Goods_name'), operate: 'LIKE'},
{field: 'keywords', title: __('Keywords'), operate: 'LIKE'},
{field: 'category.name', title: __('Category.name'), operate: false},
{field: 'activity.name', title: __('Activity.name'), operate: 'LIKE'},
{field: 'activity.name', title: __('Activity.name'), operate: false},
{field: 'category_id', visible: false, title: __('Category_id'),operate: 'LIKE %...%'},
{field: 'activity_id', visible: false, title: __('Activity_id'),operate: 'LIKE %...%'},
{field: 'image', title: __('Image'), formatter: Table.api.formatter.image},
... ...