list.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <view class="container" v-if="fetch">
  3. <use-tabbar :tabbar="false"></use-tabbar>
  4. <view class="w-full navbar-area bg-main">
  5. <view class="state-area dflex-a">
  6. <view v-for="(item, index) in fetch.nav" :key="index" :class="{ active: type === index }"
  7. class="nav-item dflex-c pos-r fs padding-lr-lg h-full" @click="tabClick(index)">
  8. {{ item.name }}
  9. <text v-if="item.num > 0">({{ item.num }})</text>
  10. </view>
  11. </view>
  12. </view>
  13. <scroll-view class="list-scroll-content h-full" scroll-y>
  14. <!-- 空白页 -->
  15. <u-empty v-if="fetch.list && fetch.list.length == 0" marginTop="200" mode="permission" text="暂无权益"></u-empty>
  16. <view v-else class="padding-lr" v-for="(item, index) in fetch.list" :key="index">
  17. <view class="coupon_box border-radius margin-top-sm bg-main" @click="showModal(item.title, item.tip)">
  18. <view class="dflex-b">
  19. <view class="left pos-a h-full dflex-c dflex-flow-c">
  20. <view>
  21. <text class="price fs-lg">{{ item.config_name }}</text>
  22. </view>
  23. <view class="fs-sm">{{item.type_name}}</view>
  24. <!-- 后续升级
  25. <view v-if="type == 0 && item.config_type == 'exchange'"
  26. class="btn-exchange bg-base ft-white padding-lr-sm padding-tb-xxs"
  27. @click.stop="exchange(item)">
  28. 立即兑换
  29. </view>
  30. -->
  31. </view>
  32. <view class="right padding left_t flex1">
  33. <view class="dflex-b padding-bottom-xs">
  34. <view class="fwb fs">{{ item.name }}</view>
  35. <text class="arrow" v-if="item.tip">›</text>
  36. </view>
  37. <view class="dflex-b ft-dark fs-xs padding-bottom border-line">
  38. <view class="">{{ item.desc }}</view>
  39. </view>
  40. <view class="dflex-b padding-top-xs">
  41. <view class="fs-xs ft-dark">{{ item.edate }}</view>
  42. <!-- 周期权益按钮 -->
  43. <view v-if="type === 1">
  44. <view v-if="item.receive == 1"
  45. class="btn-receive bg-base ft-white border-radius-sm fs-xs padding-lr-sm padding-tb-xxs"
  46. @click.stop="receive(item)">
  47. 领取
  48. </view>
  49. <view v-else-if="item.receive == 2"
  50. class="btn-receive-disabled border-radius-sm fs-xs padding-lr-sm padding-tb-xxs"
  51. @click.stop="tip(item)">
  52. 记录
  53. </view>
  54. </view>
  55. <view v-else>
  56. <view v-if="item.receive_tip"
  57. class="btn-receive-disabled border-radius-sm fs-xs padding-lr-sm padding-tb-xxs"
  58. @click.stop="tip(item)">
  59. 记录
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. </scroll-view>
  68. <u-modal @close="closeModal" @confirm="closeModal" :show="show.state" :title="show.title" :closeOnClickOverlay="true">
  69. <view class="slot-content">
  70. <u-parse :content="show.content" @linktap="handleClick"></u-parse>
  71. </view>
  72. </u-modal>
  73. </view>
  74. </template>
  75. <script>
  76. export default {
  77. data() {
  78. return {
  79. fetch: {},
  80. type: 0,
  81. show: {
  82. state: false,
  83. title: '',
  84. content: '',
  85. },
  86. };
  87. },
  88. onLoad() {
  89. this.loadData();
  90. },
  91. // 下拉刷新
  92. onPullDownRefresh() {
  93. this.loadData();
  94. },
  95. methods: {
  96. loadData() {
  97. this.DeverApi.get(this, 'benefit.my', {
  98. type: this.type
  99. });
  100. },
  101. // 顶部tab点击
  102. tabClick(index) {
  103. this.type = index;
  104. this.fetch.list = {}
  105. this.loadData();
  106. },
  107. showModal(title, content) {
  108. if (content) {
  109. this.show.title = title;
  110. this.show.content = content;
  111. this.show.state = true;
  112. }
  113. },
  114. closeModal() {
  115. this.show.state = false;
  116. },
  117. // 点击领取
  118. receive(item) {
  119. this.Dever.confirm('确认现在领取?', res => {
  120. this.DeverApi.post('benefit.receive', {
  121. id: item.config_id
  122. }, res => {
  123. this.Dever.alert('领取成功');
  124. this.loadData();
  125. });
  126. })
  127. },
  128. tip(item) {
  129. //this.Dever.alert(item.receive_tip);
  130. this.showModal('记录', item.receive_tip);
  131. },
  132. handleClick(e) {
  133. console.info(e)
  134. if (e['data-content']) {
  135. uni.setClipboardData({
  136. data: e['data-content'],
  137. });
  138. }
  139. },
  140. // 跳转至兑换界面
  141. exchange(item) {
  142. this.Dever.confirm('确认现在兑换?', res => {
  143. })
  144. },
  145. }
  146. };
  147. </script>
  148. <style lang="scss">
  149. page,
  150. .container {
  151. min-height: 100%;
  152. background: $page-color-base;
  153. }
  154. /* 优惠券状态区 */
  155. .navbar-area {
  156. white-space: nowrap;
  157. .state-area {
  158. height: 7vh;
  159. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  160. z-index: 10;
  161. }
  162. .nav-item {
  163. flex: 1;
  164. &.active {
  165. &:after {
  166. content: '';
  167. position: absolute;
  168. left: 50%;
  169. transform: translate(-50%);
  170. bottom: 0;
  171. width: 44px;
  172. height: 0;
  173. border-bottom: 2px solid $base-color;
  174. }
  175. }
  176. }
  177. }
  178. .coupon_box {
  179. position: relative;
  180. &:last-child {
  181. margin-bottom: 20rpx;
  182. }
  183. .left {
  184. background-color: #6a92ff;
  185. color: #fff;
  186. width: 30%;
  187. .price {
  188. color: #fff !important;
  189. }
  190. }
  191. .right {
  192. margin-left: 30%;
  193. }
  194. .border-line {
  195. border-bottom: 1px dotted #ededed;
  196. }
  197. }
  198. /* 按钮样式 */
  199. .btn-receive {
  200. background: $base-color;
  201. color: #fff;
  202. font-weight: bold;
  203. }
  204. .btn-receive-disabled {
  205. background: #3dafcb;
  206. color: #fff;
  207. font-weight: bold;
  208. }
  209. .btn-container {
  210. left: 9px;
  211. right: 9px;
  212. bottom: 0;
  213. }
  214. .btn-exchange {
  215. background: #ff6ade;
  216. color: #fff;
  217. font-weight: bold;
  218. }
  219. </style>