ali 3 роки тому
батько
коміт
64eab75e4e

+ 29 - 5
src/components/InvoicePaymentCard/InvoicePaymentCard.vue

@@ -4,10 +4,12 @@
       <div class="InvoicePaymentCard-head-title">
         پرداخت از طریق کیف پول
       </div>
-      <div class="InvoicePaymentCard-head-caption">
+      <div v-if="showMessage"
+           class="InvoicePaymentCard-head-caption">
         خرید شما قطعی نشده است و در صورت عدم پرداخت تا پایان زمان، صورتحساب شما لغو خواهد شد
       </div>
-      <div class="InvoicePaymentCard-head-remaining-time">
+      <div v-if="showTimer"
+           class="InvoicePaymentCard-head-remaining-time">
         <q-icon name="isax:clock" />
         زمان باقی مانده :
         {{ timerString }}
@@ -28,7 +30,8 @@
         </div>
       </div>
       <div class="other-items">
-        <div class="other-item">
+        <div v-if="showWallet"
+             class="other-item">
           <div class="other-item-label">
             <q-icon name="isax:wallet" />
             موجودی کیف پول
@@ -59,7 +62,7 @@
           </div>
         </div>
       </div>
-      <div v-if="!invoice.instalments_info || invoice.instalments_info.length === 0"
+      <div v-if="(!invoice.instalments_info || invoice.instalments_info.length === 0) && canAction"
            class="action-area">
         <q-btn color="red"
                class="btn-cancel"
@@ -81,7 +84,7 @@
           </template>
         </q-btn>
       </div>
-      <div v-if="showInvoiceLinkBtn"
+      <div v-if="showInvoiceLinkBtn && showInvoiceLink"
            class="show-invoice-row">
         <q-btn class="btn-show-invoice"
                color="primary"
@@ -94,6 +97,7 @@
       <div>
         <instalments :wallet="wallet"
                      :invoice="invoice"
+                     :can-action="canAction"
                      @onInstalmentPayed="onInstalmentPayed" />
       </div>
     </div>
@@ -118,6 +122,26 @@ export default {
     wallet: {
       type: Wallet,
       default: new Wallet()
+    },
+    showInvoiceLink: {
+      type: Boolean,
+      default: true
+    },
+    showTimer: {
+      type: Boolean,
+      default: true
+    },
+    showMessage: {
+      type: Boolean,
+      default: true
+    },
+    showWallet: {
+      type: Boolean,
+      default: true
+    },
+    canAction: {
+      type: Boolean,
+      default: true
     }
   },
   emits: ['onCancel', 'onAccept', 'onInstalmentPayed'],

+ 5 - 1
src/components/InvoicePaymentCard/components/Instalments.vue

@@ -61,7 +61,7 @@
               {{ getPaidTime(instalment.paid_time) }}
             </div>
             <div class="Instalments-col col-md-3 col-12">
-              <q-btn v-if="!instalment.paid_time"
+              <q-btn v-if="!instalment.paid_time && canAction"
                      color="primary"
                      :loading="payLoading"
                      @click="pay(instalment)">
@@ -91,6 +91,10 @@ export default {
     wallet: {
       type: Wallet,
       default: new Wallet()
+    },
+    canAction: {
+      type: Boolean,
+      default: true
     }
   },
   emits: ['onInstalmentPayed'],

+ 12 - 9
src/components/Widgets/Invoice/AdminInvoiceShow/AdminInvoiceShow.vue

@@ -103,14 +103,7 @@
         </div>
       </q-card-section>
     </q-card>
-    <div v-if="false"
-         class="action q-mt-lg">
-      <q-card v-if="!invoice.loading && invoice.status!=='PAYING' && invoice.status!=='PAID_FULL' && invoice.status!=='PAID_IN_INSTALMENT'"
-              class="q-mb-md">
-        <q-card-section>
-          تنها در صورتی که وضعیت سفارش در حال پرداخت باشد امکان پرداخت با کیف پول وجود دارد
-        </q-card-section>
-      </q-card>
+    <div class="action q-mt-lg">
       <q-card>
         <q-card-section>
           پرداخت
@@ -120,9 +113,15 @@
           <invoice-payment-card v-if="!invoice.loading && invoice.status!=='PAID_FULL' && invoice.status!=='PAID_IN_INSTALMENT'"
                                 :wallet="wallet"
                                 :invoice="invoice"
+                                :show-invoice-link="false"
+                                :show-timer="false"
+                                :show-message="false"
+                                :show-wallet="false"
+                                :can-action="false"
                                 class="payment-card"
                                 @onCancel="onCancel"
-                                @onAccept="onAccept" />
+                                @onAccept="onAccept"
+                                @onInstalmentPayed="onInstalmentPayed" />
         </q-card-section>
       </q-card>
 
@@ -189,6 +188,10 @@ export default {
     onAccept () {
       this.payInvoice()
     },
+    onInstalmentPayed () {
+      this.getMyWallet()
+      this.getInvoice()
+    },
     getMyWallet () {
       this.wallet.loading = true
       APIGateway.wallet.getMyWallet(this.user.id)