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

340 lines
7.8 KiB

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