tianyi 1 month ago
parent
commit
6c8150d4df
  1. 79
      src/views/app/business/lineManage/addEdit.vue
  2. 128
      src/views/app/business/lineManage/dictManage.vue
  3. 62
      src/views/app/business/lineManage/lineManage.vue
  4. 228
      src/views/my-components/hiver/dict.vue

79
src/views/app/business/lineManage/addEdit.vue

@ -10,10 +10,8 @@
<Row :gutter="32">
<Col span="24">
<FormItem label="广告位置" prop="position">
<Select ref="dep" @on-change="checkStatusLine" style="width:200px">
<Option v-for="(item, i) in dictDataLine" :key="i" :value="form.value">{{
item.title
}}</Option>
<Select v-model="form.position" style="width:200px">
<Option v-for="item in dictData" :value="item.value" :key="item.value">{{ item.title }}</Option>
</Select>
</FormItem>
</Col>
@ -21,8 +19,8 @@
<Row :gutter="32">
<Col span="12">
<FormItem label="商家名" prop="value">
<Select v-model="model" filterable @on-change="checkShop" @on-query-change="sreachShop">
<Option v-for="item in shopList" :value="item.value" :key="item.value">{{ item.label }}</Option>
<Select v-model="form.merchantId" filterable @on-change="checkShop" @on-query-change="sreachShop">
<Option v-for="item in shopList" v-model="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
</FormItem>
</Col>
@ -50,28 +48,28 @@
</Row>
<Row :gutter="32">
<Col span="24">
<FormItem label="广告关联商品" prop="productList">
<FormItem label="广告关联商品" prop="productList1">
<div @click="checkGoods" style="display: flex;height: 35px;width: 100%;border: 1px solid #eee;padding: 0 0 0 10px;border-radius: 5px;line-height: 35px;">
<div style="flex: 1;">{{form.productList.productName}}</div>
<div style="flex: 1;">{{form.productList1.productName}}</div>
<Icon type="ios-arrow-forward" size="24" style="line-height: 35px;" />
</div>
</FormItem>
</Col>
</Row>
<Row :gutter="32" v-if="form.productList.productName != ''">
<Row :gutter="32" v-if="form.productList1.productName != ''">
<Col span="12">
<FormItem label="商品原价" prop="originalPrice">
<Input v-model="form.productList.originalPrice" placeholder="请输入商品原价" />
<Input v-model="form.productList1.originalPrice" placeholder="请输入商品原价" />
</FormItem>
</Col>
<Col span="12">
<FormItem label="商品拼团价格" prop="originalPrice">
<Input v-model="form.productList.groupPrice" placeholder="请输入商品拼团价格" />
<Input v-model="form.productList1.groupPrice" placeholder="请输入商品拼团价格" />
</FormItem>
</Col>
<Col span="12">
<FormItem label="几人团" prop="originalPrice">
<Input type="number" v-model="form.productList.groupMembers" placeholder="请输入商品拼团价格" />
<Input type="number" v-model="form.productList1.groupMembers" placeholder="请输入商品拼团价格" />
</FormItem>
</Col>
</Row>
@ -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();
},
};
</script>

128
src/views/app/business/lineManage/dictManage.vue

@ -0,0 +1,128 @@
<template>
<div class="search">
<Card>
<Row type="flex" justify="space-between">
<Table :loading="loading" border :columns="columns" :data="data" :size="tableSize" sortable="custom"
ref="table"></Table>
<Row type="flex" justify="end" class="page">
<Page :current="searchForm.pageNum" :total="total" :page-size="searchForm.pageSize"
@on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]"
size="small" show-total show-elevator show-sizer></Page>
</Row>
</Col>
</Row>
</Card>
</div>
</template>
<script>
import {
getShareList
} from "@/api/app";
export default {
name: "dic-manage",
data() {
return {
searchForm:{
categoryId: "",
delFlag: 1,
pageNum: 1,
pageSize: "100",
shopId: ""
},
columns: [
//
{
type: "selection",
width: 60,
align: "center",
},
{
type: "index",
width: 60,
align: "center",
},
{
title: "图片",
key: "productPicture",
minWidth: 60,
render: (h, params) => {
return h("img", {
attrs: {
src: params.row.productPicture,
},
style: {
cursor: "zoom-in",
width: "80px",
height: "60px",
margin: "10px 0",
"object-fit": "contain",
},
on: {
click: () => {
this.showPic(params.row);
},
},
});
},
},
{
title: "名称",
key: "productName",
minWidth: 60,
},
{
title: "排名",
key: "orderFiled",
width: 100,
},
{
title: "操作",
key: "action",
width: 350,
align: "center",
fixed: "right",
render: (h, params) => {
return h("div", [
h(
"a", {
on: {
click: () => {
this.checkGoods(params.row);
},
},
},
"选择"
),
]);
},
},
],
data: [], //
total: 0, //
};
},
methods: {
init(v) {
console.log(v)
this.searchForm.shopId = JSON.parse(v).id
this.getDataList()
},
getDataList() {
getShareList(this.searchForm).then((res) => {
if (res.success) {
this.data = res.result.records;
this.total = res.result.total;
if (this.data.length == 0 && this.searchForm.pageNum > 1) {
this.searchForm.pageNum -= 1;
this.getDataList();
}
}
});
},
checkGoods(v){
this.$emit('on-submit1',v)
}
},
};
</script>

62
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;

228
src/views/my-components/hiver/dict.vue

@ -1,126 +1,114 @@
<template>
<div>
<Select
v-model="currentValue"
:size="size"
:loading="loading"
:placeholder="placeholder"
:multiple="multiple"
:disabled="disabled"
:filterable="filterable"
:transfer="transfer"
:clearable="clearable"
:placement="placement"
:transfer-class-name="transferClassName"
:prefix="prefix"
:max-tag-count="maxTagCount"
:max-tag-placeholder="maxTagPlaceholder"
@on-change="handleChange"
@on-query-change="handleQueryChange"
@on-clear="handleClear"
@on-open-change="handleOpenChange"
@on-select="handleSelect"
>
<Option v-for="(item, i) in dictData" :key="i" :value="item.value">{{
<div>
<Select v-model="currentValue" :size="size" :loading="loading" :placeholder="placeholder" :multiple="multiple"
:disabled="disabled" :filterable="filterable" :transfer="transfer" :clearable="clearable"
:placement="placement" :transfer-class-name="transferClassName" :prefix="prefix"
:max-tag-count="maxTagCount" :max-tag-placeholder="maxTagPlaceholder" @on-change="handleChange"
@on-query-change="handleQueryChange" @on-clear="handleClear" @on-open-change="handleOpenChange"
@on-select="handleSelect">
<Option v-for="(item, i) in dictData" :key="i" :value="item.value">{{
item.title
}}</Option>
</Select>
</div>
</Select>
</div>
</template>
<script>
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);
},
};
</script>
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);
},
};
</script>
Loading…
Cancel
Save