1285 行
57 KiB
HTML
可执行文件
1285 行
57 KiB
HTML
可执行文件
<!--[1.6.48]-->
|
||
<style>
|
||
[v-cloak] {
|
||
display: none;
|
||
}
|
||
|
||
.layui-card-header {
|
||
margin-left: 30px;
|
||
}
|
||
|
||
.layui-card-body {
|
||
margin-left: 115px;
|
||
}
|
||
|
||
td > div, th > div {
|
||
text-align: center;
|
||
}
|
||
|
||
.list {
|
||
display: flex;
|
||
flex-direction: row;
|
||
align-items: center;
|
||
margin: 10px 0;
|
||
}
|
||
|
||
.left_name {
|
||
width: 109px;
|
||
font-size: 14px;
|
||
line-height: 56px;
|
||
color: #666;
|
||
}
|
||
|
||
.center {
|
||
text-align: center;
|
||
}
|
||
|
||
.content-table {
|
||
width: 100%;
|
||
height: 40px;
|
||
line-height: 40px;
|
||
border-bottom: 1px solid #e5e5e5;
|
||
color: #409EFF;
|
||
font-weight: bold;
|
||
font-size: 15px;
|
||
margin-bottom: 10px;
|
||
}
|
||
|
||
#administrationApp .el-form-item {
|
||
margin-bottom: 0;
|
||
}
|
||
|
||
#administrationApp .el-tabs {
|
||
margin-bottom: 20px;
|
||
}
|
||
|
||
.addActivity .el-form-item {
|
||
margin-bottom: 20px !important;
|
||
}
|
||
|
||
.right {
|
||
text-align: right;
|
||
}
|
||
</style>
|
||
<div id="administrationApp" v-cloak>
|
||
<div class="content-table">Plus会员管理</div>
|
||
<el-tabs type="border-card">
|
||
<el-tab-pane label="Plus会员基本设置" style="padding: 0 15px">
|
||
<el-form label-width="200px">
|
||
<el-form-item label="初始充值成为Plus会员活动">
|
||
<el-switch
|
||
:disabled="preservation"
|
||
v-model="recharge_switch_type"
|
||
:active-text="recharge_switch_type?'开':'关'">
|
||
</el-switch>
|
||
</el-form-item>
|
||
<el-form-item label="续费充值成为Plus会员活动">
|
||
<el-switch
|
||
v-model="renew_recharge_switch_type"
|
||
:disabled="preservation"
|
||
:active-text="renew_recharge_switch_type?'开':'关'">
|
||
</el-switch>
|
||
</el-form-item>
|
||
<el-form-item label="初始购买Plus会员套餐">
|
||
<el-switch
|
||
:disabled="preservation"
|
||
v-model="purchase_switch_type"
|
||
:active-text="purchase_switch_type?'开':'关'">
|
||
</el-switch>
|
||
</el-form-item>
|
||
<el-form-item label="续费购买Plus会员套餐">
|
||
<el-switch
|
||
:disabled="preservation"
|
||
v-model="renew_purchase_switch_type"
|
||
:active-text="renew_purchase_switch_type?'开':'关'">
|
||
</el-switch>
|
||
</el-form-item>
|
||
<el-form-item label="购买指定商品成为Plus会员">
|
||
<el-switch :disabled="preservation"
|
||
v-model="goods_switch_type"
|
||
:active-text="goods_switch_type?'开':'关'">
|
||
</el-switch>
|
||
</el-form-item>
|
||
<el-form-item label="购买商品套餐成为Plus会员">
|
||
<el-switch
|
||
:disabled="preservation"
|
||
v-model="goods_group_switch_type"
|
||
:active-text="goods_group_switch_type?'开':'关'">
|
||
</el-switch>
|
||
</el-form-item>
|
||
</el-form>
|
||
<div class="right">
|
||
<el-button size="small" v-if="!preservation" type="primary" @click="submitSet">保存
|
||
</el-button>
|
||
</div>
|
||
</el-tab-pane>
|
||
</el-tabs>
|
||
<el-tabs type="border-card">
|
||
<el-tab-pane label="Plus会员套餐设置" style="padding: 0 15px">
|
||
<el-form label-width="100px">
|
||
<el-form-item label="套餐列表">
|
||
<div style="display: flex;justify-content: space-between;align-items: center;">
|
||
<el-select size="small"
|
||
v-model="activityType"
|
||
filterable
|
||
clearable
|
||
placeholder="选择套餐类型"
|
||
@change="queryPlusActivity">
|
||
<el-option label="初次购买套餐" :value="1"></el-option>
|
||
<el-option label="续费购买套餐" :value="2"></el-option>
|
||
</el-select>
|
||
<el-button size="mini"
|
||
style="margin-bottom:10px"
|
||
v-if="!preservation"
|
||
type="primary"
|
||
plain
|
||
@click="addActivity">新增套餐
|
||
</el-button>
|
||
</div>
|
||
<el-table border :data="plusActivity">
|
||
<el-table-column type="index" label="序号" width="50"></el-table-column>
|
||
<el-table-column prop="time_name" label="名称"></el-table-column>
|
||
<el-table-column prop="price" label="售价(元)"></el-table-column>
|
||
<el-table-column prop="time" label="时长(天)"></el-table-column>
|
||
<el-table-column prop="type" label="套餐类型">
|
||
<template slot-scope="scope">
|
||
<span v-if="scope.row.type==1">初次购买套餐</span>
|
||
<span v-else>续费购买套餐</span>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column prop="status" label="状态">
|
||
<template slot-scope="scope">
|
||
<el-switch
|
||
@change="changeActivity(scope.row.id,scope.row.status,scope.$index)"
|
||
:disabled="preservation"
|
||
v-model="scope.row.status"
|
||
active-value="1"
|
||
inactive-value="0">
|
||
</el-switch>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column v-if="!preservation" prop="right" label="操作" width="90">
|
||
<template slot-scope="scope">
|
||
<el-button type="text" size="small" @click="delActivity(scope.row.id)">删除
|
||
</el-button>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
<el-pagination
|
||
@size-change="activityHandleSizeChange"
|
||
@current-change="activityHandleCurrentChange"
|
||
:pager-count="5"
|
||
:page-sizes="[10,20,30,40,50,60,70,80,90,100]"
|
||
:page-size="10"
|
||
layout="total,sizes, prev, pager, next, jumper"
|
||
:total="activityLen">
|
||
</el-pagination>
|
||
</el-form-item>
|
||
</el-form>
|
||
</el-tab-pane>
|
||
</el-tabs>
|
||
<el-tabs type="border-card" v-model="GoodsStatus">
|
||
<el-tab-pane label="购买指定商品成为Plus会员" name="1" style="padding: 0 15px">
|
||
<el-form :inline="true" class="demo-form-inline">
|
||
<el-form-item>
|
||
<el-select size="small" v-model="home_store_id" filterable placeholder="请选择门店"
|
||
@change="homeChoice">
|
||
<el-option
|
||
v-for="item in store_info"
|
||
:key="item.id"
|
||
:label="item.storetag"
|
||
:value="item.id">
|
||
</el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item>
|
||
<el-input size="small" v-model="home_goods_query" placeholder="名称/货号"></el-input>
|
||
</el-form-item>
|
||
<el-form-item>
|
||
<el-button size="mini" type="primary" plain @click="homeQuery">查询</el-button>
|
||
</el-form-item>
|
||
<el-form-item>
|
||
<if condition="$authArr['shop_goods_deposit'] eq true">
|
||
<el-button size="mini" type="primary" @click="newlyAdd">新增</el-button>
|
||
</if>
|
||
</el-form-item>
|
||
</el-form>
|
||
<el-table border :data="plusGoods">
|
||
<el-table-column type="index" label="序号" width="50"></el-table-column>
|
||
<el-table-column prop="goods_name" label="名称"></el-table-column>
|
||
<el-table-column prop="goods_number" label="货号"></el-table-column>
|
||
<el-table-column prop="goods_code" label="条码"></el-table-column>
|
||
<el-table-column prop="storetag" label="门店名称"></el-table-column>
|
||
<el-table-column prop="time" label="时长(天)"></el-table-column>
|
||
<el-table-column prop="right" label="操作" width="90">
|
||
<template slot-scope="scope">
|
||
<if condition="$authArr['delPromotion'] eq true">
|
||
<el-button type="text" size="small" @click="delPromotion(scope.row.id)">删除</el-button>
|
||
</if>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
<el-pagination
|
||
@size-change="goodsHandleSizeChange"
|
||
@current-change="goodsHandleCurrentChange"
|
||
:pager-count="5"
|
||
:page-sizes="[10,20,30,40,50,60,70,80,90,100]"
|
||
:page-size="10"
|
||
layout="total,sizes, prev, pager, next, jumper"
|
||
:total="goodsLen">
|
||
</el-pagination>
|
||
</el-tab-pane>
|
||
<el-tab-pane label="购买商品套餐成为Plus会员" name="2" style="padding: 0 15px">
|
||
<el-form :inline="true" class="demo-form-inline">
|
||
<el-form-item>
|
||
<el-select size="small" v-model="group_storeid" filterable placeholder="请选择门店"
|
||
@change="groupChoice">
|
||
<el-option
|
||
v-for="item in store_info"
|
||
:key="item.id"
|
||
:label="item.storetag"
|
||
:value="item.id">
|
||
</el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item>
|
||
<el-input size="small" v-model="group_home_goods_query" placeholder="套餐名称"></el-input>
|
||
</el-form-item>
|
||
<el-form-item>
|
||
<el-button size="mini" type="primary" plain @click="mealGroupQuery">查询</el-button>
|
||
</el-form-item>
|
||
<el-form-item>
|
||
<if condition="$authArr['shop_goods_group_deposit'] eq true">
|
||
<el-button size="mini" type="primary" @click="mealNewlyAdd">新增</el-button>
|
||
</if>
|
||
</el-form-item>
|
||
</el-form>
|
||
<el-table border :data="mealGoodsList">
|
||
<el-table-column type="index" label="序号" width="50"></el-table-column>
|
||
<el-table-column prop="meal_name" label="套餐名称"></el-table-column>
|
||
<el-table-column prop="storetag" label="门店名称"></el-table-column>
|
||
<el-table-column prop="time" label="时长(天)"></el-table-column>
|
||
<el-table-column prop="right" label="操作" width="90">
|
||
<template slot-scope="scope">
|
||
<if condition="$authArr['groupGoods'] eq true">
|
||
<el-button type="text" size="mini" @click="getGroupGoods(scope.$index)">查看
|
||
</el-button>
|
||
</if>
|
||
<if condition="$authArr['delMealGroup'] eq true">
|
||
<el-button type="text" size="mini" @click="delMealGroup(scope.row.id)">
|
||
删除
|
||
</el-button>
|
||
</if>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
<el-pagination
|
||
@size-change="mealGroupSizeChange"
|
||
@current-change="mealGroupCurrentChange"
|
||
:pager-count="5"
|
||
:page-sizes="[10,20,30,40,50,60,70,80,90,100]"
|
||
:page-size="10"
|
||
layout="total,sizes, prev, pager, next, jumper"
|
||
:total="goods_group_len">
|
||
</el-pagination>
|
||
|
||
</el-tab-pane>
|
||
</el-tabs>
|
||
<el-dialog title="套餐组商品" :modal-append-to-body="false" :visible.sync="groupGoodsStatus" :close-on-click-modal="false" width="900px">
|
||
<el-form :inline="true" class="demo-form-inline">
|
||
<el-form-item>
|
||
<if condition="$authArr['group_goods_add'] eq true">
|
||
<el-button size="mini" type="primary" @click="group_goods_add">添加商品</el-button>
|
||
</if>
|
||
</el-form-item>
|
||
</el-form>
|
||
<el-table border :data="groupGoodsList" style="width: 100%;">
|
||
<el-table-column prop="goods_name" label="名称"></el-table-column>
|
||
<el-table-column prop="goods_number" label="货号"></el-table-column>
|
||
<el-table-column prop="goods_code" label="条码"></el-table-column>
|
||
<el-table-column prop="online_state" label="商城出售状态">
|
||
<template slot-scope="scope">
|
||
{{scope.row.online_state==1?'开启':'关闭'}}
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column prop="right" label="操作" width="90">
|
||
<template slot-scope="scope">
|
||
<if condition="$authArr['delete_group_goods'] eq true">
|
||
<el-button type="text" size="mini" @click="delGroupGoods(scope.row.id)">删除</el-button>
|
||
</if>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
<el-pagination
|
||
@size-change="groupGoodsSizeChange"
|
||
@current-change="groupGoodsCurrentChange"
|
||
:pager-count="5"
|
||
:page-sizes="[10,20,30,40,50,60,70,80,90,100]"
|
||
:page-size="10"
|
||
layout="total,sizes, prev, pager, next, jumper"
|
||
:total="groupGoodsLen">
|
||
</el-pagination>
|
||
</el-dialog>
|
||
<el-dialog title="新增购买商品活动" :modal-append-to-body="false" :visible.sync="storeGoodsShow" :close-on-click-modal="false" width="900px">
|
||
<el-form id="meal_form" label-width="100px">
|
||
<template v-if="isMealGroup">
|
||
<el-form-item label="套餐名称">
|
||
<el-input style="width: 214px;" size="small" name="meal_name" v-model="meal_name"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="头像图片">
|
||
<label class="file_label">
|
||
<input type="hidden" name="logo_id"/>
|
||
<input type="file" @change="chooseImg" name="logo" placeholder="选择图片"
|
||
accept="image/png,image/jpeg"/>
|
||
<img style="max-width: 200px" src="defaulImg"
|
||
onerror="this.onerror=null;this.src='__PUBLIC__/paper/images/wx_add.png'">
|
||
</label>
|
||
<el-button plain size="mini" @click="selectImage('logo')"
|
||
icon="el-icon-upload el-icon--right">选择图片
|
||
</el-button>
|
||
<p>建议大小312*256</p>
|
||
</el-form-item>
|
||
</template>
|
||
<el-form-item v-if="new_add_status!=3" label="时效(天)">
|
||
<el-input size="small"
|
||
style="width: 214px"
|
||
placeholder="如:30、90、365,上限9999"
|
||
v-model="goods_time"
|
||
oninput="value=this.value.replace(/^[0]|\D/,'')"></el-input>
|
||
</el-form-item>
|
||
<el-form-item v-if="new_add_status!=3" label="选择门店">
|
||
<el-select size="small" v-model="store_id" filterable placeholder="请选择门店" @change="choiceStore">
|
||
<el-option
|
||
v-for="item in store_info"
|
||
:key="item.id"
|
||
:label="item.storetag"
|
||
:value="item.id">
|
||
</el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="操作">
|
||
<div style="display: flex;align-items: center;justify-content: space-between;">
|
||
<div>
|
||
<el-input style="width: 214px;margin-right: 20px;" :clearable="true" size="small"
|
||
v-model="goods_query" placeholder="名称/货号"></el-input>
|
||
<el-button size="mini" type="primary" plain @click="query">查询</el-button>
|
||
</div>
|
||
<el-button size="mini" type="primary" @click="shop_goods_deposit">保存</el-button>
|
||
</div>
|
||
</el-form-item>
|
||
<el-form-item label="商品列表">
|
||
<el-table border :data="store_goods" style="width: 100%;"
|
||
@selection-change="shop_goods_choice">
|
||
<el-table-column type="selection"></el-table-column>
|
||
<el-table-column prop="goods_name" label="名称"></el-table-column>
|
||
<el-table-column prop="goods_number" label="货号"></el-table-column>
|
||
<el-table-column prop="goods_code" label="条码"></el-table-column>
|
||
</el-table>
|
||
<el-pagination
|
||
@size-change="handleSizeChange"
|
||
@current-change="handleCurrentChange"
|
||
:pager-count="5"
|
||
:page-sizes="[10,20,30,40,50,60,70,80,90,100]"
|
||
:page-size="10"
|
||
layout="total,sizes, prev, pager, next, jumper"
|
||
:total="store_len">
|
||
</el-pagination>
|
||
</el-form-item>
|
||
</el-form>
|
||
</el-dialog>
|
||
<el-dialog title="添加直接购买Plus会员套餐" :modal-append-to-body="false" :visible.sync="showAddActivity" :close-on-click-modal="false" width="500px">
|
||
<div class="addActivity">
|
||
<el-form label-width="120px" :model="activityForm" :rules="activityRules" ref="activityForm">
|
||
<el-form-item label="套餐名称" prop="time_name">
|
||
<el-input size="small" placeholder="如:月卡、季卡、年卡" v-model="activityForm.time_name"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="套餐价格" prop="price">
|
||
<el-input size="small" v-model="activityForm.price"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="套餐时长(天)" prop="time">
|
||
<el-input size="small"
|
||
placeholder="如:30、90、365,上限9999"
|
||
v-model="activityForm.time"
|
||
oninput="value=this.value.replace(/^[0]|\D/,'')"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="套餐类型" prop="type">
|
||
<el-radio-group v-model="activityForm.type">
|
||
<el-radio :label="1">初始购买套餐</el-radio>
|
||
<el-radio :label="2">续费购买套餐</el-radio>
|
||
</el-radio-group>
|
||
</el-form-item>
|
||
<el-form-item label="套餐状态" prop="status">
|
||
<el-switch
|
||
v-model="activityForm.status"
|
||
:active-value="1"
|
||
:inactive-value="0"
|
||
:active-text="activityForm.status==1?'开启':'关闭'">
|
||
</el-switch>
|
||
</el-form-item>
|
||
</el-form>
|
||
</div>
|
||
<div class="center">
|
||
<el-button size="mini" type="primary" @click="sureAddActivity('activityForm')">保存</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
<el-dialog title="选择图片" :modal-append-to-body="false" :visible.sync="showSelectImage" :close-on-click-modal="false"
|
||
custom-class="select-image-el-dialog administrationApp-select-image-el-dialog"
|
||
:top="'50px'">
|
||
<template-select-image :can-select-num="1" @selectfile="selectFile"></template-select-image>
|
||
</el-dialog>
|
||
</div>
|
||
<script type="text/javascript">
|
||
var administrationApp = new Vue({
|
||
el: '#administrationApp',
|
||
data: {
|
||
activeName: '1',
|
||
GoodsStatus: '1',
|
||
recharge_switch_type: "{$plus_info['recharge_switch_type']}" == 2 ? true : false,
|
||
purchase_switch_type: "{$plus_info['purchase_switch_type']}" == 2 ? true : false,
|
||
renew_recharge_switch_type: "{$plus_info['renew_recharge_switch_type']}" == 2 ? true : false,
|
||
renew_purchase_switch_type: "{$plus_info['renew_purchase_switch_type']}" == 2 ? true : false,
|
||
goods_switch_type: "{$plus_info['goods_switch_type']}" == 2 ? true : false,
|
||
goods_group_switch_type: "{$plus_info['goods_group_switch_type']}" == 2 ? true : false, //套餐开关
|
||
preservation: "{$authArr['preservation']}" == 1 ? false : true,
|
||
purchase_money: "{$plus_info['purchase_money']}",
|
||
renew_purchase_money: "{$plus_info['renew_purchase_money']}",
|
||
storeGoodsShow: false,
|
||
goodsLen: 0,
|
||
goods_group_len: 0,
|
||
goodsCurrentLimit: 10,
|
||
goodsCurrentPage: 1,
|
||
activityLen: 0,
|
||
activityCurrentLimit: 10,
|
||
activityCurrentPage: 1,
|
||
plusActivity: [],
|
||
home_goods_query: '',
|
||
store_info: {$store_info},
|
||
store_len: 0,
|
||
currentLimit: 10,
|
||
currentPage: 1,
|
||
plusGoods: [],
|
||
store_id: '',
|
||
home_store_id: '',
|
||
store_goods: [],
|
||
goods_query: '',
|
||
shop_goods: [],
|
||
mealGoodsList: [], //套餐组
|
||
mealCurrentLimit: 10,
|
||
mealCurrentPage: 1,
|
||
group_home_goods_query: '',
|
||
new_add_status: '1', //1单个商品新增 2套餐组新增
|
||
isMealGroup: false, //是否是添加套餐组
|
||
group_storeid: '', //套餐组门店查询
|
||
showSelectImage: false, //套餐图片
|
||
actFileName: '',
|
||
groupGoodsStatus: false, //套餐组商品模块状态
|
||
groupGoodsList: [], //套餐组中的商品
|
||
groupGoodsCurrentLimit: 10,
|
||
groupGoodsCurrentPage: 1,
|
||
groupGoodsLen: 0,
|
||
group_id: '', //套餐组id
|
||
defaulImg: '', //默认套餐图片
|
||
showAddActivity: false,//是否显示添加套餐
|
||
activityType: '',
|
||
activityForm: {
|
||
time_name: '',
|
||
price: '',
|
||
time: '',
|
||
type: 1,
|
||
status: 0,
|
||
},
|
||
activityRules: {
|
||
time_name: [{message: '请输入套餐名称', required: true, trigger: 'blur'}, {
|
||
min: 1,
|
||
max: 25,
|
||
message: '限制长度 1 到 25',
|
||
}],
|
||
price: [{message: '请输入正确的价格', required: true, trigger: 'blur'}, {
|
||
validator: function (rule, value, callback) {
|
||
var reg = /^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d{0,2})$/;
|
||
if (reg.test(value) == false || value < 0) {
|
||
callback(new Error("请输入正确的价格"));
|
||
} else {
|
||
callback();
|
||
}
|
||
}, trigger: 'blur'
|
||
}],
|
||
time: [{message: '请输入正确的天数', required: true, trigger: 'blur'}, {
|
||
validator: function (rule, value, callback) {
|
||
var reg = /(^[1-9]{1,4}$)|(^[1-9]{0,1}[0-9]{0,3}$)/;
|
||
if (reg.test(value) == false) {
|
||
callback(new Error("请输入正确的天数"));
|
||
} else {
|
||
callback();
|
||
}
|
||
}, trigger: 'blur'
|
||
}],
|
||
type: [{message: '请选择套餐类型', required: true, trigger: 'blur'}],
|
||
status: [{message: '请设置套餐状态', required: true, trigger: 'blur'}],
|
||
},
|
||
goods_time: '',
|
||
meal_name: '',
|
||
},
|
||
methods: {
|
||
//指定商品
|
||
getPlusGoods: function () {
|
||
var that = this;
|
||
var goodsCurrentLimit = that.goodsCurrentLimit;
|
||
var goodsCurrentPage = that.goodsCurrentPage;
|
||
var home_goods_query = that.home_goods_query;
|
||
var home_store_id = that.home_store_id;
|
||
$.ajax({
|
||
url: "{:U('plus_goods_show')}",
|
||
type: "post",
|
||
data: {
|
||
page: goodsCurrentPage,
|
||
limit: goodsCurrentLimit,
|
||
home_store_id: home_store_id,
|
||
home_goods_query: home_goods_query
|
||
},
|
||
success: function (res) {
|
||
that.plusGoods = res.info;
|
||
that.goodsLen = res.count;
|
||
that.goodsCurrentPage = res.page;
|
||
}
|
||
})
|
||
},
|
||
getMealGroupGoods: function () {
|
||
var that = this;
|
||
var mealCurrentLimit = that.mealCurrentLimit;
|
||
var mealCurrentPage = that.mealCurrentPage;
|
||
var group_home_goods_query = that.group_home_goods_query;
|
||
var group_storeid = that.group_storeid;
|
||
console.log(group_storeid);
|
||
$.ajax({
|
||
url: "{:U('plus_meal_group_goods_show')}",
|
||
type: "post",
|
||
data: {
|
||
page: mealCurrentPage,
|
||
limit: mealCurrentLimit,
|
||
meal_name: group_home_goods_query,
|
||
store_id: group_storeid
|
||
},
|
||
success: function (res) {
|
||
that.mealGoodsList = res.info;
|
||
that.goods_group_len = res.count;
|
||
that.mealCurrentPage = res.page;
|
||
}
|
||
})
|
||
},
|
||
//单个商品查询
|
||
homeQuery: function () {
|
||
this.goodsCurrentLimit = 10;
|
||
this.goodsCurrentPage = 1;
|
||
this.getPlusGoods();
|
||
},
|
||
//套餐查询
|
||
mealGroupQuery: function () {
|
||
this.mealCurrentLimit = 10;
|
||
this.mealCurrentPage = 1;
|
||
this.getMealGroupGoods();
|
||
},
|
||
//指定商品列表切换每页数量
|
||
goodsHandleSizeChange: function (val) {
|
||
this.goodsCurrentLimit = val;
|
||
this.goodsCurrentPage = 1;
|
||
this.getPlusGoods();
|
||
},
|
||
//指定商品列表切换分页
|
||
goodsHandleCurrentChange: function (val) {
|
||
this.goodsCurrentPage = val;
|
||
this.getPlusGoods();
|
||
},
|
||
mealGroupSizeChange: function (val) { //套餐组
|
||
this.mealCurrentLimit = val;//切换每页数量
|
||
this.mealCurrentPage = 1;
|
||
this.getMealGroupGoods();
|
||
},
|
||
mealGroupCurrentChange: function (val) {
|
||
this.goodsCurrentPage = val;
|
||
this.getMealGroupGoods();
|
||
},
|
||
//保存基本设置
|
||
submitSet: function () {
|
||
var that = this;
|
||
$.ajax({
|
||
url: "{:U('preservation')}",
|
||
type: "post",
|
||
data: {
|
||
recharge_switch_type: that.recharge_switch_type ? 2 : 1,
|
||
purchase_switch_type: that.purchase_switch_type ? 2 : 1,
|
||
renew_purchase_switch_type: that.renew_purchase_switch_type ? 2 : 1,
|
||
goods_switch_type: that.goods_switch_type ? 2 : 1,
|
||
renew_recharge_switch_type: that.renew_recharge_switch_type ? 2 : 1,
|
||
goods_group_switch_type: that.goods_group_switch_type ? 2 : 1,
|
||
},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
that.$message({
|
||
type: 'success',
|
||
message: res.msg,
|
||
duration: 1500
|
||
})
|
||
} else {
|
||
that.$message({
|
||
type: 'error',
|
||
message: res.msg,
|
||
duration: 1500
|
||
})
|
||
}
|
||
}
|
||
})
|
||
},
|
||
//新增购买指定商品成为plus会员
|
||
newlyAdd: function () {
|
||
var that = this;
|
||
that.storeGoodsShow = true;
|
||
that.new_add_status = 1;
|
||
that.isMealGroup = false;
|
||
that.getStoreGoods();
|
||
},
|
||
//套餐新增
|
||
mealNewlyAdd: function () {
|
||
var that = this;
|
||
that.storeGoodsShow = true;
|
||
that.isMealGroup = true;
|
||
that.new_add_status = 2;
|
||
that.getStoreGoods();
|
||
},
|
||
chooseImg: function () {
|
||
if (window.event.target.files.length) {
|
||
console.log(22)
|
||
var that = this;
|
||
var imgObj = window.event.target.files[0];
|
||
var imgType = ['image/jpeg', 'image/jpg', 'image/png'];
|
||
if (jQuery.inArray(imgObj.type, imgType) != -1) {
|
||
//是图片
|
||
var reader = new FileReader();
|
||
reader.readAsDataURL(imgObj);
|
||
reader.onload = function () {
|
||
$("input[name='logo']").next('img').attr('src', this.result);
|
||
}
|
||
}
|
||
}
|
||
},
|
||
//选择图片
|
||
selectImage: function (actName) {
|
||
//将选择图片
|
||
this.actFileName = actName;
|
||
this.showSelectImage = true;
|
||
},
|
||
selectFile: function (item) {
|
||
//选择文件
|
||
this.showSelectImage = false;
|
||
if (!item.length) {
|
||
$("input[name='" + this.actFileName + "']").click();
|
||
} else {
|
||
$("input[name='" + this.actFileName + "_id']").val(item[0].id);
|
||
$("input[name='" + this.actFileName + "']").next('img').attr('src', item[0].path);
|
||
}
|
||
},
|
||
//获取门店新增套餐可选商品
|
||
getStoreGoods: function () {
|
||
var that = this;
|
||
$.ajax({
|
||
url: "{:U('store_goods')}",
|
||
type: "post",
|
||
data: {
|
||
store_id: that.store_id,
|
||
page: that.currentPage,
|
||
limit: that.currentLimit,
|
||
goods_query: that.goods_query
|
||
},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
that.store_goods = res.info;
|
||
that.store_len = res.store_len;
|
||
} else {
|
||
that.store_goods = [];
|
||
}
|
||
}
|
||
})
|
||
},
|
||
//plus下拉选项
|
||
homeChoice: function () {
|
||
var that = this;
|
||
that.goodsCurrentLimit = 10;
|
||
that.goodsCurrentPage = 1;
|
||
that.home_goods_query = '';
|
||
that.getPlusGoods();
|
||
},
|
||
//选择门店
|
||
choiceStore: function () {
|
||
this.goods_query = '';
|
||
this.query();
|
||
},
|
||
//查询
|
||
query: function () {
|
||
this.currentLimit = 10;
|
||
this.currentPage = 1;
|
||
this.getStoreGoods();
|
||
},
|
||
handleSizeChange(val) {
|
||
this.currentLimit = val;//切换每页数量
|
||
this.currentPage = 1;
|
||
this.getStoreGoods();
|
||
},
|
||
handleCurrentChange(val) {
|
||
this.currentPage = val;
|
||
this.getStoreGoods();//切换页数
|
||
},
|
||
//重置新增的表单
|
||
resetForm: function () {
|
||
$("input[name='logo_id']").val('');
|
||
$("input[name='logo']").val('');
|
||
$("input[name='logo']").next('img').attr('src', '__PUBLIC__/paper/images/wx_add.png');
|
||
this.meal_name = '';
|
||
this.goods_time = '';
|
||
this.store_id = '';
|
||
},
|
||
//商品保存
|
||
shop_goods_deposit: function () {
|
||
var that = this;
|
||
var store_id = that.store_id;
|
||
var shop_goods = that.shop_goods;
|
||
var shop_goods_id = [];
|
||
var new_add_status = that.new_add_status; //1单个商品新增 2套餐组 3为新增套餐中的商品
|
||
var group_id = that.group_id; // new_add_status = 3 时套餐组id
|
||
if (!store_id) {
|
||
that.$message({
|
||
type: 'error',
|
||
message: "请选择门店",
|
||
duration: 1500
|
||
});
|
||
return false;
|
||
}
|
||
if (!shop_goods || shop_goods.length <= 0) {
|
||
that.$message({
|
||
type: 'error',
|
||
message: "请选择商品",
|
||
duration: 1500
|
||
})
|
||
return false;
|
||
}
|
||
for (var i = 0; i < shop_goods.length; i++) {
|
||
shop_goods_id.push(shop_goods[i].id);
|
||
}
|
||
if (new_add_status == 1) {
|
||
if (!that.goods_time) {
|
||
that.$message({
|
||
type: 'error',
|
||
message: "请设置天数",
|
||
duration: 1500
|
||
});
|
||
return false;
|
||
}
|
||
if (that.goods_time > 9999) {
|
||
that.$message({
|
||
type: 'error',
|
||
message: "时间最多9999天",
|
||
duration: 1500
|
||
});
|
||
return false;
|
||
}
|
||
that.$loading({
|
||
lock: true,
|
||
text: '保存中,请等待',
|
||
spinner: 'el-icon-loading',
|
||
background: 'rgba(255, 255, 255, 0.3)'
|
||
});
|
||
$.ajax({
|
||
url: "{:U('shop_goods_deposit')}",
|
||
type: "post",
|
||
data: {
|
||
store_id: store_id,
|
||
shop_goods_id: shop_goods_id,
|
||
goods_time: that.goods_time,
|
||
},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
that.$message({
|
||
type: 'success',
|
||
message: res.msg,
|
||
duration: 1500
|
||
})
|
||
that.resetForm();
|
||
that.storeGoodsShow = false;
|
||
that.getPlusGoods();
|
||
} else {
|
||
that.$message({
|
||
type: 'error',
|
||
message: res.msg,
|
||
duration: 1500
|
||
})
|
||
}
|
||
that.$loading().close();
|
||
}
|
||
})
|
||
} else if (new_add_status == 2) {
|
||
if (!that.goods_time) {
|
||
that.$message({
|
||
type: 'error',
|
||
message: "请设置天数",
|
||
duration: 1500
|
||
});
|
||
return false;
|
||
}
|
||
if (that.goods_time > 9999) {
|
||
that.$message({
|
||
type: 'error',
|
||
message: "时间最多9999天",
|
||
duration: 1500
|
||
});
|
||
return false;
|
||
}
|
||
var meal_form = new FormData(document.getElementById('meal_form'));
|
||
if (!$("input[name='logo']").val() && !$("input[name='logo_id']").val()) {
|
||
this.$message({
|
||
type: 'warning',
|
||
message: '您未修改图片',
|
||
duration: 1000
|
||
});
|
||
return;
|
||
}
|
||
that.$loading({
|
||
lock: true,
|
||
text: '保存中,请等待',
|
||
spinner: 'el-icon-loading',
|
||
background: 'rgba(255, 255, 255, 0.3)'
|
||
});
|
||
$.ajax({
|
||
url: "{:U('image_upload')}",
|
||
type: "post",
|
||
data: meal_form,
|
||
processData: false, // jQuery不要去处理发送的数据
|
||
contentType: false, // jQuery不要去设置Content-Type请求头
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
var image_id = res.image_id;
|
||
var meal_name = res.meal_name;
|
||
$.ajax({
|
||
url: "{:U('shop_goods_group_deposit')}",
|
||
type: "post",
|
||
data: {
|
||
store_id: store_id,
|
||
shop_goods_id: shop_goods_id,
|
||
meal_name: meal_name,
|
||
image_id: image_id,
|
||
goods_time: that.goods_time,
|
||
},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
that.$message({
|
||
type: 'success',
|
||
message: res.msg,
|
||
duration: 1500
|
||
});
|
||
that.resetForm();
|
||
that.storeGoodsShow = false;
|
||
that.getMealGroupGoods();
|
||
} else {
|
||
that.$message({
|
||
type: 'error',
|
||
message: res.msg,
|
||
duration: 1500
|
||
})
|
||
}
|
||
that.$loading().close();
|
||
}
|
||
})
|
||
} else {
|
||
that.$loading().close();
|
||
that.$message({
|
||
type: 'success',
|
||
message: res.msg,
|
||
duration: 1500
|
||
})
|
||
}
|
||
}
|
||
})
|
||
} else if (new_add_status == 3) { //保存套餐中的商品
|
||
if (!group_id) {
|
||
that.$message({
|
||
type: 'error',
|
||
message: "登录超时",
|
||
duration: 1000
|
||
})
|
||
return false;
|
||
}
|
||
that.$loading({
|
||
lock: true,
|
||
text: '保存中,请等待',
|
||
spinner: 'el-icon-loading',
|
||
background: 'rgba(255, 255, 255, 0.3)'
|
||
});
|
||
$.ajax({
|
||
url: "{:U('group_goods_add')}",
|
||
type: "post",
|
||
data: {
|
||
group_id: group_id,
|
||
shop_goods_id: shop_goods_id,
|
||
store_id: store_id
|
||
},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
that.$message({
|
||
type: 'success',
|
||
message: res.msg,
|
||
duration: 1000
|
||
})
|
||
that.seeGroupGoods();
|
||
} else {
|
||
that.$message({
|
||
type: 'error',
|
||
message: res.msg,
|
||
duration: 1500
|
||
})
|
||
}
|
||
that.$loading().close();
|
||
}
|
||
})
|
||
} else {
|
||
that.$message({
|
||
type: 'error',
|
||
message: "登录超时",
|
||
duration: 1500
|
||
})
|
||
}
|
||
},
|
||
//删除指定商品
|
||
delPromotion: function (id) {
|
||
var that = this;
|
||
this.$confirm('确认删除该商品?删除后将不能恢复,请谨慎操作!', '提示', {
|
||
confirmButtonText: '删除',
|
||
cancelButtonText: '取消',
|
||
type: 'warning'
|
||
}).then(() => {
|
||
$.ajax({
|
||
url: "{:U('delPromotion')}",
|
||
type: "post",
|
||
data: {id: id},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
that.$message({
|
||
type: 'success',
|
||
message: res.msg,
|
||
duration: 1000
|
||
});
|
||
that.getPlusGoods();
|
||
} else {
|
||
that.$message({
|
||
type: 'error',
|
||
message: res.msg,
|
||
duration: 1000
|
||
})
|
||
}
|
||
}
|
||
})
|
||
}).catch(() => {
|
||
})
|
||
},
|
||
//plus套餐组门店选择查询
|
||
groupChoice: function () {
|
||
this.mealCurrentLimit = 10;
|
||
this.mealCurrentPage = 1;
|
||
this.getMealGroupGoods();
|
||
},
|
||
//删除套餐组
|
||
delMealGroup: function (id) {
|
||
var that = this;
|
||
this.$confirm('确认删除该套餐?删除后将不能恢复,请谨慎操作!', '提示', {
|
||
confirmButtonText: '删除',
|
||
cancelButtonText: '取消',
|
||
type: 'warning'
|
||
}).then(() => {
|
||
$.ajax({
|
||
url: "{:U('delMealGroup')}",
|
||
type: "post",
|
||
data: {
|
||
id: id,
|
||
},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
that.$message({
|
||
type: 'success',
|
||
message: res.msg,
|
||
duration: 1000
|
||
});
|
||
that.getMealGroupGoods();
|
||
} else {
|
||
that.$message({
|
||
type: 'error',
|
||
message: res.msg,
|
||
duration: 1000
|
||
})
|
||
}
|
||
}
|
||
})
|
||
}).catch(() => {
|
||
})
|
||
},
|
||
shop_goods_choice: function (data) {
|
||
this.shop_goods = [];
|
||
this.shop_goods = data;
|
||
},
|
||
//套餐组中的商品
|
||
getGroupGoods: function (index) {
|
||
console.log(index);
|
||
var mealGoodsList = JSON.parse(JSON.stringify(this.mealGoodsList));
|
||
console.log(mealGoodsList);
|
||
this.group_id = mealGoodsList[index].id;
|
||
this.store_id = mealGoodsList[index].storeid;
|
||
this.new_add_status = 3;
|
||
this.groupGoodsStatus = true;
|
||
this.seeGroupGoods();
|
||
},
|
||
seeGroupGoods: function () {
|
||
var that = this;
|
||
$.ajax({
|
||
url: "{:U('groupGoods')}",
|
||
type: "post",
|
||
data: {
|
||
id: that.group_id,
|
||
limit: that.groupGoodsCurrentLimit,
|
||
page: that.groupGoodsCurrentPage
|
||
},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
that.groupGoodsList = res.info;
|
||
that.groupGoodsLen = res.len;
|
||
} else {
|
||
that.groupGoodsList = [];
|
||
}
|
||
}
|
||
})
|
||
},
|
||
groupGoodsSizeChange: function (val) {
|
||
this.groupGoodsCurrentLimit = val;//切换每页数量
|
||
this.groupGoodsCurrentPage = 1;
|
||
var group_id = this.group_id;
|
||
this.seeGroupGoods();
|
||
},
|
||
//切换页数
|
||
groupGoodsCurrentChange: function (val) {
|
||
this.groupGoodsCurrentPage = val;
|
||
var group_id = this.group_id;
|
||
this.seeGroupGoods();
|
||
},
|
||
//删除套餐中的商品
|
||
delGroupGoods: function (id) {
|
||
var that = this;
|
||
var group_id = that.group_id;
|
||
$.ajax({
|
||
url: "{:U('delete_group_goods')}",
|
||
type: "post",
|
||
data: {
|
||
id: id,
|
||
group_id: group_id
|
||
},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
that.$message({
|
||
type: 'success',
|
||
message: res.msg,
|
||
duration: 1000
|
||
})
|
||
that.seeGroupGoods();
|
||
} else {
|
||
that.$message({
|
||
type: 'error',
|
||
message: res.msg,
|
||
duration: 1000
|
||
})
|
||
}
|
||
}
|
||
})
|
||
},
|
||
group_goods_add: function () {
|
||
var that = this;
|
||
that.new_add_status = 3; //3为新增套餐中的商品
|
||
that.storeGoodsShow = true;
|
||
that.isMealGroup = false;
|
||
that.getStoreGoods();
|
||
},
|
||
activityHandleSizeChange: function (val) {
|
||
this.activityCurrentLimit = val;//切换每页数量
|
||
this.activityCurrentPage = 1;
|
||
this.getPlusActivity();
|
||
},
|
||
activityHandleCurrentChange: function (val) {
|
||
this.activityCurrentPage = val;
|
||
this.getPlusActivity();
|
||
},
|
||
//添加plus会员购买套餐
|
||
addActivity: function () {
|
||
this.showAddActivity = true;
|
||
this.activityForm = {
|
||
time_name: '',
|
||
time: '',
|
||
type: 1,
|
||
status: 0,
|
||
};
|
||
},
|
||
//提交数据
|
||
sureAddActivity: function (formName) {
|
||
var that = this;
|
||
this.$refs[formName].validate((valid) => {
|
||
if (valid) {
|
||
that.$confirm("确认添加以上设置的套餐吗?", "温馨提示", {
|
||
confirmButtonText: '添加',
|
||
cancelButtonText: '取消',
|
||
type: 'info'
|
||
}).then(() => {
|
||
that.$loading({
|
||
lock: true,
|
||
text: '保存中,请等待',
|
||
spinner: 'el-icon-loading',
|
||
background: 'rgba(255, 255, 255, 0.3)'
|
||
});
|
||
$.ajax({
|
||
url: "{:U('addActivity')}", //图片上传出来的url,返回的是图片上传后的路径,http格式
|
||
data: that.activityForm,
|
||
type: "POST",
|
||
success: function (res) {
|
||
that.$loading().close();
|
||
if (res.status == 1) {
|
||
that.getPlusActivity();
|
||
that.showAddActivity = false;
|
||
that.$message({
|
||
message: res.msg,
|
||
type: 'success',
|
||
duration: 1500,
|
||
});
|
||
} else {
|
||
that.$message({message: res.msg, type: 'error'});
|
||
}
|
||
}, error: function () {
|
||
that.$loading().close();
|
||
that.$message({message: '系统发生错误', type: 'error'});
|
||
}
|
||
});
|
||
}).catch(() => {
|
||
})
|
||
} else {
|
||
that.$message({message: '请完善必填项', type: 'error'});
|
||
}
|
||
});
|
||
},
|
||
//开启关闭plus会员套餐
|
||
changeActivity: function (id, status, index) {
|
||
var that = this;
|
||
$.ajax({
|
||
url: "{:U('changeActivity')}",
|
||
type: 'post',
|
||
data: {
|
||
id: id,
|
||
status: status,
|
||
},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
that.$message({
|
||
message: res.msg,
|
||
type: 'success',
|
||
duration: 1500,
|
||
});
|
||
} else {
|
||
var plusActivity = JSON.parse(JSON.stringify(that.plusActivity));
|
||
plusActivity[index].status = plusActivity[index].status == 1 ? '0' : '1';
|
||
that.plusActivity = [];
|
||
that.plusActivity = plusActivity;
|
||
that.$message({
|
||
message: res.msg,
|
||
type: 'error',
|
||
duration: 1500,
|
||
});
|
||
}
|
||
},
|
||
error: function () {
|
||
var plusActivity = JSON.parse(JSON.stringify(that.plusActivity));
|
||
plusActivity[index].status = plusActivity[index].status == 1 ? '0' : '1';
|
||
that.plusActivity = [];
|
||
that.plusActivity = plusActivity;
|
||
that.$message({
|
||
message: "请求发生错误",
|
||
type: 'error',
|
||
duration: 1500,
|
||
});
|
||
}
|
||
})
|
||
},
|
||
//删除plus会员套餐
|
||
delActivity: function (id) {
|
||
var that = this;
|
||
this.$confirm('确认删除该Plus购买套餐?删除后将不能恢复,请谨慎操作!', '提示', {
|
||
confirmButtonText: '删除',
|
||
cancelButtonText: '取消',
|
||
type: 'warning'
|
||
}).then(() => {
|
||
$.ajax({
|
||
url: "{:U('delActivity')}",
|
||
type: 'post',
|
||
data: {
|
||
id: id
|
||
},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
that.$message({
|
||
message: res.msg,
|
||
type: 'success',
|
||
duration: 1500,
|
||
});
|
||
that.getPlusActivity();
|
||
} else {
|
||
that.$message({
|
||
message: res.msg,
|
||
type: 'error',
|
||
duration: 1500,
|
||
});
|
||
}
|
||
},
|
||
error: function () {
|
||
that.$message({
|
||
message: "请求发生错误",
|
||
type: 'error',
|
||
duration: 1500,
|
||
});
|
||
}
|
||
})
|
||
}).catch(() => {
|
||
})
|
||
},
|
||
//选择套餐类型搜索
|
||
queryPlusActivity: function () {
|
||
this.activityCurrentPage = 1;
|
||
this.getPlusActivity();
|
||
},
|
||
//获取plus会员套餐
|
||
getPlusActivity: function () {
|
||
var that = this;
|
||
$.ajax({
|
||
url: "{:U('getPlusActivity')}",
|
||
type: "post",
|
||
data: {
|
||
page: that.activityCurrentPage,
|
||
limit: that.activityCurrentLimit,
|
||
activityType: that.activityType,
|
||
},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
that.plusActivity = [];
|
||
that.plusActivity = res.data;
|
||
that.activityLen = res.count;
|
||
} else {
|
||
that.plusActivity = [];
|
||
}
|
||
}
|
||
})
|
||
}
|
||
},
|
||
created: function () {
|
||
this.getPlusGoods();
|
||
this.getMealGroupGoods();
|
||
this.getPlusActivity();
|
||
}
|
||
})
|
||
</script> |