index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <template>
  2. <Theme>
  3. <view class="wrap">
  4. <Navbar title="tabbar.订单" leftShow border fixed>
  5. <template #right>
  6. <navMenu :options="{ icon: 'icon-home', text: '主页' }" />
  7. </template>
  8. </Navbar>
  9. <!-- <view class="tops" id="tabs" :style="{ top: tabTop + 'px' }">
  10. <view class="tab">
  11. <Tab :active="actvieNum" keyName="text" :tabList="tabList" @confirm="tabClick" />
  12. </view>
  13. <view class="product_sort">
  14. <view class="sort_list" :class="sortActive == index ? 'sort_active' : ''" v-for="item, index in sortList"
  15. :key="index" @click="item.callback(item, index)">
  16. <trans :_t="item.text" />
  17. <template v-if="item.isTrue == 1">
  18. <view class="sort_arrow">
  19. <view class="sort_arrow_top"
  20. :style="defaultParams.sort == 'moneyAsc' ? { borderBottom: '4px solid #f0700c' } : {}"></view>
  21. <view class="sort_arrow_bottom"
  22. :style="defaultParams.sort == 'moneyDesc' ? { borderTop: '4px solid #f0700c' } : {}"></view>
  23. </view>
  24. </template>
  25. </view>
  26. </view>
  27. </view> -->
  28. <view class="content">
  29. <List
  30. url="/shop/search/recommend"
  31. :topHeight="tabHeight"
  32. :defaultParams="defaultParams"
  33. ref="listRef"
  34. >
  35. <template #item="{ item }">
  36. <shopList :channel="actvieNum" :item="item" />
  37. </template>
  38. </List>
  39. </view>
  40. </view>
  41. <Tabbar page="channel" />
  42. </Theme>
  43. </template>
  44. <script setup>
  45. import { ref, reactive, computed, onMounted, nextTick } from "vue";
  46. import Tabbar from "@/components/tabbar";
  47. import navMenu from "@/components/nav_menu";
  48. import Navbar from "@/components/navbar";
  49. import { onReachBottom } from "@dcloudio/uni-app";
  50. import List from "@/components/list";
  51. import { query, systemInfo } from "@/utils";
  52. import shopList from "../index/components/shop_list";
  53. import popup from "@/components/popup";
  54. import Tab from "@/components/tabs";
  55. const searchValue = ref("");
  56. const listRef = ref(null);
  57. const popupRef = ref(null);
  58. const actvieNum = ref(1);
  59. const tabHeight = ref(0);
  60. const tabTop = ref(44);
  61. const sortActive = ref(0);
  62. const tabList = ref([
  63. {
  64. icon: "icon-ds-1688",
  65. text: "1688",
  66. channel: 0,
  67. },
  68. {
  69. icon: "icon-ds-taobao",
  70. text: "淘宝",
  71. channel: 1,
  72. },
  73. {
  74. icon: "icon-ds-jd",
  75. text: "JD",
  76. channel: 3,
  77. },
  78. ]);
  79. const defaultParams = reactive({});
  80. const sortList = reactive([
  81. {
  82. text: "综合",
  83. sort: "",
  84. callback: (index) => {
  85. actvieNum.value = index;
  86. defaultParams.sort = "";
  87. nextTick(() => {
  88. listRef.value && listRef.value.handleRefresh();
  89. });
  90. },
  91. },
  92. {
  93. text: "价格",
  94. isTrue: 1,
  95. sort: "moneyDesc", // moneyAsc 升序
  96. callback: (item, index) => {
  97. priceClick(item, index);
  98. },
  99. },
  100. ]);
  101. const priceClick = (item, index) => {
  102. if (sortActive.value == index) {
  103. if (defaultParams.sort == "moneyAsc") {
  104. defaultParams.sort = "";
  105. sortActive.value = 0;
  106. } else {
  107. defaultParams.sort = "moneyAsc";
  108. }
  109. } else {
  110. sortActive.value = index;
  111. defaultParams.sort = item.sort;
  112. }
  113. nextTick(() => {
  114. listRef.value && listRef.value.handleRefresh();
  115. });
  116. };
  117. const tabClick = (item, index) => {
  118. defaultParams.channel = item.channel;
  119. if (actvieNum.value == index) return;
  120. actvieNum.value = index;
  121. nextTick(() => {
  122. listRef.value && listRef.value.handleRefresh();
  123. });
  124. };
  125. onMounted(() => {
  126. nextTick(async () => {
  127. tabTop.value = systemInfo().statusBarHeight;
  128. nextTick(() => {
  129. listRef.value && listRef.value.getData();
  130. });
  131. });
  132. });
  133. onReachBottom(() => {
  134. nextTick(() => {
  135. listRef.value && listRef.value.scrolltolower();
  136. });
  137. });
  138. uni.hideTabBar();
  139. </script>
  140. <style lang="less" scoped>
  141. @import url("@/style.less");
  142. .wrap {
  143. min-height: calc(100vh - 50px);
  144. background-color: var(--bg);
  145. .nav_center {
  146. width: calc(100% - 46px - 50px);
  147. .icon-camera {
  148. color: #adb8cc;
  149. font-size: 56rpx;
  150. }
  151. }
  152. .nav_right {
  153. .icon-font {
  154. .size(28px);
  155. color: var(--text);
  156. }
  157. }
  158. .tops {
  159. // position: fixed;
  160. // top: 44px;
  161. // left: 0;
  162. // right: 0;
  163. // background-color: var(--bg);
  164. // z-index: 1;
  165. .tab {
  166. padding: 0 24rpx;
  167. }
  168. .product_sort {
  169. .flex();
  170. padding: 24rpx 32rpx;
  171. .sort_list {
  172. color: var(--text);
  173. .size(24rpx);
  174. line-height: 40rpx;
  175. margin-right: 72rpx;
  176. padding: 16rpx 0;
  177. .ver();
  178. .sort_arrow {
  179. margin-left: 20rpx;
  180. &_top {
  181. border-bottom: 4px solid #adb8cc;
  182. border-left: 4px solid transparent;
  183. border-right: 4px solid transparent;
  184. font-size: 0;
  185. height: 0;
  186. line-height: 0;
  187. margin-bottom: 1px;
  188. width: 0;
  189. }
  190. &_bottom {
  191. border-left: 4px solid transparent;
  192. border-right: 4px solid transparent;
  193. border-top: 4px solid #adb8cc;
  194. font-size: 0;
  195. height: 0;
  196. line-height: 0;
  197. margin-top: 1px;
  198. width: 0;
  199. }
  200. }
  201. }
  202. .sort_active {
  203. color: var(--primary);
  204. }
  205. }
  206. }
  207. .content {
  208. padding: 16rpx 32rpx;
  209. /deep/ .wrap_list {
  210. .uni-scroll-view-content {
  211. > uni-view {
  212. .flex();
  213. flex-wrap: wrap;
  214. gap: 16rpx;
  215. .u-list-item {
  216. width: calc((100% - 16rpx) / 2);
  217. }
  218. }
  219. }
  220. }
  221. }
  222. }
  223. .pop_cont {
  224. color: var(--text);
  225. .size(28rpx);
  226. line-height: 60rpx;
  227. }
  228. .pop_tip {
  229. color: var(--text-01);
  230. .size(28rpx);
  231. line-height: 60rpx;
  232. }
  233. .pop_btn {
  234. margin-top: 32rpx;
  235. height: 76rpx;
  236. padding: 16rpx 30rpx;
  237. color: var(--primary);
  238. border: 1px solid var(--primary);
  239. border-radius: 16rpx;
  240. .size(24rpx);
  241. .flex_center();
  242. }
  243. </style>