Alex 9 месяцев назад
Родитель
Сommit
b78b165df5

+ 3 - 3
src/views/recycle/scanLog/index.vue

@@ -78,7 +78,7 @@
         <el-button
           type="success"
           plain
-          v-permission="'recycle:booklist:batchAddSocial'"
+          v-permission="'recycle:scanLog:batchAddSocial'"
           @click="handleOptType(1)"
         >
           加社科库
@@ -86,7 +86,7 @@
         <el-button
           type="primary"
           plain
-          v-permission="'recycle:booklist:batchAddTeach'"
+          v-permission="'recycle:scanLog:batchAddTeach'"
           @click="handleOptType(2)"
         >
           加教材库
@@ -279,7 +279,7 @@
 
   const pageConfig = reactive({
     pageUrl: '/user/userScanLog/getBookScanLogList',
-    fileName: '回收书单管理',
+    fileName: '扫码记录管理',
     cacheKey: 'scanLoglistTable',
     params: {
       searchType: '1'

+ 359 - 0
src/views/recycle/workbench/index.vue

@@ -0,0 +1,359 @@
+<template>
+  <ele-page flex-table>
+    <book-search @search="reload"></book-search>
+
+    <common-table
+      ref="pageRef"
+      :pageConfig="pageConfig"
+      :columns="columns"
+      :tools="false"
+      @sort-change="handleSortChange"
+    >
+      <template #toolbar>
+        <el-radio-group @change="handleStatusChange" v-model="searchType">
+          <el-radio-button label="已加入回收书单(正在回收)" value="1" />
+          <el-radio-button label="已加入回收书单(暂停回收)" value="2" />
+          <el-radio-button label="未加入回收书单" value="3" />
+          <el-radio-button label="黑名单" value="4" />
+          <el-radio-button label="无数据信息" value="5" />
+        </el-radio-group>
+
+        <span class="ml-8"></span>
+        <el-button
+          type="warning"
+          plain
+          v-permission="'recycle:workbench:batchRemoveBooklist'"
+          @click="handleOptBooklist('remove')"
+          v-if="['1', '2'].includes(searchType)"
+        >
+          移除回收书单
+        </el-button>
+        <el-button
+          type="success"
+          plain
+          v-permission="'recycle:workbench:batchAddBooklist'"
+          @click="handleOptBooklist('add')"
+          v-if="['3', '4'].includes(searchType)"
+        >
+          加入回收书单
+        </el-button>
+        <el-button
+          type="warning"
+          plain
+          v-permission="'recycle:workbench:batchRemoveBlacklist'"
+          @click="handleOptBlacklist('remove')"
+          v-if="searchType === '4'"
+        >
+          移除黑名单
+        </el-button>
+        <el-button
+          type="danger"
+          plain
+          v-permission="'recycle:workbench:batchAddBlacklist'"
+          @click="handleOptBlacklist('add')"
+          v-if="searchType !== '4'"
+        >
+          加黑名单
+        </el-button>
+
+        <el-button
+          type="warning"
+          plain
+          v-permission="'recycle:workbench:batchPauseRecycle'"
+          @click="handleOptRecycle('pause')"
+          v-if="searchType === '1'"
+        >
+          暂停回收
+        </el-button>
+        <el-button
+          type="warning"
+          plain
+          v-permission="'recycle:workbench:batchStartRecycle'"
+          @click="handleOptRecycle('start')"
+          v-if="searchType === '2'"
+        >
+          开启回收
+        </el-button>
+
+        <el-button
+          type="success"
+          plain
+          v-permission="'recycle:workbench:batchAddSocial'"
+          @click="handleOptType(1)"
+        >
+          加社科库
+        </el-button>
+        <el-button
+          type="primary"
+          plain
+          v-permission="'recycle:workbench:batchAddTeach'"
+          @click="handleOptType(2)"
+        >
+          加教材库
+        </el-button>
+      </template>
+
+      <template #cover="{ row }">
+        <el-image
+          style="width: 90px; height: 120px; border-radius: 4px"
+          fit="cover"
+          :src="row.cover"
+        />
+      </template>
+      <template #baseInfo="{ row }">
+        <book-info :row="row"></book-info>
+      </template>
+      <template #stock="{ row }">
+        <book-stock :row="row"></book-stock>
+      </template>
+
+      <template #action="{ row }">
+        <el-button
+          type="primary"
+          link
+          v-permission="'recycle:workbench:viewUrl'"
+          @click="handleViewUrl(row, 'tb')"
+        >
+          [查看淘宝]
+        </el-button>
+        <el-button
+          type="danger"
+          link
+          v-permission="'recycle:workbench:viewUrl'"
+          @click="handleViewUrl(row, 'kw')"
+        >
+          [查看孔网]
+        </el-button>
+        <el-button
+          color="#192bbe"
+          plain
+          link
+          v-permission="'recycle:workbench:setParams'"
+          @click="handleSetParams(row)"
+        >
+          [设置独立参数]
+        </el-button>
+        <el-button
+          type="success"
+          link
+          v-permission="'recycle:workbench:removeBlacklist'"
+          @click="handleOptBlacklist('remove', row)"
+          v-if="row.bookStatus == 3"
+        >
+          [移除黑名单]
+        </el-button>
+        <el-button
+          type="warning"
+          link
+          v-permission="'recycle:workbench:addBlacklist'"
+          @click="handleOptBlacklist('add', row)"
+          v-if="row.bookStatus == 1 || row.bookStatus == 2"
+        >
+          [加入黑名单]
+        </el-button>
+        <el-button
+          type="danger"
+          link
+          v-permission="'recycle:workbench:pauseRecycle'"
+          @click="handleOptRecycle('pause', row)"
+          v-if="row.recycleStatus == 1"
+        >
+          [暂停回收]
+        </el-button>
+        <el-button
+          type="success"
+          link
+          v-permission="'recycle:workbench:startRecycle'"
+          @click="handleOptRecycle('start', row)"
+          v-else
+        >
+          [开启回收]
+        </el-button>
+        <el-button
+          type="success"
+          link
+          v-permission="'recycle:workbench:removeBooklist'"
+          @click="handleOptBooklist('remove', row)"
+          v-if="row.bookStatus == 2"
+        >
+          [移除回收书单]
+        </el-button>
+        <el-button
+          type="danger"
+          link
+          v-permission="'recycle:workbench:addBooklist'"
+          @click="handleOptBooklist('add', row)"
+          v-if="row.bookStatus == 1"
+        >
+          [加入回收书单]
+        </el-button>
+        <!-- 回收日志和售价日志 -->
+        <el-button
+          type="danger"
+          link
+          v-permission="'recycle:workbench:recycleLog'"
+          @click="handleViewRecycleLog(row)"
+        >
+          [回收日志]
+        </el-button>
+        <el-button
+          type="primary"
+          link
+          v-permission="'recycle:workbench:salesLog'"
+          @click="handleViewSalesLog(row)"
+        >
+          [售价日志]
+        </el-button>
+      </template>
+    </common-table>
+
+    <books-edit ref="editRef"></books-edit>
+    <set-params ref="paramsRef"></set-params>
+    <add-discount ref="discountRef" @refresh="reload"></add-discount>
+    <order-blacklist ref="blacklistRef" @refresh="reload"></order-blacklist>
+    <order-recycle-log ref="recycleLogRef" />
+    <order-sales-log ref="salesLogRef" />
+  </ele-page>
+</template>
+
+<script setup>
+  import { ref, reactive } from 'vue';
+  import CommonTable from '@/components/CommonPage/CommonTable.vue';
+  import booksEdit from '@/views/data/books/components/books-edit.vue';
+  import bookSearch from '@/views/recycle/components/book-search.vue';
+  import bookInfo from '@/views/recycle/components/book-info.vue';
+  import bookStock from '@/views/recycle/components/book-stock.vue';
+  import setParams from '@/views/recycle/components/set-params.vue';
+  import addDiscount from '@/views/recycle/components/add-discount.vue';
+  import orderBlacklist from '@/views/recycleOrder/detail/order-blacklist.vue';
+  import orderRecycleLog from '@/views/recycleOrder/detail/order-recycle-log.vue';
+  import orderSalesLog from '@/views/recycleOrder/detail/order-sales-log.vue';
+  import { useBookOperation } from '@/utils/use-book-operation';
+
+  defineOptions({ name: 'scanLoglist' });
+
+  const searchType = ref('1');
+  function handleStatusChange(value) {
+    pageRef.value.reload({ searchType: value });
+  }
+
+  function handleSortChange({ column, order }) {
+    // 1 扫描次数 2总回收量 3最后一次扫描时间
+    reload({
+      orderType: column.columnKey,
+      orderWay: order === 'ascending' ? 'asc' : 'desc'
+    });
+  }
+
+  /** 表格列配置 */
+  const columns = ref([
+    {
+      type: 'selection',
+      columnKey: 'selection',
+      width: 50,
+      align: 'center',
+      fixed: 'left'
+    },
+    {
+      label: '图片',
+      prop: 'cover',
+      width: 120,
+      slot: 'cover'
+    },
+    {
+      label: '信息',
+      prop: 'baseInfo',
+      width: 540,
+      slot: 'baseInfo'
+    },
+    {
+      label: '总回收数量',
+      minWidth: 120,
+      prop: 'recycleTotalNum',
+      sortable: true,
+      columnKey: '2'
+    },
+    {
+      label: '扫描次数',
+      prop: 'scanNum',
+      sortable: true,
+      columnKey: '1',
+      minWidth: 100,
+      formatter: (row) => row?.scanNum || 0
+    },
+    {
+      label: '最近扫描时间',
+      prop: 'lastScanTime',
+      sortable: true,
+      columnKey: '3',
+      minWidth: 160,
+      formatter: (row) => (row?.lastScanTime ? row?.lastScanTime : '-')
+    },
+    {
+      label: '最大回收量',
+      minWidth: 120,
+      prop: 'recycleMax',
+      sortable: true,
+      columnKey: '6'
+    },
+    {
+      columnKey: 'action',
+      label: '操作',
+      width: 200,
+      slot: 'action',
+      fixed: 'right'
+    }
+  ]);
+
+  /** 页面组件实例 */
+  const pageRef = ref(null);
+
+  const pageConfig = reactive({
+    pageUrl: '/user/userScanLog/getBookScanLogList',
+    fileName: '扫码工作台',
+    cacheKey: 'workbenchTable',
+    params: {
+      searchType: '1'
+    },
+    rowKey: 'isbn'
+  });
+
+  //查看回收日志
+  const recycleLogRef = ref(null);
+  function handleViewRecycleLog(row) {
+    recycleLogRef.value?.handleOpen(row);
+  }
+
+  //查看售价日志
+  const salesLogRef = ref(null);
+  function handleViewSalesLog(row) {
+    salesLogRef.value?.handleOpen(row);
+  }
+
+  //刷新表格
+  function reload(where) {
+    pageRef.value?.reload(where);
+  }
+  // 使用图书操作混入
+  const {
+    blacklistRef,
+    discountRef,
+    paramsRef,
+    handleOptBooklist,
+    handleOptBlacklist,
+    handleSetParams,
+    handleOptType,
+    handleOptRecycle
+  } = useBookOperation(pageRef);
+
+  //查看淘宝和孔网
+  function handleViewUrl(row, type) {
+    let url = '';
+    if (type == 'tb') {
+      url = `https://s.taobao.com/search?q=${row.isbn}`;
+    } else if (type == 'kw') {
+      url = `https://search.kongfz.com/product_result/?key=${row.isbn}&status=0&_stpmt=eyJzZWFyY2hfdHlwZSI6ImFjdGl2ZSJ9`;
+    }
+    window.open(url, '_blank');
+  }
+</script>

+ 2 - 2
src/views/recycleOrder/detail/order-book-list.vue

@@ -112,8 +112,8 @@
         <el-button color="#0f7dc7" @click="handleSalesLog(row)"
           >售价日志</el-button
         >
-        <el-button color="#399420" @click="handleViewUrl(row, 'db')"
-          >查看豆瓣</el-button
+        <el-button color="#399420" @click="handleViewUrl(row, 'kw')"
+          >查看孔网</el-button
         >
       </div>
     </template>