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

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