From 0482a19422e484bd8ee7776b69d46baf876452a3 Mon Sep 17 00:00:00 2001 From: beyond <931414026@qq.com> Date: Sun, 2 Feb 2020 17:19:07 +0800 Subject: [PATCH] =?UTF-8?q?beyond=202.2=20=E4=BC=98=E6=83=A0=E5=88=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/Coupon.js | 125 +++--- src/lang/zh.js | 11 +- src/router/index.js | 2 +- src/views/Coupon/AddCoupon.vue | 344 ++++++--------- src/views/Coupon/CouponList.vue | 60 +-- src/views/Coupon/components/DetailList.vue | 81 ++-- src/views/Coupon/components/MyDialog.vue | 422 ++++++------------- src/views/Coupon/components/MyRepository.vue | 43 +- 8 files changed, 453 insertions(+), 635 deletions(-) diff --git a/src/api/Coupon.js b/src/api/Coupon.js index 34e27e7e..1c50d139 100644 --- a/src/api/Coupon.js +++ b/src/api/Coupon.js @@ -1,61 +1,64 @@ -import request from '@/utils/request' - -// 添加领料单 -export function createCoupon(query, query2, query3) { - var params = new URLSearchParams() - if (query !== '' && query !== null && query !== undefined) { - params.append('Json', query) // 你要传给后台的参数值 key/value - } - return request({ - url: '/coupon/create', - method: 'post', - data: params - }) -} - -// 领料单列表 -export function couponlist(query) { - var params = new URLSearchParams() - if (query.name !== '' && query.name !== null && query.name !== undefined) { - params.append('name', query.name) // 你要传给后台的参数值 key/value - } - if (query.stat !== '' && query.stat !== null && query.stat !== undefined) { - params.append('stat', query.stat) // 你要传给后台的参数值 key/value - } - params.append('pageNum', query.pageNum) // 你要传给后台的参数值 key/value - params.append('pageSize', query.pageSize) // 你要传给后台的参数值 key/value - return request({ - url: '/coupon/search', - method: 'post', - data: params - }) -} - -// 删除领料单 -export function deletecoupon(query, query2) { - var params = new URLSearchParams() - if (query !== '' && query !== null && query !== undefined) { - params.append('modelids', query) // 你要传给后台的参数值 key/value - } - if (query2 !== '' && query2 !== null && query2 !== undefined) { - params.append('operatorId', query2) // 你要传给后台的参数值 key/value - } - return request({ - url: '/coupon/delete', - method: 'post', - data: params - }) -} - -// 修改领料单 -export function updatecoupon(query) { - var params = new URLSearchParams() - if (query !== '' && query !== null && query !== undefined) { - params.append('Json', query) // 你要传给后台的参数值 key/value - } - return request({ - url: '/coupon/update', - method: 'post', - data: params - }) -} +import request from '@/utils/request' + +// 添加领料单 +export function createCoupon(query) { + var params = new URLSearchParams() + if (query !== '' && query !== null && query !== undefined) { + params.append('Json', query) // 你要传给后台的参数值 key/value + } + return request({ + url: '/coupon/create', + method: 'post', + data: params + }) +} + +// 领料单列表 +export function couponlist(query) { + var params = new URLSearchParams() + if (query.name !== '' && query.name !== null && query.name !== undefined) { + params.append('name', query.name) // 你要传给后台的参数值 key/value + } + if (query.type !== '' && query.type !== null && query.type !== undefined) { + params.append('type', query.type) // 你要传给后台的参数值 key/value + } + if (query.money !== '' && query.money !== null && query.money !== undefined) { + params.append('money', query.money) // 你要传给后台的参数值 key/value + } + params.append('pageNum', query.pageNum) // 你要传给后台的参数值 key/value + params.append('pageSize', query.pageSize) // 你要传给后台的参数值 key/value + return request({ + url: '/coupon/search', + method: 'post', + data: params + }) +} + +// 删除领料单 +export function deletecoupon(query, query2) { + var params = new URLSearchParams() + if (query !== '' && query !== null && query !== undefined) { + params.append('modelids', query) // 你要传给后台的参数值 key/value + } + if (query2 !== '' && query2 !== null && query2 !== undefined) { + params.append('operatorId', query2) // 你要传给后台的参数值 key/value + } + return request({ + url: '/coupon/delete', + method: 'post', + data: params + }) +} + +// 修改领料单 +export function updatecoupon(query) { + var params = new URLSearchParams() + if (query !== '' && query !== null && query !== undefined) { + params.append('Json', query) // 你要传给后台的参数值 key/value + } + return request({ + url: '/coupon/update', + method: 'post', + data: params + }) +} diff --git a/src/lang/zh.js b/src/lang/zh.js index e57250ae..2a34411f 100644 --- a/src/lang/zh.js +++ b/src/lang/zh.js @@ -851,7 +851,7 @@ export default { applicableRepositoryId: '使用门店', applicableProductId: '使用商品', stat: '状态', - received: '已领取', + received: '已发放', used: '已使用', couponStat: '优惠券状态', couponType: '优惠券类型', @@ -3942,7 +3942,14 @@ export default { outlay: '支出单', totalPay: '总支出', balance: '余额', - payModeName: '结算方式' + payModeName: '结算方式', + type: '优惠券类型', + effectiveTime: '有效期', + effectiveType: '适用类别', + isRepeat: '是否可以叠加', + number: '发行量', + send: '已发放数量', + left: '剩余数量' }, collectAndPayDetail: { name: '名称', diff --git a/src/router/index.js b/src/router/index.js index c946c05d..73cf76c8 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -2857,7 +2857,7 @@ export const asyncRouterMap = [ path: 'CouponList', component: () => import('@/views/Coupon/CouponList'), name: 'CouponList', - meta: { title: 'CouponList', noCache: true, roles: ['215-216-218-2', '215-216-218-3', '215-216-218-4', '215-216-218-5', '215-216-218-6', '215-216-218-7', '215-216-218-8', '215-216-218-9'] } + meta: { title: 'CouponList', noCache: true, roles: ['215-216-217-2', '215-216-217-3', '215-216-217-4', '215-216-217-5', '215-216-217-6', '215-216-217-7', '215-216-217-8', '215-216-217-9'] } } ] }, diff --git a/src/views/Coupon/AddCoupon.vue b/src/views/Coupon/AddCoupon.vue index 629c17a3..07736046 100644 --- a/src/views/Coupon/AddCoupon.vue +++ b/src/views/Coupon/AddCoupon.vue @@ -18,13 +18,55 @@ - - + + - + + + 全部门店 + 部分门店 + + + + + + + + + + + + + + + + + + + + + + + + Yes + No + + + + + + + 限制时间 + 不限制时间 + + + + + - + - - - - - - - - - - - - - - YES - NO - - - - - - - YES - NO - - - - - - - - - - - - - - - - - - - - - - - -

