my_gift.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <!-- +---------------------------------------------------------------------- -->
  2. <!-- | CRMEB [ CRMEB赋能开发者,助力企业发展 ] -->
  3. <!-- +---------------------------------------------------------------------- -->
  4. <!-- | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. -->
  5. <!-- +---------------------------------------------------------------------- -->
  6. <!-- | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 -->
  7. <!-- +---------------------------------------------------------------------- -->
  8. <!-- | Author: CRMEB Team <admin@crmeb.com> -->
  9. <!-- +---------------------------------------------------------------------- -->
  10. {extend name="public/container"}
  11. {block name="title"}我的赠送{/block}
  12. {block name="head"}
  13. <style>
  14. body {
  15. background: #F5F5F5;
  16. }
  17. </style>
  18. {/block}
  19. {block name="content"}
  20. <div v-cloak id="app" class="gift-given">
  21. <div class="list" v-if="updateGiftList.length">
  22. <a v-for="(item, index) in updateGiftList" :key="index" :href="item.path" class="item given">
  23. <div class="item-hd">
  24. <div v-if="item.is_draw">赠送成功</div>
  25. <div v-else>未赠送</div>
  26. <div v-if="item.is_draw">领取人:{{item.gift_user.nickname}}</div>
  27. <div v-else>去赠送</div>
  28. </div>
  29. <div class="item-bd">
  30. <div>
  31. <img :src="item.image" alt="">
  32. </div>
  33. <div class="text">
  34. <div class="title">{{ item.title }}</div>
  35. <div class="money">¥<span>{{ item.money }}</span></div>
  36. </div>
  37. </div>
  38. </a>
  39. </div>
  40. <div v-if="!updateGiftList.length && loaded" class="empty">
  41. <img src="{__WAP_PATH}zsff/images/empty.png" alt="暂无数据">
  42. <div>暂无数据</div>
  43. </div>
  44. <quick-menu></quick-menu>
  45. </div>
  46. {/block}
  47. {block name="foot"}
  48. <script>
  49. require(['vue', 'helper', 'store', 'quick'], function (Vue, helper, store) {
  50. var vm = new Vue({
  51. el: '#app',
  52. data: {
  53. page: 1,
  54. limit: 16,
  55. appear: true,
  56. giftList: [],
  57. loaded: false,
  58. loading: false,
  59. },
  60. computed: {
  61. updateGiftList: function () {
  62. var that = this;
  63. return this.giftList.map(function (value) {
  64. value.path = value.is_draw ? $h.U({ c: 'special', a: 'gift_receive', p: { orderId: value.order_id } }) : $h.U({ c: 'special', a: 'gift_special', q: { orderId: value.order_id } });
  65. return value;
  66. });
  67. }
  68. },
  69. created: function () {
  70. this.getGiftList();
  71. },
  72. mounted: function () {
  73. $h.EventUtil.listenTouchDirection(document, function () {
  74. this.loading == false && this.getGiftList();
  75. }.bind(this), false);
  76. },
  77. methods: {
  78. getGiftList: function () {
  79. var that = this;
  80. if (that.loading) return;
  81. if (that.loaded) return;
  82. that.loading = true;
  83. store.baseGet(helper.U({
  84. c: 'my',
  85. a: 'get_order_list',
  86. q: {
  87. page: that.page,
  88. limit: that.limit,
  89. type: 1
  90. }
  91. }), function (res) {
  92. var list = res.data.data.list;
  93. var giftList = $h.SplitArray(list, that.giftList);
  94. that.loaded = list.length < that.limit;
  95. that.page = res.data.data.page;
  96. that.loading = false;
  97. that.$set(that, 'giftList', giftList);
  98. }, function (res) {
  99. that.loading = false;
  100. });
  101. }
  102. }
  103. });
  104. });
  105. </script>
  106. {/block}