Преглед изворни кода

1、迁移直播看课记录

yys пре 3 недеља
родитељ
комит
084a40950f

+ 36 - 0
src/api/live/liveCouponUser.js

@@ -0,0 +1,36 @@
+import request from '@/utils/request'
+
+// 查询优惠券发放记录列表
+export function listStoreCouponUser(query) {
+  return request({
+    url: '/live/coupon/user/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询优惠券发放记录详细
+export function getStoreCouponUser(id) {
+  return request({
+    url: '/live/coupon/user/' + id,
+    method: 'get'
+  })
+}
+
+// 导出优惠券发放记录
+export function exportStoreCouponUser(query) {
+  return request({
+    url: '/live/coupon/user/export',
+    method: 'get',
+    params: query
+  })
+}
+
+// 核销优惠券
+export function verifyStoreCouponUser(data) {
+  return request({
+    url: '/live/coupon/user/verify',
+    method: 'post',
+    data: data
+  })
+}

+ 218 - 0
src/views/live/liveCouponUser/index.vue

@@ -0,0 +1,218 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
+      <el-form-item label="优惠券名称" prop="couponTitle">
+        <el-input
+          v-model="queryParams.couponTitle"
+          placeholder="请输入优惠券名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="状态" prop="status">
+        <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
+          <el-option
+            v-for="item in statusOptions"
+            :key="item.dictValue"
+            :label="item.dictLabel"
+            :value="item.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="领取时间">
+        <el-date-picker
+          v-model="dateRange"
+          size="small"
+          style="width: 220px"
+          value-format="yyyy-MM-dd"
+          type="daterange"
+          range-separator="-"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          icon="el-icon-download"
+          size="mini"
+          @click="handleExport"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table
+      height="500"
+      border
+      size="mini"
+      v-loading="loading"
+      :data="storeCouponUserList"
+    >
+      <el-table-column label="会员" min-width="120" show-overflow-tooltip>
+        <template slot-scope="scope">
+          <div class="cell-main">{{ scope.row.nickname || '-' }}</div>
+          <div class="cell-sub">{{ scope.row.phone || '-' }}</div>
+        </template>
+      </el-table-column>
+      <el-table-column label="优惠券" min-width="140" show-overflow-tooltip>
+        <template slot-scope="scope">
+          <div class="cell-main">{{ scope.row.couponTitle || '-' }}</div>
+          <div class="cell-sub">面值 {{ scope.row.couponPrice }} / 满 {{ scope.row.useMinPrice }}</div>
+        </template>
+      </el-table-column>
+      <el-table-column label="领取/有效期" min-width="150">
+        <template slot-scope="scope">
+          <div class="cell-sub">领:{{ formatTime(scope.row.createTime) }}</div>
+          <div class="cell-sub">止:{{ formatTime(scope.row.limitTime) }}</div>
+        </template>
+      </el-table-column>
+      <el-table-column label="核销信息" min-width="150">
+        <template slot-scope="scope">
+          <div class="cell-main">{{ scope.row.verifyUserName || '-' }}</div>
+          <div class="cell-sub">{{ formatTime(scope.row.verifyTime || scope.row.useTime) }}</div>
+        </template>
+      </el-table-column>
+      <el-table-column label="状态" width="80" align="center">
+        <template slot-scope="scope">
+          <el-tag size="mini" :type="statusTagType(scope.row.status)">{{ statusLabel(scope.row.status) }}</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" width="70" align="center">
+        <template slot-scope="scope">
+          <el-button
+            v-if="String(scope.row.status) === '0'"
+            size="mini"
+            type="text"
+            @click="handleVerify(scope.row)"
+          >核销</el-button>
+          <span v-else class="cell-sub">-</span>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </div>
+</template>
+
+<script>
+import { listStoreCouponUser, exportStoreCouponUser, verifyStoreCouponUser } from "@/api/live/liveCouponUser";
+
+export default {
+  name: "LiveCouponUser",
+  data() {
+    return {
+      statusOptions: [],
+      loading: true,
+      dateRange: [],
+      showSearch: true,
+      total: 0,
+      storeCouponUserList: [],
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        couponTitle: null,
+        status: null
+      }
+    };
+  },
+  created() {
+    this.getDicts("live_coupon_user_status").then((response) => {
+      this.statusOptions = response.data || [];
+    });
+    this.getList();
+  },
+  methods: {
+    statusLabel(status) {
+      const hit = (this.statusOptions || []).find(item => String(item.dictValue) === String(status));
+      if (hit) {
+        return hit.dictLabel;
+      }
+      const fallback = { 0: "未核销", 1: "已核销", 2: "已过期" };
+      return fallback[status] != null ? fallback[status] : status;
+    },
+    statusTagType(status) {
+      const map = { 0: "info", 1: "success", 2: "danger" };
+      return map[status] || "info";
+    },
+    formatTime(val) {
+      if (!val) {
+        return "-";
+      }
+      const text = String(val).replace("T", " ");
+      return text.length >= 16 ? text.substring(0, 16) : text;
+    },
+    getList() {
+      this.loading = true;
+      listStoreCouponUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
+        this.storeCouponUserList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      }).catch(() => {
+        this.loading = false;
+      });
+    },
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    resetQuery() {
+      this.dateRange = [];
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    handleVerify(row) {
+      this.$confirm('是否确认核销"' + row.couponTitle + '"?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        return verifyStoreCouponUser({ couponUserId: row.id });
+      }).then(response => {
+        if (response.code === 200) {
+          this.msgSuccess(response.msg || "核销成功");
+          this.getList();
+        }
+      }).catch(() => {});
+    },
+    handleExport() {
+      const queryParams = this.addDateRange({ ...this.queryParams }, this.dateRange);
+      this.$confirm('是否确认导出所有优惠券发放记录数据项?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        return exportStoreCouponUser(queryParams);
+      }).then(response => {
+        this.download(response.msg);
+      }).catch(() => {});
+    }
+  }
+};
+</script>
+
+<style scoped>
+.cell-main {
+  line-height: 18px;
+  color: #303133;
+}
+.cell-sub {
+  line-height: 18px;
+  font-size: 12px;
+  color: #909399;
+}
+</style>

