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

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