1
This commit is contained in:
parent
faa2bb5777
commit
eedf770a8d
@ -61,8 +61,8 @@ class Goods extends \yii\db\ActiveRecord
|
|||||||
[['attr_groups', 'plugin_sign'], 'trim'],
|
[['attr_groups', 'plugin_sign'], 'trim'],
|
||||||
[['cx_mch_id', 'goods_hub_id', 'status', 'use_attr', 'goods_stock', 'virtual_sales', 'confine_count', 'freight_id', 'sort', 'created_at', 'updated_at', 'deleted_at', 'is_delete', 'payment_people', 'payment_num', 'payment_order', 'sales', 'viewed_count'], 'integer'],
|
[['cx_mch_id', 'goods_hub_id', 'status', 'use_attr', 'goods_stock', 'virtual_sales', 'confine_count', 'freight_id', 'sort', 'created_at', 'updated_at', 'deleted_at', 'is_delete', 'payment_people', 'payment_num', 'payment_order', 'sales', 'viewed_count'], 'integer'],
|
||||||
[['goods_hub_id', 'attr_groups'], 'required'],
|
[['goods_hub_id', 'attr_groups'], 'required'],
|
||||||
[['price', 'payment_amount'], 'number'],
|
[['payment_amount'], 'number'],
|
||||||
[['attr_groups'], 'string'],
|
[['attr_groups', 'price'], 'string'],
|
||||||
[['plugin_sign'], 'string', 'max' => 255],
|
[['plugin_sign'], 'string', 'max' => 255],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -100,7 +100,8 @@ class Goods extends \yii\db\ActiveRecord
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function beforeSave($insert) {
|
public function beforeSave($insert)
|
||||||
|
{
|
||||||
if (parent::beforeSave($insert)) {
|
if (parent::beforeSave($insert)) {
|
||||||
if ($this->isNewRecord) {
|
if ($this->isNewRecord) {
|
||||||
$this->created_at = time();
|
$this->created_at = time();
|
||||||
|
|||||||
@ -72,16 +72,16 @@ class CommonGoodsEditForm extends Model
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[['name', 'subtitle', 'detail', 'cover_pic', 'video_url', 'unit', 'plugin_sign', 'goods_no',], 'trim'],
|
[['name', 'subtitle', 'detail', 'cover_pic', 'video_url', 'unit', 'plugin_sign', 'goods_no',], 'trim'],
|
||||||
[['name', 'subtitle', 'detail', 'cover_pic', 'video_url', 'video_banner_urls', 'banner_urls', 'unit', 'plugin_sign', 'goods_no', 'date', 'signing_head_img', 'signing_foot_img'], 'string'],
|
[['name', 'subtitle', 'detail', 'price', 'cover_pic', 'video_url', 'video_banner_urls', 'banner_urls', 'unit', 'plugin_sign', 'goods_no', 'date', 'signing_head_img', 'signing_foot_img'], 'string'],
|
||||||
[['original_price', 'cost_price', 'price', 'goods_weight'], 'number'],
|
[['original_price', 'cost_price', 'goods_weight'], 'number'],
|
||||||
[['type', 'use_attr', 'goods_stock', 'virtual_sales', 'confine_count', 'freight_id', 'sort', 'cx_mch_id'], 'integer'],
|
[['type', 'use_attr', 'goods_stock', 'virtual_sales', 'confine_count', 'freight_id', 'sort', 'cx_mch_id'], 'integer'],
|
||||||
|
|
||||||
[['cat_id', 'cat1_id', 'cat2_id', 'cat3_id', 'cat4_id',], 'integer'],
|
[['cat_id', 'cat1_id', 'cat2_id', 'cat3_id', 'cat4_id',], 'integer'],
|
||||||
|
|
||||||
|
|
||||||
[['pic_urls', 'cat_ids', 'model', 'attr', 'attrGroups'], 'safe'],
|
[['pic_urls', 'cat_ids', 'model', 'attr', 'attrGroups'], 'safe'],
|
||||||
[['cost_price', 'original_price', 'price'], 'number', 'min' => 0],
|
[['cost_price', 'original_price'], 'number', 'min' => 0],
|
||||||
[['cost_price', 'original_price', 'price'], 'number', 'max' => 9999999],
|
[['cost_price', 'original_price'], 'number', 'max' => 9999999],
|
||||||
[['sort', 'virtual_sales', 'freight_id'], 'default', 'value' => 100],
|
[['sort', 'virtual_sales', 'freight_id'], 'default', 'value' => 100],
|
||||||
[['confine_count', 'use_attr'], 'default', 'value' => 0],
|
[['confine_count', 'use_attr'], 'default', 'value' => 0],
|
||||||
[['name', 'price', 'cover_pic', 'type', 'plugin_sign', 'banner_urls', 'model', 'cx_mch_id'], 'required'],
|
[['name', 'price', 'cover_pic', 'type', 'plugin_sign', 'banner_urls', 'model', 'cx_mch_id'], 'required'],
|
||||||
@ -124,6 +124,7 @@ class CommonGoodsEditForm extends Model
|
|||||||
$this->model->cx_mch_id = $this->cx_mch_id;
|
$this->model->cx_mch_id = $this->cx_mch_id;
|
||||||
$this->model->plugin_sign = $this->plugin_sign;
|
$this->model->plugin_sign = $this->plugin_sign;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->model->price = $this->price;
|
$this->model->price = $this->price;
|
||||||
$this->model->goods_stock = empty($this->goods_stock) ? 9999 : $this->goods_stock; // 商品库存
|
$this->model->goods_stock = empty($this->goods_stock) ? 9999 : $this->goods_stock; // 商品库存
|
||||||
$this->model->virtual_sales = $this->virtual_sales;
|
$this->model->virtual_sales = $this->virtual_sales;
|
||||||
@ -185,8 +186,8 @@ class CommonGoodsEditForm extends Model
|
|||||||
}
|
}
|
||||||
$goods_hub->name = $this->name;
|
$goods_hub->name = $this->name;
|
||||||
$goods_hub->subtitle = $this->subtitle;
|
$goods_hub->subtitle = $this->subtitle;
|
||||||
$goods_hub->original_price = $this->original_price ? $this->original_price : $this->price;
|
// $goods_hub->original_price = $this->original_price ? $this->original_price : $this->price;
|
||||||
$goods_hub->cost_price = $this->cost_price ? $this->cost_price : $this->price;
|
// $goods_hub->cost_price = $this->cost_price ? $this->cost_price : $this->price;
|
||||||
$goods_hub->detail = $this->detail;
|
$goods_hub->detail = $this->detail;
|
||||||
$goods_hub->cover_pic = $this->cover_pic;
|
$goods_hub->cover_pic = $this->cover_pic;
|
||||||
$goods_hub->signing_head_img = $this->signing_head_img;
|
$goods_hub->signing_head_img = $this->signing_head_img;
|
||||||
|
|||||||
@ -154,7 +154,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label required">签约价格</label>
|
<label class="layui-form-label required">签约价格</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input type="number" name="price" placeholder="请输入售价" autocomplete="off"
|
<input type="subtitle" name="price" placeholder="请输入售价" autocomplete="off"
|
||||||
class="layui-input" value="<?= $model->price ?>" lay-verify="required">
|
class="layui-input" value="<?= $model->price ?>" lay-verify="required">
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-mid layui-word-aux"></div>
|
<div class="layui-form-mid layui-word-aux"></div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user