瀏覽代碼

add 商品档案&fix bug

ylong 7 月之前
父節點
當前提交
aba5ffd1e4

+ 99 - 0
src/views/data/productPush/components/push-log.vue

@@ -0,0 +1,99 @@
+<!-- 推送记录弹窗 -->
+<template>
+    <ele-modal
+        v-model="visible"
+        title="推送记录"
+        :width="800"
+        destroy-on-close
+        @open="handleOpen"
+    >
+        <ele-data-table
+            ref="tableRef"
+            row-key="id"
+            :columns="columns"
+            :data="dataList"
+            :loading="loading"
+        >
+            <template #pushRes="{ row }">
+                <dict-data
+                    code="book_stat_push_status"
+                    type="text"
+                    :model-value="row.pushRes"
+                />
+            </template>
+        </ele-data-table>
+        <template #footer>
+            <el-button @click="handleClose">关闭</el-button>
+        </template>
+    </ele-modal>
+</template>
+
+<script setup>
+    import { ref, reactive, defineExpose } from 'vue';
+    import request from '@/utils/request';
+    import { EleMessage } from 'ele-admin-plus/es';
+
+    defineOptions({ name: 'PushLog' });
+
+    /** 弹窗是否打开 */
+    const visible = ref(false);
+
+    /** 加载状态 */
+    const loading = ref(false);
+
+    /** 表格数据 */
+    const dataList = ref([]);
+
+    /** 当前行数据 */
+    const currentRow = ref(null);
+
+    /** 表格列配置 */
+    const columns = [
+        { label: 'ID', prop: 'id', align: 'center', width: 80 },
+        { label: '推送时间', prop: 'createTime', align: 'center' },
+        { label: '推送人', prop: 'pushUserName', align: 'center' },
+        { label: '推送结果', prop: 'pushRes', align: 'center', slot: 'pushRes' }
+    ];
+
+    /** 获取推送记录数据 */
+    const fetchPushLogs = () => {
+        if (!currentRow.value || !currentRow.value.id) return;
+
+        loading.value = true;
+
+        request
+            .get('/bookpush/pusherp/log?pushId=' + currentRow.value.id)
+            .then((res) => {
+                console.log(res, 'xxx');
+                if (res.data.code === 200) {
+                    dataList.value = res.data.data || [];
+                } else {
+                    EleMessage.error(res.data.msg);
+                }
+            })
+            .finally(() => {
+                loading.value = false;
+            });
+    };
+
+    /** 关闭弹窗 */
+    const handleClose = () => {
+        visible.value = false;
+    };
+
+    /** 弹窗打开事件 */
+    const handleOpen = () => {
+        fetchPushLogs();
+    };
+
+    /** 打开弹窗 */
+    const open = (row) => {
+        currentRow.value = row;
+        visible.value = true;
+    };
+
+    // 暴露方法给父组件调用
+    defineExpose({
+        open
+    });
+</script>

+ 172 - 151
src/views/data/productPush/index.vue

@@ -1,159 +1,180 @@
 <template>
