917 行
38 KiB
HTML
可执行文件
917 行
38 KiB
HTML
可执行文件
<!--[1.6.48]-->
|
||
<link href="__PUBLIC__/user/css/customMenu.css" rel="stylesheet"/>
|
||
<style type="text/css">
|
||
.table-striped td {
|
||
padding-top: 10px;
|
||
padding-bottom: 10px
|
||
}
|
||
|
||
a {
|
||
font-size: 14px;
|
||
}
|
||
|
||
a:hover,
|
||
a:active {
|
||
text-decoration: none;
|
||
color: red;
|
||
}
|
||
|
||
.hover td {
|
||
padding-left: 10px;
|
||
}
|
||
|
||
.designer a {
|
||
border-left: 1px #DDD solid;
|
||
margin-left: 10px;
|
||
padding-left: 10px;
|
||
color: #333;
|
||
}
|
||
|
||
.modal-dialog .radio-inline {
|
||
width: 32.5%;
|
||
padding: 5px 0 5px 20px;
|
||
margin-left: 0;
|
||
}
|
||
|
||
.sonmenu {
|
||
margin-top: 20px;
|
||
padding-left: 80px;
|
||
}
|
||
|
||
.hide {
|
||
display: none;
|
||
}
|
||
|
||
.nav-pills > li.active > a, .nav-pills > li.active > a:hover, .nav-pills > li.active > a:focus {
|
||
color: white !important;
|
||
background-color: #009688 !important;
|
||
}
|
||
|
||
.a {
|
||
color: #009688 !important;
|
||
}
|
||
|
||
.modal-footer > a {
|
||
color: white !important;
|
||
background-color: #009688 !important;
|
||
border: 1px solid #009688;
|
||
}
|
||
|
||
.modal-footer > a:active, .modal-footer > a:hover {
|
||
color: white !important;
|
||
background-color: #009688 !important;
|
||
border: 1px solid #009688;
|
||
}
|
||
|
||
.cri0, .cri2 {
|
||
display: block;
|
||
}
|
||
|
||
.cri1_a01_d {
|
||
width: 25%
|
||
}
|
||
|
||
.cri1_a02_d {
|
||
width: 25%
|
||
}
|
||
|
||
.cri_b_left01 img {
|
||
width: 100px;
|
||
height: 100px
|
||
}
|
||
|
||
.getVipUrl {
|
||
display: inline-block;
|
||
background-color: #009688;
|
||
color: white;
|
||
padding: 10px;
|
||
border-radius: 3px;
|
||
margin-left: 154px;
|
||
margin-top: 10px;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.getVipUrl:active {
|
||
transform: scale(0.98);
|
||
background-color: rgba(0, 150, 136, 0.8);
|
||
}
|
||
|
||
.active {
|
||
border-color: #409EFF;
|
||
}
|
||
|
||
.custom_right0402 {
|
||
color: #409EFF;
|
||
}
|
||
|
||
.custom_right01_del {
|
||
color: #409EFF;
|
||
}
|
||
|
||
.cri_cheak01 {
|
||
color: #409EFF;
|
||
border-bottom: 2px solid #409EFF;
|
||
}
|
||
|
||
.cri_cheak01:hover {
|
||
color: #409EFF;
|
||
border-bottom: 2px solid #409EFF;
|
||
}
|
||
|
||
.custom_left02_r02_c_t {
|
||
position: absolute;
|
||
transform: scale(0.9);
|
||
top: 0;
|
||
right: 0;
|
||
left: 0;
|
||
bottom: 0;
|
||
margin: auto;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.custom {
|
||
padding-left: 360px !important;
|
||
}
|
||
</style>
|
||
<div class="custom" id="myApp" v-cloak
|
||
v-loading="loading"
|
||
:element-loading-text="menuLoadingText"
|
||
element-loading-spinner="el-icon-loading">
|
||
<div class="custom_left">
|
||
<div class="custom_left01">{$storeconfig.name}</div>
|
||
<div class="custom_left02">
|
||
<div class="custom_left02_l">
|
||
<img src="__PUBLIC__/user/images/keyboard.png"/>
|
||
</div>
|
||
<div class="custom_left02_r">
|
||
<div class="custom_left02_r01" v-for="(item,key) in button">
|
||
<div :class="key==active&&findActive==-1?'active':''" @click="itemadd(key)"
|
||
class="custom_left02_r01_1">{{item.name}}
|
||
</div>
|
||
<div class="custom_left02_r02">
|
||
<div v-for="(items,keys) in item.sub_button"
|
||
class="custom_left02_r02_c"
|
||
:class="key==active&&keys==findActive?'active':''"
|
||
@click="findClick(key,keys)">
|
||
<span class="custom_left02_r02_c_t">{{items.name}}</span>
|
||
</div>
|
||
<div class="custom_left02_create2" v-show="button[key]['sub_button'].length<5"
|
||
@click="addFindmenu(key)">+添加子菜单
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="custom_left02_create" @click="addbutton" v-show="button.length<3">+添加菜单</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="custom_right">
|
||
<div class="custom_right01">
|
||
<span>自定义菜单</span>
|
||
<span class="custom_right01_del" @click="delmenu">删除菜单</span>
|
||
</div>
|
||
<div class="custom_right02">第一步:在左侧选择需要编辑的菜单,并对菜单进行命名</div>
|
||
<div class="custom_right03" v-if="!isFind">
|
||
<div class="custom_right03_l">主菜单名称</div>
|
||
<div class="custom_right03_r">
|
||
<div class="custom_right03_r01">
|
||
<input v-model="button[active]['name']"
|
||
oninput="value=getStrLen(this.value)>12?splitLenStr(this.value,12):this.value"
|
||
class="custom_name" type="text"
|
||
placeholder="请输入菜单名称"/>
|
||
</div>
|
||
<div class="custom_right03_r02">字数不超过6个汉字</div>
|
||
</div>
|
||
</div>
|
||
<div class="custom_right03" v-else>
|
||
<div class="custom_right03_l">子菜单名称</div>
|
||
<div class="custom_right03_r">
|
||
<div class="custom_right03_r01">
|
||
<el-input v-model="button[active]['sub_button'][findActive]['name']"
|
||
size="small"
|
||
oninput="value=getStrLen(this.value)>16?splitLenStr(this.value,16):this.value"
|
||
placeholder="请输入菜单名称"></el-input>
|
||
</div>
|
||
<div class="custom_right03_r02">字数不超过8个汉字</div>
|
||
</div>
|
||
</div>
|
||
<div v-if="isMenuConfig">
|
||
<div class="custom_right04">
|
||
<span>第二步:设置点击该菜单所触发的动作事件,如:领取卡券</span>
|
||
<span class="custom_right0402" @click="editMenu">修改菜单</span>
|
||
</div>
|
||
<div class="custom_right05_box" v-show="menuShow">
|
||
<div class="custom_right05">
|
||
<div class="custom_right05_inner" @click="sendMsg">
|
||
<img src="__PUBLIC__/user/images/messageSend.png"/>
|
||
<span>发送消息</span>
|
||
</div>
|
||
<!--<div class="custom_right05_inner02" @click="coupon">-->
|
||
<!--<img src="__PUBLIC__/user/images/coupons.png" />-->
|
||
<!--<span>优惠券</span>-->
|
||
<!--</div>-->
|
||
<div class="custom_right05_inner">
|
||
<img src="__PUBLIC__/user/images/url.png" @click="url"/>
|
||
<span>网址链接</span>
|
||
</div>
|
||
<div class="custom_right05_inner custom_right05_inner04" @click="showSelectLink = true">
|
||
<img src="__PUBLIC__/user/images/more.png"/>
|
||
<span>功能入口</span>
|
||
</div>
|
||
<div class="custom_right05_inner custom_right05_inner04" @click="showOtherSmallProgram = true">
|
||
<img src="__PUBLIC__/user/images/more.png"/>
|
||
<span>其他小程序入口</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="cri cri0" v-show="sendMsgShow">
|
||
<div class="cri_a">
|
||
<div class="cri_a01" :class="sourceActive==1?'cri_cheak01':''" @click="imgClick">图片</div>
|
||
<i></i>
|
||
<!--<div class="cri_a01 cri_a02" :class="sourceActive==2?'cri_cheak01':''" @click="newsClick">图文消息</div>-->
|
||
</div>
|
||
<div class="cri_b" v-show="sourceActive==1">
|
||
<div class="cri_b_left">
|
||
<div class="cri_b_left01">上传图片:</div>
|
||
<div class="cri_b_left02">
|
||
<button type="button" class="layui-btn layui-btn-warm" id="cri_b_right01">上传图片</button>
|
||
<button type="button" class="layui-btn layui-btn-warm" @click="delImg"
|
||
id="cri_b_right02">删除
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<div class="cri_b_right">
|
||
<img class="cri_b_right_img" :src="media_url" v-show="media_url"/>
|
||
</div>
|
||
</div>
|
||
<div class="cri_b" v-show="sourceActive==2">
|
||
<div class="cri_b_left01" style="margin-top: 0px">
|
||
<img class="cri_b_right_img" :src="newInfo['pic']" v-show="newInfo['pic']"/>
|
||
</div>
|
||
<div class="cri_b_right" style="width: 300px">
|
||
<h3>{{newInfo.title}}</h3>
|
||
<div>{{newInfo.desc}}</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="cri cri2" v-show="urlShow">
|
||
<div class="cri2Box">
|
||
<div class="cri2_a">页面网址</div>
|
||
<div class="cri2_b">
|
||
<div class="cri2_b01" style="width: 520px">
|
||
<input type="text" @blur="pageurl" v-model="pageUrls"
|
||
placeholder="例如:https://www.xxxxxxx.com"/>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<el-button style="margin-left: 154px;margin-top: 5px"
|
||
type="primary" size="small"
|
||
@click="showChooseVipPath=true">获取会员卡内部地址
|
||
</el-button>
|
||
</div>
|
||
<el-dialog title="选择会员卡内部地址"
|
||
:visible.sync="showChooseVipPath"
|
||
:close-on-click-modal="false"
|
||
:modal-append-to-body="false"
|
||
:append-to-body="false"
|
||
width="600px"
|
||
:close-on-press-escape="false">
|
||
<el-table border size="small" :data="vipPathList">
|
||
<el-table-column align="center" prop="name" label="页面" min-width="100"></el-table-column>
|
||
<el-table-column align="center" prop="path" label="地址" min-width="70"></el-table-column>
|
||
<el-table-column align="center" label="操作" min-width="90">
|
||
<template slot-scope="scope">
|
||
<el-button size="mini" type="primary" plain round @click="useVipPath(scope.row.path)">使用
|
||
</el-button>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
</el-dialog>
|
||
|
||
<div class="cri " style="padding-top:10px ">
|
||
<div class="cri1 selectcard">
|
||
<div class="cri1_a_box">
|
||
|
||
<div class="cri1_a" v-for="(wxitem,index) in wxCard">
|
||
<div class="cri1_a01">{{wxitem.title}}</div>
|
||
<div class="cri1_a02">{{wxitem.code_type}}</div>
|
||
<div class="cri1_a03">库 存: {{wxitem.quantity}}</div>
|
||
<div class="cri1_a04">有效期:{{wxitem.begin_time_stamp}} 至 {{wxitem.end_time_stamp}}</div>
|
||
<div class="cri1_a05">
|
||
<span v-if="cardSelected==index" class="cri1_a05_span"
|
||
@click="selectcard(index)">已选择</span>
|
||
<span v-else class="cri1_a05_span" @click="selectcard(index)">选择</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="cri1_b">
|
||
<div class="cri1_b_l">第 1 到 5 条, 共 1 条</div>
|
||
<div class="cri1_b_r">
|
||
<div class="cri1_b_r01">第一页</div>
|
||
<div class="cri1_b_r01">上一页</div>
|
||
<div class="cri1_b_r02">1</div>
|
||
<div class="cri1_b_r01">下一页</div>
|
||
<div class="cri1_b_r01">最后一页</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="cri1 selectWx">
|
||
<div class="cri1_a_box">
|
||
<div class="cri1_a" v-for="(wxSourseItem,index) in wxSourse">
|
||
<div class="cri1_a01_d">{{wxSourseItem.title}}</div>
|
||
<div class="cri1_a02_d">{{wxSourseItem.desc}}</div>
|
||
<div class="cri1_a04_d">创建于:{{wxSourseItem.cdate}}</div>
|
||
<div class="cri1_a05_d">
|
||
<span v-if="wxSelected==index" class="cri1_a05_span" @click="selectWx(index)">已选择</span>
|
||
<span v-else class="cri1_a05_span" @click="selectWx(index)">选择</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="custom_right06">
|
||
<el-button type="primary" @click="publish">保存并发布</el-button>
|
||
</div>
|
||
<el-dialog title="填写其他小程序" :modal-append-to-body="false" :visible.sync="showOtherSmallProgram" width="600px" :close-on-click-modal="false">
|
||
<div style="padding: 0 20px">
|
||
<el-form label-width="120px">
|
||
<el-form-item label="小程序appID">
|
||
<el-input type="text" v-model="tempAppID"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="小程序入口地址">
|
||
<el-input type="text" v-model="tempUrl" placeholder="如: /pages/store/store"></el-input>
|
||
</el-form-item>
|
||
</el-form>
|
||
</div>
|
||
<div slot="footer" class="dialog-footer">
|
||
<el-button size="small" @click="showOtherSmallProgram = false">取 消</el-button>
|
||
<el-button size="small" type="primary" @click="sureChooseOtherSmallProgram">确 定</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
<el-dialog title="选择功能入口" :modal-append-to-body="false" :visible.sync="showSelectLink" width="600px" :close-on-click-modal="false">
|
||
<div style="padding: 0 20px">
|
||
<div class="cri">
|
||
<div class="cri1_a" v-for="(fnItem,index) in fnList">
|
||
<div class="cri1_a01">{{fnItem.name}}</div>
|
||
<div class="cri1_a02" style="width: 50%;">{{fnItem.desc}}</div>
|
||
<div class="cri1_a05">
|
||
<el-button :type="selectFnIndex==index?'primary':''" size="small" @click="fnSelect(index)">
|
||
{{selectFnIndex==index?'已选择':'选择'}}
|
||
</el-button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div slot="footer" class="dialog-footer">
|
||
<el-button size="small" @click="showSelectLink = false">取 消</el-button>
|
||
<el-button size="small" type="primary" @click="sureSelectLink">确 定</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
</div>
|
||
<script>
|
||
/**
|
||
* 获取字符长度包含中文
|
||
* @param str
|
||
* @returns {*}
|
||
*/
|
||
function getStrLen(str) {
|
||
str = str.replace(/[^\u0391-\uFFE5]/g, "aa");
|
||
let len = str.length; //先把中文替换成两个字节的英文,在计算长度
|
||
return len;
|
||
}
|
||
|
||
/**
|
||
* 截取字符串指定长度字符
|
||
* @param str
|
||
* @param len
|
||
*/
|
||
function splitLenStr(str, len) {
|
||
let count = 0;
|
||
var reg = /[^\u0391-\uFFE5]/g;
|
||
let flag = false;
|
||
for (let i = 0; i < str.length; i++) {
|
||
if (reg.test(str[i])) {
|
||
count += 2;
|
||
if (count > len) {
|
||
count -= 2;
|
||
flag = true;
|
||
}
|
||
} else {
|
||
count++;
|
||
}
|
||
if (count == len) {
|
||
flag = true;
|
||
}
|
||
if (flag) {
|
||
str = str.substr(0, i);
|
||
break;
|
||
}
|
||
}
|
||
return str;
|
||
}
|
||
|
||
var myvue = new Vue({
|
||
el: '#myApp',
|
||
data: function () {
|
||
return {
|
||
showChooseVipPath: false,//是否显示选择会员卡地址
|
||
vipPathList: [
|
||
{name: '会员卡首页', path: 'Index/index.html'},
|
||
{name: '充值', path: 'Onlinepay/index.html'},
|
||
{name: '积分商城', path: 'ScoreMall/index.html'},
|
||
{name: '修改密码', path: 'Set/forgetpwd.html'},
|
||
],//会员卡地址列表
|
||
button: [{
|
||
"type": "",
|
||
"name": "",
|
||
"url": "",
|
||
"sub_button": []
|
||
}],
|
||
//存放图文消息的数组
|
||
wxSourse: [],
|
||
wxCard: [],
|
||
canAdd: true,
|
||
active: 0,
|
||
buttonName: "",
|
||
isFind: false,
|
||
isMenuConfig: true,
|
||
findActive: -1,
|
||
menuShow: true,
|
||
sendMsgShow: false,
|
||
urlShow: false,
|
||
//被选中的卡券
|
||
cardSelected: null,
|
||
media_url: null,
|
||
wxSelected: null,
|
||
sourceActive: 1,
|
||
newInfo: {'title': null, 'pic': null, 'desc': null},
|
||
fnList: [{index: 1, name: '小程序商城入口', desc: '点击设置小程序商城的入口(小程序需要和公众号绑定)'},
|
||
{index: 2, name: '积分商城入口', desc: '商家开启积分商城之后可以使用该入口功能'}
|
||
/*{index:3,name:'微信卡包推送',desc:'推送一个会员卡包给公众号粉丝'},
|
||
{index:4,name:'商家餐饮入口',desc:'商家进入智慧餐饮的入口'}*/],
|
||
selectFnIndex: null,
|
||
pageUrls: null,
|
||
showSelectLink: false,
|
||
tempAppID: '',
|
||
tempUrl: '',
|
||
showOtherSmallProgram: false,
|
||
loading: false,
|
||
menuLoadingText: '',
|
||
}
|
||
},
|
||
created() {
|
||
//加载时就执行的方法
|
||
this.getmenu();
|
||
},
|
||
methods: {
|
||
getmenu: function () {
|
||
//从接口获取微信菜单数据
|
||
var that = this;
|
||
$.ajax({
|
||
url: "{:U('getMenu')}",
|
||
type: "post",
|
||
success: function (re) {
|
||
// console.log(re);
|
||
if (re) {
|
||
that.button = re.button;
|
||
}
|
||
that.itemadd(0);
|
||
}
|
||
})
|
||
},
|
||
addbutton: function () {
|
||
//添加一个一级菜单数组到data中
|
||
var obj = {
|
||
"type": "view",
|
||
"name": "",
|
||
"sub_button": [],
|
||
}
|
||
this.button.push(obj);
|
||
},
|
||
itemadd: function (key) {
|
||
this.active = key;
|
||
//判断如果有子级菜单 就不显示选项
|
||
var length = this.button[key]['sub_button'].length;
|
||
if (length > 0) {
|
||
this.isMenuConfig = false;
|
||
} else {
|
||
this.isMenuConfig = true;
|
||
}
|
||
this.isFind = false;
|
||
this.findActive = -1;
|
||
var type = this.button[key]['type'];
|
||
//对应的菜单展现出来
|
||
console.log(type);
|
||
switch (type) {
|
||
case 'view':
|
||
//网址 展现网址菜单
|
||
this.url();
|
||
this.pageUrls = this.button[key]['url'];
|
||
break;
|
||
case 'media_id':
|
||
this.sendMsg();
|
||
this.sourceActive = 1;
|
||
this.media_url = this.button[key]['media_url'];
|
||
//没有就去查找 微信中上传的图片
|
||
if (this.media_url == undefined) {
|
||
var media_id = this.button[key]['media_id'];
|
||
this.getwxImg(media_id);
|
||
}
|
||
break;
|
||
case 'view_limited':
|
||
this.sendMsg();
|
||
var id = this.button[key]['media_id'];
|
||
this.getmediaInfo(id);
|
||
break;
|
||
default:
|
||
this.editMenu();
|
||
break;
|
||
}
|
||
},
|
||
getwxImg: function (id) {
|
||
//获取微信图片信息
|
||
var that = this;
|
||
$.ajax({
|
||
url: '{:U("getwxImg")}',
|
||
type: "post",
|
||
data: {id: id},
|
||
success: function (re) {
|
||
if (re.status) {
|
||
that.media_url = re.url;
|
||
} else {
|
||
layer.alert('无效的图片素材,请检查后重新上传');
|
||
}
|
||
}
|
||
})
|
||
},
|
||
//子级菜单被点击
|
||
findClick: function (key, keys) {
|
||
this.selectFnIndex = null;
|
||
this.isFind = true;
|
||
this.isMenuConfig = true;
|
||
//参数对应一下
|
||
this.active = key;
|
||
this.findActive = keys;
|
||
var that = this;
|
||
var type = this.button[key].sub_button[keys]['type'];
|
||
//对应的菜单展现出来
|
||
switch (type) {
|
||
case 'view':
|
||
//网址 展现网址菜单
|
||
this.url();
|
||
this.pageUrls = this.button[key].sub_button[keys]['url'];
|
||
break;
|
||
case 'media_id':
|
||
this.sendMsg();
|
||
this.sourceActive = 1;
|
||
this.media_url = this.button[key].sub_button[keys]['media_url'];
|
||
if (this.media_url == undefined) {
|
||
var media_id = this.media_url = this.button[key].sub_button[keys]['media_id'];
|
||
this.getwxImg(media_id);
|
||
}
|
||
break;
|
||
case 'view_limited':
|
||
this.sendMsg();
|
||
var id = this.button[key].sub_button[keys]['media_id'];
|
||
this.getmediaInfo(id);
|
||
break;
|
||
default:
|
||
this.editMenu();
|
||
break;
|
||
}
|
||
},
|
||
addFindmenu: function (key) {
|
||
//添加一个子菜单
|
||
var that = this;
|
||
var obj = {
|
||
"type": "",
|
||
"name": "",
|
||
"url": ""
|
||
}
|
||
//子级菜单没有事件
|
||
this.active = key;
|
||
//判断之前的长度
|
||
var sub_length = this.button[key]['sub_button'].length;
|
||
if (!sub_length) {
|
||
layer.confirm("添加子菜单后,主菜单的功能内容将被清除。确定添加子菜单?", {title: '温馨提示'}, function (index) {
|
||
that.button[key]['sub_button'].push(obj);
|
||
that.button[key]['type'] = null;
|
||
that.button[key]['key'] = null;
|
||
layer.close(index);
|
||
})
|
||
return;
|
||
} else {
|
||
that.button[key]['sub_button'].push(obj);
|
||
}
|
||
//清除菜单内容
|
||
},
|
||
delmenu: function () {
|
||
var active = this.active;
|
||
var findactive = this.findActive;
|
||
var that = this;
|
||
//判断当前菜单选中的是主菜单还是子菜单
|
||
if (!this.isFind) {
|
||
//删除主菜单
|
||
var length = this.button[active]["sub_button"].length;
|
||
if (length > 0) {
|
||
layer.alert("无法删除,该菜单下还有子菜单");
|
||
return;
|
||
} else {
|
||
layer.confirm("确定要删除这个菜单?删除后不可恢复", function (index) {
|
||
Vue.delete(that.button, active);
|
||
that.itemadd(0);
|
||
layer.close(index);
|
||
})
|
||
}
|
||
} else {
|
||
//删除子菜单
|
||
layer.confirm("确定要删除这个子菜单?删除后不可恢复", function (index) {
|
||
Vue.delete(that.button[active]["sub_button"], findactive);
|
||
that.itemadd(0);
|
||
layer.close(index);
|
||
})
|
||
}
|
||
},
|
||
sendMsg: function () {
|
||
//发送消息
|
||
this.menuShow = false;
|
||
this.sendMsgShow = true;
|
||
this.urlShow = false;
|
||
layui.use(['upload'], function () {
|
||
//上传图片设置 到接口确定之后上传到微信服务器
|
||
var upload = layui.upload;
|
||
//执行实例
|
||
upload.render({
|
||
elem: '#cri_b_right01' //绑定元素
|
||
, url: '{:U("upload")}' //上传接口
|
||
, done: function (res, index, upload) {
|
||
//上传完毕回调
|
||
if (!myvue.isFind) {
|
||
myvue.button[myvue.active]['media_url'] = res.name;
|
||
myvue.button[myvue.active]['type'] = 'media_id';
|
||
} else {
|
||
myvue.button[myvue.active]['sub_button'][myvue.findActive]['media_url'] = res.name;
|
||
myvue.button[myvue.active]['sub_button'][myvue.findActive]['type'] = 'media_id';
|
||
}
|
||
myvue.media_url = res.name;
|
||
|
||
}
|
||
});
|
||
});
|
||
},
|
||
coupon: function () {
|
||
var that = this;
|
||
this.getcard(0, function () {
|
||
layer.open({
|
||
type: 1,
|
||
title: "选择卡券信息",
|
||
content: $(".selectcard"),
|
||
area: ["50%", "50%"],
|
||
btn: ["确定", "取消"],
|
||
closeBtn: 0,
|
||
yes: function (index, layero) {
|
||
var active = that.active;
|
||
var cardid = that.wxCard[that.cardSelected]["id"];
|
||
if (!that.isFind) {
|
||
//一级菜单触发的事件
|
||
//获取cardid wx_code;
|
||
that.button[active]['type'] = "click";
|
||
that.button[active]['key'] = "cardid-" + cardid;
|
||
} else {
|
||
//获取cardid wx_code;
|
||
that.button[active]['sub_button'][that.findActive]['type'] = "click";
|
||
that.button[active]['sub_button'][that.findActive]['key'] = "cardid-" + cardid;
|
||
//子级菜单触发的事件
|
||
}
|
||
|
||
layer.close(index);
|
||
}
|
||
})
|
||
})
|
||
},
|
||
url: function () {
|
||
this.menuShow = false;
|
||
this.sendMsgShow = false;
|
||
this.urlShow = true;
|
||
},
|
||
//使用会员卡内部地址
|
||
useVipPath(path) {
|
||
let merchant_id = localStorage.merchant_id;
|
||
let server_host = 'http://' + window.location.host + '/index.php/Vip/';
|
||
this.pageUrls = server_host + path + '?merchantid=' + merchant_id;
|
||
this.showChooseVipPath = false;
|
||
this.$nextTick(() => {
|
||
this.pageurl();
|
||
})
|
||
},
|
||
|
||
/*fn: function () {
|
||
this.showSelectLink = true;
|
||
},*/
|
||
/*确定选择功能*/
|
||
sureSelectLink: function () {
|
||
var active = this.active;
|
||
var index = this.fnList[this.selectFnIndex].index;
|
||
if (!this.isFind) {
|
||
//一级菜单触发的事件
|
||
//获取cardid wx_code;
|
||
this.button[active]['type'] = "custom";
|
||
this.button[active]['index'] = index;
|
||
//获取一级信息
|
||
} else {
|
||
//获取cardid wx_code;
|
||
this.button[active]['sub_button'][this.findActive]['type'] = "custom";
|
||
this.button[active]['sub_button'][this.findActive]['index'] = index;
|
||
//子级菜单触发的事件
|
||
}
|
||
this.showSelectLink = false;
|
||
},
|
||
/*确定添加其他小程序*/
|
||
sureChooseOtherSmallProgram: function () {
|
||
if (!this.tempAppID || !this.tempUrl) {
|
||
return;
|
||
}
|
||
var active = this.active;
|
||
console.log(this.button);
|
||
var tempAppID = this.tempAppID;
|
||
var tempUrl = this.tempUrl;
|
||
if (!this.isFind) {
|
||
//一级菜单触发的事件
|
||
//获取cardid wx_code;
|
||
this.button[active]['type'] = "custom";
|
||
this.button[active]['index'] = 1;
|
||
this.button[active]['appid'] = tempAppID;
|
||
this.button[active]['pagepath'] = tempUrl;
|
||
//获取一级信息
|
||
} else {
|
||
//获取cardid wx_code;
|
||
this.button[active]['sub_button'][this.findActive]['type'] = "custom";
|
||
this.button[active]['sub_button'][this.findActive]['index'] = 1;
|
||
this.button[active]['sub_button'][this.findActive]['appid'] = tempAppID;
|
||
this.button[active]['sub_button'][this.findActive]['pagepath'] = tempUrl;
|
||
//子级菜单触发的事件
|
||
}
|
||
this.showOtherSmallProgram = false;
|
||
},
|
||
editMenu: function () {
|
||
this.menuShow = true;
|
||
this.sendMsgShow = false;
|
||
this.urlShow = false;
|
||
},
|
||
selectcard: function (key) {
|
||
// 记录选中的id信息 讲被选中的变成被选中
|
||
this.cardSelected = key;
|
||
},//获取所有的微信卡券
|
||
getcard: function (page, fn) {
|
||
var that = this;
|
||
var merchantid = {$merchantid};
|
||
var data = {page: page, merchantid: merchantid};
|
||
$.ajax({
|
||
url: "{:U('getcard')}",
|
||
data: data,
|
||
type: "post",
|
||
success: function (re) {
|
||
if (re.status) {
|
||
that.wxCard = re.data;
|
||
typeof fn == 'function' && fn();
|
||
} else {
|
||
layer.alert("暂无卡券,请自行添加,并且同步至后台中");
|
||
}
|
||
}
|
||
})
|
||
},
|
||
//删除上传图片
|
||
delImg: function () {
|
||
var key = this.active;
|
||
var keys = this.findActive;
|
||
//删除上传图片
|
||
this.media_url = null;
|
||
if (this.isFind) {
|
||
this.button[key].sub_button[keys]['media_url'] = null;
|
||
} else {
|
||
this.button[key]['media_url'] = null;
|
||
}
|
||
},
|
||
newsClick: function () {
|
||
//点击图文消息
|
||
var that = this;
|
||
that.wxSelected = null;
|
||
this.getNewList(function () {
|
||
layer.open({
|
||
type: 1,
|
||
title: "选择图文信息",
|
||
content: $(".selectWx"),
|
||
area: ["50%", "50%"],
|
||
btn: ["确定", "取消"],
|
||
closeBtn: 0,
|
||
yes: function (index, layero) {
|
||
var wxSelected = that.wxSelected;
|
||
if (wxSelected !== "") {
|
||
var active = that.active;
|
||
var media_id = that.wxSourse[that.wxSelected]["media_id"];
|
||
if (!that.isFind) {
|
||
//一级菜单触发的事件
|
||
//获取cardid wx_code;
|
||
that.button[active]['type'] = "view_limited";
|
||
that.button[active]['media_id'] = media_id;
|
||
//子级菜单触发的事件
|
||
that.getmediaInfo(media_id);
|
||
//获取一级信息
|
||
} else {
|
||
//获取cardid wx_code;
|
||
|
||
that.button[active]['sub_button'][that.findActive]['type'] = "view_limited";
|
||
that.button[active]['sub_button'][that.findActive]['media_id'] = media_id;
|
||
//子级菜单触发的事件
|
||
that.getmediaInfo(media_id);
|
||
}
|
||
}
|
||
layer.close(index);
|
||
}
|
||
})
|
||
});
|
||
},
|
||
getmediaInfo: function (id) {
|
||
var that = this;
|
||
$.ajax({
|
||
url: "{:U('getFindWxSourse')}",
|
||
type: "post",
|
||
data: {id: id},
|
||
success: function (re) {
|
||
if (re.status) {
|
||
that.sourceActive = 2;
|
||
//设置显示图文
|
||
that.newInfo.pic = '/' + re.data.thumb_media_src;
|
||
that.newInfo.title = re.data.title;
|
||
that.newInfo.desc = re.data.digest;
|
||
} else {
|
||
layer.alert('该图文没有图文信息,请检查图文信息库');
|
||
}
|
||
}
|
||
})
|
||
},
|
||
//获取微信的图文列表
|
||
getNewList: function (fn) {
|
||
var that = this;
|
||
$.ajax({
|
||
url: "{:U('getWxSourse')}",
|
||
type: "post",
|
||
success: function (re) {
|
||
if (re.status) {
|
||
that.wxSourse = re.data;
|
||
typeof fn == 'function' && fn();
|
||
} else {
|
||
layer.alert("暂无微信图文消息,请自行添加,并且同步至后台中");
|
||
}
|
||
}
|
||
})
|
||
},
|
||
selectWx: function (index) {
|
||
this.wxSelected = index;
|
||
},
|
||
imgClick: function () {
|
||
this.sourceActive = 1;
|
||
},
|
||
pageurl: function () {
|
||
var val = this.pageUrls;
|
||
var active = this.active;
|
||
var that = this;
|
||
if (!this.isFind) {
|
||
//一级菜单触发的事件
|
||
//获取cardid wx_code;
|
||
that.button[active]['type'] = "view";
|
||
that.button[active]['url'] = val;
|
||
//获取一级信息
|
||
} else {
|
||
//获取cardid wx_code;
|
||
that.button[active]['sub_button'][that.findActive]['type'] = "view";
|
||
that.button[active]['sub_button'][that.findActive]['url'] = val;
|
||
//子级菜单触发的事件
|
||
}
|
||
console.log(that.button);
|
||
},
|
||
fnSelect: function (index) {
|
||
this.selectFnIndex = index;
|
||
},
|
||
publish: function () {
|
||
//获取数据并且发布信息
|
||
var data = {data: this.button};
|
||
console.log(data);
|
||
this.loading = true;
|
||
this.menuLoadingText = '提交中,请等待';
|
||
//利用ajax 发送菜单信息
|
||
$.ajax({
|
||
url: '{:U("upMenu")}',
|
||
type: 'post',
|
||
data: data,
|
||
success: (re) => {
|
||
this.loading = false;
|
||
layer.alert(re.msg);
|
||
}
|
||
})
|
||
|
||
}
|
||
}
|
||
});
|
||
</script> |