498 行
20 KiB
HTML
可执行文件
498 行
20 KiB
HTML
可执行文件
<!--[1.8.50]-->
|
|
<style>
|
|
.Business_tb1 table tr th {
|
|
height: 30px !important;
|
|
background-color: #D5e9ed;
|
|
color: #00a3d6;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.Business_tb1 table tr td {
|
|
/*border: none;*/
|
|
height: 100%;
|
|
position: relative;
|
|
/*background-color: white;*/
|
|
font-size: 12px;
|
|
}
|
|
|
|
.Business_tb1 table tr {
|
|
width: 100% !important;
|
|
}
|
|
|
|
.Business_tb1 table tr:nth-child(2n+1) {
|
|
/*background-color: pink;*/
|
|
}
|
|
|
|
.layui-form-item {
|
|
display: flex;
|
|
justify-content: flex-start;
|
|
align-items: center;
|
|
flex-direction: row;
|
|
}
|
|
|
|
label {
|
|
margin-bottom: 0;
|
|
width: auto;
|
|
}
|
|
|
|
select {
|
|
height: 38px;
|
|
}
|
|
|
|
.delbtn {
|
|
color: #f55;
|
|
}
|
|
|
|
.searchbtn {
|
|
/*width: 60px;*/
|
|
height: 40px;
|
|
padding: 0px 18px;
|
|
font-size: 14px;
|
|
text-align: center;
|
|
line-height: 40px;
|
|
background: #009688;
|
|
border: 0;
|
|
border-radius: 0 2px 2px 0;
|
|
margin: 0;
|
|
color: white;
|
|
}
|
|
|
|
.showgoodsitembox {
|
|
position: fixed;
|
|
width: calc(100% - 160px);
|
|
height: calc(100% - 65px);
|
|
background-color: rgba(0, 0, 0, 0);
|
|
top: 0;
|
|
left: 0;
|
|
z-index: 450;
|
|
}
|
|
|
|
.showgoodsitembox2 {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
|
|
.total {
|
|
width: 96%;
|
|
margin-left: 15px;
|
|
height: 80px;
|
|
margin-top: 10px;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
align-items: flex-end;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.import {
|
|
display: block;
|
|
width: 92px;
|
|
height: 40px;
|
|
opacity: 0;
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
}
|
|
|
|
input::-webkit-outer-spin-button,
|
|
input::-webkit-inner-spin-button {
|
|
-webkit-appearance: none;
|
|
}
|
|
|
|
input[type="number"] {
|
|
-moz-appearance: textfield;
|
|
}
|
|
|
|
.goodscheckbox {
|
|
display: inline-block;
|
|
width: 20px;
|
|
height: 20px;
|
|
margin: auto;
|
|
}
|
|
</style>
|
|
<div id="vipImportApp" style="position: relative;with:100%;height: 100%;overflow-y: auto;padding: 0 20px;">
|
|
<div style="margin:20px 0 20px;">
|
|
<el-collapse accordion>
|
|
<el-collapse-item>
|
|
<template slot="title">
|
|
常规会员导入须知>>></i>
|
|
</template>
|
|
<div>1.导入会员前请先下载会员导入模板,并严格按照模板的要求来编辑会员信息</div>
|
|
<div>2.确认导入会员信息前需先选择门店</div>
|
|
<div>3.要导入的会员,要确保会员卡号和手机号没有重复,否则导入失败</div>
|
|
</el-collapse-item>
|
|
</el-collapse>
|
|
</div>
|
|
|
|
<form style="display: flex;height: calc(100% - 90px);flex-direction: column;">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label" style="width:auto" v-if="platform_type == 1">选择门店</label>
|
|
<div class="layui-input-inline" v-if="platform_type == 1">
|
|
<select name="storeid" id="storeid" class="supplier" v-model="storeid">
|
|
<option value="0">--选择门店--</option>
|
|
<volist name="info" id="vo">
|
|
<option value="{$vo.id}">{$vo.storetag}</option>
|
|
</volist>
|
|
</select>
|
|
</div>
|
|
<div class="layui-input-inline" style="margin-left: 40px;position: relative">
|
|
<if condition="$authArr['vipImport'] eq true">
|
|
<input type="button" value="选择会员表格" class="searchbtn">
|
|
</if>
|
|
<input type="file" class="import" @change="upfile" ref="myfile">
|
|
</div>
|
|
<div class="layui-input-inline" style="margin-left: 40px;">
|
|
<if condition="$authArr['downfile'] eq true">
|
|
<input type="button" value="下载会员导入模板" class="searchbtn" @click="downfile">
|
|
</if>
|
|
</div>
|
|
</div>
|
|
<div class="Business"
|
|
style="flex: 1;overflow-y: hidden;display: flex;flex-direction:column;box-sizing: border-box;">
|
|
<div class="Business_tb1" style="height: 100%;">
|
|
<table border="0" cellspacing="0" cellpadding="0" class="layui-table"
|
|
style="height:calc(100% - 1px);position: relative;display: flex;flex-direction: column;overflow-y: auto;margin: 0">
|
|
<tr style="height: 30px;position: relative;top:0;left:0;" id="tabletitle">
|
|
<th>
|
|
<input type="checkbox" style="width: 20px;height: 20px;" v-model="checkAll"
|
|
@change="changeCheckAll">
|
|
<span>选择</span>
|
|
</th>
|
|
<th>序号</th>
|
|
<th>操作</th>
|
|
<th>手机号/会员卡号</th>
|
|
<th>名称</th>
|
|
<th>昵称</th>
|
|
<th>性别</th>
|
|
<th>会员卡余额</th>
|
|
<th>积分</th>
|
|
<th>密码</th>
|
|
<th>是否绑定实体卡</th>
|
|
<th>状态</th>
|
|
</tr>
|
|
<tr style="height: 30px;">
|
|
<td colspan="13"></td>
|
|
</tr>
|
|
<template v-for="(item,index) in goodsarr">
|
|
<tr style="height: 30px;">
|
|
<td>
|
|
<input type="checkbox" @change="changeCheck" v-model="checkgoodsarr" :value="index"
|
|
class="goodscheckbox">
|
|
</td>
|
|
<td>{{index+1}}</td>
|
|
<td>
|
|
<if condition="$authArr['delgoodsitem'] eq true">
|
|
<div @click="delgoodsitem(index)" class="delbtn">删除</div>
|
|
</if>
|
|
</td>
|
|
<th>{{item.mobile_phone}}</th>
|
|
<td>{{item.name}}</td>
|
|
<td>{{item.nickname}}</td>
|
|
<td>{{item.sex_name}}</td>
|
|
<td>{{item.balance}}</td>
|
|
<td>{{item.integral}}</td>
|
|
<td>{{item.password}}</td>
|
|
<td>{{item.card_key}}</td>
|
|
<th>{{item.statusname}}</th>
|
|
</tr>
|
|
</template>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="total">
|
|
<div class="layui-form-item">
|
|
<input type="button" value="下载会员导入失败表格" class="searchbtn" @click="downfaultfile"
|
|
v-if="candownfaultfile">
|
|
</div>
|
|
<div class="layui-form-item">
|
|
<if condition="$authArr['delgoodsitem'] eq true">
|
|
<input type="button" style="margin-right: 10px;" value="批量删除" class="searchbtn"
|
|
@click="delSomeData">
|
|
</if>
|
|
<if condition="$authArr['submitVips'] eq true">
|
|
<input type="button" value="导入会员信息" class="searchbtn" @click="doconfirm">
|
|
</if>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
<div v-if="shade" class="showgoodsitembox showgoodsitembox2">
|
|
<span>数据操作中。。。</span>
|
|
</div>
|
|
<div v-if="shade2" class="showgoodsitembox showgoodsitembox3" style="background-color:white;">
|
|
<span>数据操作中。。。</span>
|
|
</div>
|
|
<el-dialog title="导入结果" :modal-append-to-body="false" :visible.sync="showError" :width="'500px'" :show-close="false"
|
|
:close-on-click-modal="false">
|
|
<div style="padding: 0 20px">
|
|
<div v-for="item in errorList">{{item}}</div>
|
|
</div>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button size="small" type="primary" @click="refresh">关 闭</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
</div>
|
|
<script type="text/javascript">
|
|
layui.use(['layer', 'form'], function () {
|
|
var layer = layui.layer;
|
|
var vipImportApp = new Vue({
|
|
el: '#vipImportApp',
|
|
data: function () {
|
|
return {
|
|
platform_type:1,
|
|
storeid: 0,
|
|
candownfaultfile: false,
|
|
myfile: "",
|
|
dismoney: 0,
|
|
showgoods: false,
|
|
floworderid: "{$merchantid}",
|
|
canchangenum: false,
|
|
settimeouttimer: "",
|
|
shade: false,
|
|
keyword: "",
|
|
shade2: false,
|
|
searchgoodsinfo: {},
|
|
goodsarr: [],
|
|
checkgoodsarr: [],
|
|
statustype: -1,
|
|
checkAll: false,
|
|
showError: false,
|
|
errorList: []
|
|
}
|
|
},
|
|
created: function () {
|
|
// console.log(this.storeid);
|
|
$('.showgoodsitembox').css({'opacity': 1});
|
|
this.getPlatformType();
|
|
this.getgoodsarr();
|
|
},
|
|
methods: {
|
|
/**
|
|
* @description 获取商户是否为微礼平台类型
|
|
*/
|
|
getPlatformType() {
|
|
this.sendRequest('Retail/Mgoods/getPlatformType', {
|
|
success: (response) => {
|
|
if (response.status == 1) {
|
|
this.platform_type = response.platform_type
|
|
}
|
|
}
|
|
});
|
|
},
|
|
//全选或不选
|
|
refresh: function () {
|
|
this.showError = false;
|
|
this.getgoodsarr();
|
|
},
|
|
changeCheckAll: function () {
|
|
if (this.checkAll) {
|
|
for (var i = 0; i < this.goodsarr.length; i++) {
|
|
if (this.checkgoodsarr.indexOf(i) == -1) {
|
|
this.checkgoodsarr.push(i);
|
|
}
|
|
}
|
|
} else {
|
|
this.checkgoodsarr = [];
|
|
}
|
|
},
|
|
//单选
|
|
changeCheck: function () {
|
|
if (this.checkgoodsarr.length == this.goodsarr.length) {
|
|
this.checkAll = true;
|
|
} else {
|
|
this.checkAll = false;
|
|
}
|
|
},
|
|
//批量删除
|
|
delSomeData: function () {
|
|
if (!this.checkgoodsarr.length) {
|
|
layer.msg('未选择数据');
|
|
} else {
|
|
var id = [];
|
|
for (var i = 0; i < this.checkgoodsarr.length; i++) {
|
|
var index = parseInt(this.checkgoodsarr[i]);
|
|
id.push(this.goodsarr[index].id)
|
|
}
|
|
if (id.length) {
|
|
var that = this;
|
|
layer.confirm('确认删除已选中数据吗?', function () {
|
|
that.shade = true;
|
|
$.ajax({
|
|
url: "{:U('delgoodsitem')}",
|
|
data: {id: id.join(',')},
|
|
type: 'post',
|
|
success: function (res) {
|
|
if (res.status == 1) {
|
|
that.checkgoodsarr = [];
|
|
that.checkAll = false;
|
|
that.getgoodsarr();
|
|
layer.msg(res.msg, {time: 1500})
|
|
} else {
|
|
layer.msg(res.msg, {time: 1500})
|
|
}
|
|
that.shade = false;
|
|
},
|
|
error: function (error) {
|
|
console.log(error);
|
|
layer.msg('出错了');
|
|
that.shade = false;
|
|
}
|
|
})
|
|
});
|
|
}
|
|
}
|
|
},
|
|
getgoodsarr: function () {
|
|
var floworderid = this.floworderid;
|
|
var that = this;
|
|
var statustype = this.statustype;
|
|
$.ajax({
|
|
url: "{:U('getgoodsarr')}",
|
|
data: {
|
|
floworderid: floworderid,
|
|
statustype: statustype
|
|
},
|
|
type: 'post',
|
|
success: function (res) {
|
|
if (res.status == 1) {
|
|
that.goodsarr = [];
|
|
that.goodsarr = res.data;
|
|
} else {
|
|
that.goodsarr = [];
|
|
}
|
|
},
|
|
error: function (error) {
|
|
layer.msg('错误了。。。')
|
|
}
|
|
})
|
|
},
|
|
// 删除一行
|
|
delgoodsitem: function (index) {
|
|
console.log(index);
|
|
var id = this.goodsarr[index]['id'];
|
|
var that = this;
|
|
that.shade = true;
|
|
$.ajax({
|
|
url: "{:U('delgoodsitem')}",
|
|
data: {id: id},
|
|
type: 'post',
|
|
success: function (res) {
|
|
if (res.status == 1) {
|
|
that.goodsarr.splice(index, 1);
|
|
} else {
|
|
layer.msg(res.msg, {time: 1500})
|
|
}
|
|
that.shade = false;
|
|
},
|
|
error: function (error) {
|
|
console.log(error);
|
|
layer.msg('出错了');
|
|
that.shade = false;
|
|
}
|
|
})
|
|
},
|
|
// 导入会员
|
|
doconfirm: function () {
|
|
// console.log(this.checkgoodsarr);
|
|
var platform_type = this.platform_type;
|
|
var storeid = this.storeid;
|
|
var checkgoodsarr = this.checkgoodsarr;
|
|
var that = this;
|
|
if (this.statustype != 0 && this.statustype != -1) {
|
|
return;
|
|
}
|
|
if (storeid == 0 && platform_type != 2) {
|
|
layer.msg('请选择门店')
|
|
return;
|
|
}
|
|
if (checkgoodsarr.length == 0) {
|
|
layer.msg('请选择要导入的会员');
|
|
return;
|
|
}
|
|
layer.confirm('确定要将选中导入到该门店?只会导入状态为“未导入”的数据', function (index) {
|
|
layer.close(index);
|
|
that.submitfloworder();
|
|
})
|
|
},
|
|
submitfloworder: function () {
|
|
var storeid = this.storeid;
|
|
var checkgoodsarr = [];
|
|
for (var i = 0; i < this.checkgoodsarr.length; i++) {
|
|
var index = parseInt(this.checkgoodsarr[i]);
|
|
if (this.goodsarr[index].status == 0) {
|
|
checkgoodsarr.push(this.goodsarr[index].id)
|
|
}
|
|
}
|
|
if (checkgoodsarr.length) {
|
|
var that = this;
|
|
$.ajax({
|
|
url: "{:U('submitVips')}",
|
|
data: {
|
|
storeid: storeid,
|
|
checkgoodsarr: checkgoodsarr
|
|
},
|
|
type: 'post',
|
|
success: function (res) {
|
|
// console.log(res);
|
|
if (res.status == 1) {
|
|
layer.msg(res.msg, {time: 3000, icon: 1}, function () {
|
|
MenuApp.refreshWindow();
|
|
});
|
|
//window.location.replace("{:U('index')}");
|
|
} else if (res.status == 2) {
|
|
that.errorList = res.data;
|
|
that.showError = true;
|
|
} else {
|
|
layer.msg(res.msg);
|
|
}
|
|
},
|
|
error: function (error) {
|
|
console.log(error);
|
|
layer.msg('出错了。')
|
|
}
|
|
})
|
|
} else {
|
|
layer.msg('您选择的数据都不是未导入的');
|
|
}
|
|
},
|
|
// 下载导入模板
|
|
downfile: function () {
|
|
window.location.href = "{:U('downfile')}";
|
|
},
|
|
// 上传模板表格
|
|
upfile: function () {
|
|
var that = this;
|
|
console.log(this.$refs.myfile.files[0]);
|
|
var file = this.$refs.myfile.files[0];
|
|
var fd = new FormData();
|
|
fd.append('file', file);
|
|
$.ajax({
|
|
url: "{:U('vipImport')}",
|
|
data: fd,
|
|
type: 'post',
|
|
async: false,
|
|
cache: false,
|
|
contentType: false, //不设置内容类型
|
|
processData: false,
|
|
success: function (res) {
|
|
if (res.status == 1) {
|
|
layer.msg(res.msg, {time: 2000})
|
|
that.getgoodsarr();
|
|
if(res.path){
|
|
that.candownfaultfile = true;
|
|
}
|
|
} else {
|
|
layer.msg(res.msg, {time: 2000});
|
|
}
|
|
}
|
|
})
|
|
},
|
|
downfaultfile: function () {
|
|
var id = this.floworderid;
|
|
window.location.href = "{:U('downfaultfile')}?id=" + id;
|
|
}
|
|
},
|
|
})
|
|
})
|
|
</script>
|