diff --git a/src/api/customer.js b/src/api/customer.js new file mode 100644 index 0000000..7a89cb6 --- /dev/null +++ b/src/api/customer.js @@ -0,0 +1,57 @@ +import request from '@/utils/request' + +export function fetchVip(data) { + return request({ + url: '/manage/customer/listVip', + method: 'post', + data + }) +} + +export function fetchCustomer(data) { + return request({ + url: '/manage/customer/listCustomer', + method: 'post', + data + }) +} + +export function addCustomer(data) { + return request({ + url: '/manage/customer/addClient', + method: 'post', + data + }) +} + +export function findByCustomerId(customerId) { + return request({ + url: '/manage/customer/findByClientId/' + customerId, + method: 'get' + }) +} + +export function updateCustomer(data) { + return request({ + url: '/manage/customer/updateClient', + method: 'put', + data + }) +} + +export function delClient(customerId){ + return request({ + url: '/manage/customer/delClient/' + customerId, + method: 'delete' + }) +} + +export function batchDelClient(customerIds){ + return request({ + url: '/manage/customer/batchDelClient/' + customerIds, + method: 'delete' + }) +} + + + diff --git a/src/api/import.js b/src/api/import.js new file mode 100644 index 0000000..d0da91a --- /dev/null +++ b/src/api/import.js @@ -0,0 +1,17 @@ +import request from '@/utils/request' + +export function fetchImport(data) { + return request({ + url: '/manage/import/listImport', + method: 'post', + data + }) +} + +export function importAdd(data){ + return request({ + url: '/manage/import/addImport', + method: 'post', + data + }) +} diff --git a/src/api/merch.js b/src/api/merch.js index 1b2ab62..36d5fd7 100644 --- a/src/api/merch.js +++ b/src/api/merch.js @@ -44,3 +44,10 @@ export function batchDelMerch(merchIds){ method: 'delete' }) } + +export function findTypes(){ + return request({ + url: '/manage/merch/findTypes', + method: 'get' + }) +} diff --git a/src/api/returns.js b/src/api/returns.js new file mode 100644 index 0000000..24b04fa --- /dev/null +++ b/src/api/returns.js @@ -0,0 +1,17 @@ +import request from '@/utils/request' + +export function fetchReturns(data) { + return request({ + url: '/manage/returns/listReturns', + method: 'post', + data + }) +} + +export function returnsAdd(data){ + return request({ + url: '/manage/returns/addReturns', + method: 'post', + data + }) +} diff --git a/src/views/market/index.vue b/src/views/market/index.vue index 574fd27..a6c32fb 100644 --- a/src/views/market/index.vue +++ b/src/views/market/index.vue @@ -323,10 +323,187 @@ + 刷新 + + + + + + + + + 查询 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 刷新 + + + + + + + + + 查询 + + + 新增客户 + + + + + + + + + + + + + + + + + 删除 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -338,9 +515,14 @@ - - - + @@ -397,10 +579,13 @@ - - - - + @@ -418,7 +603,7 @@ - + @@ -430,7 +615,6 @@ 下架 - - - 进货 - 退货 + + + 添加进货 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 添加退货 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 报损 报溢 - 查询库存 + + + + + + + + + + + + + + + + 查询 + + + 新增商品 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 未上架 + 上架 + 下架 + + + + + + + + 综合统计 @@ -503,8 +906,10 @@ import { add, batchDel, del, fetchManager, findById, update, fetchEmp } from '@/api/manager'; import { findRoles, findPosts } from '@/api/role'; -import { fetchMerch, addMerch, findByMerchId, updateMerch, delMerch, batchDelMerch } from '@/api/merch'; -import item from '@/layout/components/Sidebar/Item.vue' +import { fetchMerch, addMerch, findByMerchId, updateMerch, delMerch, batchDelMerch, findTypes } from '@/api/merch'; +import { fetchVip, fetchCustomer, addCustomer, findByCustomerId, updateCustomer, delClient, batchDelClient } from '@/api/customer' +import { fetchImport, importAdd } from '@/api/import' +import { fetchReturns, returnsAdd } from '@/api/returns' export default { //import引入的组件需要注入到对象中才能使用 @@ -547,7 +952,7 @@ export default { dialogFormVisible2: false, dialogFormVisible3: false, dialogFormVisible4: false, - formLabelWidth: '120px', + formLabelWidth: '160px', passwordType: 'password', redirect: undefined, multipleSelection: [], @@ -582,7 +987,7 @@ export default { merch: { merchId: null, merchName: '', - merchType: null, + typeIds: '', merchPrice: null, barCode: '', salesProPrice: null, @@ -595,7 +1000,8 @@ export default { merchRequest: { merchId: null, merchName: '', - merchType: null, + typeIds: null, + merchNum: null, pageNum: 1, pageSize: 5 }, @@ -603,9 +1009,80 @@ export default { total: 0, list: [] }, - merchTypes: [], + merchTypes: {}, + props: { + label: 'typeName', + value: 'typeIds', + children: 'children', + expandTrigger: 'hover' + }, dialogFormVisible5: false, dialogFormVisible6: false, + customer: { + customerId: null, + customerName: '', + customerAge: null, + customerGender: null, + customerAddress: '', + customerTel: '', + vipGrade: null, + regDate: null + }, + customerRequest: { + customerId: null, + customerName: '', + pageNum: 1, + pageSize: 5 + }, + customerResponse: { + total: 0, + list: [] + }, + dialogFormVisible7: false, + dialogFormVisible8: false, + dialogFormVisible9: false, + dialogFormVisible10: false, + dialogFormVisible11: false, + imports: { + listId: null, + merchId: null, + merchName: null, + typeIds: null, + merchPrice: null, + planNum: null, + importDate: null, + provideId: null + }, + importRequest: { + pageNum: 1, + pageSize: 5 + }, + importResponse: { + total: 0, + list: [] + }, + dialogFormVisible12: false, + returns: { + listId: null, + merchId: null, + merchName: null, + typeIds: null, + merchPrice: null, + planNum: null, + returnsDate: null, + provideId: null + }, + returnsRequest: { + pageNum: 1, + pageSize: 5 + }, + returnsResponse: { + total: 0, + list: [] + }, + dialogFormVisible13: false, + dialogFormVisible14: false, + } }, methods: { @@ -734,6 +1211,7 @@ export default { this.fetchManager() }, addMerch() { + this.merch.typeIds = this.merch.typeIds.join(",").split(","); addMerch(this.merch).then(res => { this.$message.success(res.msg) this.dialogFormVisible5 = false @@ -748,6 +1226,7 @@ export default { }) }, updateMerch() { + this.merch.typeIds = this.merch.typeIds.join(",").split(","); updateMerch(this.merch).then(res => { this.$message.success(res.msg) this.dialogFormVisible6 = false @@ -766,7 +1245,132 @@ export default { this.$message.success(res.msg) this.fetchMerch() }) - } + }, + handleChange(val) { + findTypes().then(res => { + this.merchTypes = res.data + }) + }, + fetchVip(){ + fetchVip(this.customerRequest).then(res=>{ + this.customerResponse.list = [] + this.customerResponse = res.data + }) + }, + fetchCustomer(){ + fetchCustomer(this.customerRequest).then(res=>{ + this.customerResponse.list = [] + this.customerResponse = res.data + }) + }, + handleSizeChange2(val) { + this.customerRequest.pageSize = val + this.fetchManager() + }, + handleCurrentChange2(val) { + this.customerRequest.pageNum = val + this.fetchManager() + }, + openVip(customerId){ + this.dialogFormVisible8 = true + findByCustomerId(customerId).then(res =>{ + this.customer = res.data + }) + }, + updateVip(){ + updateCustomer(this.customer).then(res => { + this.$message.success(res.msg) + this.dialogFormVisible8 = false + this.customer = {} + this.fetchVip() + }) + }, + addCustomer(){ + addCustomer(this.customer).then(res => { + this.$message.success(res.msg) + this.dialogFormVisible9 = false + this.customer = {} + this.fetchCustomer() + }) + }, + openCustomer(customerId){ + this.dialogFormVisible10 = true + findByCustomerId(customerId).then(res =>{ + this.customer = res.data + }) + }, + updateCustomer(){ + updateCustomer(this.customer).then(res => { + this.$message.success(res.msg) + this.dialogFormVisible10 = false + this.customer = {} + this.fetchCustomer() + }) + }, + delCustomer(customerId){ + delClient(customerId).then(res => { + this.$message.success(res.msg) + this.fetchCustomer() + }) + }, + batchDelClient(){ + batchDelClient(this.multipleSelection.map(item => item.customerId)).then(res => { + this.$message.success(res.msg) + this.fetchCustomer() + }) + }, + addMerch2() { + this.merch.typeIds = this.merch.typeIds.join(",").split(",")[2]; + addMerch(this.merch).then(res => { + this.$message.success(res.msg) + this.dialogFormVisible5 = false + this.merch = {} + this.fetchMerch() + }) + }, + fetchImport(){ + fetchImport(this.importRequest).then(res => { + this.importResponse = res.data + }) + }, + handleSizeChange3(val) { + this.importRequest.pageSize = val + this.fetchImport() + }, + handleCurrentChange3(val) { + this.importRequest.pageNum = val + this.fetchImport() + }, + addImport() { + importAdd(this.imports).then(res => { + this.$message.success(res.msg) + this.dialogFormVisible12 = false + this.imports = {} + this.fetchImport() + }) + }, + fetchReturn(){ + fetchReturns(this.returnsRequest).then(res => { + this.returnsResponse = res.data + }) + }, + handleSizeChange4(val) { + this.returnsResponse.pageSize = val + this.fetchReturn() + }, + handleCurrentChange4(val) { + this.returnsResponse.pageNum = val + this.fetchReturn() + }, + addReturn() { + returnsAdd(this.returns).then(res => { + this.$message.success(res.msg) + this.dialogFormVisible13 = false + this.returns = {} + this.fetchReturn() + }) + }, + }, //声明周期 - 创建完成(可以访问当前this实例), created() { @@ -775,6 +1379,11 @@ export default { this.findPosts() this.fetchEmp() this.fetchMerch() + this.fetchVip() + this.fetchCustomer() + this.handleChange() + this.fetchImport() + this.fetchReturn() } }