bazaar.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. <template>
  2. <view class="container">
  3. <view v-if="isshow == 1">
  4. <view class="top">
  5. <view class="vheight"></view>
  6. <view class="input-box flex">
  7. <view class="input-content flex">
  8. <view class="iconfont iconsearch"></view>
  9. <view class="input"><input type="text" v-model="keyword" placeholder="请输入搜索内容" /></view>
  10. </view>
  11. <view class="input-button flex" @click="searchNew"><text>搜索</text></view>
  12. </view>
  13. </view>
  14. <view class="navbar">
  15. <view class="nav-item" :class="{ current: filterIndex === 0 }" @click="tabClick(0)">综合排序</view>
  16. <view class="nav-item" :class="{ current: filterIndex === 2 }" @click="tabClick(2)">
  17. <text>价格</text>
  18. <view class="p-box">
  19. <text :class="{ active: priceOrder === 1 && filterIndex === 2 }" class="iconfont iconfold"></text>
  20. <text :class="{ active: priceOrder === 2 && filterIndex === 2 }" class="iconfont iconfold xia"></text>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="box">
  25. <view class="box-title">
  26. <view class="left">艺绘</view>
  27. <view class="right" @click="navTo('/pages/index/cangp')">查看更多 ></view>
  28. </view>
  29. <view class="box-content" v-for="(item, index) in list" @click="buy(item)">
  30. <view class="img"><image :src="item.class_info.uri" mode=""></image></view>
  31. <view class="content-title">
  32. <view class="title">{{ item.class_info.name }}</view>
  33. <view class="text">持有者:{{ item.user.nickname }}</view>
  34. <view class="text">
  35. 价格:
  36. <span style="font-size: 32rpx; color:#A581FF">¥{{ item.price }}</span>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="btm" style="height: 44px;"></view>
  42. </view>
  43. <view class="jqqd" v-else>敬请期待</view>
  44. </view>
  45. </template>
  46. <script>
  47. import { getBargainList, getProducts } from '@/api/product.js';
  48. import { nftmall, nftDetail } from '@/api/order.js';
  49. // import {mapState} from 'vuex'
  50. import { loadIndexs } from '@/api/index.js';
  51. import { mapState, mapMutations } from 'vuex';
  52. // #ifdef H5
  53. import { weixindata, shareLoad } from '@/utils/wxAuthorized';
  54. // #endif
  55. export default {
  56. data() {
  57. return {
  58. list: [], //卡片信息
  59. page: 1,
  60. limit: 10,
  61. loadType: 'more',
  62. headerPosition: 'fixed',
  63. headerTop: '0px',
  64. filterIndex: 0, //查询类型
  65. priceOrder: 0, //1 价格从低到高 2价格从高到低
  66. text: [],
  67. article: [],
  68. page: 1,
  69. limit: 10,
  70. isshow: 1, //是否显示1显示2敬请期待
  71. keyword: '' //搜索内容
  72. };
  73. },
  74. computed: {
  75. ...mapState(['loginInterceptor', 'baseURL']),
  76. ...mapState('user', ['hasLogin', 'userInfo'])
  77. },
  78. onLoad: function(option) {
  79. if (this.hasLogin) {
  80. this.loadIndex();
  81. // this.getProduct();
  82. }
  83. },
  84. onShow: function() {
  85. if (this.hasLogin) {
  86. this.pdshow();
  87. this.loadIndex();
  88. // this.getProduct();
  89. }
  90. },
  91. // onReachBottom() {
  92. // this.getproducts();
  93. // },
  94. methods: {
  95. ...mapMutations(['setLat', 'setLon']),
  96. // 判断是否显示
  97. pdshow() {
  98. loadIndexs().then(e => {
  99. if (e.data.market_switch == '1') {
  100. this.isshow = 1;
  101. } else {
  102. this.isshow = 2;
  103. }
  104. });
  105. },
  106. //市场列表
  107. loadIndex() {
  108. let obj = this;
  109. let data = {
  110. page: obj.page,
  111. limit: obj.limit,
  112. key_word: obj.keyword
  113. };
  114. if (obj.filterIndex == 2) {
  115. if (obj.priceOrder == 1) {
  116. data.order = 'price_asc';
  117. } else {
  118. data.order = 'price_desc';
  119. }
  120. }
  121. nftmall(data).then(res => {
  122. // console.log(res, 'res');
  123. obj.list = res.data.list;
  124. // obj.carouselList = res.data.banner
  125. // console.log(res,'res');
  126. // obj.list = res.data.info.fastList
  127. });
  128. },
  129. // 搜索
  130. searchNew() {
  131. this.page = 1;
  132. this.loadIndex();
  133. },
  134. getProduct() {
  135. let obj = this;
  136. getProducts().then(res => {
  137. // obj.carouselList = res.data.banner
  138. // console.log(res,'rrrrrrrrr')
  139. // obj.list = res.list
  140. // console.log(obj.list, 'res');
  141. });
  142. },
  143. buy(item) {
  144. console.log(item, 'res');
  145. uni.navigateTo({
  146. url: '/pages/product/product?id=' + item.id + '&isSc=1'
  147. });
  148. },
  149. navTo(url) {
  150. uni.switchTab({
  151. url
  152. });
  153. },
  154. // 點擊搜索框
  155. clickSearch() {
  156. uni.navigateTo({
  157. url: '/pages/product/search'
  158. });
  159. },
  160. //筛选点击
  161. tabClick(index) {
  162. // 防止重复点击综合排序
  163. if (this.filterIndex === 0 && this.filterIndex === index) {
  164. return;
  165. }
  166. this.filterIndex = index;
  167. // 判断是否为销量优先
  168. if (index === 1) {
  169. this.numberOrder = this.numberOrder === 1 ? 2 : 1;
  170. }
  171. // 判断是否为价格优先
  172. if (index === 2) {
  173. this.priceOrder = this.priceOrder === 1 ? 2 : 1;
  174. }
  175. // 初始化页数
  176. this.page = 1;
  177. // 初始化数组
  178. uni.pageScrollTo({
  179. duration: 300,
  180. scrollTop: 0
  181. });
  182. this.loadIndex();
  183. },
  184. swiperChange() {}
  185. }
  186. };
  187. </script>
  188. <style lang="scss">
  189. page {
  190. width: 750rpx;
  191. min-height: 100%;
  192. // background: #111111;
  193. }
  194. .container {
  195. /* #ifdef H5 */
  196. padding-top: 100rpx;
  197. /* #endif */
  198. /* #ifdef APP */
  199. padding-top: calc(100rpx + var(--status-bar-height));
  200. /* #endif */
  201. }
  202. .top {
  203. position: fixed;
  204. z-index: 9999;
  205. top: 0;
  206. left: 0;
  207. width: 100%;
  208. .top-bg {
  209. position: absolute;
  210. top: 0;
  211. left: 0;
  212. right: 0;
  213. width: 100%;
  214. height: 100%;
  215. }
  216. .top-main {
  217. position: relative;
  218. z-index: 2;
  219. padding: 30rpx;
  220. .search-box {
  221. justify-content: center;
  222. width: 698rpx;
  223. height: 60rpx;
  224. background: #191919;
  225. // box-shadow: 0px 10rpx 20rpx 0px rgba(4, 114, 69, 0.22);
  226. border-radius: 30rpx;
  227. .search {
  228. width: 34rpx;
  229. height: 34rpx;
  230. }
  231. .search-font {
  232. margin-left: 14rpx;
  233. font-size: 28rpx;
  234. font-family: PingFang SC;
  235. font-weight: 500;
  236. color: #a4a4a4;
  237. }
  238. }
  239. }
  240. }
  241. .box {
  242. margin: 0 30rpx;
  243. .box-title {
  244. display: flex;
  245. justify-content: space-between;
  246. .left {
  247. font-size: 38rpx;
  248. font-family: PingFang SC;
  249. font-weight: bold;
  250. color: #ffffff;
  251. line-height: 120rpx;
  252. }
  253. .right {
  254. font-size: 24rpx;
  255. font-family: PingFang SC;
  256. font-weight: 500;
  257. color: #ffffff;
  258. line-height: 120rpx;
  259. }
  260. }
  261. .box-content {
  262. width: 690rpx;
  263. height: 915rpx;
  264. margin: 50rpx 0;
  265. .img {
  266. width: 690rpx;
  267. height: 690rpx;
  268. image {
  269. width: 100%;
  270. height: 100%;
  271. }
  272. }
  273. .content-title {
  274. margin-top: -10rpx;
  275. padding: 30rpx 20rpx;
  276. border-bottom-left-radius: 10rpx;
  277. border-bottom-right-radius: 10rpx;
  278. border: 2rpx solid #533a6a;
  279. // box-shadow: 0px 0px 20rpx 0px rgba(79,59,103,0.0600);
  280. .title {
  281. font-size: 39rpx;
  282. font-weight: bold;
  283. color: #ffffff;
  284. margin-bottom: 20rpx;
  285. }
  286. .text {
  287. margin: 10rpx 0;
  288. color: #ffffff;
  289. font-size: 26rpx;
  290. }
  291. }
  292. }
  293. }
  294. .popup-box {
  295. width: 522rpx;
  296. height: 605rpx;
  297. background-color: #ffffff;
  298. border-radius: 20rpx;
  299. position: relative;
  300. .img {
  301. position: relative;
  302. top: -56rpx;
  303. left: 0;
  304. width: 522rpx;
  305. height: 132rpx;
  306. display: flex;
  307. justify-content: center;
  308. image {
  309. border-radius: 20rpx 20rpx 0 0;
  310. width: 450rpx;
  311. height: 132rpx;
  312. }
  313. }
  314. .mian {
  315. margin-top: -44rpx;
  316. display: flex;
  317. flex-direction: column;
  318. align-items: center;
  319. // padding: 32rpx 32rpx;
  320. background-color: #ffffff;
  321. border-radius: 0 0 20rpx 20rpx;
  322. text-align: center;
  323. .delivery {
  324. font-size: 40rpx;
  325. color: #333333;
  326. display: flex;
  327. align-items: center;
  328. flex-direction: column;
  329. .title {
  330. }
  331. image {
  332. margin-top: 48rpx;
  333. width: 172rpx;
  334. height: 160rpx;
  335. }
  336. }
  337. .nocancel {
  338. font-size: 32rpx;
  339. color: #333333;
  340. margin-top: 14rpx;
  341. }
  342. .comfirm-box {
  343. margin-top: 52rpx;
  344. display: flex;
  345. // margin-bottom: 32rpx;
  346. // justify-content: space-around;
  347. .cancel {
  348. display: flex;
  349. align-items: center;
  350. justify-content: center;
  351. width: 197rpx;
  352. height: 74rpx;
  353. border: 1px solid #dcc786;
  354. border-radius: 38rpx;
  355. font-size: 32rpx;
  356. color: #605128;
  357. }
  358. .comfirm {
  359. margin-left: 32rpx;
  360. display: flex;
  361. align-items: center;
  362. justify-content: center;
  363. width: 197rpx;
  364. height: 74rpx;
  365. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  366. border-radius: 38px;
  367. font-size: 32rpx;
  368. color: #605128;
  369. }
  370. }
  371. }
  372. }
  373. .tongz {
  374. width: 690rpx;
  375. height: 70rpx;
  376. margin: 32rpx auto 0;
  377. padding: 18rpx 30rpx 18rpx 24rpx;
  378. align-items: center;
  379. position: relative;
  380. .tongz-bg {
  381. position: absolute;
  382. top: 0;
  383. right: 0;
  384. left: 0;
  385. width: 690rpx;
  386. height: 70rpx;
  387. image {
  388. width: 100%;
  389. height: 100%;
  390. }
  391. }
  392. .tongz-left {
  393. width: 640rpx;
  394. .image-left {
  395. width: 28rpx;
  396. height: 34rpx;
  397. }
  398. .tongz-font {
  399. margin-left: 22rpx;
  400. font-size: 28rpx;
  401. font-family: Source Han Sans CN;
  402. font-weight: 400;
  403. color: #0f253a;
  404. }
  405. }
  406. .tongz-right {
  407. position: relative;
  408. z-index: 11;
  409. width: 12rpx;
  410. height: 26rpx;
  411. image {
  412. width: 100%;
  413. height: 100%;
  414. }
  415. }
  416. }
  417. .vheight {
  418. height: var(--status-bar-height);
  419. background-color: #111111;
  420. }
  421. .input-box {
  422. padding: 25rpx;
  423. background-color: #111111;
  424. height: 44px;
  425. .iconsearch {
  426. font-size: 50rpx;
  427. }
  428. .leftIcon {
  429. padding-right: 10px;
  430. .icon {
  431. width: 20px;
  432. }
  433. }
  434. .input-content {
  435. border-radius: 99rpx;
  436. flex-grow: 1;
  437. padding: 10rpx 30rpx;
  438. background-color: rgba(231, 231, 231, 0.7);
  439. .input {
  440. flex-grow: 1;
  441. input {
  442. font-size: $font-lg;
  443. }
  444. }
  445. }
  446. .input-button {
  447. padding-left: 20rpx;
  448. font-size: $font-lg;
  449. height: 100%;
  450. color: #ffffff;
  451. }
  452. }
  453. .navbar {
  454. display: flex;
  455. width: 100%;
  456. height: 80rpx;
  457. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.06);
  458. z-index: 10;
  459. .nav-item {
  460. flex: 1;
  461. display: flex;
  462. justify-content: center;
  463. align-items: center;
  464. height: 100%;
  465. font-size: 30rpx;
  466. color: #fff;
  467. position: relative;
  468. &.current {
  469. color: #FDD58A;
  470. &:after {
  471. content: '';
  472. position: absolute;
  473. left: 50%;
  474. bottom: 0;
  475. transform: translateX(-50%);
  476. width: 120rpx;
  477. height: 0;
  478. border-bottom: 4rpx solid #FDD58A;
  479. }
  480. }
  481. }
  482. .p-box {
  483. display: flex;
  484. flex-direction: column;
  485. .iconfont {
  486. display: flex;
  487. align-items: center;
  488. justify-content: center;
  489. width: 30rpx;
  490. height: 14rpx;
  491. line-height: 1;
  492. margin-left: 4rpx;
  493. font-size: 26rpx;
  494. color: #888;
  495. &.active {
  496. color: #917bf6;
  497. }
  498. }
  499. .xia {
  500. transform: scaleY(-1);
  501. }
  502. }
  503. .cate-item {
  504. display: flex;
  505. justify-content: center;
  506. align-items: center;
  507. height: 100%;
  508. width: 80rpx;
  509. position: relative;
  510. font-size: 44rpx;
  511. &:after {
  512. content: '';
  513. position: absolute;
  514. left: 0;
  515. top: 50%;
  516. transform: translateY(-50%);
  517. border-left: 1px solid #ddd;
  518. width: 0;
  519. height: 36rpx;
  520. }
  521. }
  522. }
  523. .jqqd {
  524. color: #fff;
  525. text-align: center;
  526. font-size: 40rpx;
  527. }
  528. </style>