|
|
@@ -1,13 +1,403 @@
|
|
|
+<!-- @desc:销售订单新建 @auth:付斌 @time:2024/02/20 15:15 -->
|
|
|
<template>
|
|
|
|
|
|
+ <div class="main-div" style="position: relative;">
|
|
|
+ <DkCollapse @on-change="changeCollapse" ref="collapse">
|
|
|
+ <DkPanel prop="essentialInformation">
|
|
|
+ <!-- 单据信息 -->
|
|
|
+ <DkForm slot="content" ref="formInline" v-model="formData" :labelMaxWords="6" style="width:100%">
|
|
|
+ <!--客户电话-->
|
|
|
+ <DkFormItem prop="cusPhone" :required="true">
|
|
|
+ <SelectMagnifier v-model="formData.cusPhone" ref="cusPhone" :telephone="true"
|
|
|
+ primary-key="objectId" :multiple="false"
|
|
|
+ :type="this.$config.MagnifierType.customer"
|
|
|
+ @on-input-blur="selectCustomer"
|
|
|
+ @ok="selectCustomer"/>
|
|
|
+ </DkFormItem>
|
|
|
+ <!--客户名称-->
|
|
|
+ <DkFormItem prop="cusName">
|
|
|
+ <InputPop ref="cusName" :disabled="true" v-model="formData.cusName"/>
|
|
|
+ </DkFormItem>
|
|
|
+ <!--详细地址-->
|
|
|
+ <DkFormItem prop="addressFull">
|
|
|
+ <InputPop ref="addressFull" v-model="formData.addressFull" :disabled="true"/>
|
|
|
+ </DkFormItem>
|
|
|
+ <!--业务部门-->
|
|
|
+ <DkFormItem prop="orgId" :label="$t('orgId')">
|
|
|
+ <SelectMagnifier v-model="formData.orgId" :display-text="formData.orgName"
|
|
|
+ :type="this.$config.MagnifierType.org"
|
|
|
+ :initSearchFlag="true"
|
|
|
+ :multiple="false" :disabled="true"/>
|
|
|
+ </DkFormItem>
|
|
|
+ <!--业务员-->
|
|
|
+ <DkFormItem prop="staffId" :label="$t('staffId')">
|
|
|
+ <SelectMagnifier v-model="formData.staffId" :display-text="formData.staffName"
|
|
|
+ :type="this.$config.MagnifierType.staff"
|
|
|
+ :initSearchFlag="true"
|
|
|
+ :multiple="false" :disabled="true"/>
|
|
|
+ </DkFormItem>
|
|
|
+ <!--收款时间-->
|
|
|
+ <DkFormItem prop="accDate" :data-type="$config.dataType.date">
|
|
|
+ <DatePickerPop v-model="formData.accDate"
|
|
|
+ :short-cut-flag="true"/>
|
|
|
+ </DkFormItem>
|
|
|
+ <!--客户可用余额-->
|
|
|
+ <DkFormItem prop="receiptResidue">
|
|
|
+ <InputNumberPop ref="receiptResidue" v-model="formData.receiptResidue" :disabled="true"/>
|
|
|
+ </DkFormItem>
|
|
|
+ <!--合计收款金额-->
|
|
|
+ <DkFormItem prop="sumAmtRec">
|
|
|
+ <InputNumberPop ref="sumAmtRec" v-model="formData.sumAmtRec" :disabled="true"/>
|
|
|
+ </DkFormItem>
|
|
|
+ </DkForm>
|
|
|
+ </DkPanel>
|
|
|
+ <!--客户收款-->
|
|
|
+ <DkPanel prop="customerAccount">
|
|
|
+ <div id="search-cond-div-goods-info" ref="search-cond-div-goods-info" slot="content">
|
|
|
+ <EditTable v-if="showEditTable" ref="receiptTable" :data="formData.itemList" showFooter
|
|
|
+ major-field="receiptId"
|
|
|
+ :height="this.tableHeight/2"
|
|
|
+ :new-row-flag="true"
|
|
|
+ :columns="receiptColumns"
|
|
|
+ controlId="macId" @on-choose="getTotals" @changeValue="getTotals"/>
|
|
|
+ </div>
|
|
|
+ </DkPanel>
|
|
|
+
|
|
|
+ <BaseIndexButtonGroup ref="BaseIndexButtonGroup" id="BaseIndexButtonGroup">
|
|
|
+ <template #left>
|
|
|
+ <BaseIndexButton ref="chooseReceivableInvoice" name="chooseReceivableInvoice"
|
|
|
+ @click="chooseReceivableInvoice"></BaseIndexButton>
|
|
|
+ </template>
|
|
|
+ </BaseIndexButtonGroup>
|
|
|
+
|
|
|
+ <!--应收款单-->
|
|
|
+ <DkPanel prop="receivableInvoice">
|
|
|
+ <div id="search-cond-div-receivable-info" ref="search-cond-div-goods-info" slot="content">
|
|
|
+ <EditTable ref="receivableTable" :data="formData.receivableList" showFooter
|
|
|
+ major-field="receiptId"
|
|
|
+ :height="this.tableHeight/2"
|
|
|
+ :new-row-flag="true"
|
|
|
+ :columns="receivableColumns"
|
|
|
+ controlId="macId" @on-choose="getTotals" @changeValue="getTotals"/>
|
|
|
+ </div>
|
|
|
+ </DkPanel>
|
|
|
+ </DkCollapse>
|
|
|
+ <!-- 下部分按钮区域-->
|
|
|
+ <DkSaveButton ref="saveButton" :loading="loading" @save="save(true)" @close="close"/>
|
|
|
+
|
|
|
+ <!-- 应收款单 -->
|
|
|
+ <DkModal :loading="loading" v-model="receivableModal" ref="modal_receivable"
|
|
|
+ @modalOk="receivableOk" :title='this.$t("应收款单")' :height="900" :width="1200">
|
|
|
+ <BaseIndexButtonGroup ref="BaseIndexButtonGroup2" id="BaseIndexButtonGroup2">
|
|
|
+ <template #left>
|
|
|
+ <BaseIndexButton ref="search" name="search" @click="getReceivableInvoice"></BaseIndexButton>
|
|
|
+ <BaseIndexButton ref="clear" name="clear"></BaseIndexButton>
|
|
|
+ </template>
|
|
|
+ </BaseIndexButtonGroup>
|
|
|
+ <DkTable :id="'table-'+$options.name" ref="detail-select" :pageFlag="false"
|
|
|
+ :data="tableData_receivable" :height="this.tableHeight" primaryKey="item_id" name="table">
|
|
|
+ <DkTableColumn field="biznisNo"/>
|
|
|
+ <DkTableColumn field="accDate"/>
|
|
|
+ <DkTableColumn field="recStatus"/>
|
|
|
+ <DkTableColumn field="amtShould"/>
|
|
|
+ <DkTableColumn field="amtHandle"/>
|
|
|
+ <DkTableColumn field="amtWaive"/>
|
|
|
+ <DkTableColumn field="amtResidue"/>
|
|
|
+ </DkTable>
|
|
|
+ </DkModal>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import {formMixin} from '@/mixins/form'
|
|
|
+
|
|
|
export default {
|
|
|
- name: "form"
|
|
|
-}
|
|
|
-</script>
|
|
|
+ components: {},
|
|
|
+ mixins: [formMixin],
|
|
|
+ data() {
|
|
|
+ let self = this
|
|
|
+ return {
|
|
|
+ loading: false,
|
|
|
+ receivableModal: false,
|
|
|
+ tableData_receivable: null,
|
|
|
+ negativeFlag: false,
|
|
|
+ showEditTable: true,
|
|
|
+ //控制客户是否可以输入
|
|
|
+ readonlyFlag: true,
|
|
|
+ allCanNoEdit: false, //是否所有的都不允许编辑
|
|
|
+ // 画面表单数据
|
|
|
+ formData: {
|
|
|
+ accDate: new Date(),
|
|
|
+ rpType: null,
|
|
|
+ objectId: null,//客户Id
|
|
|
+ cusName: null,
|
|
|
+ cusPhone: null,
|
|
|
+ addressFull: null, // 详细地址
|
|
|
+ staffId: null,
|
|
|
+ staffName: null,
|
|
|
+ staffCode: null,
|
|
|
+ orgId: null,
|
|
|
+ orgName: null,
|
|
|
+ orgCode: null,
|
|
|
+ sumAmtRec: null,
|
|
|
+ receiptResidue: null,
|
|
|
+ makeStaff: self.$store.state.user.id,
|
|
|
+ cpId: self.$store.state.user.cpId,
|
|
|
+ itemList: [],
|
|
|
+ receivableList: [],
|
|
|
+ },
|
|
|
+ receiptColumns: [
|
|
|
+ {
|
|
|
+ field: 'macName',
|
|
|
+ controlId: 'macId',
|
|
|
+ type: 'tableSelect',
|
|
|
+ width: 200,
|
|
|
+ dataType: self.$config.tableSelectType.moneyAccount,
|
|
|
+ fieldUpdate: self.$updateColumns.receiptChooseMac,
|
|
|
+ searchDetailFlag: true
|
|
|
+ },
|
|
|
+ // //账户余额
|
|
|
+ // {
|
|
|
+ // field: 'balance',
|
|
|
+ // type: 'disabled',
|
|
|
+ // digits: 2,
|
|
|
+ // title: this.$t('accountBalance'),
|
|
|
+ // },
|
|
|
+ //收款金额
|
|
|
+ {
|
|
|
+ field: 'amtRec',
|
|
|
+ type: 'number',
|
|
|
+ digits: 2,
|
|
|
+ negative: () => self.negativeFlag,
|
|
|
+ sum: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'remarks', type: 'text', equal: true,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ receivableColumns: [
|
|
|
+ {field: 'biznisNo', type: 'disabled'},
|
|
|
+ {field: 'accDate', type: 'disabled'},
|
|
|
+ {field: 'recStatus', type: 'disabled'},
|
|
|
+ {field: 'amtShould', type: 'disabled'},
|
|
|
+ {field: 'amtHandle', type: 'disabled'},
|
|
|
+ {field: 'amtWaive', type: 'disabled'},
|
|
|
+ {field: 'amtResidue', type: 'disabled'},
|
|
|
+ ],
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ chooseReceivableInvoice() {
|
|
|
+ this.receivableModal = true
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 获取应收款单
|
|
|
+ * @author : 付斌
|
|
|
+ * @date : 2024-03-22 16:42
|
|
|
+ */
|
|
|
+ getReceivableInvoice() {
|
|
|
+ // 查询客户可用余额
|
|
|
+ let params = {
|
|
|
+ 'objectId': this.formData.objectId
|
|
|
+ }
|
|
|
+ this.excute(this.$service.accountService, this.$service.accountService.getReceivableAccountItem, params).then(res => {
|
|
|
+ if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
+ this.tableData_receivable = res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ receivableOk() {
|
|
|
+ let self = this;
|
|
|
+ let sensitiveList = self.sensitiveList
|
|
|
+ this.params = {
|
|
|
+ roleId: this.roleId
|
|
|
+ }
|
|
|
+ let roleSensitiveList = []
|
|
|
+ for (let it of sensitiveList) {
|
|
|
+ if (it.checked) {
|
|
|
+ let list = {
|
|
|
+ roleId: this.roleId,
|
|
|
+ senItemCode: it.itemCode,
|
|
|
+ flgShow: true,
|
|
|
+ }
|
|
|
+ roleSensitiveList.push(list)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.params.roleSensitiveList = roleSensitiveList;
|
|
|
+ return this.excute(this.$service.roleSensitiveService, this.$service.roleSensitiveService.updateBatch, this.params, true, 'save')
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 加载数据
|
|
|
+ * @author : 付斌
|
|
|
+ * @date : 2024-02-20 15:53
|
|
|
+ */
|
|
|
+ initData() {
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 获取客户资料并且监听每一次的客户修改
|
|
|
+ * @date : 2022/5/24 15:04
|
|
|
+ * @author : 付斌
|
|
|
+ */
|
|
|
+ selectCustomer(val) {
|
|
|
+ if (val && val.length > 0) {
|
|
|
+ this.formData.objectId = val[0].cusId
|
|
|
+ this.formData.cusPhone = val[0].cusPhone
|
|
|
+ this.formData.cusName = val[0].cusName
|
|
|
+ this.formData.orgId = val[0].orgId
|
|
|
+ this.formData.orgName = val[0].orgName
|
|
|
+ this.formData.staffId = val[0].staffId
|
|
|
+ this.formData.staffName = val[0].staffName
|
|
|
+ this.formData.addressFull = val[0].addressFull
|
|
|
|
|
|
-<style scoped>
|
|
|
+ // 查询客户可用余额
|
|
|
+ let params = {
|
|
|
+ 'objectId': this.formData.objectId
|
|
|
+ }
|
|
|
+ this.excute(this.$service.accountService, this.$service.accountService.selectByCond, params).then(res => {
|
|
|
+ if (res.code === this.$config.SUCCESS_CODE && res.data.list.length > 0) {
|
|
|
+ this.formData.receiptResidue = res.data.list[0].receiptResidue
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 计算合计
|
|
|
+ * @date : 2022/5/30 15:31
|
|
|
+ * @author : 付斌
|
|
|
+ */
|
|
|
+ getTotals(field, row, rowIndex) {
|
|
|
+ let table = this.$refs['receiptTable'].getTableDataFilter();
|
|
|
+ let sumAmtRec = 0; // 合计数量
|
|
|
+ if (table && table.length > 0) {
|
|
|
+ table.forEach(row => {
|
|
|
+ if (row["amtRec"]) {
|
|
|
+ sumAmtRec += parseFloat(row["amtRec"]);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.formData.sumAmtRec = sumAmtRec;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 通过id查询
|
|
|
+ * @author : 付斌
|
|
|
+ * @date : 2022/03/04 13:17
|
|
|
+ */
|
|
|
+ detail(id) {
|
|
|
+ return this.excuteNoParam(this.$service.cusReceiptService, this.$service.cusReceiptService.getRpForUpdate, [id]);
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 编辑页面赋值
|
|
|
+ * @author : 付斌
|
|
|
+ * @date : 2024-03-03 9:33
|
|
|
+ */
|
|
|
+ setValuesByEdit(data) {
|
|
|
+ if (data) {
|
|
|
+ this.formData = data["data"];
|
|
|
+ this.formData.itemList = data["dataItem"];
|
|
|
|
|
|
-</style>
|
|
|
+ // 如果是退款,editTable要输入负数
|
|
|
+ if (this.formData.rpType === this.$config.rpType.tuiShouKuan) {
|
|
|
+ this.showEditTable = false
|
|
|
+ this.negativeFlag = true;
|
|
|
+ setTimeout(() => {
|
|
|
+ this.showEditTable = true;
|
|
|
+ }, 50)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 校验数据
|
|
|
+ * @author : 付斌
|
|
|
+ * @date : 2024-03-11 14:37
|
|
|
+ */
|
|
|
+ validData() {
|
|
|
+ let itemTable = this.$refs['receiptTable'].getTableDataFilter();
|
|
|
+ if (!itemTable || itemTable.length == 0) {
|
|
|
+ this.$Message.warning(this.$t('W_012'))
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for (let it of itemTable) {
|
|
|
+ if (!it.amtRec || it.amtRec === '') {
|
|
|
+ this.$Message.warning(this.$t('W_042', {'param': '收款金额不能'}))
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 给参数赋值
|
|
|
+ * @author : 付斌
|
|
|
+ * @date : 2023/6/25 14:31
|
|
|
+ */
|
|
|
+ setParams(arg) {
|
|
|
+ if (this.type === this.$config.formMode.receipt) {
|
|
|
+ this.formData.rpType = this.$config.rpType.shouKuan
|
|
|
+ } else if (this.type === this.$config.formMode.refund) {
|
|
|
+ this.formData.rpType = this.$config.rpType.tuiShouKuan
|
|
|
+ }
|
|
|
+ this.formData.accDate = new Date(this.formData.accDate).toDateStr();
|
|
|
+ // 修改新增的表数据
|
|
|
+ let itemTable = this.$refs['receiptTable'].getTableDataFilter();
|
|
|
+ this.formData.itemList = itemTable
|
|
|
+ this.params = {...this.formData}
|
|
|
+ // itemTable.forEach((it, index) => {
|
|
|
+ // this.$set(it, 'residueAmt', it["amtRec"]);
|
|
|
+ // Object.assign(it, it, this.formData)
|
|
|
+ // });
|
|
|
+ // this.params = {"itemList": itemTable}
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 保存数据
|
|
|
+ * @author : 付斌
|
|
|
+ * @date : 2023/6/25 14:31
|
|
|
+ */
|
|
|
+ saveData() {
|
|
|
+ if (this.type === this.$config.formMode.receipt) {
|
|
|
+ return this.excute(this.$service.cusReceiptService, this.$service.cusReceiptService.insertReceipt, this.params);
|
|
|
+ } else if (this.type === this.$config.formMode.refund) {
|
|
|
+ return this.excute(this.$service.cusReceiptService, this.$service.cusReceiptService.insertRefund, this.params)
|
|
|
+ } else if (this.type === this.$config.formMode.edit) {
|
|
|
+ return this.excute(this.$service.cusReceiptService, this.$service.cusReceiptService.update, this.params)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc :新建完毕后清空窗体
|
|
|
+ * @author : 付斌
|
|
|
+ * @date : 2024-02-27 10:33
|
|
|
+ */
|
|
|
+ clear() {
|
|
|
+ let self = this
|
|
|
+ this.formData = {
|
|
|
+ accDate: new Date(),
|
|
|
+ rpType: null,
|
|
|
+ objectId: null,//客户Id
|
|
|
+ cusName: null,
|
|
|
+ cusPhone: null,
|
|
|
+ addressFull: null, // 详细地址
|
|
|
+ staffId: null,
|
|
|
+ staffName: null,
|
|
|
+ staffCode: null,
|
|
|
+ orgId: null,
|
|
|
+ orgName: null,
|
|
|
+ orgCode: null,
|
|
|
+ sumAmtRec: null,
|
|
|
+ receiptResidue: null,
|
|
|
+ makeStaff: self.$store.state.user.id,
|
|
|
+ cpId: self.$store.state.user.cpId,
|
|
|
+ itemList: [],
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
+ ,
|
|
|
+ /**
|
|
|
+ * @desc : 在实例创建完成后被立即同步调用
|
|
|
+ * @author : 付斌
|
|
|
+ * @date : 2022/3/3 10:32
|
|
|
+ */
|
|
|
+ created() {
|
|
|
+ this.focusItem = 'receiptId'; // 给第一个组件赋值,可以在混入中自动去聚焦
|
|
|
+ this.primaryKey = 'receiptId' // 设置主键Id
|
|
|
+ this.routeObjName = 'receipt' // 设置路由名称
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|