htc 1 هفته پیش
والد
کامیت
51f1684ef3
2فایلهای تغییر یافته به همراه67 افزوده شده و 7 حذف شده
  1. 4 1
      src/views/modules/member/components/familyMember.vue
  2. 63 6
      src/views/modules/member/query.vue

+ 4 - 1
src/views/modules/member/components/familyMember.vue

@@ -1,7 +1,10 @@
 <template>
   <div class="page">
     <el-table :data="dataList" border cell-class-name="vertical-top-cell" v-loading="loading" empty-text="暂无家庭成员">
-      <el-table-column prop="xxx" label="善行少年编号"></el-table-column>
+      <el-table-column label="序号" width="70">
+        <template slot-scope="scope">{{ scope.$index + 1 }}</template>
+      </el-table-column>
+      <!-- <el-table-column prop="xxx" label="善行少年编号"></el-table-column> -->
       <el-table-column prop="name" label="姓名"></el-table-column>
       <el-table-column prop="idCard" label="身份证"></el-table-column>
       <el-table-column prop="volunteerNo" label="义工号"></el-table-column>

+ 63 - 6
src/views/modules/member/query.vue

@@ -27,10 +27,26 @@
           </div>
           <div class="table-title adfacjb">
             <div class="table-title-left">会员列表共({{ total }})人</div>
-            <div class="table-title-right">
-              <el-button type="primary" icon="el-icon-plus" @click="handleExportTicket">导入专享券</el-button>
-              <el-button type="primary" icon="el-icon-plus" @click="handleExportHeart">导入爱心值</el-button>
-              <el-button type="primary" icon="el-icon-plus" @click="handleAdd" v-if="$hasPermission('core:appuser:save')">新增会员</el-button>
+            <div class="table-title-right adfac">
+              <el-button type="default" @click="handleDownloadTieket" v-if="$hasPermission('core:appuser:downloadTicket')">下载专享券导入模板</el-button>
+              <el-upload v-if="$hasPermission('core:appuser:importTicket')"
+                :action="uploadUrl"
+                :headers="uploadHeaders"
+                :on-success="uploadFileSuccess"
+                :before-upload="beforeAvatarUpload"
+                :limit="1">
+                <el-button type="primary" style="margin-left: 10px;">导入专享券</el-button>
+              </el-upload>
+              <el-button type="default" @click="handleDownloadLove" style="margin-left: 10px;" v-if="$hasPermission('core:appuser:downloadLove')">下载爱心值导入模板</el-button>
+              <el-upload v-if="$hasPermission('core:appuser:importLove')"
+                :action="uploadUrl2"
+                :headers="uploadHeaders"
+                :on-success="uploadFileSuccess"
+                :before-upload="beforeAvatarUpload"
+                :limit="1">
+                <el-button type="primary" style="margin-left: 10px;">导入爱心值</el-button>
+              </el-upload>
+              <el-button type="primary" @click="handleAdd" v-if="$hasPermission('core:appuser:save')" style="margin-left: 10px;">新增会员</el-button>
               <el-button type="default" @click="handleExcel" v-if="$hasPermission('core:appuser:export')">导出Excel</el-button>
             </div>
           </div>
@@ -65,7 +81,7 @@
             <el-table-column label="操作" width="300" fixed="right">
               <template #default="scope">
                   <el-button link type="text" @click="handleDetail(scope.row)" v-if="$hasPermission('core:appuser:detail')">会员详情</el-button>
-                  <el-button link type="text" @click="handleCreateCode(scope.row)" v-if="$hasPermission('core:appuser:code')">生成邀请码</el-button>
+                  <!-- <el-button link type="text" @click="handleCreateCode(scope.row)" v-if="$hasPermission('core:appuser:code')">生成邀请码</el-button> -->
                   <el-button link type="text" @click="handleDelete(scope.row)" v-if="$hasPermission('core:appuser:delete')">删除</el-button>
               </template>
             </el-table-column>
@@ -100,7 +116,12 @@ export default {
       total: 0,
       channelOptions: [],
       dataList: [],
-      loading: false
+      loading: false,
+      uploadUrl: `${window.SITE_CONFIG['apiURL']}/core/activity/coupon/import`,
+      uploadUrl2: `${window.SITE_CONFIG['apiURL']}/core/love/value/record/import`,
+      uploadHeaders: {
+        token: Cookies.get('token')
+      }
     }
   },
   created () {
@@ -138,6 +159,34 @@ export default {
       }
       this.getList()
     },
+    handleDownloadTieket () {
+      window.location.href = `${window.SITE_CONFIG['apiURL']}/core/activity/coupon/download?token=${Cookies.get('token')}`
+    },
+    handleExportTicket () {
+
+    },
+    handleDownloadLove () {
+      window.location.href = `${window.SITE_CONFIG['apiURL']}/core/love/value/record/download?token=${Cookies.get('token')}`
+    },
+    handleExportHeart () {
+
+    },
+    beforeAvatarUpload (file) {
+      const isXls = file.type === 'application/vnd.ms-excel'
+      const isXlsx = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
+      if (!isXls && !isXlsx) {
+        this.$message.error('上传文件只能是 xls 或 xlsx 格式!')
+      }
+      return isXls || isXlsx
+    },
+    uploadFileSuccess (response, file, fileList) {
+      if (response && response.code === 0) {
+        this.$message.success('导入成功!')
+        this.getList()
+      } else {
+        this.$message.error(response.msg || '文件上传失败!')
+      }
+    },
     handleAdd () {
       this.$router.push({ name: 'memberAdd' })
     },
@@ -179,6 +228,9 @@ export default {
 </script>
 
 <style scoped lang="scss">
+::v-deep .el-upload-list{
+  display: none;
+}
 .page-title{
     font-family: PingFang-SC, PingFang-SC;
     font-weight: bold;
@@ -208,6 +260,11 @@ export default {
     font-size: 16px;
     color: #252525;
     line-height: 22px;
+    width: 200px;
+  }
+  &-right{
+    width: calc(100% - 200px);
+    justify-content: flex-end;
   }
 }