canyin-project/ybcy/views/admin/apply/payment_store.php

272 lines
11 KiB
PHP
Raw Normal View History

2024-11-01 16:07:54 +08:00
<!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; ?>
<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;
}
.avatar-uploader .el-upload {
width: 100px;
height: 100px;
line-height: 100px;
}
.el-icon-plus:before {
font-size: 20px;
}
.el-input-width{
width: 170px;
}
</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="yb_body">
<div class="layout" id="paymentList" v-cloak>
<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">
</div>
<div class="main-con pad_tb_30" id="pay_channel" >
<form id="from_id">
<input type="hidden" name="store_id" id="select_store" :value="store_id">
<input type="hidden" name="apply_id" id="select_store" :value="apply_id">
<div class="flex-bet wid pad_tb_20" v-for="(item, index) in channel_arr" :key="index" :id="'div_'+index">
<input type="hidden" name="bind_id[]" :value="bind_id[index]">
<div class="flex-grow-0 t_r pad_r_25 right-left">选择支付通道:</div>
<div class="flex-grow-1 t_l right-width">
<el-select v-model="select_value[index]" placeholder="请选择" name="channel_select[]">
<el-option value="">请选择</el-option>
<el-option v-for="items in payment_channel_data" :label="items.channel_name" :value="items.channel_id" >
</el-option>
</el-select>
公钥:<el-input v-model="public_key_select[index]" name="public_key[]" id="public_key" class="el-input-width"></el-input>
私钥:<el-input v-model="private_key_select[index]" name="private_key[]" id="private_key" class="el-input-width"></el-input>
机构号:<el-input v-model="ins_num_select[index]" name="ins_num[]" id="ins_num" class="el-input-width"></el-input>
商户号:<el-input v-model="merchant_num_select[index]" name="merchant_num[]" id="merchant_num" class="el-input-width"></el-input>
<!-- <el-button type="primary" class="tijiao" onclick='$(this).parent().parent().remove();'>删除</el-button>-->
<el-button type="primary" class="tijiao" @click='del(index,bind_id[index])'>删除</el-button>
</div>
</div>
</form>
</div>
<div class="ba_f mar_t20 pad_30 main-button">
<el-button type="primary" class="tijiao" @click="addChannel" style="background-color: #f56c6c">增加</el-button>
<el-button type="primary" class="tijiao" @click="onSubmit">保存</el-button>
</div>
</div>
</el-main>
</el-container>
</el-container>
</div>
</div>
<script>
new Vue({
el: '#paymentList',
created() {
const apply_id = utils.GetQueryString("apply_id")
const store_id = utils.GetQueryString("store_id")
this.apply_id = apply_id
this.store_id = store_id
this.init();
},
data: function () {
return {
cardLoading: true,
activeName: 'msg',
apply_id: '',
store_id: '',
select_value : [],
public_key_select : [],
private_key_select : [],
ins_num_select : [],
merchant_num_select : [],
bind_id : [],
payment_channel_data: <?php echo $data ?>,
channel_arr: <?php echo $select_data_len ?>,
}
},
watch: {
select_value(newValue) {
this.select_value = newValue
}
},
methods: {
async init() {
//给已选中select赋默认值
var select_data = <?php echo $select_data ?>;
for(var i=0;i<select_data.length;i++){
this.select_value[i] = select_data[i]['channel_id'];
this.public_key_select[i] = select_data[i]['public_key'];
this.private_key_select[i] = select_data[i]['private_key'];
this.ins_num_select[i] = select_data[i]['ins_num'];
this.merchant_num_select[i] = select_data[i]['merchant_num'];
this.bind_id[i] = select_data[i]['id'];
}
},
async del(idx,bind_id){
var div_id = 'div_'+idx;
if(bind_id > 0) {
var store_id = $("#select_store").val();
await utils.showConfirm({content: '确定要删除吗,删除后不可恢复,确定?'}, this);
var requstData = {
id: bind_id,
store_id:store_id
}
res = await utils.requestPost({
data: requstData,
url: "admin/apply/delpaychannel"
}, this)
if (res.code == 1) {
this.$message({
type: 'success',
message: '操作成功!',
duration: 1000,
onClose: () => {
$('#'+div_id).remove();
},
});
}
} else {
$('#'+div_id).remove();
}
},
//增加一行
async addChannel() {
var max_val = Math.max.apply(Math, this.channel_arr);
this.channel_arr.push(max_val++)
},
//提交数据
async onSubmit() {
var fd = new FormData(document.querySelector("form"));
// var bind_id_arr =[];
// var channel_select_arr =[];
// var public_key_arr =[];
// var private_key_arr =[];
// var ins_num_arr =[];
// var merchant_num_arr =[];
// $("input[name='bind_id[]']").each(function(i){
// bind_id_arr.push($(this).val());
// })
// $("input[name='public_key[]']").each(function(){
// public_key_arr.push($(this).val());
// })
// $("input[name='private_key[]']").each(function(){
// private_key_arr.push($(this).val());
// })
// $("input[name='ins_num[]']").each(function(){
// ins_num_arr.push($(this).val());
// })
// $("input[name='merchant_num[]']").each(function(){
// merchant_num_arr.push($(this).val());
// })
// if(channel_select_arr.length == 0 && public_key_arr.length == 0 && private_key_arr.length == 0 && ins_num_arr.length == 0 && merchant_num_arr.length == 0) {
// await utils.showConfirm({content: '此操作将会删除当前门店所有支付通道配置,确定?'}, this)
// }
//
// apply_id = this.apply_id;
// formInline = this.formInline;
// var requstData = {
// apply_id: this.apply_id,
// store_id: this.store_id,
// channel_select_arr: channel_select_arr,
// public_key_arr: public_key_arr,
// private_key_arr: private_key_arr,
// ins_num_arr: ins_num_arr,
// merchant_num_arr: merchant_num_arr,
// data: formdata,
// }
res = await utils.requestPost({
data: fd,
url: "admin/apply/paymentstoresave"
}, this)
if (res.code == 1) {
this.$message({
type: 'success',
message: '操作成功!',
duration: 900,
onClose: () => {
location.href = "<?= Yii::$app->urlManager->createUrl('admin/apply/platform_storelist');?>"+ "?id=" + this.apply_id;
},
});
}
},
}
})
</script>
</body>
</html>