index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <ele-page flex-table>
  3. <page-search @search="reload" />
  4. <common-table ref="pageRef" :pageConfig="pageConfig" :columns="columns" :tools="false" :datasource="datasource">
  5. <template #toolbar>
  6. <el-radio-group @change="handleStatusChange" v-model="searchType" class="audit-tabs">
  7. <el-radio-button label="全部" value="0" />
  8. <el-radio-button label="待审核" value="1" />
  9. <el-radio-button label="已完成" value="2" />
  10. </el-radio-group>
  11. </template>
  12. <template #cover="{ row }">
  13. <el-image style="width: 100px; height: 100px; border-radius: 4px" fit="cover" :src="row.cover"
  14. :preview-src-list="[row.cover]" :initial-index="0" preview-teleported />
  15. </template>
  16. <template #info="{ row }">
  17. <div class="flex flex-col text-sm">
  18. <div class="mb-1">
  19. <span class="font-bold">书名: </span>{{ row.bookName }}
  20. </div>
  21. <div class="mb-1">
  22. <span class="font-bold">作者: </span>{{ row.author }}
  23. </div>
  24. <div class="mb-1">
  25. <span class="font-bold">ISBN: </span>{{ row.isbn }}
  26. </div>
  27. <div class="mb-1">
  28. <span class="font-bold">出版社: </span>{{ row.publisher }}
  29. </div>
  30. <div class="mb-1">
  31. <span class="font-bold">出版时间: </span>{{ row.pubDate }}
  32. </div>
  33. <div class="mb-1">
  34. <span class="font-bold">所属类型: </span>{{ row.type }}
  35. </div>
  36. <div class="mb-1">
  37. <span class="font-bold">回收状态: </span>{{ row.recycleStatus }}
  38. </div>
  39. <div class="mt-2 border-t pt-2">
  40. <span class="mr-4">定价: {{ row.price }}</span>
  41. <span class="mr-4">回收折扣: {{ row.recycleDiscount }}折 <span
  42. class="text-red-500 text-xs">建议0.5-0.6折</span></span>
  43. <span>回收价格: {{ row.recyclePrice }}</span>
  44. </div>
  45. <div class="mb-1">
  46. <span class="text-green-500 text-xs">谢程娟: 2025-06-15</span>
  47. </div>
  48. <div class="mb-1">
  49. <span class="mr-4">销售价格: {{ row.salesPrice }}</span>
  50. <span class="text-green-500 text-xs">谢程娟: 2025-06-15</span>
  51. </div>
  52. <div class="mb-1">
  53. <span>(已回收数量: {{ row.recycledCount }} 当前库存: {{ row.currentStock }})</span>
  54. </div>
  55. </div>
  56. </template>
  57. <template #newPrice="{ row }">
  58. <div class="flex flex-col items-center">
  59. <div class="flex items-center text-xl font-bold">
  60. {{ row.newPrice }}
  61. <el-icon class="ml-2 cursor-pointer text-red-500">
  62. <Edit />
  63. </el-icon>
  64. </div>
  65. <el-button size="small" type="info" plain class="mt-1">填入原售价</el-button>
  66. </div>
  67. </template>
  68. <template #action="{ row }">
  69. <div class="flex flex-col items-center gap-2">
  70. <el-button color="#951d1d" size="small" @click="handleViewUrl(row, 'kw')">查看孔网</el-button>
  71. <el-button color="#f37607" size="small" @click="handleViewUrl(row, 'tb')">查看淘宝</el-button>
  72. <el-button color="#4095e5" size="small">设置独立参数</el-button>
  73. <el-button type="success" size="small">同意</el-button>
  74. </div>
  75. </template>
  76. </common-table>
  77. </ele-page>
  78. </template>
  79. <script setup>
  80. import { ref, reactive } from 'vue';
  81. import { Edit } from '@element-plus/icons-vue';
  82. import CommonTable from '@/components/CommonPage/CommonTable.vue';
  83. import PageSearch from './components/page-search.vue';
  84. defineOptions({ name: 'PriceAudit' });
  85. // Component Refs
  86. const pageRef = ref(null);
  87. const searchType = ref('0');
  88. const columns = ref([
  89. { type: 'selection', width: 50, align: 'center', fixed: 'left' },
  90. { label: '图片', prop: 'cover', width: 120, slot: 'cover' },
  91. { label: '信息', prop: 'info', minWidth: 400, slot: 'info' },
  92. { label: '总回收量', prop: 'totalRecycled', width: 110, sortable: true, align: 'center' },
  93. { label: '状态', prop: 'status', width: 100, align: 'center' },
  94. { label: '分配时间', prop: 'assignTime', width: 160, align: 'center' },
  95. { label: '当前库存', prop: 'currentStock', width: 110, sortable: true, align: 'center' },
  96. { label: '当前售价', prop: 'salesPrice', width: 100, align: 'center' },
  97. { label: '处理人', prop: 'handler', width: 100, align: 'center' },
  98. { label: '新售价', prop: 'newPrice', width: 150, slot: 'newPrice', align: 'center' },
  99. { label: '操作', prop: 'action', width: 120, slot: 'action', fixed: 'right', align: 'center' }
  100. ]);
  101. const pageConfig = reactive({
  102. fileName: '价格审核',
  103. cacheKey: 'priceAuditTable',
  104. params: {
  105. searchType: '0'
  106. },
  107. rowKey: 'id'
  108. });
  109. // Mock datasource
  110. const datasource = ({ page, limit, where, orders }) => {
  111. return Promise.resolve({
  112. code: 0,
  113. msg: 'success',
  114. count: 10,
  115. data: Array.from({ length: 10 }).map((_, i) => ({
  116. id: i + 1,
  117. cover: 'https://img1.baidu.com/it/u=2356551695,3062334057&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=707',
  118. bookName: '马克思主义基本原理',
  119. author: '编写组',
  120. isbn: '9787056025415',
  121. publisher: '高等教育出版社',
  122. pubDate: '2018-06',
  123. type: '教材库',
  124. recycleStatus: '正在回收',
  125. price: 25,
  126. recycleDiscount: 0.2,
  127. recyclePrice: 0.5,
  128. salesPrice: 6.5,
  129. recycledCount: 200,
  130. currentStock: 75 + i,
  131. totalRecycled: 200,
  132. status: i % 2 === 0 ? '待审核' : '已审核',
  133. assignTime: '2024-06-15 15:06:11',
  134. handler: 'zzz',
  135. newPrice: 10.55
  136. }))
  137. });
  138. };
  139. function reload(where) {
  140. pageRef.value?.reload(where);
  141. }
  142. function handleStatusChange(value) {
  143. pageRef.value?.reload({ searchType: value });
  144. }
  145. //查看淘宝和孔网
  146. function handleViewUrl(row, type) {
  147. let url = '';
  148. if (type == 'tb') {
  149. url = `https://s.taobao.com/search?q=${row.isbn}`;
  150. } else if (type == 'kw') {
  151. url = `https://search.kongfz.com/product_result/?key=${row.isbn}&status=0&_stpmt=eyJzZWFyY2hfdHlwZSI6ImFjdGl2ZSJ9`;
  152. }
  153. window.open(url, '_blank');
  154. }
  155. </script>
  156. <style scoped>
  157. /* 仿照截图中的Tabs样式 */
  158. :deep(.audit-tabs) .el-radio-button__inner {
  159. width: 200px;
  160. /* 增加宽度 */
  161. border-radius: 0;
  162. border: none;
  163. border-bottom: 2px solid transparent;
  164. background: transparent;
  165. box-shadow: none;
  166. color: #666;
  167. }
  168. :deep(.audit-tabs) .el-radio-button__original-radio:checked+.el-radio-button__inner {
  169. background-color: #409eff;
  170. /* 蓝色背景 */
  171. color: white;
  172. border-radius: 0;
  173. /* 保持方形或自定义圆角 */
  174. box-shadow: none;
  175. }
  176. /* 整体背景可能需要调整,这里仅做基本样式覆盖 */
  177. .audit-tabs {
  178. display: flex;
  179. background-color: #fff;
  180. border-bottom: 1px solid #eee;
  181. margin-bottom: 10px;
  182. width: 100%;
  183. }
  184. </style>