search.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. <template>
  2. <view class="index-content" style="background: #FFFFFF;">
  3. <view class="tui-tabs">
  4. <scroll-view id="tab-bar" scroll-with-animation class="tui-scroll-h" :scroll-x="true"
  5. :show-scrollbar="false" style="border-bottom: 2upx solid #F8F8F8;">
  6. <view style="display: flex;">
  7. <view v-for="(tab, index) in tab" :data-current="index" @tap="tabSelect" :data-id="index">
  8. <view class="tui-tab-item-title" style="margin-left: 100upx;"
  9. :class="{ 'tui-tab-item-title-active': index == TabCur }">{{ tab.name }}</view>
  10. </view>
  11. </view>
  12. </scroll-view>
  13. </view>
  14. <view style="display: flex;flex-wrap: wrap;margin-top: 80upx;">
  15. <view
  16. style="width: 345upx;height: 550upx;background-color: #FFFFFF; border-radius: 20upx;margin-left: 20upx; margin-top: 20upx;box-shadow: rgba(183, 183, 183, 0.3) 1px 1px 10px 1px;"
  17. @tap='goDetail(item.id)' v-for="(item,index) in couponlist" :key='index' v-if="couponlist.length > 0">
  18. <image :src="item.coverImg"
  19. style="width: 345upx;height: 340upx;border-top-left-radius:20upx;border-top-right-radius:20upx;">
  20. </image>
  21. <view style="padding: 16upx 2upx 16upx 16upx;">
  22. <view style="width: 100%;height: 60upx;">
  23. <text class="limapboxqing2"><text class="indexr"
  24. style=""><text>自营</text></text>{{ item.title }}</text>
  25. </view>
  26. </view>
  27. <!-- <view v-if="isEnable != '否'">
  28. <view v-if="item.descrition != ''"
  29. style="font-size: 26upx;color:#FB2C1C;margin: 6upx 10upx;border:1px solid #FB2C1C;border-radius: 7upx;width: max-content;text-align: center;padding: 1upx 10upx 1upx 10upx;">
  30. 预估返{{item.descrition}}</view>
  31. <view
  32. :style=" item.descrition != '' ? 'padding: 0rpx 15rpx;display: flex;margin:10rpx 0' : 'padding: 0rpx 15rpx;display: flex;margin:60rpx 0'">
  33. <view v-if="relation"
  34. style="width: 40%;font-size: 38upx;color: #FF2A47;font-weight: 700;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
  35. ¥{{item.memberPrice}}</view>
  36. <view v-if='!relation'
  37. style="width: 40%;font-size: 38upx;color: #FF2A47;font-weight: 700;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
  38. ¥{{item.price}}</view>
  39. <view
  40. style="width: 60%;font-size: 24upx;color: #999999;margin-top: 10upx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;text-align: right;">
  41. {{item.sales}}人已购买
  42. </view>
  43. </view>
  44. </view> -->
  45. <view>
  46. <view style="padding: 0rpx 15rpx;display: flex;margin:60rpx 0">
  47. <view
  48. style="width: 40%;font-size: 38upx;color: #FF2A47;font-weight: 700;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
  49. ¥{{item.price}}</view>
  50. <view
  51. style="width: 60%;font-size: 24upx;color: #999999;margin-top: 10upx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;text-align: right;">
  52. {{item.sales}}人已购买
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. <!-- 悬浮上拉 -->
  58. <view class="scroll_top" @tap="topScrollTap" v-bind:class="[scrollTop ? 'active' : '','']"
  59. style="bottom: 56px;">
  60. <text class="iconfont icon-shangla"></text>
  61. </view>
  62. <!-- 加载更多提示 -->
  63. <view class="s-col is-col-24" v-if="couponlist.length > 0">
  64. <load-more :loadingType="loadingType" :contentText="contentText"></load-more>
  65. </view>
  66. <!-- 加载更多提示 -->
  67. <empty style="width: 100%;" v-if="couponlist.length === 0" des="暂无数据" show="false"></empty>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. export default {
  73. data() {
  74. return {
  75. show: false,
  76. relation: false,
  77. //综合createAt 销量sales 佣金比例commissionPrice 超低价price
  78. tab: [{
  79. name: '综合',
  80. id: '0',
  81. status: 'createAt'
  82. },
  83. {
  84. name: '销量',
  85. id: '1',
  86. status: 'sales'
  87. },
  88. {
  89. name: '佣金',
  90. id: '2',
  91. status: 'commissionPrice'
  92. },
  93. {
  94. name: '超低价',
  95. id: '3',
  96. status: 'price'
  97. }
  98. ],
  99. status: 'createAt',
  100. TabCur: 0,
  101. scrollLeft: 0,
  102. scrollTop: false,
  103. couponlist: [],
  104. page: 0,
  105. size: 10,
  106. cid: 1,
  107. isInvitation: 0,
  108. loadingType: 0,
  109. isEnable: '否',
  110. contentText: {
  111. contentdown: "上拉显示更多",
  112. contentrefresh: "正在加载...",
  113. contentnomore: "没有更多数据了"
  114. }
  115. }
  116. },
  117. onLoad: function(e) {
  118. uni.showLoading({
  119. title: '加载中...'
  120. });
  121. let a = this.$queue.getData("isEnable")
  122. if (a) {
  123. this.isEnable = a;
  124. }
  125. this.cid = e.cid;
  126. uni.setNavigationBarTitle({
  127. title: e.name
  128. });
  129. this.getGoodsList();
  130. },
  131. onPageScroll: function(e) {
  132. this.scrollTop = e.scrollTop > 200;
  133. },
  134. methods: {
  135. goDetail(id) {
  136. uni.navigateTo({
  137. url: '../index/commoditydetail?ordersId=' + id
  138. });
  139. },
  140. getGoodsList(type) {
  141. this.loadingType = 1;
  142. this.$Request.getT('/app/goods/userList?page=' + this.page + '&size=10' + '&type=' + this.cid + '&title=' +
  143. '&sort=' +
  144. this.status).then(
  145. res => {
  146. if (res.status === 0) {
  147. if (this.page === 0 || res.status) {
  148. this.couponlist = [];
  149. }
  150. let grade = this.$queue.getData('grade');
  151. res.data.content.forEach(d => {
  152. d.descrition = '';
  153. if (d.commissionPrice != 0) {
  154. d.descrition = parseFloat(d.commissionPrice).toFixed(2);
  155. }
  156. this.couponlist.push(d);
  157. });
  158. if (res.data.content.length === this.size) {
  159. this.loadingType = 0;
  160. } else {
  161. this.loadingType = 3;
  162. }
  163. } else {
  164. this.loadingType = 2;
  165. }
  166. uni.hideLoading();
  167. if (type === "Refresh") {
  168. uni.stopPullDownRefresh(); // 停止刷新
  169. }
  170. });
  171. },
  172. tabSelect(e) {
  173. this.TabCur = e.currentTarget.dataset.id;
  174. this.status = this.tab[this.TabCur].status;
  175. this.page = 0;
  176. uni.showLoading({
  177. title: '加载中...'
  178. });
  179. this.getGoodsList();
  180. //#ifdef H5
  181. uni.pageScrollTo({
  182. scrollTop: 0,
  183. duration: 300
  184. });
  185. //#endif
  186. },
  187. topScrollTap: function() {
  188. uni.pageScrollTo({
  189. scrollTop: 0,
  190. duration: 300
  191. });
  192. },
  193. navigateBack: function() {
  194. uni.navigateBack();
  195. },
  196. },
  197. onReachBottom: function() {
  198. this.page = this.page + 1;
  199. this.getGoodsList('');
  200. },
  201. onPullDownRefresh: function() {
  202. this.page = 0;
  203. this.getGoodsList("Refresh");
  204. }
  205. }
  206. </script>
  207. <style lang="less">
  208. @import '../../../../static/less/index.less';
  209. @import '../../../../static/css/index.css';
  210. page {
  211. background: #FFFFFF;
  212. }
  213. .limapboxqing2 {
  214. font-size: 28upx;
  215. color: #333333;
  216. overflow: hidden;
  217. text-overflow: ellipsis;
  218. display: -webkit-box;
  219. -webkit-line-clamp: 2;
  220. -webkit-box-orient: vertical;
  221. }
  222. .indexr {
  223. color: #FFFFFF;
  224. font-size: 22upx;
  225. padding-left: 12upx;
  226. display: inline-block;
  227. padding-right: 13upx;
  228. border-radius: 8upx;
  229. margin-right: 8upx;
  230. padding-top: 4upx;
  231. line-height: 38upx;
  232. background: -moz-linear-gradient(left, #FB2C1A 0, #FF2A46 100%);
  233. background: -webkit-gradient(linear, left top, left right, color-stop(0, #FB2C1A), color-stop(100%, #FF2A46));
  234. background: -webkit-linear-gradient(left, #FB2C1A 0, #FF2A46 100%);
  235. background: -o-linear-gradient(left, #FB2C1A 0, #FF2A46 100%);
  236. background: -ms-linear-gradient(left, #FB2C1A 0, #FF2A46 100%);
  237. background: linear-gradient(to left, #FB2C1A 0, #FF2A46 100%);
  238. }
  239. .tui-tabs {
  240. flex: 1;
  241. flex-direction: column;
  242. overflow: hidden;
  243. background-color: #fafafa;
  244. /* #ifdef MP-ALIPAY || MP-BAIDU */
  245. height: 100vh;
  246. /* #endif */
  247. }
  248. .tui-scroll-h {
  249. width: 750rpx;
  250. height: 80rpx;
  251. background-color: #ffffff;
  252. flex-direction: row;
  253. /* #ifndef APP-PLUS */
  254. white-space: nowrap;
  255. /* #endif */
  256. /* #ifdef APP-PLUS */
  257. position: fixed;
  258. top: 0px;
  259. left: 0;
  260. z-index: 999;
  261. /* #endif */
  262. /* #ifdef H5 */
  263. position: fixed;
  264. top: 44px;
  265. left: 0;
  266. z-index: 999;
  267. /* #endif */
  268. /* #ifdef MP-WEIXIN */
  269. position: fixed;
  270. top: 0;
  271. left: 0;
  272. z-index: 999;
  273. /* #endif */
  274. }
  275. .tui-line-h {
  276. /* #ifdef APP-PLUS */
  277. height: 1rpx;
  278. background-color: #cccccc;
  279. /* #endif */
  280. position: relative;
  281. }
  282. /* #ifndef APP-PLUS*/
  283. .tui-line-h::after {
  284. content: '';
  285. position: absolute;
  286. border-bottom: 1rpx solid #cccccc;
  287. -webkit-transform: scaleY(0.5);
  288. transform: scaleY(0.5);
  289. bottom: 0;
  290. right: 0;
  291. left: 0;
  292. }
  293. /* #endif */
  294. .tui-tab-item {
  295. /* #ifndef APP-PLUS */
  296. display: flex;
  297. /* #endif */
  298. }
  299. .tui-tab-item-title {
  300. color: #555;
  301. font-size: 30rpx;
  302. height: 80rpx;
  303. line-height: 80rpx;
  304. flex-wrap: nowrap;
  305. /* #ifndef APP-PLUS */
  306. white-space: nowrap;
  307. /* #endif */
  308. }
  309. .tui-tab-item-title-active {
  310. color: #E10A07;
  311. font-size: 32upx;
  312. font-weight: bold;
  313. border-bottom-width: 6upx;
  314. text-align: center;
  315. }
  316. </style>