添加预售备注
This commit is contained in:
parent
a3412766b2
commit
0bce3718e2
@ -67,7 +67,7 @@ class GoodsLogic extends Logic
|
||||
}
|
||||
|
||||
$goodsDetail = Goods::with(['goods_image', 'goods_item', 'shop'])
|
||||
->field('id,type,name,image,video,remark,goods_remark,content,purchase_price,issuing_price,wholesale_price,market_price,min_price,max_price,is_show_stock,stock,sales_actual,sales_virtual,clicks,clicks_virtual,shop_id,poster,subsidy_id,is_new_goods')
|
||||
->field('id,type,name,image,video,remark,goods_remark,content,purchase_price,issuing_price,wholesale_price,market_price,min_price,max_price,is_show_stock,stock,sales_actual,sales_virtual,clicks,clicks_virtual,shop_id,poster,subsidy_id,presale,presale_mask')
|
||||
->where($onSaleWhere)
|
||||
->where('id', $goodsId)
|
||||
->findOrEmpty();
|
||||
|
||||
@ -417,7 +417,8 @@ class GoodsLogic extends Logic
|
||||
//更新主表
|
||||
$data = [
|
||||
'name' => $post['name'],
|
||||
'is_new_goods' => isset($post['is_new_goods']) && $post['is_new_goods'] == 'on' ? 1 : 0,
|
||||
'presale' => isset($post['presale']) && $post['presale'] == 'on' ? 1 : 0,
|
||||
'presale_mask' => $post['presale_mask'],
|
||||
'code' => $post['code'],
|
||||
'shop_cate_id' => $post['shop_cate_id'],
|
||||
'first_cate_id' => $post['first_cate_id'],
|
||||
@ -956,7 +957,8 @@ class GoodsLogic extends Logic
|
||||
$data = [
|
||||
'type' => $post['type'],
|
||||
'name' => trim($post['name']),
|
||||
'is_new_goods' => isset($post['is_new_goods']) && $post['is_new_goods'] == 'on' ? 1 : 0,
|
||||
'presale' => isset($post['presale']) && $post['presale'] == 'on' ? 1 : 0,
|
||||
'presale_mask' => $post['presale_mask'],
|
||||
'code' => trim($post['code']) ? trim($post['code']) : create_goods_code($shop_id),
|
||||
'shop_id' => $shop_id,
|
||||
'shop_cate_id' => $post['shop_cate_id'],
|
||||
|
||||
@ -843,7 +843,8 @@
|
||||
var goods_info= {$info|raw|default=''};
|
||||
|
||||
// 商品类型
|
||||
$("input[name=is_new_goods]").prop("checked", goods_info['base']['is_new_goods'] == 1);
|
||||
$("input[name=presale]").prop("checked", goods_info['base']['presale'] == 1);
|
||||
$("input[name=presale_mask]").val(goods_info['base']['presale_mask']);
|
||||
$("input[name=type]").prop("disabled",true);
|
||||
$("input[name=type][value="+goods_info['base']['type']+"]").prop("checked",true);
|
||||
switchGoodsType(goods_info['base']['type']);
|
||||
@ -853,8 +854,8 @@
|
||||
$('textarea[name="delivery_content"]').val(goods_info['base']['delivery_content']);
|
||||
// 配送方式
|
||||
renderDeliveryType(goods_info['base']['delivery_type'], goods_info['base']['type']);
|
||||
$('textarea[name="goods_remark"]').val(goods_info['base']['goods_remark']);
|
||||
$('input[name="work_remark"]').val(goods_info['base']['work_remark']);
|
||||
$('textarea[name="goods_remark"]').val(goods_info['base']['goods_remark']);
|
||||
$('input[name="work_remark"]').val(goods_info['base']['work_remark']);
|
||||
$('input[name="goods_id"]').val(goods_info['base']['id']);
|
||||
$('input[name="name"]').val(goods_info['base']['name']);
|
||||
$('input[name="code"]').val(goods_info['base']['code']);
|
||||
|
||||
@ -25,11 +25,19 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--新品-->
|
||||
<!--预售-->
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">新品</label>
|
||||
<label class="layui-form-label">预售</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="is_new_goods" lay-skin="switch">
|
||||
<input type="checkbox" name="presale" lay-skin="switch">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--预售备注-->
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">预售备注</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="presale_mask" class="layui-input" placeholder="预售备注">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -37,8 +37,8 @@ class AddIsNewGoodsFieldsToGoods extends Migrator
|
||||
public function down()
|
||||
{
|
||||
// 回滚操作删除添加的字段
|
||||
$table = $this->table('goods_subsidy');
|
||||
$table->removeColumn('store_subsidy')
|
||||
$table = $this->table('goods');
|
||||
$table->removeColumn('is_new_goods')
|
||||
->update();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class RenameIsNewGoodsFieldsToGoods extends Migrator
|
||||
{
|
||||
/**
|
||||
* Change Method.
|
||||
*
|
||||
* Write your reversible migrations using this method.
|
||||
*
|
||||
* More information on writing migrations is available here:
|
||||
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
|
||||
*
|
||||
* The following commands can be used in this method and Phinx will
|
||||
* automatically reverse them when rolling back:
|
||||
*
|
||||
* createTable
|
||||
* renameTable
|
||||
* addColumn
|
||||
* renameColumn
|
||||
* addIndex
|
||||
* addForeignKey
|
||||
*
|
||||
* Remember to call "create()" or "update()" and NOT "save()" when working
|
||||
* with the Table class.
|
||||
*/
|
||||
public function change()
|
||||
{
|
||||
$table = $this->table('goods');
|
||||
$table->renameColumn('is_new_goods', 'presale')->update(); // 更新
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class AddPresaleMaskFieldsToGoods extends Migrator
|
||||
{
|
||||
/**
|
||||
* Change Method.
|
||||
*
|
||||
* Write your reversible migrations using this method.
|
||||
*
|
||||
* More information on writing migrations is available here:
|
||||
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
|
||||
*
|
||||
* The following commands can be used in this method and Phinx will
|
||||
* automatically reverse them when rolling back:
|
||||
*
|
||||
* createTable
|
||||
* renameTable
|
||||
* addColumn
|
||||
* renameColumn
|
||||
* addIndex
|
||||
* addForeignKey
|
||||
*
|
||||
* Remember to call "create()" or "update()" and NOT "save()" when working
|
||||
* with the Table class.
|
||||
*/
|
||||
public function change()
|
||||
{
|
||||
$table = $this->table('goods');
|
||||
$table->addColumn('presale_mask', 'string', [
|
||||
'limit' => 255, 'default' => '', 'null' => false, 'comment' => '预售备注'
|
||||
])->update(); // 更新表结构
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
// 回滚操作删除添加的字段
|
||||
$table = $this->table('goods');
|
||||
$table->removeColumn('presale_mask')
|
||||
->update();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user