金诚优选前端代码
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.

489 lines
13 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <template>
  2. <view>
  3. <lf-nav :spreadOut="false" :showIcon="true" bgColor="transparent!important"></lf-nav>
  4. <view class="shop-head">
  5. <image class="lf-w-100 lf-h-100" :src="detail.logo" mode="aspectFill"></image>
  6. </view>
  7. <view class="shop-title">
  8. <view class="shop-flex">
  9. <view class="shop-img">
  10. <image class="shop-img" :src="detail.logo" mode="aspectFill"></image>
  11. </view>
  12. <view>
  13. <view class="lf-color-black lf-font-36">{{ detail.name }}</view>
  14. <view class="lf-font-24 lf-color-black">
  15. <text class="lf-iconfont icon-dizhi lf-font-24 lf-color-primary"></text>
  16. <text class="lf-m-l-10">{{ detail.floor }}</text>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="function-total">
  21. <view class="lf-row-center lf-flex-column">
  22. <view><text class="lf-iconfont icon-pinglun shop-function"></text></view>
  23. <view class="lf-font-24 lf-color-33">客服</view>
  24. </view>
  25. <view class="lf-row-center lf-flex-column">
  26. <view><text class="lf-iconfont icon-shoucang shop-function"></text></view>
  27. <view class="lf-font-24 lf-color-333">收藏</view>
  28. </view>
  29. <view class="lf-row-center lf-flex-column">
  30. <view><text class="lf-iconfont icon-fenxiang shop-function"></text></view>
  31. <view class="lf-font-24 lf-color-333">分享</view>
  32. </view>
  33. </view>
  34. </view>
  35. <view v-if="title_tab.length">
  36. <u-tabs :list="title_tab" active-color="#15716E" inactive-color='#777777' :is-scroll="true" :current="title_current" @change="titletabChange"></u-tabs>
  37. </view>
  38. <!-- 推荐 -->
  39. <view v-if="title_current==0">
  40. <view class="lf-row-between lf-p-l-32 lf-p-t-40 lf-p-r-32">
  41. <view class="lf-font-32 lf-color-black lf-font-bold">在售商品</view>
  42. <view class="lf-font-24 lf-color-555">查看全部 <text class="lf-iconfont icon-xiangyou lf-font-24 lf-m-l-10"></text></view>
  43. </view>
  44. <view class="recommend-box" >
  45. <view class="goods-rom" v-for="(item,index) of detail.goods" :key="index" v-if="detail.goods.length">
  46. <u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.img" :index="index">
  47. <view class="list-label">已售{{item.sale_count}}</view>
  48. </u-lazy-load>
  49. <view class="lf-p-20">
  50. <view class="list-title">
  51. {{item.name}}
  52. </view>
  53. <view class="list-price">
  54. <!-- <text>{{item.price}}</text> -->
  55. <lf-price :price="item.min_price"></lf-price>
  56. <text class="lf-m-l-20 lf-font-24 lf-color-666 lf-line-through">{{item.min_market_price}}</text>
  57. </view>
  58. </view>
  59. </view>
  60. <lf-nocontent v-else></lf-nocontent>
  61. </view>
  62. <view class="introduct">
  63. <text class="lf-font-32 lf-color-black">品牌故事</text>
  64. <view class="lf-font-28 lf-color-333 lf-m-t-20">{{ detail.story }}</view>
  65. </view>
  66. </view>
  67. <view class="lf-p-t-30 lf-p-b-30" v-else>
  68. <view class="lf-m-b-30 lf-flex lf-w-100">
  69. <u-icon name="search" class="search-icon"></u-icon>
  70. <input class="rom-search" v-model="search_val" @confirm="search" type="text" placeholder="请输入商品名称" />
  71. </view>
  72. <view class="special_tab">
  73. <u-tabs :list="tab_list" active-color="#15716E" inactive-color='#777777' :is-scroll="true" :current="current" @change="tabChange"></u-tabs>
  74. </view>
  75. <swiper :style="{height: '800rpx', width: '750rpx'}" :current="current" @change="swiperChange">
  76. <swiper-item v-for="(tabItem, tabIndex) in tab_list" :key="tabIndex">
  77. <scroll-view class="com" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="tabItem.isRefresher" @scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh">
  78. <view class="lf-m-t-20"></view>
  79. <lf-waterfall :list="tabItem.list" :listlength="tab_list.length" :tabindex='tabIndex' ref="uWaterfallFather"></lf-waterfall>
  80. <view class="loading-more lf-m-b-10">
  81. <text :class="{'loading-more-text': tabItem.loadingClass}" v-if="tabItem.list.length">{{tabItem.loadingText}}</text>
  82. <lf-nocontent v-else></lf-nocontent>
  83. <!-- <view>
  84. {{tabItem.list.length}}
  85. </view> -->
  86. </view>
  87. </scroll-view>
  88. </swiper-item>
  89. </swiper>
  90. </view>
  91. </view>
  92. </template>
  93. <script>
  94. import lfWaterfall from '@/components/lf-waterfall-shopdetails/lf-waterfall.vue';
  95. export default {
  96. components: {
  97. lfWaterfall
  98. },
  99. data() {
  100. return {
  101. title_tab: [
  102. {name:'推荐'},
  103. {name:'商品'}
  104. ],
  105. tab_list: [],
  106. current: 0,
  107. title_current:0,
  108. brand_id: 0,
  109. detail: {},
  110. search_val: ''
  111. }
  112. },
  113. onLoad(options){
  114. this.brand_id = options.id;
  115. this.getShopDetail();
  116. },
  117. methods: {
  118. getShopDetail(){
  119. this.$http.get({
  120. api: 'api/brand/detail',
  121. data: {
  122. brand_id: this.brand_id
  123. }
  124. }).then(res => {
  125. console.log("getShopDetail", res);
  126. this.detail = res.data.data;
  127. })
  128. },
  129. tabChange(index){
  130. this.current = index;
  131. this.clearTabItem();
  132. this.getData();
  133. },
  134. titletabChange(index){
  135. this.title_current = index;
  136. if(this.tab_list.length <= 0){
  137. this.initGoodsTabs();
  138. this.getData();
  139. }
  140. },
  141. initGoodsTabs(){
  142. let _public = {
  143. isRefresher: false,
  144. loadingClass: true,
  145. loadingText: '正在加载中',
  146. page: 1,
  147. isPage: true
  148. };
  149. this.tab_list = [{
  150. name: '综合',
  151. list: [],
  152. ..._public
  153. },{
  154. name: '销量',
  155. list: [],
  156. ..._public
  157. },{
  158. name: '上新',
  159. list: [],
  160. ..._public
  161. },{
  162. name: '价格',
  163. list: [],
  164. ..._public
  165. }]
  166. },
  167. getData() {
  168. let par = {
  169. brand_id: this.brand_id
  170. }
  171. let orderBy = ['','sale_count','updated_at','sell_price'][this.current];
  172. if(orderBy){
  173. par.orderBy = orderBy;
  174. }
  175. if(this.search_val){
  176. par.keyword = this.search_val;
  177. }
  178. this.$http.get({
  179. api: 'api/store/list',
  180. data: par
  181. }).then(res => {
  182. console.log("getDat", res);
  183. let tab_item = this.tab_list[this.current];
  184. let isPage = false; // TODO 默认没有下一页
  185. tab_item.isPage = isPage;
  186. if(!isPage){
  187. tab_item.loadingClass = false;
  188. tab_item.loadingText = '没有更多数据啦~';
  189. }
  190. tab_item.isRefresher = false;
  191. let data_list = res.data.data || [];
  192. let list = data_list.map(item => {
  193. return {
  194. id: item.id,
  195. original_price: item.market_price,
  196. picture: item.img,
  197. pictures: [item.img],
  198. price: item.min_price,
  199. product_id: item.brand_id,
  200. sale: item.sale_count,
  201. title: item.name
  202. }
  203. })
  204. if(tab_item.page == 1){
  205. tab_item.list = list;
  206. }else{
  207. tab_item.list.push(...list);
  208. }
  209. })
  210. },
  211. search(event){
  212. this.clearTabItem();
  213. this.getData();
  214. },
  215. // 滑块下标值变化
  216. swiperChange(event){
  217. this.current = event.detail.current;
  218. if(event.detail.source == '') return; // 如果是被动出发,没有事件类型则不做处理
  219. },
  220. // 页面触底,加载下一页
  221. onScrolltolower(){
  222. let tab_item = this.tab_list[this.current];
  223. if(tab_item.isPage){
  224. tab_item.page = tab_item.page + 1;
  225. this.getData();
  226. }
  227. },
  228. // scroll-view 下拉刷新
  229. onRefresherrefresh(){
  230. this.$u.throttle(() => {
  231. this.clearTabItem();
  232. this.getData();
  233. }, 200);
  234. },
  235. clearTabItem(){
  236. let tab_item = this.tab_list[this.current];
  237. tab_item.page = 1;
  238. tab_item.isPage = true;
  239. tab_item.isRefresher = true;
  240. tab_item.loadingClass = true;
  241. tab_item.loadingText = '正在加载中';
  242. tab_item.list = [];
  243. this.$set(this.tab_list, this.current, tab_item);
  244. this.$refs.uWaterfallFather[this.current].clear();
  245. }
  246. }
  247. }
  248. </script>
  249. <style>
  250. page {
  251. background-color: white;
  252. }
  253. </style>
  254. <style lang="scss" scoped>
  255. .search-icon {
  256. position: relative;
  257. bottom: 0;
  258. left: 54rpx;
  259. }
  260. /deep/.input-placeholder{
  261. color: #777;
  262. font-size: 28rpx;
  263. }
  264. .rom-search {
  265. width: 686rpx;
  266. height: 60rpx;
  267. background: #F4F8F8;
  268. border-radius: 30rpx;
  269. padding-left: 74rpx;
  270. font-size: 28rpx;
  271. }
  272. .recommend-box{
  273. display: flex;
  274. justify-content: space-between;
  275. padding: 30rpx 32rpx;
  276. flex-wrap: wrap;
  277. }
  278. .goods-rom {
  279. border-radius: 20rpx;
  280. width: 333rpx;
  281. height: max-content;
  282. background-color: white;
  283. box-shadow: 0px 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  284. &:nth-child(2n) {
  285. margin-right: 0;
  286. }
  287. &:nth-child(n + 3) {
  288. margin-top: 20rpx;
  289. }
  290. }
  291. .introduct {
  292. padding: 30rpx 32rpx;
  293. }
  294. .com{
  295. width: 100%;
  296. height: 100%;
  297. box-sizing: border-box;
  298. padding: 0rpx 28rpx;
  299. }
  300. .shop-head {
  301. width: 100%;
  302. height: 400rpx;
  303. position: relative;
  304. }
  305. .shop-flex {
  306. display: flex;
  307. padding: 30rpx;
  308. }
  309. .shop-title {
  310. width: 686rpx;
  311. height: 274rpx;
  312. border-radius: 20rpx;
  313. background-color: white;
  314. box-shadow: 0rpx 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  315. margin: 0 auto;
  316. position: relative;
  317. top: -32rpx;
  318. }
  319. .shop-img {
  320. width: 90rpx;
  321. height: 90rpx;
  322. margin-right: 15rpx;
  323. }
  324. .shop-function {
  325. width: 80rpx;
  326. height: 80rpx;
  327. border-radius: 50%;
  328. font-size: 40rpx;
  329. }
  330. .function-total {
  331. display: flex;
  332. justify-content: space-between;
  333. padding: 0 65rpx 0 65rpx;
  334. }
  335. /deep/.u-scroll-box {
  336. display: flex;
  337. justify-content: center;
  338. align-items: center;
  339. border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
  340. }
  341. /deep/.u-scroll-box .u-tab-bar {
  342. background-color: #15716E!important;
  343. width: 80rpx!important;
  344. position: absolute;
  345. left: 0;
  346. bottom: -12rpx;
  347. }
  348. /deep/.special_tab .u-tabs .u-scroll-box .u-tab-bar {
  349. background-color: #15716E!important;
  350. width: 56rpx!important;
  351. position: absolute;
  352. height: 5rpx!important;
  353. left: 8rpx;
  354. bottom: -4rpx;
  355. }
  356. /deep/ .u-tab-item {
  357. font-size: 28rpx!important;
  358. }
  359. //价格筛选伪类
  360. // /deep/.special_tab .u-tab-item:nth-child(4n) ::after{
  361. // font-size: 48rpx!important;
  362. // content: '';
  363. // color: red;
  364. // }
  365. // loading加载
  366. .loading-more {
  367. align-items: center;
  368. justify-content: center;
  369. padding-top: 10px;
  370. padding-bottom: 10px;
  371. text-align: center;
  372. font-size: 28rpx;
  373. color: #999;
  374. }
  375. .loading-more-text::before {
  376. content: '';
  377. width: 20px;
  378. height: 20px;
  379. display: inline-block;
  380. vertical-align: middle;
  381. -webkit-animation: weuiLoading 1s steps(12, end) infinite;
  382. animation: weuiLoading 1s steps(12, end) infinite;
  383. background-repeat: no-repeat;
  384. background-image: url("data:image/svg+xml;charset=utf8, %3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 100 100'%3E%3Cpath fill='none' d='M0 0h100v100H0z'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23E9E9E9' rx='5' ry='5' transform='translate(0 -30)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23989697' rx='5' ry='5' transform='rotate(30 105.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%239B999A' rx='5' ry='5' transform='rotate(60 75.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23A3A1A2' rx='5' ry='5' transform='rotate(90 65 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23ABA9AA' rx='5' ry='5' transform='rotate(120 58.66 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23B2B2B2' rx='5' ry='5' transform='rotate(150 54.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23BAB8B9' rx='5' ry='5' transform='rotate(180 50 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23C2C0C1' rx='5' ry='5' transform='rotate(-150 45.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23CBCBCB' rx='5' ry='5' transform='rotate(-120 41.34 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23D2D2D2' rx='5' ry='5' transform='rotate(-90 35 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23DADADA' rx='5' ry='5' transform='rotate(-60 24.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23E2E2E2' rx='5' ry='5' transform='rotate(-30 -5.98 65)'/%3E%3C/svg%3E");
  385. background-size: 100%;
  386. }
  387. @keyframes weuiLoading {
  388. 0% {
  389. transform: rotate3d(0, 0, 1, 0deg);
  390. }
  391. 100% {
  392. transform: rotate3d(0, 0, 1, 360deg);
  393. }
  394. }
  395. .list-warter {
  396. border-radius: 20rpx;
  397. margin: 10px 5px;
  398. margin-top: 0px;
  399. background-color: #ffffff;
  400. // padding: 8px;
  401. position: relative;
  402. overflow: hidden;
  403. box-shadow: 0rpx 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  404. }
  405. .u-close {
  406. position: absolute;
  407. top: 32rpx;
  408. right: 32rpx;
  409. }
  410. .list-image {
  411. width: 100%;
  412. border-radius: 4px;
  413. }
  414. .list-title {
  415. font-size: 28rpx;
  416. font-weight: bold;
  417. color: $u-main-color;
  418. }
  419. .list-label{
  420. position: absolute;
  421. bottom: 0;
  422. right: 0;
  423. background-color: rgba(0,0,0,0.5);
  424. width: 140rpx;
  425. height: 48rpx;
  426. border-radius: 20rpx 0rpx 0rpx 0rpx;
  427. font-size: 22rpx;
  428. color: #FFFFFF;
  429. line-height: 48rpx;
  430. text-align: center;
  431. }
  432. .list-tag {
  433. display: flex;
  434. margin-top: 5px;
  435. }
  436. .list-tag-owner {
  437. background-color: $u-type-error;
  438. color: #FFFFFF;
  439. display: flex;
  440. align-items: center;
  441. padding: 4rpx 14rpx;
  442. border-radius: 50rpx;
  443. font-size: 20rpx;
  444. line-height: 1;
  445. }
  446. .list-tag-text {
  447. border: 1px solid $u-type-primary;
  448. color: $u-type-primary;
  449. margin-left: 10px;
  450. border-radius: 50rpx;
  451. line-height: 1;
  452. padding: 4rpx 14rpx;
  453. display: flex;
  454. align-items: center;
  455. border-radius: 50rpx;
  456. font-size: 20rpx;
  457. }
  458. .list-price {
  459. font-size: 30rpx;
  460. color: $u-type-error;
  461. margin-top: 5px;
  462. display: flex;
  463. align-items: center;
  464. }
  465. </style>