建材商城系统20241014
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

341 lines
8.5 KiB

7 months ago
7 months ago
7 months ago
7 months ago
  1. <template>
  2. <view class="page">
  3. <view class="red-top">
  4. <view class="building-title">
  5. <view class="title-right">
  6. 建材
  7. </view>
  8. <view class="title-left">
  9. 寻找你想要的建材材料
  10. </view>
  11. </view>
  12. <view class="building-search">
  13. <view class="address">
  14. <image src="../../static/image/home/1.png" mode=""></image>
  15. <view class="eare">
  16. <text>深圳</text>
  17. </view>
  18. <view class="down-arrow"></view>
  19. </view>
  20. <view class="search">
  21. <!-- DC2828 -->
  22. <uv-search bgColor="#ffffff" placeholder="搜索材料" inputAlign="left" height="70"
  23. showAction="false"></uv-search>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="image-home">
  28. <uv-swiper class="uv-swaip"
  29. keyName="image"
  30. height="350rpx" :list="bannerList" circular bgColor="#ffffff">
  31. </uv-swiper>
  32. </view>
  33. <view class="building-class">
  34. <view style="width: 710rpx;">
  35. <uv-grid :col="4" :border="false">
  36. <uv-grid-item v-for="(item, index) in menuList" :key="index"
  37. @click="menuClick(item)">
  38. <image class="image" :src="item.image" mode=""></image>
  39. <text class="grid-text">{{item.title}}</text>
  40. </uv-grid-item>
  41. </uv-grid>
  42. </view>
  43. </view>
  44. <view class="hot-building">
  45. <text>热卖建材</text>
  46. </view>
  47. <view class="productList">
  48. <productItem
  49. @click="$utils.navigateTo(`/pages_order/product/productDetail?id=${item.id}`)"
  50. :item="item" v-for="(item, index) in list" :key="index"/>
  51. </view>
  52. <PrivacyAgreementPoup />
  53. <quick-order-entry
  54. @click="handleQuickOrderClick"
  55. @order-loaded="handleOrderLoaded"
  56. ref="quickOrderEntry"
  57. />
  58. <tabber select="home" />
  59. </view>
  60. </template>
  61. <script>
  62. import PrivacyAgreementPoup from '@/components/config/PrivacyAgreementPoup.vue'
  63. import tabber from '@/components/base/tabbar.vue'
  64. import QuickOrderEntry from '@/components/QuickOrderEntry.vue'
  65. import productItem from '@/components/productItem.vue'
  66. import mixinsList from '@/mixins/list.js'
  67. export default {
  68. mixins: [mixinsList],
  69. components: {
  70. tabber,
  71. PrivacyAgreementPoup,
  72. QuickOrderEntry,
  73. productItem,
  74. },
  75. data() {
  76. return {
  77. keyword: '',
  78. bannerList : [],
  79. menuList: [],
  80. mixinsListApi: 'getProductList',
  81. hasNewOrderMessage: false,
  82. orderMessageCount: 0
  83. }
  84. },
  85. computed: {
  86. },
  87. onShow() {
  88. this.getBanner()
  89. this.getMenu()
  90. if(uni.getStorageSync('token')){
  91. // 刷新快捷下单信息
  92. this.refreshQuickOrder()
  93. }
  94. },
  95. methods: {
  96. // 获取轮播图
  97. getBanner() {
  98. this.$api('getBanner', res => {
  99. if (res.code == 200) {
  100. this.bannerList = res.result
  101. }
  102. })
  103. },
  104. // 获取菜单
  105. getMenu() {
  106. this.$api('getIcon', res => {
  107. if (res.code == 200) {
  108. this.menuList = res.result
  109. }
  110. })
  111. },
  112. toUrl() {
  113. uni.navigateTo({
  114. url: '/pages_order/order/fastCreateOrder'
  115. })
  116. },
  117. toGoodInfo(item, index) {
  118. uni.navigateTo({
  119. url: `/pages_order/product/productDetail?id=${item.id}`
  120. })
  121. },
  122. menuClick(item){
  123. uni.navigateTo({
  124. url: `/pages_order/product/productList?title=${item.title}&iconId=${item.id}`
  125. })
  126. // if(!item.url){
  127. // return
  128. // }
  129. // uni.navigateTo({
  130. // url: item.url,
  131. // })
  132. },
  133. // 刷新快捷下单信息
  134. refreshQuickOrder() {
  135. if (this.$refs.quickOrderEntry) {
  136. this.$refs.quickOrderEntry.refresh();
  137. }
  138. },
  139. // 快捷下单按钮点击
  140. handleQuickOrderClick() {
  141. console.log('快捷下单按钮点击');
  142. // 组件内部已处理清除消息
  143. },
  144. // 订单信息加载完成
  145. handleOrderLoaded(orderList) {
  146. console.log('获取到快捷下单列表', orderList);
  147. if (Array.isArray(orderList) && orderList.length > 0) {
  148. // 可以在这里处理订单列表数据
  149. // 例如:筛选、排序或显示提示等
  150. }
  151. },
  152. }
  153. }
  154. </script>
  155. <style scoped lang="scss">
  156. .red-top {
  157. position: relative;
  158. height: 420rpx;
  159. background: linear-gradient(to bottom, $uni-color, #f05a45);
  160. border-bottom-left-radius: 100rpx;
  161. border-bottom-right-radius: 100rpx;
  162. z-index: -1;
  163. .building-title {
  164. position: absolute;
  165. height: 100rpx;
  166. width: 100%;
  167. margin-top: 100rpx;
  168. .title-right {
  169. color: $uni-bg-color;
  170. height: 100rpx;
  171. line-height: 100rpx;
  172. font-size: 45rpx;
  173. font-weight: 900;
  174. margin-left: 30rpx;
  175. display: inline-block;
  176. }
  177. .title-left {
  178. display: inline-block;
  179. margin-left: 30rpx;
  180. font-size: 22rpx;
  181. color: $uni-bg-color;
  182. }
  183. }
  184. .building-search {
  185. position: absolute;
  186. height: 100rpx;
  187. width: 100%;
  188. margin-top: 200rpx;
  189. // background-color: black;
  190. .address {
  191. height: 100rpx;
  192. width: 150rpx;
  193. position: relative;
  194. display: flex;
  195. align-items: center;
  196. image {
  197. position: absolute;
  198. height: 20rpx;
  199. width: 15rpx;
  200. line-height: 20rpx;
  201. left: 40rpx;
  202. top: 42rpx;
  203. }
  204. .eare {
  205. width: 100rpx;
  206. height: 100rpx;
  207. line-height: 100rpx;
  208. margin-left: 60rpx;
  209. color: $uni-bg-color;
  210. }
  211. .down-arrow:after {
  212. content: "";
  213. display: inline-block;
  214. width: 0;
  215. height: 0;
  216. border-left: 10rpx solid transparent;
  217. border-right: 10rpx solid transparent;
  218. border-top: 15rpx solid $uni-bg-color;
  219. margin-top: 5rpx;
  220. position: absolute;
  221. top: 42rpx;
  222. left: 130rpx;
  223. }
  224. }
  225. .search {
  226. display: inline-block;
  227. position: absolute;
  228. top: 16rpx;
  229. left: 26%;
  230. width: 70%;
  231. :deep(.uv-search__content) {
  232. box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.1);
  233. }
  234. }
  235. }
  236. }
  237. .image-home {
  238. z-index: 1;
  239. margin: 0 20rpx;
  240. margin-top: -90rpx;
  241. border-radius: 20rpx;
  242. overflow: hidden;
  243. box-shadow: 0 10rpx 20rpx rgba(0, 0, 0, 0.1);
  244. }
  245. .building-class {
  246. height: 220rpx;
  247. display: flex;
  248. justify-content: space-around;
  249. align-items: center;
  250. /* 垂直居中 */
  251. background-color: $uni-bg-color;
  252. margin: 20rpx 0;
  253. border-radius: 20rpx;
  254. box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.05);
  255. image {
  256. margin-left: 20rpx;
  257. margin-right: 20rpx;
  258. margin-bottom: 10rpx;
  259. width: 90rpx;
  260. height: 90rpx;
  261. display: inline-block;
  262. transition: transform 0.3s;
  263. &:hover {
  264. transform: scale(1.05);
  265. }
  266. }
  267. .grid-text {
  268. margin-top: 4rpx;
  269. font-size: 26rpx;
  270. font-weight: 500;
  271. color: #333;
  272. }
  273. }
  274. .text-building {
  275. display: flex;
  276. justify-content: space-around;
  277. align-items: center;
  278. /* 垂直居中 */
  279. background-color: $uni-bg-color;
  280. text-align: center;
  281. font-weight: 500;
  282. margin-bottom: -30rpx;
  283. padding-bottom: 40rpx;
  284. // overflow: hidden;
  285. }
  286. .hot-building {
  287. margin-top: 25rpx;
  288. height: 80rpx;
  289. background-color: $uni-bg-color;
  290. display: flex;
  291. align-items: center;
  292. padding-left: 40rpx;
  293. font-size: 35rpx;
  294. font-weight: 600;
  295. color: #333;
  296. position: relative;
  297. &::after {
  298. content: '';
  299. position: absolute;
  300. left: 40rpx;
  301. bottom: 15rpx;
  302. width: 60rpx;
  303. height: 6rpx;
  304. background-color: $uni-color;
  305. border-radius: 3rpx;
  306. }
  307. }
  308. .productList{
  309. }
  310. </style>