作者 SHW\戥岁。。

编辑后折扣消失bug

... ... @@ -260,9 +260,14 @@ class Litestoregoods extends Backend
}
$result = $row->allowField(true)->save($params);
if ($result !== false) {
//获取设置的折扣
$discount = Db::name('litestore_goods_spec')->where('goods_id', $row->goods_id)->value('discount');
//成功之后 存储商品规格
$spec_many_params = $this->request->post("spec_many/a");
$row->addGoodsSpec($params, $spec_many_params, $this->request->post("spec/a"), true);
//还原折扣
Db::name('litestore_goods_spec')->where('goods_id', $row->goods_id)->update(['discount' => $discount]);
// 删除购物车
Db::name('cart')->where('goods_id', $row->goods_id)->delete();
//删除我常买
... ...
... ... @@ -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 asc").data("pageSize",20);
$("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 asc").data("pageSize",20);
$("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);
});
... ... @@ -37,6 +37,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'litestor
sortName: 'goods_sort',
search: false,
showExport: false,
fixedColumns: true,
fixedRightNumber: 1,
pageList: [100, 300, 500],
columns: [
[
... ... @@ -46,8 +48,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'litestor
{field: 'keywords', title: __('Keywords'), operate: 'LIKE'},
{field: 'category.name', title: __('Category.name'), operate: false},
{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: '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},
{field: 'images', title: __('Images'), formatter: Table.api.formatter.images},
{
... ... @@ -110,19 +112,19 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'litestor
$(document).on("click", ".btn-discount", function () {
var ids = Table.api.selectedids(table);
layer.prompt({
formType: 0,
value: '8.5',
title: '请输入折扣(请勿输入汉字)',
area: ['800px', '350px'] //自定义文本域宽高
},function(value, index, elem){
formType: 0,
value: '8.5',
title: '请输入折扣(请勿输入汉字)',
area: ['800px', '350px'] //自定义文本域宽高
}, function (value, index, elem) {
Fast.api.ajax({
url:'litestore/litestoregoods/discount?id='+ids+'&discount='+value,
},function (data,ret){
url: 'litestore/litestoregoods/discount?id=' + ids + '&discount=' + value,
}, function (data, ret) {
Fast.api.success('data');
layer.close(index);
window.location.reload(true);
return false;
},function (data,ret){
}, function (data, ret) {
Fast.api.success('失败')
return true;
});
... ...