entryActivities.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <div class='m-container'>
  3. <h2>
  4. <div class="squrt"></div>时间充值活动
  5. </h2>
  6. <div class="m-core">
  7. <div @click="onChargeOperation('create')"
  8. v-permission="'/entryOperation'"
  9. class='newBand'>添加</div>
  10. <save-form :inline="true"
  11. :model="searchForm"
  12. @submit="search">
  13. <!-- <el-form-item>
  14. <el-select placeholder="请选择适用范围">
  15. <el-option value="NEW" label="新用户"></el-option>
  16. <el-option value="ALL" label="所有用户"></el-option>
  17. </el-select>
  18. </el-form-item> -->
  19. <el-form-item>
  20. <el-select v-model="searchForm.delFlag"
  21. clearable
  22. placeholder="请选择活动状态">
  23. <el-option value="false"
  24. label="启用"></el-option>
  25. <el-option value="true"
  26. label="停止"></el-option>
  27. </el-select>
  28. </el-form-item>
  29. <el-form-item>
  30. <el-button type="danger" native-type="submit">搜索</el-button>
  31. </el-form-item>
  32. </save-form>
  33. <div class="tableWrap">
  34. <el-table :data="dataList"
  35. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  36. <el-table-column align="center"
  37. prop="id"
  38. label="活动编号">
  39. </el-table-column>
  40. <el-table-column align="center"
  41. prop="name"
  42. label="活动名称">
  43. </el-table-column>
  44. <el-table-column align="center"
  45. label="适用范围">
  46. <!-- NEW("NEW", "新手"), ALL("ALL", "全部"); -->
  47. <template slot-scope="scope">
  48. {{ scope.row.suitableUser == 'NEW' ? '新用户' : '' }}
  49. {{ scope.row.suitableUser == 'ALL' ? '全部' : '' }}
  50. </template>
  51. </el-table-column>
  52. <!-- <el-table-column align="center" prop="tag"
  53. label="活动类型">
  54. </el-table-column> -->
  55. <el-table-column align="center"
  56. label="有效期"
  57. width="225px">
  58. <template slot-scope="scope">
  59. 开始时间:{{ scope.row.startDate }} <br /> 结束时间:{{ scope.row.endDate }}
  60. </template>
  61. </el-table-column>
  62. <el-table-column align="center"
  63. label="价格/元">
  64. <template slot-scope="scope">
  65. 原价:{{ scope.row.totalPrice }}元 <br /> 折扣价:{{ scope.row.discountPrice ? scope.row.discountPrice : 0 }}元
  66. </template>
  67. </el-table-column>
  68. <el-table-column align="center"
  69. label="时间/分钟">
  70. <template slot-scope="scope">
  71. 购买:{{ scope.row.purchaseMinutes }}分钟 <br /> 赠送:{{ scope.row.giveMinutes ? scope.row.giveMinutes : 0 }}分钟
  72. </template>
  73. </el-table-column>
  74. <el-table-column align="center"
  75. label="活动状态">
  76. <template slot-scope="scope">
  77. {{ scope.row.delFlag ? '停用' : '启用' }}
  78. </template>
  79. </el-table-column>
  80. <el-table-column align="center"
  81. label="操作">
  82. <template slot-scope="scope">
  83. <el-button type="text"
  84. v-permission="'/entryOperationLook'"
  85. @click="onChargeOperation('look', scope.row)">查看</el-button>
  86. <el-button v-permission="'tenantEntryActivities/updateDelFlag'"
  87. @click="onChargeOperation('update', scope.row)"
  88. type="text">{{ scope.row.delFlag ? '启用' : '停用' }}</el-button>
  89. </template>
  90. </el-table-column>
  91. </el-table>
  92. <pagination sync :total.sync="pageInfo.total"
  93. :page.sync="pageInfo.page"
  94. :limit.sync="pageInfo.limit"
  95. :page-sizes="pageInfo.page_size"
  96. @pagination="getList" />
  97. </div>
  98. </div>
  99. </div>
  100. </template>
  101. <script>
  102. import pagination from '@/components/Pagination/index'
  103. import { getEntryActivities, getActivitieUpdateDelFlag } from '@/api/appTenant'
  104. export default {
  105. components: { pagination },
  106. name: 'chargesList',
  107. data () {
  108. return {
  109. id: null,
  110. dataList: [],
  111. searchForm: {
  112. delFlag: null
  113. },
  114. pageInfo: {
  115. // 分页规则
  116. limit: 10, // 限制显示条数
  117. page: 1, // 当前页
  118. total: 0, // 总条数
  119. page_size: [10, 20, 40, 50] // 选择限制显示条数
  120. }
  121. }
  122. },
  123. activated () {
  124. this.getList()
  125. },
  126. mounted () {
  127. this.getList()
  128. },
  129. methods: {
  130. search() {
  131. this.pageInfo.page = 1
  132. this.getList()
  133. },
  134. messageTips (title, res) {
  135. if (res.code == 200) {
  136. this.$message.success(title + '成功')
  137. this.chargeStatus = false
  138. this.getList()
  139. } else {
  140. this.$message.error(res.msg)
  141. }
  142. },
  143. onChargeOperation (type, row) {
  144. if (type == 'update') {
  145. let tempString = row.delFlag ? '启用' : '停用'
  146. this.$confirm(`是否${tempString}该活动?`, '提示', {
  147. confirmButtonText: '确定',
  148. cancelButtonText: '取消',
  149. type: 'warning'
  150. }).then(() => {
  151. getActivitieUpdateDelFlag({ delFlag: !row.delFlag, id: row.id }).then(res => {
  152. this.messageTips(tempString, res)
  153. })
  154. }).catch(() => {
  155. })
  156. } else if (type == 'create') {
  157. this.$router.push({
  158. path: '/insideSetting/entryOperation',
  159. query: {
  160. type: 'create'
  161. }
  162. }, (route) => {
  163. route.meta.title = '添加活动充值活动'
  164. })
  165. } else if (type == 'look') {
  166. this.$router.push({
  167. path: '/insideSetting/entryOperation',
  168. query: {
  169. id: row.id,
  170. type: 'look'
  171. }
  172. }, (route) => {
  173. route.meta.title = '查看活动充值活动'
  174. })
  175. }
  176. },
  177. getList () {
  178. let params = {
  179. delFlag: this.searchForm.delFlag ? this.searchForm.delFlag : null,
  180. rows: this.pageInfo.limit,
  181. page: this.pageInfo.page
  182. }
  183. getEntryActivities(params).then(res => {
  184. if (res.code == 200) {
  185. this.dataList = res.data.rows
  186. this.pageInfo.total = res.data.total
  187. }
  188. })
  189. },
  190. }
  191. }
  192. </script>
  193. <style lang="scss" scoped>
  194. /deep/.el-button--primary {
  195. background: #14928a;
  196. border-color: #14928a;
  197. color: #fff;
  198. &:hover,
  199. &:active,
  200. &:focus {
  201. background: #14928a;
  202. border-color: #14928a;
  203. color: #fff;
  204. }
  205. }
  206. /deep/.el-date-editor.el-input {
  207. width: 100% !important;
  208. }
  209. /deep/.el-select {
  210. width: 98% !important;
  211. }
  212. /deep/.el-table {
  213. display: inline-block;
  214. }
  215. </style>