建材商城系统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.

314 lines
7.3 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. <uv-search bgColor="#ffffff"
  22. placeholder="搜索材料"
  23. disabled
  24. @click="$utils.navigateTo(`/pages_order/product/productList?search=true`)"
  25. showAction="false"></uv-search>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="image-home"
  30. @click="$utils.navigateTo('/pages_order/order/fastCreateOrder')">
  31. <uv-swiper class="uv-swaip"
  32. keyName="image"
  33. height="350rpx"
  34. :list="bannerList"
  35. circular
  36. bgColor="#ffffff">
  37. </uv-swiper>
  38. </view>
  39. <view class="building-class">
  40. <view style="width: 710rpx;">
  41. <uv-grid :col="4" :border="false">
  42. <uv-grid-item v-for="(item, index) in menuList" :key="index"
  43. @click="menuClick(item)">
  44. <image class="image" :src="item.image" mode=""></image>
  45. <text class="grid-text">{{item.title}}</text>
  46. </uv-grid-item>
  47. </uv-grid>
  48. </view>
  49. </view>
  50. <view class="hot-building">
  51. <text>热卖建材</text>
  52. </view>
  53. <view class="productList">
  54. <productItem
  55. @click="$utils.navigateTo(`/pages_order/product/productDetail?id=${item.id}`)"
  56. :item="item" v-for="(item, index) in list" :key="index"/>
  57. </view>
  58. <PrivacyAgreementPoup />
  59. <quick-order-entry
  60. ref="quickOrderEntry"
  61. />
  62. <kefu/>
  63. <tabber select="home" />
  64. </view>
  65. </template>
  66. <script>
  67. import PrivacyAgreementPoup from '@/components/config/PrivacyAgreementPoup.vue'
  68. import tabber from '@/components/base/tabbar.vue'
  69. import productItem from '@/components/productItem.vue'
  70. import mixinsList from '@/mixins/list.js'
  71. export default {
  72. mixins: [mixinsList],
  73. components: {
  74. tabber,
  75. PrivacyAgreementPoup,
  76. productItem,
  77. },
  78. data() {
  79. return {
  80. keyword: '',
  81. bannerList : [],
  82. menuList: [],
  83. mixinsListApi: 'getProductList',
  84. hasNewOrderMessage: false,
  85. orderMessageCount: 0
  86. }
  87. },
  88. computed: {
  89. },
  90. onShow() {
  91. this.getBanner()
  92. this.getMenu()
  93. if(uni.getStorageSync('token')){
  94. this.$store.commit('getUserInfo')
  95. }
  96. },
  97. methods: {
  98. // 获取轮播图
  99. getBanner() {
  100. this.$api('getBanner', res => {
  101. if (res.code == 200) {
  102. this.bannerList = res.result
  103. }
  104. })
  105. },
  106. // 获取菜单
  107. getMenu() {
  108. this.$api('getIcon', res => {
  109. if (res.code == 200) {
  110. this.menuList = res.result
  111. }
  112. })
  113. },
  114. toUrl() {
  115. uni.navigateTo({
  116. url: '/pages_order/order/fastCreateOrder'
  117. })
  118. },
  119. toGoodInfo(item, index) {
  120. uni.navigateTo({
  121. url: `/pages_order/product/productDetail?id=${item.id}`
  122. })
  123. },
  124. menuClick(item){
  125. uni.navigateTo({
  126. url: `/pages_order/product/productList?title=${item.title}&iconId=${item.id}`
  127. })
  128. // if(!item.url){
  129. // return
  130. // }
  131. // uni.navigateTo({
  132. // url: item.url,
  133. // })
  134. },
  135. }
  136. }
  137. </script>
  138. <style scoped lang="scss">
  139. .red-top {
  140. position: relative;
  141. height: 420rpx;
  142. background: linear-gradient(to bottom, $uni-color, #f05a45);
  143. border-bottom-left-radius: 100rpx;
  144. border-bottom-right-radius: 100rpx;
  145. .building-title {
  146. position: absolute;
  147. height: 100rpx;
  148. width: 100%;
  149. margin-top: 100rpx;
  150. .title-right {
  151. color: $uni-bg-color;
  152. height: 100rpx;
  153. line-height: 100rpx;
  154. font-size: 45rpx;
  155. font-weight: 900;
  156. margin-left: 30rpx;
  157. display: inline-block;
  158. }
  159. .title-left {
  160. display: inline-block;
  161. margin-left: 30rpx;
  162. font-size: 22rpx;
  163. color: $uni-bg-color;
  164. }
  165. }
  166. .building-search {
  167. position: absolute;
  168. height: 100rpx;
  169. width: 100%;
  170. margin-top: 200rpx;
  171. display: flex;
  172. justify-content: center;
  173. align-items: center;
  174. gap: 20rpx;
  175. .address {
  176. height: 100rpx;
  177. width: 150rpx;
  178. position: relative;
  179. display: flex;
  180. align-items: center;
  181. justify-content: center;
  182. gap: 10rpx;
  183. image {
  184. height: 20rpx;
  185. width: 20rpx;
  186. }
  187. .eare {
  188. color: $uni-bg-color;
  189. }
  190. .down-arrow {
  191. content: "";
  192. display: block;
  193. width: 0;
  194. height: 0;
  195. border-left: 10rpx solid transparent;
  196. border-right: 10rpx solid transparent;
  197. border-top: 15rpx solid $uni-bg-color;
  198. }
  199. }
  200. .search {
  201. background-color: #fff;
  202. border-radius: 40rpx;
  203. display: flex;
  204. padding: 20rpx;
  205. :deep(.uv-search__content) {
  206. box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.1);
  207. }
  208. }
  209. }
  210. }
  211. .image-home {
  212. z-index: 1;
  213. margin: 0 20rpx;
  214. margin-top: -90rpx;
  215. border-radius: 20rpx;
  216. overflow: hidden;
  217. box-shadow: 0 10rpx 20rpx rgba(0, 0, 0, 0.1);
  218. }
  219. .building-class {
  220. padding: 20rpx 0;
  221. display: flex;
  222. justify-content: space-around;
  223. align-items: center;
  224. /* 垂直居中 */
  225. background-color: $uni-bg-color;
  226. margin: 20rpx 0;
  227. border-radius: 20rpx;
  228. box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.05);
  229. image {
  230. margin-left: 20rpx;
  231. margin-right: 20rpx;
  232. margin-bottom: 10rpx;
  233. width: 90rpx;
  234. height: 90rpx;
  235. display: inline-block;
  236. transition: transform 0.3s;
  237. &:hover {
  238. transform: scale(1.05);
  239. }
  240. }
  241. .grid-text {
  242. margin-top: 4rpx;
  243. font-size: 26rpx;
  244. font-weight: 500;
  245. color: #333;
  246. }
  247. }
  248. .text-building {
  249. display: flex;
  250. justify-content: space-around;
  251. align-items: center;
  252. /* 垂直居中 */
  253. background-color: $uni-bg-color;
  254. text-align: center;
  255. font-weight: 500;
  256. margin-bottom: -30rpx;
  257. padding-bottom: 40rpx;
  258. // overflow: hidden;
  259. }
  260. .hot-building {
  261. margin-top: 25rpx;
  262. height: 80rpx;
  263. background-color: $uni-bg-color;
  264. display: flex;
  265. align-items: center;
  266. padding-left: 40rpx;
  267. font-size: 35rpx;
  268. font-weight: 600;
  269. color: #333;
  270. position: relative;
  271. &::after {
  272. content: '';
  273. position: absolute;
  274. left: 40rpx;
  275. bottom: 15rpx;
  276. width: 60rpx;
  277. height: 6rpx;
  278. background-color: $uni-color;
  279. border-radius: 3rpx;
  280. }
  281. }
  282. .productList{
  283. }
  284. </style>