index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718
  1. <template>
  2. <mobile-frame>
  3. <view class="main">
  4. <view class="one">
  5. <view class="one_1" v-if="barActive=='0'">
  6. <view class="first">
  7. <image class="image" :src="info.logo&&info.logo.length>0?info.logo[0].url:''" mode=""></image>
  8. </view>
  9. <view class="second">
  10. <scroll-view scroll-y="true" class="scroll-view">
  11. <view class="list-scroll-view">
  12. <view class="list" v-for="(item,index) in shoplist" :key="index" @tap="toBuy(item)">
  13. <image class="image" :src="item.file&&item.file.length>0?item.file[0].url:''" mode=""></image>
  14. <view class="name">
  15. {{item.name}}
  16. </view>
  17. <view class="other">
  18. <view class="money">
  19. <text>¥</text>
  20. <text>{{item.sell_money}}</text>
  21. </view>
  22. <view class="btn">
  23. <button type="default" size="mini">购买</button>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </scroll-view>
  29. </view>
  30. </view>
  31. <view class="one_3" v-else-if="barActive=='1'">
  32. <view class="first">
  33. <input type="text" v-model="searchInfo.name" @input="toInput" placeholder="搜索商品">
  34. </view>
  35. <view class="second">
  36. <scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
  37. <view class="list-scroll-view">
  38. <view class="second_1">
  39. <view :class="['list',condActive==index?'activeList':'']" v-for="(item,index) in condList" :key="index" @tap="toCond(index,item)">
  40. <view class="name">
  41. {{item.name}}
  42. </view>
  43. <view class="icon">
  44. <view class="icon_1">
  45. <text :class="['iconfont',item.shangActive]" v-if="condActive==index&&shang==true"></text>
  46. <text :class="['iconfont',item.shang]" v-else></text>
  47. </view>
  48. <view class="icon_1">
  49. <text :class="['iconfont', item.xiaActive]" v-if="condActive==index&&xia==true"></text>
  50. <text :class="['iconfont', item.xia]" v-else></text>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="second_2">
  56. <view class="list" v-for="(item,index) in allList" :key="index">
  57. <image class="image" :src="item.file&&item.file.length>0?item.file[0].url:''" mode=""></image>
  58. <view class="sale" v-if="item.is_sale==true">
  59. <text>已售尽</text>
  60. </view>
  61. <view class="name">
  62. {{item.name}}
  63. </view>
  64. <view class="other">
  65. <view class="money">
  66. <text>¥</text>
  67. <text>{{item.sell_money}}</text>
  68. </view>
  69. <view class="other_1">{{item.evaluate||0}}人评价</view>
  70. <view class="btn" v-if="item.is_sale==false">
  71. <text class="iconfont icon-gouwuche"></text>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. </scroll-view>
  78. </view>
  79. </view>
  80. <view class="one_4" v-else-if="barActive=='2'">
  81. <view class="first">
  82. <image class="image" :src="info.logo&&info.logo.length>0?info.logo[0].url:''" mode=""></image>
  83. <view class="name">{{info.name}}</view>
  84. </view>
  85. <view class="second">
  86. <view class="second_1">
  87. <view class="grade">
  88. <view>{{info.goods_score||0}}</view>
  89. 商品
  90. </view>
  91. <view class="grade">
  92. <view>{{info.send_score||0}}</view>
  93. 发货
  94. </view>
  95. <view class="grade">
  96. <view>{{info.service_score||0}}</view>
  97. 服务
  98. </view>
  99. </view>
  100. <view class="second_2">
  101. <view class="second_2_bor">
  102. <image class="image" :src="info.logo&&info.logo.length>0?info.logo[0].url:''" mode=""></image>
  103. </view>
  104. <view class="txt">
  105. 店铺二维码
  106. </view>
  107. </view>
  108. </view>
  109. <view class="collect">
  110. <text v-if="!collection" @click="toCollect" class="iconfont icon-yduishoucangkongxin"></text>
  111. <text v-else @click="toCollect" class="iconfont icon-yduishoucangshixin"></text>
  112. </view>
  113. </view>
  114. </view>
  115. <view class="two">
  116. <view class="list" v-for="(item,index) in barList" :key="index" @tap="barChange(index,item)">
  117. <view class="icon">
  118. <text :class="['iconfont',barActive==index?item.acticon:item.icon]"></text>
  119. </view>
  120. <view :class="['name',barActive==index?'activename':'']">
  121. {{item.name}}
  122. </view>
  123. </view>
  124. </view>
  125. </view>
  126. </mobile-frame>
  127. </template>
  128. <script>
  129. export default {
  130. data() {
  131. return {
  132. id: '',
  133. barActive: '0',
  134. barList: [ //底部菜单
  135. {
  136. icon: 'icon-shangdian',
  137. acticon: "icon-shangdian-copy",
  138. name: '微店首页'
  139. },
  140. {
  141. icon: 'icon-shangpinfenlei',
  142. acticon: "icon-shangpinfenlei-copy",
  143. name: '全部商品'
  144. },
  145. {
  146. icon: 'icon-qiyejianjie',
  147. acticon: "icon-qiyejianjie-copy",
  148. name: '店铺简介'
  149. }
  150. ],
  151. // 店铺信息
  152. info: {},
  153. // 店铺部分商品
  154. shoplist: [],
  155. active: '0',
  156. typeList: [ //
  157. {
  158. label: '进口食品'
  159. }
  160. ],
  161. list: [ //
  162. {
  163. label: '进口食品'
  164. }
  165. ],
  166. // 收藏
  167. collection: false,
  168. searchInfo: {},
  169. allList: [ //
  170. {
  171. "_id": "63353758101f3c01048c4f61",
  172. "file": [{
  173. "id": "20220929141236",
  174. "name": "f0e22552dddcf494f9720c655a8420a.png",
  175. "uri": "/files/point/goods/20220929141236.png",
  176. "url": "https://broadcast.waityou24.cn/files/point/goods/20220929141236.png",
  177. "uid": 1664431956868,
  178. "status": "success"
  179. }],
  180. "name": "test",
  181. "sell_money": 0.1
  182. }
  183. ],
  184. condActive: 0,
  185. shang: false,
  186. xia: false,
  187. condList: [ // 筛选
  188. {
  189. name: '默认',
  190. },
  191. {
  192. name: '销量',
  193. shang: 'icon-shangjiantou',
  194. shangActive: 'icon-shangjiantou-copy',
  195. xia: 'icon-xiajiantou',
  196. xiaActive: 'icon-xiajiantou-copy'
  197. },
  198. {
  199. name: '价格',
  200. shang: 'icon-shangjiantou',
  201. shangActive: 'icon-shangjiantou-copy',
  202. xia: 'icon-xiajiantou',
  203. xiaActive: 'icon-xiajiantou-copy'
  204. },
  205. {
  206. name: '浏览量',
  207. shang: 'icon-shangjiantou',
  208. shangActive: 'icon-shangjiantou-copy',
  209. xia: 'icon-xiajiantou',
  210. xiaActive: 'icon-xiajiantou-copy'
  211. }
  212. ]
  213. };
  214. },
  215. onLoad: function(e) {
  216. const that = this;
  217. that.$set(that, `id`, e.id || '6333d71d32c5f69745f9bd32');
  218. that.search()
  219. },
  220. onShow: function() {},
  221. methods: {
  222. // 查询信息
  223. async search() {
  224. const that = this;
  225. if (that.id) {
  226. // 查询店铺信息
  227. const res = await that.$api(`/shop/${that.id}`, 'GET');
  228. if (res.errcode == '0') that.$set(that, `info`, res.data);
  229. // 查询店铺商品
  230. that.searchShopMarket();
  231. }
  232. },
  233. // 查询店铺商品
  234. async searchShopMarket() {
  235. const that = this;
  236. const res = await that.$api(`/viewGoods/indexGoodsList`, 'GET', {
  237. shop: that.id,
  238. skip: 0,
  239. limit: 20
  240. })
  241. if (res.errcode == '0') that.$set(that, `shoplist`, res.data);
  242. },
  243. // 购买
  244. toBuy(item) {
  245. if (item && item._id) {
  246. uni.navigateTo({
  247. url: `/pagesHome/order/detail?id=${item._id}`
  248. })
  249. }
  250. },
  251. // 选择底部菜单
  252. barChange(index, item) {
  253. const that = this;
  254. that.$set(that, `barActive`, index);
  255. uni.setNavigationBarTitle({
  256. title: item.name
  257. });
  258. },
  259. // 公共跳转
  260. toCommon(e) {
  261. uni.navigateTo({
  262. url: `/${e}`
  263. })
  264. },
  265. // 输入框
  266. toInput(e) {
  267. const that = this;
  268. that.$set(that.searchInfo, `name`, e.detail.value)
  269. },
  270. toChange(index, e) {
  271. const that = this;
  272. that.$set(that, `active`, index);
  273. // that.searchRight(e);
  274. },
  275. // 筛选
  276. toCond(index, e) {
  277. const that = this;
  278. that.$set(that, `condActive`, index);
  279. if (that.xia == false) {
  280. that.$set(that, `shang`, false);
  281. that.$set(that, `xia`, true);
  282. } else if (that.xia == true) {
  283. that.$set(that, `shang`, true);
  284. that.$set(that, `xia`, false);
  285. }
  286. },
  287. // 收藏
  288. toCollect() {
  289. const that = this;
  290. that.collection = !that.collection;
  291. if (that.collection == true) {
  292. uni.showToast({
  293. title: `收藏成功`,
  294. icon: 'none'
  295. })
  296. } else {
  297. uni.showToast({
  298. title: `取消成功`,
  299. icon: 'none'
  300. })
  301. }
  302. },
  303. // 分页
  304. toPage() {}
  305. }
  306. }
  307. </script>
  308. <style lang="scss">
  309. .main {
  310. display: flex;
  311. flex-direction: column;
  312. width: 100vw;
  313. height: 100vh;
  314. .one {
  315. position: relative;
  316. flex-grow: 1;
  317. .one_1 {
  318. display: flex;
  319. flex-direction: column;
  320. width: 96vw;
  321. height: 90vh;
  322. padding: 2vw;
  323. background-color: var(--fFB1Color);
  324. .first {
  325. margin: 0 0 2vw 0;
  326. .image {
  327. width: 100%;
  328. height: 50vw;
  329. }
  330. }
  331. .second {
  332. position: relative;
  333. flex-grow: 1;
  334. .list {
  335. margin: 0 2vw 2vw 0;
  336. background-color: var(--fffColor);
  337. padding: 2vw;
  338. width: 43vw;
  339. border-radius: 5px;
  340. .image {
  341. width: 100%;
  342. height: 49vw;
  343. margin: 0 0 1vw 0;
  344. }
  345. .name {
  346. font-size: var(--font15Size);
  347. margin: 0 0 2vw 0;
  348. }
  349. .other {
  350. display: flex;
  351. flex-direction: row;
  352. justify-content: space-between;
  353. .money {
  354. color: var(--ff0Color);
  355. text:nth-child(1) {
  356. font-size: var(--font12Size);
  357. }
  358. }
  359. .btn {
  360. button {
  361. border-radius: 25px;
  362. color: var(--fffColor);
  363. background-color: var(--ff0Color);
  364. font-size: var(--font12Size);
  365. }
  366. }
  367. }
  368. }
  369. .list:nth-child(2n) {
  370. margin: 0 0 2vw 0;
  371. }
  372. }
  373. }
  374. .one_2 {
  375. height: 91vh;
  376. display: flex;
  377. flex-direction: row;
  378. padding: 2vw;
  379. .first_1 {
  380. position: relative;
  381. width: 25vw;
  382. background-color: #fafafa;
  383. display: flex;
  384. flex-direction: column;
  385. .list {
  386. text-align: center;
  387. padding: 2.5vw 0;
  388. border-bottom: 1px solid var(--f1Color);
  389. text {
  390. font-size: var(--font14Size);
  391. }
  392. }
  393. .listActive {
  394. background-color: var(--fffColor);
  395. }
  396. }
  397. .first_2 {
  398. padding: 2vw;
  399. flex-grow: 1;
  400. position: relative;
  401. display: flex;
  402. flex-direction: column;
  403. .list {
  404. margin: 0 0 2vw 0;
  405. padding: 2vw;
  406. .title {
  407. font-size: var(--font16Size);
  408. margin: 0 0 2vw 0;
  409. }
  410. .market {
  411. display: flex;
  412. flex-direction: row;
  413. flex-wrap: wrap;
  414. .marketList {
  415. text-align: center;
  416. margin: 0 2vw 2vw 0;
  417. width: 22vw;
  418. .image {
  419. width: 100%;
  420. height: 15vw;
  421. }
  422. .name {
  423. font-size: var(--font14Size);
  424. }
  425. }
  426. .marketList:nth-child(3n) {
  427. margin: 0 0 2vw 0;
  428. }
  429. }
  430. }
  431. }
  432. }
  433. .one_3 {
  434. display: flex;
  435. flex-direction: column;
  436. width: 100vw;
  437. height: 90vh;
  438. .first {
  439. border-bottom: 1px solid var(--f85Color);
  440. padding: 2vw;
  441. input {
  442. padding: 2vw;
  443. background-color: var(--f1Color);
  444. font-size: var(--font14Size);
  445. border-radius: 5px;
  446. }
  447. }
  448. .second {
  449. position: relative;
  450. flex-grow: 1;
  451. .second_1 {
  452. width: 96vw;
  453. background-color: var(--fffColor);
  454. padding: 2vw;
  455. display: flex;
  456. flex-direction: row;
  457. justify-content: space-around;
  458. .list {
  459. display: flex;
  460. flex-direction: row;
  461. .icon {
  462. position: relative;
  463. top: -5px;
  464. left: 2px;
  465. .icon_1 {
  466. height: 10px;
  467. .iconfont {
  468. font-size: 12px;
  469. }
  470. }
  471. }
  472. }
  473. .activeList {
  474. .name {
  475. color: #ff0000;
  476. }
  477. }
  478. }
  479. .second_2 {
  480. display: flex;
  481. flex-direction: row;
  482. flex-wrap: wrap;
  483. padding: 2vw 2vw 0 2vw;
  484. background-color: var(--f1Color);
  485. .list {
  486. position: relative;
  487. width: 43vw;
  488. margin: 0 2vw 2vw 0;
  489. padding: 2vw;
  490. border-radius: 9px;
  491. background-color: var(--fffColor);
  492. .image {
  493. width: 100%;
  494. height: 40vw;
  495. }
  496. .sale {
  497. position: absolute;
  498. top: 18vw;
  499. text-align: center;
  500. width: 43vw;
  501. text {
  502. background-color: #0000005f;
  503. border-radius: 90px;
  504. display: inline-block;
  505. width: 15vw;
  506. height: 15vw;
  507. color: var(--fffColor);
  508. text-align: center;
  509. line-height: 15vw;
  510. }
  511. }
  512. .name {
  513. font-size: var(--font16Size);
  514. margin: 0 0 1vw 0;
  515. }
  516. .other {
  517. display: flex;
  518. flex-direction: row;
  519. justify-content: space-between;
  520. .money {
  521. font-size: var(--font14Size);
  522. color: var(--ff0Color);
  523. text:nth-child(1) {
  524. font-size: var(--font12Size);
  525. }
  526. }
  527. .other_1 {
  528. flex-grow: 1;
  529. margin: 0 0 0 2vw;
  530. font-size: var(--font12Size);
  531. color: var(--f85Color);
  532. }
  533. .btn {
  534. button {
  535. font-size: var(--font20Size);
  536. }
  537. }
  538. }
  539. }
  540. .list:nth-child(2n) {
  541. margin: 0 0 2vw 0;
  542. }
  543. }
  544. }
  545. }
  546. .one_4 {
  547. .first {
  548. display: flex;
  549. flex-direction: column;
  550. align-items: center;
  551. background-color: var(--fFB1Color);
  552. border-bottom-right-radius: 10vw;
  553. border-bottom-left-radius: 10vw;
  554. .image {
  555. width: 20vw;
  556. height: 20vw;
  557. border-radius: 20vw;
  558. }
  559. .name {
  560. margin: 2vw 0;
  561. font-size: var(--font16Szie);
  562. font-weight: bold;
  563. color: var(--mainColor);
  564. }
  565. }
  566. .second {
  567. margin: 2vw 0;
  568. .second_1 {
  569. display: flex;
  570. justify-content: space-evenly;
  571. .grade {
  572. display: flex;
  573. flex-direction: column;
  574. align-items: center;
  575. color: var(--f85Color);
  576. font-size: var(--font13Size);
  577. view {
  578. margin: 1vw 0 0 0;
  579. color: var(--ff0Color);
  580. }
  581. }
  582. }
  583. .second_2 {
  584. display: flex;
  585. justify-content: center;
  586. flex-direction: column;
  587. margin: 15vw 25vw 0 25vw;
  588. text-align: center;
  589. background: #b2b2b2;
  590. padding: 2vw;
  591. border-radius: 5px;
  592. .second_2_bor {
  593. .image {
  594. width: 100%;
  595. height: 40vw;
  596. }
  597. }
  598. .txt {
  599. color: #fff;
  600. font-size: 14px;
  601. margin: 2vw 0;
  602. }
  603. }
  604. }
  605. }
  606. .collect {
  607. position: fixed;
  608. top: 0;
  609. right: 2vw;
  610. .iconfont {
  611. font-size: 25px;
  612. }
  613. }
  614. }
  615. .two {
  616. display: flex;
  617. flex-direction: row;
  618. justify-content: space-around;
  619. border-top: 1px solid #f1f1f1;
  620. .list {
  621. padding: 1vw 0;
  622. text-align: center;
  623. .icon {}
  624. .name {
  625. font-size: 12px;
  626. }
  627. .activename {
  628. color: var(--fFB1Color);
  629. }
  630. }
  631. }
  632. }
  633. .scroll-view {
  634. position: absolute;
  635. top: 0;
  636. left: 0;
  637. right: 0;
  638. bottom: 0;
  639. .list-scroll-view {
  640. display: flex;
  641. flex-direction: row;
  642. flex-wrap: wrap;
  643. }
  644. }
  645. </style>