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

336 lines
7.8 KiB

1 year ago
1 year ago
1 year ago
1 year 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. .red-top {
  160. position: relative;
  161. height: 420rpx;
  162. background: linear-gradient(to bottom, $uni-color, #f05a45);
  163. border-bottom-left-radius: 100rpx;
  164. border-bottom-right-radius: 100rpx;
  165. .building-title {
  166. position: absolute;
  167. height: 100rpx;
  168. width: 100%;
  169. margin-top: 100rpx;
  170. .title-right {
  171. color: $uni-bg-color;
  172. height: 100rpx;
  173. line-height: 100rpx;
  174. font-size: 45rpx;
  175. font-weight: 900;
  176. margin-left: 30rpx;
  177. display: inline-block;
  178. }
  179. .title-left {
  180. display: inline-block;
  181. margin-left: 30rpx;
  182. font-size: 22rpx;
  183. color: $uni-bg-color;
  184. }
  185. }
  186. .building-search {
  187. position: absolute;
  188. height: 100rpx;
  189. width: 100%;
  190. margin-top: 200rpx;
  191. display: flex;
  192. justify-content: center;
  193. align-items: center;
  194. gap: 20rpx;
  195. .address {
  196. height: 100rpx;
  197. width: 150rpx;
  198. position: relative;
  199. display: flex;
  200. align-items: center;
  201. justify-content: center;
  202. gap: 10rpx;
  203. image {
  204. height: 20rpx;
  205. width: 20rpx;
  206. }
  207. .eare {
  208. color: $uni-bg-color;
  209. }
  210. .down-arrow {
  211. content: "";
  212. display: block;
  213. width: 0;
  214. height: 0;
  215. border-left: 10rpx solid transparent;
  216. border-right: 10rpx solid transparent;
  217. border-top: 15rpx solid $uni-bg-color;
  218. }
  219. }
  220. .search {
  221. background-color: #fff;
  222. border-radius: 40rpx;
  223. display: flex;
  224. padding: 20rpx;
  225. :deep(.uv-search__content) {
  226. box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.1);
  227. }
  228. }
  229. }
  230. }
  231. .image-home {
  232. z-index: 1;
  233. margin: 0 20rpx;
  234. margin-top: -90rpx;
  235. border-radius: 20rpx;
  236. overflow: hidden;
  237. box-shadow: 0 10rpx 20rpx rgba(0, 0, 0, 0.1);
  238. }
  239. .building-class {
  240. padding: 20rpx 0;
  241. display: flex;
  242. justify-content: space-around;
  243. align-items: center;
  244. /* 垂直居中 */
  245. background-color: $uni-bg-color;
  246. margin: 20rpx 0;
  247. border-radius: 20rpx;
  248. box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.05);
  249. image {
  250. margin-left: 20rpx;
  251. margin-right: 20rpx;
  252. margin-bottom: 10rpx;
  253. width: 90rpx;
  254. height: 90rpx;
  255. display: inline-block;
  256. transition: transform 0.3s;
  257. &:hover {
  258. transform: scale(1.05);
  259. }
  260. }
  261. .grid-text {
  262. margin-top: 4rpx;
  263. font-size: 26rpx;
  264. font-weight: 500;
  265. color: #333;
  266. }
  267. }
  268. .text-building {
  269. display: flex;
  270. justify-content: space-around;
  271. align-items: center;
  272. /* 垂直居中 */
  273. background-color: $uni-bg-color;
  274. text-align: center;
  275. font-weight: 500;
  276. margin-bottom: -30rpx;
  277. padding-bottom: 40rpx;
  278. // overflow: hidden;
  279. }
  280. .hot-building {
  281. margin-top: 25rpx;
  282. height: 80rpx;
  283. background-color: $uni-bg-color;
  284. display: flex;
  285. align-items: center;
  286. padding-left: 40rpx;
  287. font-size: 35rpx;
  288. font-weight: 600;
  289. color: #333;
  290. position: relative;
  291. &::after {
  292. content: '';
  293. position: absolute;
  294. left: 40rpx;
  295. bottom: 15rpx;
  296. width: 60rpx;
  297. height: 6rpx;
  298. background-color: $uni-color;
  299. border-radius: 3rpx;
  300. }
  301. }
  302. .productList{
  303. }
  304. </style>