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

333 lines
7.7 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>{{ 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() {
  94. if(this.selectCity.id){
  95. this.mixinsListApi = 'getProductList'
  96. }
  97. uni.$on('initCity', () => {
  98. this.mixinsListApi = 'getProductList'
  99. this.getData()
  100. })
  101. },
  102. onShow() {
  103. this.getBanner()
  104. this.getMenu()
  105. if(uni.getStorageSync('token')){
  106. this.$store.commit('getUserInfo')
  107. }
  108. },
  109. methods: {
  110. // 获取轮播图
  111. getBanner() {
  112. this.$api('getBanner', res => {
  113. if (res.code == 200) {
  114. this.bannerList = res.result
  115. }
  116. })
  117. },
  118. beforeGetData(){
  119. return {
  120. cityId : this.selectCity.id
  121. }
  122. },
  123. // 获取菜单
  124. getMenu() {
  125. this.$api('getIcon', res => {
  126. if (res.code == 200) {
  127. this.menuList = res.result
  128. }
  129. })
  130. },
  131. toUrl() {
  132. uni.navigateTo({
  133. url: '/pages_order/order/fastCreateOrder'
  134. })
  135. },
  136. toGoodInfo(item, index) {
  137. uni.navigateTo({
  138. url: `/pages_order/product/productDetail?id=${item.id}`
  139. })
  140. },
  141. menuClick(item){
  142. uni.navigateTo({
  143. url: `/pages_order/product/productList?title=${item.title}&iconId=${item.id}`
  144. })
  145. // if(!item.url){
  146. // return
  147. // }
  148. // uni.navigateTo({
  149. // url: item.url,
  150. // })
  151. },
  152. }
  153. }
  154. </script>
  155. <style scoped lang="scss">
  156. .red-top {
  157. position: relative;
  158. height: 420rpx;
  159. background: linear-gradient(to bottom, $uni-color, #f05a45);
  160. border-bottom-left-radius: 100rpx;
  161. border-bottom-right-radius: 100rpx;
  162. .building-title {
  163. position: absolute;
  164. height: 100rpx;
  165. width: 100%;
  166. margin-top: 100rpx;
  167. .title-right {
  168. color: $uni-bg-color;
  169. height: 100rpx;
  170. line-height: 100rpx;
  171. font-size: 45rpx;
  172. font-weight: 900;
  173. margin-left: 30rpx;
  174. display: inline-block;
  175. }
  176. .title-left {
  177. display: inline-block;
  178. margin-left: 30rpx;
  179. font-size: 22rpx;
  180. color: $uni-bg-color;
  181. }
  182. }
  183. .building-search {
  184. position: absolute;
  185. height: 100rpx;
  186. width: 100%;
  187. margin-top: 200rpx;
  188. display: flex;
  189. justify-content: center;
  190. align-items: center;
  191. gap: 20rpx;
  192. .address {
  193. height: 100rpx;
  194. width: 150rpx;
  195. position: relative;
  196. display: flex;
  197. align-items: center;
  198. justify-content: center;
  199. gap: 10rpx;
  200. image {
  201. height: 20rpx;
  202. width: 20rpx;
  203. }
  204. .eare {
  205. color: $uni-bg-color;
  206. }
  207. .down-arrow {
  208. content: "";
  209. display: block;
  210. width: 0;
  211. height: 0;
  212. border-left: 10rpx solid transparent;
  213. border-right: 10rpx solid transparent;
  214. border-top: 15rpx solid $uni-bg-color;
  215. }
  216. }
  217. .search {
  218. background-color: #fff;
  219. border-radius: 40rpx;
  220. display: flex;
  221. padding: 20rpx;
  222. :deep(.uv-search__content) {
  223. box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.1);
  224. }
  225. }
  226. }
  227. }
  228. .image-home {
  229. z-index: 1;
  230. margin: 0 20rpx;
  231. margin-top: -90rpx;
  232. border-radius: 20rpx;
  233. overflow: hidden;
  234. box-shadow: 0 10rpx 20rpx rgba(0, 0, 0, 0.1);
  235. }
  236. .building-class {
  237. padding: 20rpx 0;
  238. display: flex;
  239. justify-content: space-around;
  240. align-items: center;
  241. /* 垂直居中 */
  242. background-color: $uni-bg-color;
  243. margin: 20rpx 0;
  244. border-radius: 20rpx;
  245. box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.05);
  246. image {
  247. margin-left: 20rpx;
  248. margin-right: 20rpx;
  249. margin-bottom: 10rpx;
  250. width: 90rpx;
  251. height: 90rpx;
  252. display: inline-block;
  253. transition: transform 0.3s;
  254. &:hover {
  255. transform: scale(1.05);
  256. }
  257. }
  258. .grid-text {
  259. margin-top: 4rpx;
  260. font-size: 26rpx;
  261. font-weight: 500;
  262. color: #333;
  263. }
  264. }
  265. .text-building {
  266. display: flex;
  267. justify-content: space-around;
  268. align-items: center;
  269. /* 垂直居中 */
  270. background-color: $uni-bg-color;
  271. text-align: center;
  272. font-weight: 500;
  273. margin-bottom: -30rpx;
  274. padding-bottom: 40rpx;
  275. // overflow: hidden;
  276. }
  277. .hot-building {
  278. margin-top: 25rpx;
  279. height: 80rpx;
  280. background-color: $uni-bg-color;
  281. display: flex;
  282. align-items: center;
  283. padding-left: 40rpx;
  284. font-size: 35rpx;
  285. font-weight: 600;
  286. color: #333;
  287. position: relative;
  288. &::after {
  289. content: '';
  290. position: absolute;
  291. left: 40rpx;
  292. bottom: 15rpx;
  293. width: 60rpx;
  294. height: 6rpx;
  295. background-color: $uni-color;
  296. border-radius: 3rpx;
  297. }
  298. }
  299. .productList{
  300. }
  301. </style>