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

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