文件

591 行
25 KiB
HTML
可执行文件

<!--[1.7.14]-->
<style>
th {
background-color: #f5f7fa !important;
}
th > .cell {
white-space: nowrap !important;
text-align: center;
}
th, td {
text-align: center;
line-height: 30px;
padding: 0;
}
th > .cell, td > .cell {
text-align: center;
}
.el-table__row > td:last-child > .cell {
white-space: nowrap;
}
.el-pagination {
padding: 8px;
}
.el-input {
width: 200px;
}
.el-collapse-item__header {
font-weight: bold;
font-size: 14px;
}
.other-pay-content {
display: flex;
}
.other-pay-content .el-input {
margin-right: 5px;
}
.refund-circle-box {
display: flex;
align-items: center;
justify-content: center;
}
.refund-circle {
border: 1px solid #bbb;
border-radius: 50%;
padding: 5px;
margin: 0 5px;
cursor: pointer;
}
.refund-circle:hover {
border-color: #999;
color: #999;
}
.refund-circle:active {
border-color: #409EFF;
color: #409EFF;
}
.refund-circle-disabled {
cursor: not-allowed;
border: 1px solid #ddd;
color: #ddd;
}
.refund-circle.refund-circle-disabled:hover {
border: 1px solid #ddd;
color: #ddd;
}
.refund-circle.refund-circle-disabled:active {
border: 1px solid #ddd;
color: #ddd;
}
.list-complete-item {
transition: all 0.3s;
display: flex;
align-items: center;
border-bottom: 1px solid #ebeef5;
}
.list-complete-item > div {
flex: 1;
text-align: center;
border-right: 1px solid #ebeef5;
}
.list-complete-item > div:last-child {
border: none;
}
.list-complete-enter, .list-complete-leave-to {
opacity: 0;
transform: translateY(30px);
}
.list-complete-leave-active {
position: absolute;
}
.list-complete-item-title {
background-color: #f5f7fa;
}
.list-complete-item-title > div {
color: #909399;
font-weight: bold;
}
</style>
<div id="baseSetApp" v-cloak>
<el-collapse v-model="activeCollapseNames">
<el-collapse-item title="其他支付设置" name="1">
<el-form label-width="100px">
<el-form-item label="是否开启">
<el-switch v-model="other_pay"
:disabled="other_pay_disabled"
@change="changeOtherPay"
:active-text="other_pay==1?'开启':'关闭'"
inactive-value="0"
active-value="1">
</el-switch>
</el-form-item>
<el-form-item label="管理支付">
<div style="display: flex;align-items: center;justify-content: space-between">
<div>
<if condition="$authArr['addOtherPay'] eq true">
<el-input size="small"
type="text"
oninput="this.value=this.value.replace(/^ +| +$|-/g,'')"
placeholder="添加支付"
v-model="newOtherName"></el-input>
<el-button type="primary" size="small"
@click="addOtherPay">添加
</el-button>
<span style="color: #aaa;font-size: 13px">输入名称后直接点击添加</span>
</if>
</div>
<if condition="$authArr['delOtherPay'] eq true">
<el-button size="small" :disabled="checkOtherList.length?false:true"
@click="delSomeOtherPay">批量删除
</el-button>
</if>
</div>
</el-form-item>
<el-form-item label="支付列表">
<div style="max-width: calc(100vw - 308px);"
v-loading="otherPayLoading"
element-loading-text="数据加载中,请等待"
element-loading-spinner="el-icon-loading">
<el-table border :data="otherPayList"
size="small"
style="width: calc(100vw - 308px);box-sizing: border-box;"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="40"></el-table-column>
<el-table-column type="index" label="序号" width="50"></el-table-column>
<el-table-column prop="name" label="支付名称" min-width="100px">
<template slot-scope="scope">
<div class="other-pay-content" v-if="actOtherPayIndex==scope.$index">
<el-input type="primary"
size="small"
oninput="this.value=this.value.replace(/^ +| +$/g,'')"
v-model="scope.row.name"></el-input>
<el-button :disabaled="scope.row.name.length?false:true"
size="mini"
@click="upOtherPayName(scope.row.id,scope.row.name)"
type="primary">保存
</el-button>
<el-button type="text" size="mini" @click="actOtherPayIndex=-1">取消</el-button>
</div>
<div v-else>{{scope.row.name}}</div>
</template>
</el-table-column>
<el-table-column label="状态" min-width="56">
<template slot-scope="scope">
<el-switch
@change="changeOtherPayStatus(scope.$index,scope.row.status,scope.row.id)"
:disabled="otherPayStatusDisabled"
v-model="scope.row.status"
inactive-value="0"
active-value="1">
</el-switch>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" style="border-right: none;">
<template slot-scope="scope">
<if condition="$authArr['upOtherPayName'] eq true">
<el-button
@click.native.prevent="actOtherPayIndex=scope.$index"
type="text"
size="small">编辑
</el-button>
</if>
<if condition="$authArr['delOtherPay'] eq true">
<el-button @click.native.prevent="delOtherPay(scope.row.id,scope.row.name)"
style="color: #999"
type="text"
size="small">删除
</el-button>
</if>
</template>
</el-table-column>
</el-table>
<template v-if="currentLen>currentLimit">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[5]"
:page-size="100"
layout="total, sizes, prev, pager, next, jumper"
:total="currentLen">
</el-pagination>
</template>
</div>
</el-form-item>
</el-form>
</el-collapse-item>
<el-collapse-item title="退款顺序设置" name="3">
<el-form label-width="100px">
<el-form-item>
<div style="border: 1px solid #EBEEF5;">
<div class="list-complete-item list-complete-item-title">
<div>序号</div>
<div>名称</div>
<div>操作</div>
</div>
<transition-group name="list-complete" tag="ul">
<li v-for="(item,index) in refundList" class="list-complete-item"
:key="JSON.stringify(item)">
<div>{{index+1}}</div>
<div>{{item.name}}</div>
<div class="refund-circle-box">
<i class="refund-circle el-icon-arrow-up"
:class="index==0?'refund-circle-disabled':''"
@click="refundUp(index)"></i>
<i class="refund-circle el-icon-arrow-down"
:class="index==(refundList.length-1)?'refund-circle-disabled':''"
@click="refundDown(index)"></i>
</div>
</li>
</transition-group>
</div>
</el-form-item>
<el-form-item>
<el-button type="primary" size="mini" @click="saveOrderSet">保存设置</el-button>
</el-form-item>
</el-form>
</el-collapse-item>
<el-collapse-item title="支付成为会员" name="4">
<el-form label-width="100px">
<el-form-item label="是否开启" require>
<el-switch v-model="pay_to_vip_state"
:disabled="pay_to_vip_disabled"
@change="payToVip"
inactive-value="0"
:active-text="pay_to_vip_state==1?'开启':'关闭'"
active-value="1">
</el-switch>
<div style="color: #999">该功能仅支持商城端</div>
</el-form-item>
</el-form>
</el-collapse-item>
<el-collapse-item title="代金券单品核销指定类型" name="5">
<el-form label-width="100px">
<el-form-item label="" require>
<div>
<el-radio v-model="pay_coupon_goods_tag" label="1" @change="payCouponType">指定商品id</el-radio>
</div>
<div>
<el-radio v-model="pay_coupon_goods_tag" label="2" @change="payCouponType">
指定商品条码(不区分门店,只要商品条码符合即可使用)
</el-radio>
</div>
</el-form-item>
</el-form>
</el-collapse-item>
</el-collapse>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.14.1/lodash.min.js"></script>
<script type="text/javascript">
var baseSetApp = new Vue({
el: '#baseSetApp',
data: function () {
return {
pay_coupon_goods_tag: "{$MerchantConfig['pay_coupon_goods_tag']}",
otherPayStatusDisabled: "{$authArr['changeOtherPayStatus']}" ? false : true,
other_pay_disabled: "{$authArr['changeOtherPay']}" ? false : true,
pay_to_vip_disabled: "{$authArr['payToVip']}" ? false : true,
other_pay: "{$MerchantConfig['other_pay']}",
otherPayList: [], //其他支付列表
currentLen: 0, //其他支付总条数
currentPage: 1, //其他支付总页数
currentLimit: 5, //其他支付每页数量
activeCollapseNames: ['1', '2', '3', '4', '5'],//折叠面板数组
checkOtherList: [], //选中的其他支付列表
newOtherName: '', //新建其他支付名称
otherPayLoading: false, //是否显示其他支付层的loading
actOtherPayIndex: -1, //点击修改的其他支付index
pay_to_vip_state: "{$MerchantConfig['pay_to_vip_state']}",//积分抵现开启关闭状态,
refundList: {$refundList},
refundLoading: false
}
},
methods: {
//代金券指定类型
payCouponType: function () {
$.ajax({
url: "{:U('payCouponType')}",
type: "post",
data: {
pay_coupon_goods_tag: this.pay_coupon_goods_tag
},
success: (res) => {
if (res.status == 1) {
this.$message.success(res.message);
} else {
this.$message.error(res.message);
}
}
})
},
/*--------------------其他支付设置------------------------*/
/*开启/关闭其他支付*/
changeOtherPay: function (val) {
console.log(val);
var that = this;
$.post("{:U('changeOtherPay')}", {
other_pay: val
}, function (res) {
if (res.status == 1) {
that.$message({type: 'success', message: res.msg, duration: 1000});
} else {
that.other_pay = val == 1 ? 0 : 1;
that.$message({type: 'error', message: res.msg, duration: 1000});
}
});
},
/*添加其他支付*/
addOtherPay: function () {
if (this.newOtherName !== '') {
var that = this;
this.$confirm('您确认要添加一个名为' + that.newOtherName + '的支付方式吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'info'
}).then(() => {
that.otherPayLoading = true;
$.post("{:U('addOtherPay')}", {
name: this.newOtherName
}, function (res) {
that.otherPayLoading = false;
if (res.status == 1) {
that.getOtherPay();
that.newOtherName = '';
that.$message({type: 'success', message: res.msg, duration: 1000});
} else {
that.$message({type: 'error', message: res.msg, duration: 1000});
}
})
}).catch(() => {
});
}
},
/*删除其他支付*/
delOtherPay: function (id, name) {
var that = this;
this.$confirm('您确认要删除名为' + name + '的支付方式吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
that.doDelOtherPay([id])
}).catch(() => {
});
},
/*批量删除其他支付*/
delSomeOtherPay: function () {
var that = this;
this.$confirm('您确认要删除名已选中的支付方式吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
that.otherPayLoading = true;
var id = [];
for (var i = 0; i < that.checkOtherList.length; i++) {
id.push(that.checkOtherList[i].id);
}
that.doDelOtherPay(id)
}).catch(() => {
});
},
/*批量删除其他支付请求*/
doDelOtherPay: function (data) {
//传入id列表
var that = this;
that.otherPayLoading = true;
$.post("{:U('delOtherPay')}", {
id: data
}, function (res) {
that.otherPayLoading = false;
if (res.status == 1) {
that.getOtherPay();
that.$message({type: 'success', message: res.msg, duration: 1000});
} else {
that.$message({type: 'error', message: res.msg, duration: 1000});
}
})
},
/*修改其他支付名称*/
upOtherPayName: function (id, name) {
var that = this;
that.otherPayLoading = true;
$.post("{:U('upOtherPayName')}", {
id: id,
name: name
}, function (res) {
that.otherPayLoading = false;
if (res.status == 1) {
that.actOtherPayIndex = -1;
that.$message({type: 'success', message: res.msg, duration: 1000});
} else {
that.$message({type: 'error', message: res.msg, duration: 1000});
}
})
},
/*修改其他支付状态*/
changeOtherPayStatus: function (index, status, id) {
var that = this;
that.otherPayLoading = true;
$.post("{:U('changeOtherPayStatus')}", {
id: id,
status: status
}, function (res) {
that.otherPayLoading = false;
if (res.status == 1) {
that.$message({type: 'success', message: res.msg, duration: 1000});
} else {
status = status == 1 ? 0 : 1;
that.$message({type: 'error', message: res.msg, duration: 1000});
}
})
},
/*选中/取消选中其他支付列表*/
handleSelectionChange: function (data) {
// console.log(data);
this.checkOtherList = data;
},
/*修改其他支付每页显示数量*/
handleSizeChange(val) {
this.currentLimit = val;//切换每页数量
this.currentPage = 1;
this.getOtherPay();
},
/*其他支付换页*/
handleCurrentChange(val) {
this.currentPage = val;
this.getOtherPay();//切换页数
},
/*获取其他支付列表*/
getOtherPay: function () {
var that = this;
this.otherPayLoading = true;
$.post("{:U('getOtherPay')}", {
page: that.currentPage,
limit: that.currentLimit
}, function (res) {
that.otherPayLoading = false;
if (res.status == 1) {
that.currentLen = res.count;
that.otherPayList = [];
that.otherPayList = res.data;
} else {
that.$message({type: 'error', message: res.msg, duration: 1000});
}
})
},
/*------------------------退款排序----------------------*/
/*排序向上*/
shuffle: function () {
this.refundList = _.shuffle(this.refundList)
},
refundUp: function (index) {
if (index == 0) {
return;
}
var refundList = JSON.parse(JSON.stringify(this.refundList));
var temp = refundList[index];
refundList[index] = refundList[index - 1];
refundList[index].order = refundList[index].order * 1 + 1;
refundList[index - 1] = temp;
refundList[index - 1].order -= 1;
this.refundList = refundList;
},
/*排序向下*/
refundDown: function (index) {
if (index == this.refundList.length - 1) {
return;
}
var refundList = JSON.parse(JSON.stringify(this.refundList));
var temp = refundList[index];
refundList[index] = refundList[index + 1];
refundList[index].order -= 1;
refundList[index + 1] = temp;
refundList[index + 1].order = refundList[index + 1].order * 1 - 1;
this.refundList = refundList;
},
saveOrderSet: function () {
var that = this;
this.$confirm('您确认要保存当前设置吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
$.post("{:U('saveOrderSet')}", {
refundList: that.refundList
}, function (res) {
if (res.status == 1) {
that.$message({type: 'success', message: res.msg, duration: 1000});
} else {
that.$message({type: 'error', message: res.msg, duration: 1000});
}
})
}).catch(() => {
});
},
/*----------------------积分抵现设置---------------------*/
/*保存积分抵现设置*/
saveIntegralSet: function (formName) {
//提交数据
var that = this;
this.$refs[formName].validate((valid) => {
if (valid) {
that.arriveCashLoading = true;
$.post("{:U('saveIntegralSet')}", {
integral_arrive_cash: that.integral_arrive_cash,
integral_arrive_cash_rate: that.integralForm.integral_arrive_cash_rate,
integral_arrive_cash_data: that.integralForm.integral_arrive_cash_data
}, function (res) {
that.arriveCashLoading = false;
if (res.status == 1) {
that.$message({type: 'success', message: res.msg, duration: 1000});
} else {
that.$message({type: 'error', message: res.msg, duration: 1000});
}
})
}
});
},
//修改支付成为会员设置
payToVip: function (e) {
console.log(e);
var that = this;
$.ajax({
url: "{:U('payToVip')}",
type: "post",
data: {
state: e
},
success: function (res) {
if (res.status == 1) {
that.$message.success(res.msg);
} else {
that.$message.error(res.msg);
}
},
error: function (res) {
that.$message.error('请求发生错误');
}
})
}
},
created: function () {
this.getOtherPay();
}
})
</script>