-  <ele-page flex-table>
-    <page-search @search="reload" :status="useStatus"></page-search>
-
-    <common-table ref="pageRef" :pageConfig="pageConfig" :columns="columns">
-      <template #toolbar>
-        <div class="flex items-center mb-4">
-          <el-button type="warning" plain @click="handleBatchPush" v-permission="'data:productPush:onePush'">
-            一键推送
-          </el-button>
-          <el-button
-            type="success"
-            plain
-            @click="handleExportExcel"
-            :icon="DownloadOutlined"
-            v-permission="'data:productPush:export'"
-          >
-            导出
-          </el-button>
-        </div>
-      </template>
-
-      <template #isPush="{ row }">
-        <el-tag type="success" v-if="row.isPush === '是'">是</el-tag>
-        <el-tag type="danger" v-else>否</el-tag>
-      </template>
-
-      <template #pushStatus="{ row }">
-        <el-tag type="success" v-if="row.pushStatus === '成功'">成功</el-tag>
-        <el-tag type="danger" v-if="row.pushStatus === '失败'">失败</el-tag>
-        <el-tag type="warning" v-if="row.pushStatus === '系统错误'"
-          >系统错误</el-tag
-        >
-        <el-tag type="info" v-if="row.pushStatus === '无数据'">无数据</el-tag>
-      </template>
-
-      <template #action="{ row }">
-        <div>
-          <el-button type="primary" link @click="handleDetail(row)" v-permission="'data:productPush:delete'">
-            删除
-          </el-button>
-          <el-button type="primary" link @click="handlePush(row)" v-permission="'data:productPush:push'">
-            推送
-          </el-button>
-          <el-button type="primary" link @click="handlePushLog(row)" v-permission="'data:productPush:pushLog'">
-            推送日志
-          </el-button>
-        </div>
-      </template>
-    </common-table>
-  </ele-page>
+    <ele-page flex-table>
+        <page-search @search="reload" :status="useStatus"></page-search>
+
+        <common-table ref="pageRef" :pageConfig="pageConfig" :columns="columns">
+            <template #toolbar>
+                <div class="flex items-center mb-4">
+                    <el-button
+                        type="warning"
+                        plain
+                        @click="handleBatchPush"
+                        v-permission="'data:productPush:onePush'"
+                    >
+                        一键推送
+                    </el-button>
+                    <el-button
+                        type="success"
+                        plain
+                        @click="handleExportExcel"
+                        :icon="DownloadOutlined"
+                        v-permission="'data:productPush:export'"
+                    >
+                        导出
+                    </el-button>
+                </div>
+            </template>
+
+            <template #isPush="{ row }">
+                <dict-data
+                    code="book_stat_is_push"
+                    type="tag"
+                    :model-value="row.pushStatus"
+                />
+            </template>
+
+            <template #pushStatus="{ row }">
+                <dict-data
+                    code="book_stat_push_status"
+                    type="text"
+                    :model-value="row.pushRes"
+                />
+            </template>
+
+            <template #action="{ row }">
+                <div>
+                    <el-button
+                        type="primary"
+                        link
+                        @click="handleDelete(row)"
+                        v-permission="'data:productPush:delete'"
+                    >
+                        删除
+                    </el-button>
+                    <el-button
+                        type="danger"
+                        link
+                        @click="handleBatchPush(row)"
+                        v-permission="'data:productPush:push'"
+                    >
+                        推送
+                    </el-button>
+                    <el-button
+                        type="warning"
+                        link
+                        @click="handlePushLog(row)"
+                        v-permission="'data:productPush:pushLog'"
+                    >
+                        推送日志
+                    </el-button>
+                </div>
+            </template>
+        </common-table>
+
+        <!-- 推送日志弹窗 -->
+        <push-log ref="pushLogRef" />
+    </ele-page>
 </template>
 
 <script setup>
