文件

113 行
3.9 KiB
HTML
可执行文件

<!--[1.4.90]-->
<style>
#ShippingApp .el-form-item--small.el-form-item{
margin-bottom: 0;
}
#ShippingApp .el-form{
margin-top: 10px;
}
</style>
<div id="ShippingApp">
<div class="goods_title">
<div class="goods_title_inner">
商城商品详情页
</div>
</div>
<el-form size="small">
<el-form-item label="引导成为常规会员">
<el-switch @change="changeStatus(1)"
v-model="vip_register_state"
:inactive-value="0"
:disabled="!operate.operate"
:active-value="1">
</el-switch>
<span style="color:#999;font-size: 12px;">开关为开启时,用户不是会员时显示引导注册会员</span>
</el-form-item>
<el-form-item label="引导成为/续费PLUS会员">
<el-switch @change="changeStatus(2)"
v-model="plus_register_state"
:inactive-value="0"
:disabled="!operate.operate"
:active-value="1">
</el-switch>
<span style="color:#999;font-size: 12px;">开关为开启时,用户不是plus会员则引导用户进行开通,用户是plus会员则引导用户去续费</span>
</el-form-item>
</el-form>
</div>
<script type="text/javascript">
new Vue({
el: '#ShippingApp',
data: {
vip_register_state: 0,
plus_register_state: 0,
operate:{},
},
methods: {
changeStatus(type) {
$.ajax(({
url: "{:U('changeStatus')}",
type: 'post',
data:{
vip_register_state: this.vip_register_state,
plus_register_state: this.plus_register_state
},
success: (res) => {
if (res.status == 1) {
this.$message({
type: 'success',
message: res.msg,
});
} else {
if (type == 1) {
this.vip_register_state = this.vip_register_state == 1 ? 0 : 1;
} else {
this.plus_register_state = this.plus_register_state == 1 ? 0 : 1;
}
this.$message({
type: 'error',
message: res.msg,
});
}
},
error: (res) => {
console.log(res)
}
}))
},
getBaseData() {
$.ajax(({
url: "{:U('getBaseData')}",
type: 'post',
success: (res) => {
if (res.status == 1) {
this.vip_register_state = res.vip_register_state;
this.plus_register_state = res.plus_register_state;
}
},
error: (res) => {
console.log(res)
}
}))
},
},
created(){
this.getBaseData();
//获取操作权限
var auth_list = {
operate: '/index.php/Retail/Shipping/changeStatus',
};
$.ajax({
url: "{:U('Retail/Component/checkOperateAuth')}",
type: "post",
data: {
auth_list: JSON.stringify(auth_list),
},
success: (res) => {
if (res.status == 1) {
this.operate = res.data;
}
}
})
}
})
</script>