1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-07 18:25:45 +08:00

Fix Customer the Point of Sales (#870)

Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
Elsio Sanchez 2021-05-25 16:26:38 -04:00 committed by GitHub
parent 70022f0f61
commit 6b927bd88f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 113 additions and 104 deletions

View File

@ -16,90 +16,86 @@
along with this program. If not, see <https:www.gnu.org/licenses/>.
-->
<template>
<div>
<el-form-item>
<template slot="label">
{{ $t('form.pos.order.BusinessPartnerCreate.businessPartner') }}
<el-popover
v-model="showCreate"
placement="right"
width="400"
trigger="click"
>
<business-partner-create
:parent-metadata="parentMetadata"
:show-field="showCreate"
/>
<el-button
slot="reference"
type="text"
:disabled="isDisabled"
@click="popoverOpen"
>
<i
class="el-icon-circle-plus"
/>
</el-button>
</el-popover>
<el-popover
placement="right"
width="800"
trigger="click"
:disabled="isDisabled"
@hide="showFieldList = !showFieldList"
>
<business-partners-list
:parent-metadata="parentMetadata"
:shows-popovers="showsPopovers"
:show-field="showFieldList"
/>
<el-button
slot="reference"
type="text"
@click="showFieldList = !showFieldList"
>
<i
class="el-icon-search"
/>
</el-button>
</el-popover>
</template>
<el-autocomplete
v-model="displayedValue"
:placeholder="$t('quickAccess.searchWithEnter')"
:fetch-suggestions="localSearch"
clearable
value-key="name"
style="width: 100%;"
popper-class="custom-field-bpartner-info"
:disabled="isDisabled"
@clear="setBusinessPartner(blankBPartner, false)"
@keyup.enter.native="getBPartnerWithEnter"
@select="handleSelect"
@focus="setNewDisplayedValue"
@blur="setOldDisplayedValue"
<el-form-item>
<template slot="label">
{{ $t('form.pos.order.BusinessPartnerCreate.businessPartner') }}
<el-popover
v-model="showCreate"
placement="right"
width="400"
trigger="click"
>
<template
slot="prefix"
<business-partner-create
:parent-metadata="parentMetadata"
:show-field="showCreate"
/>
<el-button
slot="reference"
type="text"
:disabled="isDisabled"
@click="popoverOpen"
>
<i
class="el-icon-user-solid el-input__icon"
class="el-icon-circle-plus"
/>
</template>
</el-button>
</el-popover>
<el-popover
placement="right"
width="800"
trigger="click"
:disabled="isDisabled"
@hide="showFieldList = !showFieldList"
>
<business-partners-list
:parent-metadata="parentMetadata"
:shows-popovers="showsPopovers"
:show-field="showFieldList"
/>
<el-button
slot="reference"
type="text"
@click="showFieldList = !showFieldList"
>
<i
class="el-icon-search"
/>
</el-button>
</el-popover>
</template>
<el-autocomplete
v-model="displayedValue"
:placeholder="$t('quickAccess.searchWithEnter')"
:fetch-suggestions="localSearch"
clearable
value-key="name"
style="width: 100%;"
popper-class="custom-field-bpartner-info"
:disabled="isDisabled"
@clear="setBusinessPartner(blankBPartner, false)"
@keyup.enter.native="getBPartnerWithEnter"
@select="handleSelect"
@focus="setNewDisplayedValue"
@blur="setOldDisplayedValue"
>
<template
slot="prefix"
>
<i
class="el-icon-user-solid el-input__icon"
/>
</template>
<template slot-scope="props">
<div class="header">
<b>{{ props.item.name }} </b>
</div>
<span class="info">
{{ props.item.value }}
</span>
</template>
</el-autocomplete>
</el-form-item>
</div>
<template slot-scope="props">
<div class="header">
<b>{{ props.item.name }} </b>
</div>
<span class="info">
{{ props.item.value }}
</span>
</template>
</el-autocomplete>
</el-form-item>
</template>
<script>
@ -169,11 +165,15 @@ export default {
},
displayedValue: {
get() {
return this.$store.getters.getValueOfField({
containerUuid: this.parentMetadata.containerUuid,
// DisplayColumn_'ColumnName'
columnName: 'DisplayColumn_C_BPartner_ID' // this.parentMetadata.displayColumnName
})
const busineesPartner = this.$store.getters.posAttributes.currentPointOfSales.currentOrder.businessPartner.name
if (this.isEmptyValue(busineesPartner)) {
return this.$store.getters.getValueOfField({
containerUuid: this.parentMetadata.containerUuid,
// DisplayColumn_'ColumnName'
columnName: 'DisplayColumn_C_BPartner_ID' // this.parentMetadata.displayColumnName
})
}
return busineesPartner
},
set(value) {
this.$store.commit('updateValueOfField', {

View File

@ -475,7 +475,7 @@ export default {
requestCreateOrder({
posUuid,
customerUuid: this.currentOrder.businessPartner.uuid,
salesRepresentativeUuid: this.currentPointOfSales.salesRepresentative.uuid
salesRepresentativeUuid: this.currentOrder.salesRepresentative.uuid
})
.then(order => {
this.$store.dispatch('currentOrder', order)

View File

@ -28,7 +28,7 @@
>
<el-form label-position="top" label-width="10px" @submit.native.prevent="notSubmitForm">
<el-row :gutter="24" style="display: flex;">
<el-col :span="14" style="padding-left: 0px; padding-right: 0px;">
<el-col :span="isEmptyValue(currentOrder) ? 14 : 11 " style="padding-left: 0px; padding-right: 0px;">
<template
v-for="(field) in fieldsList"
>
@ -39,7 +39,7 @@
/>
</template>
</el-col>
<el-col :span="6" style="padding-left: 0px; padding-right: 0px;">
<el-col :span="isEmptyValue(currentOrder) ? 9 : 7" style="padding-left: 0px; padding-right: 0px;">
<business-partner
:parent-metadata="{
name: panelMetadata.name,
@ -50,20 +50,26 @@
:is-disabled="isDisabled"
/>
</el-col>
<el-col :span="2" :style="isShowedPOSKeyLayout ? 'margin-top: 3.4%;padding: 0px;' : 'padding: 0px;margin-top: 2.4%;'">
<el-tag
v-if="!isEmptyValue(currentOrder.documentStatus.value)"
:type="tagStatus(currentOrder.documentStatus.value)"
>
<span v-if="!isEmptyValue(currentOrder.documentStatus.value)">
{{ currentOrder.documentStatus.name }}
</span>
</el-tag>
</el-col>
<el-col :span="2" :style="isShowedPOSKeyLayout ? 'margin-top: 3.4%;' : 'padding: 0px;margin-top: 2.4%;'">
<el-button type="primary" plain :disabled="isEmptyValue(this.$route.query.action)" @click="newOrder">
{{ $t('form.pos.optionsPoinSales.salesOrder.newOrder') }}
</el-button>
<el-col :span="isEmptyValue(currentOrder) ? 1 : 4" :style="isShowedPOSKeyLayout ? 'padding: 0px;' : 'padding: 0px;margin-top: 2.9%;'">
<el-form-item>
<el-row :gutter="24">
<el-col :span="10" style="padding-left: 0px; padding-right: 0px;">
<el-tag
v-if="!isEmptyValue(currentOrder.documentStatus.value)"
:type="tagStatus(currentOrder.documentStatus.value)"
>
<span v-if="!isEmptyValue(currentOrder.documentStatus.value)">
{{ currentOrder.documentStatus.name }}
</span>
</el-tag>
</el-col>
<el-col :span="14" style="padding-left: 0px; padding-right: 0px;">
<el-button type="primary" plain :disabled="isEmptyValue(this.$route.query.action)" @click="newOrder">
{{ $t('form.pos.optionsPoinSales.salesOrder.newOrder') }}
</el-button>
</el-col>
</el-row>
</el-form-item>
</el-col>
</el-row>
</el-form>

View File

@ -269,18 +269,17 @@ export default {
if (this.isEmptyValue(orderUuid)) {
const posUuid = this.currentPointOfSales.uuid
let customerUuid = this.$store.getters.getValueOfField({
containerUuid: this.containerUuid,
containerUuid: this.metadata.containerUuid,
columnName: 'C_BPartner_ID_UUID'
})
const id = this.$store.getters.getValueOfField({
containerUuid: this.containerUuid,
containerUuid: this.metadata.containerUuid,
columnName: 'C_BPartner_ID'
})
if (this.isEmptyValue(customerUuid) || id === 1000006) {
customerUuid = this.currentPointOfSales.templateBusinessPartner.uuid
}
// user session
// alert(name)
this.$store.dispatch('createOrder', {
posUuid,
customerUuid,

View File

@ -17,6 +17,7 @@
import {
requestListOrderLines
} from '@/api/ADempiere/form/point-of-sales.js'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js'
import { showMessage } from '@/utils/ADempiere/notification.js'
/**
* Order Line Actions
@ -26,6 +27,9 @@ export default {
commit('setListOrderLine', params)
},
listOrderLinesFromServer({ commit }, orderUuid) {
if (isEmptyValue(orderUuid)) {
return
}
requestListOrderLines({
orderUuid
})