list-preferred.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <div class="app-container">
  3. <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal">
  4. <el-menu-item index="1"><router-link to="/goods/list">全部商品</router-link></el-menu-item>
  5. <el-menu-item index="2"><router-link to="/goods/list/preferred">星范优选</router-link></el-menu-item>
  6. <el-menu-item index="3"><router-link to="/goods/list/preferential">星范精品</router-link></el-menu-item>
  7. <el-menu-item index="4"><router-link to="/goods/list/commonly">常用商品</router-link></el-menu-item>
  8. </el-menu>
  9. <div class="filter-container" style="margin-top:20px;">
  10. <el-input v-model="listQuery.form.id" placeholder="商品ID" style="width: 120px;" class="filter-item" @keyup.enter.native="handleFilter" />
  11. <el-input v-model="listQuery.form.productName" placeholder="商品名称" style="width: 120px;" class="filter-item" @keyup.enter.native="handleFilter" />
  12. <el-input v-model="listQuery.form.shopName" placeholder="供应商名称" style="width: 120px;" class="filter-item" @keyup.enter.native="handleFilter" />
  13. <el-select v-model="listQuery.form.classifyID" placeholder="商品分类" clearable style="width: 110px" class="filter-item" value="" @change="handleFilter">
  14. <!-- <el-option v-for="item in productsClassifyList" :key="item.id" :label="item.classifyName" :value="item.id" /> -->
  15. </el-select>
  16. <el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">搜索</el-button>
  17. <el-button class="filter-item" type="primary" icon="el-icon-sort">批量更新排序</el-button>
  18. <el-button class="filter-item" type="primary" icon="el-icon-circle-plus-outline">
  19. <router-link to="/goods/list/select">添加商品</router-link>
  20. </el-button>
  21. </div>
  22. <el-table
  23. v-loading="listLoading"
  24. :data="list"
  25. element-loading-text="Loading"
  26. border
  27. fit
  28. highlight-current-row
  29. style="width:100%;margin-top:20px;"
  30. >
  31. <el-table-column align="center" label="序号">
  32. <template slot-scope="scope">
  33. {{ scope.$index }}
  34. </template>
  35. </el-table-column>
  36. <el-table-column label="商品ID" align="center" prop="id" />
  37. <el-table-column label="商品图片" align="center" prop="mainImage">
  38. <template slot-scope="{row}">
  39. <img :src="row.mainImage" alt="" width="50">
  40. </template>
  41. </el-table-column>
  42. <el-table-column label="商品名称" align="center" prop="productName" />
  43. <el-table-column label="供应商名称" align="center" prop="shopName" />
  44. <el-table-column label="市场价" align="center" prop="normalPrice" />
  45. <el-table-column label="成本价" align="center" prop="costPrice" />
  46. <el-table-column label="售价" align="center" prop="retailPrice" />
  47. <el-table-column label="起订量" align="center" prop="minBuyNumber" />
  48. <el-table-column label="商品分类" align="center" prop="productClassifyName" />
  49. <el-table-column align="center" label="添加时间" prop="addTime">
  50. <template slot-scope="{row}">
  51. <i class="el-icon-time" />
  52. <span>{{ row.addTime }}</span>
  53. </template>
  54. </el-table-column>
  55. <el-table-column label="排序值" align="center" prop="sort">
  56. <template slot-scope="{row}">
  57. <el-input v-model="row.sort" style="width:60px;" size="small" />
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  61. <template slot-scope="{row}">
  62. <el-button :vid="row.id" type="primary" size="small">取消</el-button>
  63. </template>
  64. </el-table-column>
  65. </el-table>
  66. <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="fetchData" />
  67. </div>
  68. </template>
  69. <script>
  70. import { getList } from '@/api/goods'
  71. import Pagination from '@/components/Pagination'
  72. export default {
  73. components: { Pagination },
  74. filters: {
  75. statusFilter(status) {
  76. const statusMap = {
  77. 1: 'success',
  78. 0: 'gray'
  79. }
  80. return statusMap[status]
  81. }
  82. },
  83. data() {
  84. return {
  85. list: null,
  86. listLoading: true,
  87. total: 0,
  88. activeIndex: '2',
  89. listQuery: {
  90. page: 1,
  91. limit: 10,
  92. form: {
  93. id: '',
  94. mainImage: '',
  95. productName: '',
  96. shopName: '',
  97. normalPrice: '', // 市场价',
  98. costPrice: '', // 成本价',
  99. retailPrice: '', // '售价',
  100. minBuyNumber: '', // '最小起订量',
  101. preferredProduct: '', // 是否是优选商品:0不是优选,1优选商品',
  102. commonlyProduct: '', // 是否是常用商品:0不是常用,1常用商品',
  103. preferentialProduct: '', // 是否是星范精品:0不是精品,1星范精品商品',
  104. validFlag: '', // '商品状态,1已上架,2已下架',
  105. productClassifyName: '', // '对应cm_mall_products_classify商品分类表id',
  106. addTime: '', // '添加时间',
  107. organizeID: this.organizeID // '组织ID,具体对应cm_mall_organize表ID',
  108. }
  109. }
  110. }
  111. },
  112. created() {
  113. this.fetchData()
  114. },
  115. methods: {
  116. fetchData() {
  117. this.listLoading = true
  118. getList().then(response => {
  119. this.list = response.data.items
  120. this.listLoading = false
  121. }).catch(() => {
  122. // 封装静态数据
  123. this.list = [
  124. {
  125. id: 0,
  126. mainImage: 'https://img.caimei365.com/group1/M00/00/C3/Cmis21ogFTuATpnrAAIh4ixubXM38.JPEG',
  127. productName: '韩国恩盛进口 素提亚 BeautyHeart 电穿孔技术 打造V脸 紧致提升',
  128. shopName: '北京恩盛众成国际贸易有限公司',
  129. normalPrice: '10000.00',
  130. costPrice: '6666.00',
  131. retailPrice: '6600.00',
  132. minBuyNumber: '1',
  133. preferredProduct: '1',
  134. commonlyProduct: '1',
  135. preferentialProduct: '1',
  136. validFlag: '1',
  137. productClassifyName: 0,
  138. addTime: new Date(),
  139. organizeID: this.organizeID
  140. },
  141. {
  142. id: 0,
  143. mainImage: '',
  144. productName: 'hahaah',
  145. shopName: '',
  146. normalPrice: '',
  147. costPrice: '',
  148. retailPrice: '',
  149. minBuyNumber: '',
  150. preferredProduct: '',
  151. commonlyProduct: '',
  152. preferentialProduct: '',
  153. validFlag: '',
  154. productClassifyName: 0,
  155. addTime: '',
  156. organizeID: this.organizeID
  157. }
  158. ]
  159. })
  160. this.listLoading = false
  161. this.total = 2
  162. },
  163. handleFilter() {
  164. alert('搜索')
  165. },
  166. handleCreate() {
  167. alert('添加')
  168. }
  169. }
  170. }
  171. </script>
  172. <style scoped>
  173. </style>