purchaserActivity.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <view class="purchaser-activity-container">
  3. <view class="search-bar">
  4. <text v-for="item in activityTimeList" :key="item.Id" :class="item.IsChoose ? 'active' : ''"
  5. @click="isActivityDate(item.Id)">{{ item.StatusName }}</text>
  6. <text v-for="item in activityTypeList" :key="item.Id" :class="item.IsChoose ? 'active' : ''"
  7. @click="isActivityType(item.Id)">{{ item.StatusName }}</text>
  8. </view>
  9. <view class="purchaser-activity-list">
  10. <purchaserActivityList style="width: 682rpx;" ref="purchaserActivityListRef" :whichDay="whichDay"
  11. :typeName="typeName">
  12. <view class="no-data-box">
  13. <view class="no-data">
  14. <image src="https://hzstatic.hzinsights.com/cygx/icon/activity-no-data.png" ></image>
  15. <text>暂无对应活动</text>
  16. </view>
  17. </view>
  18. </purchaserActivityList>
  19. </view>
  20. <Loading />
  21. </view>
  22. </template>
  23. <script>
  24. import purchaserActivityList from "@/components/activity/purchaserActivityList.vue"
  25. import { Throttle } from "@/config/util.js";
  26. import { activity } from "@/config/api";
  27. export default {
  28. components:{purchaserActivityList},
  29. data() {
  30. return {
  31. activityTimeList: [
  32. { Id: 1, IsChoose: false, StatusName: "今日活动" },
  33. { Id: 2, IsChoose: false, StatusName: "明日活动" },
  34. ],
  35. activityTypeList: [
  36. { Id: 3, IsChoose: false, StatusName: "公司调研电话会" }
  37. ],
  38. whichDay:'',
  39. typeName:''
  40. }
  41. },
  42. methods: {
  43. // 今日明日的点击事件
  44. isActivityDate(id) {
  45. this.activityTimeList.forEach((item) => {
  46. if (item.Id == id) item.IsChoose = !item.IsChoose;
  47. });
  48. const arr = [];
  49. this.activityTimeList.forEach((item) => item.IsChoose && arr.push(item.Id));
  50. this.whichDay = arr.join(",");
  51. this.typeName=""
  52. this.activityTypeList.map(item =>{
  53. item.IsChoose=false
  54. })
  55. this.$nextTick(()=>{
  56. this.$refs.purchaserActivityListRef.reloadActivityList();
  57. })
  58. },
  59. isActivityType(id){
  60. this.activityTypeList.forEach((item) => {
  61. if (item.Id == id) item.IsChoose = !item.IsChoose;
  62. });
  63. const arr = [];
  64. this.activityTypeList.forEach((item) => item.IsChoose && arr.push(item.Id));
  65. this.typeName = arr.join(",");
  66. this.whichDay=""
  67. this.activityTimeList.map(item =>{
  68. item.IsChoose=false
  69. })
  70. this.$nextTick(()=>{
  71. this.$refs.purchaserActivityListRef.reloadActivityList();
  72. })
  73. },
  74. loadShare(option){
  75. // if(!option) return
  76. this.whichDay = option.whichDay || ""
  77. let whichDayArr = this.whichDay.split(',')
  78. this.typeName = option.typeName || ""
  79. let typeNameArr = this.typeName.split(',')
  80. this.activityTimeList.map(item =>{
  81. item.IsChoose= whichDayArr.includes(item.Id+'')
  82. })
  83. this.activityTypeList.forEach((item) => {
  84. item.IsChoose= typeNameArr.includes(item.Id+'')
  85. });
  86. this.$nextTick(()=>{
  87. this.$refs.purchaserActivityListRef.reloadActivityList();
  88. })
  89. }
  90. },
  91. /** 用户点击分享 */
  92. onShareAppMessage: function (res) {
  93. return {
  94. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : "近期所有研选活动预告",
  95. path: "/pages-purchaser/purchaserActivity/purchaserActivity?whichDay=" + this.whichDay + "&typeName=" + this.typeName,
  96. };
  97. },
  98. onLoad(option) {
  99. this.loadShare(option);
  100. },
  101. onReachBottom: Throttle(function () {
  102. if (this.$refs.purchaserActivityListRef.page_no >= this.$refs.purchaserActivityListRef.pages) return;
  103. this.$refs.purchaserActivityListRef.loadActivityMore();
  104. }),
  105. }
  106. </script>
  107. <style lang="scss" scoped>
  108. .purchaser-activity-container{
  109. background-color: $uni-bg-color;
  110. min-height: 100vh;
  111. // height: 100vh;
  112. .search-bar{
  113. width: 100vw;
  114. height: 82rpx;
  115. display: flex;
  116. align-items: center;
  117. padding: 0 34rpx;
  118. background-color: white;
  119. position: sticky;
  120. top: 0;
  121. text {
  122. // width: 136rpx;
  123. min-width: 136rpx;
  124. padding: 4rpx 20rpx;
  125. height: 42rpx;
  126. text-align: center;
  127. line-height: 34rpx;
  128. background-color: #f8f8fa;
  129. box-sizing: border-box;
  130. border-radius: 44rpx;
  131. margin-right: 20rpx;
  132. font-size: 24rpx;
  133. white-space: nowrap;
  134. }
  135. .active {
  136. background-color: #376cbb;
  137. color: #fff;
  138. }
  139. }
  140. .purchaser-activity-list{
  141. padding: 20rpx 34rpx 36rpx;
  142. .no-data-box{
  143. width: 682rpx;
  144. // height: 100%;
  145. border-radius: 16rpx;
  146. background-color: white;
  147. display: flex;
  148. flex-direction: column;
  149. align-items: center;
  150. justify-content: center;
  151. .no-data{
  152. display: flex;
  153. flex-direction: column;
  154. align-items: center;
  155. justify-content: center;
  156. height: calc(100vh - 138rpx);
  157. image{
  158. width: 412rpx;
  159. height: 380rpx;
  160. margin-bottom: 40rpx;
  161. }
  162. text{
  163. font-size: 24rpx;
  164. line-height: 34rpx;
  165. color: #999999;
  166. }
  167. }
  168. }
  169. }
  170. }
  171. </style>