1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 12:01:57 +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/>. along with this program. If not, see <https:www.gnu.org/licenses/>.
--> -->
<template> <template>
<div> <el-form-item>
<el-form-item> <template slot="label">
<template slot="label"> {{ $t('form.pos.order.BusinessPartnerCreate.businessPartner') }}
{{ $t('form.pos.order.BusinessPartnerCreate.businessPartner') }} <el-popover
<el-popover v-model="showCreate"
v-model="showCreate" placement="right"
placement="right" width="400"
width="400" trigger="click"
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"
> >
<template <business-partner-create
slot="prefix" :parent-metadata="parentMetadata"
:show-field="showCreate"
/>
<el-button
slot="reference"
type="text"
:disabled="isDisabled"
@click="popoverOpen"
> >
<i <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"> <template slot-scope="props">
<div class="header"> <div class="header">
<b>{{ props.item.name }} </b> <b>{{ props.item.name }} </b>
</div> </div>
<span class="info"> <span class="info">
{{ props.item.value }} {{ props.item.value }}
</span> </span>
</template> </template>
</el-autocomplete> </el-autocomplete>
</el-form-item> </el-form-item>
</div>
</template> </template>
<script> <script>
@ -169,11 +165,15 @@ export default {
}, },
displayedValue: { displayedValue: {
get() { get() {
return this.$store.getters.getValueOfField({ const busineesPartner = this.$store.getters.posAttributes.currentPointOfSales.currentOrder.businessPartner.name
containerUuid: this.parentMetadata.containerUuid, if (this.isEmptyValue(busineesPartner)) {
// DisplayColumn_'ColumnName' return this.$store.getters.getValueOfField({
columnName: 'DisplayColumn_C_BPartner_ID' // this.parentMetadata.displayColumnName containerUuid: this.parentMetadata.containerUuid,
}) // DisplayColumn_'ColumnName'
columnName: 'DisplayColumn_C_BPartner_ID' // this.parentMetadata.displayColumnName
})
}
return busineesPartner
}, },
set(value) { set(value) {
this.$store.commit('updateValueOfField', { this.$store.commit('updateValueOfField', {

View File

@ -475,7 +475,7 @@ export default {
requestCreateOrder({ requestCreateOrder({
posUuid, posUuid,
customerUuid: this.currentOrder.businessPartner.uuid, customerUuid: this.currentOrder.businessPartner.uuid,
salesRepresentativeUuid: this.currentPointOfSales.salesRepresentative.uuid salesRepresentativeUuid: this.currentOrder.salesRepresentative.uuid
}) })
.then(order => { .then(order => {
this.$store.dispatch('currentOrder', 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-form label-position="top" label-width="10px" @submit.native.prevent="notSubmitForm">
<el-row :gutter="24" style="display: flex;"> <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 <template
v-for="(field) in fieldsList" v-for="(field) in fieldsList"
> >
@ -39,7 +39,7 @@
/> />
</template> </template>
</el-col> </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 <business-partner
:parent-metadata="{ :parent-metadata="{
name: panelMetadata.name, name: panelMetadata.name,
@ -50,20 +50,26 @@
:is-disabled="isDisabled" :is-disabled="isDisabled"
/> />
</el-col> </el-col>
<el-col :span="2" :style="isShowedPOSKeyLayout ? 'margin-top: 3.4%;padding: 0px;' : 'padding: 0px;margin-top: 2.4%;'"> <el-col :span="isEmptyValue(currentOrder) ? 1 : 4" :style="isShowedPOSKeyLayout ? 'padding: 0px;' : 'padding: 0px;margin-top: 2.9%;'">
<el-tag <el-form-item>
v-if="!isEmptyValue(currentOrder.documentStatus.value)" <el-row :gutter="24">
:type="tagStatus(currentOrder.documentStatus.value)" <el-col :span="10" style="padding-left: 0px; padding-right: 0px;">
> <el-tag
<span v-if="!isEmptyValue(currentOrder.documentStatus.value)"> v-if="!isEmptyValue(currentOrder.documentStatus.value)"
{{ currentOrder.documentStatus.name }} :type="tagStatus(currentOrder.documentStatus.value)"
</span> >
</el-tag> <span v-if="!isEmptyValue(currentOrder.documentStatus.value)">
</el-col> {{ currentOrder.documentStatus.name }}
<el-col :span="2" :style="isShowedPOSKeyLayout ? 'margin-top: 3.4%;' : 'padding: 0px;margin-top: 2.4%;'"> </span>
<el-button type="primary" plain :disabled="isEmptyValue(this.$route.query.action)" @click="newOrder"> </el-tag>
{{ $t('form.pos.optionsPoinSales.salesOrder.newOrder') }} </el-col>
</el-button> <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-col>
</el-row> </el-row>
</el-form> </el-form>

View File

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

View File

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