From 872c553dbb31d730cf0a62f03090d97797d60b1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=99=E5=90=8C=E5=AD=A6?= <2495967527@qq.com> Date: Wed, 4 Dec 2024 19:08:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=9A=E5=91=98=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modules/marketing.js | 18 + src/api/modules/pre-sale.js | 7 + src/router/full-routers.js | 79 +++ src/views/modules/marketing/level/index.vue | 166 ++++++ .../modules/marketing/points-mall/index.vue | 15 + .../modules/marketing/points-order/index.vue | 15 + .../marketing/points-setting/index.vue | 15 + src/views/modules/marketing/user/index.vue | 322 +++++++++++ src/views/modules/presale/products/index.vue | 23 +- .../presale/products/popup/add-or-update.vue | 501 ++++++++++++------ .../presale/products/popup/commodity.vue | 233 ++++---- 11 files changed, 1105 insertions(+), 289 deletions(-) create mode 100644 src/api/modules/marketing.js create mode 100644 src/views/modules/marketing/level/index.vue create mode 100644 src/views/modules/marketing/points-mall/index.vue create mode 100644 src/views/modules/marketing/points-order/index.vue create mode 100644 src/views/modules/marketing/points-setting/index.vue create mode 100644 src/views/modules/marketing/user/index.vue diff --git a/src/api/modules/marketing.js b/src/api/modules/marketing.js new file mode 100644 index 0000000..a28e6f5 --- /dev/null +++ b/src/api/modules/marketing.js @@ -0,0 +1,18 @@ +import $http from "@/utils/httpRequest.js"; + +export const marketing = { + marketingLevelPage: (data) => { + return $http.request({ + url: `/merchant-api/memberUnitMemberLevel/list`, + method: "post", + data, + }); + }, + marketingUserPage: (data) => { + return $http.request({ + url: `/merchant-api/memberUnitUser/page`, + method: "get", + params: data, + }); + }, +}; diff --git a/src/api/modules/pre-sale.js b/src/api/modules/pre-sale.js index 5886788..2e86144 100644 --- a/src/api/modules/pre-sale.js +++ b/src/api/modules/pre-sale.js @@ -16,4 +16,11 @@ export const preSale = { data, }); }, + updatePreSaleProducts: (data) => { + return $http.request({ + url: `/merchant-api/product/save/advance/sell`, + method: "post", + data, + }); + }, }; diff --git a/src/router/full-routers.js b/src/router/full-routers.js index d2603f3..6e48791 100644 --- a/src/router/full-routers.js +++ b/src/router/full-routers.js @@ -226,6 +226,85 @@ export default { }, ], }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "营销管理", + url: "", + perms: "", + type: 0, + elIcon: "el-icon-tickets", + orderNum: 0, + open: null, + list: [ + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "会员等级管理", + url: "marketing/level/index", + perms: "", + type: 1, + elIcon: "el-icon-user", + orderNum: 0, + open: null, + list: [], + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "用户管理", + url: "marketing/user/index", + perms: "", + type: 1, + elIcon: "el-icon-data-analysis", + orderNum: 0, + open: null, + list: [], + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "积分设置", + url: "marketing/points-setting/index", + perms: "", + type: 1, + elIcon: "el-icon-shopping-cart-full", + orderNum: 0, + open: null, + list: [], + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "积分商城", + url: "marketing/points-mall/index", + perms: "", + type: 1, + elIcon: "el-icon-shopping-cart-full", + orderNum: 0, + open: null, + list: [], + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "积分订单", + url: "marketing/points-order/index", + perms: "", + type: 1, + elIcon: "el-icon-shopping-cart-full", + orderNum: 0, + open: null, + list: [], + }, + ], + }, ], code: 0, permissions: [], diff --git a/src/views/modules/marketing/level/index.vue b/src/views/modules/marketing/level/index.vue new file mode 100644 index 0000000..e2e650f --- /dev/null +++ b/src/views/modules/marketing/level/index.vue @@ -0,0 +1,166 @@ + + + + + \ No newline at end of file diff --git a/src/views/modules/marketing/points-mall/index.vue b/src/views/modules/marketing/points-mall/index.vue new file mode 100644 index 0000000..4f13553 --- /dev/null +++ b/src/views/modules/marketing/points-mall/index.vue @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/src/views/modules/marketing/points-order/index.vue b/src/views/modules/marketing/points-order/index.vue new file mode 100644 index 0000000..6a41ab5 --- /dev/null +++ b/src/views/modules/marketing/points-order/index.vue @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/src/views/modules/marketing/points-setting/index.vue b/src/views/modules/marketing/points-setting/index.vue new file mode 100644 index 0000000..df61af2 --- /dev/null +++ b/src/views/modules/marketing/points-setting/index.vue @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/src/views/modules/marketing/user/index.vue b/src/views/modules/marketing/user/index.vue new file mode 100644 index 0000000..2ff124e --- /dev/null +++ b/src/views/modules/marketing/user/index.vue @@ -0,0 +1,322 @@ + + + + + \ No newline at end of file diff --git a/src/views/modules/presale/products/index.vue b/src/views/modules/presale/products/index.vue index 932c183..3d8fae9 100644 --- a/src/views/modules/presale/products/index.vue +++ b/src/views/modules/presale/products/index.vue @@ -336,7 +336,7 @@ export default { align: "center", field: "presalePrice", type: "jsx", - render: ({ row }) => { + render: ({ row }) => { if ( Math.min.apply( Math, @@ -512,29 +512,32 @@ export default { }; return (
- + 查看 - + 编辑 关闭 diff --git a/src/views/modules/presale/products/popup/add-or-update.vue b/src/views/modules/presale/products/popup/add-or-update.vue index ace4b01..392305a 100644 --- a/src/views/modules/presale/products/popup/add-or-update.vue +++ b/src/views/modules/presale/products/popup/add-or-update.vue @@ -70,7 +70,7 @@ > - + @@ -81,132 +81,255 @@ 选择是,用户可在付尾款前申请退定金(申请后自动退,无需审核),或付尾款时间结束后系统自动退定金 - + 点击请选择商品 备注:一次最多添加五个商品 - -
- 已选择商品 -
-
-
-
- 商品ID:{{ item.productId }} - 商品名称:{{ item.name }} -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
+ 已选择商品
- -
+
+
+
+ 商品ID:{{ item.productId }} + 商品名称:{{ item.name }} +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ 商品ID:{{ ruleForm.productId }} + 商品名称:{{ ruleForm.name }} +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
@@ -251,41 +374,56 @@ export default { orderTime: [], //订单支付时间 arrears: [], //尾款时间 delivery: [], //发货时间 - tableData: [ - { - date: "2016-05-03", - name: "王小虎", - address: "红", - isShow: false, - presalePrice: "", - }, - { - date: "2016-05-02", - name: "王小虎", - address: "弄", - isShow: false, - presalePrice: "", - }, - { - date: "2016-05-04", - name: "王小虎", - address: "8 弄", - isShow: true, - presalePrice: "", - }, - ], + tableData: [], rules: { - name: [{ required: true, message: "请输入属性名称", trigger: "blur" }], - value: [ + startTime: [ { required: true, - message: "请输入属性内容", - trigger: "blur", + message: "请选择支付时间", + trigger: ["blur", "change"], + }, + ], + balancePaymentStartTime: [ + { + required: true, + message: "请选择尾款支付时间", + trigger: "change", + }, + ], + estimatedStartDeliveryTime: [ + { + required: true, + message: "请选择预计发货时间", + trigger: "change", + }, + ], + isRefundEarnestMoney: [ + { + required: true, + message: "请选择定金可退", + trigger: "change", + }, + ], + presalePrice: [ + { + required: true, + message: "请输入预售价格", + trigger: ["blur", "change"], }, ], }, }; }, + watch: { + "modalConfig.show"(newVal) { + if (newVal) { + //关闭弹窗清空校验 + setTimeout(() => { + this.$refs.ruleForm.resetFields(); + }); + } + }, + }, methods: { queryTableData(pageNo, pageSize) {}, toggle(e) { @@ -303,6 +441,12 @@ export default { this.arrears = []; this.delivery = []; this.ruleForm = { + startTime: "", + endTime: "", + balancePaymentStartTime: "", + balancePaymentEndTime: "", + estimatedStartDeliveryTime: "", + estimatedEndDeliveryTime: "", productList: [], isRefundEarnestMoney: 1, //定金可退 1是 2否 }; @@ -319,15 +463,24 @@ export default { console.log(row.startTime, row.endTime); this.orderTime = [row.startTime, row.endTime]; this.arrears = [row.balancePaymentStartTime, row.balancePaymentEndTime]; - this.delivery = [row.estimatedStartDeliveryTime, row.estimatedEndDeliveryTime]; - this.ruleForm.productList = [ - { - productId: row.id, - name: row.name, - productSpecificationList: row.productSpecificationList, - }, + this.delivery = [ + row.estimatedStartDeliveryTime, + row.estimatedEndDeliveryTime, ]; - console.log(this.orderTime, this.arrears, this.delivery); + (this.ruleForm = { + productId: row.id, + advanceSellId: row.advanceSellId, + startTime: row.startTime, + name: row.name, + endTime: row.endTime, + balancePaymentStartTime: row.balancePaymentStartTime, + balancePaymentEndTime: row.balancePaymentEndTime, + estimatedStartDeliveryTime: row.estimatedStartDeliveryTime, + estimatedEndDeliveryTime: row.estimatedEndDeliveryTime, + isRefundEarnestMoney: row.isRefundEarnestMoney, + productSpecificationList: row.productSpecificationList, + }), + console.log(this.orderTime, this.arrears, this.delivery); // this.ruleForm = row; }, @@ -403,17 +556,31 @@ export default { type: "primary", // submit: true, handle: () => { - this.$api.preSale.addPreSaleProducts(this.ruleForm).then((res) => { - console.log("确认", res); - // this.toggle(); - }); - // console.log("确认", this.ruleForm); - // this.$refs.ruleForm.validate((valid) => { - // if (valid) { - // this.$emit("getAttribute", this.ruleForm); - // this.toggle(); - // } - // }); + if (this.isAdd) { + this.$refs.ruleForm.validate((valid) => { + if (valid) { + console.log(valid); + this.$api.preSale + .addPreSaleProducts(this.ruleForm) + .then((res) => { + this.$emit("queryList"); + this.toggle(); + }); + } + }); + } else { + this.$refs.ruleForm.validate((valid) => { + if (valid) { + console.log(valid); + this.$api.preSale + .updatePreSaleProducts(this.ruleForm) + .then((res) => { + this.$emit("queryList"); + this.toggle(); + }); + } + }); + } }, }, ]; diff --git a/src/views/modules/presale/products/popup/commodity.vue b/src/views/modules/presale/products/popup/commodity.vue index 616787f..f7d4012 100644 --- a/src/views/modules/presale/products/popup/commodity.vue +++ b/src/views/modules/presale/products/popup/commodity.vue @@ -7,32 +7,59 @@ :modalHandles="modalHandles" > @@ -49,15 +76,13 @@ export default { show: false, width: "1000px", }, + query: { + pageNumber: 1, + pageSize: 10, + }, + total: 0, modalData: {}, dataList: [], //表格数据 - tableProp: { - "auto-resize": true, - border: true, - height: "auto", - "row-id": "id", - "show-overflow": false, - }, selectList: [], formInline: {}, formList: { @@ -66,27 +91,26 @@ export default { }; }, methods: { - queryList(pageNo, pageSize) { + queryList() { this.$api.mer_admin .getProductPage({ p: { - pageNumber: pageNo, - pageSize: pageSize, + pageNumber: this.query.pageNumber, + pageSize: this.query.pageSize, }, ...this.formInline, + ...this.formList, productFilterType: "SALE", merchantId: JSON.parse(sessionStorage.getItem("userInfo")).merchantId, productQuerySortParam: [], }) .then((res) => { console.log(res); - this.$refs.oTable.complete( - res.data.data.data, - Number(res.data.data.total) - ); + this.dataList = res.data.data.data; + this.total = Number(res.data.data.total); }) .catch((err) => { - this.$refs.oTable.complete(false); + this.dataList = []; }); }, toggle(e) { @@ -104,7 +128,7 @@ export default { this.formInline = row; this.isAdd = true; this.$nextTick(() => { - this.$refs.oTable.reload(); + this.queryList(); }); }, update: () => { @@ -113,77 +137,54 @@ export default { }; }, init(row) {}, + toggleSelection(rows) { + if (rows) { + rows.forEach((row) => { + this.$refs.multipleTable.toggleRowSelection(row); + }); + } else { + this.$refs.multipleTable.clearSelection(); + } + }, + select(selection, row) { + if (selection.length > 5) { + this.$message.error("最多选择5个商品"); + this.$refs.multipleTable.toggleRowSelection(row, false); + } else { + this.selectList = selection; + } + }, + selectAll(selection) { + if (selection.length > 5) { + this.$message.error("最多选择5个商品"); + selection.length = 5; + this.selectList = selection; + console.log(selection); + } else { + this.selectList = selection; + } + }, + getSalePrice(row) { + if (row.minSalePrice == row.maxSalePrice) { + return row.minSalePrice; + } else { + return `${row.minSalePrice}~${row.maxSalePrice}`; + } + }, + handleSizeChange(val) { + this.query.pageSize = val; + this.getList(); + }, + handleCurrentChange(val) { + this.query.pageNumber = val; + this.getList(); + }, + Reset() { + this.formList = {}; + this.queryList(); + }, }, computed: { - tableCols() { - return [ - { type: "checkbox", width: "60px", fixed: "left" }, - { - title: "商品图", - field: "productPhotoList", - align: "center", - width: "100px", - type: "jsx", - render: ({ row }) => { - if (row.productPhotoList.length > 0) { - return ( - { - return item.url; - })} - src={row.productPhotoList[0].url} - > - ); - } else { - return 暂无商品图; - } - }, - }, - { - title: "商品名称", - align: "center", - field: "name", - }, - { - title: "商品售价", - align: "center", - field: "minSalePrice", - type: "jsx", - render: ({ row }) => { - if (row.minSalePrice == row.maxSalePrice) { - return ¥{row.minSalePrice}; - } else { - return ( - - ¥{row.minSalePrice}~¥{row.maxSalePrice} - - ); - } - }, - }, - { - title: "折扣", - align: "center", - field: "discountActivity", - type: "jsx", - render: ({ row }) => { - if (row.discountActivity) { - return {row.discountActivity.ruleObject.discount}折; - } - }, - }, - { - title: "销量", - align: "center", - field: "saleNum", - }, - { - title: "库存", - align: "center", - field: "stockNum", - }, - ]; - }, modalHandles() { return [ { @@ -205,10 +206,15 @@ export default { tableEvent() { return { "checkbox-all": ({ records, reserves }) => { + console.log(records, reserves); this.selectList = [...records, ...reserves]; }, "checkbox-change": ({ records, reserves }) => { - console.log(this.selectList, "2"); + console.log(records, reserves); + if (records.length > 5) { + this.$message.error("最多选择5个商品"); + return; + } this.selectList = [...records, ...reserves]; }, }; @@ -217,5 +223,8 @@ export default { }; - \ No newline at end of file