detail.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <div class="detail-container">
  3. <!-- 主图LOGO部分 -->
  4. <div class="logo-section flex left top">
  5. <div class="fw-600">主图LOGO:</div>
  6. <upload v-model="queryParams.logoImage"></upload>
  7. </div>
  8. <el-divider />
  9. <!-- 选择详情模板部分 -->
  10. <div class="template-section ">
  11. <div class="flex between">
  12. <span>选择详情模版</span>
  13. <div class="template-pagination">
  14. <el-pagination background layout="prev, pager, next" v-model:current-page="queryParams.current"
  15. v-model:page-size.sync="queryParams.size" :total="totalPage" @current-change="onCurrentChange"
  16. @size-change="onSizeChange" />
  17. </div>
  18. </div>
  19. <div class="template-list">
  20. <div v-for="(template, index) in visibleTemplates" :key="index" class="template-item"
  21. @click="queryParams.templateId = template.id">
  22. <div class="select-warp" :class="queryParams.templateId == template.id ? 'active' : ''">
  23. <el-icon color="#FFFFFF">
  24. <Select />
  25. </el-icon>
  26. </div>
  27. <div class="template-info">
  28. <span class="mar-left-10">{{ template.templateId }}</span>
  29. <div class="template-view" @click="viewTemplate(template)">查看</div>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. <!-- 详情资料准备部分 -->
  35. <div class="data-prep-section">
  36. <div class="flex-item left">详情资料准备 (2选1)</div>
  37. <div class="flex-item left">
  38. <el-radio-group v-model="queryParams.radio1" class="ml-4">
  39. <el-radio label="1" size="large">EXCEL文件选择</el-radio>
  40. <el-radio label="2" size="large">系统对接(和业务员联系)</el-radio>
  41. </el-radio-group>
  42. </div>
  43. <div v-if="dataPrepOption === 'excel'" class="excel-upload">
  44. <el-row :gutter="20">
  45. <el-col :span="1"></el-col>
  46. <el-col :span="4">商品基础资料EXCEL文件选择:</el-col>
  47. <el-col :span="18">
  48. <el-input type="textarea" v-model="excelFilePath" />
  49. </el-col>
  50. <el-col :span="1"></el-col>
  51. </el-row>
  52. </div>
  53. </div>
  54. <!-- 开始生成按钮 -->
  55. <button class="generate-button button--primary1" @click="generate">开始生成</button>
  56. </div>
  57. </template>
  58. <script lang="ts" setup>
  59. import { ref, computed, reactive } from 'vue';
  60. import { Select } from '@element-plus/icons-vue'
  61. import upload from '@/components/upload'
  62. // 模拟数据
  63. const templates = [
  64. { id: 1101, templateId: '某某模版编号1', preview: '...' },
  65. { id: 1102, templateId: '某某模版编号2', preview: '...' },
  66. { id: 1103, templateId: '某某模版编号3', preview: '...' },
  67. { id: 1104, templateId: '某某模版编号4', preview: '...' },
  68. { id: 1105, templateId: '某某模版编号5', preview: '...' },
  69. { id: 1106, templateId: '某某模版编号6', preview: '...' },
  70. { id: 1107, templateId: '某某模版编号7', preview: '...' },
  71. { id: 1108, templateId: '某某模版编号8', preview: '...' },
  72. { id: 1109, templateId: '某某模版编号9', preview: '...' },
  73. { id: 1110, templateId: '某某模版编号10', preview: '...' },
  74. { id: 1111, templateId: '某某模版编号11', preview: '...' },
  75. { id: 1112, templateId: '某某模版编号12', preview: '...' },
  76. // 更多模板...
  77. ];
  78. const itemsPerPage = 4; // 每页显示的模板数量
  79. // 状态变量
  80. const currentPage = ref(1);
  81. const selectedTemplateIndex = ref(0);
  82. const dataPrepOption = ref('excel');
  83. const excelFilePath = ref('D:\\MyDocuments\\PythonCode\\MyPython\\red_dragonfly\\deal_pics\\auto_capture_V2\\auto_photo');
  84. const totalPage = ref(3);
  85. const queryParams = reactive({
  86. logoImage: '',
  87. size: 1,
  88. current: 1,
  89. templateId: 1101,
  90. radio1: 1
  91. })
  92. // 计算属性,获取当前页可见的模板
  93. const visibleTemplates = computed(() => {
  94. const startIndex = (queryParams.current - 1) * itemsPerPage;
  95. const data = templates.slice(startIndex, startIndex + itemsPerPage);
  96. return data
  97. });
  98. // 查看模板详情
  99. const viewTemplate = (template) => {
  100. console.log('查看模板详情', template);
  101. };
  102. const onCurrentChange = (page) => {
  103. queryParams.current = page;
  104. };
  105. const onSizeChange = (data) => {
  106. };
  107. // 开始生成操作
  108. const generate = () => {
  109. console.log('开始生成');
  110. // 这里添加实际生成主图和详情的逻辑
  111. };
  112. </script>
  113. <style lang="scss" scoped>
  114. .detail-container {
  115. padding: 20px 0 20px 20px;
  116. max-width: 1200px;
  117. background-color: #EAECED;
  118. width: 100%;
  119. }
  120. .logo-section,
  121. .template-section,
  122. .data-prep-section {
  123. margin-bottom: 20px;
  124. }
  125. .logo-upload {
  126. border: 1px dashed #ccc;
  127. border-radius: 5px;
  128. padding: 50px 0;
  129. text-align: center;
  130. cursor: pointer;
  131. }
  132. .template-pagination button {
  133. margin-right: 5px;
  134. }
  135. .template-pagination span {
  136. display: inline-block;
  137. width: 20px;
  138. height: 20px;
  139. line-height: 20px;
  140. text-align: center;
  141. border: 1px solid #ccc;
  142. border-radius: 5px;
  143. margin-right: 5px;
  144. cursor: pointer;
  145. }
  146. .template-list {
  147. display: flex;
  148. flex-wrap: wrap;
  149. gap: 10px;
  150. margin-top: 10px;
  151. .template-item {
  152. width: calc(25% - 34px);
  153. border: 1px solid #ccc;
  154. border-radius: 10px;
  155. padding: 10px;
  156. height: 320px;
  157. cursor: pointer;
  158. background: #f0f0f0;
  159. position: relative;
  160. overflow: hidden;
  161. .template-info {
  162. position: absolute;
  163. bottom: 0;
  164. left: 0;
  165. background: rgba($color: #000000, $alpha: .3);
  166. width: 100%;
  167. height: 36px;
  168. line-height: 36px;
  169. color: #eee;
  170. display: flex;
  171. align-items: center;
  172. justify-content: space-between;
  173. .template-view {
  174. background: #DFE2E3;
  175. color: #3366FF;
  176. height: 30px;
  177. line-height: 30px;
  178. padding: 0 10px;
  179. border-radius: 4px;
  180. margin-right: 10px;
  181. font-size: 14px;
  182. }
  183. }
  184. }
  185. }
  186. .excel-upload {
  187. width: 100%;
  188. background: #F7F7F7;
  189. padding: 20px 0;
  190. }
  191. .generate-button {
  192. padding: 10px 20px;
  193. color: white;
  194. border: none;
  195. border-radius: 5px;
  196. cursor: pointer;
  197. }
  198. .select-warp {
  199. width: 18px;
  200. height: 18px;
  201. border-radius: 4px;
  202. background-color: #fff;
  203. &.active {
  204. background-color: #1677FF;
  205. }
  206. }
  207. </style>