usersList.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <view style="background: #F7F8FC;height:100vh">
  3. <cu-custom bgColor="bg-fff" :isBack="true">
  4. <block slot="content">{{ currentTab == 0 ? '代金券用户' : currentTab == 1 ? '满减券用户' : '折扣券用户' }}</block>
  5. </cu-custom>
  6. <view class="coupon-title"
  7. :style="currentTab == '0' ? 'background: #EFFFFE' : currentTab == '1' ? 'background: #F4FAFF;' : 'background: #FFF7F3;'">
  8. <image :src="`/static/coupon/userBg${Number(currentTab) + 1}.png`" mode="">
  9. </image>
  10. <text class="coupon-name">{{ name }}</text>
  11. </view>
  12. <view class="coupon-header">
  13. <view class="tab-bar flex justify-around items-center">
  14. <text v-for="(item, index) in staList" :key="index" class="tab-item"
  15. :class="{ active: statusType === index }" @click="onTabChange(index)">
  16. {{ item.label }} {{ item.value }}
  17. </text>
  18. </view>
  19. </view>
  20. <view class="coupon-item" v-for="val in couponList" :key="val.id">
  21. <view class="user-info">
  22. <image class="avatar" :src="val.userAvatar" mode="aspectFill"></image>
  23. <view class="name">{{ val.userName }}</view>
  24. <view class="status" style="color: #D56412;" v-if="val.consumerStatus == 1">未使用</view>
  25. <view class="status" v-if="val.consumerStatus == 2">已使用</view>
  26. <view class="status" style="color: #999999;" v-if="val.consumerStatus == 3">已失效</view>
  27. </view>
  28. <view class="date-info">
  29. <view class="valid-date">
  30. <text class="label">有效时间:</text>
  31. <text class="value">{{ val.beginTime }} - {{ val.endTime }}</text>
  32. </view>
  33. <view class="purchase-date">
  34. <text class="label" v-if="val.source==2">购买时间:</text>
  35. <text class="label" v-else>发放时间:</text>
  36. <text class="value">{{ val.payTime }}</text>
  37. </view>
  38. </view>
  39. <view class="product-info flex" v-if="val.consumerStatus == 2">
  40. <view class="product-title">
  41. <view>
  42. <text class="label">购买信息:</text>
  43. <text class="value">{{ val.productName }}</text>
  44. </view>
  45. <view class="product-detail">
  46. <text class="price">¥{{ val.soldPrice }}</text>
  47. <text class="quantity">1份</text>
  48. </view>
  49. </view>
  50. <image class="product-image" :src="val.productImage" mode="aspectFill"></image>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. export default {
  57. data() {
  58. return {
  59. staList: [{
  60. label:'全部',
  61. value:''
  62. },{
  63. label:'未使用',
  64. value:''
  65. },{
  66. label:'已使用',
  67. value:''
  68. },{
  69. label:'已失效',
  70. value:''
  71. }],
  72. productId: '',
  73. currentTab: '',
  74. couponList: [],
  75. statusType: 0,
  76. page: {
  77. pageNo: 1,
  78. pageSize: 10
  79. },
  80. name:'',
  81. }
  82. },
  83. methods: {
  84. onTabChange(index) {
  85. this.statusType = index
  86. this.getForm()
  87. },
  88. getForm() {
  89. this.$http.post('/merchant/localConsumerUserInfo/list', { status: this.statusType, consumerId: this.productId, ...this.page }).then(res => {
  90. if (res.data.success) {
  91. this.couponList = res.data.result.records
  92. }
  93. else {
  94. this.$tip.error(res.data.message);
  95. }
  96. })
  97. },
  98. },
  99. onLoad(options) {
  100. if (options) {
  101. this.productId = options.id
  102. this.currentTab = options.tab
  103. this.name=options.name
  104. }
  105. },
  106. onShow() {
  107. if (this.productId) {
  108. this.getForm()
  109. this.$http.get('/merchant/localConsumerUserInfo/getConsumerInfo', {params: {consumerId: this.productId} }).then(res => {
  110. if (res.data.success) {
  111. this.staList.forEach(e=>{
  112. if(e.label=='全部'){
  113. e.value=res.data.result.allNum
  114. }
  115. if(e.label=='已使用'){
  116. e.value=res.data.result.useNum
  117. }
  118. if(e.label=='未使用'){
  119. e.value=res.data.result.noUseNum
  120. }
  121. if(e.label=='已失效'){
  122. e.value=res.data.result.noNum
  123. }
  124. })
  125. }
  126. else {
  127. this.$tip.error(res.data.message);
  128. }
  129. })
  130. }
  131. }
  132. }
  133. </script>
  134. <style lang="scss" scoped>
  135. .coupon-header {
  136. background: #FFFFFF;
  137. padding: 18rpx;
  138. border-bottom: 1px solid #EEEEEE;
  139. }
  140. .coupon-title {
  141. background: #EFFFFE;
  142. padding: 20rpx 32rpx;
  143. border-top: 1px solid #EEEEEE;
  144. position: relative;
  145. image {
  146. width: 347rpx;
  147. height: 56rpx;
  148. }
  149. .coupon-name {
  150. position: absolute;
  151. color: #FFFFFF;
  152. left: 22rpx;
  153. width: 347rpx;
  154. height: 56rpx;
  155. line-height: 56rpx;
  156. text-align: center;
  157. overflow: hidden;
  158. white-space: nowrap;
  159. text-overflow: ellipsis;
  160. padding: 0 16rpx;
  161. box-sizing: border-box;
  162. }
  163. }
  164. .tab-bar {
  165. position: relative;
  166. .tab-item {
  167. // padding: 12rpx 40rpx;
  168. // height: 60rpx;
  169. // line-height: 60rpx;
  170. text-align: center;
  171. padding: 10rpx 16rpx;
  172. font-size: 28rpx;
  173. color: #666;
  174. position: relative;
  175. border-radius: 8rpx;
  176. transition: all 0.3s;
  177. background: #F2F3F5;
  178. &.active {
  179. color: #2D88F4;
  180. background: #ECF5FF;
  181. font-weight: 500;
  182. }
  183. &:last-child {
  184. margin-right: 0;
  185. }
  186. }
  187. }
  188. .coupon-item {
  189. background: #FFFFFF;
  190. padding: 20rpx 40rpx;
  191. margin-bottom: 20rpx;
  192. }
  193. .user-info {
  194. display: flex;
  195. align-items: center;
  196. margin-bottom: 16rpx;
  197. .avatar {
  198. width: 80rpx;
  199. height: 80rpx;
  200. border-radius: 50%;
  201. margin-right: 16rpx;
  202. }
  203. .name {
  204. font-size: 32rpx;
  205. color: #333333;
  206. flex: 1;
  207. }
  208. .status {
  209. font-size: 28rpx;
  210. color: #509B45;
  211. }
  212. }
  213. .date-info {
  214. margin-bottom: 16rpx;
  215. margin-left: 96rpx;
  216. font-size: 26rpx;
  217. color: #8A91A8;
  218. .valid-date,
  219. .purchase-date {
  220. margin-bottom: 8rpx;
  221. .label {
  222. margin-right: 8rpx;
  223. }
  224. }
  225. }
  226. .product-info {
  227. background: #F7F8FC;
  228. padding: 14rpx;
  229. border-radius: 8rpx;
  230. .product-title {
  231. width: 60%;
  232. margin-bottom: 16rpx;
  233. font-size: 26rpx;
  234. color: #666666;
  235. overflow: hidden;
  236. /* 隐藏溢出的内容 */
  237. white-space: nowrap;
  238. /* 防止文本换行 */
  239. text-overflow: ellipsis;
  240. /* 使用省略号表示溢出的内容 */
  241. }
  242. .product-image {
  243. width: 80rpx;
  244. height: 80rpx;
  245. border-radius: 8rpx;
  246. margin-left: 42rpx;
  247. }
  248. .product-detail {
  249. display: flex;
  250. align-items: center;
  251. color: #999999;
  252. font-size: 24rpx;
  253. .price {
  254. margin-right: 26rpx;
  255. }
  256. }
  257. }
  258. </style>