index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <Theme>
  3. <view class="wrap">
  4. <Navbar autoBack fixed leftShow>
  5. <template #center>
  6. <view class="nav_title">
  7. <trans _t="tabbar.订单" />
  8. </view>
  9. <view class="bg_logo">{{ verConfig.appNames }}</view>
  10. </template>
  11. <template #right>
  12. <uni-icons
  13. type="search"
  14. color="var(--light)"
  15. size="24"
  16. @click="toOrder"
  17. ></uni-icons>
  18. </template>
  19. </Navbar>
  20. <Tab
  21. :active="actvieNum"
  22. keyName="text"
  23. :tabList="tabList"
  24. @confirm="tabClick"
  25. id="tabs"
  26. />
  27. <template v-if="actvieNum == 0">
  28. <OrderList
  29. :tabHeight="tabHeight"
  30. :tabbarHeight="tabbarHeight"
  31. :tabParams="tabParams"
  32. navShow
  33. />
  34. <!-- <view class="content">
  35. <List url="/shop/order/list" :topHeight="tabHeight" :defaultParams="defaultParams" ref="listRef"
  36. @datas="getList">
  37. <template #item="{ item }">
  38. <OrderList :item="item" @on-check="onCheck" />
  39. </template>
  40. </List>
  41. </view> -->
  42. </template>
  43. <template v-else-if="actvieNum == 1">
  44. <OrderList2 navShow />
  45. </template>
  46. <template v-else-if="actvieNum == 2">
  47. <OrderList3 :tabHeight="tabHeight" :tabParams="tabParams" navShow />
  48. </template>
  49. <!-- <OrderCompleted class="order_completed" /> -->
  50. </view>
  51. <Tabbar page="order" @getTabbarHeight="getTabbarHeight" />
  52. </Theme>
  53. </template>
  54. <script setup>
  55. import Tabbar from "@/components/tabbar";
  56. import { ref, computed, onMounted, nextTick, reactive } from "vue";
  57. import Tab from "@/components/tabs";
  58. import OrderList from "../dashboard/order.vue";
  59. import OrderList2 from "../dashboard/warehouse.vue";
  60. import OrderList3 from "../dashboard/parcel.vue";
  61. import { query } from "@/utils";
  62. import verConfig from "@/ver.config";
  63. import { t } from "@/locale";
  64. import Navbar from "@/components/navbar";
  65. import { onShow } from "@dcloudio/uni-app";
  66. import { useShopStore } from "@/store";
  67. // import OrderCompleted from './components/OrderCompleted.vue';
  68. const useShop = useShopStore();
  69. const tabParams = computed(() => useShop.getTabParams);
  70. const tabHeight = ref(0);
  71. uni.hideTabBar();
  72. const tabList = ref([
  73. {
  74. //text: t('代购订单'),
  75. text: "我的订单",
  76. channel: 0,
  77. },
  78. {
  79. text: "商品仓库",
  80. channel: 1,
  81. },
  82. {
  83. text: "集运包裹",
  84. channel: 2,
  85. url: "/shop/packages/lists",
  86. },
  87. ]);
  88. const actvieNum = ref(0);
  89. const actvieUrl = ref("/shop/order/list");
  90. const defaultParams = reactive({
  91. begin: "",
  92. end: "",
  93. keywords: "",
  94. status: "",
  95. });
  96. const dataList = ref([]);
  97. const listRef = ref(null);
  98. const tabbarHeight = ref(0);
  99. const getList = (list) => {
  100. dataList.value = list;
  101. };
  102. const getTabbarHeight = (height) => {
  103. tabbarHeight.value = height;
  104. };
  105. const tabClick = (item, index) => {
  106. actvieUrl.value = item.url;
  107. defaultParams.channel = item.channel;
  108. if (actvieNum.value == index) return;
  109. actvieNum.value = item.channel;
  110. // nextTick(() => {
  111. // listRef.value && listRef.value.handleRefresh();
  112. // })
  113. };
  114. const onCheck = (item) => {
  115. uni.navigateTo({ url: `/pages/order/details?oid=${item.orderId}` });
  116. };
  117. const toOrder = () => {
  118. uni.navigateTo({ url: `/pages/dashboard/order` });
  119. };
  120. onMounted(() => {
  121. nextTick(async () => {
  122. const res = await query("#tabs", this);
  123. tabHeight.value = res.height;
  124. actvieNum.value = useShop.tabParams?.tab || 0;
  125. // nextTick(() => {
  126. // listRef.value && listRef.value.handleRefresh();
  127. // })
  128. });
  129. });
  130. onShow(() => {
  131. nextTick(() => {
  132. actvieNum.value = useShop.tabParams?.tab || 0;
  133. // listRef.value && listRef.value.handleRefresh();
  134. });
  135. });
  136. </script>
  137. <style lang="less" scoped>
  138. @import url("@/style.less");
  139. .wrap {
  140. background: var(--bg);
  141. // overflow: hidden;
  142. min-height: 100vh;
  143. .flex();
  144. flex-direction: column;
  145. .order_completed {
  146. position: fixed;
  147. top: 600rpx;
  148. right: 0rpx;
  149. z-index: 999;
  150. }
  151. :deep(.u-navbar__content) {
  152. background-color: var(--black) !important;
  153. }
  154. .tab {
  155. background-color: var(--black);
  156. }
  157. .nav_title {
  158. color: var(--light);
  159. }
  160. .bg_logo {
  161. position: absolute;
  162. .size(128rpx);
  163. color: var(--inputBg);
  164. opacity: 0.06;
  165. top: 0;
  166. left: 50%;
  167. font-weight: bold;
  168. transform: translateX(-50%);
  169. line-height: 88rpx;
  170. text-transform: uppercase;
  171. font-family: "HarmonyOS_Sans";
  172. text-wrap: nowrap;
  173. }
  174. /deep/ .tab {
  175. .tab_list {
  176. font-weight: 500;
  177. padding: 26rpx 0;
  178. }
  179. .active {
  180. color: var(--light);
  181. &::before {
  182. background-color: var(--light);
  183. height: 4rpx;
  184. width: 38rpx;
  185. margin: 16rpx auto;
  186. }
  187. }
  188. }
  189. .content {
  190. /deep/ .wrap_list {
  191. .uni-scroll-view-content {
  192. > uni-view {
  193. .flex();
  194. flex-wrap: wrap;
  195. gap: 24rpx;
  196. padding: 24rpx 32rpx;
  197. .u-list-item {
  198. width: calc((100% - 48rpx) / 3);
  199. }
  200. }
  201. }
  202. }
  203. }
  204. }
  205. </style>