From 09a98d33fb7521caff9e7dd4494981e7e8fcd5a6 Mon Sep 17 00:00:00 2001 From: zm <zm@iemsoft.cn> Date: Thu, 25 Mar 2021 15:59:20 +0800 Subject: [PATCH] 导入卡号和密码功能完成,未测试 --- plugins/exchange/views/library/edit.php | 69 ++++++++++++++++++++++++++++++++-- 1 files changed, 65 insertions(+), 4 deletions(-) diff --git a/plugins/exchange/views/library/edit.php b/plugins/exchange/views/library/edit.php index 60f26c1..37eabf8 100644 --- a/plugins/exchange/views/library/edit.php +++ b/plugins/exchange/views/library/edit.php @@ -581,9 +581,10 @@ <div slot="header" style="width: 100%;" flex="main:justify cross:center"> <div>兑换码管理</div> <div> - <el-button @click="getActivity" size="small" type="primary">生成动态活码</el-button> + <!--<el-button @click="getActivity" size="small" type="primary">生成动态活码</el-button>--> <el-button @click="appendDialog=true;num=''" size="small" type="primary">批量生成兑换码</el-button> - <el-button type="primary" @click="uploadVisible = true" size="small">批量导入卡号</el-button> + <el-button type="primary" @click="uploadVisible = true" size="small">批量导入卡号</el-button> + <el-button type="primary" @click="exportData" size="small">导出卡密数据</el-button> </div> </div> <div class="rules use-rules"> @@ -740,6 +741,7 @@ <image style="width: 29px;height: 29px;margin-right:5px" src="statics/img/mall/pass.png"></image> <span>成功导入{{updateData.success}}条数据</span> </div> + <!-- <div flex="cross:center main:center" style="margin-top: 15px;" > <span style="margin-right: 5px;"> 未导入 @@ -752,6 +754,7 @@ </el-button> </div> </div> + --> </div> </div> <div slot="footer" class="dialog-footer" flex="main:center"> @@ -765,7 +768,7 @@ width="30%"> <p flex="cross:center"> <image src="statics/img/plugins/sigh.png" style="margin-right: 10px;width:30px;height: 30px;"></image> - <span>请导入不大于2M的Excel文件</span> + <span>请导入不大于1M的CSV文件</span> </p> <span slot="footer" class="dialog-footer"> <el-upload @@ -773,12 +776,48 @@ action="" :multiple="false" :http-request="handleFile" - accept=".xls,.csv" + accept=".csv" :on-change="excelChange" :show-file-list="false"> <el-button type="primary" >点击导入</el-button> </el-upload> </span> + </el-dialog> + <el-dialog + flex="cross:center" + class="export-dialog" + title="提示" + :visible.sync="exportDialogVisible" + width="20%"> + <template> + <div> + <div class="el-message-box__content"> + <div class="el-message-box__status el-icon-warning"></div> + <div class="el-message-box__message"> + <p>{{exportParams.export == 'export' ? '确认导出卡号密码数据' : '确认下载导入文件模板'}}</p> + </div> + </div> + </div> + <span slot="footer" class="dialog-footer"> + <form target="_blank" :action="exportParams.action_url" method="post"> + <div class="modal-body"> + + <input name="_csrf" type="hidden" id="_csrf" + value="<?= Yii::$app->request->csrfToken ?>"> + <input name="s-keyword" :value="codeSearch.keyword" type="hidden"> + <input name="s-type" :value="codeSearch.type" type="hidden"> + <input name="s_created_at_s" :value="codeSearch.created_at[0]" type="hidden"> + <input name="s_created_at_e" :value="codeSearch.created_at[1]" type="hidden"> + <input name="s-status" :value="codeSearch.status" type="hidden"> + <input name="export" :value="exportParams.export" type="hidden"> + </div> + <div flex="dir:right" style="margin-top: 20px;"> + <button type="submit" + class="el-button el-button--primary el-button--small">点击下载</button> + </div> + </form> + </span> + </template> </el-dialog> <!-- 选择奖励品 --> <el-dialog title="选择奖励品类型" :visible.sync="chooseDialog" width="590px"> @@ -1210,7 +1249,14 @@ uploadVisible: false, updateDialogVisible: false, updateData: null, + sizeM: 0, + progress: 0, file: '', + exportParams: { + action_url: `<?= Yii::$app->urlManager->createUrl('/plugin/exchange/mall/index/export') ?>`, + export: 'export' + }, + exportDialogVisible: false, getActivityCode: false, codeShow: true, qrVisible: false, @@ -2042,6 +2088,14 @@ this.file = file.raw; }, + updateNo() { + const elt = document.createElement('a'); + elt.setAttribute('href', this.updateData.url); + elt.setAttribute('download', '未导入数据.csv'); + elt.style.display = 'none'; + document.body.appendChild(elt); + elt.click(); + }, async handleFile() { let formData = new FormData(); let size = this.file.size; @@ -2075,6 +2129,13 @@ } }, }, + + // 导出数据 + exportData() { + this.exportDialogVisible = true; + this.exportParams.export = 'export'; + }, + mounted: function () { this.getSvip(); if(getQuery('id') > 0) { -- Gitblit v1.8.0