usersList.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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="">{{ 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. text{
  150. position: absolute;
  151. color: #FFFFFF;
  152. left: 22rpx;
  153. width: 347rpx;
  154. height: 56rpx;
  155. line-height: 56rpx;
  156. text-align: center;
  157. }
  158. }
  159. .tab-bar {
  160. position: relative;
  161. .tab-item {
  162. // padding: 12rpx 40rpx;
  163. // height: 60rpx;
  164. // line-height: 60rpx;
  165. text-align: center;
  166. padding: 10rpx 16rpx;
  167. font-size: 28rpx;
  168. color: #666;
  169. position: relative;
  170. border-radius: 8rpx;
  171. transition: all 0.3s;
  172. background: #F2F3F5;
  173. &.active {
  174. color: #2D88F4;
  175. background: #ECF5FF;
  176. font-weight: 500;
  177. }
  178. &:last-child {
  179. margin-right: 0;
  180. }
  181. }
  182. }
  183. .coupon-item {
  184. background: #FFFFFF;
  185. padding: 20rpx 40rpx;
  186. margin-bottom: 20rpx;
  187. }
  188. .user-info {
  189. display: flex;
  190. align-items: center;
  191. margin-bottom: 16rpx;
  192. .avatar {
  193. width: 80rpx;
  194. height: 80rpx;
  195. border-radius: 50%;
  196. margin-right: 16rpx;
  197. }
  198. .name {
  199. font-size: 32rpx;
  200. color: #333333;
  201. flex: 1;
  202. }
  203. .status {
  204. font-size: 28rpx;
  205. color: #509B45;
  206. }
  207. }
  208. .date-info {
  209. margin-bottom: 16rpx;
  210. margin-left: 96rpx;
  211. font-size: 26rpx;
  212. color: #8A91A8;
  213. .valid-date,
  214. .purchase-date {
  215. margin-bottom: 8rpx;
  216. .label {
  217. margin-right: 8rpx;
  218. }
  219. }
  220. }
  221. .product-info {
  222. background: #F7F8FC;
  223. padding: 14rpx;
  224. border-radius: 8rpx;
  225. .product-title {
  226. width: 60%;
  227. margin-bottom: 16rpx;
  228. font-size: 26rpx;
  229. color: #666666;
  230. overflow: hidden;
  231. /* 隐藏溢出的内容 */
  232. white-space: nowrap;
  233. /* 防止文本换行 */
  234. text-overflow: ellipsis;
  235. /* 使用省略号表示溢出的内容 */
  236. }
  237. .product-image {
  238. width: 80rpx;
  239. height: 80rpx;
  240. border-radius: 8rpx;
  241. margin-left: 42rpx;
  242. }
  243. .product-detail {
  244. display: flex;
  245. align-items: center;
  246. color: #999999;
  247. font-size: 24rpx;
  248. .price {
  249. margin-right: 26rpx;
  250. }
  251. }
  252. }
  253. </style>