From 3bfa70b3e150cba8803c9ab9f8d1a2a909354c95 Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Sat, 29 Aug 2026 09:35:55 +0800 Subject: [PATCH] 1 --- src/api/index.js | 8 + src/views/app/business/lineManage/addEdit.vue | 127 ++++++++++++---- .../app/business/lineManage/lineManage.vue | 143 ++++++++++++++++-- .../app/business/logistics/logistics.vue | 51 +++++++ 4 files changed, 285 insertions(+), 44 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index dac322d..066442b 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -832,6 +832,14 @@ export const getBaseDeliveryFeeSetting = (params) => { export const saveBaseDeliveryFeeSetting = (params) => { return postBodyRequest('/mall/admin/seckillGroup/baseDeliveryFee/save', params) } +// 查询校区配送开关 +export const getShopAreaDeliverySwitch = (params) => { + return getRequest('/app/shopArea/deliverySwitch/get', params) +} +// 保存校区配送开关 +export const saveShopAreaDeliverySwitch = (params) => { + return postRequest('/app/shopArea/deliverySwitch/update', params) +} // 查询i/e审核管理配置 export const getIeAuditSetting = (params) => { return getRequest('/app/ie/admin/audit-setting', params) diff --git a/src/views/app/business/lineManage/addEdit.vue b/src/views/app/business/lineManage/addEdit.vue index 950e6bc..e6ed5f4 100644 --- a/src/views/app/business/lineManage/addEdit.vue +++ b/src/views/app/business/lineManage/addEdit.vue @@ -10,14 +10,15 @@ - + - + @@ -54,7 +55,7 @@ - +
- + @@ -124,6 +125,14 @@ type: String, default: "0", }, + scene: { + type: String, + default: "homeAd", + }, + homeCenterAdCount: { + type: Number, + default: 0, + }, }, data() { return { @@ -136,28 +145,20 @@ roleList: [], visible: this.value, title: "", + originalPosition: "", data: [], dictData: [{ title: "首页顶部大广告位", value: 'home_top' }, { - title: "首页中位左上", - value: 'home_center_left_top' - }, { - title: "首页中位左下", - value: 'home_center_left_bottom' - }, { - title: "首页中位右上", - value: 'home_center_right_top' - }, { - title: "首页中位右下", - value: 'home_center_right_bottom' + title: "首页广告位", + value: 'home_center' }], passColor: "", submitLoading: false, maxHeight: 510, form: { - position: '', + position: 'home_center', sortOrder: "", title: '', adImage: '', @@ -196,9 +197,38 @@ }, }; }, + computed: { + isHomePopup() { + return this.scene == "homePopup" || this.form.position == "home_popup"; + }, + }, methods: { init() { + }, + getDefaultForm() { + return { + position: this.scene == "homePopup" ? "home_popup" : 'home_center', + sortOrder: "", + title: this.scene == "homePopup" ? "首页弹窗" : '', + adImage: '', + status: 1, + regionId: JSON.parse(this.getStore("user")).departmentId, + merchantName: '', + merchantId: '', + merchantImage: '', + linkUrl: this.scene == "homePopup" ? '' : '/package2/group/groupBuySingle?type=shop&item=', + linkParams: '', + productList1: { + adId: "", + productImage: "", + productName: "", + originalPrice: "", + groupPrice: "", + groupMembers: "" + }, + productList: [] + } }, addOne() { let data = { @@ -209,13 +239,40 @@ delOne(i) { this.adList.splice(i, 1); }, + isHomeCenterPosition(position) { + return !!position && position != 'home_top' && position != 'home_popup'; + }, submit() { - this.form.productList = [] - this.form.productList.push(this.form.productList1) - this.form.linkUrl = '/package2/group/groupBuySingle?type=shop&item=' - this.form.adImage = '' - for (let i = 0; i < this.adList.length; i++) { - this.form.adImage += this.adList[i].pic + ',' + this.form.adImage = this.adList + .map(item => item.pic) + .filter(item => item != null && String(item).trim() != '') + .map(item => String(item).trim()) + .join(',') + if (this.isHomePopup) { + this.form.position = 'home_popup' + this.form.title = this.form.title || '首页弹窗' + this.form.merchantName = '' + this.form.merchantId = '' + this.form.merchantImage = '' + this.form.linkUrl = '' + this.form.linkParams = '' + this.form.productList = [] + } else { + if (this.isHomeCenterPosition(this.form.position)) { + const isNewHomeCenterAd = !this.isHomeCenterPosition(this.originalPosition) + if (isNewHomeCenterAd && this.homeCenterAdCount >= 10) { + this.$Message.warning("首页广告位最多添加10个"); + return; + } + this.form.position = 'home_center' + } + this.form.productList = [] + this.form.productList.push(this.form.productList1) + this.form.linkUrl = '/package2/group/groupBuySingle?type=shop&item=' + } + if (this.isHomePopup && !this.form.adImage) { + this.$Message.warning("请上传弹窗图片"); + return; } this.$refs.form.validate((valid) => { if (valid) { @@ -405,16 +462,26 @@ } // 清空数据 this.$refs.form.resetFields(); + this.originalPosition = ""; + this.form = this.getDefaultForm(); + this.adList = [{ + pic: '' + }]; if (this.type == "0" || this.type == "1") { // 回显数据 let data = this.data; + this.originalPosition = data.position || ""; // 回显 - this.form = data; + this.form = Object.assign(this.getDefaultForm(), data); + if (this.isHomeCenterPosition(this.form.position)) { + this.form.position = 'home_center'; + } // 判断字符串中是否包含逗号 - if (this.form.adImage.indexOf(',') !== -1) { + const adImage = this.form.adImage || ''; + if (adImage.indexOf(',') !== -1) { // 有逗号:先按逗号分割,再过滤掉空字符串或纯空白字符串,最后映射为 {pic: url} 对象数组 - this.adList = this.form.adImage + this.adList = adImage .split(',') .filter(item => item.trim() !== '') // 过滤掉空项 .map(url => ({ @@ -423,7 +490,7 @@ } else { // 没有逗号:整个字符串作为一个对象 this.adList = [{ - pic: this.form.adImage.trim() + pic: adImage.trim() }]; } getShopData(this.searchForm).then((res) => { @@ -436,7 +503,7 @@ } } }); - if (data.productList.length > 0) { + if (data.productList && data.productList.length > 0) { this.form.productList1 = { adId: data.id, productImage: data.productList[0].productImage, diff --git a/src/views/app/business/lineManage/lineManage.vue b/src/views/app/business/lineManage/lineManage.vue index d587382..2913fd1 100644 --- a/src/views/app/business/lineManage/lineManage.vue +++ b/src/views/app/business/lineManage/lineManage.vue @@ -5,10 +5,15 @@ @@ -66,6 +71,7 @@ data() { return { tableSize: "default", + activeTab: "homeAd", message: "", selectIndex: "", currentRow: {}, @@ -105,14 +111,10 @@ let re = "" if (params.row.position == 'home_top') { re = "首页顶部大广告位"; - } else if (params.row.position == 'home_center_left_top') { - re = "首页中位左上"; - } else if (params.row.position == 'home_center_left_bottom') { - re = "首页中位左下"; - } else if (params.row.position == 'home_center_right_top') { - re = "首页中位右上"; - } else if (params.row.position == 'home_center_right_bottom') { - re = "首页中位右下"; + } else if (params.row.position == 'home_popup') { + re = "首页弹窗"; + } else { + re = "首页广告位"; } return h( "div", @@ -234,7 +236,7 @@ width: 150, render: (h, params) => { let re = "" - if(params.row.productList != ''){ + if(params.row.productList && params.row.productList.length > 0){ re = params.row.productList[0].productName } return h( @@ -279,7 +281,100 @@ }, }, ], + popupColumns: [ + { + type: "index", + width: 60, + align: "center", + fixed: "left", + }, + { + title: "弹窗图片", + key: "adImage", + minWidth: 180, + render: (h, params) => { + const imageUrl = (params.row.adImage || '').split(',').filter(item => item.trim() !== '').map(url => url.trim())[0]; + if (!imageUrl) { + return h('span', '无图片'); + } + return h("img", { + attrs: { + src: imageUrl, + }, + style: { + cursor: "zoom-in", + width: "120px", + height: "80px", + margin: "10px 0", + "object-fit": "contain", + "border-radius": "6px", + background: "#f5f5f5" + }, + on: { + click: () => { + this.showPic(imageUrl); + }, + }, + }); + }, + }, + { + title: "排序值", + key: "sortOrder", + width: 100, + }, + { + title: "状态", + key: "status", + width: 100, + render: (h, params) => { + let re = "" + if (params.row.status == 0) { + re = "下架"; + } else if (params.row.status == 1) { + re = "上架"; + } + return h("div", re); + } + }, + { + title: "操作", + key: "action", + width: 200, + align: "center", + render: (h, params) => { + return h("div", [ + h( + "a", { + on: { + click: () => { + this.edit(params.row); + }, + }, + }, + "编辑" + ), + h("Divider", { + props: { + type: "vertical", + }, + }), + h( + "a", { + on: { + click: () => { + this.del(params.row); + }, + }, + }, + "删除" + ), + ]); + }, + }, + ], chooseColumns: [], + rawData: [], data: [], exportData: [], total: 0, @@ -287,6 +382,11 @@ rechargeVisiable: false, }; }, + computed: { + homeCenterAdCount() { + return (this.rawData || []).filter(item => this.isHomeCenterAd(item)).length; + }, + }, methods: { init() { this.getDataList(); @@ -299,17 +399,31 @@ changeTableSize(v) { this.tableSize = v; }, + changeAdTab() { + this.data = this.filterAdData(this.rawData); + }, changePageSize(v) { this.searchForm.pageSize = v; this.getDataList(); }, + filterAdData(list) { + const records = list || []; + if (this.activeTab == "homePopup") { + return records.filter(item => item.position == "home_popup"); + } + return records.filter(item => item.position != "home_popup"); + }, + isHomeCenterAd(item) { + return item && item.position != "home_top" && item.position != "home_popup"; + }, getDataList() { // 线路列表 this.loading = true; getADList(this.searchForm).then((res) => { this.loading = false; if (res.code == 200) { - this.data = res.result.records; + this.rawData = res.result.records || []; + this.data = this.filterAdData(this.rawData); } }); }, @@ -344,6 +458,7 @@ this.showCompany = true; }, add() { + this.form = {}; this.showType = "2"; this.showCompany = true; }, diff --git a/src/views/app/business/logistics/logistics.vue b/src/views/app/business/logistics/logistics.vue index 8c40cf9..b9f00fc 100644 --- a/src/views/app/business/logistics/logistics.vue +++ b/src/views/app/business/logistics/logistics.vue @@ -79,6 +79,7 @@ +
@@ -125,6 +126,22 @@
+
+
+ + + 开启 + 关闭 + +
+ 关闭后,用户在该校区外卖商家下单时只能选择到店消费。 +
+
+ + + +
+
@@ -248,6 +265,8 @@ saveCustomerPhoneSetting, getBaseDeliveryFeeSetting as getBaseDeliveryFeeSettingApi, saveBaseDeliveryFeeSetting as saveBaseDeliveryFeeSettingApi, + getShopAreaDeliverySwitch, + saveShopAreaDeliverySwitch, } from "@/api/index"; import addEdit from "./addEdit.vue"; import logisticsAddress from "@/views/app/business/logistics/logisticsAddress"; @@ -288,6 +307,7 @@ settingLoading: false, customerServiceLoading: false, baseDeliveryFeeLoading: false, + deliverySwitchLoading: false, transferOrder: false, workerOrderVisible: false, workerOrderTab: "daiqu", @@ -343,6 +363,10 @@ regionId: regionId, baseDeliveryFee: 0 }, + deliverySwitchForm: { + regionId: regionId, + deliveryEnabled: 1 + }, workerOrderForm: { pageNum: 1, pageSize: 10 @@ -414,6 +438,7 @@ this.getSetting(); this.getCustomerServiceSetting(); this.getBaseDeliveryFeeSetting(); + this.getDeliverySwitch(); }, buildWorkerColumns() { return [ { @@ -555,6 +580,10 @@ this.getBaseDeliveryFeeSetting(); return; } + if (v === "deliverySwitch") { + this.getDeliverySwitch(); + return; + } this.total = 0; this.data = []; const form = v === "hall" ? this.hallSearchForm : this.deliverySearchForm; @@ -1005,6 +1034,28 @@ this.baseDeliveryFeeLoading = false; }); }, + getDeliverySwitch() { + getShopAreaDeliverySwitch({ + regionId: this.deliverySwitchForm.regionId + }).then((res) => { + if (res.success) { + this.deliverySwitchForm.deliveryEnabled = res.result == null ? 1 : Number(res.result); + } + }); + }, + saveDeliverySwitch() { + this.deliverySwitchLoading = true; + saveShopAreaDeliverySwitch({ + regionId: this.deliverySwitchForm.regionId, + deliveryEnabled: this.deliverySwitchForm.deliveryEnabled + }).then((res) => { + if (res.success) { + this.$Message.success("保存成功"); + } + }).finally(() => { + this.deliverySwitchLoading = false; + }); + }, goTransferOrder(item) { if (!item || !item.workerId) { this.$Message.warning("请选择配送员");