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

506 lines
14 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 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. // TODO 检查list是否正常
  208. if(tab_item.page == 1){
  209. tab_item.list = list;
  210. }else{
  211. tab_item.list.push(...list);
  212. }
  213. })
  214. },
  215. search(event){
  216. this.clearTabItem();
  217. this.getData();
  218. },
  219. // 滑块下标值变化
  220. swiperChange(event){
  221. this.current = event.detail.current;
  222. if(event.detail.source == '') return; // 如果是被动出发,没有事件类型则不做处理
  223. this.clearTabItem();
  224. this.getData();
  225. },
  226. // 页面触底,加载下一页
  227. onScrolltolower(){
  228. let tab_item = this.tab_list[this.current];
  229. if(tab_item.isPage){
  230. tab_item.page = tab_item.page + 1;
  231. this.getData();
  232. }
  233. },
  234. // scroll-view 下拉刷新
  235. onRefresherrefresh(){
  236. this.$u.throttle(() => {
  237. this.clearTabItem();
  238. this.getData();
  239. }, 200);
  240. },
  241. clearTabItem(){
  242. let tab_item = this.tab_list[this.current];
  243. tab_item.page = 1;
  244. tab_item.isPage = true;
  245. tab_item.isRefresher = true;
  246. tab_item.loadingClass = true;
  247. tab_item.loadingText = '正在加载中';
  248. tab_item.list = [];
  249. this.$set(this.tab_list, this.current, tab_item);
  250. this.$refs.uWaterfallFather[this.current].clear();
  251. }
  252. },
  253. onShareAppMessage(){
  254. return {
  255. title: '给你分享了一家店铺,我觉得很不错哦~'
  256. }
  257. }
  258. }
  259. </script>
  260. <style>
  261. page {
  262. background-color: white;
  263. }
  264. </style>
  265. <style lang="scss" scoped>
  266. .search-icon {
  267. position: relative;
  268. bottom: 0;
  269. left: 54rpx;
  270. }
  271. /deep/.input-placeholder{
  272. color: #777;
  273. font-size: 28rpx;
  274. }
  275. .rom-search {
  276. width: 686rpx;
  277. height: 60rpx;
  278. background: #F4F8F8;
  279. border-radius: 30rpx;
  280. padding-left: 74rpx;
  281. font-size: 28rpx;
  282. }
  283. .recommend-box{
  284. display: flex;
  285. justify-content: space-between;
  286. padding: 30rpx 32rpx;
  287. flex-wrap: wrap;
  288. }
  289. .goods-rom {
  290. border-radius: 20rpx;
  291. width: 333rpx;
  292. height: max-content;
  293. background-color: white;
  294. box-shadow: 0px 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  295. &:nth-child(2n) {
  296. margin-right: 0;
  297. }
  298. &:nth-child(n + 3) {
  299. margin-top: 20rpx;
  300. }
  301. }
  302. .introduct {
  303. padding: 30rpx 32rpx;
  304. }
  305. .com{
  306. width: 100%;
  307. height: 100%;
  308. box-sizing: border-box;
  309. padding: 0rpx 28rpx;
  310. }
  311. .shop-head {
  312. width: 100%;
  313. height: 400rpx;
  314. position: relative;
  315. }
  316. .shop-flex {
  317. display: flex;
  318. padding: 30rpx;
  319. }
  320. .shop-title {
  321. width: 686rpx;
  322. height: 274rpx;
  323. border-radius: 20rpx;
  324. background-color: white;
  325. box-shadow: 0rpx 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  326. margin: 0 auto;
  327. position: relative;
  328. top: -32rpx;
  329. }
  330. .shop-img {
  331. width: 90rpx;
  332. height: 90rpx;
  333. margin-right: 15rpx;
  334. }
  335. .shop-function {
  336. width: 80rpx;
  337. height: 80rpx;
  338. border-radius: 50%;
  339. font-size: 40rpx;
  340. }
  341. .function-total {
  342. display: flex;
  343. justify-content: space-between;
  344. padding: 0 65rpx 0 65rpx;
  345. }
  346. .menu-btn{
  347. margin: 0;
  348. padding: 0;
  349. background-color: transparent;
  350. line-height: 1.5;
  351. }
  352. /deep/.u-scroll-box {
  353. display: flex;
  354. justify-content: center;
  355. align-items: center;
  356. border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
  357. }
  358. /deep/.u-scroll-box .u-tab-bar {
  359. background-color: #15716E!important;
  360. width: 80rpx!important;
  361. position: absolute;
  362. left: 0;
  363. bottom: -12rpx;
  364. }
  365. /deep/.special_tab .u-tabs .u-scroll-box .u-tab-bar {
  366. background-color: #15716E!important;
  367. width: 56rpx!important;
  368. position: absolute;
  369. height: 5rpx!important;
  370. left: 8rpx;
  371. bottom: -4rpx;
  372. }
  373. /deep/ .u-tab-item {
  374. font-size: 28rpx!important;
  375. }
  376. //价格筛选伪类
  377. // /deep/.special_tab .u-tab-item:nth-child(4n) ::after{
  378. // font-size: 48rpx!important;
  379. // content: '';
  380. // color: red;
  381. // }
  382. // loading加载
  383. .loading-more {
  384. align-items: center;
  385. justify-content: center;
  386. padding-top: 10px;
  387. padding-bottom: 10px;
  388. text-align: center;
  389. font-size: 28rpx;
  390. color: #999;
  391. }
  392. .loading-more-text::before {
  393. content: '';
  394. width: 20px;
  395. height: 20px;
  396. display: inline-block;
  397. vertical-align: middle;
  398. -webkit-animation: weuiLoading 1s steps(12, end) infinite;
  399. animation: weuiLoading 1s steps(12, end) infinite;
  400. background-repeat: no-repeat;
  401. 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");
  402. background-size: 100%;
  403. }
  404. @keyframes weuiLoading {
  405. 0% {
  406. transform: rotate3d(0, 0, 1, 0deg);
  407. }
  408. 100% {
  409. transform: rotate3d(0, 0, 1, 360deg);
  410. }
  411. }
  412. .list-warter {
  413. border-radius: 20rpx;
  414. margin: 10px 5px;
  415. margin-top: 0px;
  416. background-color: #ffffff;
  417. // padding: 8px;
  418. position: relative;
  419. overflow: hidden;
  420. box-shadow: 0rpx 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  421. }
  422. .u-close {
  423. position: absolute;
  424. top: 32rpx;
  425. right: 32rpx;
  426. }
  427. .list-image {
  428. width: 100%;
  429. border-radius: 4px;
  430. }
  431. .list-title {
  432. font-size: 28rpx;
  433. font-weight: bold;
  434. color: $u-main-color;
  435. }
  436. .list-label{
  437. position: absolute;
  438. bottom: 0;
  439. right: 0;
  440. background-color: rgba(0,0,0,0.5);
  441. width: 140rpx;
  442. height: 48rpx;
  443. border-radius: 20rpx 0rpx 0rpx 0rpx;
  444. font-size: 22rpx;
  445. color: #FFFFFF;
  446. line-height: 48rpx;
  447. text-align: center;
  448. }
  449. .list-tag {
  450. display: flex;
  451. margin-top: 5px;
  452. }
  453. .list-tag-owner {
  454. background-color: $u-type-error;
  455. color: #FFFFFF;
  456. display: flex;
  457. align-items: center;
  458. padding: 4rpx 14rpx;
  459. border-radius: 50rpx;
  460. font-size: 20rpx;
  461. line-height: 1;
  462. }
  463. .list-tag-text {
  464. border: 1px solid $u-type-primary;
  465. color: $u-type-primary;
  466. margin-left: 10px;
  467. border-radius: 50rpx;
  468. line-height: 1;
  469. padding: 4rpx 14rpx;
  470. display: flex;
  471. align-items: center;
  472. border-radius: 50rpx;
  473. font-size: 20rpx;
  474. }
  475. .list-price {
  476. font-size: 30rpx;
  477. color: $u-type-error;
  478. margin-top: 5px;
  479. display: flex;
  480. align-items: center;
  481. }
  482. </style>