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

484 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. <view class="quick-order-container" @click="toUrl">
  72. <view class="new-message" v-if="false">
  73. 你有一条新的快捷下单信息
  74. </view>
  75. <view class="quick-order">
  76. <view class="number-order" v-if="false">
  77. 1
  78. </view>
  79. <image src="../../static/image/home/7.png" mode=""></image>
  80. </view>
  81. </view>
  82. <tabber select="home" />
  83. </view>
  84. </template>
  85. <script>
  86. import PrivacyAgreementPoup from '@/components/config/PrivacyAgreementPoup.vue'
  87. import tabber from '@/components/base/tabbar.vue'
  88. import mixinsList from '@/mixins/list.js'
  89. export default {
  90. mixins: [mixinsList],
  91. components: {
  92. tabber,
  93. PrivacyAgreementPoup,
  94. },
  95. data() {
  96. return {
  97. keyword: '',
  98. bannerList : [],
  99. menuList: [],
  100. mixinsListApi: 'getProductList',
  101. }
  102. },
  103. computed: {
  104. },
  105. onShow() {
  106. this.getBanner()
  107. this.getMenu()
  108. if(uni.getStorageSync('token')){
  109. this.getOrderInfo()
  110. }
  111. },
  112. methods: {
  113. // 快捷下单信息
  114. getOrderInfo(){
  115. this.$api('getOrderInfo')
  116. .then(res => {
  117. })
  118. },
  119. // 获取轮播图
  120. getBanner() {
  121. this.$api('getBanner', res => {
  122. if (res.code == 200) {
  123. this.bannerList = res.result
  124. }
  125. })
  126. },
  127. // 获取菜单
  128. getMenu() {
  129. this.$api('getIcon', res => {
  130. if (res.code == 200) {
  131. this.menuList = res.result
  132. }
  133. })
  134. },
  135. toUrl() {
  136. uni.navigateTo({
  137. url: '/pages_order/order/fastCreateOrder'
  138. })
  139. },
  140. toGoodInfo(item, index) {
  141. uni.navigateTo({
  142. url: `/pages_order/product/productDetail?id=${item.id}`
  143. })
  144. },
  145. menuClick(item){
  146. if(!item.url){
  147. return
  148. }
  149. uni.navigateTo({
  150. url: item.url,
  151. })
  152. },
  153. }
  154. }
  155. </script>
  156. <style scoped lang="scss">
  157. .red-top {
  158. position: relative;
  159. height: 420rpx;
  160. background: linear-gradient(to bottom, $uni-color, #f05a45);
  161. border-bottom-left-radius: 100rpx;
  162. border-bottom-right-radius: 100rpx;
  163. z-index: -1;
  164. .building-title {
  165. position: absolute;
  166. height: 100rpx;
  167. width: 100%;
  168. margin-top: 100rpx;
  169. .title-right {
  170. color: $uni-bg-color;
  171. height: 100rpx;
  172. line-height: 100rpx;
  173. font-size: 45rpx;
  174. font-weight: 900;
  175. margin-left: 30rpx;
  176. display: inline-block;
  177. }
  178. .title-left {
  179. display: inline-block;
  180. margin-left: 30rpx;
  181. font-size: 22rpx;
  182. color: $uni-bg-color;
  183. }
  184. }
  185. .building-search {
  186. position: absolute;
  187. height: 100rpx;
  188. width: 100%;
  189. margin-top: 200rpx;
  190. // background-color: black;
  191. .address {
  192. height: 100rpx;
  193. width: 150rpx;
  194. position: relative;
  195. display: flex;
  196. align-items: center;
  197. image {
  198. position: absolute;
  199. height: 20rpx;
  200. width: 15rpx;
  201. line-height: 20rpx;
  202. left: 40rpx;
  203. top: 42rpx;
  204. }
  205. .eare {
  206. width: 100rpx;
  207. height: 100rpx;
  208. line-height: 100rpx;
  209. margin-left: 60rpx;
  210. color: $uni-bg-color;
  211. }
  212. .down-arrow:after {
  213. content: "";
  214. display: inline-block;
  215. width: 0;
  216. height: 0;
  217. border-left: 10rpx solid transparent;
  218. border-right: 10rpx solid transparent;
  219. border-top: 15rpx solid $uni-bg-color;
  220. margin-top: 5rpx;
  221. position: absolute;
  222. top: 42rpx;
  223. left: 130rpx;
  224. }
  225. }
  226. .search {
  227. display: inline-block;
  228. position: absolute;
  229. top: 16rpx;
  230. left: 26%;
  231. width: 70%;
  232. :deep(.uv-search__content) {
  233. box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.1);
  234. }
  235. }
  236. }
  237. }
  238. .image-home {
  239. z-index: 1;
  240. margin: 0 20rpx;
  241. margin-top: -90rpx;
  242. border-radius: 20rpx;
  243. overflow: hidden;
  244. box-shadow: 0 10rpx 20rpx rgba(0, 0, 0, 0.1);
  245. }
  246. .building-class {
  247. height: 220rpx;
  248. display: flex;
  249. justify-content: space-around;
  250. align-items: center;
  251. /* 垂直居中 */
  252. background-color: $uni-bg-color;
  253. margin: 20rpx 0;
  254. border-radius: 20rpx;
  255. box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.05);
  256. image {
  257. margin-left: 20rpx;
  258. margin-right: 20rpx;
  259. margin-bottom: 10rpx;
  260. width: 90rpx;
  261. height: 90rpx;
  262. display: inline-block;
  263. transition: transform 0.3s;
  264. &:hover {
  265. transform: scale(1.05);
  266. }
  267. }
  268. .grid-text {
  269. margin-top: 4rpx;
  270. font-size: 26rpx;
  271. font-weight: 500;
  272. color: #333;
  273. }
  274. }
  275. .text-building {
  276. display: flex;
  277. justify-content: space-around;
  278. align-items: center;
  279. /* 垂直居中 */
  280. background-color: $uni-bg-color;
  281. text-align: center;
  282. font-weight: 500;
  283. margin-bottom: -30rpx;
  284. padding-bottom: 40rpx;
  285. // overflow: hidden;
  286. }
  287. .hot-building {
  288. margin-top: 25rpx;
  289. height: 80rpx;
  290. background-color: $uni-bg-color;
  291. display: flex;
  292. align-items: center;
  293. padding-left: 40rpx;
  294. font-size: 35rpx;
  295. font-weight: 600;
  296. color: #333;
  297. position: relative;
  298. &::after {
  299. content: '';
  300. position: absolute;
  301. left: 40rpx;
  302. bottom: 15rpx;
  303. width: 60rpx;
  304. height: 6rpx;
  305. background-color: $uni-color;
  306. border-radius: 3rpx;
  307. }
  308. }
  309. .quick-order-container {
  310. position: fixed;
  311. right: 30rpx;
  312. bottom: 30vh;
  313. z-index: 99;
  314. transition: transform 0.3s;
  315. &:active {
  316. transform: scale(0.95);
  317. }
  318. }
  319. .new-message {
  320. position: absolute;
  321. top: 50rpx;
  322. right: 100%;
  323. white-space: nowrap;
  324. background-color: #DC2828;
  325. border-radius: 20rpx;
  326. font-size: 25rpx;
  327. color: $uni-bg-color;
  328. padding: 5rpx 15rpx;
  329. margin-bottom: 10rpx;
  330. box-shadow: 0 5rpx 10rpx rgba(220, 40, 40, 0.3);
  331. animation: pulse 2s infinite;
  332. }
  333. .quick-order {
  334. position: relative;
  335. width: 230rpx;
  336. height: 160rpx;
  337. image {
  338. width: 100%;
  339. height: 100%;
  340. }
  341. .number-order {
  342. background-color: #DC2828;
  343. position: absolute;
  344. font-size: 30rpx;
  345. height: 40rpx;
  346. width: 40rpx;
  347. text-align: center;
  348. border-radius: 20rpx;
  349. color: #ffffff;
  350. top: 10rpx;
  351. left: 25rpx;
  352. }
  353. }
  354. .shop-list {
  355. width: 95%;
  356. height: 222rpx;
  357. display: flex;
  358. margin: 30rpx auto;
  359. background-color: #ffffff;
  360. border-radius: 20rpx;
  361. box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.05);
  362. transition: transform 0.3s, box-shadow 0.3s;
  363. &:active {
  364. transform: translateY(2rpx);
  365. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  366. }
  367. // /deep/
  368. .picture-shop {
  369. width: 240rpx;
  370. height: 100%;
  371. display: flex;
  372. align-items: center;
  373. justify-content: center;
  374. image {
  375. width: 200rpx;
  376. height: 150rpx;
  377. }
  378. }
  379. .price-shop {
  380. width: 250rpx;
  381. height: 100%;
  382. .top-shop {
  383. height: 100rpx;
  384. width: 100%;
  385. font-size: 32rpx;
  386. margin-top: 20rpx;
  387. text-align: center;
  388. font-weight: 600;
  389. overflow: hidden;
  390. text-overflow: ellipsis;
  391. white-space: nowrap;
  392. .tag-shop {
  393. display: flex;
  394. justify-content: space-around;
  395. margin-top: 10rpx;
  396. }
  397. .bottom-price {
  398. display: inline-block;
  399. font-size: 28rpx;
  400. color: #666;
  401. text {
  402. color: #DC2828;
  403. font-weight: 700;
  404. }
  405. }
  406. }
  407. }
  408. .buy-shop {
  409. height: 100%;
  410. width: 250rpx;
  411. display: flex;
  412. justify-content: center;
  413. align-items: center;
  414. :deep(.uv-button) {
  415. transition: transform 0.2s;
  416. &:active {
  417. transform: scale(0.95);
  418. }
  419. }
  420. }
  421. @keyframes pulse {
  422. 0% {
  423. transform: scale(1);
  424. }
  425. 50% {
  426. transform: scale(1.05);
  427. }
  428. 100% {
  429. transform: scale(1);
  430. }
  431. }
  432. }
  433. </style>