tianyi 3 weeks ago
parent
commit
5555bd1218
  1. 233
      src/views/app/business/lineManage/addEdit.vue
  2. 60
      src/views/app/business/lineManage/lineManage.vue

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

@ -11,7 +11,8 @@
<Col span="24">
<FormItem label="广告位置" prop="position">
<Select v-model="form.position" style="width:200px">
<Option v-for="item in dictData" :value="item.value" :key="item.value">{{ item.title }}</Option>
<Option v-for="item in dictData" :value="item.value" :key="item.value">{{ item.title }}
</Option>
</Select>
</FormItem>
</Col>
@ -19,16 +20,26 @@
<Row :gutter="32">
<Col span="12">
<FormItem label="商家名" prop="value">
<Select v-model="form.merchantId" filterable @on-change="checkShop" :remote-method="sreachShop" :loading="loading1">
<Option v-for="item in shopList" v-model="item.value" :key="item.value">{{ item.label }}</Option>
<Select v-model="form.merchantId" filterable @on-change="checkShop"
:remote-method="sreachShop" :loading="loading1">
<Option v-for="item in shopList" v-model="item.value" :key="item.value">{{ item.label }}
</Option>
</Select>
</FormItem>
</Col>
</Row>
<Row :gutter="32">
<Col span="24">
<FormItem label="广告图" prop="adImage">
<upload-pic-input v-model="form.adImage"></upload-pic-input>
<div v-for="(item,index) in adList" :key="index" style="display: flex;line-height: 30px;">
<upload-pic-input v-model="item.pic"></upload-pic-input>
<Icon @click="delOne(index)" type="ios-trash-outline" v-if="adList.length>1" size="30"
color="red" />
</div>
<div v-if="form.position == 'home_top'" style="margin-top:10px;" @click="addOne">
<Icon type="ios-add-circle-outline" size="30" color="#000" />
</div>
</FormItem>
</Col>
</Row>
@ -49,7 +60,8 @@
<Row :gutter="32">
<Col span="24">
<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 @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.productList1.productName}}</div>
<Icon type="ios-arrow-forward" size="24" style="line-height: 35px;" />
</div>
@ -58,19 +70,19 @@
</Row>
<Row :gutter="32" v-if="form.productList1.productName != ''">
<Col span="12">
<FormItem label="商品原价" prop="originalPrice">
<Input v-model="form.productList1.originalPrice" placeholder="请输入商品原价" />
</FormItem>
<FormItem label="商品原价" prop="originalPrice">
<Input v-model="form.productList1.originalPrice" placeholder="请输入商品原价" />
</FormItem>
</Col>
<Col span="12">
<FormItem label="商品拼团价格" prop="originalPrice">
<Input v-model="form.productList1.groupPrice" placeholder="请输入商品拼团价格" />
</FormItem>
<FormItem label="商品拼团价格" prop="originalPrice">
<Input v-model="form.productList1.groupPrice" placeholder="请输入商品拼团价格" />
</FormItem>
</Col>
<Col span="12">
<FormItem label="几人团" prop="originalPrice">
<Input type="number" v-model="form.productList1.groupMembers" placeholder="请输入商品拼团价格" />
</FormItem>
<FormItem label="几人团" prop="originalPrice">
<Input type="number" v-model="form.productList1.groupMembers" placeholder="请输入商品拼团价格" />
</FormItem>
</Col>
</Row>
</Form>
@ -118,9 +130,12 @@
},
data() {
return {
loading1:false,
aaVisiable:false,
shopList:[],
adList: [{
pic: ''
}],
loading1: false,
aaVisiable: false,
shopList: [],
roleList: [],
visible: this.value,
title: "",
@ -146,17 +161,17 @@
maxHeight: 510,
form: {
position: '',
sortOrder:"",
title:'',
adImage:'',
status:1,
regionId:JSON.parse(this.getStore("user")).departmentId,
merchantName:'',
merchantId:'',
merchantImage:'',
linkUrl:'/package1/group/groupBuySingle?type=shop&item=',
linkParams:'',
productList1:{
sortOrder: "",
title: '',
adImage: '',
status: 1,
regionId: JSON.parse(this.getStore("user")).departmentId,
merchantName: '',
merchantId: '',
merchantImage: '',
linkUrl: '/package1/group/groupBuySingle?type=shop&item=',
linkParams: '',
productList1: {
adId: "",
productImage: "",
productName: "",
@ -164,10 +179,10 @@
groupPrice: "",
groupMembers: ""
},
productList:[]
productList: []
},
searchForm: {
regionId:JSON.parse(this.getStore("userInfo")).departmentId,
regionId: JSON.parse(this.getStore("userInfo")).departmentId,
shopType: "",
shopArea: "",
pageNumber: 1,
@ -186,11 +201,24 @@
},
methods: {
init() {
},
addOne() {
let data = {
pic: ''
}
this.adList.push(data)
},
delOne(i) {
this.adList.splice(i, 1);
},
submit() {
this.form.productList.push(this.form.productList1)
this.form.linkUrl='/package1/group/groupBuySingle?type=shop&item='
this.form.linkUrl = '/package1/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.$refs.form.validate((valid) => {
if (valid) {
if (this.type == "1") {
@ -199,22 +227,22 @@
updateAD(this.form).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("操作成功");
this.$emit("on-submit", true);
this.form = {
position: '',
sortOrder:"",
title:'',
adImage:'',
status:1,
regionId:JSON.parse(this.getStore("user")).departmentId,
merchantName:'',
merchantId:'',
merchantImage:'',
linkUrl:'/package1/group/groupBuySingle?type=shop&item=',
linkParams:'',
productList1:{
sortOrder: "",
title: '',
adImage: '',
status: 1,
regionId: JSON.parse(this.getStore("user")).departmentId,
merchantName: '',
merchantId: '',
merchantImage: '',
linkUrl: '/package1/group/groupBuySingle?type=shop&item=',
linkParams: '',
productList1: {
adId: "",
productImage: "",
productName: "",
@ -222,7 +250,7 @@
groupPrice: "",
groupMembers: ""
},
productList:[]
productList: []
}
this.visible = false;
}
@ -233,22 +261,22 @@
addAD(this.form).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("操作成功");
this.$emit("on-submit", true);
this.form = {
position: '',
sortOrder:"",
title:'',
adImage:'',
status:1,
regionId:JSON.parse(this.getStore("user")).departmentId,
merchantName:'',
merchantId:'',
merchantImage:'',
linkUrl:'/package1/group/groupBuySingle?type=shop&item=',
linkParams:'',
productList1:{
sortOrder: "",
title: '',
adImage: '',
status: 1,
regionId: JSON.parse(this.getStore("user")).departmentId,
merchantName: '',
merchantId: '',
merchantImage: '',
linkUrl: '/package1/group/groupBuySingle?type=shop&item=',
linkParams: '',
productList1: {
adId: "",
productImage: "",
productName: "",
@ -256,7 +284,7 @@
groupPrice: "",
groupMembers: ""
},
productList:[]
productList: []
}
this.visible = false;
}
@ -265,9 +293,9 @@
}
});
},
checkGoods(){
checkGoods() {
let that = this;
if(this.form.merchantId == ''){
if (this.form.merchantId == '') {
this.$Message.warning("您还未选择商家");
return
}
@ -276,15 +304,15 @@
that.$refs.goodsPage.init(that.form.linkParams);
});
},
getGoods(v){
console.log('11111',v)
getGoods(v) {
console.log('11111', v)
this.form.productList1.productImage = v.productPicture
this.form.productList1.productName = v.productName
console.log('22222',this.form)
console.log('22222', this.form)
this.aaVisiable = false
},
sreachShop(v){
sreachShop(v) {
this.searchForm.keyWord = v
//
this.loading = true;
@ -292,28 +320,28 @@
this.loading = false;
if (res.success) {
this.shopList = res.result.content;
for(let i=0;i<this.shopList.length;i++){
for (let i = 0; i < this.shopList.length; i++) {
this.shopList[i].label = this.shopList[i].shopName
this.shopList[i].value = this.shopList[i].id
}
}
});
},
checkShop(v){
console.log("数据",v)
for(let i=0;i<this.shopList.length;i++){
if(this.shopList[i].id == v){
checkShop(v) {
console.log("数据", v)
for (let i = 0; i < this.shopList.length; i++) {
if (this.shopList[i].id == v) {
let data = {
products:this.shopList[i].products,
id:this.shopList[i].id,
shopName:this.shopList[i].shopName,
shopPhone:this.shopList[i].shopPhone,
shopAddress:this.shopList[i].shopAddress,
shopIcon:this.shopList[i].shopIcon,
shopScore:this.shopList[i].shopScore,
shopTypeTitle:this.shopList[i].shopTypeTitle,
saleCount:this.shopList[i].saleCount,
remark:this.shopList[i].remark,
products: this.shopList[i].products,
id: this.shopList[i].id,
shopName: this.shopList[i].shopName,
shopPhone: this.shopList[i].shopPhone,
shopAddress: this.shopList[i].shopAddress,
shopIcon: this.shopList[i].shopIcon,
shopScore: this.shopList[i].shopScore,
shopTypeTitle: this.shopList[i].shopTypeTitle,
saleCount: this.shopList[i].saleCount,
remark: this.shopList[i].remark,
}
this.form.linkParams = JSON.stringify(data)
this.form.merchantName = this.shopList[i].shopName
@ -322,15 +350,15 @@
}
}
this.form.productList1 = {
adId: this.form.productList1.adId,
productImage: "",
productName: "",
originalPrice: "",
groupPrice: "",
groupMembers: ""
adId: this.form.productList1.adId,
productImage: "",
productName: "",
originalPrice: "",
groupPrice: "",
groupMembers: ""
}
},
checkStatusLine(v){
checkStatusLine(v) {
this.form.position = v
console.log(v)
},
@ -358,40 +386,55 @@
if (this.type == "0" || this.type == "1") {
//
let data = this.data;
console.log('回显数据',data)
console.log('回显数据', data)
//
this.form = data;
//
if (this.form.adImage.indexOf(',') !== -1) {
// {pic: url}
this.adList = this.form.adImage
.split(',')
.filter(item => item.trim() !== '') //
.map(url => ({
pic: url.trim()
}));
} else {
//
this.adList = [{
pic: this.form.adImage.trim()
}];
}
getShopData(this.searchForm).then((res) => {
this.loading = false;
if (res.success) {
this.shopList = res.result.content;
for(let i=0;i<this.shopList.length;i++){
for (let i = 0; i < this.shopList.length; i++) {
this.shopList[i].label = this.shopList[i].shopName
this.shopList[i].value = this.shopList[i].id
}
}
});
if(data.productList.length>0){
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
groupMembers: data.productList[0].groupMembers
}
}else{
} else {
this.form.productList1 = {
adId: "",
productImage: "",
productName: "",
originalPrice: "",
groupPrice: "",
groupMembers:""
groupMembers: ""
}
}
}
this.$forceUpdate()
this.visible = value;

60
src/views/app/business/lineManage/lineManage.vue

@ -155,23 +155,49 @@
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);
},
},
});
//
const imageStr = params.row.adImage || '';
const imageUrls = imageStr.indexOf(',') !== -1
? imageStr.split(',').filter(item => item.trim() !== '').map(url => url.trim())
: [imageStr.trim()];
//
if (imageUrls.length === 0 || (imageUrls.length === 1 && imageUrls[0] === '')) {
return h('span', '无图片');
}
// img
const imgElements = imageUrls.map(url => {
return h('img', {
attrs: {
src: url,
},
style: {
cursor: "zoom-in",
width: "80px",
height: "60px",
margin: "10px 5px", //
"object-fit": "contain",
"border-radius": "4px",
"background": "#f5f5f5"
},
on: {
click: () => {
this.showPic(url); // URL
},
},
});
});
// div flex
return h('div', {
style: {
display: "flex",
"flex-wrap": "wrap",
"align-items": "center",
"gap": "8px"
}
}, imgElements);
},
},
{

Loading…
Cancel
Save