From a4bc2284900265c364a4b8d6b63c57738409da8a Mon Sep 17 00:00:00 2001 From: beyond <931414026@qq.com> Date: Thu, 23 May 2019 10:14:48 +0800 Subject: [PATCH] sss --- src/views/SaleOrder/AddSaleOrder.vue | 125 +++++- src/views/SaleOrder/components/MyDialog.vue | 82 +++- .../SaleOrder/components/MyOpportunity.vue | 418 ++++++++++++++++++ 3 files changed, 599 insertions(+), 26 deletions(-) create mode 100644 src/views/SaleOrder/components/MyOpportunity.vue diff --git a/src/views/SaleOrder/AddSaleOrder.vue b/src/views/SaleOrder/AddSaleOrder.vue index 767f5a95..64ef7dad 100644 --- a/src/views/SaleOrder/AddSaleOrder.vue +++ b/src/views/SaleOrder/AddSaleOrder.vue @@ -9,12 +9,12 @@ - + - + @@ -22,12 +22,13 @@ - + + - + @@ -35,19 +36,19 @@ - + - + - + - + @@ -72,28 +73,28 @@ :picker-options="pickerOptions1" type="date" value-format="yyyy-MM-dd" - style="margin-left: 18px"/> + style="margin-left: 18px;width: 200px"/> - + - + - + - + @@ -101,7 +102,7 @@ - + @@ -109,7 +110,7 @@ - + @@ -117,17 +118,17 @@ - + - + - +

订单明细

