|
@@ -43,9 +43,18 @@
|
|
|
></el-switch>
|
|
></el-switch>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
|
|
+ <!-- 编辑 -->
|
|
|
|
|
+ <template #slot-modify="{scope}">
|
|
|
|
|
+ <el-button type="text" @click="modifyBtnFn(scope.row)">编辑</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <!-- 删除 -->
|
|
|
|
|
+ <template #slot-del="{scope}">
|
|
|
|
|
+ <el-button type="text" @click="delBtnFn(scope.row)">删除</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
<!-- 添加 -->
|
|
<!-- 添加 -->
|
|
|
<template #slot-add-ad-btn="{scope}">
|
|
<template #slot-add-ad-btn="{scope}">
|
|
|
- <el-button type="primary" size="mini" @click="changeStatus">添加</el-button>
|
|
|
|
|
|
|
+ <el-button type="primary" size="mini" @click="addBtnFn">添加</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</cl-crud>
|
|
</cl-crud>
|
|
|
<!-- 新增弹窗 -->
|
|
<!-- 新增弹窗 -->
|
|
@@ -74,7 +83,7 @@
|
|
|
<el-col :span="11">
|
|
<el-col :span="11">
|
|
|
<el-date-picker
|
|
<el-date-picker
|
|
|
type="date"
|
|
type="date"
|
|
|
- placeholder="选择日期"
|
|
|
|
|
|
|
+ placeholder="选择开始日期"
|
|
|
v-model="adForm.startTime"
|
|
v-model="adForm.startTime"
|
|
|
value-format="yyyy-MM-dd"
|
|
value-format="yyyy-MM-dd"
|
|
|
style="width: 100%;"
|
|
style="width: 100%;"
|
|
@@ -84,7 +93,7 @@
|
|
|
<el-col :span="11">
|
|
<el-col :span="11">
|
|
|
<el-date-picker
|
|
<el-date-picker
|
|
|
type="date"
|
|
type="date"
|
|
|
- placeholder="选择日期"
|
|
|
|
|
|
|
+ placeholder="选择结束日期"
|
|
|
v-model="adForm.endTime"
|
|
v-model="adForm.endTime"
|
|
|
value-format="yyyy-MM-dd"
|
|
value-format="yyyy-MM-dd"
|
|
|
style="width: 100%;"
|
|
style="width: 100%;"
|
|
@@ -109,7 +118,7 @@
|
|
|
<template v-if="adForm.style == 0">
|
|
<template v-if="adForm.style == 0">
|
|
|
<div>
|
|
<div>
|
|
|
<el-input
|
|
<el-input
|
|
|
- v-model="appendForm.url"
|
|
|
|
|
|
|
+ v-model="adForm.url"
|
|
|
placeholder="请填写链接,留空点图片不跳转"
|
|
placeholder="请填写链接,留空点图片不跳转"
|
|
|
size="small"
|
|
size="small"
|
|
|
></el-input>
|
|
></el-input>
|
|
@@ -117,9 +126,26 @@
|
|
|
</template>
|
|
</template>
|
|
|
<template v-else>
|
|
<template v-else>
|
|
|
<div>
|
|
<div>
|
|
|
- <el-button type="primary" size="small" @click="selGoods"
|
|
|
|
|
- >选择商品</el-button
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <div class="goods-list-wrap" v-if="!$util.isEmpty(goodsData)">
|
|
|
|
|
+ <div class="goods-list">
|
|
|
|
|
+ <div class="list-img">
|
|
|
|
|
+ <img
|
|
|
|
|
+ :src="goodsData.imgUrl"
|
|
|
|
|
+ alt="商品图片"
|
|
|
|
|
+ mode="center"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="list-right">
|
|
|
|
|
+ <div>{{ goodsData.goodsName }}</div>
|
|
|
|
|
+ <div class="app-price">¥{{ goodsData.price }}</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <el-button type="primary" size="small" @click="selGoods"
|
|
|
|
|
+ >选择商品</el-button
|
|
|
|
|
+ >
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -130,11 +156,22 @@
|
|
|
<el-button type="primary" size="small" @click="addFn">确认</el-button>
|
|
<el-button type="primary" size="small" @click="addFn">确认</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
+ <!-- 选择商品 -->
|
|
|
|
|
+ <sel-Search
|
|
|
|
|
+ :show.sync="selGoodsModal"
|
|
|
|
|
+ @confirm="selGoodsConfirmFn"
|
|
|
|
|
+ @cancel="selGoodsModal = false"
|
|
|
|
|
+ ></sel-Search>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
|
+import selSearch from '@/components/module/sel-search';
|
|
|
export default {
|
|
export default {
|
|
|
|
|
+ name: 'list-ad',
|
|
|
|
|
+ components: {
|
|
|
|
|
+ selSearch
|
|
|
|
|
+ },
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
app: null,
|
|
app: null,
|
|
@@ -149,8 +186,10 @@ export default {
|
|
|
key: '0'
|
|
key: '0'
|
|
|
}
|
|
}
|
|
|
],
|
|
],
|
|
|
|
|
+ // 修改弹窗
|
|
|
|
|
+ modifyData: {},
|
|
|
// 新增弹窗
|
|
// 新增弹窗
|
|
|
- addDialog: true,
|
|
|
|
|
|
|
+ addDialog: false,
|
|
|
adForm: {
|
|
adForm: {
|
|
|
adName: '',
|
|
adName: '',
|
|
|
adImg: '',
|
|
adImg: '',
|
|
@@ -159,15 +198,46 @@ export default {
|
|
|
type: '1',
|
|
type: '1',
|
|
|
style: '0',
|
|
style: '0',
|
|
|
startTime: '',
|
|
startTime: '',
|
|
|
|
|
+ url: '',
|
|
|
endTime: ''
|
|
endTime: ''
|
|
|
},
|
|
},
|
|
|
- appendForm: {
|
|
|
|
|
- url: '',
|
|
|
|
|
- goodsId: ''
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 商品列表
|
|
|
|
|
+ selGoodsModal: false,
|
|
|
|
|
+ goodsData: {},
|
|
|
|
|
+ goodsList: []
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ // api
|
|
|
|
|
+ delBtnFn(item) {
|
|
|
|
|
+ this.$confirm('是否删除该广告?', '提示', {
|
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
|
+ type: 'warning'
|
|
|
|
|
+ })
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ this.$service.ad.delete({ id: item.id }).then(res => {
|
|
|
|
|
+ this.$message.success('删除成功!');
|
|
|
|
|
+ this.app.refresh({ type: this.tabIndex });
|
|
|
|
|
+ });
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch();
|
|
|
|
|
+ },
|
|
|
|
|
+ // operate
|
|
|
|
|
+ modifyBtnFn(item) {
|
|
|
|
|
+ this.modifyData = item;
|
|
|
|
|
+ this.addDialog = true;
|
|
|
|
|
+ let data = JSON.parse(JSON.stringify(item));
|
|
|
|
|
+ data.startTime = this.$util.$formatDate(data.startTime);
|
|
|
|
|
+ data.endTime = this.$util.$formatDate(data.endTime);
|
|
|
|
|
+ if (this.$util.isEmpty(data)) return;
|
|
|
|
|
+ Object.keys(data).forEach((i, index) => {
|
|
|
|
|
+ this.adForm[i] = data[i];
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ addBtnFn() {
|
|
|
|
|
+ this.addDialog = true;
|
|
|
|
|
+ },
|
|
|
handleClick(tab, e) {
|
|
handleClick(tab, e) {
|
|
|
this.app.refresh({ type: this.tabIndex });
|
|
this.app.refresh({ type: this.tabIndex });
|
|
|
},
|
|
},
|
|
@@ -184,9 +254,9 @@ export default {
|
|
|
let form = JSON.parse(JSON.stringify(this.adForm));
|
|
let form = JSON.parse(JSON.stringify(this.adForm));
|
|
|
form.type = this.tabIndex;
|
|
form.type = this.tabIndex;
|
|
|
if (form.style == '0') {
|
|
if (form.style == '0') {
|
|
|
- form.url = this.appendForm.url;
|
|
|
|
|
|
|
+ form.url = '';
|
|
|
} else {
|
|
} else {
|
|
|
- form.goodsId = this.appendForm.goodsId;
|
|
|
|
|
|
|
+ form.goodsId = this.goodsData.id;
|
|
|
}
|
|
}
|
|
|
this.$service.ad.add(form).then(res => {
|
|
this.$service.ad.add(form).then(res => {
|
|
|
this.$message.success('操作成功!');
|
|
this.$message.success('操作成功!');
|
|
@@ -194,7 +264,14 @@ export default {
|
|
|
this.app.refresh({ type: this.tabIndex });
|
|
this.app.refresh({ type: this.tabIndex });
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
- selGoods() {},
|
|
|
|
|
|
|
+ // 选择商品
|
|
|
|
|
+ selGoods() {
|
|
|
|
|
+ this.selGoodsModal = true;
|
|
|
|
|
+ },
|
|
|
|
|
+ selGoodsConfirmFn(item) {
|
|
|
|
|
+ this.goodsData = item;
|
|
|
|
|
+ this.selGoodsModal = false;
|
|
|
|
|
+ },
|
|
|
// cl-crud 组件ad
|
|
// cl-crud 组件ad
|
|
|
onLoad({ ctx, app }) {
|
|
onLoad({ ctx, app }) {
|
|
|
this.app = app;
|
|
this.app = app;
|
|
@@ -249,7 +326,7 @@ export default {
|
|
|
label: '操作'
|
|
label: '操作'
|
|
|
},
|
|
},
|
|
|
// 布局,请移步 `layout`
|
|
// 布局,请移步 `layout`
|
|
|
- layout: ['slot-column-redeem']
|
|
|
|
|
|
|
+ layout: ['slot-modify', 'slot-del']
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
.set('layout', [
|
|
.set('layout', [
|
|
@@ -267,4 +344,25 @@ export default {
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
// module
|
|
// module
|
|
|
|
|
+.ad-modal-content {
|
|
|
|
|
+ .goods-list-wrap {
|
|
|
|
|
+ .goods-list {
|
|
|
|
|
+ @include disFlex(center, flex-start);
|
|
|
|
|
+ margin-bottom: 10px;
|
|
|
|
|
+ .list-img {
|
|
|
|
|
+ width: 60px;
|
|
|
|
|
+ height: 60px;
|
|
|
|
|
+ margin-right: 10px;
|
|
|
|
|
+ img {
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ .list-right {
|
|
|
|
|
+ .app-price {
|
|
|
|
|
+ margin-top: 5px;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|