index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <!-- 活动列表 -->
  2. <template>
  3. <!-- 现场经理或未登录显示 -->
  4. <navigator style="margin-top: 100upx;" v-if="isTrader2 == 1" url="../login/index"
  5. class="main_btn_m get_phone to_login">
  6. 去登陆商户</navigator>
  7. <view v-else>
  8. <view class="loading_text" v-if="loading">加载中...</view>
  9. <view v-else>
  10. <!-- 非商户 -->
  11. <view class="main_width" v-if="sys_role==0">
  12. <navigator class="nav" :url="'./detail?id='+item.id" v-for="item in data" :key="item.id">
  13. <image style="width: 100%;height: 300rpx;" :src="item.list_photos[0]['url']"></image>
  14. <view class="title">
  15. <view style="color: white;" class="text_in_width nowrap">{{item.title}}
  16. </view>
  17. </view>
  18. </navigator>
  19. </view>
  20. <view v-else>
  21. <!-- 非现场经理商家显示 -->
  22. <view>
  23. <navigator :style="'background-color:'+(style_arr[index%4]['bgc'])" :url="'./detail?id='+item.id"
  24. v-for="(item, index) in data" :key="item.id" class="mer_each">
  25. <view style="height: 50upx;"></view>
  26. <view class="big_title" :style="'color:'+(style_arr[index%4]['color'])">
  27. {{item.title}}
  28. </view>
  29. <view class="small_title" :style="'margin-top: 20upx;color:'+(style_arr[index%4]['color'])">
  30. {{item.title2}}
  31. </view>
  32. </navigator>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="loading_text" v-if="data.length==0&&!loading">暂无数据</view>
  37. </view>
  38. </template>
  39. <script>
  40. import commonData from '../../commonData.js'
  41. import commonFun from '../../commonFun.js'
  42. export default {
  43. data() {
  44. return {
  45. loading: true,
  46. isTrader2: 2,
  47. FOREND_TOKEN: 'a',
  48. sys_role: commonData.sys_role,
  49. style_arr: [{
  50. color: '#00C7B2',
  51. bgc: '#f5fefb',
  52. },
  53. {
  54. color: '#fd653c',
  55. bgc: '#fff8f6',
  56. },
  57. {
  58. color: '#ffb90b',
  59. bgc: '#fffdf1',
  60. },
  61. {
  62. color: '#00a5ad',
  63. bgc: '#efffff',
  64. },
  65. ],
  66. data: [],
  67. }
  68. },
  69. methods: {
  70. get_data() {
  71. if (this.isTrader2 == 1 || this.FOREND_TOKEN == '') {
  72. uni.stopPullDownRefresh()
  73. return
  74. }
  75. this.loading = true
  76. uni.showLoading({
  77. title: '加载中...',
  78. mask: true
  79. })
  80. let params = {
  81. bizCatalog: this.sys_role == 0 ? 'MActivityEntity' : 'TraServiceEntity',
  82. handleMode: 'fetchall',
  83. pageIndex: 1,
  84. pageSize: 1000,
  85. orderby: 0,
  86. nowLngLat: "117.68898010253906,39.0351862510659",
  87. query: {
  88. status: 5
  89. }
  90. }
  91. console.log('营销活动列表请求参数')
  92. console.log(params)
  93. commonFun.requestUrl('&WsAjaxBiz=' + (this.sys_role == 1 ? 'Trader' : 'Public') +
  94. '&WsAjaxAction=fetchPageData', params, res => {
  95. if (res.status) {
  96. this.data = res.data.Result.pageData
  97. console.log('营销活动获取数据')
  98. console.log(this.data)
  99. }
  100. this.loading = false
  101. uni.hideLoading()
  102. uni.stopPullDownRefresh()
  103. })
  104. },
  105. },
  106. onLoad() {
  107. if (this.sys_role == 1) {
  108. uni.setNavigationBarTitle({
  109. title: '服务'
  110. })
  111. }
  112. },
  113. onShow() {
  114. let isTrader2 = uni.getStorageSync('isTrader2') || 2 //设置isTrader2为是否是现场经理
  115. this.isTrader2 = isTrader2
  116. if (isTrader2 != 1) {
  117. this.get_data()
  118. }
  119. },
  120. onPullDownRefresh() {
  121. if (this.isTrader2 != 1) {
  122. this.get_data()
  123. }
  124. },
  125. }
  126. </script>
  127. <style>
  128. .big_title {
  129. font-size: 34upx !important;
  130. }
  131. .small_title {
  132. font-size: 28upx !important;
  133. margin-top: 15upx;
  134. }
  135. .mer_each view {
  136. padding:0 24upx;
  137. white-space: nowrap;
  138. overflow: hidden;
  139. text-overflow: ellipsis;
  140. }
  141. .mer_each {
  142. width: 336upx;
  143. height: 221upx;
  144. background-color: #f7fdfb;
  145. border-radius: 12upx;
  146. float: left;
  147. margin-left: 26upx;
  148. margin-top: 26upx;
  149. overflow: hidden;
  150. }
  151. .nav {
  152. position: relative;
  153. border-radius: 15upx;
  154. overflow: hidden;
  155. margin-top: 30upx;
  156. }
  157. .title {
  158. color: white;
  159. background-color: rgba(0, 0, 0, 0.4);
  160. text-align: left;
  161. width: 100%;
  162. line-height: 70upx;
  163. position: absolute;
  164. bottom: 10upx;
  165. left: 0;
  166. }
  167. </style>