- 添加商品 + 添加商品 删除
@@ -331,7 +332,7 @@ - + @@ -344,7 +345,7 @@ - + @@ -370,13 +371,14 @@ import MyEmp from './components/MyEmp' import MyDelivery from '../DailyAdjust/components/MyDelivery' import MyDetail from './components/MyDetail' import MyApply from './components/MyApply' +import MyOpportunity from './components/MyOpportunity' import MySupplier from '../Product/components/MySupplier' import MyRequire from './components/MyRequire' import MyCustomer from './components/MyCustomer' import MyAgent from './components/MyAgent' export default { name: 'AddSaleOrder', - components: { MyAgent, MyCustomer, MyRequire, MySupplier, MyApply, MyDetail, MyDelivery, MyEmp }, + components: { MyAgent, MyCustomer, MyRequire, MySupplier, MyApply, MyDetail, MyDelivery, MyEmp, MyOpportunity }, data() { const validatePass = (rule, value, callback) => { console.log(this.supplierId) @@ -386,6 +388,13 @@ export default { callback() } } + const validatePass2 = (rule, value, callback) => { + if (this.customerId === undefined || this.customerId === null || this.customerId === '') { + callback(new Error('请选择客户')) + } else { + callback() + } + } return { pickerOptions1: { disabledDate: (time) => { @@ -418,10 +427,16 @@ export default { agentcontrol: false, // 选择的数据 choosedata: [], + // 控制销售机会 + opportunitycontrol: false, + // 控制添加商品按钮是否可以点击 + Isproduct: true, // 销售人员回显 salePersonId: '', // 控制销售人员 stockControl: false, + // 控制源单编码是否可以选择 + IsNumber: true, // 开票类别数据 invoiceTypes: [], // 开票类别获取参数 @@ -440,6 +455,8 @@ export default { }, // 控制商品列表窗口 control: false, + // 控制添加商品按钮 + addpro: true, // 销售订单信息数据 personalForm: { createPersonId: this.$store.getters.userId, @@ -452,10 +469,14 @@ export default { sendType: '2', currency: '1', transDate: null, - sourceType: '1' + sourceType: '1', + otherMoney: '0.00' }, // 销售订单规则数据 personalrules: { + customerId: [ + { required: true, validator: validatePass2, trigger: 'change' } + ], customerType: [ { required: true, message: '请选择客户类别', trigger: 'change' } ], @@ -483,6 +504,63 @@ export default { this.getdatatime() }, methods: { + // 从销售机会过来的源单数据 + opportunityDetail(val) { + console.log(val) + const nowlistdata = this.$refs.editable.getRecords() + for (let i = 0; i < val.length; i++) { + for (let j = 0; j < nowlistdata.length; j++) { + if (val[i].sourceNumber === nowlistdata[j].sourceNumber) { + // this.$notify.error({ + // title: '错误', + // message: '物品已添加', + // offset: 100 + // }) + return false + } + } + this.$refs.editable.insert(val[i]) + } + }, + opportunity(val) { + console.log(val) + if (val.customerType !== null && val.customerType !== undefined && val.customerType !== '') { + this.personalForm.customerType = String(val.customerType) + } + // this.personalForm.customerId = val.customerId + // this.customerId = val.customerName + // this.personalForm.customerPhone = val.customerPhone + this.personalForm.sourceNumber = val.opportunityNumber + this.personalForm.salePersonId = val.handlePersonId + this.salePersonId = val.handlePersonName + this.personalForm.handleRepositoryId = val.handleRepositoryId + this.handleRepositoryId = val.handleRepositoryName + }, + openoppo() { + if (this.personalForm.sourceType === '2') { + this.opportunitycontrol = true + } + }, + // 控制源单类型 + chooseSource(val) { + if (val === '2') { + this.Isproduct = true + this.IsNumber = false + this.$refs.editable.clear() + } else if (val === '1') { + this.Isproduct = false + this.IsNumber = true + this.$refs.editable.clear() + } + }, + // 无来源添加商品 + chooseType() { + this.control = true + }, + // 从源单中添加商品 + handleAddSouce() { + this.arrivalcontrol = true + }, getdatatime() { // 默认显示今天 this.personalForm.transDate = new Date() }, @@ -514,6 +592,7 @@ export default { sums[6] = '' sums[8] = '' sums[9] = '' + sums[23] = '' this.heji1 = sums[10] this.heji2 = sums[18] this.heji3 = sums[15] diff --git a/src/views/SaleOrder/components/MyDialog.vue b/src/views/SaleOrder/components/MyDialog.vue index b1531baf..485fe4d1 100644 --- a/src/views/SaleOrder/components/MyDialog.vue +++ b/src/views/SaleOrder/components/MyDialog.vue @@ -11,6 +11,20 @@ + + + + + + + + + + + + + + @@ -129,7 +143,7 @@

订单明细

- 添加商品 + 添加商品 删除
@@ -355,8 +369,9 @@ import MySupplier from '../../Product/components/MySupplier' import MyRequire from './MyRequire' import MyCustomer from './MyCustomer' import MyAgent from './MyAgent' +import MyOpportunity from './MyOpportunity' export default { - components: { MyAgent, MyCustomer, MyRequire, MySupplier, MyApply, MyDetail, MyDelivery, MyEmp }, + components: { MyAgent, MyCustomer, MyRequire, MySupplier, MyApply, MyDetail, MyDelivery, MyEmp, MyOpportunity }, props: { editcontrol: { type: Boolean, @@ -393,6 +408,8 @@ export default { heji7: '', heji8: '', heji9: '', + // 控制添加商品按钮是否可以点击 + Isproduct: true, // 回显客户 customerId: '', // 控制客户 @@ -412,12 +429,16 @@ export default { }, // 结算方式数据 colseTypes: [], + // 控制源单编码是否可以选择 + IsNumber: true, // 结算方式获取参数 colseTypeparms: { type: 3, pagenum: 1, pagesize: 99999 }, + // 控制销售机会 + opportunitycontrol: false, // 控制商品列表窗口 control: false, // 销售订单规则数据 @@ -455,15 +476,70 @@ export default { this.personalForm = this.editdata this.planPersonId = this.personalForm.planPersonName this.stockPersonId = this.personalForm.stockPersonName + this.salePersonId = this.personalForm.salePersonName + this.customerId = this.personalForm.customerName this.list2 = this.personalForm.saleOrderDetailVos this.list3 = this.personalForm.saleOrderCostDetails - this.chooseType() + this.chooseSource(this.personalForm.sourceType) } }, created() { this.getTypes() }, methods: { + // 从销售机会过来的源单数据 + opportunityDetail(val) { + console.log(val) + const nowlistdata = this.$refs.editable.getRecords() + for (let i = 0; i < val.length; i++) { + for (let j = 0; j < nowlistdata.length; j++) { + if (val[i].sourceNumber === nowlistdata[j].sourceNumber) { + // this.$notify.error({ + // title: '错误', + // message: '物品已添加', + // offset: 100 + // }) + return false + } + } + this.$refs.editable.insert(val[i]) + } + }, + opportunity(val) { + console.log(val) + if (val.customerType !== null && val.customerType !== undefined && val.customerType !== '') { + this.personalForm.customerType = String(val.customerType) + } + // this.personalForm.customerId = val.customerId + // this.customerId = val.customerName + // this.personalForm.customerPhone = val.customerPhone + this.personalForm.sourceNumber = val.opportunityNumber + this.personalForm.salePersonId = val.handlePersonId + this.salePersonId = val.handlePersonName + this.personalForm.handleRepositoryId = val.handleRepositoryId + this.handleRepositoryId = val.handleRepositoryName + }, + openoppo() { + if (this.personalForm.sourceType === '2') { + this.opportunitycontrol = true + } + }, + // 控制源单类型 + chooseSource(val) { + if (val === '2') { + this.Isproduct = true + this.IsNumber = false + this.$refs.editable.clear() + } else if (val === '1') { + this.Isproduct = false + this.IsNumber = true + this.$refs.editable.clear() + } + }, + // 从源单中添加商品 + handleAddSouce() { + this.arrivalcontrol = true + }, // 总计 getSummaries(param) { const { columns, data } = param diff --git a/src/views/SaleOrder/components/MyOpportunity.vue b/src/views/SaleOrder/components/MyOpportunity.vue new file mode 100644 index 00000000..ccf6884d --- /dev/null +++ b/src/views/SaleOrder/components/MyOpportunity.vue @@ -0,0 +1,418 @@ + + + + +