index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <div class="miaoshaPage">
  3. <!-- 搜索 -->
  4. <div class="formSearch">
  5. <!-- 搜索条件 -->
  6. <el-form :inline="true" :model="query" class="demo-form-inline">
  7. <el-form-item label="活动名称">
  8. <el-input v-model="query.currencyName" maxlength="20" placeholder="请输入活动名称" />
  9. </el-form-item>
  10. <el-form-item label="活动状态">
  11. <el-select v-model="query.state" placeholder="请选择活动状态">
  12. <el-option v-for="item in activityStatusSelect" :key="item.index" :label="item.label" :value="item.value" />
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item>
  16. <el-button type="primary" plain @click="search">查询</el-button>
  17. <el-button plain @click="clear">重置</el-button>
  18. <el-button type="primary" plain @click="addActivity">新建活动</el-button>
  19. </el-form-item>
  20. </el-form>
  21. </div>
  22. <!-- 表格 -->
  23. <div class="tableBox">
  24. <el-table
  25. ref="multipleTable" :data="tableData" border
  26. :header-cell-style="{ background: '#EEF3FF', color: '#333333' }" tooltip-effect="dark" style="width: 100%"
  27. >
  28. <el-table-column prop="currencyName" label="活动名称" width="220" />
  29. <el-table-column prop="content" label="活动内容" align="center" />
  30. <el-table-column prop="shops" label="参与商家数" align="center" />
  31. <el-table-column prop="products" label="商品数量" align="center" />
  32. <el-table-column label="报名时间" align="center" prop="signTime">
  33. </el-table-column>
  34. <el-table-column label="活动起止时间" align="center" prop="time">
  35. </el-table-column>
  36. <el-table-column label="活动状态" align="center">
  37. <template slot-scope="scope">
  38. <span v-if="scope.row.state == 0">报名未开始</span>
  39. <span v-if="scope.row.state == 1">报名进行中</span>
  40. <span v-if="scope.row.state == 2">活动待开始</span>
  41. <span v-if="scope.row.state == 3">活动进行中</span>
  42. <span v-if="scope.row.state == 4">活动已结束</span>
  43. </template>
  44. </el-table-column>
  45. <!-- <el-table-column prop="createTime" label="创建时间" width="220" /> -->
  46. <el-table-column label="操作" align="center" show-overflow-tooltip>
  47. <template slot-scope="scope">
  48. <div class="btnList">
  49. <el-button type="text" @click="details(scope.row)">详情</el-button>
  50. <el-button v-if="scope.row.state != 4" type="text" @click="editActivity(scope.row)">编辑</el-button>
  51. <el-button v-if="scope.row.state != 4" type="text" @click="endActivity(scope.row)">结束</el-button>
  52. <el-button v-if="scope.row.state == 4" type="text" @click="delActivity(scope.row)">删除</el-button>
  53. </div>
  54. </template>
  55. </el-table-column>
  56. </el-table>
  57. <div class="fenye">
  58. <el-pagination
  59. :current-page="query.page" :page-sizes="[10, 20, 50, 100]" :page-size="10"
  60. layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="handleSizeChange"
  61. @current-change="handleCurrentChange"
  62. />
  63. </div>
  64. </div>
  65. <el-dialog
  66. :title="editForm ? '修改限时秒杀活动' : '新增限时秒杀活动'" :visible.sync="activityVisible" width="50%" center
  67. :close-on-click-modal="false"
  68. >
  69. <AddActive
  70. :activity-form="activityForm" :is-edit="editForm" @cancel="activityVisible = false"
  71. @refersh="refersh('activityVisible')"
  72. />
  73. </el-dialog>
  74. <el-dialog
  75. title="秒杀活动详情" :visible.sync="activityDetailVisible" width="74%" center
  76. :close-on-click-modal="false"
  77. @close="cleanForm('activityDetailVisible')"
  78. >
  79. <ActivityDetail :bee-data="activityForm" :activclean="activityDetailVisible" />
  80. </el-dialog>
  81. </div>
  82. </template>
  83. <script>
  84. import AddActive from '@/views/active/beeCoin/component/AddActive.vue'
  85. import ActivityDetail from '@/views/active/beeCoin/component/ActivityDetail.vue'
  86. // import {
  87. // getSeckillData,
  88. // endSeckillData,
  89. // delSeckillData
  90. // } from '@/api/active/active_seckill.js'
  91. import { getBeeList, stopBee, beeDelete } from '@/api/active/active_bee.js'
  92. export default {
  93. components: {
  94. AddActive,
  95. ActivityDetail
  96. },
  97. data() {
  98. return {
  99. query: {
  100. currencyName: '', // 活动名称
  101. // 活动状态 0-报名未开始 1-报名进行中 2-活动待开始 3-活动进行中 4-活动已结束
  102. state: '',
  103. page: 1,
  104. pageSize: 10
  105. },
  106. total: 1,
  107. tableData: [],
  108. activityStatusSelect: [
  109. {
  110. index: 0,
  111. label: '报名未开始',
  112. value: 0
  113. },
  114. {
  115. index: 1,
  116. label: '报名进行中',
  117. value: 1
  118. },
  119. {
  120. index: 2,
  121. label: '活动待开始',
  122. value: 2
  123. },
  124. {
  125. index: 3,
  126. label: '活动进行中',
  127. value: 3
  128. },
  129. {
  130. index: 4,
  131. label: '活动已结束',
  132. value: 4
  133. }
  134. ],
  135. activityVisible: false,
  136. editForm: 0,
  137. activityDetailVisible: false,
  138. activityForm: {
  139. seckillId: 0
  140. }
  141. }
  142. },
  143. created() {
  144. this.getAll()
  145. },
  146. methods: {
  147. async getAll() {
  148. const res = await getBeeList(this.query)
  149. this.tableData = res.data.list
  150. this.total = res.data.total
  151. },
  152. handleSizeChange(val) {
  153. this.query.pageSize = val
  154. this.getAll()
  155. },
  156. handleCurrentChange(val) {
  157. this.query.page = val
  158. this.getAll()
  159. },
  160. search() {
  161. this.total = 1
  162. this.query.page = 1
  163. this.getAll()
  164. },
  165. clear() {
  166. this.query = {
  167. currencyName: '', // 活动名称
  168. // 活动状态 0-报名未开始 1-报名进行中 2-活动待开始 3-活动进行中 4-活动已结束
  169. state: '',
  170. page: 1,
  171. pageSize: 10
  172. }
  173. },
  174. details(row) {
  175. this.activityForm = row
  176. this.activityDetailVisible = true
  177. },
  178. // 添加活动
  179. addActivity() {
  180. this.editForm = 0
  181. this.activityVisible = true
  182. },
  183. // 编辑活动
  184. editActivity(row) {
  185. this.editForm = 1
  186. this.activityForm = row
  187. this.activityVisible = true
  188. },
  189. async endActivity(row) {
  190. const res = await stopBee({ currencyId: row.currencyId })
  191. if (res.code === '') {
  192. this.$message({
  193. message: '结束成功',
  194. type: 'success'
  195. })
  196. this.getAll()
  197. }
  198. },
  199. async delActivity(row) {
  200. const res = await beeDelete(row.currencyId)
  201. if (res.code === '') {
  202. this.$message({
  203. message: '删除成功',
  204. type: 'success'
  205. })
  206. this.getAll()
  207. }
  208. },
  209. cleanForm(attr) {
  210. this[attr] = false
  211. // console.log(attr);
  212. },
  213. refersh(attr) {
  214. this[attr] = false
  215. this.getAll()
  216. this.$confirm('需到【分佣配置】—【等级分佣】进行配置活动分佣规则', '配置分佣', {
  217. confirmButtonText: '去配置',
  218. cancelButtonText: '取消'
  219. })
  220. .then(() => {
  221. this.$router.push({
  222. path: '/commissionAllocation/gradeCommission'
  223. })
  224. })
  225. .catch(() => {})
  226. }
  227. }
  228. }
  229. </script>
  230. <style lang="scss" scoped>
  231. .miaoshaPage {
  232. padding: 30px;
  233. .tableBox {
  234. .fenye {
  235. margin: 20px;
  236. }
  237. }
  238. }
  239. </style>