index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <!-- 选品会员列表 -->
  2. <template>
  3. <div class="app-container">
  4. <!-- 查询和其他操作 -->
  5. <div class="filter-container">
  6. <el-input
  7. v-model="listQuery.shopName" clearable size="mini" class="filter-item"
  8. style="width: 200px;"
  9. placeholder="请输入选品会员名称"
  10. />
  11. <el-input
  12. v-model="listQuery.shopCode" clearable size="mini" class="filter-item"
  13. style="width: 200px;margin-left: 10px;" placeholder="请输入选品会员编码"
  14. />
  15. <el-input
  16. v-model="listQuery.chargePersonName" clearable size="mini" class="filter-item"
  17. style="width: 200px;margin-left: 10px;" placeholder="请输入负责人"
  18. />
  19. <el-select
  20. v-model="listQuery.contractState" clearable size="mini" class="filter-item"
  21. style="width: 200px;margin-left: 10px;" placeholder="请选择合同状态"
  22. >
  23. <el-option label="有效" :value="1" />
  24. <el-option label="无效" :value="0" />
  25. </el-select>
  26. <el-button
  27. size="mini" class="filter-item" type="primary" icon="el-icon-search"
  28. style="margin-left:10px;"
  29. @click="handleSearch"
  30. >
  31. 查找
  32. </el-button>
  33. <br />
  34. <el-button
  35. size="mini" type="primary" icon="el-icon-plus"
  36. @click="$refs.EditModal && $refs.EditModal.handleOpen({ shopId: '' })"
  37. >
  38. 新建商家
  39. </el-button>
  40. </div>
  41. <!-- 查询结果 -->
  42. <div v-tableHeight>
  43. <el-table
  44. v-loading="listLoading" height="100%" element-loading-text="正在查询中。。。" :data="list"
  45. v-bind="{ stripe: true, size: 'small', border: true, fit: true, highlightCurrentRow: true }"
  46. >
  47. <el-table-column label="选品会员名称" width="220">
  48. <template slot-scope="scope">{{ scope.row.shopName }}</template>
  49. </el-table-column>
  50. <el-table-column prop="shopCode" label="选品会员编码" />
  51. <el-table-column label="是否支持消费金">
  52. <template slot-scope="scope">
  53. <span v-if="scope.row.isBeeCoin === 1">支持</span>
  54. <span v-else-if="scope.row.isBeeCoin === 2">不支持</span>
  55. <span v-else>--</span>
  56. </template>
  57. </el-table-column>
  58. <!-- <el-table-column align="center" min-width="120" label="商家消费金提现比例" prop="beecoinRatio">
  59. <template slot-scope="{ row }">
  60. <span v-if="row.beeCoinRatio">{{ row.beeCoinRatio }}:1</span>
  61. <span v-else>--</span>
  62. </template>
  63. </el-table-column> -->
  64. <el-table-column prop="chargePersonName" label="负责人" />
  65. <el-table-column prop="chargePersonPhone" label="联系电话" />
  66. <el-table-column label="合同状态">
  67. <template slot-scope="scope">
  68. <span v-if="scope.row.contractState === 0">无效</span>
  69. <span v-if="scope.row.contractState === 1">有效</span>
  70. </template>
  71. </el-table-column>
  72. <el-table-column prop="createTime" label="创建时间" />
  73. <el-table-column align="center" label="操作" width="280" fixed="right" class-name="small-padding fixed-width">
  74. <template slot-scope="{ row }">
  75. <el-button type="warning" size="mini" @click="handleDetail(row)">
  76. 详情
  77. </el-button>
  78. <el-button size="mini" @click="handleEdit(row)">
  79. 编辑
  80. </el-button>
  81. <el-button v-if="row.state == 1" type="text" @click="handleDisabled(row)">
  82. 禁用
  83. </el-button>
  84. <el-button v-else type="text" @click="handleEnable(row)">
  85. 启用
  86. </el-button>
  87. <el-button type="danger" size="mini" @click="handleDelete(row)">
  88. 删除
  89. </el-button>
  90. </template>
  91. </el-table-column>
  92. </el-table>
  93. </div>
  94. <div>
  95. <el-pagination
  96. :current-page="listQuery.page" :page-sizes="[10, 20, 50, 100]" :page-size="listQuery.pageSize"
  97. layout="total, sizes, prev, pager, next, jumper" :total="total"
  98. @size-change="(val) => ((listQuery.pageSize = val) && getList())"
  99. @current-change="(val) => ((listQuery.page = val) && getList())"
  100. />
  101. </div>
  102. <!-- 新增编辑 -->
  103. <EditModal ref="EditModal" @success="getList" />
  104. <!-- 查看详情 -->
  105. <DetailModal ref="DetailModal" />
  106. </div>
  107. </template>
  108. <script>
  109. import EditModal from '../../business/businessList/components/EditModal'
  110. import DetailModal from '../../business/businessList/components/DetailModal'
  111. import {
  112. businessListGetAll,
  113. businessListStart,
  114. delBusinessById
  115. } from '@/api/business'
  116. export default {
  117. name: 'SelectionMemberList',
  118. components: {
  119. EditModal,
  120. DetailModal
  121. },
  122. data() {
  123. // 这里存放数据
  124. return {
  125. list: [],
  126. total: 0,
  127. listLoading: true,
  128. listQuery: {
  129. page: 1,
  130. pageSize: 20,
  131. shopName: '',
  132. shopCode: '',
  133. chargePersonName: '',
  134. contractState: '',
  135. shopType: 4
  136. }
  137. }
  138. },
  139. created() {
  140. this.getList()
  141. },
  142. methods: {
  143. async getList() {
  144. this.listLoading = true
  145. try {
  146. const res = await businessListGetAll(this.listQuery)
  147. this.list = res.data.list
  148. this.total = res.data.total
  149. } finally {
  150. this.listLoading = false
  151. }
  152. },
  153. handleSearch() {
  154. this.listQuery.page = 1
  155. this.getList()
  156. },
  157. handleDetail(row) {
  158. this.$refs.DetailModal && this.$refs.DetailModal.handleOpen(row)
  159. },
  160. handleEdit(row) {
  161. this.$refs.EditModal && this.$refs.EditModal.handleOpen(row)
  162. },
  163. handleDelete(row) {
  164. this.$confirm('确定删除此项?')
  165. .then(async () => {
  166. await delBusinessById({ shopId: row.shopId })
  167. this.$message({ message: '删除成功!', type: 'success' })
  168. this.handleSearch()
  169. })
  170. .catch(() => {})
  171. },
  172. handleDisabled(row) {
  173. this.$confirm('确定停用此项?')
  174. .then(async () => {
  175. await businessListStart({ shopName: row.shopName, state: 0, shopId: row.shopId })
  176. this.$message({ message: '停用成功!', type: 'success' })
  177. this.handleSearch()
  178. })
  179. .catch(() => {})
  180. },
  181. handleEnable(row) {
  182. this.$confirm('确定启用此项?')
  183. .then(async () => {
  184. await businessListStart({ shopName: row.shopName, state: 1, shopId: row.shopId })
  185. this.$message({ message: '启用成功!', type: 'success' })
  186. this.handleSearch()
  187. })
  188. .catch(() => {})
  189. }
  190. }
  191. }
  192. </script>
  193. <style lang="scss" scoped>
  194. .app-container {
  195. padding: 20px;
  196. display: flex;
  197. flex-direction: column;
  198. .filter-container {
  199. .filter-item {
  200. display: inline-block;
  201. vertical-align: middle;
  202. margin-bottom: 10px;
  203. }
  204. }
  205. .small-padding {
  206. .cell {
  207. padding-left: 5px;
  208. padding-right: 5px;
  209. }
  210. }
  211. .fixed-width {
  212. .el-button--mini {
  213. padding: 7px 10px;
  214. }
  215. }
  216. }
  217. </style>