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

444 lines
11 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="shop-list" v-for="(item, index) in list" @click="toGoodInfo(item, index)" :key="index">
  48. <view class="picture-shop">
  49. <image :src="item.image" mode=""></image>
  50. </view>
  51. <view class="price-shop">
  52. <view class="top-shop">
  53. <text>{{item.name}}</text>
  54. <view class="tag-shop">
  55. <uv-tags :text="item.categoryName" type="warning" plain size="mini"></uv-tags>
  56. <uv-tags text="快速下单" type="warning" plain size="mini"></uv-tags>
  57. </view>
  58. </view>
  59. <view class="bottom-price">
  60. <text style="font-size: 40rpx; ">{{item.price}}</text>/{{item.unit}}
  61. </view>
  62. </view>
  63. <view class="buy-shop">
  64. <uv-button
  65. type="primary"
  66. shape="circle"
  67. text="立即购买"></uv-button>
  68. </view>
  69. </view>
  70. <PrivacyAgreementPoup />
  71. <quick-order-entry
  72. @click="handleQuickOrderClick"
  73. @order-loaded="handleOrderLoaded"
  74. ref="quickOrderEntry"
  75. />
  76. <tabber select="home" />
  77. </view>
  78. </template>
  79. <script>
  80. import PrivacyAgreementPoup from '@/components/config/PrivacyAgreementPoup.vue'
  81. import tabber from '@/components/base/tabbar.vue'
  82. import QuickOrderEntry from '@/components/QuickOrderEntry.vue'
  83. import mixinsList from '@/mixins/list.js'
  84. export default {
  85. mixins: [mixinsList],
  86. components: {
  87. tabber,
  88. PrivacyAgreementPoup,
  89. QuickOrderEntry
  90. },
  91. data() {
  92. return {
  93. keyword: '',
  94. bannerList : [],
  95. menuList: [],
  96. mixinsListApi: 'getProductList',
  97. hasNewOrderMessage: false,
  98. orderMessageCount: 0
  99. }
  100. },
  101. computed: {
  102. },
  103. onShow() {
  104. this.getBanner()
  105. this.getMenu()
  106. if(uni.getStorageSync('token')){
  107. // 刷新快捷下单信息
  108. this.refreshQuickOrder()
  109. }
  110. },
  111. methods: {
  112. // 获取轮播图
  113. getBanner() {
  114. this.$api('getBanner', res => {
  115. if (res.code == 200) {
  116. this.bannerList = res.result
  117. }
  118. })
  119. },
  120. // 获取菜单
  121. getMenu() {
  122. this.$api('getIcon', res => {
  123. if (res.code == 200) {
  124. this.menuList = res.result
  125. }
  126. })
  127. },
  128. toUrl() {
  129. uni.navigateTo({
  130. url: '/pages_order/order/fastCreateOrder'
  131. })
  132. },
  133. toGoodInfo(item, index) {
  134. uni.navigateTo({
  135. url: `/pages_order/product/productDetail?id=${item.id}`
  136. })
  137. },
  138. menuClick(item){
  139. if(!item.url){
  140. return
  141. }
  142. uni.navigateTo({
  143. url: item.url,
  144. })
  145. },
  146. // 刷新快捷下单信息
  147. refreshQuickOrder() {
  148. if (this.$refs.quickOrderEntry) {
  149. this.$refs.quickOrderEntry.refresh();
  150. }
  151. },
  152. // 快捷下单按钮点击
  153. handleQuickOrderClick() {
  154. console.log('快捷下单按钮点击');
  155. // 组件内部已处理清除消息
  156. },
  157. // 订单信息加载完成
  158. handleOrderLoaded(orderList) {
  159. console.log('获取到快捷下单列表', orderList);
  160. if (Array.isArray(orderList) && orderList.length > 0) {
  161. // 可以在这里处理订单列表数据
  162. // 例如:筛选、排序或显示提示等
  163. }
  164. },
  165. }
  166. }
  167. </script>
  168. <style scoped lang="scss">
  169. .red-top {
  170. position: relative;
  171. height: 420rpx;
  172. background: linear-gradient(to bottom, $uni-color, #f05a45);
  173. border-bottom-left-radius: 100rpx;
  174. border-bottom-right-radius: 100rpx;
  175. z-index: -1;
  176. .building-title {
  177. position: absolute;
  178. height: 100rpx;
  179. width: 100%;
  180. margin-top: 100rpx;
  181. .title-right {
  182. color: $uni-bg-color;
  183. height: 100rpx;
  184. line-height: 100rpx;
  185. font-size: 45rpx;
  186. font-weight: 900;
  187. margin-left: 30rpx;
  188. display: inline-block;
  189. }
  190. .title-left {
  191. display: inline-block;
  192. margin-left: 30rpx;
  193. font-size: 22rpx;
  194. color: $uni-bg-color;
  195. }
  196. }
  197. .building-search {
  198. position: absolute;
  199. height: 100rpx;
  200. width: 100%;
  201. margin-top: 200rpx;
  202. // background-color: black;
  203. .address {
  204. height: 100rpx;
  205. width: 150rpx;
  206. position: relative;
  207. display: flex;
  208. align-items: center;
  209. image {
  210. position: absolute;
  211. height: 20rpx;
  212. width: 15rpx;
  213. line-height: 20rpx;
  214. left: 40rpx;
  215. top: 42rpx;
  216. }
  217. .eare {
  218. width: 100rpx;
  219. height: 100rpx;
  220. line-height: 100rpx;
  221. margin-left: 60rpx;
  222. color: $uni-bg-color;
  223. }
  224. .down-arrow:after {
  225. content: "";
  226. display: inline-block;
  227. width: 0;
  228. height: 0;
  229. border-left: 10rpx solid transparent;
  230. border-right: 10rpx solid transparent;
  231. border-top: 15rpx solid $uni-bg-color;
  232. margin-top: 5rpx;
  233. position: absolute;
  234. top: 42rpx;
  235. left: 130rpx;
  236. }
  237. }
  238. .search {
  239. display: inline-block;
  240. position: absolute;
  241. top: 16rpx;
  242. left: 26%;
  243. width: 70%;
  244. :deep(.uv-search__content) {
  245. box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.1);
  246. }
  247. }
  248. }
  249. }
  250. .image-home {
  251. z-index: 1;
  252. margin: 0 20rpx;
  253. margin-top: -90rpx;
  254. border-radius: 20rpx;
  255. overflow: hidden;
  256. box-shadow: 0 10rpx 20rpx rgba(0, 0, 0, 0.1);
  257. }
  258. .building-class {
  259. height: 220rpx;
  260. display: flex;
  261. justify-content: space-around;
  262. align-items: center;
  263. /* 垂直居中 */
  264. background-color: $uni-bg-color;
  265. margin: 20rpx 0;
  266. border-radius: 20rpx;
  267. box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.05);
  268. image {
  269. margin-left: 20rpx;
  270. margin-right: 20rpx;
  271. margin-bottom: 10rpx;
  272. width: 90rpx;
  273. height: 90rpx;
  274. display: inline-block;
  275. transition: transform 0.3s;
  276. &:hover {
  277. transform: scale(1.05);
  278. }
  279. }
  280. .grid-text {
  281. margin-top: 4rpx;
  282. font-size: 26rpx;
  283. font-weight: 500;
  284. color: #333;
  285. }
  286. }
  287. .text-building {
  288. display: flex;
  289. justify-content: space-around;
  290. align-items: center;
  291. /* 垂直居中 */
  292. background-color: $uni-bg-color;
  293. text-align: center;
  294. font-weight: 500;
  295. margin-bottom: -30rpx;
  296. padding-bottom: 40rpx;
  297. // overflow: hidden;
  298. }
  299. .hot-building {
  300. margin-top: 25rpx;
  301. height: 80rpx;
  302. background-color: $uni-bg-color;
  303. display: flex;
  304. align-items: center;
  305. padding-left: 40rpx;
  306. font-size: 35rpx;
  307. font-weight: 600;
  308. color: #333;
  309. position: relative;
  310. &::after {
  311. content: '';
  312. position: absolute;
  313. left: 40rpx;
  314. bottom: 15rpx;
  315. width: 60rpx;
  316. height: 6rpx;
  317. background-color: $uni-color;
  318. border-radius: 3rpx;
  319. }
  320. }
  321. .shop-list {
  322. width: 95%;
  323. height: 222rpx;
  324. display: flex;
  325. margin: 30rpx auto;
  326. background-color: #ffffff;
  327. border-radius: 20rpx;
  328. box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.05);
  329. transition: transform 0.3s, box-shadow 0.3s;
  330. &:active {
  331. transform: translateY(2rpx);
  332. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  333. }
  334. // /deep/
  335. .picture-shop {
  336. width: 240rpx;
  337. height: 100%;
  338. display: flex;
  339. align-items: center;
  340. justify-content: center;
  341. image {
  342. width: 200rpx;
  343. height: 150rpx;
  344. }
  345. }
  346. .price-shop {
  347. width: 250rpx;
  348. height: 100%;
  349. .top-shop {
  350. height: 100rpx;
  351. width: 100%;
  352. font-size: 32rpx;
  353. margin-top: 20rpx;
  354. text-align: center;
  355. font-weight: 600;
  356. overflow: hidden;
  357. text-overflow: ellipsis;
  358. white-space: nowrap;
  359. .tag-shop {
  360. display: flex;
  361. justify-content: space-around;
  362. margin-top: 10rpx;
  363. }
  364. .bottom-price {
  365. display: inline-block;
  366. font-size: 28rpx;
  367. color: #666;
  368. text {
  369. color: #DC2828;
  370. font-weight: 700;
  371. }
  372. }
  373. }
  374. }
  375. .buy-shop {
  376. height: 100%;
  377. width: 250rpx;
  378. display: flex;
  379. justify-content: center;
  380. align-items: center;
  381. :deep(.uv-button) {
  382. transition: transform 0.2s;
  383. &:active {
  384. transform: scale(0.95);
  385. }
  386. }
  387. }
  388. @keyframes pulse {
  389. 0% {
  390. transform: scale(1);
  391. }
  392. 50% {
  393. transform: scale(1.05);
  394. }
  395. 100% {
  396. transform: scale(1);
  397. }
  398. }
  399. }
  400. </style>