Browse Source

2020/05/26

lxs 4 years ago
parent
commit
3c4e399f74

+ 17 - 0
src/api/challenge.js

@@ -0,0 +1,17 @@
+import request from '@/utils/request'
+
+export function getList(params) {
+  return request({
+    method: 'get',
+    url: '/challenge/index',
+    params
+  })
+}
+
+export function getInfo(params) {
+  return request({
+    method: 'get',
+    url: '/challenge/guess',
+    params
+  })
+}

+ 14 - 0
src/router/index.js

@@ -203,6 +203,20 @@ export const asyncRoutes = [ // 异步加载路由
     ]
   },
   {
+    path: '/zbsChallenge',
+    component: Layout,
+    redirect: '/zbsChallenge/index',
+    name: 'zbsChallenge',
+    children: [
+      {
+        path: 'index',
+        component: () => import('@/views/Challenge'),
+        name: 'zbsChallengeIndex',
+        meta: { title: '挑战管理', icon: 'goodsmanage' }
+      }
+    ]
+  },
+  {
     path: '/zbsseasonset',
     component: Layout,
     redirect: '/zbsseasonset/index',

+ 204 - 0
src/views/Challenge.vue

@@ -0,0 +1,204 @@
+<template>
+  <div class="app-container">
+    <div class="header-container">
+      <switchseason class="switchseason" @switchseason="switchseason" />
+      <el-input v-model="params.challenge_name" type="text" placeholder="挑战者昵称/手机号" style="width:300px" />
+      <el-input v-model="params.accept_name" type="text" placeholder="应战人昵称/手机号" style="width:300px" />
+      <el-button type="primary" @click="params.page_index = 1; getList()">搜索</el-button>
+    </div>
+    <el-table
+      v-loading="loading"
+      border
+      stripe
+      :data="list"
+      style="width: 100%;margin: 20px 0"
+    >
+      <el-table-column
+        label="序号"
+        type="index"
+        width="60"
+        align="center"
+        :index="params.page_size * (params.page_index - 1) + 1"
+      />
+      <el-table-column
+        prop="u_name"
+        label="挑战人昵称"
+        align="center"
+      />
+      <el-table-column
+        prop="u_phone"
+        label="挑战人手机号"
+        align="center"
+      />
+      <el-table-column
+        prop="uu_name"
+        label="应战人昵称"
+        align="center"
+      />
+      <el-table-column
+        prop="uu_phone"
+        label="应战人手机号"
+        align="center"
+      />
+      <el-table-column
+        prop="is_pay"
+        label="挑战失败红包"
+        align="center"
+      />
+      <el-table-column
+        prop="challenge_num"
+        label="挑战卖货数"
+        align="center"
+      />
+      <el-table-column
+        prop="challenge_inte"
+        label="挑战获胜学分"
+        align="center"
+      />
+      <el-table-column
+        prop="challenge_time"
+        label="挑战时间"
+        align="center"
+      />
+      <el-table-column
+        label="查看详情"
+        align="center"
+      >
+        <template slot-scope="{ row }">
+          <el-button type="primary" @click="handleInfo(row)">查看详情</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <el-pagination
+      background
+      :total="total"
+      :page-size="params.page_size"
+      layout="total, prev, pager, next, jumper"
+      @current-change="handleCurrentChange"
+    />
+    <el-dialog
+      title="挑战详情"
+      :visible.sync="challengeInfo"
+      :before-close="resetInfo"
+    >
+      <el-row :gutter="20">
+        <el-col :span="12" class="info-header">
+          <span>挑战人: {{ info.challenge_name }}</span>
+        </el-col>
+        <el-col :span="12" class="info-header">
+          <span>应战人: {{ info.accept_name }}</span>
+        </el-col>
+      </el-row>
+      <p>竞猜人: </p>
+      <el-row>
+        <el-col :span="12">
+          <p v-for="item in info.challenge" :key="item.id">
+            {{ item.nickname }}
+          </p>
+        </el-col>
+        <el-col :span="12">
+          <p v-for="item in info.accept" :key="item.id">
+            {{ item.nickname }}
+          </p>
+        </el-col>
+      </el-row>
+    </el-dialog>
+  </div>
+</template>
+<script>
+import { getList, getInfo } from '@/api/challenge'
+export default {
+  data() {
+    return {
+      params: {
+        page_index: 1,
+        page_size: 15,
+        challenge_name: '',
+        accept_name: '',
+        // season: this.$store.state.user.season_list[0].season
+        season: ''
+      },
+      loading: false,
+      total: 0,
+      list: [],
+      challengeInfo: false,
+      info: {}
+    }
+  },
+  computed: {
+    season_list() {
+      return this.$store.state.user.season_list
+    }
+  },
+  created() {
+    this.getList()
+  },
+  methods: {
+    switchseason(index) { // 切换赛季
+      this.params.season = this.season_list[index].season
+      this.getList()
+    },
+    handleCurrentChange(page) { // 换页
+      this.loading = true
+      this.params.page_index = page
+      this.getList()
+    },
+    async getList() {
+      this.loading = true
+      await getList(this.params).then(res => {
+        this.loading = false
+        if (res.code === 200) {
+          this.list = res.data.list
+          this.total = res.data.total
+        } else {
+          this.$message.error(res.data)
+        }
+      }).catch(e => {
+        this.loading = false
+      })
+    },
+    async handleInfo(row) {
+      this.loading = true
+      await getInfo({ id: row.id }).then(res => {
+        this.loading = false
+        if (res.code === 200) {
+          this.info = res.data
+          this.challengeInfo = true
+        } else {
+          this.$message.error(res.data)
+        }
+      }).catch(e => {
+        this.loading = false
+      })
+    },
+    resetInfo() {
+      this.challengeInfo = false
+      this.info = {}
+    }
+  }
+}
+</script>
+<style lang="scss" scoped>
+  .header-container {
+    display: flex;
+    align-items: center;
+    /deep/ .el-input {
+      margin-right: 10px;
+    }
+    .switchseason {
+      position: relative;
+      margin-right: 10px;
+    }
+  }
+
+  .info-header {
+    padding: 10px 0;
+    background: #409EFF;
+    color: #ffffff;
+
+    &:nth-last-of-type(1) {
+      // margin-left: 20px;
+      background: #67C23A;
+    }
+  }
+</style>

+ 22 - 2
src/views/SeasonSet.vue

@@ -83,6 +83,18 @@
             @change="datechange"
           />
         </el-form-item>
+        <el-form-item label="挑战次数:">
+          <el-input v-model="formLabelAlign.challenge_num" type="number" placeholder="请输入挑战次数" />
+        </el-form-item>
+        <el-form-item label="获胜奖励学分:">
+          <el-input v-model="formLabelAlign.challenge_inte" type="number" placeholder="请输入挑战获胜奖励学分" />
+        </el-form-item>
+        <el-form-item label="竞猜学分:">
+          <el-input v-model="formLabelAlign.guessing_inte" type="number" placeholder="请输入竞猜学分" />
+        </el-form-item>
+        <el-form-item label="默认放弃时间:">
+          <el-input v-model="formLabelAlign.give_up_time" type="number" placeholder="默认放弃时间(天)" />
+        </el-form-item>
         <el-button v-loading="loading" type="primary" :disabled="disabled" @click="submitForm">设置</el-button>
       </el-form>
     </div>
@@ -106,7 +118,11 @@ export default {
         round_start_time: '',
         round_end_time: '',
         gift_start_time: '',
-        gift_end_time: ''
+        gift_end_time: '',
+        challenge_num: '',
+        challenge_inte: '',
+        give_up_time: '',
+        guessing_inte: ''
       },
       startDay: new Date(),
       disabled: false,
@@ -148,7 +164,11 @@ export default {
         round_start_time: +new Date(this.formLabelAlign.round_start_time) / 1000,
         round_end_time: +new Date(this.formLabelAlign.round_end_time) / 1000,
         gift_start_time: +new Date(this.formLabelAlign.gift_start_time) / 1000,
-        gift_end_time: +new Date(this.formLabelAlign.gift_end_time) / 1000
+        gift_end_time: +new Date(this.formLabelAlign.gift_end_time) / 1000,
+        challenge_num: this.formLabelAlign.challenge_num,
+        challenge_inte: this.formLabelAlign.challenge_inte,
+        give_up_time: this.formLabelAlign.give_up_time,
+        guessing_inte: this.formLabelAlign.guessing_inte
       }).then(() => {
         this.loading = false
         Message({

+ 1 - 0
src/views/SignupManage.vue

@@ -134,6 +134,7 @@
             type="success"
             icon="el-icon-sort"
             size="mini"
+            :disabled="scope.row.can_refund === 0"
             @click="handleRefund(scope.$index, scope.row)"
           >退款</el-button>
         </template>

+ 22 - 5
src/views/components/total.vue

@@ -35,6 +35,19 @@
     </div>
     <div class="total">
       <div class="total-item">
+        <span class="name">代理公司</span>
+        <div class="num">
+          <span style="color: #7670D9;">{{ crown_join }}</span>
+          <span class="right">
+            <span>参赛率</span>
+            <span>{{ isNaN(Math.floor((crown_join / crown_total) * 100)) ? 0 : Math.floor((crown_join / crown_total) * 100) }}%</span>
+          </span>
+        </div>
+        <div class="progress">
+          <div :style="{ background: '#7670D9', width: Math.floor((crown_join / crown_total) * 100) + '%' }" />
+        </div>
+      </div>
+      <div class="total-item">
         <span class="name">销售主管</span>
         <div class="num">
           <span style="color: #7670D9;">{{ super_join }}</span>
@@ -63,14 +76,14 @@
       <div class="total-item">
         <span class="name">参赛人数</span>
         <div class="num">
-          <span style="color: #5AC4B6;">{{ super_join + top_join }}</span>
+          <span style="color: #5AC4B6;">{{ super_join + top_join + crown_join }}</span>
           <span class="right">
             <span>参赛率</span>
-            <span>{{ isNaN(Math.floor(((super_join + top_join) / (super_total + top_total)) * 100)) ? 0 : Math.floor(((super_join + top_join) / (super_total + top_total)) * 100) }}%</span>
+            <span>{{ isNaN(Math.floor(((super_join + top_join + crown_join) / (super_total + top_total + crown_total)) * 100)) ? 0 : Math.floor(((super_join + top_join + crown_join) / (super_total + top_total + crown_total)) * 100) }}%</span>
           </span>
         </div>
         <div class="progress">
-          <div :style="{ background: '#5AC4B6', width: Math.floor(((super_join + top_join) / (super_total + top_total)) * 100) + '%' }" />
+          <div :style="{ background: '#5AC4B6', width: Math.floor(((super_join + top_join + crown_join) / (super_total + top_total + crown_total)) * 100) + '%' }" />
         </div>
       </div>
       <div class="total-item">
@@ -79,11 +92,11 @@
           <span style="color: #D970D0;">{{ per_num }}</span>
           <span class="right">
             <span>卖货率</span>
-            <span>{{ isNaN(Math.floor(per_num / (super_join + top_join) * 100)) ? 0 : Math.floor(per_num / (super_join + top_join) * 100) }}%</span>
+            <span>{{ isNaN(Math.floor(per_num / (super_join + top_join + crown_join) * 100)) ? 0 : Math.floor(per_num / (super_join + top_join + crown_join) * 100) }}%</span>
           </span>
         </div>
         <div class="progress">
-          <div :style="{ background: '#D970D0', width: isNaN(Math.floor(per_num / (super_join + top_join) * 100)) ? 0 : Math.floor(per_num / (super_join + top_join) * 100) + '%' }" />
+          <div :style="{ background: '#D970D0', width: isNaN(Math.floor(per_num / (super_join + top_join + crown_join) * 100)) ? 0 : Math.floor(per_num / (super_join + top_join + crown_join) * 100) + '%' }" />
         </div>
       </div>
     </div>
@@ -152,6 +165,8 @@ export default {
   },
   data() {
     return {
+      crown_join: 0,
+      crown_total: 0,
       super_join: 0,
       super_total: 0,
       top_join: 0,
@@ -253,6 +268,8 @@ export default {
         this.simple_order_total = res.data.simple_order_total
         this.old_order_total = res.data.old_order_total
         this.per_num = res.data.per_num
+        this.crown_total = res.data.crown_total
+        this.crown_join = res.data.crown_join
       })
     },
     testChoosedDate(e) { // 检测所选时间范围是否处于合法范围

+ 2 - 4
vue.config.js

@@ -19,10 +19,8 @@ module.exports = {
     },
     proxy: {
       [process.env.VUE_APP_BASE_API]: {
-        target: 'https://api.admin.jiuweiyun.cn/api',
-        // target: 'http://api.admin.dake.club/api',
-        // target: 'https://yinchengnuo.com/admin',
-        // target: 'http://192.168.0.14/api',
+        // target: 'https://api.admin.jiuweiyun.cn/api',
+        target: 'http://192.168.0.15:8016/api',
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''