user-coupon.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <style>
  2. .set-el-button {
  3. padding: 0!important;
  4. border: 0;
  5. margin: 0 5px;
  6. }
  7. .sort-input {
  8. width: 100%;
  9. background-color: #F3F5F6;
  10. height: 32px;
  11. }
  12. .sort-input span {
  13. height: 32px;
  14. width: 100%;
  15. line-height: 32px;
  16. display: inline-block;
  17. padding: 0 10px;
  18. font-size: 13px;
  19. }
  20. .sort-input .el-input__inner {
  21. height: 32px;
  22. line-height: 32px;
  23. background-color: #F3F5F6;
  24. float: left;
  25. padding: 0 10px;
  26. border: 0;
  27. }
  28. .table-body {
  29. padding: 20px;
  30. background-color: #fff;
  31. }
  32. .table-info .el-button {
  33. padding: 0 !important;
  34. border: 0;
  35. margin: 0 5px;
  36. }
  37. .input-item {
  38. display: inline-block;
  39. width: 250px;
  40. margin: 0 0 20px;
  41. }
  42. .input-item .el-input__inner {
  43. border-right: 0;
  44. }
  45. .input-item .el-input__inner:hover{
  46. border: 1px solid #dcdfe6;
  47. border-right: 0;
  48. outline: 0;
  49. }
  50. .input-item .el-input__inner:focus{
  51. border: 1px solid #dcdfe6;
  52. border-right: 0;
  53. outline: 0;
  54. }
  55. .input-item .el-input-group__append {
  56. background-color: #fff;
  57. border-left: 0;
  58. width: 10%;
  59. padding: 0;
  60. }
  61. .input-item .el-input-group__append .el-button {
  62. padding: 0;
  63. }
  64. .input-item .el-input-group__append .el-button {
  65. margin: 0;
  66. }
  67. .el-table th>.cell {
  68. color: #333;
  69. font-weight: bold;
  70. font-size: 14px;
  71. }
  72. .table1 .el-table__footer-wrapper,
  73. .table1 .el-table__header-wrapper {
  74. border-bottom: 1.4px solid #D6D6D6;
  75. }
  76. .user_img{
  77. position: relative;
  78. margin-right: 8px;
  79. /* height: 50px;
  80. width: 50px; */
  81. }
  82. .default-avatar{
  83. width: 50px;
  84. height: 50px;
  85. border-radius: 50%;
  86. margin-right: 8px;
  87. }
  88. .uer-nickname {
  89. flex: 1;
  90. }
  91. </style>
  92. <div id="app" v-cloak>
  93. <el-card shadow="never" style="border:0" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  94. <div slot="header">
  95. <span>会员优惠券</span>
  96. </div>
  97. <div class="table-body">
  98. <div class="input-item">
  99. <el-input @keyup.enter.native="search" size="small" placeholder="请输入优惠券名称搜索" v-model="keyword" clearable @clear="search">
  100. <el-button slot="append" icon="el-icon-search" @click="search"></el-button>
  101. </el-input>
  102. </div>
  103. <div class="input-item">
  104. <el-input @keyup.enter.native="search" size="small" placeholder="请输入会员ID" v-model="user_id" clearable @clear="search">
  105. <el-button slot="append" icon="el-icon-search" @click="search"></el-button>
  106. </el-input>
  107. </div>
  108. <div class="input-item">
  109. <el-select v-model="from_type" placeholder="请选择" size="small">
  110. <el-option v-for="(item,index) in from_type_text" :key="index" :label="item" :value="index">{{item}}
  111. </el-option>
  112. </el-select>
  113. </div>
  114. <div class="input-item">
  115. <el-button type="primary" size="small" @click="search" style="margin-left: 15px;">搜索</el-button>
  116. <el-button type="warning" @click="clereSearch" v-if="keyword || user_id" style="padding: 9px 15px !important;">清除搜索条件</el-button>
  117. </div>
  118. <el-table v-loading="loading" :data="list" style="width: 100%;margin-bottom: 15px">
  119. <el-table-column width='100' prop="user_id" label="会员ID" align='center' ></el-table-column>
  120. <el-table-column label="会员" align='center' width="180">
  121. <template slot-scope="scope">
  122. <div class="user_img" flex="cross:center">
  123. <el-image class="default-avatar" :src="scope.row.avatar_url">
  124. <div slot="error" class="image-slot">
  125. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  126. </div>
  127. </el-image>
  128. <div class="uer-nickname over1" v-if="scope.row.nickname">{{scope.row.nickname}}</div>
  129. <div class="uer-nickname over1" v-else>--</div>
  130. </div>
  131. </template>
  132. </el-table-column>
  133. <el-table-column width='100' align='center' prop="from_type" label="类型">
  134. <template slot-scope="scope">
  135. <span v-if="scope.row.from_type == 1">
  136. 平台门店券
  137. </span>
  138. <span v-else-if="scope.row.from_type == 2">
  139. 门店独立券
  140. </span>
  141. </template>
  142. </el-table-column>
  143. <el-table-column width='100' align='center' prop="coupon_id" label="优惠券id"></el-table-column>
  144. <el-table-column width='150' align='center' prop="name" label="优惠券名称"></el-table-column>
  145. <el-table-column width='150' align='center' prop="min_price" label="最低消费金额(元)"></el-table-column>
  146. <el-table-column width='150' align='center' prop="sub_price" label="优惠方式">
  147. <template slot-scope="scope">
  148. <div>{{scope.row.content}}</div>
  149. </template>
  150. </el-table-column>
  151. <el-table-column width='120' align='center' prop="sub_price" label="使用范围">
  152. <template slot-scope="scope">
  153. <span v-if="scope.row.appoint_type == 1">指定商品类目</span>
  154. <span v-if="scope.row.appoint_type == 2">指定商品</span>
  155. <span v-if="scope.row.appoint_type == 3">全场通用</span>
  156. <span v-if="scope.row.appoint_type == 4">指定门店</span>
  157. </template>
  158. </el-table-column>
  159. <el-table-column width='180' align='center' prop="receive_platform" label="领取来源">
  160. <template slot-scope="scope">
  161. <span>{{scope.row.receive_type}}</span>
  162. </template>
  163. </el-table-column>
  164. <el-table-column width='180' align='center' prop="is_use" label="是否使用">
  165. <template slot-scope="scope">
  166. <span v-if="scope.row.is_use == 1">
  167. 已使用
  168. </span>
  169. <span v-else-if="scope.row.is_use == 0">
  170. 未使用
  171. </span>
  172. </template>
  173. </el-table-column>
  174. <el-table-column width='150' align='center' prop="created_at" label="领取时间">
  175. <template slot-scope="scope">
  176. {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
  177. </template>
  178. </el-table-column>
  179. <el-table-column width='150'align='center' prop="created_at" label="使用时间" align="center">
  180. <template slot-scope="scope">
  181. <span v-if="scope.row.is_use == 1">
  182. {{scope.row.used_time|dateTimeFormat('Y-m-d H:i:s')}}
  183. </span>
  184. <span v-else>--</span>
  185. </template>
  186. </el-table-column>
  187. </el-table>
  188. <div flex="box:last cross:center">
  189. <div style="visibility: hidden">
  190. <el-button plain type="primary" size="small">批量操作1</el-button>
  191. <el-button plain type="primary" size="small">批量操作2</el-button>
  192. </div>
  193. <div>
  194. <el-pagination v-if="pagination" :page-size="page_size" style="float: right;" background @current-change="pageChange" layout="prev, pager, next" :total="pagination.totalCount">
  195. </el-pagination>
  196. </div>
  197. </div>
  198. </div>
  199. </el-card>
  200. </div>
  201. <script>
  202. const app = new Vue({
  203. el: '#app',
  204. data() {
  205. return {
  206. loading: false,
  207. list: [],
  208. keyword: '',
  209. user_id: '',
  210. from_type: '',
  211. pagination: null,
  212. page: 1,
  213. page_size: 10,
  214. from_type_text: {
  215. 1: '平台门店券',
  216. 2: '门店独立券'
  217. },
  218. };
  219. },
  220. methods: {
  221. //搜索
  222. search() {
  223. this.page = 1;
  224. this.loadData();
  225. },
  226. // 清除搜索条件
  227. clereSearch() {
  228. this.keyword = '';
  229. this.from_type = '';
  230. this.user_id = null;
  231. this.loadData();
  232. },
  233. //分页
  234. pageChange(page) {
  235. this.page = page;
  236. this.loadData();
  237. },
  238. // 根据参数获取请求信息
  239. loadData() {
  240. this.loading = true;
  241. console.log(this.keyword)
  242. request({
  243. params: {
  244. r: 'store/client/coupon/user-coupon',
  245. keyword: this.keyword,
  246. user_id: this.user_id,
  247. from_type: this.from_type,
  248. page: this.page,
  249. },
  250. }).then(e => {
  251. this.loading = false;
  252. if (e.data.code === 0) {
  253. this.list = e.data.data.list;
  254. this.pagination = e.data.data.pagination;
  255. this.page_size = e.data.data.page_size;
  256. } else {
  257. this.listLoading = false;
  258. this.$message({
  259. message: e.data.msg,
  260. type: 'error'
  261. });
  262. }
  263. }).catch(e => {
  264. this.listLoading = false;
  265. });
  266. }
  267. },
  268. created() {
  269. this.loadData();
  270. }
  271. })
  272. </script>