727 行
32 KiB
HTML
可执行文件
727 行
32 KiB
HTML
可执行文件
<!--[1.8.32]-->
|
||
<style>
|
||
.list-content {
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
height: 166px;
|
||
margin: 5px;
|
||
}
|
||
|
||
.list-title {
|
||
font-size: 14px;
|
||
color: #666;
|
||
}
|
||
|
||
.tips {
|
||
font-size: 12px;
|
||
color: #666;
|
||
padding-left: 5px;
|
||
}
|
||
</style>
|
||
<div id="bannerApp" v-cloak style="padding: 0 20px 20px">
|
||
<if condition="$authArr['setIcon'] eq true">
|
||
<div class="goodsBox">
|
||
<div class="goods_title" style="display: flex;align-items: center;">
|
||
<div class="goods_title_inner" style="width: auto">小图标设置</div>
|
||
<div class="tips">建议图片大小:90*90</div>
|
||
</div>
|
||
<div class="goods_table">
|
||
<form id="formIcon">
|
||
<p>注意:返回图标的设置在2.0.0版本及之后的版本将无效</p>
|
||
<div style="display: flex;flex-wrap: wrap;">
|
||
<div class="list-content">
|
||
<div class="list-title">电话图标:</div>
|
||
<label class="file_label" style="display: block">
|
||
<input type="hidden" name="home_tel_icon_id"/>
|
||
<input @change="changeIconImg('home_tel_icon')" type="file" name="home_tel_icon"
|
||
placeholder="选择图片"
|
||
accept="image/png,image/jpeg,image/gif"/>
|
||
<img style="max-width: 200px" src="{$icon['home_tel_icon']}"
|
||
onerror="this.error=null;this.src='__PUBLIC__/paper/images/wx_add.png'">
|
||
</label>
|
||
<el-button plain size="small" @click="selectBannerImage('home_tel_icon')"
|
||
>图库图标
|
||
<el-tooltip class="item" effect="dark" content="点击图片选择本地图片,点击按钮选择图库图片"
|
||
placement="top-start">
|
||
<i class="el-icon-question"></i>
|
||
</el-tooltip>
|
||
</el-button>
|
||
</div>
|
||
<div class="list-content">
|
||
<div class="list-title">返回图标:</div>
|
||
<label class="file_label" style="display: block">
|
||
<input type="hidden" name="home_back_icon_id"/>
|
||
<input @change="changeIconImg('home_back_icon')" type="file" name="home_back_icon"
|
||
placeholder="选择图片"
|
||
accept="image/png,image/jpeg,image/gif"/>
|
||
<img style="max-width: 200px" src="{$icon['home_back_icon']}"
|
||
onerror="this.error=null;this.src='__PUBLIC__/paper/images/wx_add.png'">
|
||
</label>
|
||
<el-button plain size="small" @click="selectBannerImage('home_back_icon')"
|
||
>图库图标
|
||
<el-tooltip class="item" effect="dark" content="点击图片选择本地图片,点击按钮选择图库图片"
|
||
placement="top-start">
|
||
<i class="el-icon-question"></i>
|
||
</el-tooltip>
|
||
</el-button>
|
||
</div>
|
||
<div class="list-content">
|
||
<div class="list-title">小程序客服图标:</div>
|
||
<label class="file_label" style="display: block">
|
||
<input type="hidden" name="home_support_icon_id"/>
|
||
<input @change="changeIconImg('home_support_icon')" type="file" name="home_support_icon"
|
||
placeholder="选择图片"
|
||
accept="image/png,image/jpeg,image/gif"/>
|
||
<img style="max-width: 200px" src="{$icon['home_support_icon']}"
|
||
onerror="this.error=null;this.src='__PUBLIC__/paper/images/wx_add.png'">
|
||
</label>
|
||
<el-button plain size="small" @click="selectBannerImage('home_support_icon')"
|
||
>图库图标
|
||
<el-tooltip class="item" effect="dark" content="点击图片选择本地图片,点击按钮选择图库图片"
|
||
placement="top-start">
|
||
<i class="el-icon-question"></i>
|
||
</el-tooltip>
|
||
</el-button>
|
||
</div>
|
||
</div>
|
||
<el-button type="primary" size="small" @click="saveIcon">保存</el-button>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
</if>
|
||
<div class="goodsBox">
|
||
<div class="goods_title">
|
||
<div class="goods_title_inner">
|
||
轮播图设置
|
||
</div>
|
||
</div>
|
||
<div style="margin-left: 30px;margin-bottom: 10px">
|
||
<if condition="$authArr['bannerSet'] eq true">
|
||
<el-button size="small" type="primary" @click="createBanner">新增轮播图</el-button>
|
||
</if>
|
||
</div>
|
||
<div style="margin: 0 30px;">
|
||
<el-table border :data="bannerList"
|
||
v-loading="loading" size="small"
|
||
element-loading-text="数据获取中"
|
||
element-loading-spinner="el-icon-loading"
|
||
style="width: calc(100vw - 208px);box-sizing: border-box;">
|
||
<el-table-column type="index" label="序号" width="50"></el-table-column>
|
||
<el-table-column prop="img" label="轮播图" show-overflow-tooltip>
|
||
<template slot-scope="scope">
|
||
<img style="max-height: 70px" :src="scope.row.imgurl">
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column prop="addtime" label="创建时间" show-overflow-tooltip></el-table-column>
|
||
<el-table-column prop="url_notes" label="跳转说明" show-overflow-tooltip></el-table-column>
|
||
<el-table-column prop="status" label="状态" show-overflow-tooltip>
|
||
|
||
<template slot-scope="scope">
|
||
<el-tooltip :content="scope.row.status==1?'点击关闭':'点击开启'" placement="top">
|
||
<el-switch @change="edit($event,scope.$index)"
|
||
:disabled="!changeBanner"
|
||
v-model="scope.row.status"
|
||
active-color="#13ce66"
|
||
inactive-color="#eeeeee"
|
||
active-value="1"
|
||
inactive-value="0">
|
||
</el-switch>
|
||
</el-tooltip>
|
||
</template>
|
||
|
||
</el-table-column>
|
||
<el-table-column fixed="right" label="操作" width="130" style="border-right: none;">
|
||
<template slot-scope="scope">
|
||
<if condition="$authArr['deleteBanner'] eq true">
|
||
<el-button size="small" @click="deleteBanner(scope.$index)" type="text">删除</el-button>
|
||
</if>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
<el-pagination
|
||
@size-change="handleSizeChange"
|
||
@current-change="handleCurrentChange"
|
||
:current-page="currentPage"
|
||
:page-sizes="[10, 15, 20, 25, 30, 35, 40, 45, 50]"
|
||
:page-size="100"
|
||
layout="total, sizes, prev, pager, next, jumper"
|
||
:total="len">
|
||
</el-pagination>
|
||
</div>
|
||
</div>
|
||
<el-dialog title="添加轮播图" :modal-append-to-body="false"
|
||
:visible.sync="showAddImage" custom-class="select-image-el-dialog" :modal="true"
|
||
style="margin-left:200px;margin-right:30px;" id="loadingTwo">
|
||
<form id="formImg" style="padding-top: 20px">
|
||
<div class="gA_inner" style="width: 100%;justify-content: center;flex-direction: column;">
|
||
<label class="file_label" style="display: block;margin-bottom: 10px">
|
||
<input id="imgurl_id" type="hidden" name="imgurl_id"/>
|
||
<input @change="changeBannerImage" id="imgurl" type="file" name="imgurl" placeholder="选择图片"
|
||
accept="image/png,image/jpeg,image/gif"/>
|
||
<img id="newImg" style="width: 414px;height: 150px;max-height:150px;margin-right: 10px;"
|
||
src="__PUBLIC__/Retail/goods/banner_default.png">
|
||
</label>
|
||
<el-button plain size="small" @click="selectBannerImage('imgurl')"
|
||
>图库图片
|
||
<el-tooltip class="item" effect="dark" content="点击图片选择本地图片,点击按钮选择图库图片" placement="top-start">
|
||
<i class="el-icon-question"></i>
|
||
</el-tooltip>
|
||
</el-button>
|
||
</div>
|
||
<div class="tips" style="text-align: center;">建议图片大小:690*280</div>
|
||
<div class="gA_inner">
|
||
<div class="gA_inner_left">状态:</div>
|
||
<div class="gA_inner_right" style="font-size: 0;margin-left: 48px;">
|
||
<el-radio-group v-model="radio">
|
||
<el-radio name="status" :label="1">启用</el-radio>
|
||
<el-radio name="status" :label="0">禁用</el-radio>
|
||
</el-radio-group>
|
||
</div>
|
||
</div>
|
||
<div class="gA_inner">
|
||
<div class="gA_inner_left">跳转类型:</div>
|
||
<div class="gA_inner_right" style="font-size: 0;margin-left: 48px;">
|
||
<el-select v-model="jump_type" size="small" style="width:200px;" clearable placeholder="请选择"
|
||
@change="jumpChang">
|
||
<el-option label="商品分类" value="1"></el-option>
|
||
<el-option label="功能入口" value="2"></el-option>
|
||
</el-select>
|
||
</div>
|
||
</div>
|
||
<div class="gA_inner" v-if="jump_type == 1">
|
||
<div class="gA_inner_left">选择分类:</div>
|
||
<div class="gA_inner_right" style="font-size: 0;margin-left: 48px;">
|
||
<select-goods-category :user-type="2"
|
||
:store-id="store_id"
|
||
:category-id1.sync="class_id1"
|
||
:category-id2.sync="class_id2"
|
||
:category-id3.sync="class_id3"></select-goods-category>
|
||
</div>
|
||
</div>
|
||
<div class="gA_inner" v-if="jump_type == 2">
|
||
<div class="gA_inner_left">选择功能:</div>
|
||
<div class="gA_inner_right" style="font-size: 0;margin-left: 48px;">
|
||
<el-select v-model="jump_id" size="small" placeholder="请选择" :loading="url_loading"
|
||
style="width:200px;" @change="closeJumpUrl">
|
||
<el-option v-for="(val,index) in jump_url" :label="val.name" :value="val.id"
|
||
:key="index"></el-option>
|
||
</el-select>
|
||
</div>
|
||
</div>
|
||
<div class="gA_inner" v-if="jump_type == 2 && show_goods == true">
|
||
<div class="gA_inner_left">关联商品:</div>
|
||
<div class="gA_inner_right" style="font-size: 0;margin-left: 48px;">
|
||
<el-input v-model="goods_info.name" size="small" placeholder="请选择商品" readonly
|
||
style="width:200px;"></el-input>
|
||
<el-button type="primary" size="small" style="margin-left: 3px;" @click="getGoodsList">选择商品
|
||
</el-button>
|
||
</div>
|
||
</div>
|
||
<div class="center">
|
||
<el-button type="primary" size="medium" @click="saveImg">保存</el-button>
|
||
</div>
|
||
</form>
|
||
</el-dialog>
|
||
<!-- 选择商品 -->
|
||
<el-dialog title="选择商品" :modal-append-to-body="false"
|
||
:visible.sync="goods_dialog" custom-class="select-image-el-dialog" :modal="true" :top="'50px'"
|
||
style="margin-left:190px;">
|
||
<div style="margin-left: 30px;margin-bottom: 5px;">
|
||
<el-input v-model="keyword" placeholder="名称/货号/条码" size="small" style="width:200px;"></el-input>
|
||
<el-button type="primary" size="small" style="margin-left: 3px;" @click="searchGoods">搜索</el-button>
|
||
</div>
|
||
<div style="border: 1px solid #e6e6e6;margin: 0 30px;height: calc(100vh - 180px);">
|
||
<el-table border :data="goods" style="width: 100%;border: none;" height="calc(100vh - 180px)">
|
||
<el-table-column type="index" label="序号" width="50"></el-table-column>
|
||
<el-table-column prop="goods_name" label="商品名称" show-overflow-tooltip></el-table-column>
|
||
<el-table-column prop="good_image" label="商品图" show-overflow-tooltip>
|
||
<template slot-scope="scope">
|
||
<img style="max-height: 70px" :src="scope.row.good_image">
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column prop="goods_num" label="库存" show-overflow-tooltip></el-table-column>
|
||
<el-table-column fixed="right" label="操作" width="130" style="border-right: none;">
|
||
<template slot-scope="scope">
|
||
<el-button @click=" choose_goods(scope.row)" plain>选择</el-button>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
<el-pagination
|
||
@size-change="handleGoodsSizeChange"
|
||
@current-change="handleGoodsCurrentChange"
|
||
:current-page="page"
|
||
:page-sizes="[10, 15, 20, 25, 30, 35, 40, 45, 50]"
|
||
:page-size="limit"
|
||
layout="total, sizes, prev, pager, next, jumper"
|
||
:total="total">
|
||
</el-pagination>
|
||
</div>
|
||
</el-dialog>
|
||
<el-dialog title="选择图片" :modal-append-to-body="false"
|
||
:visible.sync="showSelectBannerImage" custom-class="select-image-el-dialog" :top="'10px'">
|
||
<template-select-image :can-select-num="1"
|
||
@selectfile="selectBannerFile"></template-select-image>
|
||
</el-dialog>
|
||
</div>
|
||
<script src="/Public/Retail/common/js/select-goods-category.js"></script>
|
||
<script type="text/javascript">
|
||
var bannerApp = new Vue({
|
||
el: '#bannerApp',
|
||
data: function () {
|
||
return {
|
||
changeBanner: "{$authArr['changeBanner']}" == 1 ? true : false,
|
||
loading: true,
|
||
store_id: localStorage.store_id,
|
||
showSelectBannerImage: false,
|
||
actFileBannerName: '',
|
||
title: '添加等级',
|
||
bannerList: [],
|
||
len: 0,
|
||
currentPage: 1,
|
||
currentLimit: 10,
|
||
showAddImage: false,
|
||
radio: 1,
|
||
class_loading: false, // 加载分类
|
||
goods_class: [], // 分类
|
||
url_loading: false, // 加载功能
|
||
jump_url: [],
|
||
show_goods: false, // 显示选择商品
|
||
goods_dialog: false, // 弹出层 商品
|
||
goods_loading: false, // 商品加载
|
||
page: 1,
|
||
limit: 10,
|
||
total: 0,
|
||
keyword: '',
|
||
goods: [], // 商品
|
||
jump_type: '', // 跳转类型
|
||
class_id: '', // 分类id
|
||
class_id1: '', // 分类id
|
||
class_id2: '', // 分类id
|
||
class_id3: '', // 分类id
|
||
jump_id: '', // 跳转功能id
|
||
goods_info: {
|
||
id: '', // 商品id
|
||
name: '', // 商品名称
|
||
},
|
||
|
||
}
|
||
},
|
||
methods: {
|
||
createBanner: function () {
|
||
this.showAddImage = true;
|
||
},
|
||
|
||
changeBannerImage: function () {
|
||
if (window.event.target.files.length) {
|
||
var that = this;
|
||
var imgObj = window.event.target.files[0];
|
||
var imgType = ['image/jpeg', 'image/jpg', 'image/png', 'image/gif'];
|
||
console.log(imgObj.type);
|
||
if (jQuery.inArray(imgObj.type, imgType) != -1) {
|
||
//是图片
|
||
var reader = new FileReader();
|
||
reader.readAsDataURL(imgObj);
|
||
reader.onload = function () {
|
||
$("#imgurl_id").val('');
|
||
$("#newImg").attr('src', this.result);
|
||
}
|
||
}
|
||
}
|
||
},
|
||
|
||
changeIconImg: function (name) {
|
||
if (window.event.target.files.length) {
|
||
var that = this;
|
||
var imgObj = window.event.target.files[0];
|
||
var imgType = ['image/jpeg', 'image/jpg', 'image/png', 'image/gif'];
|
||
console.log(imgObj.type);
|
||
if (jQuery.inArray(imgObj.type, imgType) != -1) {
|
||
//是图片
|
||
var reader = new FileReader();
|
||
reader.readAsDataURL(imgObj);
|
||
reader.onload = function () {
|
||
$("input[name='" + name + "_id']").val('');
|
||
$("input[name='" + name + "']").next('img').attr('src', this.result);
|
||
}
|
||
}
|
||
}
|
||
},
|
||
|
||
edit: function (val, index) {
|
||
console.log(val, index);
|
||
var that = this;
|
||
var bannerList = JSON.parse(JSON.stringify(this.bannerList));
|
||
that.$loading({
|
||
lock: true,
|
||
text: '切换中,请等待',
|
||
spinner: 'el-icon-loading',
|
||
background: 'rgba(255, 255, 255, 0.7)'
|
||
});
|
||
$.post("{:U('changeBanner')}", {
|
||
id: that.bannerList[index].id,
|
||
status: that.bannerList[index].status
|
||
}, function (res) {
|
||
that.$loading().close();
|
||
if (res.status == 1) {
|
||
that.$message({
|
||
type: 'success',
|
||
message: res.msg,
|
||
duration: 1000
|
||
});
|
||
} else {
|
||
bannerList[index].status = bannerList[index].status == 1 ? 0 : 1;
|
||
that.bannerList = [];
|
||
that.bannerList = bannerList;
|
||
that.$message({
|
||
type: 'warning',
|
||
message: res.msg
|
||
});
|
||
}
|
||
})
|
||
},
|
||
|
||
deleteBanner: function (index) {
|
||
var that = this;
|
||
console.log(index)
|
||
this.$confirm('确认删除该轮播图吗', '提示', {
|
||
confirmButtonText: '确定',
|
||
cancelButtonText: '取消',
|
||
type: 'info'
|
||
}).then(() => {
|
||
that.$loading({
|
||
lock: true,
|
||
text: '删除中,请等待',
|
||
spinner: 'el-icon-loading',
|
||
background: 'rgba(255, 255, 255, 0.7)'
|
||
});
|
||
$.post("{:U('deleteBanner')}", {
|
||
id: that.bannerList[index].id
|
||
}, function (res) {
|
||
that.$loading().close();
|
||
if (res.status == 1) {
|
||
that.$message({
|
||
type: 'success',
|
||
message: res.msg,
|
||
duration: 1000
|
||
});
|
||
var bannerList = JSON.parse(JSON.stringify(that.bannerList));
|
||
bannerList.splice(index, 1);
|
||
that.bannerList = [];
|
||
that.bannerList = bannerList;
|
||
that.len--;
|
||
} else {
|
||
that.$message({
|
||
type: 'warning',
|
||
message: res.msg
|
||
});
|
||
}
|
||
})
|
||
}).catch(() => {
|
||
});
|
||
},
|
||
|
||
handleSizeChange(val) {
|
||
this.currentLimit = val;//切换每页数量
|
||
this.currentPage = 1;
|
||
this.getData();
|
||
},
|
||
|
||
handleCurrentChange(val) {
|
||
this.currentPage = val;
|
||
this.getData();//切换页数
|
||
},
|
||
|
||
selectBannerFile: function (item) {
|
||
console.log(item);
|
||
this.showSelectBannerImage = false;
|
||
if (item.length) {
|
||
$("input[name='" + this.actFileBannerName + "']").val('');
|
||
$("input[name='" + this.actFileBannerName + "_id']").val(item[0].id);
|
||
$("input[name='" + this.actFileBannerName + "']").next('img').attr('src', item[0].path);
|
||
}
|
||
},
|
||
|
||
selectBannerImage: function (actName) {
|
||
this.actFileBannerName = actName;
|
||
this.showSelectBannerImage = true;
|
||
},
|
||
|
||
getData: function () {
|
||
var that = this;
|
||
$.post("{:U('bannerList')}", {
|
||
page: this.currentPage,
|
||
limit: this.currentLimit
|
||
}, function (res) {
|
||
that.loading = false;
|
||
if (res.status == 1) {
|
||
that.bannerList = [];
|
||
that.bannerList = res.data;
|
||
that.len = res.count;
|
||
// that.currentPage = that.currentPage + 1;
|
||
} else {
|
||
that.$message({
|
||
message: res.msg,
|
||
type: 'warning',
|
||
duration: 1000
|
||
});
|
||
}
|
||
})
|
||
},
|
||
|
||
saveIcon: function () {
|
||
var fd = new FormData(document.getElementById('formIcon'));
|
||
var that = this;
|
||
that.$loading({
|
||
lock: true,
|
||
text: '保存中,请等待',
|
||
spinner: 'el-icon-loading',
|
||
background: 'rgba(255, 255, 255, 0.7)'
|
||
});
|
||
$.ajax({
|
||
url: "{:U('setIcon')}",
|
||
type: "POST",
|
||
data: fd,
|
||
processData: false, // jQuery不要去处理发送的数据
|
||
contentType: false, // jQuery不要去设置Content-Type请求头
|
||
success: function (res) {
|
||
that.$loading().close();
|
||
if (res.status == 1) {
|
||
$("input[type='file']").val('');
|
||
that.$message({
|
||
type: 'success',
|
||
message: res.msg,
|
||
duration: 1000
|
||
});
|
||
} else {
|
||
that.$message({
|
||
type: 'error',
|
||
message: res.msg,
|
||
duration: 1000
|
||
});
|
||
}
|
||
}
|
||
})
|
||
},
|
||
|
||
saveImg () {
|
||
// 判断类型
|
||
if (parseInt(this.jump_type) == 1) {
|
||
// 判断分类
|
||
this.class_id = this.class_id3?this.class_id3:(this.class_id2?this.class_id2:(this.class_id1?this.class_id1:''))
|
||
if (!this.class_id) {
|
||
return this.$message.warning('请选择商品分类');
|
||
}
|
||
} else if (parseInt(this.jump_type) == 2) {
|
||
// 判断功能
|
||
if (!this.jump_id) {
|
||
return this.$message.warning('请选择功能');
|
||
}
|
||
var jump_url = this.jump_url;
|
||
for (var i = 0; i < jump_url.length; i++) {
|
||
if (jump_url[i].id == this.jump_id) {
|
||
if (jump_url[i].url == '/pages/details/details') {
|
||
// 判断商品
|
||
if (!this.goods_info.id) {
|
||
return this.$message.warning('请选择商品');
|
||
}
|
||
}
|
||
}
|
||
}
|
||
} else {
|
||
return this.$message.warning('请选择跳转类型');
|
||
}
|
||
const loading = this.$loading({
|
||
target: "#loadingTwo",
|
||
lock: true,
|
||
text: '保存中,请等待',
|
||
spinner: 'el-icon-loading',
|
||
background: 'rgba(255, 255, 255, 0.7)'
|
||
});
|
||
var fd = new FormData(document.getElementById('formImg'));
|
||
fd.append("jump_type", this.jump_type);
|
||
fd.append("class_id", this.class_id);
|
||
fd.append("jump_id", this.jump_id);
|
||
fd.append("goods_id", this.goods_info.id);
|
||
$.ajax({
|
||
url: "{:U('bannerSet')}",
|
||
type: "POST",
|
||
data: fd,
|
||
processData: false, // jQuery不要去处理发送的数据
|
||
contentType: false, // jQuery不要去设置Content-Type请求头
|
||
success: (res)=> {
|
||
loading.close();
|
||
this.showAddImage = false;
|
||
if (res.status == 1) {
|
||
this.$message({
|
||
type: 'success',
|
||
message: res.msg,
|
||
duration: 1000,
|
||
onClose: ()=> {
|
||
$("input[type='file']").val('');
|
||
this.currentPage = 1;
|
||
this.radio = 1;
|
||
$('#newImg').attr('src', '__PUBLIC__/Retail/goods/banner_default.png');
|
||
$('#imgurl').val('');
|
||
$('#imgurl_id').val(0);
|
||
this.getData();
|
||
}
|
||
});
|
||
} else {
|
||
this.$message.error(res.msg);
|
||
}
|
||
}
|
||
})
|
||
},
|
||
|
||
/**
|
||
* 跳转类型判断 jump_type==1时查询分类 ==2时查询功能入口
|
||
*/
|
||
jumpChang() {
|
||
// 判断
|
||
if (parseInt(this.jump_type) == 1) {
|
||
|
||
} else if (parseInt(this.jump_type) == 2) {
|
||
this.getXcxUrl();
|
||
} else {
|
||
this.empty_data();
|
||
}
|
||
},
|
||
|
||
/**
|
||
* 获取功能插件
|
||
*/
|
||
getXcxUrl() {
|
||
var vm = this;
|
||
vm.jump_id = '';
|
||
vm.jump_url = [];
|
||
vm.goods_info = {id: '', name: ''};
|
||
vm.url_loading = true;
|
||
$.ajax({
|
||
url: "{:U('get_magic_cube')}",
|
||
type: "post",
|
||
success: function (res) {
|
||
vm.url_loading = false;
|
||
if (res.status == 1) {
|
||
vm.jump_url = res.magic_cube;
|
||
} else {
|
||
vm.$message({
|
||
showClose: true,
|
||
message: res.msg,
|
||
type: 'error',
|
||
duration: 1000
|
||
});
|
||
}
|
||
}
|
||
})
|
||
},
|
||
|
||
/**
|
||
* 选择功能
|
||
*/
|
||
closeJumpUrl() {
|
||
var jump_url = this.jump_url;
|
||
for (var i = 0; i < jump_url.length; i++) {
|
||
if (jump_url[i].id == this.jump_id) {
|
||
this.show_goods = jump_url[i].url == '/pages/details/details' ? true : false;
|
||
}
|
||
}
|
||
},
|
||
|
||
/**
|
||
* 获取线上商品
|
||
*/
|
||
getGoodsList() {
|
||
var vm = this;
|
||
$.post("{:U('getOnlineGoods')}", {
|
||
page: vm.page,
|
||
limit: vm.limit,
|
||
keyword: vm.keyword,
|
||
}, function (res) {
|
||
vm.goods_loading = true;
|
||
if (res.status == 1) {
|
||
vm.total = res.count;
|
||
vm.goods = res.data;
|
||
vm.goods_dialog = true;
|
||
} else {
|
||
vm.$message({
|
||
showClose: true,
|
||
message: res.msg,
|
||
type: 'error',
|
||
duration: 1000
|
||
});
|
||
}
|
||
})
|
||
},
|
||
|
||
/**
|
||
* 搜索商品
|
||
*/
|
||
searchGoods() {
|
||
this.page = 1;
|
||
this.getGoodsList();
|
||
},
|
||
|
||
/**
|
||
* 切换每页数量
|
||
*/
|
||
handleGoodsSizeChange(val) {
|
||
this.limit = val;
|
||
this.page = 1;
|
||
this.getGoodsList();
|
||
},
|
||
|
||
/**
|
||
* 切换页数
|
||
*/
|
||
handleGoodsCurrentChange(val) {
|
||
this.page = val;
|
||
this.getGoodsList();
|
||
},
|
||
|
||
/**
|
||
* 选择商品
|
||
*/
|
||
choose_goods(data) {
|
||
this.goods_info = {
|
||
id: data.id,
|
||
name: data.goods_name
|
||
};
|
||
this.goods_dialog = false;
|
||
},
|
||
|
||
/**
|
||
* 关闭弹出
|
||
*/
|
||
empty_data() {
|
||
this.class_loading = false;
|
||
this.goods_class = [];
|
||
this.url_loading = false;
|
||
this.jump_url = [];
|
||
this.show_goods = false;
|
||
this.goods_dialog = false;
|
||
this.goods_loading = false;
|
||
this.page = 1;
|
||
this.limit = 10;
|
||
this.total = 0;
|
||
this.keyword = '';
|
||
this.goods = [];
|
||
this.jump_type = '';
|
||
this.class_id = '';
|
||
this.jump_id = '';
|
||
this.goods_info = {id: '', name: '',};
|
||
|
||
},
|
||
},
|
||
|
||
mounted: function () {
|
||
|
||
},
|
||
created: function () {
|
||
this.getData();
|
||
}
|
||
});
|
||
</script>
|
||
|
||
<!--</html>--> |