浏览代码

Adaptation du fonctionnement du formulaire de commande par rapport à la nouvelle option credit_functioning

dev
父节点
当前提交
ee7267177c
共有 3 个文件被更改,包括 17 次插入5 次删除
  1. +8
    -2
      producer/controllers/OrderController.php
  2. +4
    -2
      producer/views/order/order.php
  3. +5
    -1
      producer/web/js/vuejs/order-order.js

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

@@ -310,7 +310,7 @@ class OrderController extends ProducerBaseController
$order = Order::searchOne([
'id' => $order->id
]) ;
if ($credit && ($pointSale->credit || $order->getAmount(Order::AMOUNT_PAID))) {
if($credit && $pointSale->credit && ($posts['use_credit'] || $pointSale->credit_functioning == Producer::CREDIT_FUNCTIONING_MANDATORY)) {
$amountPaid = $order->getAmount(Order::AMOUNT_PAID);

// à payer
@@ -436,7 +436,8 @@ class OrderController extends ProducerBaseController
]) ;
$json['producer'] = [
'order_infos' => $producer->order_infos,
'credit' => $producer->credit
'credit' => $producer->credit,
'credit_functioning' => $producer->credit_functioning,
] ;
// Distributions
@@ -512,6 +513,8 @@ class OrderController extends ProducerBaseController
])
->all();

$creditFunctioningProducer = Producer::getConfig('credit_functioning') ;
foreach($pointsSaleArray as &$pointSale) {
$pointSale = array_merge($pointSale->getAttributes(),[
'pointSaleDistribution' => [
@@ -524,6 +527,9 @@ class OrderController extends ProducerBaseController
if($pointSale['code'] && strlen($pointSale['code'])) {
$pointSale['code'] = '***' ;
}
if(!strlen($pointSale['credit_functioning'])) {
$pointSale['credit_functioning'] = $creditFunctioningProducer ;
}
}
$json['points_sale'] = $pointsSaleArray;

+ 4
- 2
producer/views/order/order.php 查看文件

@@ -230,8 +230,10 @@ $this->setTitle('Commander') ;
</div>
<div class="credit">
<div v-if="producer.credit == 1 && pointSaleActive.credit == 1">
<span class="glyphicon glyphicon-chevron-right"></span> La commande va être réglée via votre Crédit ({{ formatPrice(credit) }}).
<div class="info">
<input type="checkbox" id="use-credit" v-model="useCredit" disabled="disabled" v-if="pointSaleActive.credit_functioning == 'mandatory'" />
<input type="checkbox" id="use-credit" v-model="useCredit" v-else /> <label for="use-credit">Utiliser mon Crédit ({{ formatPrice(credit) }})</label>
<div class="info" v-if="useCredit">
<span v-if="order == null || order.amount_paid == 0">{{ priceTotal(true) }} seront débités</span>
<span v-else-if="order != null && order.amount_paid > 0 && order.amount_paid < priceTotal()">{{ formatPrice(priceTotal() - order.amount_paid) }} seront débités</span>
<span v-else-if="order != null && order.amount_paid > priceTotal()">{{ formatPrice(order.amount_paid - priceTotal()) }} seront remboursés</span>

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

@@ -17,6 +17,7 @@ var app = new Vue({
comment: '',
creditCheckbox: false,
credit: 0,
useCredit: false,
errors: [],
disableConfirmButton: false,
calendar: {
@@ -242,6 +243,8 @@ var app = new Vue({

validatePointSale: function(idPointSale) {
this.pointSaleActive = this.getPointSale(idPointSale) ;
this.useCredit = true ;
this.changeStep('products') ;
},
productQuantityClick: function(product, quantity) {
@@ -301,7 +304,8 @@ var app = new Vue({
comment: this.comment
},
code_point_sale: this.pointsSaleCodes[this.pointSaleActive.id],
products: productsArray
products: productsArray,
use_credit: Number(this.useCredit)
}).then(function(response) {
if(response.data.status == 'success') {
window.location.href = chat_base_url(true)+'order/confirm?idOrder='+response.data.idOrder ;

正在加载...
取消
保存