mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 12:01:57 +08:00
support price checking (#930)
* support price checking * correcting comments Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
parent
9b64e66722
commit
587e8cb9c1
@ -73,7 +73,7 @@
|
|||||||
|
|
||||||
<div class="product-price amount">
|
<div class="product-price amount">
|
||||||
<span style="float: right;"> {{ formatPrice(productPrice.grandTotal, productPrice.currency.iSOCode) }} </span> <br>
|
<span style="float: right;"> {{ formatPrice(productPrice.grandTotal, productPrice.currency.iSOCode) }} </span> <br>
|
||||||
{{ formatPrice(productPrice.schemaGrandTotal, productPrice.schemaCurrency.iSOCode) }}
|
<span v-if="!isEmptyValue(currentPointOfSales.displayCurrency)"> {{ formatPrice(productPrice.grandTotalConverted, currentPointOfSales.displayCurrency.iSOCode) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -133,8 +133,17 @@ export default {
|
|||||||
defaultImage() {
|
defaultImage() {
|
||||||
return require('@/image/ADempiere/priceChecking/no-image.jpg')
|
return require('@/image/ADempiere/priceChecking/no-image.jpg')
|
||||||
},
|
},
|
||||||
currentPoint() {
|
currentPointOfSales() {
|
||||||
return this.$store.getters.posAttributes.currentPointOfSales
|
return this.$store.getters.posAttributes.currentPointOfSales
|
||||||
|
},
|
||||||
|
pointOfSalesList() {
|
||||||
|
return this.$store.getters.posAttributes.pointOfSalesList
|
||||||
|
},
|
||||||
|
convertionsList() {
|
||||||
|
return this.$store.state['pointOfSales/point/index'].conversionsList
|
||||||
|
},
|
||||||
|
currentConvertion() {
|
||||||
|
return this.convertionsList.find(convert => convert.currencyTo.id === this.currentPointOfSales.displayCurrency.id)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -143,12 +152,23 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
this.backgroundForm = this.defaultImage
|
this.backgroundForm = this.defaultImage
|
||||||
this.getImageFromSource(this.organizationImagePath)
|
this.getImageFromSource(this.organizationImagePath)
|
||||||
this.$store.dispatch('listPointOfSalesFromServer')
|
if (this.isEmptyValue(this.pointOfSalesList)) {
|
||||||
|
this.$store.dispatch('listPointOfSalesFromServer')
|
||||||
|
}
|
||||||
|
if (!this.isEmptyValue(this.pointOfSalesList) && this.isEmptyValue(this.currentConvertion)) {
|
||||||
|
this.$store.dispatch('searchConversion', {
|
||||||
|
conversionTypeUuid: this.currentPointOfSales.conversionTypeUuid,
|
||||||
|
currencyFromUuid: this.currentPointOfSales.priceList.currency.uuid,
|
||||||
|
currencyToUuid: this.currentPointOfSales.displayCurrency.uuid
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
this.unsubscribe()
|
this.unsubscribe()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
formatPercent,
|
||||||
|
formatPrice,
|
||||||
focusProductValue() {
|
focusProductValue() {
|
||||||
if (!this.isEmptyValue(this.$refs.ProductValue[0])) {
|
if (!this.isEmptyValue(this.$refs.ProductValue[0])) {
|
||||||
this.$refs.ProductValue[0].$children[0].$children[0].$children[1].$children[0].focus()
|
this.$refs.ProductValue[0].$children[0].$children[0].$children[1].$children[0].focus()
|
||||||
@ -165,8 +185,10 @@ export default {
|
|||||||
})
|
})
|
||||||
this.backgroundForm = image.uri
|
this.backgroundForm = image.uri
|
||||||
},
|
},
|
||||||
formatPercent,
|
amountConvert(price, currency) {
|
||||||
formatPrice,
|
const convertion = this.convertionsList.find(convert => convert.currencyTo.id === currency.id)
|
||||||
|
return price / convertion.divideRate
|
||||||
|
},
|
||||||
subscribeChanges() {
|
subscribeChanges() {
|
||||||
return this.$store.subscribe((mutation, state) => {
|
return this.$store.subscribe((mutation, state) => {
|
||||||
if ((mutation.type === 'currentPointOfSales') || (mutation.type === 'setListProductPrice') || (mutation.type === 'addFocusLost')) {
|
if ((mutation.type === 'currentPointOfSales') || (mutation.type === 'setListProductPrice') || (mutation.type === 'addFocusLost')) {
|
||||||
@ -178,7 +200,7 @@ export default {
|
|||||||
if (!this.isEmptyValue(this.search) && this.search.length >= 4) {
|
if (!this.isEmptyValue(this.search) && this.search.length >= 4) {
|
||||||
getProductPrice({
|
getProductPrice({
|
||||||
searchValue: mutation.payload.value,
|
searchValue: mutation.payload.value,
|
||||||
priceListUuid: this.currentPoint.priceList.uuid
|
posUuid: this.currentPointOfSales.uuid
|
||||||
})
|
})
|
||||||
.then(productPrice => {
|
.then(productPrice => {
|
||||||
this.messageError = true
|
this.messageError = true
|
||||||
@ -191,16 +213,12 @@ export default {
|
|||||||
image,
|
image,
|
||||||
grandTotal: this.getGrandTotal(priceBase, rate),
|
grandTotal: this.getGrandTotal(priceBase, rate),
|
||||||
productName: product.name,
|
productName: product.name,
|
||||||
productDescription: product.description,
|
productDescription: product.help,
|
||||||
priceBase,
|
priceBase,
|
||||||
priceStandard: productPrice.priceStandard,
|
priceStandard: productPrice.priceStandard,
|
||||||
priceList: productPrice.priceList,
|
priceList: productPrice.priceList,
|
||||||
priceLimit: productPrice.priceLimit,
|
priceLimit: productPrice.priceLimit,
|
||||||
schemaCurrency: productPrice.schemaCurrency,
|
grandTotalConverted: this.amountConvert(productPrice.priceStandard, this.currentPointOfSales.displayCurrency),
|
||||||
schemaGrandTotal: this.getGrandTotal(productPrice.schemaPriceStandard, rate),
|
|
||||||
schemaPriceStandard: productPrice.schemaPriceStandard,
|
|
||||||
schemaPriceList: productPrice.schemaPriceList,
|
|
||||||
schemaPriceLimit: productPrice.schemaPriceLimit,
|
|
||||||
taxRate: rate,
|
taxRate: rate,
|
||||||
taxName: taxRate.name,
|
taxName: taxRate.name,
|
||||||
taxIndicator: taxRate.taxIndicator,
|
taxIndicator: taxRate.taxIndicator,
|
||||||
@ -235,7 +253,7 @@ export default {
|
|||||||
}
|
}
|
||||||
getProductPrice({
|
getProductPrice({
|
||||||
searchValue: mutation.payload.value,
|
searchValue: mutation.payload.value,
|
||||||
priceListUuid: this.currentPoint.priceList.uuid
|
posUuid: this.currentPointOfSales.uuid
|
||||||
})
|
})
|
||||||
.then(productPrice => {
|
.then(productPrice => {
|
||||||
this.messageError = true
|
this.messageError = true
|
||||||
@ -253,7 +271,7 @@ export default {
|
|||||||
priceList: productPrice.priceList,
|
priceList: productPrice.priceList,
|
||||||
priceLimit: productPrice.priceLimit,
|
priceLimit: productPrice.priceLimit,
|
||||||
schemaCurrency: productPrice.schemaCurrency,
|
schemaCurrency: productPrice.schemaCurrency,
|
||||||
schemaGrandTotal: this.getGrandTotal(productPrice.schemaPriceStandard, rate),
|
grandTotalConverted: this.amountConvert(productPrice.priceStandard, this.currentPointOfSales.displayCurrency),
|
||||||
schemaPriceStandard: productPrice.schemaPriceStandard,
|
schemaPriceStandard: productPrice.schemaPriceStandard,
|
||||||
schemaPriceList: productPrice.schemaPriceList,
|
schemaPriceList: productPrice.schemaPriceList,
|
||||||
schemaPriceLimit: productPrice.schemaPriceLimit,
|
schemaPriceLimit: productPrice.schemaPriceLimit,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user