index.vue 9.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <template>
  2. <div class="subPage">
  3. <div class="system-table-search">
  4. <div class="flex-h">
  5. <div class="flex-item flex-h">
  6. <el-button size="mini" type="success" @click="addCoupon('drink')">新增饮品优惠券</el-button>
  7. <el-button size="mini" type="success" @click="addCoupon('course')">新增课程优惠券</el-button>
  8. </div>
  9. <ul>
  10. <li>
  11. <!-- <span>选择案场:</span> -->
  12. <el-select v-model="CaseId" placeholder="请选择案场">
  13. <el-option
  14. v-for="item in cases"
  15. :key="item.CaseId"
  16. :label="item.CaseName"
  17. :value="item.CaseId">
  18. </el-option>
  19. </el-select>
  20. </li>
  21. </ul>
  22. <el-button
  23. size="mini"
  24. type="primary" @click="search">搜索</el-button>
  25. </div>
  26. <div class="moreFilter"></div>
  27. </div>
  28. <div class="system-table-box">
  29. <el-table
  30. :data="currentList"
  31. stripe
  32. style="width: 100%">
  33. <el-table-column
  34. prop="xxx"
  35. label="券名称">
  36. </el-table-column>
  37. <el-table-column
  38. prop="xxx"
  39. label="券类型">
  40. </el-table-column>
  41. <el-table-column
  42. prop="xxx"
  43. label="券价格">
  44. </el-table-column>
  45. <el-table-column
  46. prop="xxx"
  47. label="有效期">
  48. </el-table-column>
  49. <el-table-column
  50. prop="xxx"
  51. label="发放类型">
  52. </el-table-column>
  53. <el-table-column
  54. prop="xxx"
  55. label="总数量">
  56. </el-table-column>
  57. <el-table-column
  58. prop="xxx"
  59. label="已发">
  60. </el-table-column>
  61. <el-table-column
  62. prop="xxx"
  63. label="实际使用">
  64. </el-table-column>
  65. <el-table-column
  66. prop="xxx"
  67. label="状态">
  68. </el-table-column>
  69. <el-table-column label="操作" fixed='right' width="350">
  70. <template slot-scope="scope">
  71. <el-button
  72. size="mini"
  73. type="warning"
  74. @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
  75. <el-button
  76. size="mini"
  77. type="danger"
  78. @click="sendCoupon(scope.$index, scope.row)">赠送客户</el-button>
  79. <el-button
  80. size="mini"
  81. type="success"
  82. @click="handleDelete(scope.$index, scope.row)">点击复制链接</el-button>
  83. </template>
  84. </el-table-column>
  85. </el-table>
  86. </div>
  87. <el-pagination
  88. @current-change="handleCurrentChange"
  89. :current-page.sync="postData.page"
  90. :page-size="postData.pagesize"
  91. layout="prev, pager, next, jumper"
  92. :total="total">
  93. </el-pagination>
  94. <el-dialog
  95. title="选择赠送客户"
  96. :visible.sync="centerDialogVisible"
  97. width="800px"
  98. center>
  99. <div>
  100. <ul class="dialogSearchList flex-h" style="margin-bottom:10px;">
  101. <li class="flex-item">
  102. <el-input
  103. placeholder="请输入用户名"
  104. v-model="dialogPostData.username"
  105. clearable>
  106. </el-input>
  107. </li>
  108. <li class="flex-item">
  109. <el-input
  110. placeholder="请输入手机号"
  111. v-model="dialogPostData.phone"
  112. clearable>
  113. </el-input>
  114. </li>
  115. <li class="flex-item">
  116. <el-input
  117. placeholder="请输入推荐人"
  118. v-model="dialogPostData.referrer"
  119. clearable>
  120. </el-input>
  121. </li>
  122. <li>
  123. <el-button type="primary" @click="dialogSearch">搜索</el-button>
  124. </li>
  125. </ul>
  126. <ul class="dialogSearchList flex-h">
  127. <li class="flex-item">
  128. <el-date-picker
  129. v-model="dialogPostData.startdate"
  130. type="date"
  131. placeholder="选择起始日期">
  132. </el-date-picker>
  133. <el-date-picker
  134. v-model="dialogPostData.enddate"
  135. type="date"
  136. placeholder="选择截止日期">
  137. </el-date-picker>
  138. </li>
  139. </ul>
  140. </div>
  141. <div>
  142. <el-table
  143. ref="multipleTable"
  144. :data="customerList"
  145. tooltip-effect="dark"
  146. style="width: 100%"
  147. @selection-change="handleSelectionChange">
  148. <el-table-column
  149. type="selection">
  150. </el-table-column>
  151. <el-table-column
  152. prop="Name"
  153. label="姓名">
  154. </el-table-column>
  155. <el-table-column
  156. prop="NickName"
  157. label="微信昵称">
  158. </el-table-column>
  159. <el-table-column
  160. prop="Phone"
  161. label="手机号">
  162. </el-table-column>
  163. <el-table-column
  164. prop="CreatDate"
  165. label="创建时间">
  166. </el-table-column>
  167. <el-table-column
  168. prop="Referrer"
  169. label="推荐人">
  170. </el-table-column>
  171. </el-table>
  172. </div>
  173. <div>
  174. <el-pagination
  175. @current-change="handleCurrentChangeDialog"
  176. :current-page.sync="dialogPostData.page"
  177. :page-size="dialogPostData.pagesize"
  178. layout="prev, pager, next, jumper"
  179. :total="dialogTotal">
  180. </el-pagination>
  181. </div>
  182. <span slot="footer" class="dialog-footer">
  183. <el-button @click="centerDialogVisible = false">取 消</el-button>
  184. <el-button type="primary" @click="centerDialogVisible = false">确 定</el-button>
  185. </span>
  186. </el-dialog>
  187. </div>
  188. </template>
  189. <script>
  190. import { mapState } from 'vuex'
  191. export default {
  192. name: '',
  193. data () {
  194. return {
  195. dialogTotal: 0,
  196. dialogPostData: {
  197. caseid: '', // 案场id
  198. page: 1, // 当前页码
  199. pagesize: 10, // 请求数据量
  200. },
  201. customerList: [],
  202. centerDialogVisible: false,
  203. total: 0,
  204. postData: { // 表格搜索条件
  205. caseid: '', // 案场id
  206. page: 1, // 当前页码
  207. pagesize: 10, // 请求数据量
  208. },
  209. currentList: [{
  210. xxx: 'xxx'
  211. }]
  212. }
  213. },
  214. mounted () {
  215. this.$nextTick(function () {
  216. this.getList()
  217. })
  218. },
  219. computed: {
  220. ...mapState({
  221. cases: x => x.app.cases.list,
  222. defaultCaseId: x => x.app.cases.default
  223. }),
  224. CaseId: {
  225. get () {
  226. return this.postData.caseid || this.defaultCaseId
  227. },
  228. set (val) {
  229. this.postData.caseid = val
  230. }
  231. }
  232. },
  233. methods: {
  234. dialogSearch () { // 赠送客户搜索
  235. // 1
  236. },
  237. handleCurrentChangeDialog (val) {
  238. // 1
  239. },
  240. handleSelectionChange (val) {
  241. // 1
  242. },
  243. sendCoupon (index, row) { // 赠送优惠券
  244. this.centerDialogVisible = true
  245. },
  246. search () { // 搜索
  247. this.postData.page = 1
  248. this.currentList = []
  249. this.getList()
  250. },
  251. getList () { // 获取列表
  252. this.$ajax(this.$api.channelManager.getChannelList.url, {
  253. method: this.$api.channelManager.getChannelList.method,
  254. queryData: { ...this.postData, caseid: this.CaseId }
  255. }).then(res => {
  256. this.currentList = res.list
  257. this.postData.page = res.page
  258. this.total = res.pagenum
  259. })
  260. },
  261. handleCurrentChange (val) { // 跳转到分页
  262. this.getList()
  263. },
  264. handleEdit (index, row) { // 编辑
  265. this.$router.push({ name: 'editChannel', query: { id: row.ChannelId } })
  266. },
  267. handleDelete (index, row) { // 删除
  268. let name = '确认删除渠道“' + row.ChannelName + '”?'
  269. this.$confirm(name, '提示', {
  270. confirmButtonText: '确定',
  271. cancelButtonText: '取消',
  272. type: 'warning'
  273. }).then(() => {
  274. this.$ajax(this.$api.channelManager.deleteChannel.url, {
  275. method: this.$api.channelManager.deleteChannel.method,
  276. urlData: { channelId: row.ChannelId }
  277. }).then(res => {
  278. this.$message({
  279. type: 'success',
  280. message: '删除成功!'
  281. })
  282. this.search()
  283. })
  284. }).catch(() => {
  285. this.$message({
  286. type: 'info',
  287. message: '已取消删除'
  288. })
  289. })
  290. },
  291. addCoupon (val) {
  292. this.$router.push({ name: 'editCoupon', query: { type: val } })
  293. }
  294. }
  295. }
  296. </script>
  297. <!-- Add "scoped" attribute to limit CSS to this component only -->
  298. <style lang="scss" scoped>
  299. @import "page.scss";
  300. .dialogSearchList {
  301. align-items: center;
  302. > li {
  303. font-size: 0;
  304. margin-left: 10px;
  305. &:first-child {
  306. margin-left: 0;
  307. }
  308. > *:nth-child(2) {
  309. margin-left: 10px;
  310. }
  311. }
  312. }
  313. </style>