diff --git a/src/api/app.js b/src/api/app.js index d985f28..8a5e1b6 100644 --- a/src/api/app.js +++ b/src/api/app.js @@ -357,7 +357,7 @@ export const delSeckill = (params) => { } // 秒杀商品列表 export const seckillProductList = (params) => { - return getRequest('/mall/admin/seckillGroup/product/page', params) + return postBodyRequest('/mall/admin/seckillGroup/product/page', params) } // 新增秒杀商品 export const addSeckillProduct = (params) => { @@ -375,6 +375,10 @@ export const delSeckillProduct = (params) => { export const upSeckillProduct = (params) => { return postRequest('/mall/admin/seckillGroup/product/up', params) } +// 秒杀商品下架 +export const downSeckillProduct = (params) => { + return postRequest('/mall/admin/seckillGroup/product/down', params) +} export const getShopData = (params) => { return getRequest('/app/shop/getByCondition', params) diff --git a/src/views/app/business/bus/addEdit.vue b/src/views/app/business/bus/addEdit.vue index 2175930..17431f7 100644 --- a/src/views/app/business/bus/addEdit.vue +++ b/src/views/app/business/bus/addEdit.vue @@ -43,6 +43,16 @@ + + + + + 其他 + 邀新奖励 + + + + @@ -133,7 +143,7 @@ validStartTime:'', //有效期开始时间 validEndTime:'', //有效期结束时间 validDays:'', //自领取之日起有效天数 - + ruleType:1, issuerType:1, //发放方:1-平台,2-商家 issuerId:0, //发放方ID 0-平台 status:1, //状态:0-已下架/停发,1-发放中 diff --git a/src/views/app/business/bus/bus.vue b/src/views/app/business/bus/bus.vue index 964e96b..8314fe8 100644 --- a/src/views/app/business/bus/bus.vue +++ b/src/views/app/business/bus/bus.vue @@ -267,7 +267,7 @@ } }, { - title: "领取人次", + title: "总数量", key: "totalCount", width: 150, }, diff --git a/src/views/app/business/logiticsCompany/addEdit.vue b/src/views/app/business/logiticsCompany/addEdit.vue index 2175930..f31760f 100644 --- a/src/views/app/business/logiticsCompany/addEdit.vue +++ b/src/views/app/business/logiticsCompany/addEdit.vue @@ -1,247 +1,125 @@ \ No newline at end of file +@import "@/styles/drawer-common.less"; + diff --git a/src/views/app/business/logiticsCompany/dictManage.vue b/src/views/app/business/logiticsCompany/dictManage.vue index 6bae70f..7fe4ee2 100644 --- a/src/views/app/business/logiticsCompany/dictManage.vue +++ b/src/views/app/business/logiticsCompany/dictManage.vue @@ -1,315 +1,300 @@ - \ No newline at end of file diff --git a/src/views/app/business/logiticsCompany/logiticsCompany.vue b/src/views/app/business/logiticsCompany/logiticsCompany.vue index 8cfd147..67d5869 100644 --- a/src/views/app/business/logiticsCompany/logiticsCompany.vue +++ b/src/views/app/business/logiticsCompany/logiticsCompany.vue @@ -1,304 +1,193 @@ + \ No newline at end of file +import { seckillList, delSeckill } from "@/api/app"; +import addEdit from "./addEdit.vue"; +import goodsList from "./dictManage.vue"; + +export default { + name: "logiticsCompany", + components: { + addEdit, + goodsList, + }, + data() { + return { + tableSize: "default", + showCategory: false, + showType: "0", + loading: false, + form: {}, + data: [], + visibleGoods: false, + goodsModalTitle: "秒杀团商品", + columns: [ + { + type: "index", + width: 60, + align: "center", + fixed: "left", + }, + { + title: "分类名称", + key: "categoryName", + minWidth: 160, + fixed: "left", + }, + { + title: "分类图标", + key: "categoryIcon", + minWidth: 160, + render: (h, params) => { + if (!params.row.categoryIcon) return h("span", "-"); + return h("img", { + attrs: { src: params.row.categoryIcon }, + style: { + width: "60px", + height: "40px", + objectFit: "contain", + }, + }); + }, + }, + { + title: "排序", + key: "sort", + minWidth: 100, + }, + { + title: "状态", + key: "status", + minWidth: 100, + render: (h, params) => h("span", params.row.status == 1 ? "启用" : "禁用"), + }, + { + title: "备注", + key: "remark", + minWidth: 180, + }, + { + title: "操作", + key: "action", + width: 230, + align: "center", + fixed: "right", + render: (h, params) => { + return h("div", [ + h("a", { on: { click: () => this.edit(params.row) } }, "编辑"), + h("Divider", { props: { type: "vertical" } }), + h("a", { on: { click: () => this.remove(params.row) } }, "删除"), + h("Divider", { props: { type: "vertical" } }), + h("a", { on: { click: () => this.openGoods(params.row) } }, "管理商品"), + ]); + }, + }, + ], + }; + }, + methods: { + init() { + this.getDataList(); + }, + changeTableSize(v) { + this.tableSize = v; + }, + getRegionId() { + return JSON.parse(this.getStore("user")).departmentId; + }, + getDataList() { + this.loading = true; + seckillList({ + regionId: this.getRegionId(), + }).then((res) => { + this.loading = false; + if (res.success) { + this.data = Array.isArray(res.result) ? res.result : (res.result && res.result.records) || []; + } + }).catch(() => { + this.loading = false; + }); + }, + add() { + this.form = { + regionId: this.getRegionId(), + sort: 0, + status: 1, + }; + this.showType = "2"; + this.showCategory = true; + }, + edit(v) { + this.form = JSON.parse(JSON.stringify(v)); + this.showType = "1"; + this.showCategory = true; + }, + remove(v) { + this.$Modal.confirm({ + title: "确认删除", + content: "您确认要删除秒杀团分类 " + v.categoryName + " ?", + loading: true, + onOk: () => { + delSeckill({ id: v.id }).then((res) => { + this.$Modal.remove(); + if (res.success) { + this.$Message.success("删除成功"); + this.getDataList(); + } + }); + }, + }); + }, + openGoods(v) { + this.goodsModalTitle = "管理商品 - " + v.categoryName; + this.visibleGoods = true; + this.$nextTick(() => { + this.$refs.goodsPage.init(v); + }); + }, + }, + mounted() { + this.init(); + }, +}; + diff --git a/src/views/app/business/logiticsCompany/transferStation.vue b/src/views/app/business/logiticsCompany/transferStation.vue index 56547a1..0678686 100644 --- a/src/views/app/business/logiticsCompany/transferStation.vue +++ b/src/views/app/business/logiticsCompany/transferStation.vue @@ -1,1008 +1,342 @@ + \ No newline at end of file +import { getShopData, getShareList, addSeckillProduct } from "@/api/app"; + +export default { + name: "seckill-product-selector", + data() { + return { + category: {}, + regionId: "", + tableSize: "default", + openSearch: true, + loading: false, + treeLoading: false, + submitLoading: false, + maxHeight: "500px", + editTitle: "", + searchKey: "", + expand: true, + span: 18, + expandIcon: "ios-arrow-back", + treeData: [], + selectNode: {}, + data: [], + total: 0, + addVisible: false, + dateRange: [], + searchForm: { + shopId: "", + keywords: "", + pageNum: 1, + pageSize: 10, + delFlag: 1, + }, + addForm: {}, + columns: [ + { + type: "index", + width: 60, + align: "center", + }, + { + title: "图片", + key: "productPicture", + width: 100, + render: (h, params) => h("img", { + attrs: { src: params.row.productPicture }, + style: { + width: "70px", + height: "55px", + objectFit: "contain", + }, + }), + }, + { + title: "商品名称", + key: "productName", + minWidth: 180, + }, + { + title: "原价", + width: 100, + render: (h, params) => h("span", this.getOriginalPrice(params.row)), + }, + { + title: "库存", + key: "stockCount", + width: 100, + }, + { + title: "操作", + key: "action", + width: 130, + align: "center", + fixed: "right", + render: (h, params) => h("a", { on: { click: () => this.openAdd(params.row) } }, "添加"), + }, + ], + }; + }, + methods: { + init(category) { + this.category = category || {}; + this.regionId = this.category.regionId || JSON.parse(this.getStore("user")).departmentId; + this.searchKey = ""; + this.treeData = []; + this.cancelEdit(); + }, + changeExpand() { + this.expand = !this.expand; + this.expandIcon = this.expand ? "ios-arrow-back" : "ios-arrow-forward"; + this.span = this.expand ? 18 : 23; + }, + search() { + if (!this.searchKey) { + this.treeData = []; + this.cancelEdit(); + return; + } + this.getShopList(); + }, + getShopList() { + this.treeLoading = true; + getShopData({ + regionId: this.regionId, + keyWord: this.searchKey, + pageNumber: 1, + pageSize: 1000, + }).then((res) => { + this.treeLoading = false; + if (res.success) { + const content = res.result && (res.result.content || res.result.records || res.result); + const list = Array.isArray(content) ? content : []; + this.treeData = list.map((item) => ({ + id: item.id, + title: item.shopName, + shopName: item.shopName, + shopAddress: item.shopAddress, + contactPhone: item.contactPhone, + regionId: item.regionId, + })); + } + }).catch(() => { + this.treeLoading = false; + }); + }, + selectTree(v) { + if (v.length > 0) { + this.selectNode = JSON.parse(JSON.stringify(v[0])); + this.editTitle = this.selectNode.title; + this.searchForm.shopId = this.selectNode.id; + this.searchForm.pageNum = 1; + this.getDataList(); + } else { + this.cancelEdit(); + } + }, + cancelEdit() { + const data = this.$refs.tree.getSelectedNodes()[0]; + if (data) data.selected = false; + this.selectNode = {}; + this.editTitle = ""; + this.searchForm.shopId = ""; + this.data = []; + this.total = 0; + }, + changePage(v) { + this.searchForm.pageNum = v; + this.getDataList(); + }, + changePageSize(v) { + this.searchForm.pageSize = v; + this.searchForm.pageNum = 1; + this.getDataList(); + }, + handleSearch() { + this.searchForm.pageNum = 1; + this.getDataList(); + }, + handleReset() { + this.searchForm.keywords = ""; + this.searchForm.pageNum = 1; + this.getDataList(); + }, + getDataList() { + if (!this.searchForm.shopId) { + this.$Message.warning("请先选择商家"); + return; + } + this.loading = true; + getShareList({ + shopId: this.searchForm.shopId, + keywords: this.searchForm.keywords, + pageNum: this.searchForm.pageNum, + pageSize: this.searchForm.pageSize, + delFlag: 1, + }).then((res) => { + this.loading = false; + if (res.success) { + this.data = res.result.records || []; + this.total = res.result.total || 0; + } + }).catch(() => { + this.loading = false; + }); + }, + getOriginalPrice(row) { + if (!row || !row.attributeListPrice) return row && row.price ? row.price : ""; + try { + const specs = typeof row.attributeListPrice === "string" ? JSON.parse(row.attributeListPrice) : row.attributeListPrice; + if (Array.isArray(specs) && specs.length > 0) return specs[0].specPrice || row.price || ""; + for (const key in specs) { + return specs[key].specPrice || row.price || ""; + } + } catch (e) { + return row.price || ""; + } + return row.price || ""; + }, + changeDate(v) { + this.dateRange = v; + this.addForm.startTime = v && v[0] ? v[0] : null; + this.addForm.endTime = v && v[1] ? v[1] : null; + }, + openAdd(row) { + const originalPrice = Number(this.getOriginalPrice(row) || 0); + this.addForm = { + categoryId: this.category.id, + productId: row.id, + productName: row.productName, + originalPrice: originalPrice, + seckillPrice: originalPrice ? originalPrice.toFixed(2) : "", + totalStock: 1, + limitNum: 0, + orderFiled: 0, + status: 1, + getAreaId: this.selectNode.regionId || this.regionId, + startTime: null, + endTime: null, + remark: "", + }; + this.dateRange = []; + this.addVisible = true; + }, + submitAdd() { + const seckillPrice = Number(this.addForm.seckillPrice); + if (!seckillPrice || seckillPrice <= 0) { + this.$Message.warning("秒杀价格必须大于0"); + return; + } + if (!this.addForm.totalStock || this.addForm.totalStock <= 0) { + this.$Message.warning("秒杀库存必须大于0"); + return; + } + this.addForm.seckillPrice = seckillPrice; + this.submitLoading = true; + addSeckillProduct(this.addForm).then((res) => { + this.submitLoading = false; + if (res.success) { + this.$Message.success("添加成功"); + this.addVisible = false; + this.$emit("on-submit", true); + } + }).catch(() => { + this.submitLoading = false; + }); + }, + }, + mounted() { + const height = document.documentElement.clientHeight; + this.maxHeight = Number(height - 287) + "px"; + }, +}; + diff --git a/vue.config.js b/vue.config.js index 1b53647..172842c 100644 --- a/vue.config.js +++ b/vue.config.js @@ -4,7 +4,7 @@ module.exports = { publicPath: '/', devServer: { host: '127.0.0.1', - port: 8888, + port: 8889, proxy: { '/hiver': { // target: 'https://hbkuaishi.com', // 正式1