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

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

@ -11,7 +11,8 @@
<Col span="24"> <Col span="24">
<FormItem label="广告位置" prop="position"> <FormItem label="广告位置" prop="position">
<Select v-model="form.position" style="width:200px"> <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> </Select>
</FormItem> </FormItem>
</Col> </Col>
@ -19,16 +20,26 @@
<Row :gutter="32"> <Row :gutter="32">
<Col span="12"> <Col span="12">
<FormItem label="商家名" prop="value"> <FormItem label="商家名" prop="value">
<Select v-model="form.merchantId" filterable @on-change="checkShop" :remote-method="sreachShop" :loading="loading1"> <Select v-model="form.merchantId" filterable @on-change="checkShop"
<Option v-for="item in shopList" v-model="item.value" :key="item.value">{{ item.label }}</Option> :remote-method="sreachShop" :loading="loading1">
<Option v-for="item in shopList" v-model="item.value" :key="item.value">{{ item.label }}
</Option>
</Select> </Select>
</FormItem> </FormItem>
</Col> </Col>
</Row> </Row>
<Row :gutter="32"> <Row :gutter="32">
<Col span="24"> <Col span="24">
<FormItem label="广告图" prop="adImage"> <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> </FormItem>
</Col> </Col>
</Row> </Row>
@ -49,7 +60,8 @@
<Row :gutter="32"> <Row :gutter="32">
<Col span="24"> <Col span="24">
<FormItem label="广告关联商品" prop="productList1"> <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> <div style="flex: 1;">{{form.productList1.productName}}</div>
<Icon type="ios-arrow-forward" size="24" style="line-height: 35px;" /> <Icon type="ios-arrow-forward" size="24" style="line-height: 35px;" />
</div> </div>
@ -118,6 +130,9 @@
}, },
data() { data() {
return { return {
adList: [{
pic: ''
}],
loading1: false, loading1: false,
aaVisiable: false, aaVisiable: false,
shopList: [], shopList: [],
@ -187,10 +202,23 @@
methods: { methods: {
init() { init() {
},
addOne() {
let data = {
pic: ''
}
this.adList.push(data)
},
delOne(i) {
this.adList.splice(i, 1);
}, },
submit() { submit() {
this.form.productList.push(this.form.productList1) 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) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
if (this.type == "1") { if (this.type == "1") {
@ -362,6 +390,21 @@
// //
this.form = 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) => { getShopData(this.searchForm).then((res) => {
this.loading = false; this.loading = false;
if (res.success) { if (res.success) {

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

@ -155,23 +155,49 @@
width: 100, width: 100,
render: (h, params) => { render: (h, params) => {
return h("img", { //
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: { attrs: {
src: params.row.adImage, src: url,
}, },
style: { style: {
cursor: "zoom-in", cursor: "zoom-in",
width: "80px", width: "80px",
height: "60px", height: "60px",
margin: "10px 0", margin: "10px 5px", //
"object-fit": "contain", "object-fit": "contain",
"border-radius": "4px",
"background": "#f5f5f5"
}, },
on: { on: {
click: () => { click: () => {
this.showPic(params.row.adImage); this.showPic(url); // URL
}, },
}, },
}); });
});
// div flex
return h('div', {
style: {
display: "flex",
"flex-wrap": "wrap",
"align-items": "center",
"gap": "8px"
}
}, imgElements);
}, },
}, },
{ {

Loading…
Cancel
Save