index.vue 8.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <template>
  2. <div class="subPage">
  3. <div class="system-table-search">
  4. <div class="flex-h">
  5. <ul class="searchFilterLine" style="white-space: normal;">
  6. <li>
  7. <el-select v-model="postData.caseid" placeholder="请选择案场">
  8. <el-option
  9. v-for="item in cases"
  10. :key="item.CaseId"
  11. :label="item.CaseName"
  12. :value="item.CaseId">
  13. </el-option>
  14. </el-select>
  15. </li>
  16. <li>
  17. <el-select v-model="postData.receivetype" placeholder="请选择获取方式">
  18. <el-option
  19. v-for="item in typeList"
  20. :key="item.id"
  21. :label="item.value"
  22. :value="item.id">
  23. </el-option>
  24. </el-select>
  25. </li>
  26. <li>
  27. <el-select v-model="postData.status" placeholder="请选择状态">
  28. <el-option
  29. v-for="item in statusList"
  30. :key="item.id"
  31. :label="item.value"
  32. :value="item.id">
  33. </el-option>
  34. </el-select>
  35. </li>
  36. <li>
  37. <el-input
  38. placeholder="请输入卡券名称"
  39. v-model="postData.name"
  40. clearable>
  41. </el-input>
  42. </li>
  43. <li>
  44. <el-input
  45. placeholder="请输入手机号"
  46. v-model="postData.tel"
  47. clearable>
  48. </el-input>
  49. </li>
  50. <li style="white-space: nowrap;">
  51. <span>有效期:</span>
  52. <el-date-picker
  53. value-format="yyyy-MM-dd"
  54. v-model="postData.begindate"
  55. type="date"
  56. placeholder="选择起始日期">
  57. </el-date-picker>
  58. <span>至</span>
  59. <el-date-picker
  60. value-format="yyyy-MM-dd"
  61. v-model="postData.enddate"
  62. type="date"
  63. placeholder="选择截止日期">
  64. </el-date-picker>
  65. </li>
  66. </ul>
  67. </div>
  68. <div class="flex-h">
  69. <div class="flex-item flex-h"></div>
  70. <el-button
  71. size="mini"
  72. type="primary" @click="search">搜索</el-button>
  73. <el-button
  74. size="mini"
  75. type="success" @click="exportExcel">导出Excel</el-button>
  76. </div>
  77. <div class="moreFilter"></div>
  78. </div>
  79. <div class="system-table-box">
  80. <el-table
  81. :data="cardCouponUsedList"
  82. stripe
  83. style="width: 100%">
  84. <el-table-column
  85. prop="CaseName"
  86. label="所属案场">
  87. </el-table-column>
  88. <el-table-column
  89. prop="CardCouponName"
  90. label="卡券名称">
  91. </el-table-column>
  92. <el-table-column
  93. prop="TargetName"
  94. label="使用商品">
  95. </el-table-column>
  96. <el-table-column
  97. prop="ReceivingType"
  98. label="获取方式">
  99. <template slot-scope="scope">
  100. {{scope.row.ReceivingType === 'event' ? '系统' : scope.row.ReceivingType === 'sales' ? '案场' : scope.row.ReceivingType === 'channel' ? '渠道' : scope.row.ReceivingType === 'give' ? '后台赠送' : ''}}
  101. </template>
  102. </el-table-column>
  103. <el-table-column
  104. prop="CustomerName"
  105. label="微信昵称">
  106. </el-table-column>
  107. <el-table-column
  108. prop="Phone"
  109. label="手机号">
  110. </el-table-column>
  111. <el-table-column
  112. prop="SalesName"
  113. label="销售">
  114. </el-table-column>
  115. <el-table-column
  116. prop="EndDate"
  117. label="有效期"
  118. width="140px">
  119. <template slot-scope="scope">
  120. {{scope.row.EndDate === '0001-01-01T00:00:00Z' ? '-' : toolClass.dateFormat(scope.row.EndDate)}}
  121. </template>
  122. </el-table-column>
  123. <el-table-column
  124. prop="ReceiveDate"
  125. label="获取时间"
  126. width="140px">
  127. <template slot-scope="scope">
  128. {{scope.row.ReceiveDate === '0001-01-01T00:00:00Z' ? '-' : toolClass.dateFormat(scope.row.ReceiveDate)}}
  129. </template>
  130. </el-table-column>
  131. <el-table-column
  132. prop="VerifyDate"
  133. label="使用时间"
  134. width="140px">
  135. <template slot-scope="scope">
  136. {{scope.row.UsedDate === '0001-01-01T00:00:00Z' ? '-' : toolClass.dateFormat(scope.row.UsedDate)}}
  137. </template>
  138. </el-table-column>
  139. <el-table-column
  140. prop="VerifyStatus"
  141. label="状态">
  142. <template slot-scope="scope">
  143. {{scope.row.VerifyStatus === 'useable' ? '未使用' : scope.row.VerifyStatus === 'used' ? '已使用' : scope.row.VerifyStatus === 'late' ? '逾期核销' : scope.row.VerifyStatus === 'expire' ? '已失效' : ''}}
  144. </template>
  145. </el-table-column>
  146. </el-table>
  147. </div>
  148. <el-pagination
  149. @current-change="handleCurrentChange"
  150. :current-page.sync="postData.page"
  151. :page-size="postData.pagesize"
  152. layout="prev, pager, next, jumper"
  153. :total="total">
  154. </el-pagination>
  155. </div>
  156. </template>
  157. <script>
  158. import { mapState, createNamespacedHelpers } from 'vuex'
  159. import tableSearch from '@/components/tableSearch/index'
  160. const { mapState: mapStaState, mapActions: mapStaActions } = createNamespacedHelpers('sta')
  161. export default {
  162. name: '',
  163. data () {
  164. return {
  165. total: 0,
  166. postData: { // 表格搜索条件
  167. tel: '', // 手机号
  168. status: '', // 状态
  169. caseid: '', // 案场id
  170. receivetype: '', // 获取方式
  171. begindate: '', // 起始日期
  172. enddate: '', // 截止日期
  173. name: '', // 卡券名称
  174. page: 1, // 当前页码
  175. pagesize: 10, // 请求数据量
  176. },
  177. currentList: [],
  178. typeList: [{
  179. value: '',
  180. id: ''
  181. }, {
  182. value: '案场',
  183. id: 'sales'
  184. }, {
  185. value: '渠道',
  186. id: 'channel'
  187. }, {
  188. value: '系统',
  189. id: 'event'
  190. }, {
  191. value: '后台赠送',
  192. id: 'give'
  193. }],
  194. statusList: [{
  195. value: '',
  196. id: ''
  197. }, {
  198. value: '未使用',
  199. id: 'useable'
  200. }, {
  201. value: '已使用',
  202. id: 'used'
  203. }, {
  204. value: '已失效',
  205. id: 'expire'
  206. }],
  207. }
  208. },
  209. computed: {
  210. ...mapState({
  211. cases: x => x.app.cases.list,
  212. defaultCaseId: x => x.app.cases.default
  213. }),
  214. ...mapStaState({
  215. cardCouponUsedList: x => x.cardCouponUsedList.list || [],
  216. }),
  217. CaseId: {
  218. get () {
  219. return this.postData.caseid || this.defaultCaseId
  220. },
  221. set (val) {
  222. this.postData.caseid = val
  223. }
  224. }
  225. },
  226. components: {
  227. tableSearch,
  228. },
  229. mounted () {
  230. this.$nextTick(function () {
  231. this.getList()
  232. })
  233. },
  234. methods: {
  235. ...mapStaActions([
  236. 'getCardCouponUsedList',
  237. ]),
  238. search () { // 搜索
  239. this.page = 1
  240. this.getList()
  241. },
  242. handleCurrentChange (val) { // 跳转到分页
  243. this.page = val
  244. this.getList()
  245. },
  246. getList () {
  247. this.getCardCouponUsedList(this.postData).then((res) => {
  248. // console.log(JSON.stringify(res))
  249. this.postData.page = res.page
  250. this.total = res.pagenum
  251. })
  252. },
  253. exportExcel () {
  254. var url = '&tel=' + this.postData.tel + '&status=' + this.postData.status + '&receivetype=' + this.postData.receivetype + '&begindate=' + this.postData.begindate + '&enddate=' + this.postData.enddate + '&name=' + this.postData.name
  255. console.log(`${this.toolClass.ReplaceOrg(this.$api.statistics.cardCouponUsedListExcel.url)}?token=${localStorage.getItem('JWT')}&caseid=${this.CaseId === 'all' ? '' : this.CaseId}${url}`)
  256. window.location.href = `${this.toolClass.ReplaceOrg(this.$api.statistics.cardCouponUsedListExcel.url)}?token=${localStorage.getItem('JWT')}&caseid=${this.CaseId === 'all' ? '' : this.CaseId}${url}`
  257. },
  258. }
  259. }
  260. </script>
  261. <!-- Add "scoped" attribute to limit CSS to this component only -->
  262. <style lang="scss" scoped>
  263. @import "page.scss";
  264. .searchFilterLine {
  265. > li {
  266. margin-bottom: 20px;
  267. }
  268. }
  269. </style>