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.

443 lines
8.8 KiB

3 years ago
3 years ago
3 years ago
  1. <template>
  2. <view class="app">
  3. <view class="qwl-search">
  4. <input placeholder="搜索商品" class="qwl-search-input"/>
  5. <image src="/static/base/search.png" class="qwl-search-icon"></image>
  6. </view>
  7. <view class="product-section">
  8. <view class="product-left">
  9. <view class="product-left-item" v-for="(item,index) in productList" :key=index
  10. @click="leftSelect(index)"
  11. :style="{backgroundColor:currentIndex==index?'white':'#F5F5F5'}">
  12. <text class="product-left-item-title">全部</text>
  13. <view v-if="currentIndex==index" class="product-left-item-line"></view>
  14. </view>
  15. </view>
  16. <view class="product-right">
  17. <view class="product-source">
  18. <text class="product-source-grade">供货上级</text>
  19. <text class="product-source-grade product-source-name">轻未来公司张三</text>
  20. </view>
  21. <view class="product-right-item" v-for="(item,index) in 4" :key=index>
  22. <image class="product-right-img" src="/static/shop/677088217d8a00aa.jpg"></image>
  23. <view class="product-right-section">
  24. <text class="product-right-section-title">轻未来超纤维阻燃粉</text>
  25. <view class="product-right-section-des" style="margin: 6rpx 0rpx 20rpx;">
  26. <text class="product-right-section-number">库存2</text>
  27. <text class="product-right-section-label">物料</text>
  28. </view>
  29. <view class="product-right-section-des">
  30. <text class="product-right-section-price">5999</text>
  31. <view>
  32. <text class="product-right-btn product-remove">-</text>
  33. <text class="product-right-section-sale" :style="{color:1==1?'#EDAF8B':'#DDDDDD'}">1</text>
  34. <text class="product-right-btn product-add">+</text>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="product-footer">
  42. <view class="product-footer-left">
  43. <text class="product-footer-title">总计</text>
  44. <text class="product-footer-summary">5999</text>
  45. </view>
  46. <text class="product-footer-pay">结算</text>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. components: {
  53. },
  54. data() {
  55. return {
  56. navList: [],//导航列表
  57. advertList: [],//广告列表
  58. hotList: [],//热门推荐
  59. indicatorDots: true,
  60. autoplay: true,
  61. interval: 2000,
  62. duration: 500,
  63. productList:['全部','物料','公司产品','活动产品'],
  64. rightList:['1','2','3','4'],
  65. currentIndex:0,
  66. }
  67. },
  68. computed: {
  69. changeIndicatorDots(e) {
  70. this.indicatorDots = !this.indicatorDots
  71. },
  72. changeAutoplay(e) {
  73. this.autoplay = !this.autoplay
  74. },
  75. intervalChange(e) {
  76. this.interval = e.target.value
  77. },
  78. durationChange(e) {
  79. this.duration = e.target.value
  80. },
  81. midAdvert(){
  82. if(this.advertList.length === 0) return {};
  83. const res = this.advertList.filter(item=> item.advert_type === 'middle');
  84. return res.length > 0 ? res[0]: {};
  85. },
  86. carousel(){
  87. return this.advertList.filter(item=> item.advert_type === 'carousel');
  88. }
  89. },
  90. onLoad() {
  91. this.loadAdvert();
  92. this.loadNavList();
  93. setTimeout(()=>{
  94. //this.navTo('/pages/address/list')
  95. }, 1000)
  96. },
  97. methods: {
  98. leftSelect(index){
  99. this.currentIndex=index
  100. },
  101. //加载广告 缓存10分钟
  102. async loadAdvert(){
  103. const res = await this.$request('advert', 'getAdvertList', {}, {
  104. cache: 10*60
  105. });
  106. this.advertList = res.data;
  107. this.log(res);
  108. },
  109. //加载导航 缓存1小时
  110. async loadNavList(){
  111. const res = await this.$request('advert', 'getNavList', {}, {
  112. cache: 60*60*0,
  113. });
  114. this.navList = res.data;
  115. },
  116. }
  117. }
  118. </script>
  119. <style>
  120. page{
  121. background-color: white;
  122. }
  123. </style>
  124. <style scoped lang="scss">
  125. /* 分类 */
  126. .swiper{
  127. background-color: yellow;
  128. height: 750rpx;
  129. }
  130. .swiper-item{
  131. }
  132. .swiper-img{
  133. width: 100%;
  134. height: 750rpx;
  135. }
  136. .qwl-search{
  137. position: relative;
  138. margin: 30rpx 30rpx 20rpx 30rpx;
  139. }
  140. .qwl-search-input{
  141. background-color: red;
  142. height: 75rpx;
  143. text-indent: 80rpx;
  144. background-color: #F5F5F5;
  145. border-radius: 10rpx;
  146. }
  147. .qwl-search-icon{
  148. top: 20rpx;
  149. left: 30rpx;
  150. position: absolute;
  151. width: 35rpx;
  152. height: 35rpx;
  153. }
  154. .product-section{
  155. display: flex;
  156. flex-direction: row;
  157. justify-content: flex-start;
  158. align-items: flex-start;
  159. }
  160. .product-left{
  161. background-color:#F5F5F5 ;
  162. height:calc(100vh - 95rpx);
  163. // height:calc(100vh - 200rpx);
  164. }
  165. .product-left-item{
  166. display: flex;
  167. flex-direction: column;
  168. justify-content: center;
  169. align-items: center;
  170. }
  171. .product-left-item-title{
  172. width: 200rpx;
  173. text-align: center;
  174. display: block;
  175. font-size: 15px;
  176. font-weight: bold;
  177. color: #333333;
  178. height: 130rpx;
  179. line-height: 130rpx;
  180. // line-height: 92px;
  181. }
  182. .product-left-item-line{
  183. // margin: 0px auto;
  184. position: relative;
  185. top: -30rpx;
  186. background-color: #EDAF8B;
  187. height:5rpx ;
  188. width: 30rpx;
  189. }
  190. .product-right{
  191. flex: 1;
  192. }
  193. .product-source{
  194. height: 100rpx;
  195. background: #EDAF8B;
  196. }
  197. .product-source-grade{
  198. margin: 0rpx 20rpx;
  199. font-size: 30rpx;
  200. font-weight: 500;
  201. color: #FFFFFF;
  202. line-height: 100rpx;
  203. }
  204. .product-source-name{
  205. margin: 0px 20rpx;
  206. }
  207. .product-right{
  208. }
  209. .product-right-item{
  210. margin: 30rpx 0rpx;
  211. display: flex;
  212. flex-direction: row;
  213. justify-content: flex-start;
  214. align-items: center;
  215. }
  216. .product-right-img{
  217. margin: 0rpx 30rpx;
  218. width: 170rpx;
  219. height: 170rpx;
  220. border-radius: 10rpx;
  221. }
  222. .product-right-section-title{
  223. font-size: 15px;
  224. font-weight: bold;
  225. color: #333333;
  226. // line-height: 48px;
  227. }
  228. .product-right-section-des{
  229. display: flex;
  230. flex-direction: row;
  231. justify-content: space-between;
  232. align-items: center;
  233. }
  234. .product-right-section-number{
  235. font-size: 13px;
  236. font-weight: 500;
  237. color: #999999;
  238. // line-height: 48px;
  239. }
  240. .product-right-section-label{
  241. border: 1px solid #EDAF8B;
  242. border-radius: 4px;
  243. font-size: 13px;
  244. font-weight: 500;
  245. color: #EDAF8B;
  246. padding: 4rpx 8rpx;
  247. }
  248. .product-right-section-price{
  249. font-size: 18px;
  250. font-weight: bold;
  251. color: #EDAF8B;
  252. }
  253. .product-right-btn{
  254. width: 36rpx;
  255. height: 36rpx;
  256. border-radius: 50%;
  257. display: inline-block;
  258. text-align: center;
  259. color: white;
  260. }
  261. .product-add{
  262. background-color: #EDAF8B;
  263. }
  264. .product-remove{
  265. background-color: #DDDDDD;
  266. }
  267. .product-right-section-sale{
  268. position: relative;
  269. // top: -10rpx;
  270. font-size: 13px;
  271. font-weight: 500;
  272. color: #DDDDDD;
  273. height: 30rpx;
  274. line-height: 30rpx;
  275. margin: 0rpx 16rpx;
  276. }
  277. .product-footer{
  278. border-top: 1rpx solid $separatorColor;
  279. position: absolute;
  280. position: fixed;
  281. // bottom: 32rpx;
  282. bottom: 0rpx;
  283. left: 0rpx;
  284. right: 0rpx;
  285. background-color: white;
  286. height: 90rpx;
  287. line-height: 90rpx;
  288. display: flex;
  289. justify-content: space-between;
  290. align-items: center;
  291. }
  292. .product-footer-pay{
  293. background: #EDAF8B;
  294. font-size: 18px;
  295. font-weight: 500;
  296. color: #FFFFFF;
  297. height: 90rpx;
  298. line-height: 90rpx;
  299. width: 250rpx;
  300. text-align: center;
  301. }
  302. .product-footer-summary{
  303. font-size: 18px;
  304. font-weight: 500;
  305. color: #EDAF8B;
  306. font-weight: bold;
  307. }
  308. .product-footer-title{
  309. margin: 0rpx 4rpx 0rpx 60rpx;
  310. font-size: 13px;
  311. font-weight: 500;
  312. color: #333333;
  313. }
  314. // .menu-item{
  315. // display: flex;
  316. // flex-direction: row;
  317. // align-items: center;
  318. // }
  319. // .menu-txt{
  320. // height: 90rpx;
  321. // line-height: 90rpx;
  322. // text-align: center;
  323. // flex: 1;
  324. // font-size: 18px;
  325. // font-weight: 500;
  326. // color: #EDAF8B;
  327. // border: 1px solid #EDAF8B;
  328. // }
  329. // .product-section{
  330. // margin: 36rpx 64rpx 30rpx 40rpx;
  331. // }
  332. // .prduct-title{
  333. // font-size: 18px;
  334. // font-weight: bold;
  335. // color: #333333;
  336. // line-height: 50rpx;
  337. // // line-height: 48px;
  338. // }
  339. // .product-des{
  340. // margin: 30rpx 0rpx;
  341. // display: flex;
  342. // flex-direction: row;
  343. // justify-content: space-between;
  344. // align-items: flex-end;
  345. // }
  346. // .product-price-sale{
  347. // font-size: 28px;
  348. // font-weight: bold;
  349. // color: #EDAF8B;
  350. // }
  351. // .product-price-show{
  352. // font-size: 13px;
  353. // font-weight: 500;
  354. // text-decoration: line-through;
  355. // color: #999999;
  356. // }
  357. // .product-number{
  358. // font-size: 13px;
  359. // font-weight: 500;
  360. // color: #999999;
  361. // }
  362. // .separator-section{
  363. // background-color: $separatorColor;
  364. // height: 20rpx;
  365. // }
  366. // .product-detail{
  367. // margin: 60rpx 40rpx 10rpx;
  368. // }
  369. // .product-detail-title{
  370. // display: block;
  371. // font-size: 18px;
  372. // font-weight: bold;
  373. // color: #333333;
  374. // }
  375. // .product-detail-wrap{
  376. // margin: 30rpx 0rpx;
  377. // }
  378. // .product-detail-txt{
  379. // line-height: 30rpx;
  380. // font-size: 13px;
  381. // // font-weight: 500;
  382. // color: #999999;
  383. // }
  384. // .product-detail-img{
  385. // width: 100%;
  386. // height: 600rpx;
  387. // border-radius: 10rpx;
  388. // }
  389. </style>