index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <div class="Sell">
  3. <page-header-wrapper
  4. :title="false"
  5. content="用于配置销售目录"
  6. :tab-list="tabList"
  7. :tab-active-key="tabActiveKey"
  8. @tabChange="handleTabChange"
  9. >
  10. <a-card
  11. :body-style="{padding: '24px 32px'}"
  12. :bordered="false"
  13. title="明细"
  14. >
  15. <template slot="extra">
  16. <a-button type="primary" @click="visible = true">新增{{ modalText }}</a-button>
  17. </template>
  18. <a-table
  19. row-key="index"
  20. size="small"
  21. :columns="searchTableColumns"
  22. :dataSource="searchData"
  23. :pagination="{ pageSize: 5 }"
  24. >
  25. <span slot="range" slot-scope="text, record">
  26. <trend :flag="record.status === 0 ? 'up' : 'down'">
  27. {{ text }}%
  28. </trend>
  29. </span>
  30. <template slot="action" >
  31. <a>编辑</a>
  32. <a-divider type="vertical" />
  33. <a-popconfirm
  34. title="你确定要删除这个标签吗?"
  35. ok-text="Yes"
  36. cancel-text="No"
  37. @confirm="() => {}"
  38. @cancel="() => {}"
  39. >
  40. <a>删除</a>
  41. </a-popconfirm>
  42. </template>
  43. </a-table>
  44. <!-- <a-row> -->
  45. <!-- <a-col :xs="24" :sm="24" :md="12" :lg="8" > -->
  46. <!-- <div class="cate-item" v-for="(item, index) in cateList" :key="index">
  47. <div><span class="sort">{{ index + 1 }}</span> <span></span> {{ item.label }}</div>
  48. <div class="opration"><a-icon type="form" /> <a-icon type="delete" /></div>
  49. </div> -->
  50. <!-- </a-col> -->
  51. <!-- </a-row> -->
  52. </a-card>
  53. </page-header-wrapper>
  54. <!-- 新建各种类目 -->
  55. <a-modal
  56. :title="'新增' + modalText"
  57. v-model="visible"
  58. :confirm-loading="confirmLoading"
  59. ok-text="确认"
  60. cancel-text="取消"
  61. @ok="handleOk"
  62. >
  63. <a-input v-model="cateValue" :placeholder="'请输入' + modalText" />
  64. </a-modal>
  65. </div>
  66. </template>
  67. <script>
  68. import { getConfig } from '@/api/basics'
  69. const searchTableColumns = [
  70. {
  71. dataIndex: 'index',
  72. title: '序号',
  73. width: 90
  74. },
  75. {
  76. dataIndex: 'keyword',
  77. title: '类目名'
  78. },
  79. {
  80. title: '操作',
  81. key: 'action',
  82. scopedSlots: { customRender: 'action' }
  83. }
  84. ]
  85. const searchData = []
  86. for (let i = 0; i < 50; i += 1) {
  87. searchData.push({
  88. index: i + 1,
  89. keyword: `搜索关键词-${i}`,
  90. count: Math.floor(Math.random() * 1000),
  91. range: Math.floor(Math.random() * 100),
  92. status: Math.floor((Math.random() * 10) % 2)
  93. })
  94. }
  95. export default {
  96. name: 'Sell',
  97. computed: {
  98. modalText () {
  99. return this.tabList[this.tabActiveKey].tab
  100. }
  101. },
  102. created () {
  103. this.getConfig()
  104. },
  105. data () {
  106. return {
  107. searchTableColumns,
  108. searchData,
  109. tabList: [
  110. { key: '0', tab: '意向度' },
  111. { key: '1', tab: '来源渠道' },
  112. { key: '2', tab: '意向课程' },
  113. { key: '3', tab: '年级' },
  114. { key: '4', tab: '流失原因' }
  115. ],
  116. tabActiveKey: '0',
  117. visible: false,
  118. confirmLoading: false,
  119. cateValue: '', // 各种类目的名称
  120. cateList: [
  121. {
  122. label: '客户不满意'
  123. }
  124. ], // 类目集合
  125. queryParams: {
  126. curPage: 1,
  127. type: 'INTENTION'
  128. }
  129. }
  130. },
  131. methods: {
  132. // 获取销售配置
  133. async getConfig () {
  134. console.log('helorenwenhao')
  135. const { curPage, type } = this.queryParams
  136. const $par = {
  137. curPage,
  138. type
  139. }
  140. const { code, data } = await getConfig($par)
  141. if (code === 0) {
  142. console.log(data)
  143. }
  144. },
  145. handleTabChange (key) {
  146. this.tabActiveKey = key
  147. },
  148. handleOk (e) {
  149. this.ModalText = 'The modal will be closed after two seconds'
  150. this.confirmLoading = true
  151. setTimeout(() => {
  152. this.visible = false
  153. this.confirmLoading = false
  154. }, 2000)
  155. }
  156. }
  157. }
  158. </script>
  159. <style scoped lang="less">
  160. .sort {
  161. background-color: #f5f5f5;
  162. border-radius: 20px;
  163. display: inline-block;
  164. font-size: 12px;
  165. font-weight: 600;
  166. margin-right: 24px;
  167. height: 20px;
  168. line-height: 20px;
  169. width: 20px;
  170. text-align: center;
  171. }
  172. .cate-item {
  173. height: 40px;
  174. border: 1px solid #f3f3f3;
  175. display: flex;
  176. justify-content: space-between;
  177. align-items: center;
  178. }
  179. </style>