channel-list.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <view >
  3. <view v-if="$isNotEmpty(channel)" @click="channelShow=true" class="channel " style="width: 100%;">
  4. <view class="left">
  5. <view class="center">
  6. <image :src="item.channelLogo?item.channelLogo:'/static/icon/channel.png'" mode=""></image>
  7. </view>
  8. <view class="content">
  9. <text>{{channel.channelName}}</text>
  10. <text style="font-weight: 300;">优先使用该渠道积分支付</text>
  11. </view>
  12. </view>
  13. <view class="right">
  14. <text class="cuIcon-unfold"></text>
  15. </view>
  16. </view>
  17. <u-popup :closeable="true" v-model="channelShow" mode="bottom" height="65%">
  18. <view class="popup-content">
  19. <view class="">
  20. <view style="border-bottom: 1rpx solid #eee;" class="fixed center text-bold text-lg padding-bottom-40">
  21. 请选择优先使用的渠道积分
  22. </view>
  23. <view @click="check(item)" v-for="(item,index) in channelList" :key="index" class="channel-item">
  24. <image :src="item.channelLogo?item.channelLogo:'/static/icon/channel.png'" mode=""></image>
  25. <text class="margin-left-10">{{item.channelName}}(剩余 ¥ {{item.available}})</text>
  26. <text v-if="channel.channelId==item.channelId" class="cuIcon-check checked"></text>
  27. </view>
  28. </view>
  29. <view class="center">
  30. <view @click="confirm" class="cu-btn radius channelbtn">
  31. 确认
  32. </view>
  33. </view>
  34. </view>
  35. </u-popup>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. name:"channel-list",
  41. data() {
  42. return {
  43. //渠道积分
  44. channel:{},
  45. channelList:[],
  46. channelShow:false,
  47. };
  48. },
  49. created() {
  50. this.getUserPonint()
  51. },
  52. methods:{
  53. //获取用户渠道积分
  54. getUserPonint(){
  55. if (this.$isEmpty(this.vuex_userId)) {
  56. return
  57. }
  58. let params={
  59. userId:this.vuex_userId || '-1'
  60. }
  61. this.$api.userChannelPoint.list(params).then(res=>{
  62. if (this.$isNotEmpty(res.data.records)) {
  63. this.channelList=res.data.records
  64. this.channel=this.channelList[0]
  65. this.$u.vuex('vuex_channel',this.channel)
  66. }
  67. })
  68. },
  69. confirm(){
  70. this.channelShow=false
  71. this.$u.vuex('vuex_channel',this.channel)
  72. this.$emit('click',this.channel)
  73. },
  74. check(item){
  75. this.channel=item
  76. }
  77. }
  78. }
  79. </script>
  80. <style lang="scss">
  81. .channel{
  82. display: flex;
  83. justify-content: space-between;
  84. margin-top: 10rpx;
  85. padding:20rpx 40rpx;
  86. background-color: #FFFFFF;
  87. .left{
  88. display: flex;
  89. image{
  90. width: 60rpx;
  91. height: 60rpx;
  92. display: flex;
  93. justify-content: center;
  94. align-items: center;
  95. }
  96. view{
  97. display: flex;
  98. flex-direction: column;
  99. }
  100. .content{
  101. margin-left: 16rpx;
  102. text:first-child{
  103. font-size: 32rpx;
  104. margin-bottom: 10rpx;
  105. }
  106. text:last-child{
  107. font-size: 28rpx;
  108. color: #989898;
  109. }
  110. }
  111. }
  112. .right{
  113. display: flex;
  114. justify-content: center;
  115. align-items: center;
  116. }
  117. }
  118. .popup-content{
  119. display: flex;
  120. flex-direction: column;
  121. justify-content: space-between;
  122. padding: 40rpx 0;
  123. height: 100%;
  124. .channelbtn{
  125. background-color: #18b566;
  126. color: #FFFFFF;
  127. padding: 38rpx 180rpx;
  128. }
  129. .channel-item{
  130. position: relative;
  131. display: flex;
  132. padding: 30rpx;
  133. border-bottom: 1rpx solid #eee;
  134. image{
  135. width: 40rpx;
  136. height: 40rpx;
  137. margin-right: 10rpx;
  138. }
  139. .checked{
  140. color: #18b566;
  141. font-size: 34rpx;
  142. position: absolute;
  143. font-weight: 800;
  144. right: 40rpx;
  145. bottom: 30rpx;
  146. }
  147. }
  148. }
  149. </style>