canyin-project/ybcy/views/admin/apply/platform_edit.php
2024-11-01 16:07:54 +08:00

653 lines
35 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="renderer" content="webkit">
<?php if($this->params['site_image']):?>
<link rel="shortcut icon" type="image/x-icon" href="<?$this->params['site_image']?>" />
<?php else:?>
<link rel="shortcut icon" type="image/x-icon" href="<?=Yii::$app->request->baseUrl?>/web/favicon.ico" />
<?php endif;?>
<title>
<?php if($this->params['site_title']):?>
<?php echo $this->params['site_title']; ?>
<?php else:?>
应用管理后台
<?php endif;?>-编辑平台
</title>
<link rel="stylesheet" type="text/css" href="<?=Yii::$app->request->baseUrl?>/web/static/css/globle.css" />
<script src="<?=Yii::$app->request->baseUrl?>/web/static/js/config.js" type="text/javascript" charset="utf-8"></script>
</head>
<style>
.imgbox {
width: 100px;
height: 100px;
}
.checkbox .el-checkbox {
border: 1px solid #F3F6FB;
position: relative;
width: 100px;
height: 100px;
}
.checklabel-zjtd {
left: 0px;
}
.checkbox .el-checkbox .el-checkbox__input {
position: absolute;
bottom: 5px;
left: 42px;
}
.channel-icon img {
width: 32px;
height: 32px;
}
.namelogo {
width: 54px;
height: 54px;
border-radius: 50%;
}
.hed-right .el-button {
height: 38px;
}
.hed-right .btn-jrpt {
width: 130px;
}
.hed-right .btn-ty {
width: 104px;
}
.mar_t3 {
margin-top: 3px;
}
/* .checkbox .el-checkbox__label {
padding-left: 34px;
}*/
.avatar-uploader .el-upload {
width: 100px;
height: 100px;
line-height: 100px;
}
.el-icon-plus:before {
font-size: 20px;
}
</style>
<body>
<div class="pHead">
<div class="publicHeader">
<?php echo $this->render('@app/views/admin/public/publicHeader.html');?>
</div>
</div>
<div class="pLeft">
<div class="publicAside hei">
<?php echo $this->render('@app/views/admin/public/publicAside.html');?>
</div>
</div>
<div class="upimg">
<div class="attachment hei">
<?php echo $this->render('@app/views/admin/public/attachment-img.html'); ?>
</div>
</div>
<div class="yb_body">
<div class="layout" id="platformList" v-cloak v-loading="cardLoading">
<el-container>
<el-container>
<el-main>
<div class="main" style="min-width: 800px">
<div class="ba_f">
<div class="main-tab ba_f bor_rad5 pad_tb_30">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="平台信息" name="msg">平台信息</el-tab-pane>
<el-tab-pane label="操作员管理" name="user">用户管理</el-tab-pane>
<el-tab-pane label="其他设置" name="setting">其他设置</el-tab-pane>
</el-tabs>
<div class="tips t_l flex flex-y-center">
<span class="iconfont icontishi maincolor fon_16 mar_r10 mar_t3"></span>
<p class="fon_12 maincolor">提示:请真实填写以下相关信息,保存后请勿随意修改。</p>
</div>
</div>
<div class="main-con pad_tb_30">
<div class="flex-bet wid pad_tb_20">
<div class="flex-grow-0 t_r pad_r_25 right-left">排序</div>
<div class="flex-grow-1 t_l right-width">
<el-input v-model="formInline.sort" placeholder="排序" class="elinput"></el-input>
</div>
</div>
<div class="flex-bet wid pad_tb_20">
<div class="flex-grow-0 t_r pad_r_25 right-left"><span class="color_red">*</span>平台名称</div>
<div class="flex-grow-1 t_l right-width">
<el-input v-model="formInline.apply_name" placeholder="请输入平台名称" class="elinput"></el-input>
</div>
</div>
<div class="flex-bet wid pad_tb_20">
<div class="flex-grow-0 t_r pad_r_25 right-left">平台logo</div>
<div class="flex-grow-1 t_l right-width">
<div class="imgbox bor_rad5 ba_f5">
<el-upload class="avatar-uploader" :action="upload_url" :show-file-list="false" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload">
<img v-if="imageUrl" :src="imageUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</div>
<!-- <div class="uploadSource bor_de rel flex curs" v-if="imageUrl">-->
<!-- <label class="statusLabel curs" @mouseenter="enter(1)" @mouseleave="leave(1)">-->
<!-- <i class="el-icon-check" ref="imgicon1"></i>-->
<!-- <i class="el-icon-close" @click="deleteMultiImage(imageUrl,1)"></i>-->
<!-- </label>-->
<!-- <img :src="imageUrl" @click='test(1)' class="wid"/>-->
<!-- </div>-->
<!-- <div class="uploadSource flex-center curs" v-else @click='test(1)'>-->
<!-- <i class="el-icon-plus fon_40 color_d9"></i>-->
<!-- </div>-->
<!-- <attachment-img ref="img1" type="img" :type4='id' @attachment='imgadd1'></attachment-img>-->
</div>
</div>
<div class="flex-bet wid pad_tb_20">
<div class="flex-grow-0 t_r pad_r_25 right-left">二维码</div>
<div class="flex-grow-1 t_l right-width">
<div class="imgbox bor_rad5 ba_f5">
<el-upload class="avatar-uploader" :action="upload_url2" :show-file-list="false" :on-success="handleAvatarSuccess2" :before-upload="beforeAvatarUpload">
<img v-if="imageUrl2" :src="imageUrl2" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</div>
<!-- <div class="uploadSource bor_de rel flex curs" v-if="imageUrl2">-->
<!-- <label class="statusLabel curs" @mouseenter="enter(2)" @mouseleave="leave(2)">-->
<!-- <i class="el-icon-check" ref="imgicon2"></i>-->
<!-- <i class="el-icon-close" @click="deleteMultiImage(imageUrl2,2)"></i>-->
<!-- </label>-->
<!-- <img :src="imageUrl2" @click='test(2)' class="wid"/>-->
<!-- </div>-->
<!-- <div class="uploadSource flex-center curs" v-else @click='test(2)'>-->
<!-- <i class="el-icon-plus fon_40 color_d9"></i>-->
<!-- </div>-->
<!-- <attachment-img ref="img2" type="img" :type4='id' @attachment='imgadd2'></attachment-img>-->
</div>
</div>
<!-- <div class="flex-bet wid pad_tb_20">-->
<!-- <div class="flex-grow-0 t_r pad_r_25 right-left">版本</div>-->
<!-- <div class="flex-grow-1 t_l right-width">{{app_name}}-->
<!---->
<!-- </div>-->
<!-- </div>-->
<div class="flex-bet wid pad_tb_20">
<div class="flex-grow-0 t_r pad_r_25 right-left"><span class="color_red">*</span>门店模式</div>
<div class="flex-grow-1 t_l right-width">
<el-radio-group v-model="formInline.shopModel" @change="radioChange">
<el-radio label="1" value='1'>单门店
</el-radio>
<el-radio label="2" value='2'>多门店
</el-radio>
</el-radio-group>
</div>
</div>
<div class="flex wid pad_tb_20" v-show="formInline.shopModel=='2'">
<div class="flex-grow-0 t_r pad_r_25 right-left"><span class="color_red">*</span>可创建门店数量</div>
<div class=" t_l ">
<div class=" t_l mar_t10 " v-if="!storeFlag">
<el-input v-model="formInline.shopNum" placeholder="请输入门店数量" class="elinput"></el-input>
</div>
</div>
<el-checkbox v-model="storeFlag" class="mar_l20" @change="checkChange">无限</el-checkbox>
</div>
<div style="color:gray;font-size: 14PX;text-align: left; padding-left:150px">(空值或者填0则为无限门店,直接勾选无限无效)</div>
<div class="flex-bet wid pad_tb_20">
<div class="flex-grow-0 t_r pad_r_25 right-left"><span class="color_red">*</span>应用渠道</div>
<div class="flex-grow-1 t_l right-width">
<div class="checkbox">
<el-checkbox-group v-model="formInline.channel_str">
<el-checkbox v-for="item in channelOptions" :label="item.name" :key="item.id">
<div class="checklabel ab mar_b20">
<div class="channel-icon flex-center"><img :src="item.channel_image" class="wid" /></div>
<div class="mar_t5"> {{item.use_name}}</div>
</div>
</el-checkbox>
</el-checkbox-group>
</div>
</div>
</div>
<div class="flex-bet wid pad_tb_20">
<div class="flex-grow-0 t_r pad_r_25 right-left">商家端</div>
<div class="flex-grow-1 t_l right-width">
<el-checkbox-group v-model="formInline.service">
<el-checkbox v-for="item in operation3" :label="item.name" :key="item.id" disabled size="medium">
{{item.use_name}}
</el-checkbox>
</el-checkbox-group>
</div>
</div>
<div class="flex-bet wi d pad_tb_20">
<div class="flex-grow-0 t_r pad_r_25 right-left">应用插件</div>
<div class="flex-grow-1 t_l right-width flex">
<div>
<el-checkbox-group v-model="formInline.use_str">
<el-checkbox v-for="item in operation2" :label="item.name" :key="item.id" border size="medium">
{{item.use_name}}
</el-checkbox>
</el-checkbox-group>
</div>
<div class="mar_l20">
<el-checkbox-group v-model="formInline.instore">
<el-checkbox true-label="1" false-label="2" border size="medium">店内功能</el-checkbox>
</el-checkbox-group>
</div>
<div class="mar_l20">
<el-checkbox-group v-model="formInline.takeout">
<el-checkbox true-label="1" false-label="2" border size="medium">外卖功能</el-checkbox>
</el-checkbox-group>
</div>
</div>
</div>
<div class="flex-bet wi d pad_tb_20">
<div class="flex-grow-0 t_r pad_r_25 right-left">增值插件</div>
<div class="flex-grow-1 t_l right-width">
<el-checkbox-group v-model="formInline.plug_str">
<el-checkbox v-for="item in operation" :label="item.name" :key="item.id" border size="medium">
{{item.use_name}}
</el-checkbox>
</el-checkbox-group>
</div>
</div>
<div class="flex-bet wi d pad_tb_20">
<div class="flex-grow-0 t_r pad_r_25 right-left">配送支持</div>
<div class="flex-grow-1 t_l right-width">
<el-checkbox-group v-model="formInline.deliveryMode">
<el-checkbox v-for="items of distList" :label="items.value" :key="items.value" size="medium">{{ items.name}}</el-checkbox>
</el-checkbox-group>
</div>
</div>
<div class="flex-bet wi d pad_tb_20">
<div class="flex-grow-0 t_r pad_r_25 right-left">创建时间</div>
<div class="flex-grow-1 t_l right-width">
{{dt_operdate}}
</div>
</div>
<?php if($this->params['userType']):?>
<div class="flex-bet wi d pad_tb_20">
<div class="flex-grow-0 t_r pad_r_25 right-left"><span class="color_red">*</span>到期时间</div>
<div class="flex-grow-1 t_l right-width">
<el-date-picker v-model="timeData" type="datetime" v-if="!times" placeholder="选择到期时间">
</el-date-picker>
<el-checkbox v-model="times" class="mar_l20" @change="checkbox">永久</el-checkbox>
</div>
</div>
<?php endif;?>
</div>
<div class="ba_f mar_t20 pad_30 main-button">
<el-button type="primary" class="tijiao" @click="onSubmit">保存</el-button>
</div>
</div>
</el-main>
</el-container>
</el-container>
</div>
</div>
<script>
$(document).ready(function () {
$(".slimScrollDiv ul .main-nav-li a").eq(1).addClass("menu_active");
$(".main-nav .main-nav-li .submenu").eq(1).addClass("block");
$(".main-nav .main-nav-li .submenu").children().children().eq(1).addClass("menu_active2")
});
</script>
<script>
new Vue({
el: '#platformList',
created() {
const id = utils.GetQueryString("id")
// const dt_operdate = utils.GetQueryString("dt_operdate")
const userId = utils.GetQueryString("userId")
if (id) {
console.log(id)
this.id = id
// this.dt_operdate = dt_operdate
this.userId = userId
this.getbyid(id)
// this.init();
} else {
// _this = this;
// this.init();
}
},
data: function () {
return {
distList:[],
cardLoading: true,
activeName: 'msg',
id: '',
dt_operdate: '',
userId: '',
formInline: {
deliveryMode: ['1', '2', '3', '4', '5', '6', '7', '8', '9'],
sort: '',
apply_name: '',
apply_type: '',
create_shop_count: '',
time_type: '',
end_time: '',
plug_str: [],
channel_str: [],
use_str: [],
id: '',
apply_image: {},
apply_qr_code: {},
shopModel: '1',
shopNum: 50,
service: ['app'],
instore: '1',
takeout: '1',
},
checked: false,
timeData: '',
imageUrl: '',
imageUrl2: '',
upload_url: "<?= Yii::$app->urlManager->createUrl(['admin/common/upload']);?>",
upload_url2: "<?= Yii::$app->urlManager->createUrl(['admin/common/upload']);?>",
times: '',
storeFlag: false,
channelOptions: [{
value: '1',
label: '微信公众号',
icon: '/web/static/images/platform/icon_wx.png'
},
{
value: '2',
label: '微信小程序',
icon: '/web/static/images/platform/icon_xcx.png'
},
{
value: '3',
label: '支付宝小程序',
icon: '/web/static/images/platform/icon_zfb.png'
},
{
value: '4',
label: '百度小程序',
icon: '/web/static/images/platform/icon_bd.png'
},
{
value: '5',
label: '字节跳动小程序',
icon: '/web/static/images/platform/icon_zjtd.png'
}
],
radioOptions: [],
operation: [],
operation2: [],
operation3: [],
edition: '1',
img: '',
app_name: '',
}
},
methods: {
changeO(msg){
console.log(msg)
},
checkChange(val) {
this.storeFlag = val;
},
radioChange(val) {
if (val == '1') {
this.storeFlag = false;
}
},
enter(i = 0) {
this.$refs['imgicon' + i].style.display = 'none'
},
leave(i = 0) {
this.$refs['imgicon' + i].style.display = 'inline-block'
},
test(i = 0) {
// console.log(this.$refs, i)
this.$refs['img' + i].dialogVisible = true
},
imgadd1(url) {
this.imageUrl = url.str
},
imgadd2(url) {
this.imageUrl2 = url.str
},
deleteMultiImage(item, index, type) {
//typem没传是单图multigraph多图index上传图片组件排序
Array.prototype.remove = function (val) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
};
if (type == 'multigraph') {
} else {
switch (index) {
case 1:
this.imageUrl = '';
break
case 2:
this.imageUrl2 = '';
break
}
}
},
async init() {
// this.getapplylist()
// this.getpluglist()
},
//编辑显示数据
async getbyid(id) {
let params = {
id: id
}
res = await utils.requestGet({ data: params, url: "admin/apply/apply-details" }, this)
if (res.code == 1) {
Object.assign(this.formInline,res.data);
this.cardLoading = false
this.formInline.sort = res.data.sort;
this.formInline.apply_name = res.data.apply_name;
this.formInline.deliveryMode= res.data.deliveryMode;
this.formInline.service = res.data.service;
this.formInline.apply_type = res.data.apply_type ? +res.data.apply_type : ''
this.imageUrl = res.data.apply_image
this.imageUrl2 = res.data.apply_qr_code
this.formInline.channel_str = res.data.channel_str ? res.data.channel_str : []
this.channelOptions = res.data.channel_list ? res.data.channel_list : []
this.operation = res.data.plug_list ? res.data.plug_list : [] //增值插件
this.operation2 = res.data.use_list ? res.data.use_list : [] //应用插件
this.operation3 = res.data.service_list ? res.data.service_list : [] //增值插件2
// this.formInline.channel_str = res.data.channel_str?res.data.channel_str:''
this.formInline.plug_str = res.data.plug_str ? res.data.plug_str : []
this.formInline.use_str = res.data.use_str ? res.data.use_str : [] //应用插件
this.formInline.instore = res.data.instore ? res.data.instore : '1'
this.formInline.takeout = res.data.takeout ? res.data.takeout : '1'
if (res.data.shopModel == '2') {
this.formInline.shopNum = res.data.shopNum;
}
if (res.data.shopNum == '' || res.data.shopNum == 0) {
this.storeFlag = true;
}
if (res.data.time_type == '1') {
this.timeData = res.data.end_time
} else {
this.times = true;
}
this.dt_operdate = res.data.dt_operdate ? res.data.dt_operdate : ''
this.distList=res.data.deliveryModeData
console.log(this.formInline)
}
},
//获取选中的应用对应的列表
// async getapplylist(app_type) {
// let params={
// status:1,
// app_type,
// }
// res = await utils.requestPost({data: params, url: "admin/app/get-edit-list"},this)
// if (res.code == 1) {
// this.channelOptions = res.data.channel_list //版本对应可用渠道
// this.operation = res.data.plug_list //版本可用插件
// }
// },
// async radioChange(value){
// res = await utils.requestPost({data: {'app_id':value}, url: "admin/app/change-channel"}, this)
// if (res.code == 1) {
// this.channelOptions = res.data?res.data.channel_list:'' //版本对应可用渠道
// this.operation = res.data?res.data.plug_list:'' //版本可用插件
// }
// },
//渠道选择取最新选择
// handleCheckedCitiesChange1(value) {
// this.formInline.channel_str =value
// },
//可用插件选择取最新选择
handleCheckedCitiesChange(value) {
this.formInline.plug_str = value
},
handleClick(tab, event) {
if (tab.name == 'msg') {
location.href = "<?= Yii::$app->urlManager->createUrl('admin/apply/platform_edit');?>" + "?id=" + this.id + "&userId=" + this.userId;
}
if (tab.name == 'user') {
location.href = "<?= Yii::$app->urlManager->createUrl('admin/apply/platform_userm');?>" + "?id=" + this.id + "&userId=" + this.userId;
}
if (tab.name == 'enclosure') {
location.href = "<?= Yii::$app->urlManager->createUrl('admin/apply/platform_enclosure');?>" + "?id=" + this.id;
}
if (tab.name == 'setting') {
location.href = "<?= Yii::$app->urlManager->createUrl('admin/apply/other_set');?>" + "?id=" + this.id + "&userId=" + this.userId;
}
},
//点击停用
async deactivation() {
await utils.showConfirm({ content: '此操作将停用该平台, 是否确认?' }, this)
var requstData = {
id: this.id,
status: 2,
}
res = await utils.requestPost({
data: requstData,
url: "admin/apply/delapply"
}, this)
if (res.code == 1) {
this.$message({
type: 'success',
message: '操作成功!',
duration: 1000,
onClose: () => {
location.href = "<?= Yii::$app->urlManager->createUrl('admin/apply/platform_management');?>" + "?id=" + this.id;
},
});
}
},
checkbox() {
// this.getPassYearFormatDate ()//切换为永久时赋值默认一年
},
//提交数据
async onSubmit() {
this.formInline.id = this.id
// const formdata = new FormData()
let start_time = '';
let end_time = '';
if (this.timeData && !this.times) {
end_time = utils.changeDate(this.timeData)
this.formInline.end_time = end_time
// console.log(end_time)
}
this.formInline.time_type = this.times ? 2 : 1
// this.formInline.apply_image = this.imageUrl
// this.formInline.apply_qr_code = this.imageUrl2
if (this.checked) {
this.formInline.shopNum = 0;
}
// formdata.append('apply_image', this.imageUrl)
// formdata.append('apply_qr_code', this.imageUrl2)
// formdata.append('plug_str', this.formInline.plug_str)
// formdata.append('channel_str', this.formInline.channel_str)
// formdata.append('apply_name', this.formInline.apply_name)
// formdata.append('create_shop_count',this.formInline.create_shop_count)
// formdata.append('time_type',this.formInline.time_type)
// formdata.append('id',this.formInline.id)
// formdata.append('sort',this.formInline.sort)
// formdata.append('apply_type',this.formInline.apply_type)
// Object.assign(this.formInline, formdata);
// console.log(this.formInline,formdata)
if (this.formInline.apply_name == '') {
this.$message.error('请输入平台名称')
return
} else if (this.formInline.time_type == 1 && this.formInline.end_time == '') {
this.$message.error('请选择到期时间')
return
}
res = await utils.requestPost({
data: this.formInline,
url: "admin/apply/applyusave"
}, this)
if (res.code == 1) {
localStorage.setItem('apply_edit', res.data);
this.$message({
type: 'success',
message: '操作成功!',
duration: 1000,
onClose: () => {
location.href = "<?= Yii::$app->urlManager->createUrl('admin/apply/platform_management');?>" + "?id=" + this.id;
},
});
}
},
handleAvatarSuccess(res, file) {
this.imageUrl = URL.createObjectURL(file.raw);
this.formInline.apply_image = res.data
// console.log(file.raw)
},
handleAvatarSuccess2(res, file) {
this.imageUrl2 = URL.createObjectURL(file.raw);
this.formInline.apply_qr_code = res.data
// console.log(file.raw)
},
beforeAvatarUpload(file) {
const isJPG = file.type ===
file.type === 'image/jpg' ||
file.type === 'image/jpeg' ||
file.type === 'image/png' ||
file.type === 'image/gif'
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isJPG) {
this.$message.error('请上传图片文件!');
}
if (!isLt2M) {
this.$message.error('上传头像图片大小不能超过 2MB!');
}
return isJPG && isLt2M;
}
}
})
</script>
</body>
</html>