瀏覽代碼

[producer] Prise de commande : mise à jour des prix lors de la sélection d'un point de vente

master
Guillaume 3 年之前
父節點
當前提交
b3d7a1fdca
共有 2 個檔案被更改,包括 12 行新增3 行删除
  1. +12
    -2
      producer/controllers/OrderController.php
  2. +0
    -1
      producer/web/js/vuejs/order-order.js

+ 12
- 2
producer/controllers/OrderController.php 查看文件

@@ -183,7 +183,13 @@ class OrderController extends ProducerBaseController
])
->one();

if (!$order) {
if($order) {
if($order->id_point_sale != $posts['Order']['id_point_sale']) {
$order->id_point_sale = $posts['Order']['id_point_sale'] ;
$order->date_update = date('Y-m-d H:i:s') ;
}
}
else {
$order = new Order;
$order->load(Yii::$app->request->post());
$order->id_user = User::getCurrentId();
@@ -335,7 +341,11 @@ class OrderController extends ProducerBaseController
$productOrder->id_order = $order->id;
$productOrder->id_product = $product->id;

$productOrder->price = $product->price;
$productOrder->price = $product->getPrice([
'user' => User::getCurrent(),
'user_producer' => $userProducer,
'point_sale' => $pointSale
]);
$productOrder->id_tax_rate = $product->taxRate->id;

$unit = (!is_null($order) && isset($unitsArray[$product->id])) ? $unitsArray[$product->id] : $product->unit;

+ 0
- 1
producer/web/js/vuejs/order-order.js 查看文件

@@ -282,7 +282,6 @@ var app = new Vue({
this.changeStep('products') ;
},
productQuantityClick: function(product, quantity) {
console.log(this.products[product.index].quantity_remaining) ;
if( this.products[product.index].quantity_form + quantity >= 0 &&
(this.products[product.index].quantity_form + quantity <= (this.products[product.index].quantity_remaining * this.products[product.index].coefficient_unit) ||
!this.products[product.index].quantity_max)

Loading…
取消
儲存