{{ $t('updates.sysp') }}

-
- {{ $t('Hmodule.tjsp') }} - - - - - - {{ $t('Hmodule.delete') }} - -
-
- - - - - - - - - - -
-
-
{{ $t('Hmodule.baoc') }} {{ $t('Hmodule.cancel') }}
- - - -
- - - - - - - - - - - -
-
-
-
@@ -193,6 +125,8 @@ export default { components: { MyContract, MyDetail2, MyOpportunity, MyPresale, MyAdvance, MyOrder, MyRepository, MyAccept, MyAgent, MyCustomer, MyRequire, MySupplier, MyApply, MyDetail, MyDelivery, MyEmp }, data() { return { + addpro: false, + repo: true, pickerOptions1: { disabledDate: (time) => { return time.getTime() < new Date().getTime() - 8.64e7 @@ -276,9 +210,11 @@ export default { control: false, // 销售订单信息数据 personalForm: { + effectiveTime: 1, + type: 1, + isRepeat: 2, createPersonId: this.$store.getters.userId, countryId: this.$store.getters.countryId, - repositoryId: this.$store.getters.repositoryId, regionId: this.$store.getters.regionId, isDiscount: 1, isToday: 1, @@ -290,6 +226,9 @@ export default { name: [ { required: true, message: '请输入优惠券名称', trigger: 'change' } ], + number: [ + { required: true, message: '请输入发行量', trigger: 'change' } + ], money: [ { required: true, message: '请输入面值', trigger: 'change' } ], @@ -327,6 +266,25 @@ export default { _that = this }, methods: { + changeType() { + console.log('this.personalForm.type', this.personalForm.type) + if (this.personalForm.type === 1) { + this.repo = true + this.personalForm.repositoryId = '' + this.personalForm.itemName = '' + } else { + this.repo = false + } + }, + changeTime() { + if (this.personalForm.effectiveTime === 1) { + this.addpro = false + } else { + this.addpro = true + this.personalForm.beginTime = '' + this.personalForm.endTime = '' + } + }, checkStock(row) { console.log('this.personalForm.saleRepositoryId', this.personalForm.saleRepositoryId) if (this.personalForm.saleRepositoryId === null || this.personalForm.saleRepositoryId === undefined || this.personalForm.saleRepositoryId === '') { @@ -526,8 +484,17 @@ export default { this.repositorycontrol = true }, repositoryname(val) { - this.saleRepositoryId = val.repositoryName - this.personalForm.saleRepositoryId = val.id + console.log(val) + const name = [] + const id = [] + for (const i in val) { + name.push(val[i].repositoryName) + id.push(val[i].id) + } + console.log(name, id) + this.personalForm.itemName = name.join(',') + this.personalForm.repositoryId = id.join(',') + console.log(this.personalForm) }, // 出库人focus事件触发 handlechooseAccept() { @@ -952,16 +919,22 @@ export default { // 清空记录 restAllForm() { this.personalForm = { + effectiveTime: 1, + type: 1, + isRepeat: 2, createPersonId: this.$store.getters.userId, countryId: this.$store.getters.countryId, - repositoryId: this.$store.getters.repositoryId, regionId: this.$store.getters.regionId, isDiscount: 1, isToday: 1, stat: 1, - applicableWeek: [], + effectiveType: [], requireMoney: 0 } + this.addpro = false + this.repo = true + this.personalForm.repositoryId = '' + this.personalForm.itemName = '' }, // 深拷贝 deepClone(obj) { @@ -973,94 +946,50 @@ export default { handlesave() { this.$refs.personalForm.validate((valid) => { if (valid) { - const EnterDetail = this.deepClone(this.$refs.editable.getRecords()) - let applicableProductId = '' - EnterDetail.map(function(elem) { - return elem - }).forEach(function(elem) { - console.log('id', elem.id) - if (elem.id !== null || elem.id !== '' || elem.id !== undefined) { - applicableProductId = applicableProductId + ',' + elem.id + if (this.personalForm.type === 2) { + if (this.personalForm.repositoryId === undefined || this.personalForm.repositoryId === null || this.personalForm.repositoryId === '') { + this.$notify.error({ + title: '错误', + message: '请选择门店', + offset: 100 + }) + return false + } + } + if (this.personalForm.effectiveType === undefined || this.personalForm.effectiveType === null || this.personalForm.effectiveType === '' || this.personalForm.effectiveType.length === 0) { + this.$notify.error({ + title: '错误', + message: '请选择适用类别', + offset: 100 + }) + return false + } + if (this.personalForm.effectiveTime === 1) { + if (this.personalForm.beginTime === undefined || this.personalForm.beginTime === null || this.personalForm.beginTime === '') { + this.$notify.error({ + title: '错误', + message: '请选择开始时间', + offset: 100 + }) + return false + } + if (this.personalForm.endTime === undefined || this.personalForm.endTime === null || this.personalForm.endTime === '') { + this.$notify.error({ + title: '错误', + message: '请选择截止时间', + offset: 100 + }) + return false + } + if (this.personalForm.endTime <= this.personalForm.beginTime) { + this.$notify.error({ + title: '错误', + message: '截止时间需要大于开始时间', + offset: 100 + }) + return false } - if (elem.productCode === null || elem.productCode === '' || elem.productCode === undefined) { - delete elem.productCode - } - if (elem.productName === null || elem.productName === '' || elem.productName === undefined) { - delete elem.productName - } - if (elem.category === null || elem.category === '' || elem.category === undefined) { - delete elem.category - } - if (elem.type === null || elem.type === '' || elem.type === undefined) { - delete elem.type - } - if (elem.unit === null || elem.unit === '' || elem.unit === undefined) { - delete elem.unit - } - if (elem.color === null || elem.color === '' || elem.color === undefined) { - delete elem.color - } - if (elem.kpiGrade === null || elem.kpiGrade === '' || elem.kpiGrade === undefined) { - delete elem.kpiGrade - } - if (elem.point === null || elem.point === '' || elem.point === undefined) { - delete elem.point - } - if (elem.quantity === null || elem.quantity === '' || elem.quantity === undefined) { - delete elem.quantity - } - if (elem.salePrice === null || elem.salePrice === '' || elem.salePrice === undefined) { - delete elem.salePrice - } - if (elem.costPrice === null || elem.costPrice === '' || elem.costPrice === undefined) { - delete elem.costPrice - } - if (elem.costMoney === null || elem.costMoney === '' || elem.costMoney === undefined) { - delete elem.costMoney - } - if (elem.includeTaxMoney === null || elem.includeTaxMoney === '' || elem.includeTaxMoney === undefined) { - delete elem.includeTaxMoney - } - if (elem.taxRate === null || elem.taxRate === '' || elem.taxRate === undefined) { - delete elem.taxRate - } - if (elem.taxRate !== null || elem.taxRate !== '' || elem.taxRate !== undefined) { - elem.taxRate = elem.taxRate / 100 - } - if (elem.taxMoney === null || elem.taxMoney === '' || elem.taxMoney === undefined) { - delete elem.taxMoney - } - if (elem.money === null || elem.money === '' || elem.money === undefined) { - delete elem.money - } - if (elem.includeTaxCostMoney === null || elem.includeTaxCostMoney === '' || elem.includeTaxCostMoney === undefined) { - delete elem.includeTaxCostMoney - } - if (elem.discountRate === null || elem.discountRate === '' || elem.discountRate === undefined) { - delete elem.discountRate - } - if (elem.discountRate !== null || elem.discountRate !== '' || elem.discountRate !== undefined) { - elem.discountRate = elem.discountRate / 100 - } - if (elem.discountMoney === null || elem.discountMoney === '' || elem.discountMoney === undefined) { - delete elem.discountMoney - } - if (elem.carCode === null || elem.carCode === '' || elem.carCode === undefined) { - delete elem.carCode - } - if (elem.motorCode === null || elem.motorCode === '' || elem.motorCode === undefined) { - delete elem.motorCode - } - if (elem.batteryCode === null || elem.batteryCode === '' || elem.batteryCode === undefined) { - delete elem.batteryCode - } - return elem - }) - console.log('resulet', applicableProductId) - if (applicableProductId !== '') { - applicableProductId = applicableProductId + ',' } - this.personalForm.applicableProductId = applicableProductId const Data = this.personalForm for (const key in Data) { if (Data[key] === '' || Data[key] === undefined || Data[key] === null) { @@ -1070,6 +999,8 @@ export default { delete Data[key] } } + this.personalForm.effectiveType = this.personalForm.effectiveType.join(',') + console.log('this.personalForm.effectiveType', this.personalForm.effectiveType) const parms = JSON.stringify(Data) createCoupon(parms).then(res => { console.log(res) @@ -1081,7 +1012,6 @@ export default { offset: 100 }) this.restAllForm() - this.$refs.editable.clear() this.$refs.personalForm.resetFields() } else { this.$notify.error({ diff --git a/src/views/Coupon/CouponList.vue b/src/views/Coupon/CouponList.vue index 364db7f6..750934ef 100644 --- a/src/views/Coupon/CouponList.vue +++ b/src/views/Coupon/CouponList.vue @@ -3,20 +3,25 @@ - + - - - - - + + + + + + + + + + - + {{ $t('public.search') }} @@ -69,6 +74,21 @@ {{ scope.row.name }} + + + + + + + + + - + - + - - - - - - @@ -142,8 +152,8 @@ export default { filters: { statFilter(status) { const statusMap = { - 1: '启用', - 2: '未启用' + 1: '全部门店', + 2: '部分门店' } return statusMap[status] }, diff --git a/src/views/Coupon/components/DetailList.vue b/src/views/Coupon/components/DetailList.vue index 2f0011e3..72f57f2d 100644 --- a/src/views/Coupon/components/DetailList.vue +++ b/src/views/Coupon/components/DetailList.vue @@ -4,15 +4,9 @@

{{ $t('Hmodule.basicinfo') }}

-
- - - {{ personalForm.name }} @@ -24,8 +18,33 @@ - - {{ personalForm.requireMoney }} + + {{ personalForm.number }} + + + + + {{ personalForm.type | statFilter }} + + + + + {{ personalForm.repositoryName }} + + + + + {{ personalForm.effectiveTypeName }} + + + + + {{ personalForm.isRepeat | isTodayFilter }} + + + + + {{ personalForm.effectiveTime | isTodayFilter2 }} @@ -38,41 +57,6 @@ {{ personalForm.endTime }} - - - {{ personalForm.beginClock }} - - - - - {{ personalForm.endClock }} - - - - - {{ personalForm.isDiscount | isDiscountFilter }} - - - - - {{ personalForm.isDiscount | statFilter }} - - - - - {{ personalForm.isToday | isTodayFilter }} - - - - - {{ personalForm.applicableWeek }} - - - - - {{ personalForm.content }} - -
@@ -115,6 +99,13 @@ export default { } return statusMap[status] }, + isTodayFilter2(status) { + const statusMap = { + 1: '限制时间', + 2: '不限制时间' + } + return statusMap[status] + }, isTodayFilter(status) { const statusMap = { 1: 'YES', @@ -124,8 +115,8 @@ export default { }, statFilter(status) { const statusMap = { - 1: '启用', - 2: '未启用' + 1: '全部门店', + 2: '部分门店' } return statusMap[status] }, diff --git a/src/views/Coupon/components/MyDialog.vue b/src/views/Coupon/components/MyDialog.vue index 28426509..363e0c7d 100644 --- a/src/views/Coupon/components/MyDialog.vue +++ b/src/views/Coupon/components/MyDialog.vue @@ -6,6 +6,11 @@
+ + + + + @@ -17,13 +22,55 @@ - - + + - + + + 全部门店 + 部分门店 + + + + + + + + + + + + + + + + + + + + + + + + Yes + No + + + + + + + 限制时间 + 不限制时间 + + + + + - + - - - - - - - - - - - - - - YES - NO - - - - - - - YES - NO - - - - - - - - - - - - - - - - - - - - -
- - -

{{ $t('updates.ckdmx') }}

-
- {{ $t('Hmodule.tjsp') }} - - {{ $t('updates.cydzxz') }} - - - - {{ $t('Hmodule.delete') }} -
-
- - - - - - - - - - -
-
{{ $t('Hmodule.cancel') }} @@ -168,6 +137,8 @@ export default { }, data() { return { + addpro: false, + repo: true, pickerOptions1: { disabledDate: (time) => { return time.getTime() < new Date().getTime() - 8.64e7 @@ -253,6 +224,9 @@ export default { control: false, // 销售订单规则数据 personalrules: { + number: [ + { required: true, message: '请输入发行量', trigger: 'change' } + ], name: [ { required: true, message: '请输入优惠券名称', trigger: 'change' } ], @@ -281,27 +255,45 @@ export default { }, editdata() { this.personalForm = this.editdata - this.planPersonId = this.personalForm.planPersonName - this.stockPersonId = this.personalForm.stockPersonName - this.list2 = this.personalForm.productVos - this.list3 = this.personalForm.saleOutGiftVos - this.customerId = this.personalForm.customerName - this.salePersonId = this.personalForm.salePersonName - this.transferPersonId = this.personalForm.transferPersonName - this.saleRepositoryId = this.personalForm.saleRepositoryName - this.outPersonId = this.personalForm.outPersonName - this.updatebatch() + this.personalForm.effectiveType = this.personalForm.effectiveType.split(',') + this.personalForm.itemName = this.personalForm.repositoryName + console.log('this.personalForm.effectiveType', this.personalForm.effectiveType) + if (this.personalForm.type === 1) { + this.repo = true + this.personalForm.repositoryId = '' + this.personalForm.itemName = '' + } else { + this.repo = false + } } }, created() { this.getTypes() this.getdatatime() - this.chooseSourceType() }, beforeCreate() { _that = this }, methods: { + changeType() { + console.log('this.personalForm.type', this.personalForm.type) + if (this.personalForm.type === 1) { + this.repo = true + this.personalForm.repositoryId = '' + this.personalForm.itemName = '' + } else { + this.repo = false + } + }, + changeTime() { + if (this.personalForm.effectiveTime === 1) { + this.addpro = false + } else { + this.addpro = true + this.personalForm.beginTime = '' + this.personalForm.endTime = '' + } + }, // 重置一下下拉 change() { this.$forceUpdate() @@ -344,29 +336,22 @@ export default { } }) }, - chooseSourceType(val) { - console.log(val) - if (val === '5' || val === undefined) { - this.Isproduct = false - this.IsSourceNumber = true - if (this.$refs.editable.getRecords().length !== 0 && this.$refs.editable.getRecords() !== undefined && this.$refs.editable.getRecords() !== null) { - this.$refs.editable.clear() - } - } else { - this.Isproduct = true - this.IsSourceNumber = false - if (this.$refs.editable.getRecords().length !== 0 && this.$refs.editable.getRecords() !== undefined && this.$refs.editable.getRecords() !== null) { - this.$refs.editable.clear() - } - } - }, // 出库仓库focus事件触发 handlechooseRep() { this.repositorycontrol = true }, repositoryname(val) { - this.saleRepositoryId = val.repositoryName - this.personalForm.saleRepositoryId = val.id + console.log(val) + const name = [] + const id = [] + for (const i in val) { + name.push(val[i].repositoryName) + id.push(val[i].id) + } + console.log(name, id) + this.personalForm.itemName = name.join(',') + this.personalForm.repositoryId = id.join(',') + console.log(this.personalForm) }, // 出库人focus事件触发 handlechooseAccept() { @@ -573,24 +558,6 @@ export default { this.opportunitycontrol = true } }, - // 从销售订单过来数据 - saleOrderDetail(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]) - } - }, saleOrder(val) { if (val.customerType !== null && val.customerType !== undefined && val.customerType !== '') { this.personalForm.customerType = String(val.customerType) @@ -608,24 +575,6 @@ export default { this.saleRepositoryId = val.saleRepositoryName this.personalForm.address = val.transAddress }, - // 从预售单过来的源单数据 - advanceOrderDetail(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]) - } - }, advanceData(val) { this.personalForm.customerType = '2' this.personalForm.customerId = val.customerId @@ -640,24 +589,6 @@ export default { this.saleRepositoryId = val.saleRepositoryName this.personalForm.address = val.address }, - // 从销售机会过来的源单数据 - 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) { if (val.customerType !== null && val.customerType !== undefined && val.customerType !== '') { this.personalForm.customerType = String(val.customerType) @@ -674,42 +605,10 @@ export default { handleAddproduct() { this.control = true }, - productdetail(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].productCode === nowlistdata[j].productCode) { - this.$notify.error({ - title: '错误', - message: '物品已添加', - offset: 100 - }) - return false - } - } - this.$refs.editable.insert(val[i]) - } - }, // 添加赠品 handleAddGift() { this.giftcontrol = true }, - gift(val) { - const nowlistdata = this.$refs.editable2.getRecords() - for (let i = 0; i < val.length; i++) { - for (let j = 0; j < nowlistdata.length; j++) { - if (val[i].productCode === nowlistdata[j].productCode) { - this.$notify.error({ - title: '错误', - message: '物品已添加', - offset: 100 - }) - return false - } - } - this.$refs.editable2.insert(val[i]) - } - }, deleteChange(val) { this.choosedata = val }, @@ -774,105 +673,51 @@ export default { handleEditok() { this.$refs.personalForm.validate((valid) => { if (valid) { - this.personalForm.repositoryId = this.$store.getters.repositoryId - this.personalForm.regionId = this.$store.getters.regionId - this.personalForm.createPersonId = this.$store.getters.userId - this.personalForm.countryId = this.$store.getters.countryId - this.personalForm.modifyPersonId = this.$store.getters.userId - const EnterDetail = this.$refs.editable.getRecords() - if (EnterDetail.length === 0) { + if (this.personalForm.type === 2) { + if (this.personalForm.repositoryId === undefined || this.personalForm.repositoryId === null || this.personalForm.repositoryId === '') { + this.$notify.error({ + title: '错误', + message: '请选择门店', + offset: 100 + }) + return false + } + } + if (this.personalForm.effectiveType === undefined || this.personalForm.effectiveType === null || this.personalForm.effectiveType === '' || this.personalForm.effectiveType.length === 0) { this.$notify.error({ title: '错误', - message: '明细表不能为空', + message: '请选择适用类别', offset: 100 }) return false } - let applicableProductId = '' - EnterDetail.map(function(elem) { - return elem - }).forEach(function(elem) { - if (elem.id !== null || elem.id !== '' || elem.id !== undefined) { - applicableProductId = applicableProductId + ',' + elem.id + if (this.personalForm.effectiveTime === 1) { + if (this.personalForm.beginTime === undefined || this.personalForm.beginTime === null || this.personalForm.beginTime === '') { + this.$notify.error({ + title: '错误', + message: '请选择开始时间', + offset: 100 + }) + return false } - if (elem.productCode === null || elem.productCode === '' || elem.productCode === undefined) { - delete elem.productCode + if (this.personalForm.endTime === undefined || this.personalForm.endTime === null || this.personalForm.endTime === '') { + this.$notify.error({ + title: '错误', + message: '请选择截止时间', + offset: 100 + }) + return false } - if (elem.productName === null || elem.productName === '' || elem.productName === undefined) { - delete elem.productName + if (this.personalForm.endTime <= this.personalForm.beginTime) { + this.$notify.error({ + title: '错误', + message: '截止时间需要大于开始时间', + offset: 100 + }) + return false } - if (elem.category === null || elem.category === '' || elem.category === undefined) { - delete elem.category - } - if (elem.type === null || elem.type === '' || elem.type === undefined) { - delete elem.type - } - if (elem.unit === null || elem.unit === '' || elem.unit === undefined) { - delete elem.unit - } - if (elem.color === null || elem.color === '' || elem.color === undefined) { - delete elem.color - } - if (elem.kpiGrade === null || elem.kpiGrade === '' || elem.kpiGrade === undefined) { - delete elem.kpiGrade - } - if (elem.point === null || elem.point === '' || elem.point === undefined) { - delete elem.point - } - if (elem.quantity === null || elem.quantity === '' || elem.quantity === undefined) { - delete elem.quantity - } - if (elem.salePrice === null || elem.salePrice === '' || elem.salePrice === undefined) { - delete elem.salePrice - } - if (elem.costPrice === null || elem.costPrice === '' || elem.costPrice === undefined) { - delete elem.costPrice - } - if (elem.costMoney === null || elem.costMoney === '' || elem.costMoney === undefined) { - delete elem.costMoney - } - if (elem.includeTaxMoney === null || elem.includeTaxMoney === '' || elem.includeTaxMoney === undefined) { - delete elem.includeTaxMoney - } - if (elem.taxRate === null || elem.taxRate === '' || elem.taxRate === undefined) { - delete elem.taxRate - } - if (elem.taxRate !== null || elem.taxRate !== '' || elem.taxRate !== undefined) { - elem.taxRate = elem.taxRate / 100 - } - if (elem.taxMoney === null || elem.taxMoney === '' || elem.taxMoney === undefined) { - delete elem.taxMoney - } - if (elem.money === null || elem.money === '' || elem.money === undefined) { - delete elem.money - } - if (elem.includeTaxCostMoney === null || elem.includeTaxCostMoney === '' || elem.includeTaxCostMoney === undefined) { - delete elem.includeTaxCostMoney - } - if (elem.discountRate === null || elem.discountRate === '' || elem.discountRate === undefined) { - delete elem.discountRate - } - if (elem.discountRate !== null || elem.discountRate !== '' || elem.discountRate !== undefined) { - elem.discountRate = elem.discountRate / 100 - } - if (elem.discountMoney === null || elem.discountMoney === '' || elem.discountMoney === undefined) { - delete elem.discountMoney - } - if (elem.carCode === null || elem.carCode === '' || elem.carCode === undefined) { - delete elem.carCode - } - if (elem.motorCode === null || elem.motorCode === '' || elem.motorCode === undefined) { - delete elem.motorCode - } - if (elem.batteryCode === null || elem.batteryCode === '' || elem.batteryCode === undefined) { - delete elem.batteryCode - } - return elem - }) - if (applicableProductId !== '') { - applicableProductId = applicableProductId + ',' } - this.personalForm.applicableProductId = applicableProductId + this.personalForm.effectiveType = this.personalForm.effectiveType.join(',') const Data = this.personalForm for (const key in Data) { if (Data[key] === '' || Data[key] === undefined || Data[key] === null) { @@ -893,7 +738,6 @@ export default { offset: 100 }) this.$emit('rest', true) - this.$refs.editable.clear() this.$refs.personalForm.clearValidate() this.$refs.personalForm.resetFields() this.editVisible = false @@ -938,7 +782,7 @@ export default { } .edit >>> .el-dialog { background:#f1f1f1 ; - left: 0; + height: 920px; } .el-col-12{ width: 49%; diff --git a/src/views/Coupon/components/MyRepository.vue b/src/views/Coupon/components/MyRepository.vue index 10349184..0556261a 100644 --- a/src/views/Coupon/components/MyRepository.vue +++ b/src/views/Coupon/components/MyRepository.vue @@ -37,18 +37,24 @@ {{ $t('public.search') }} - {{ $t('public.add') }} + {{ $t('public.add') }}
+ @current-change="handleCurrentChange" + @selection-change="handleSelectionChange"> +