couponList.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <el-tabs v-model="activeName" @tab-click="handleClick">
  3. <el-tab-pane label="优惠券列表" name="seventh">
  4. <div style="position: relative;display: inline-block;margin: 10px 0px;">
  5. <span>状态:</span>
  6. <el-select v-model="state" style="width:150px;margin-left: 10px;" @change="animeDat(state)">
  7. <el-option v-for="item in typeList" :key="item.value" :label="item.label" :value="item.value"></el-option>
  8. </el-select>&nbsp;&nbsp;&nbsp;
  9. </div>
  10. <div style="position: relative;display: inline-block;margin: 10px 0px;">
  11. <span>手机号:</span>
  12. <el-input style="width: 200px;" @keydown.enter.native="animeDat" placeholder="请输入手机号"
  13. v-model="phone">
  14. </el-input>&nbsp;&nbsp;
  15. </div>
  16. <div style="position: relative;display: inline-block;margin: 10px 0px;">
  17. <span>商户名称:</span>
  18. <el-input style="width: 200px;" @keydown.enter.native="animeDat" placeholder="请输入商户名称"
  19. v-model="shopName">
  20. </el-input>&nbsp;&nbsp;
  21. </div>
  22. <div style="position: relative;display: inline-block;margin: 10px 0px;">
  23. <span>是否平台券:</span>
  24. <el-select v-model="isTicket" style="width:150px;margin-left: 10px;" @change="animeDat(isTicket)">
  25. <el-option label="全部" :value="0"></el-option>
  26. <el-option label="是" :value="1"></el-option>
  27. <el-option label="否" :value="2"></el-option>
  28. </el-select>&nbsp;&nbsp;&nbsp;
  29. </div>
  30. <div style="position: relative;display: inline-block;margin-right:2%;">
  31. <el-button style="margin-left:15px;" size="mini" type="primary" icon="document" @click="animeDat">查询
  32. </el-button>
  33. <el-button style="margin-left:15px;" size="mini" type="primary" icon="document" @click="cleans">重置
  34. </el-button>
  35. </div>
  36. <el-table v-loading="tableDataLoading" :data="tableData.list">
  37. <el-table-column fixed prop="id" label="编号" width="80">
  38. </el-table-column>
  39. <el-table-column fixed prop="nickName" label="昵称" width="150">
  40. <template slot-scope="scope">
  41. <span style="color: #f56c6c;cursor: pointer;" @click="updataDetails(scope.row)">{{scope.row.nickName ? scope.row.nickName : '未绑定'}}</span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column label="图像">
  45. <template slot-scope="scope">
  46. <img v-if="scope.row.avatar==null" src="~@/assets/img/avatar.png" alt="" width="40" height="40">
  47. <img v-else :src="scope.row.avatar" alt="" width="40" height="40">
  48. </template>
  49. </el-table-column>
  50. <el-table-column prop="phone" label="手机号">
  51. </el-table-column>
  52. <el-table-column prop="shopName" label="商户名称">
  53. <template slot-scope="scope">
  54. <span v-if="scope.row.shopId==0">平台优惠券</span>
  55. <span v-else>{{scope.row.shopName}}</span>
  56. </template>
  57. </el-table-column>
  58. <el-table-column prop="couponName" label="优惠券名称">
  59. </el-table-column>
  60. <el-table-column prop="couponPicture" label="图片">
  61. <template slot-scope="scope">
  62. <img :src="scope.row.couponPicture" alt="" width="40" height="40">
  63. </template>
  64. </el-table-column>
  65. <el-table-column prop="money" label="优惠券金额">
  66. </el-table-column>
  67. <el-table-column prop="minMoney" label="最低消费">
  68. </el-table-column>
  69. <!-- <el-table-column prop="needIntegral" label="兑换积分">
  70. </el-table-column> -->
  71. <el-table-column prop="createTime" label="领取时间">
  72. </el-table-column>
  73. <el-table-column prop="expirationTime" label="过期时间">
  74. </el-table-column>
  75. <el-table-column prop="expirationTime" label="状态">
  76. <template slot-scope="scope">
  77. <span v-if="scope.row.status==0">待使用</span>
  78. <span v-else-if="scope.row.status==1">已使用</span>
  79. <span v-else-if="scope.row.status==2">已失效</span>
  80. </template>
  81. </el-table-column>
  82. </el-table>
  83. <div style="text-align: center;margin-top: 10px;">
  84. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
  85. :page-sizes="[10, 20, 30,50,100]" :page-size="limit" :current-page="page" layout="total,sizes, prev, pager, next"
  86. :total="tableData.totalCount">
  87. </el-pagination>
  88. </div>
  89. </el-tab-pane>
  90. </el-tabs>
  91. </template>
  92. <script>
  93. export default {
  94. data() {
  95. return {
  96. limit: 10,
  97. page: 1,
  98. state: '',
  99. isTicket: 0,
  100. url: '',
  101. title: '',
  102. type: '',
  103. id: '',
  104. types: [{
  105. value: 'word',
  106. label: '文字'
  107. },
  108. {
  109. value: 'url',
  110. label: '链接'
  111. }
  112. ],
  113. phone: '',
  114. content: '',
  115. activeName: 'seventh',
  116. tableDataLoading: false,
  117. dialogFormVisible1: false,
  118. dialogFormVisible2: false,
  119. dialogFormVisible: false,
  120. tableData: [],
  121. typeList:[
  122. {
  123. value:'',
  124. label:'全部'
  125. },
  126. {
  127. value:0,
  128. label:'待使用'
  129. },
  130. {
  131. value:1,
  132. label:'已使用'
  133. },
  134. {
  135. value:2,
  136. label:'已失效'
  137. }
  138. ],
  139. phone:'',
  140. shopName:'',
  141. }
  142. },
  143. methods: {
  144. // 详情跳转
  145. updataDetails(row) {
  146. this.$router.push({
  147. path: '/userDetail',
  148. query: {
  149. userId: row.userId
  150. }
  151. });
  152. },
  153. handleSizeChange(val) {
  154. this.limit = val;
  155. this.dataSelect()
  156. },
  157. handleCurrentChange(val) {
  158. this.page = val;
  159. this.dataSelect()
  160. },
  161. handleClick(tab, event) {
  162. if (tab._props.label == '优惠券列表') {
  163. this.page = 1
  164. this.limit = 10
  165. this.dataSelect()
  166. }
  167. },
  168. // 获取数据列表
  169. dataSelect() {
  170. this.tableDataLoading = true
  171. this.$http({
  172. url: this.$http.adornUrl('admin/dataCentre/selectCouponByUserId'),
  173. method: 'get',
  174. params: this.$http.adornParams({
  175. 'page':this.page,
  176. 'limit':this.limit,
  177. 'userId':'',
  178. 'status':this.state,
  179. 'phone':this.phone,
  180. 'shopFlag':this.isTicket,
  181. 'shopName':this.shopName
  182. })
  183. }).then(({
  184. data
  185. }) => {
  186. this.tableDataLoading = false
  187. let returnData = data.data;
  188. this.tableData = returnData
  189. })
  190. },
  191. animeDat(){
  192. this.page = 1
  193. this.dataSelect()
  194. },
  195. cleans(){
  196. this.page = 1
  197. this.phone = ''
  198. this.state = ''
  199. this.isTicket=0
  200. this.shopName = ''
  201. this.dataSelect()
  202. }
  203. },
  204. mounted() {
  205. this.dataSelect()
  206. }
  207. };
  208. </script>
  209. <style>
  210. </style>