-  import { ref, reactive } from 'vue';
-  import { ElMessageBox } from 'element-plus/es';
-  import { EleMessage } from 'ele-admin-plus/es';
-  import { DownloadOutlined } from '@/components/icons';
-  import CommonTable from '@/components/CommonPage/CommonTable.vue';
-  import pageSearch from './components/page-search.vue';
-  import request from '@/utils/request';
-
-  defineOptions({ name: 'productPush' });
-
-  const useStatus = ref('');
-
-  /** 表格列配置 */
-  const columns = ref([
-    { label: '序号', prop: 'index', align: 'center', width: 70 },
-    { label: 'ISBN', prop: 'isbn', align: 'center', minWidth: 120 },
-    { label: '是否推送', prop: 'isPush', align: 'center', slot: 'isPush' },
-    { label: '创建时间', prop: 'createTime', align: 'center', width: 180 },
-    { label: '推送时间', prop: 'pushTime', align: 'center', width: 180 },
-    { label: '扫描提交人', prop: 'submitter', align: 'center' },
-    { label: '后台处理人', prop: 'processor', align: 'center' },
-    {
-      label: '推送状态',
-      prop: 'pushStatus',
-      align: 'center',
-      slot: 'pushStatus'
-    },
-    {
-      label: '操作',
-      width: 240,
-      align: 'center',
-      slot: 'action'
+    import { ref, reactive } from 'vue';
+    import { DownloadOutlined } from '@/components/icons';
+    import CommonTable from '@/components/CommonPage/CommonTable.vue';
+    import pageSearch from './components/page-search.vue';
+    import PushLog from './components/push-log.vue';
+    import request from '@/utils/request';
+
+    defineOptions({ name: 'productPush' });
+
+    const useStatus = ref('');
+
+    /** 表格列配置 */
+    const columns = ref([
+        { label: 'ID', prop: 'id', align: 'center', width: 70 },
+        { label: 'ISBN', prop: 'bookIsbn', align: 'center', minWidth: 120 },
+        {
+            label: '是否推送',
+            prop: 'pushStatus',
+            align: 'center',
+            slot: 'isPush'
+        },
+        { label: '创建时间', prop: 'createTime', align: 'center', width: 180 },
+        { label: '推送时间', prop: 'pushTime', align: 'center', width: 180 },
+        {
+            label: '扫描提交人',
+            prop: 'scanUserName',
+            align: 'center',
+            formatter: (row) => row.scanUserName || '-'
+        },
+        {
+            label: '后台处理人',
+            prop: 'operateUserName',
+            align: 'center',
+            formatter: (row) => row.operateUserName || '-'
+        },
+        {
+            label: '推送状态',
+            prop: 'pushRes',
+            align: 'center',
+            slot: 'pushStatus'
+        },
+        {
+            label: '操作',
+            width: 240,
+            align: 'center',
+            slot: 'action'
+        }
+    ]);
+
+    /** 页面组件实例 */
+    const pageRef = ref(null);
+
+    /** 推送日志组件实例 */
+    const pushLogRef = ref(null);
+
+    const pageConfig = reactive({
+        pageUrl: '/bookpush/pusherp/pagelist',
+        exportUrl: '/bookpush/pusherp/export',
+        fileName: '商品档案推送',
+        cacheKey: 'productPushTable'
+    });
+
+    // 刷新表格
+    function reload(where) {
+        pageRef.value?.reload(where);
     }
-  ]);
-
-  /** 页面组件实例 */
-  const pageRef = ref(null);
-
-  const pageConfig = reactive({
-    pageUrl: '/data/product/push/list',
-    exportUrl: '/data/product/push/export',
-    fileName: '商品档案推送',
-    cacheKey: 'productPushTable'
-  });
-
-  // 刷新表格
-  function reload(where) {
-    pageRef.value?.reload(where);
-  }
-
-  // 导出excel
-  function handleExportExcel() {
-    pageRef.value?.exportData('商品档案推送');
-  }
-
-  // 批量推送
-  function handleBatchPush() {
-    ElMessageBox.confirm('确认批量推送选中的商品档案?', '提示', {
-      confirmButtonText: '确定',
-      cancelButtonText: '取消',
-      type: 'warning'
-    })
-      .then(() => {
-        request.post('/data/product/push/batchPush').then((res) => {
-          if (res.data.code === 200) {
-            EleMessage.success('批量推送成功');
-            reload();
-          } else {
-            EleMessage.error(res.data.msg || '批量推送失败');
-          }
+
+    // 导出excel
+    function handleExportExcel() {
+        pageRef.value?.exportData('商品档案推送');
+    }
+
+    //删除
+    function handleDelete(row) {
+        pageRef.value.messageBoxConfirm({
+            message: '确认删除选中的商品档案?',
+            fetch: () => {
+                return request.post('/bookpush/pusherp/remove', { id: row.id });
+            }
         });
-      })
-      .catch(() => {});
-  }
-
-  // 推送单个商品
-  function handlePush(row) {
-    ElMessageBox.confirm(`确认推送ISBN为${row.isbn}的商品档案?`, '提示', {
-      confirmButtonText: '确定',
-      cancelButtonText: '取消',
-      type: 'warning'
-    })
-      .then(() => {
-        request.post(`/data/product/push/push/${row.isbn}`).then((res) => {
-          if (res.data.code === 200) {
-            EleMessage.success('推送成功');
-            reload();
-          } else {
-            EleMessage.error(res.data.msg || '推送失败');
-          }
+    }
+
+    // 批量推送
+    function handleBatchPush(row = null) {
+        let selections = row == null ? pageRef.value.getSelection() : [row];
+        pageRef.value.operatBatch({
+            row,
+            method: 'post',
+            url: '/bookpush/pusherp/pushBatch',
+            title: '确认批量推送选中的商品档案?',
+            data: {
+                ids: selections.map((item) => item.id)
+            }
         });
-      })
-      .catch(() => {});
-  }
-
-  // 查看详情
-  function handleDetail(row) {
-    // 实现详情查看逻辑
-  }
-
-  // 查看推送日志
-  function handlePushLog(row) {
-    // 实现推送日志查看逻辑
-  }
+    }
+
+    // 查看推送日志
+    function handlePushLog(row) {
+        pushLogRef.value?.open(row);
+    }
 </script>

+ 1 - 1
src/views/recycle/bookStat/index.vue

@@ -271,7 +271,7 @@
     {
       label: '总回收数量',
       minWidth: 120,
-      prop: 'recycleTotalNum',
+      prop: 'recycleTotalNumTime',
       sortable: true,
       columnKey: '2'
     },

+ 5 - 4
src/views/recycle/components/book-stat-info.vue

@@ -60,10 +60,6 @@
                         >{{ row.sugDiscountStr }}</el-text
                     >
                 </div>
-                <div class="common-text">
-                    <el-text>回收价格:</el-text>
-                    <el-text>¥ {{ row.recyclePrice }}</el-text>
-                </div>
                 <div class="common-text" v-if="row.discountChangeLog">
                     <el-text style="color: #3ab54b"
                         >{{ row.discountChangeLog.userName }}:</el-text
@@ -72,6 +68,11 @@
                         row.discountChangeLog.changeTime
                     }}</el-text>
                 </div>
+                <div class="common-text">
+                    <el-text>回收价格:</el-text>
+                    <el-text>¥ {{ row.recyclePrice }}</el-text>
+                </div>
+                
 
                 <div class="common-text">
                     <el-text>销售价格:</el-text>

+ 2 - 1
src/views/recycle/inventoryAlert/index.vue

@@ -203,12 +203,13 @@
     params: {
       alarmType: '2',
       delStatus: '1',
-      history: '1'
+      history: history.value
     }
   });
 
   //刷新表格
   function reload(where) {
+    where.history = history.value;
     pageRef.value?.reload(where);
   }
 

+ 2 - 1
src/views/recycle/priceAlert/index.vue

@@ -249,13 +249,14 @@
         cacheKey: 'priceAlertTable',
         params: {
             alarmType: 3,
-            history: '0',
+            history: history.value,
             delStatus: '1'
         }
     });
 
     //刷新表格
     function reload(where) {
+        where.history = history.value;
         pageRef.value?.reload(where);
     }
 

