From 6c8150d4dfa121461d2df77bc93afb45badf7e67 Mon Sep 17 00:00:00 2001 From: tianyi <13521030702@163.com> Date: Thu, 30 Apr 2026 10:31:07 +0800 Subject: [PATCH] 1 --- src/views/app/business/lineManage/addEdit.vue | 79 +++--- .../app/business/lineManage/dictManage.vue | 128 ++++++++++ .../app/business/lineManage/lineManage.vue | 62 +++++ src/views/my-components/hiver/dict.vue | 228 +++++++++--------- 4 files changed, 347 insertions(+), 150 deletions(-) create mode 100644 src/views/app/business/lineManage/dictManage.vue diff --git a/src/views/app/business/lineManage/addEdit.vue b/src/views/app/business/lineManage/addEdit.vue index c2ef62c..ee42dc2 100644 --- a/src/views/app/business/lineManage/addEdit.vue +++ b/src/views/app/business/lineManage/addEdit.vue @@ -10,10 +10,8 @@ - + @@ -21,8 +19,8 @@ - + @@ -50,28 +48,28 @@ - +
-
{{form.productList.productName}}
+
{{form.productList1.productName}}
- + - + - + - + @@ -122,7 +120,11 @@ return { aaVisiable:false, shopList:[], - dictDataLine: [{ + roleList: [], + visible: this.value, + title: "", + data: [], + dictData: [{ title: "首页顶部大广告位", value: 'home_top' }, { @@ -138,14 +140,9 @@ title: "首页中位右下", value: 'home_center_right_bottom' }], - roleList: [], - visible: this.value, - title: "", - data: [], passColor: "", submitLoading: false, maxHeight: 510, - form1:{}, form: { position: '', sortOrder:"", @@ -158,14 +155,15 @@ merchantImage:'', linkUrl:'/package1/group/groupBuySingle?type=shop&item=', linkParams:'', - productList:{ + productList1:{ adId: "", productImage: "", productName: "", originalPrice: "", groupPrice: "", groupMembers: "" - } + }, + productList:[] }, searchForm: { regionId:JSON.parse(this.getStore("userInfo")).departmentId, @@ -187,11 +185,11 @@ }, methods: { init() { - console.log(this.form1) - this.form.productList = {} - this.form.productList.adId = this.form1.id + }, submit() { + this.form.productList.push(this.form.productList1) + this.form.linkUrl='/package1/group/groupBuySingle?type=shop&item=' this.$refs.form.validate((valid) => { if (valid) { if (this.type == "1") { @@ -200,6 +198,7 @@ updateAD(this.form).then((res) => { this.submitLoading = false; if (res.success) { + this.form = {} this.$Message.success("操作成功"); this.$emit("on-submit", true); this.visible = false; @@ -211,6 +210,7 @@ addAD(this.form).then((res) => { this.submitLoading = false; if (res.success) { + this.form = {} this.$Message.success("操作成功"); this.$emit("on-submit", true); this.visible = false; @@ -221,19 +221,20 @@ }); }, checkGoods(){ + let that = this; if(this.form.merchantId == ''){ this.$Message.warning("您还未选择商家"); return } this.aaVisiable = true; this.$nextTick(() => { - this.$refs.goodsPage.init(this.form.linkParams); + that.$refs.goodsPage.init(that.form.linkParams); }); }, getGoods(v){ console.log('11111',v) - this.form.productList.productImage = v.productPicture - this.form.productList.productName = v.productName + this.form.productList1.productImage = v.productPicture + this.form.productList1.productName = v.productName console.log('22222',this.form) this.aaVisiable = false }, @@ -304,10 +305,31 @@ if (this.type == "0" || this.type == "1") { // 回显数据 let data = this.data; - + console.log('回显数据',data) // 回显 this.form = data; + if(data.productList.length>0){ + this.form.productList1 = { + adId: data.id, + productImage: data.productList[0].productImage, + productName: data.productList[0].productName, + originalPrice: data.productList[0].originalPrice, + groupPrice: data.productList[0].groupPrice, + groupMembers:data.productList[0].groupMembers + } + }else{ + this.form.productList1 = { + adId: "", + productImage: "", + productName: "", + originalPrice: "", + groupPrice: "", + groupMembers:"" + } + } + } + this.$forceUpdate() this.visible = value; }, }, @@ -319,9 +341,6 @@ this.$emit("input", value); }, }, - mounted() { - this.init(); - }, }; diff --git a/src/views/app/business/lineManage/dictManage.vue b/src/views/app/business/lineManage/dictManage.vue new file mode 100644 index 0000000..7188776 --- /dev/null +++ b/src/views/app/business/lineManage/dictManage.vue @@ -0,0 +1,128 @@ + + + \ No newline at end of file diff --git a/src/views/app/business/lineManage/lineManage.vue b/src/views/app/business/lineManage/lineManage.vue index c5b82b4..a7c752b 100644 --- a/src/views/app/business/lineManage/lineManage.vue +++ b/src/views/app/business/lineManage/lineManage.vue @@ -54,6 +54,8 @@ } from "@/api/app"; import addEdit from "@/views/app/business/lineManage/addEdit.vue"; import goodsList from "./dictManage.vue"; + import "viewerjs/dist/viewer.css"; + import Viewer from "viewerjs"; export default { name: "lineManage", components: { @@ -126,11 +128,51 @@ title: "商家主图", key: "merchantImage", minWidth: 250, + render: (h, params) => { + + return h("img", { + attrs: { + src: params.row.merchantImage, + }, + style: { + cursor: "zoom-in", + width: "80px", + height: "60px", + margin: "10px 0", + "object-fit": "contain", + }, + on: { + click: () => { + this.showPic(params.row.merchantImage); + }, + }, + }); + }, }, { title: "广告图片", key: "adImage", width: 100, + render: (h, params) => { + + return h("img", { + attrs: { + src: params.row.adImage, + }, + style: { + cursor: "zoom-in", + width: "80px", + height: "60px", + margin: "10px 0", + "object-fit": "contain", + }, + on: { + click: () => { + this.showPic(params.row.adImage); + }, + }, + }); + }, }, { title: "广告标题", @@ -163,6 +205,16 @@ title: "广告关联商品列表", key: "productList", width: 100, + // render: (h, params) => { + // let re = "" + // if(params.row.productList != ''){ + // re = params.row.productList[0].productName + // } + // return h( + // "div", + // re + // ); + // } }, { title: "操作", @@ -219,6 +271,16 @@ } }); }, + showPic(v) { + let image = new Image(); + image.src = v; + let viewer = new Viewer(image, { + hidden: function() { + viewer.destroy(); + }, + }); + viewer.show(); + }, handleReset() { this.$refs.searchForm.resetFields(); this.searchForm.pageNum = 1; diff --git a/src/views/my-components/hiver/dict.vue b/src/views/my-components/hiver/dict.vue index 7afb712..b7f6505 100644 --- a/src/views/my-components/hiver/dict.vue +++ b/src/views/my-components/hiver/dict.vue @@ -1,126 +1,114 @@ - + import { + getDictDataByType + } from "@/api/index"; + export default { + name: "dict", + props: { + value: "", + dict: String, + placeholder: { + type: String, + default: "请选择", + }, + placement: { + type: String, + default: "bottom-start", + }, + size: String, + multiple: { + type: Boolean, + default: false, + }, + disabled: { + type: Boolean, + default: false, + }, + filterable: { + type: Boolean, + default: false, + }, + transfer: { + type: Boolean, + default: false, + }, + transferClassName: String, + prefix: String, + maxTagCount: Number, + maxTagPlaceholder: Function, + clearable: { + type: Boolean, + default: true, + }, + }, + data() { + return { + currentValue: this.value, + dictData: [], + loading: false, + }; + }, + methods: { + getData(v) { + this.loading = true; + + getDictDataByType(v).then((res) => { + this.loading = false; + if (res.success) { + this.dictData = res.result; + } + }); + + }, + handleChange(v) { + this.$emit("input", v); + this.$emit("on-change", v); + }, + handleQueryChange(v) { + this.$emit("on-query-change", v); + }, + handleClear() { + this.$emit("on-clear", ""); + }, + handleOpenChange(v) { + this.$emit("on-open-change", v); + }, + handleSelect(v) { + this.$emit("on-select", v); + }, + setCurrentValue(value) { + if (value === this.currentValue) { + return; + } + this.currentValue = value; + this.$emit("on-change", this.currentValue); + }, + }, + watch: { + value(val) { + this.setCurrentValue(val); + }, + dict(val) { + this.getData(val); + }, + }, + mounted() { + this.getData(this.dict); + }, + }; + \ No newline at end of file