Просмотр исходного кода

Merge branch 'ui-refactor-phase-2' of guanli/ngfrontend into develop

bill001 13 часов назад
Родитель
Сommit
1db2b947d1

+ 12 - 2
src/ui-refactor/components/DeliveryNotice.vue

@@ -1,6 +1,16 @@
 <script>
+const NIGERIA_COUNTRY_ID = '620699181539139625'
+
 export default {
-  name: 'DeliveryNotice'
+  name: 'DeliveryNotice',
+  props: {
+    countryId: { type: String, default: '' }
+  },
+  computed: {
+    showDeliveryTime() {
+      return this.countryId === NIGERIA_COUNTRY_ID
+    }
+  }
 }
 </script>
 
@@ -15,7 +25,7 @@ export default {
         </p>
       </div>
     </div>
-    <div class="ng-delivery-notice-panel ng-delivery-notice-time">
+    <div v-if="showDeliveryTime" class="ng-delivery-notice-panel ng-delivery-notice-time">
       <h3 class="ng-delivery-notice-title">
         <i class="el-icon-time" aria-hidden="true" />
         Delivery Time

+ 1 - 1
src/ui-refactor/views/guest-shop/GuestPurchaseFlow.vue

@@ -107,7 +107,7 @@
         <el-col :xs="24" :lg="8" class="ng-guest-summary-column">
           <order-summary
             :checkout="stage === 'checkout'"
-            :show-delivery-notice="market === 'ng'"
+            :delivery-country-id="country.ID"
             :show-bv="false"
             :items="cartRows"
             :payment-method="paymentMethod"

+ 2 - 2
src/ui-refactor/views/purchase/OrderSummary.vue

@@ -69,7 +69,7 @@
         {{ currency }} {{ total | toThousandFilter }}
       </el-descriptions-item>
     </el-descriptions>
-    <delivery-notice v-if="showDeliveryNotice" />
+    <delivery-notice :country-id="deliveryCountryId" />
     <el-card
       v-if="maintenance"
       shadow="never"
@@ -128,7 +128,7 @@ export default {
   components: { DeliveryNotice },
   props: {
     checkout: { type: Boolean, default: false },
-    showDeliveryNotice: { type: Boolean, default: false },
+    deliveryCountryId: { type: String, default: '' },
     showBv: { type: Boolean, default: true },
     items: { type: Array, default: () => [] },
     paymentMethod: { type: String, default: '' },

+ 6 - 4
src/ui-refactor/views/purchase/PurchaseFlow.vue

@@ -118,7 +118,7 @@
           @details="handleProduct"
         >
           <template v-if="!isSelf" #footer>
-            <delivery-notice v-if="showDeliveryNotice" />
+            <delivery-notice v-if="!isUpgrade" :country-id="deliveryCountryId" />
             <div class="ng-purchase-cart-hint" role="note">
               <span class="ng-purchase-cart-hint-icon" aria-hidden="true">
                 <i class="el-icon-shopping-cart-2" />
@@ -275,7 +275,7 @@
         <order-summary
           v-if="!isEmptyCart"
           :checkout="stage === 'checkout'"
-          :show-delivery-notice="showDeliveryNotice"
+          :delivery-country-id="deliveryCountryId"
           :items="summaryItems"
           :payment-method="selectedPaymentName"
           :channels="activePayType === 'pay_stack' ? channels : []"
@@ -378,6 +378,7 @@ import ProductDetailsDialog from '@/ui-refactor/components/ProductDetailsDialog.
 import PaymentMethods from '@/ui-refactor/components/PaymentMethods.vue'
 import PaystackPaymentDialog from '@/ui-refactor/components/PaystackPaymentDialog.vue'
 import UpgradeLevelFields from './UpgradeLevelFields.vue'
+import usersInfo from '@/utils/usersInfo'
 
 export default {
   ...behavior,
@@ -402,8 +403,9 @@ export default {
     isEmptyCart() {
       return this.stage === 'cart' && !this.cartItems.length
     },
-    showDeliveryNotice() {
-      return this.currencyUnitCode === 'NGN' && (this.stage !== 'catalog' || (!this.isSelf && !this.isUpgrade))
+    deliveryCountryId() {
+      if (this.isSelf) return usersInfo.baseData()?.COUNTRY_ID || ''
+      return this.isUpgrade ? this.upgradeCountryId : this.memberDetails?.countryId || ''
     },
     maintenanceLimitLabel() {
       return this.ampDivideLine == null ? '—' : this.ampDivideLine

+ 10 - 0
src/ui-refactor/views/purchase/purchaseBehavior.js

@@ -55,6 +55,7 @@ export default {
       cartItems: [],
       memberKey: '',
       memberSearch: '',
+      upgradeCountryId: '',
       memberLoading: false,
       settingsReady: false,
       settingsLoading: false,
@@ -200,6 +201,15 @@ export default {
     stage() {
       this.prepareCheckout()
     },
+    async memberKey(userName) {
+      if (!this.isUpgrade) return
+      this.upgradeCountryId = ''
+      if (!userName) return
+      // 升级商品的币种不能确定收货国家,单独读取目标会员的国家。
+      const no = this.requestNo
+      const response = await fetchFullInfo({ userName }).catch(() => null)
+      if (this.isCurrent(no)) this.upgradeCountryId = response?.data?.countryId || ''
+    },
     memberSearch(value) {
       if (this.memberKey && value !== this.memberKey && !this.busy) this.resetMember()
     },

+ 1 - 1
src/ui-refactor/views/signup/SignupPage.vue

@@ -45,7 +45,7 @@
             @quantity="changeProductQuantity"
             @details="handleProduct"
           />
-          <delivery-notice v-if="countryName === 'Nigeria' && form.way !== 'pickup'" />
+          <delivery-notice v-if="form.countryId" :country-id="form.countryId" />
         </ui-section-card>
       </welcome-pack-fields>
       <payment-methods