+ 2 - 40
src/views/live/liveWatchLog/index.vue

@@ -162,60 +162,22 @@
           <img :src="scope.row.userAvatar" style="height: 80px">
         </template>
       </el-table-column>
-      <!-- <el-table-column label="直播间id" align="center" prop="liveId" /> -->
+      <el-table-column label="直播间id" align="center" prop="liveId" />
       <el-table-column label="直播间" align="center" prop="liveName" />
       <el-table-column label="记录类型" align="center" prop="logType">
         <template slot-scope="scope">
           <dict-tag :options="logTypeOptions" :value="scope.row.logType"/>
         </template>
       </el-table-column>
-      <!-- <el-table-column label="外部联系人id" align="center" prop="externalContactId" /> -->
+      <el-table-column label="外部联系人id" align="center" prop="externalContactId" />
       <el-table-column label="外部联系人" align="center" prop="qwExternalName" />
       <el-table-column label="销售" align="center" prop="companyUserName" />
-      <!-- <el-table-column label="公司id" align="center" prop="companyId" /> -->
-      <el-table-column label="完课时间" align="center" prop="finishTime" width="180">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.finishTime, '{y}-{m}-{d}') }}</span>
-        </template>
-      </el-table-column>
       <el-table-column label="sop最后创建时间" align="center" prop="sopCreateTime" width="180">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.sopCreateTime, '{y}-{m}-{d}') }}</span>
         </template>
       </el-table-column>
-      <!-- <el-table-column label="发送小程序appid" align="center" prop="sendAppId" /> -->
-      <!-- <el-table-column label="日志创建来源:1、个人sop,2、群聊sop,3、一键群发" align="center" prop="logSource" /> -->
       <el-table-column label="企微" align="center" prop="qwUserName" />
-      <el-table-column label="是否直播时下单" align="center" prop="liveBuy" >
-         <template slot-scope="scope">
-            <span v-if="!!scope.row.liveBuy">是</span>
-            <span v-else>否</span>
-          </template>
-       </el-table-column>
-       <el-table-column label="是否回放时下单" align="center" prop="replayBuy" >
-         <template slot-scope="scope">
-            <span v-if="!!scope.row.replayBuy">是</span>
-            <span v-else>否</span>
-          </template>
-       </el-table-column>
-      <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
-        <template slot-scope="scope">
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
-            v-hasPermi="['live:liveWatchLog:edit']"
-          >修改</el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['live:liveWatchLog:remove']"
-          >删除</el-button>
-        </template>
-      </el-table-column> -->
     </el-table>
 
     <pagination