Browse Source

开发商品物流信息编辑模块

antshop
linyaostalker 5 years ago
parent
commit
b1ab7d94e0
  1. 79
      backend/modules/goods/views/goods/express.php

79
backend/modules/goods/views/goods/express.php

@ -1,35 +1,60 @@
<?php
use yii\helpers\Url;
use blobt\widgets\Icheck;
use backend\modules\goods\models\ars\Goods;
use linyao\widgets\Select2;
use backend\modules\shop\models\ars\ExpressTemplate;
/* @var $this yii\web\View */
/* @var $model backend\modules\goods\models\ars\Goods */
/* @var $form yii\widgets\ActiveForm */
?>
<?= $form->field($model, 'coverImageId')->hiddenInput()->label('') ?>
<?= $form->field($model, 'coverImagePath')->widget(\iron\widgets\Upload::className(), [
'url' => 'upload',
'deleteUrl' => 'img-id-del',
'dragdropWidth'=> 800,
'afterSave' => 'save-file',
'maxCount' => 1,
'fillInAttribute' => 'coverImageId',
'model' => $model,
'previewConfig' => [
'url' => Url::to(['image-file', 'fileidstr' => $model->coverImageId, 'ruleverify' => $model->ruleVerify]),
],
])->label('商品封面图') ?>
<?= $form->field($model, 'detailImageId')->hiddenInput()->label('') ?>
<?= $form->field($model, 'detailImagePath')->widget(\iron\widgets\Upload::className(), [
'url' => 'upload',
'deleteUrl' => 'img-id-del',
'dragdropWidth'=> 800,
'afterSave' => 'save-file',
'maxCount' => 5,
'fillInAttribute' => 'detailImageId',
'model' => $model,
'previewConfig' => [
'url' => Url::to(['image-file', 'fileidstr' => $model->detailImageId, 'ruleverify' => $model->ruleVerify]),
],
])->label('商品详情图') ?>
<?= $form->field($model, 'is_taking')->widget(Icheck::className(), ['items' => Goods::$isTaking, 'type' => 'radio']) ?>
<?= $form->field($model, 'is_express')->widget(Icheck::className(), ['items' => Goods::$isExpress, 'type' => 'radio']) ?>
<fieldset id="isExpress" style="display: <?= $model->is_express == Goods::IS_EXPRESS_NO ? 'none' : 'block' ?>">
<?= $form->field($model, 'express_type')->widget(Icheck::className(), ['items' => Goods::$expressType, 'type' => 'radio']) ?>
<fieldset id="uniformPostage" style="display: <?= $model->express_type == Goods::EXPRESS_TYPE_UNIFORM_POSTAGE ? 'block' : 'none' ?>">
<?= $form->field($model, 'uniform_postage')->textInput() ?>
</fieldset>
<fieldset id="expressTemplate" style="display: <?= $model->express_type == Goods::EXPRESS_TYPE_EXPRESS_TEMPLAGE ? 'block' : 'none' ?>">
<?= $form->field($model, 'express_template')->widget(Select2::className(), ["items" => ExpressTemplate::modelColumn()]) ?>
</fieldset>
</fieldset>
<?php
$js =<<<JS
$("input:radio[name='Goods[is_express]']").on('ifChecked', function(event){
if ($(this).val() === '1') {
$("#isExpress").show();
} else {
$("#isExpress").hide();
}
})
$("input:radio[name='Goods[express_type]']").on('ifChecked', function(event){
if ($(this).val() === '1') {
$("#uniformPostage").show();
$("#expressTemplate").hide();
} else {
$("#expressTemplate").show();
$("#uniformPostage").hide();
}
})
$("#goods-uniform_postage").blur(function(){
if(isNaN($(this).val())){
$(this).val("0.00")
}
if($(this).val().indexOf('-') != -1){
$(this).val("0.00")
}
var basicPrice = $(this).val();
$(this).val(basicPrice.toString().match(/^\d+(?:\.\d{0,2})?/));
})
JS;
$this->registerJs($js);
?>
Loading…
Cancel
Save