couponDetail.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <!-- -->
  2. <template>
  3. <div class="m-container">
  4. <h2>
  5. <div class="squrt"></div>
  6. 优惠券明细
  7. </h2>
  8. <div class="m-core">
  9. <save-form
  10. :inline="true"
  11. :model="searchForm"
  12. @submit="search"
  13. @reset="onReSet"
  14. >
  15. <el-form-item prop="search">
  16. <el-input
  17. v-model.trim="searchForm.search"
  18. clearable
  19. @keyup.enter.native="search"
  20. placeholder="姓名/编号/手机号"
  21. ></el-input>
  22. </el-form-item>
  23. <el-form-item prop="couponName">
  24. <el-input
  25. v-model.trim="searchForm.couponName"
  26. @keyup.enter.native="search"
  27. placeholder="优惠券名称"
  28. ></el-input>
  29. </el-form-item>
  30. <el-form-item prop="paymentOrderId">
  31. <el-input
  32. v-model.trim="searchForm.paymentOrderId"
  33. @keyup.enter.native="search"
  34. placeholder="关联订单号"
  35. ></el-input>
  36. </el-form-item>
  37. <el-form-item prop="usageStatus">
  38. <el-select
  39. placeholder="优惠券状态"
  40. v-model.trim="searchForm.usageStatus"
  41. filterable
  42. clearable
  43. >
  44. <el-option label="未使用" value="0"></el-option>
  45. <el-option label="已使用" value="1"></el-option>
  46. <el-option label="已过期" value="2"></el-option>
  47. </el-select>
  48. </el-form-item>
  49. <el-form-item prop="organId">
  50. <el-select
  51. class="multiple"
  52. v-model.trim="searchForm.organId"
  53. filterable
  54. clearable
  55. placeholder="请选择分部"
  56. >
  57. <el-option
  58. v-for="(item, index) in selects.branchs"
  59. :key="index"
  60. :label="item.name"
  61. :value="item.id"
  62. ></el-option>
  63. </el-select>
  64. </el-form-item>
  65. <el-form-item prop="issueType">
  66. <el-select
  67. class="multiple"
  68. v-model.trim="searchForm.issueType"
  69. filterable
  70. clearable
  71. placeholder="获取方式"
  72. >
  73. <el-option
  74. v-for="(item, index) in issueList"
  75. :key="index"
  76. :label="item.label"
  77. :value="item.value"
  78. ></el-option>
  79. </el-select>
  80. </el-form-item>
  81. <!-- -->
  82. <el-form-item>
  83. <el-button native-type="submit" type="primary">搜索</el-button>
  84. <el-button native-type="reset" type="danger">重置</el-button>
  85. </el-form-item>
  86. </save-form>
  87. <div class="tableWrap">
  88. <el-table
  89. style="width: 100%"
  90. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  91. :data="tableList"
  92. >
  93. <el-table-column
  94. align="center"
  95. prop="organName"
  96. label="分部"
  97. ></el-table-column>
  98. <el-table-column
  99. align="center"
  100. prop="organName"
  101. label="学生姓名(编号)"
  102. >
  103. <template slot-scope="scope">
  104. <div>{{ scope.row.userName }}({{ scope.row.userId }})</div>
  105. </template>
  106. </el-table-column>
  107. <el-table-column
  108. align="center"
  109. prop="phone"
  110. label="手机号"
  111. ></el-table-column>
  112. <el-table-column
  113. align="center"
  114. prop="couponId"
  115. label="优惠券编号"
  116. ></el-table-column>
  117. <el-table-column align="center" prop="couponId" label="优惠券类型">
  118. <template slot-scope="scope">
  119. <div>
  120. {{ scope.row.couponType | couponTypeFilter }}
  121. </div>
  122. </template>
  123. </el-table-column>
  124. <el-table-column
  125. align="center"
  126. prop="couponName"
  127. label="优惠券名称"
  128. ></el-table-column>
  129. <el-table-column align="center" prop="description" label="描述">
  130. <template slot-scope="scope">
  131. <div>
  132. <Tooltip
  133. :content="
  134. scope.row.couponDescription
  135. ? scope.row.couponDescription
  136. : ''
  137. "
  138. />
  139. </div>
  140. </template>
  141. </el-table-column>
  142. <el-table-column
  143. align="center"
  144. prop="code"
  145. label="优惠码"
  146. ></el-table-column>
  147. <el-table-column align="center" prop="couponId" label="关联订单号">
  148. <template slot-scope="scope">
  149. <div
  150. @click="gotoOrder(scope.row.paymentOrderId)"
  151. style="color: var(--color-primary); cursor: pointer"
  152. >
  153. {{ scope.row.paymentOrderId }}
  154. </div>
  155. </template>
  156. </el-table-column>
  157. <el-table-column
  158. align="center"
  159. prop="couponId"
  160. width="160px"
  161. label="有效期"
  162. >
  163. <template slot-scope="scope">
  164. <div>
  165. <p>{{ scope.row.useStartDate }}</p>
  166. <p>{{ scope.row.useDeadlineDate }}</p>
  167. </div>
  168. </template>
  169. </el-table-column>
  170. <el-table-column
  171. align="center"
  172. prop="couponId"
  173. width="100px"
  174. label="获取途径"
  175. >
  176. <template slot-scope="scope">
  177. <div>
  178. <p>{{ scope.row.issueType| issueType}}</p>
  179. </div>
  180. </template>
  181. </el-table-column>
  182. <el-table-column
  183. align="center"
  184. prop="couponId"
  185. width="100px"
  186. label="使用时间"
  187. >
  188. <template slot-scope="scope">
  189. <div>
  190. <p>{{ scope.row.usedTime }}</p>
  191. </div>
  192. </template>
  193. </el-table-column>
  194. <el-table-column align="center" prop="couponId" label="状态">
  195. <template slot-scope="scope">
  196. <div>
  197. <p>{{ scope.row.usageStatus | usageStatus }}</p>
  198. </div>
  199. </template>
  200. </el-table-column>
  201. </el-table>
  202. <pagination
  203. sync
  204. :total.sync="rules.total"
  205. :page.sync="rules.page"
  206. :limit.sync="rules.limit"
  207. :page-sizes="rules.page_size"
  208. @pagination="getList"
  209. />
  210. </div>
  211. </div>
  212. </div>
  213. </template>
  214. <script>
  215. import axios from "axios";
  216. import { getToken } from "@/utils/auth";
  217. import pagination from "@/components/Pagination/index";
  218. import { getSysCouponCode } from "./api";
  219. import Tooltip from "@/components/Tooltip/index";
  220. import load from "@/utils/loading";
  221. import {issueList} from '@/utils/searchArray'
  222. export default {
  223. components: { pagination, Tooltip },
  224. data() {
  225. return {
  226. issueList,
  227. searchForm: {
  228. search: null,
  229. couponName: null,
  230. paymentOrderId: null,
  231. usageStatus: null,
  232. organId: null,
  233. },
  234. tableList: [],
  235. organList: [],
  236. rules: {
  237. // 分页规则
  238. limit: 10, // 限制显示条数
  239. page: 1, // 当前页
  240. total: 0, // 总条数
  241. page_size: [10, 20, 40, 50], // 选择限制显示条数
  242. },
  243. };
  244. },
  245. //生命周期 - 创建完成(可以访问当前this实例)
  246. created() {},
  247. //生命周期 - 挂载完成(可以访问DOM元素)
  248. async mounted() {
  249. // 获取分部
  250. await this.$store.dispatch("setBranchs");
  251. this.init();
  252. },
  253. methods: {
  254. init() {
  255. this.getList();
  256. },
  257. async getList() {
  258. try {
  259. const res = await getSysCouponCode({
  260. ...this.searchForm,
  261. page: this.rules.page,
  262. rows: this.rules.limit,
  263. });
  264. this.tableList = res.data.rows;
  265. this.rules.total = res.data.total;
  266. } catch (e) {
  267. console.log(e);
  268. }
  269. },
  270. search() {
  271. this.rules.page = 1;
  272. this.getList();
  273. },
  274. onReSet() {
  275. this.$nextTick(()=>{
  276. this.search();
  277. })
  278. },
  279. gotoOrder(id) {
  280. this.$router.push({
  281. name: "income",
  282. params: { orderNo: id },
  283. });
  284. },
  285. },
  286. filters: {
  287. usageStatus(val) {
  288. let obj = {
  289. 0: "未使用",
  290. 1: "已使用",
  291. 2: "已过期",
  292. };
  293. return obj[val];
  294. },
  295. },
  296. };
  297. </script>
  298. <style lang='scss' scoped>
  299. </style>