+ 8 - 6
src/views/recycle/stockFullAlert/index.vue

@@ -9,9 +9,9 @@
             :tools="false"
         >
             <template #toolbar>
-                <el-radio-group @change="handleStatusChange" v-model="history">
-                    <el-radio-button label="库存收满预警" value="1" />
-                    <el-radio-button label="库存已收满预警" value="0" />
+                <el-radio-group @change="handleStatusChange" v-model="fullType">
+                    <el-radio-button label="库存收满预警" value="0" />
+                    <el-radio-button label="库存已收满预警" value="1" />
                 </el-radio-group>
 
                 <span class="ml-8"></span>
@@ -188,9 +188,9 @@
 
     defineOptions({ name: 'stockFullAlert' });
 
-    const history = ref('1');
+    const fullType = ref('0');
     function handleStatusChange(value) {
-        pageRef.value.reload({ history: value });
+        pageRef.value.reload({ fullType: value });
     }
 
     /** 表格列配置 */
@@ -247,12 +247,14 @@
         params: {
             alarmType: '1',
             delStatus: '1',
-            history: '1'
+            fullType: fullType.value,
+            history:'0'
         }
     });
 
     //刷新表格
     function reload(where) {
+        where.fullType = fullType.value;
         pageRef.value?.reload(where);
     }
 

+ 1 - 1
src/views/recycle/workbench/index.vue

@@ -270,7 +270,7 @@
     {
       label: '总回收数量',
       minWidth: 120,
-      prop: 'recycleTotalNum',
+      prop: 'recycleTotalNumTime',
       sortable: true,
       columnKey: '2'
     },

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

@@ -96,6 +96,14 @@
                             >{{ row.sugDiscountStr }}</el-text
                         >
                     </div>
+                    <div class="common-text flex" v-if="row.discountChangeLog">
+                        <el-text style="color: #3ab54b"
+                            >{{ row.discountChangeLog.userName }}:</el-text
+                        >
+                        <el-text style="color: #3ab54b">{{
+                            row.discountChangeLog.changeTime
+                        }}</el-text>
+                    </div>
                     <div class="common-text flex">
                         <el-text>回收单价:</el-text>
                         <el-text>¥ {{ row.recyclePrice }}</el-text>
@@ -110,14 +118,7 @@
                             +{{ isExpand?row.upsellPrice:`${row.upsellPrice}×${row.upsellNum}` }}</el-text
                         >
                     </div>
-                    <div class="common-text flex" v-if="row.discountChangeLog">
-                        <el-text style="color: #3ab54b"
-                            >{{ row.discountChangeLog.userName }}:</el-text
-                        >
-                        <el-text style="color: #3ab54b">{{
-                            row.discountChangeLog.changeTime
-                        }}</el-text>
-                    </div>
+                   
                     <div class="common-text flex">
                         <el-text>销售价格:</el-text>
                         <el-text>¥ {{ row.productPrice }}</el-text>

+ 1 - 1
src/views/recycleOrder/needReturned/index.vue

@@ -82,7 +82,7 @@
         </template>
 
         <template #action="{ row }">
-          <div>
+          <div class="flex flex-wrap flex-col">
             <el-button
               type="success"
               link