瀏覽代碼

[producer] Pouvoir afficher un produit non commandable pour faire office de titre

refactoring
Guillaume 4 年之前
父節點
當前提交
7dfb930f13
共有 2 個檔案被更改,包括 18 行新增14 行删除
  1. +2
    -2
      common/models/Product.php
  2. +16
    -12
      producer/views/order/order.php

+ 2
- 2
common/models/Product.php 查看文件

@@ -337,8 +337,8 @@ class Product extends ActiveRecordCommon
*/
public function getPriceWithTax()
{
return Price::getPriceWithTax($this->price, $this->taxRate->value);
$taxRateValue = $this->taxRate ? $this->taxRate->value : 0 ;
return Price::getPriceWithTax($this->price, $taxRateValue);
}

public function getTheTaxRate()

+ 16
- 12
producer/views/order/order.php 查看文件

@@ -195,22 +195,26 @@ $this->setTitle('Commander') ;
<div class="recipe" v-if="product.recipe.length">{{ product.recipe }}</div>
</td>
<td class="price-unit">
{{ formatPrice(product.price_with_tax) }}<br /><span class="unit">{{ product.wording_unit }}</span>
<template v-if="product.price_with_tax > 0">{{ formatPrice(product.price_with_tax) }}<br /><span class="unit">{{ product.wording_unit }}</span></template>
</td>
<td class="td-quantity">
<div class="input-group">
<span class="input-group-btn">
<button class="btn btn-default btn-moins" type="button" @click="productQuantityClick(product, product.unit == 'piece' ? -1 : -parseFloat(product.step))" :disabled="product.quantity_form == 0"><span class="glyphicon glyphicon-minus"></span></button>
</span>
<input type="text" v-model="product.quantity_form" class="form-control quantity" readonly="readonly" />
<span class="input-group-addon">{{ product.unit == 'piece' ? 'p.' : product.unit }}</span>
<span class="input-group-btn">
<button class="btn btn-default btn-plus" type="button" @click="productQuantityClick(product, product.unit == 'piece' ? 1 : parseFloat(product.step))" :disabled="product.quantity_form == product.quantity_remaining && product.quantity_max > 0"><span class="glyphicon glyphicon-plus"></span></button>
</span>
</div>
<template v-if="product.price_with_tax > 0">
<div class="input-group">
<span class="input-group-btn">
<button class="btn btn-default btn-moins" type="button" @click="productQuantityClick(product, product.unit == 'piece' ? -1 : -parseFloat(product.step))" :disabled="product.quantity_form == 0"><span class="glyphicon glyphicon-minus"></span></button>
</span>
<input type="text" v-model="product.quantity_form" class="form-control quantity" readonly="readonly" />
<span class="input-group-addon">{{ product.unit == 'piece' ? 'p.' : product.unit }}</span>
<span class="input-group-btn">
<button class="btn btn-default btn-plus" type="button" @click="productQuantityClick(product, product.unit == 'piece' ? 1 : parseFloat(product.step))" :disabled="product.quantity_form == product.quantity_remaining && product.quantity_max > 0"><span class="glyphicon glyphicon-plus"></span></button>
</span>
</div>
</template>
</td>
<td class="price-total">
{{ formatPrice(product.price_with_tax * (product.quantity_form / product.coefficient_unit )) }}
<template v-if="product.price_with_tax > 0 && product.quantity_form > 0">
{{ formatPrice(product.price_with_tax * (product.quantity_form / product.coefficient_unit )) }}
</template>
</td>
</tr>
<tr class="total">

Loading…
取消
儲存