Store.vue 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118
  1. <template>
  2. <van-pull-refresh success-text="加载成功" success-duration="500" class="discover" v-model="isLoading" @refresh="onRefresh">
  3. <van-sticky ref="top">
  4. <div class="padding-safe-top" style="background: #222426">
  5. <div class="top">
  6. <div class="top-btn">
  7. <div class="btn" :class="{ active: active === 'explore' }" @click="changeActive('explore')">
  8. 我拥有的
  9. </div>
  10. <div class="btn" :class="{ active: active === 'likeIt' }" @click="changeActive('likeIt')">
  11. 我喜欢的
  12. </div>
  13. <div class="btn" v-if="showRoom" :class="{ active: active === 'showRoom' }"
  14. @click="changeActive('showRoom')">
  15. 我的展馆
  16. </div>
  17. <div class="btn" v-if="!$store.state.reviewPay" :class="{ active: active === 'creator' }"
  18. @click="changeActive('creator')">
  19. 我卖出的
  20. </div>
  21. <div class="btn" :class="{ active: active === 'coupon' }" @click="changeActive('coupon')">
  22. 兑换券
  23. </div>
  24. </div>
  25. <div class="search" v-if="isLogin && active !== 'coupon'"
  26. @click="$router.push('/assetSearch?status=' + status)">
  27. <div class="search_division"></div>
  28. <img src="@assets/svgs/search.svg" alt="" />
  29. </div>
  30. </div>
  31. <van-tabs class="darkTabs" v-model:active="type" line-width="16" line-height="2" :ellipsis="false"
  32. @click="changeTab" v-if="active != 'likeIt'">
  33. <van-tab :title="item.label" :name="item.value"
  34. :title-class="item.type === 'select' && sortDes ? sortDes : ''" :key="index"
  35. v-for="(item, index) in typeOptions">
  36. <template v-if="item.type === 'select'" #title>
  37. <div class="tab">
  38. <span>{{ item.label }}</span>
  39. <van-icon size="8" name="arrow-up" />
  40. <van-icon size="8" name="arrow-down" />
  41. </div>
  42. </template>
  43. </van-tab>
  44. </van-tabs>
  45. <van-tabs class="darkTabs" v-model:active="type" line-width="16" line-height="2" :ellipsis="false"
  46. @change="change" v-else-if="active === 'likeIt'">
  47. <van-tab :title="item.label" :name="item.type"
  48. :title-class="item.type === 'select' && sortDes ? sortDes : ''" :key="index"
  49. v-for="(item, index) in typeOptionLike">
  50. <template v-if="item.type === 'select'" #title>
  51. <div class="tab">
  52. <span>{{ item.label }}</span>
  53. <van-icon size="8" name="arrow-up" />
  54. <van-icon size="8" name="arrow-down" />
  55. </div>
  56. </template>
  57. </van-tab>
  58. </van-tabs>
  59. <div v-if="type == 'metadomainName'" class="metadomainName_list">
  60. <div v-for="(item, index) in metadomainList" :key="index" @click="domainBtn(index)"
  61. :class="metadomainType == item.type ? 'metadomainName_list_con' : ''"
  62. class="metadomainName_list_cons">
  63. {{ item.name }}
  64. </div>
  65. </div>
  66. </div>
  67. <!-- <van-button
  68. color="#272828"
  69. round
  70. size="mini"
  71. icon="arrow-down"
  72. icon-position="right"
  73. class="select"
  74. @click="showSelect = true"
  75. >
  76. 全部
  77. </van-button> -->
  78. </van-sticky>
  79. <van-list class="box-list" :style="{
  80. paddingBottom: showList.length % 3 === 0 ? '35.73vw' : '20px'
  81. }" :class="{ couponList: active === 'coupon', roomList: active === 'showRoom' }" v-model:loading="loading"
  82. :finished="finished" finished-text="" @load="getList" v-if="active != 'likeIt' && type != 'metadomainName'">
  83. <template v-for="(item, index) in showList" :key="index">
  84. <coupon-info :info="item" v-if="active == 'coupon'"></coupon-info>
  85. <show-info v-model:info="list[index]" v-else-if="active == 'showRoom'"></show-info>
  86. <div class="asset-list" v-else-if="type == 'xingtu'" :style="{
  87. backgroundImage:
  88. active !== 'coupon' && active !== 'showRoom' && showList.length > 0
  89. ? `url(${require('../assets/png-zhantai.png')})`
  90. : ''
  91. }">
  92. <star-asset-info :info="asset" v-for="(asset, assetIndex) in item" :key="assetIndex"></star-asset-info>
  93. </div>
  94. <div class="asset-list" v-else :style="{
  95. backgroundImage:
  96. active !== 'coupon' && active !== 'showRoom' && showList.length > 0
  97. ? `url(${require('../assets/png-zhantai.png')})`
  98. : ''
  99. }">
  100. <asset-info :info="asset" v-for="(asset, assetIndex) in item" :key="assetIndex" :num="asset.num"
  101. @showMore="showMore"></asset-info>
  102. </div>
  103. </template>
  104. <van-empty v-if="empty || (showList.length === 0 && !loading)"
  105. :description="active == 'coupon' ? '你还没有优惠券哦~' : '你还没有藏品哦~'" :image="
  106. require(`@assets/${active == 'coupon' ? 'kong_png_duihuanquanhei' : 'empty_img_asset_dark'}.png`)
  107. " />
  108. <img src="../assets/icon_zhiding.png" @click="goTop" class="goTop" v-if="bodyScroll > 100" alt="" />
  109. </van-list>
  110. <!-- <div class="domain_list" v-else-if="active != 'likeIt' && type == 'metadomainName'">
  111. <template v-for="(item, index) in showList" :key="index">
  112. <domain-owned :info="asset" v-for="(asset, assetIndex) in item" :key="assetIndex"></domain-owned>
  113. </template>
  114. <van-empty v-if="empty || (showList.length === 0 && !loading)"
  115. :description="active == 'coupon' ? '你还没有优惠券哦~' : '你还没有藏品哦~'" :image="
  116. require(`@assets/${active == 'coupon' ? 'kong_png_duihuanquanhei' : 'empty_img_asset_dark'}.png`)
  117. " />
  118. </div> -->
  119. <van-list v-else-if="active != 'likeIt' && type == 'metadomainName'" class="domain_list" v-model:loading="loading"
  120. :finished="finished" finished-text="" @load="getList">
  121. <div v-if="metadomainType == 'owned'">
  122. <template v-for="(item, index) in showList" :key="index">
  123. <domain-owned :info="asset" v-for="(asset, assetIndex) in item" :key="assetIndex"></domain-owned>
  124. </template>
  125. </div>
  126. <div v-else-if="metadomainType == 'underReview'">
  127. <template v-for="(item, index) in showList" :key="index">
  128. <domain-owned :info="asset" v-for="(asset, assetIndex) in item" :key="assetIndex"></domain-owned>
  129. </template>
  130. </div>
  131. <!-- <div v-else-if="metadomainType == 'myBid'">
  132. <template v-for="(item, index) in showList" :key="index">
  133. <owned-buy :info="asset" v-for="(asset, assetIndex) in item" :key="assetIndex"></owned-buy>
  134. </template>
  135. </div>
  136. <div v-else-if="metadomainType == 'receiveQuotation'">
  137. <template v-for="(item, index) in showList" :key="index">
  138. <receive-quotation :info="asset" v-for="(asset, assetIndex) in item"
  139. :key="assetIndex"></receive-quotation>
  140. </template>
  141. </div> -->
  142. <van-empty v-if="empty || (showList.length === 0 && !loading)"
  143. :description="active == 'coupon' ? '你还没有优惠券哦~' : '你还没有藏品哦~'" :image="
  144. require(`@assets/${active == 'coupon' ? 'kong_png_duihuanquanhei' : 'empty_img_asset_dark'}.png`)
  145. " />
  146. </van-list>
  147. <div class="list" v-else>
  148. <template v-for="(item, index) in showListLike" :key="index">
  149. <product-info v-model:info="likeList[item.index]" @update:info="init" dark></product-info>
  150. </template>
  151. <van-empty v-if="showListLike.length === 0" description="你还没有点赞哦~"
  152. :image="require('@assets/kong_png_dianzan.png')" />
  153. </div>
  154. <van-action-sheet ref="action" v-model:show="showSelect" description="选择筛选方式" :actions="actions" cancel-text="取消"
  155. close-on-click-action />
  156. <div class="tabbar-placeholder"></div>
  157. </van-pull-refresh>
  158. <van-overlay :show="show" :lock-scroll="false" @click="show = false" z-index="99">
  159. <div class="wrapper" @click.stop>
  160. <div class="wrapper-title">{{ moreTitle }}</div>
  161. <div class="wrapper-box">
  162. <van-list v-model:loading="assetLoading" :finished="assetFinished" :immediate-check="false" finished-text=""
  163. loading-text="加载中..." @load="getMoreList">
  164. <asset-info-se :info="asset" v-for="asset in assetList" :key="asset.id"></asset-info-se>
  165. </van-list>
  166. </div>
  167. <img src="@assets/icon_fenxiang_close.png" @click="show = false" alt="" class="wrapper-close" />
  168. </div>
  169. </van-overlay>
  170. </template>
  171. <script>
  172. import AssetInfo from '../components/asset/assetInfo.vue';
  173. import DomainOwned from '../components/asset/domainOwned.vue';
  174. // import OwnedBuy from '../components/asset/ownedBuy.vue';
  175. // import ReceiveQuotation from '../components/asset/receiveQuotation.vue';
  176. import AssetInfoSe from '../components/asset/assetInfoSe.vue';
  177. import ShowInfo from '../components/asset/showInfo.vue';
  178. import CouponInfo from '../components/CouponInfo.vue';
  179. import asset from '../mixins/asset';
  180. import coupon from '../mixins/coupon';
  181. import starAssetInfo from '../components/star/assetInfo.vue';
  182. import ProductInfo from '../components/product/productInfo.vue';
  183. import list from '../mixins/list';
  184. export default {
  185. name: 'store',
  186. mixins: [asset, coupon],
  187. inject: ['bar', 'setKeeps', 'scrollWrapper', 'changeScroll', 'bodyScroll'],
  188. components: {
  189. AssetInfo,
  190. AssetInfoSe,
  191. CouponInfo,
  192. ShowInfo,
  193. starAssetInfo,
  194. ProductInfo,
  195. DomainOwned,
  196. // OwnedBuy,
  197. // ReceiveQuotation
  198. },
  199. data() {
  200. return {
  201. active: 'explore',
  202. stiky: null,
  203. type: '',
  204. empty: false,
  205. list: [],
  206. likeList: [],
  207. label: '全部',
  208. showSelect: false,
  209. actions: [{ name: '选项一' }, { name: '选项二' }, { name: '选项三' }],
  210. action: null,
  211. loading: false,
  212. finished: false,
  213. page: 0,
  214. name1: '',
  215. name: '',
  216. scrollTop: 0,
  217. sortDes: '',
  218. showRoom: false,
  219. show: false,
  220. moreTitle: '',
  221. assetLoading: false,
  222. assetFinished: false,
  223. assetPage: 0,
  224. assetList: [],
  225. metadomainType: 'owned',
  226. metadomainList: [
  227. {
  228. name: '拥有的',
  229. type: 'owned'
  230. },
  231. {
  232. name: '审核中',
  233. type: 'underReview'
  234. },
  235. // {
  236. // name: '我的出价',
  237. // type: 'myBid'
  238. // },
  239. // {
  240. // name: '收到的报价',
  241. // type: 'receiveQuotation'
  242. // }
  243. ],
  244. typeOptionLike: [
  245. {
  246. label: '全部',
  247. type: ''
  248. },
  249. {
  250. label: '收藏品',
  251. type: 'DEFAULT'
  252. },
  253. {
  254. label: '数字盲盒',
  255. type: 'BLIND_BOX'
  256. }
  257. ]
  258. };
  259. },
  260. computed: {
  261. typeOptions() {
  262. if (this.active === 'explore') {
  263. if (!this.$store.state.reviewPay) {
  264. return [
  265. {
  266. label: '全部',
  267. value: '',
  268. type: ''
  269. },
  270. {
  271. label: '个人作品',
  272. value: 'xingtu',
  273. type: ''
  274. },
  275. {
  276. label: '元域名',
  277. value: 'metadomainName',
  278. type: ''
  279. },
  280. {
  281. label: '拍卖中',
  282. value: 'paimai',
  283. type: ''
  284. },
  285. {
  286. label: '寄售',
  287. value: 'ON_SALE',
  288. type: ''
  289. },
  290. {
  291. label: '封存中',
  292. value: 'lock',
  293. type: ''
  294. },
  295. {
  296. label: '仅展示',
  297. value: 'NORMAL',
  298. type: ''
  299. },
  300. {
  301. label: '未展示',
  302. value: 'NOT_NORMAL',
  303. type: ''
  304. }
  305. ];
  306. } else {
  307. return [
  308. {
  309. label: '全部',
  310. value: '',
  311. type: ''
  312. },
  313. {
  314. label: '仅展示',
  315. value: 'NORMAL',
  316. type: ''
  317. }
  318. ];
  319. }
  320. } else if (this.active === 'showRoom') {
  321. return [
  322. {
  323. label: '全部',
  324. value: '',
  325. type: ''
  326. },
  327. {
  328. label: '展览中',
  329. value: true,
  330. type: ''
  331. },
  332. {
  333. label: '未展览',
  334. value: false,
  335. type: ''
  336. }
  337. ];
  338. } else if (this.active === 'creator') {
  339. return [
  340. {
  341. label: '市场交易',
  342. value: 'TRANSFERRED',
  343. type: ''
  344. },
  345. {
  346. label: '拍卖',
  347. value: 'AUCTIONED',
  348. type: ''
  349. }
  350. // {
  351. // label: '价格',
  352. // value: 'price',
  353. // type: 'select'
  354. // }
  355. ];
  356. } else {
  357. return [
  358. {
  359. label: '未使用',
  360. value: 'CAN_USE',
  361. type: ''
  362. },
  363. {
  364. label: '不可用',
  365. value: 'CANNOT_USE',
  366. type: ''
  367. }
  368. ];
  369. }
  370. },
  371. showList() {
  372. if (this.active === 'coupon') {
  373. return [...this.list].filter(item => {
  374. if (this.type === 'CAN_USE') {
  375. return this.checkTime(item);
  376. } else {
  377. return !this.checkTime(item);
  378. }
  379. });
  380. } else if (this.active == 'showRoom') {
  381. return this.list;
  382. } else {
  383. let list = [...this.list];
  384. let _list = [];
  385. for (let i = 0; i <= Math.floor(list.length / 3); i++) {
  386. _list.push(list.slice(i * 3, (i + 1) * 3));
  387. }
  388. return _list.filter(item => {
  389. return item.length > 0;
  390. });
  391. }
  392. },
  393. showListLike() {
  394. return [...this.likeList]
  395. .map((item, index) => {
  396. return {
  397. ...item,
  398. index
  399. };
  400. })
  401. .filter(item => {
  402. return !this.type || this.type === item.type;
  403. });
  404. },
  405. sort() {
  406. return 'createdAt,desc';
  407. },
  408. url() {
  409. if (this.type === 'xingtu') {
  410. return '/photoAsset/all';
  411. } else if (this.type === 'lock') {
  412. return '/asset/all';
  413. } else if (this.type === 'metadomainName') {
  414. return 'asset/all';
  415. } else if (this.active === 'coupon') {
  416. return '/userCoupon/all';
  417. } else if (this.active === 'showRoom') {
  418. return '/showroom/all';
  419. } else if (this.active === 'explore') {
  420. return '/assetSuperimposition/all';
  421. } else {
  422. return 'asset/all';
  423. }
  424. },
  425. status() {
  426. if (this.active === 'explore') {
  427. if (this.type === 'paimai') {
  428. return 'AUCTIONING';
  429. } else if (this.type === 'metadomainName') {
  430. if (this.metadomainType == 'underReview') {
  431. return 'PENDING'
  432. } else {
  433. return 'NORMAL,TRADING,GIFTING,MINTING,AUCTIONING,PENDING';
  434. }
  435. } else {
  436. return 'NORMAL,TRADING,GIFTING,MINTING,AUCTIONING';
  437. }
  438. } else if (this.active === 'creator') {
  439. return this.type || 'TRANSFERRED';
  440. } else {
  441. return '';
  442. }
  443. }
  444. },
  445. mounted() {
  446. if (this.$route.query.type) {
  447. this.type = this.$route.query.type;
  448. }
  449. if (window.cordova && StatusBar && StatusBar.isVisible) {
  450. StatusBar.styleLightContent();
  451. }
  452. this.checkLogin();
  453. this.emitter.on('updateList', info => {
  454. console.log(info);
  455. let list = [...this.list];
  456. let assetList = [...this.assetList];
  457. if (assetList.length == 1) {
  458. this.show = false;
  459. }
  460. if (!this.show) {
  461. list.forEach((item, index) => {
  462. if (item.id === info.id || item.assetId === info.id) {
  463. list[index] = {
  464. ...item,
  465. ...info,
  466. num: item.num,
  467. id: item.id,
  468. assetId: item.assetId
  469. };
  470. if (info.status === 'DESTROYED') {
  471. list.splice(index, 1);
  472. }
  473. }
  474. });
  475. this.list = list;
  476. }
  477. if (assetList.length > 1) {
  478. assetList.forEach((item, index) => {
  479. if (item.id === info.id) {
  480. assetList[index] = info;
  481. if (info.status === 'DESTROYED') {
  482. assetList.splice(index, 1);
  483. let _index = [...this.list].findIndex(item => {
  484. return item.prefixName === this.moreTitle;
  485. });
  486. let _info = {};
  487. if (_index !== -1) {
  488. _info = { ...this.list[_index] };
  489. _info.num = _info.num - 1;
  490. }
  491. if (index === 0) {
  492. _info = {
  493. ..._info,
  494. ...assetList[0],
  495. num: _info.num,
  496. id: _info.id,
  497. assetId: assetList[0].id
  498. };
  499. }
  500. this.list[_index] = _info;
  501. }
  502. }
  503. });
  504. this.assetList = assetList;
  505. }
  506. // let list = [...this.list];
  507. // list.forEach((item, index) => {
  508. // if (item.id === info.id) {
  509. // list[index] = info;
  510. // }
  511. // });
  512. this.list = [...this.list].filter(item => {
  513. if (this.type === 'xingtu') {
  514. return item.ownerId === this.$store.state.userInfo.id;
  515. } else {
  516. return item.status !== 'DESTROYED';
  517. }
  518. });
  519. this.$toast.clear();
  520. });
  521. this.emitter.on('refreash', () => {
  522. this.page = 0;
  523. this.getList();
  524. });
  525. if (this.isLogin) {
  526. this.$http
  527. .post(
  528. '/showroom/all',
  529. {
  530. query: {
  531. del: false,
  532. userId: this.$store.state.userInfo.id
  533. }
  534. },
  535. { body: 'json' }
  536. )
  537. .then(res => {
  538. if (!res.empty) {
  539. this.showRoom = true;
  540. }
  541. });
  542. }
  543. },
  544. beforeRouteLeave(to, from, next) {
  545. if (to.path === '/assetDetail' || to.path === '/hall' || to.path === '/starCreateResult') {
  546. this.scrollTop = this.scrollWrapper.scrollTop;
  547. this.setKeeps(['index', 'store']);
  548. } else {
  549. this.scrollTop = 0;
  550. this.setKeeps(['index', 'store'], false);
  551. }
  552. next();
  553. },
  554. activated() {
  555. this.$nextTick(() => {
  556. this.changeScroll(this.scrollTop);
  557. if (window.cordova && StatusBar && StatusBar.isVisible) {
  558. StatusBar.styleLightContent();
  559. }
  560. this.$nextTick(() => {
  561. this.stiky = this.$refs.top.$el.childNodes[0];
  562. this.$el.parentNode.childNodes[1].className =
  563. this.$el.parentNode.childNodes[1].className.replace(/ bgBack/, '') + ' bgBack';
  564. });
  565. });
  566. },
  567. methods: {
  568. showMore(asset) {
  569. console.log(asset);
  570. this.moreTitle = asset.prefixName;
  571. this.show = true;
  572. this.assetLoading = true;
  573. this.getMoreList(true);
  574. //
  575. },
  576. init() {
  577. this.$toast.loading({
  578. message: '加载中...',
  579. forbidClick: true
  580. });
  581. this.empty = false;
  582. this.$http.get('/collection/myLikes').then(res => {
  583. this.likeList = res;
  584. this.empty = res.length === 0;
  585. this.$toast.clear();
  586. });
  587. },
  588. getMoreList(init = false) {
  589. if (init) {
  590. this.assetList = [];
  591. this.assetPage = 0;
  592. }
  593. this.assetLoading = true;
  594. this.assetFinished = false;
  595. return this.$http
  596. .post(
  597. '/asset/all',
  598. {
  599. page: this.assetPage,
  600. size: 50,
  601. query: {
  602. userId: this.$store.state.userInfo.id,
  603. status: this.status,
  604. prefixName: this.moreTitle,
  605. type: 'DEFAULT,BLIND_BOX'
  606. },
  607. sort: 'id,desc'
  608. },
  609. { body: 'json' }
  610. )
  611. .then(res => {
  612. let listArr = [];
  613. if (this.type === 'NORMAL') {
  614. listArr = res.content.filter(item => {
  615. return item.publicShow === true && item.consignment === false;
  616. });
  617. } else if (this.type === 'NOT_NORMAL') {
  618. listArr = res.content.filter(item => {
  619. return item.publicShow === false;
  620. });
  621. } else if (this.type === 'ON_SALE') {
  622. listArr = res.content.filter(item => {
  623. return item.consignment === true;
  624. });
  625. } else {
  626. listArr = res.content;
  627. }
  628. if (res.first) {
  629. this.assetList = listArr;
  630. } else {
  631. this.assetList = [...this.assetList, ...listArr];
  632. }
  633. this.assetLoading = false;
  634. this.assetFinished = res.last;
  635. if (!this.assetFinished) {
  636. this.assetPage = this.assetPage + 1;
  637. }
  638. return Promise.resolve();
  639. });
  640. },
  641. pad(n, width, z) {
  642. z = z || '0';
  643. n = n + '';
  644. return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
  645. },
  646. getList() {
  647. if (!this.isLogin) {
  648. this.empty = true;
  649. this.loading = false;
  650. return Promise.resolve();
  651. }
  652. if (this.page === 0) {
  653. this.list = [];
  654. }
  655. this.finished = false;
  656. this.empty = false;
  657. this.loading = true;
  658. let form = {
  659. page: this.page,
  660. size: 20,
  661. sort: this.sort === 'price' ? this.sort + this.sortDes : this.sort,
  662. query: {
  663. userId: this.$store.state.userInfo.id,
  664. ...this.beforeQuery(),
  665. companyId: 1
  666. }
  667. };
  668. if (this.type === 'xingtu') {
  669. form = {
  670. page: this.page,
  671. size: 20,
  672. sort: this.sort === 'price' ? this.sort + this.sortDes : this.sort,
  673. query: {
  674. ownerId: this.$store.state.userInfo.id,
  675. del: false,
  676. orderStatus: 'NOT_PAID,PROCESSING,FINISH'
  677. }
  678. };
  679. }
  680. return this.$http.post(this.url, form, { body: 'json' }).then(res => {
  681. // if (this.active === 'coupon' || this.active === 'showRoom') {
  682. res.content.forEach(item => {
  683. if (item.endTime) {
  684. item.endTime = this.dayjs(item.endTime).diff(this.dayjs(), 'second');
  685. item.endTime =
  686. Math.floor(item.endTime / 24 / 3600) +
  687. '天' +
  688. this.pad(parseInt(item.endTime / 3600) % 24, 2) +
  689. '时' +
  690. this.pad(parseInt(item.endTime / 60) % 60, 2) +
  691. '分';
  692. }
  693. });
  694. if (res.first) {
  695. this.page = 0;
  696. this.list = res.content;
  697. } else {
  698. this.list = [...this.list, ...res.content];
  699. }
  700. this.empty = res.empty && res.first;
  701. this.loading = false;
  702. this.finished = res.last;
  703. if (!this.finished) {
  704. this.page = this.page + 1;
  705. }
  706. // } else {
  707. // this.list = res;
  708. // this.empty = res.length === 0;
  709. // this.loading = false;
  710. // this.finished = true;
  711. // }
  712. });
  713. },
  714. beforeQuery() {
  715. let form = {};
  716. if (this.active == 'explore') {
  717. form = {
  718. status: this.status
  719. };
  720. if (this.type === 'NORMAL') {
  721. form = {
  722. ...form,
  723. assetType: 'OPEN_SHOW'
  724. };
  725. }
  726. if (this.type === 'metadomainName') {
  727. form = {
  728. ...form,
  729. type: 'DOMAIN'
  730. };
  731. }
  732. if (this.type === 'paimai') {
  733. form = {
  734. ...form,
  735. assetType: 'AUCTIONING'
  736. };
  737. }
  738. if (this.type === 'NOT_NORMAL') {
  739. form = {
  740. ...form,
  741. assetType: 'CLOSE_SHOW'
  742. };
  743. }
  744. if (this.type === 'ON_SALE') {
  745. form = {
  746. ...form,
  747. assetType: 'CONSIGNMENT'
  748. };
  749. }
  750. if (this.type === 'lock') {
  751. form = {
  752. ...form,
  753. lock: true
  754. };
  755. }
  756. if (this.type === 'xingtu') {
  757. form = {
  758. // gifted: false
  759. };
  760. }
  761. } else if (this.active == 'showRoom') {
  762. form = {
  763. publish: this.type
  764. };
  765. } else if (this.active === 'creator') {
  766. form = {
  767. status: this.status
  768. };
  769. } else {
  770. form = {
  771. used: false
  772. };
  773. }
  774. return form;
  775. },
  776. changeActive(active) {
  777. if (active === 'likeIt') {
  778. this.init();
  779. this.active = active;
  780. } else {
  781. this.list = [];
  782. this.active = active;
  783. this.loading = true;
  784. setTimeout(() => {
  785. this.$nextTick(() => {
  786. this.type = this.typeOptions[0].type;
  787. this.page = 0;
  788. this.getList();
  789. });
  790. }, 100);
  791. }
  792. },
  793. domainBtn(index) {
  794. this.metadomainType = this.metadomainList[index].type
  795. this.page = 0;
  796. if (this.metadomainType == 'myBid' || this.metadomainType == 'receiveQuotation') {
  797. this.$toast("版本升级中")
  798. } else {
  799. this.getList().then(() => {
  800. this.isLoading = false;
  801. });
  802. }
  803. },
  804. changeTab(info) {
  805. if (info.name === 'price') {
  806. this.sortDes = this.sortDes == 'desc' ? 'asc' : 'desc';
  807. }
  808. if (this.active !== 'coupon') {
  809. this.loading = true;
  810. this.page = 0;
  811. this.getList();
  812. }
  813. },
  814. goTop() {
  815. this.changeScroll(0, true);
  816. },
  817. onRefresh() {
  818. this.page = 0;
  819. this.getList().then(() => {
  820. this.isLoading = false;
  821. });
  822. },
  823. change() {
  824. this.$root.$el.scrollTop = 0;
  825. }
  826. }
  827. };
  828. </script>
  829. <style lang="less" scoped>
  830. .top {
  831. display: flex;
  832. background-color: #222426;
  833. width: calc(100vw);
  834. .top-btn {
  835. padding: 10px 16px;
  836. padding-right: 0px;
  837. width: 100%;
  838. height: 50px;
  839. box-sizing: border-box;
  840. overflow-x: auto;
  841. display: flex;
  842. align-items: center;
  843. background: #1C1C1C;
  844. .btn {
  845. font-size: @font3;
  846. line-height: 26px;
  847. display: inline-block;
  848. vertical-align: text-bottom;
  849. color: #939599;
  850. flex-shrink: 0;
  851. &.active {
  852. color: #ffffff;
  853. font-size: @font3;
  854. font-weight: bold;
  855. }
  856. }
  857. .btn+.btn {
  858. margin-left: 20px;
  859. }
  860. }
  861. .search {
  862. width: 50px;
  863. height: 50px;
  864. display: flex;
  865. align-items: center;
  866. padding-left: 10px;
  867. box-sizing: border-box;
  868. background: #1C1C1C;
  869. position: relative;
  870. .search_division {
  871. position: absolute;
  872. top: 13px;
  873. left: 4px;
  874. width: 1px;
  875. height: 24px;
  876. background-color: #272b2e;
  877. }
  878. img {
  879. display: block;
  880. }
  881. }
  882. }
  883. .metadomainName_list {
  884. padding: 16px 15px 20px 16px;
  885. display: flex;
  886. // justify-content: space-between;
  887. background: #0F0F0F;
  888. .metadomainName_list_cons {
  889. width: calc(20vw - 1px);
  890. height: 28px;
  891. background: #1E1E1E;
  892. border-radius: 4px;
  893. line-height: 28px;
  894. text-align: center;
  895. font-size: 12px;
  896. font-weight: 400;
  897. color: rgba(147, 149, 153, 0.6);
  898. margin-right: 20px;
  899. }
  900. .metadomainName_list_con {
  901. height: 28px;
  902. border-radius: 4px;
  903. border: 1px solid #00FE1E;
  904. box-sizing: border-box;
  905. color: #00FE1E;
  906. background: #0F0F0F;
  907. line-height: 28px;
  908. }
  909. }
  910. .domain_list {
  911. padding: 0px 16px;
  912. padding-bottom: 50px;
  913. }
  914. /deep/.van-sticky--fixed {
  915. background-color: #222426;
  916. }
  917. .van-tabs {
  918. background: #1C1C1C;
  919. /deep/.van-tab {
  920. margin-right: 30px;
  921. }
  922. }
  923. .select {
  924. position: absolute;
  925. right: 16px;
  926. bottom: 9px;
  927. color: @text3 !important;
  928. min-width: 96px;
  929. }
  930. // /deep/.van-sticky {
  931. // position: relative;
  932. // }
  933. /deep/.scroll-wrapper {
  934. background-color: #0f0f0f !important;
  935. }
  936. .discover {
  937. background-color: #0f0f0f;
  938. min-height: 100vh;
  939. min-height: var(--app-height);
  940. box-sizing: border-box;
  941. }
  942. .list {
  943. padding: 8px;
  944. }
  945. .grid-img {
  946. display: block;
  947. }
  948. .van-grid {
  949. margin-top: 12px;
  950. }
  951. /deep/.van-tabs__nav--line.van-tabs__nav--complete {
  952. border-top-color: #303133;
  953. }
  954. /deep/ .van-grid-item__content {
  955. padding: 14px 20px 16px;
  956. }
  957. /deep/ .van-grid-item__text {
  958. color: #fff;
  959. font-size: 13px;
  960. line-height: 18px;
  961. margin-top: 4px;
  962. }
  963. .title {
  964. padding: 16px 20px 8px;
  965. color: @prim;
  966. font-size: 18px;
  967. font-weight: bold;
  968. }
  969. .box-list {
  970. // display: flex;
  971. // flex-wrap: wrap;
  972. // padding: 8px 8px 100px;
  973. // padding: 0 0 0 4.2vw;
  974. background-size: 100vw 42vw;
  975. background-position: 0 -10vw;
  976. box-sizing: border-box;
  977. &.couponList {
  978. padding: 8px 8px 100px;
  979. }
  980. &.roomList {
  981. padding: 10px 0 100px;
  982. }
  983. .asset-list {
  984. background-size: 100vw auto;
  985. background-position: 0 -10vw;
  986. box-sizing: border-box;
  987. padding: 0 0 0 4.2vw;
  988. }
  989. }
  990. .tab {
  991. position: relative;
  992. padding-right: 14px;
  993. .van-icon {
  994. position: absolute;
  995. right: 0;
  996. &.van-icon-arrow-down {
  997. top: 8px;
  998. }
  999. &.van-icon-arrow-up {
  1000. bottom: 8px;
  1001. }
  1002. }
  1003. }
  1004. /deep/.coupon {
  1005. &::after {
  1006. background-color: #181818;
  1007. }
  1008. .coupon-bottom {
  1009. &::before,
  1010. &::after {
  1011. background-color: #0f0f0f;
  1012. }
  1013. }
  1014. .btn {
  1015. &::after {
  1016. background-color: #181818;
  1017. }
  1018. }
  1019. }
  1020. .goTop {
  1021. position: fixed;
  1022. right: 16px;
  1023. bottom: 70px;
  1024. bottom: calc(env(safe-area-inset-bottom) + 70px);
  1025. width: 44px;
  1026. height: 44px;
  1027. display: block;
  1028. z-index: 20;
  1029. }
  1030. .wrapper-box {
  1031. width: 306px;
  1032. height: 394px;
  1033. background: rgba(255, 255, 255, 0.1);
  1034. border-radius: 16px;
  1035. border: 1px solid #c8c9cc;
  1036. backdrop-filter: blur(10px);
  1037. overflow: auto;
  1038. .van-list {
  1039. padding: 12px 8px;
  1040. min-height: 364px;
  1041. }
  1042. }
  1043. .wrapper {
  1044. position: absolute;
  1045. top: 50%;
  1046. left: 50%;
  1047. transform: translate(-50%, -50%);
  1048. .flex-col();
  1049. .wrapper-title {
  1050. font-size: 20px;
  1051. font-weight: bold;
  1052. color: #ffffff;
  1053. line-height: 24px;
  1054. text-align: center;
  1055. margin-bottom: 30px;
  1056. }
  1057. .wrapper-close {
  1058. width: 40px;
  1059. height: 40px;
  1060. align-self: center;
  1061. margin-top: 10vh;
  1062. }
  1063. }
  1064. </style>