channel-list.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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="channel.channelLogo" mode=""></image>
  7. </view>
  8. <view class="content">
  9. <text>{{channel.channelName}}</text>
  10. <text>优先使用该渠道积分支付</text>
  11. </view>
  12. </view>
  13. <view class="right">
  14. <text class="cuIcon-right"></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" 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. let params={
  56. userId:this.vuex_userId
  57. }
  58. this.$api.userChannelPoint.list(params).then(res=>{
  59. if (this.$isNotEmpty(res.data.records)) {
  60. this.channelList=res.data.records
  61. this.channel=this.channelList[0]
  62. this.$u.vuex('vuex_channel',this.channel)
  63. }
  64. })
  65. },
  66. confirm(){
  67. this.channelShow=false
  68. this.$u.vuex('vuex_channel',this.channel)
  69. this.$emit('click',this.channel)
  70. },
  71. check(item){
  72. this.channel=item
  73. }
  74. }
  75. }
  76. </script>
  77. <style lang="scss">
  78. .channel{
  79. display: flex;
  80. justify-content: space-between;
  81. margin-top: 10rpx;
  82. padding:20rpx 30rpx;
  83. background-color: #FFFFFF;
  84. .left{
  85. display: flex;
  86. image{
  87. width: 60rpx;
  88. height: 60rpx;
  89. display: flex;
  90. justify-content: center;
  91. align-items: center;
  92. }
  93. view{
  94. display: flex;
  95. flex-direction: column;
  96. }
  97. .content{
  98. margin-left: 16rpx;
  99. text:first-child{
  100. font-size: 34rpx;
  101. margin-bottom: 10rpx;
  102. }
  103. text:last-child{
  104. font-size: 28rpx;
  105. color: #989898;
  106. }
  107. }
  108. }
  109. .right{
  110. display: flex;
  111. justify-content: center;
  112. align-items: center;
  113. }
  114. }
  115. .popup-content{
  116. display: flex;
  117. flex-direction: column;
  118. justify-content: space-between;
  119. padding: 40rpx 0;
  120. height: 100%;
  121. .channelbtn{
  122. background-color: #18b566;
  123. color: #FFFFFF;
  124. padding: 36rpx 150rpx;
  125. }
  126. .channel-item{
  127. position: relative;
  128. display: flex;
  129. padding: 30rpx;
  130. border-bottom: 1rpx solid #eee;
  131. image{
  132. width: 40rpx;
  133. height: 40rpx;
  134. margin-right: 10rpx;
  135. }
  136. .checked{
  137. color: #18b566;
  138. font-size: 34rpx;
  139. position: absolute;
  140. font-weight: 800;
  141. right: 40rpx;
  142. bottom: 30rpx;
  143. }
  144. }
  145. }
  146. </style>