price query search (#565)
							parent
							
								
									986c206073
								
							
						
					
					
						commit
						4716f3d7f7
					
				| 
						 | 
				
			
			@ -171,7 +171,7 @@ export default {
 | 
			
		|||
    formatPrice,
 | 
			
		||||
    subscribeChanges() {
 | 
			
		||||
      return this.$store.subscribe((mutation, state) => {
 | 
			
		||||
        if ((mutation.type === 'updateValueOfField' || mutation.type === 'addActionKeyPerformed') && mutation.payload.columnName === 'ProductValue') {
 | 
			
		||||
        if ((mutation.type === 'addActionKeyPerformed') && mutation.payload.columnName === 'ProductValue') {
 | 
			
		||||
          // cleans all values except column name 'ProductValue'
 | 
			
		||||
          this.search = mutation.payload.value
 | 
			
		||||
          if (!this.isEmptyValue(this.search) && this.search.length >= 4) {
 | 
			
		||||
| 
						 | 
				
			
			@ -223,6 +223,57 @@ export default {
 | 
			
		|||
                }
 | 
			
		||||
              })
 | 
			
		||||
          }
 | 
			
		||||
        } else if ((mutation.type === 'updateValueOfField') && (mutation.payload.columnName === 'ProductValue') && !this.isEmptyValue(mutation.payload.value)) {
 | 
			
		||||
          clearTimeout(this.timeOut)
 | 
			
		||||
          this.timeOut = setTimeout(() => {
 | 
			
		||||
            requestGetProductPrice({
 | 
			
		||||
              searchValue: mutation.payload.value
 | 
			
		||||
            })
 | 
			
		||||
              .then(productPrice => {
 | 
			
		||||
                this.messageError = true
 | 
			
		||||
                const { product, taxRate, priceStandard: priceBase } = productPrice
 | 
			
		||||
                const { rate } = taxRate
 | 
			
		||||
                const { imageURL: image } = product
 | 
			
		||||
 | 
			
		||||
                this.productPrice = {
 | 
			
		||||
                  currency: productPrice.currency,
 | 
			
		||||
                  image,
 | 
			
		||||
                  grandTotal: this.getGrandTotal(priceBase, rate),
 | 
			
		||||
                  productName: product.name,
 | 
			
		||||
                  productDescription: product.description,
 | 
			
		||||
                  priceBase,
 | 
			
		||||
                  priceStandard: productPrice.priceStandard,
 | 
			
		||||
                  priceList: productPrice.priceList,
 | 
			
		||||
                  priceLimit: productPrice.priceLimit,
 | 
			
		||||
                  schemaCurrency: productPrice.schemaCurrency,
 | 
			
		||||
                  schemaGrandTotal: this.getGrandTotal(productPrice.schemaPriceStandard, rate),
 | 
			
		||||
                  schemaPriceStandard: productPrice.schemaPriceStandard,
 | 
			
		||||
                  schemaPriceList: productPrice.schemaPriceList,
 | 
			
		||||
                  schemaPriceLimit: productPrice.schemaPriceLimit,
 | 
			
		||||
                  taxRate: rate,
 | 
			
		||||
                  taxName: taxRate.name,
 | 
			
		||||
                  taxIndicator: taxRate.taxIndicator,
 | 
			
		||||
                  taxAmt: this.getTaxAmount(priceBase, rate)
 | 
			
		||||
                }
 | 
			
		||||
              })
 | 
			
		||||
              .catch(() => {
 | 
			
		||||
                this.messageError = false
 | 
			
		||||
                this.timeMessage()
 | 
			
		||||
                this.productPrice = {}
 | 
			
		||||
              })
 | 
			
		||||
              .finally(() => {
 | 
			
		||||
                this.$store.commit('updateValueOfField', {
 | 
			
		||||
                  containerUuid: this.containerUuid,
 | 
			
		||||
                  columnName: 'ProductValue',
 | 
			
		||||
                  value: ''
 | 
			
		||||
                })
 | 
			
		||||
                this.search = ''
 | 
			
		||||
                this.currentImageOfProduct = ''
 | 
			
		||||
                if (this.isEmptyValue(this.productPrice.image)) {
 | 
			
		||||
                  this.getImage(this.productPrice.image)
 | 
			
		||||
                }
 | 
			
		||||
              })
 | 
			
		||||
          }, 500)
 | 
			
		||||
        }
 | 
			
		||||
        if (mutation.type === 'changeFormAttribute') {
 | 
			
		||||
          this.focusProductValue()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -86,7 +86,7 @@
 | 
			
		|||
                        <el-popover
 | 
			
		||||
                          placement="right"
 | 
			
		||||
                          trigger="click"
 | 
			
		||||
                          :title="$t('form.pos.product.productInformation')"
 | 
			
		||||
                          :title="$t('form.productInfo.productInformation')"
 | 
			
		||||
                        >
 | 
			
		||||
                          <el-form
 | 
			
		||||
                            label-position="top"
 | 
			
		||||
| 
						 | 
				
			
			@ -106,26 +106,26 @@
 | 
			
		|||
                                </div>
 | 
			
		||||
                              </el-col>
 | 
			
		||||
                              <el-col :span="10">
 | 
			
		||||
                                {{ $t('form.pos.product.code') }}: <b>{{ currentOrderLine.product.value }}</b><br>
 | 
			
		||||
                                {{ $t('form.pos.product.name') }}: <b>{{ currentOrderLine.product.name }}</b><br>
 | 
			
		||||
                                {{ $t('form.pos.product.description') }}: <b>{{ currentOrderLine.product.description }}</b><br>
 | 
			
		||||
                                {{ $t('form.productInfo.code') }}: <b>{{ currentOrderLine.product.value }}</b><br>
 | 
			
		||||
                                {{ $t('form.productInfo.name') }}: <b>{{ currentOrderLine.product.name }}</b><br>
 | 
			
		||||
                                {{ $t('form.productInfo.description') }}: <b>{{ currentOrderLine.product.description }}</b><br>
 | 
			
		||||
                              </el-col>
 | 
			
		||||
                              <el-col :span="10">
 | 
			
		||||
                                <div style="float: right">
 | 
			
		||||
                                  {{ $t('form.pos.product.price') }}:
 | 
			
		||||
                                  {{ $t('form.productInfo.price') }}:
 | 
			
		||||
                                  <b>{{ formatPrice(currentOrderLine.product.priceStandard, currencyPoint.iSOCode) }}</b>
 | 
			
		||||
                                  <br>
 | 
			
		||||
                                  {{ $t('form.pos.product.taxRate') }}:
 | 
			
		||||
                                  {{ $t('form.productInfo.taxAmount') }}:
 | 
			
		||||
                                  <b>{{ currentOrderLine.taxIndicator }}</b>
 | 
			
		||||
                                  <br>
 | 
			
		||||
                                  {{ $t('form.pos.product.quantityAvailable') }}:
 | 
			
		||||
                                  {{ $t('form.productInfo.quantityAvailable') }}:
 | 
			
		||||
                                  <b>{{ formatQuantity(currentOrderLine.quantityOrdered) }}</b>
 | 
			
		||||
                                </div>
 | 
			
		||||
                              </el-col>
 | 
			
		||||
                            </el-row>
 | 
			
		||||
                          </el-form>
 | 
			
		||||
                          <el-button slot="reference" type="text">
 | 
			
		||||
                            {{ $t('form.pos.product.productInformation') }}
 | 
			
		||||
                            {{ $t('form.productInfo.productInformation') }}
 | 
			
		||||
                          </el-button>
 | 
			
		||||
                        </el-popover>
 | 
			
		||||
                      </el-dropdown-item>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,7 @@ export default {
 | 
			
		|||
        },
 | 
			
		||||
        currentPrice: {
 | 
			
		||||
          columnName: 'CurrentPrice',
 | 
			
		||||
          label: this.$t('form.pos.product.price'),
 | 
			
		||||
          label: this.$t('form.productInfo.price'),
 | 
			
		||||
          isNumeric: true
 | 
			
		||||
        },
 | 
			
		||||
        quantityOrdered: {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue