Consignment.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. <template>
  2. <div class="content">
  3. <div class="consignment_top">
  4. <van-image width="120px" height="120px" radius="18" :src="Image" fit="cover" />
  5. <div class="consignment_top_title">
  6. <div class="consignment_top_title_one">{{ info.name }}</div>
  7. <div class="consignment_top_title_two">
  8. <div class="consignment_top_title_two_text1">{{info.collectionCategory}}</div>
  9. <div class="consignment_top_title_two_text2">{{ info.category }}</div>
  10. </div>
  11. <div class="consignment_top_title_three">
  12. <span class="consignment_top_title_three_text1">¥</span>{{ info.price || '0' }}
  13. </div>
  14. </div>
  15. <img :src="require('@assets/dibuwenli.png')" alt="" class="bottom_texture">
  16. </div>
  17. <!-- <div class="consignment_title">挂售上架</div>
  18. <div class="consignment_tip">交易成功后该藏品将会被转移</div>
  19. <div class="hanging_sale_list">
  20. <div class="consignment_set_price">设置价格(元)</div>
  21. <van-cell-group inset>
  22. <van-field v-model="price" type="number" placeholder="请输入金额" />
  23. </van-cell-group>
  24. <div class="transaction_password">
  25. <div class="transaction_password_title">输入交易密码</div>
  26. <div class="transaction_password_forget" @click="$router.push('/tradingPassword')">忘记密码</div>
  27. </div> -->
  28. <!-- 密码输入框 -->
  29. <!-- <van-password-inpu :value="password" :focused="showKeyboard" :gutter="16" @focus="showKeyboard = true" /> -->
  30. <!-- 数字键盘 -->
  31. <!-- <van-number-keyboard
  32. v-model="password"
  33. :show="showKeyboard"
  34. @blur="keyBlur"
  35. @close="submit"
  36. :gutter="10"
  37. maxlength="6"
  38. theme="custom"
  39. close-button-text="完成"
  40. /> -->
  41. <van-popup
  42. class="popup-content"
  43. style="background: #191d27"
  44. v-model:show="showKeyboard"
  45. teleport="body"
  46. position="bottom"
  47. >
  48. <div class="popup">
  49. <!-- <div class="cancel" @click="showKeyboard = false">取消</div> -->
  50. <img :src="require('@assets/shanchu@3x.png')" alt="" @click="showKeyboard = false" class="cancel" />
  51. <div class="title">输入交易密码</div>
  52. <van-password-input :value="password" :gutter="8" />
  53. <div class="popup_password_forget" @click="$router.push('/tradingPassword')">忘记密码?</div>
  54. <!-- <van-password-input :value="form.code" :length="4" /> -->
  55. <!-- 数字键盘 -->
  56. <van-number-keyboard
  57. v-model="password"
  58. theme="custom"
  59. :show="showKeyboard"
  60. close-button-text="完成"
  61. @close="submit"
  62. />
  63. </div>
  64. </van-popup>
  65. <!-- </div> -->
  66. <!-- <div v-else class="text3" @click="$router.push('/tradingPassword')">您当前没有交易密码,点击去设置</div> -->
  67. </div>
  68. <div class="consignment_content">
  69. <div class="consignment_content_one">挂售价格</div>
  70. <div class="consignment_content_two">
  71. <div class="consignment_content_two_text">¥</div>
  72. <van-field v-model="price" type="number"/>
  73. </div>
  74. </div>
  75. <div class="consignment_cost">
  76. <div class="consignment_cost_con">
  77. <div class="consignment_cost_con_one">
  78. <div class="consignment_cost_con_one_text1">版权使用费(5%)</div>
  79. <div class="consignment_cost_con_one_text2">{{ price2 }} 元</div>
  80. </div>
  81. <div class="consignment_cost_con_one">
  82. <div class="consignment_cost_con_one_text1">平台手续费(10%)</div>
  83. <div class="consignment_cost_con_one_text2">{{ price3 }} 元</div>
  84. </div>
  85. <div class="consignment_cost_con_one">
  86. <div class="consignment_cost_con_one_text1">售卖到手(85%)</div>
  87. <div class="consignment_cost_con_one_text2">{{ price5 }} 元</div>
  88. </div>
  89. </div>
  90. </div>
  91. <div class="consignment_button">
  92. <div class="consignment_button_con" @click="showKeyboard = true">确定</div>
  93. </div>
  94. <!-- <div class="consignment_confirmation" ref="bottom">
  95. <div class="consignment_confirmation_left" @click="$router.go(-1)">取消</div>
  96. <div class="consignment_confirmation_right" @click="submit">确认</div>
  97. </div> -->
  98. <!-- <agreement ref="agree" :info="info" @agree="agree"></agreement> -->
  99. </template>
  100. <script>
  101. import { mapState } from 'vuex';
  102. // import Agreement from '../asset/Agreement.vue';
  103. export default {
  104. name: 'Top',
  105. inject: ['changeScroll'],
  106. data() {
  107. return {
  108. price: '',
  109. showKeyboard: false,
  110. password: '',
  111. sets: false,
  112. list: [
  113. {
  114. title: '1. 作品寄售为单个作品价格'
  115. },
  116. {
  117. title: '2. 用户将会看到数字藏品的权益的使用情况'
  118. },
  119. {
  120. title: '3. 交易成功后数字藏品的点赞数量将会被清除'
  121. },
  122. {
  123. title: '4. 平台会收取作品出售价格的 5% 作为服务费'
  124. },
  125. {
  126. title: '5. 因电子支付通道限制,单笔限额20000元'
  127. }
  128. ],
  129. info: {},
  130. agreement: false,
  131. Image: ''
  132. };
  133. },
  134. computed: {
  135. ...mapState(['userInfo']),
  136. price1() {
  137. let price = Math.floor(this.price * 100) / 100;
  138. return price.toFixed(2);
  139. },
  140. price2() {
  141. let price = Math.floor(this.price * 5) / 100;
  142. return price.toFixed(2);
  143. },
  144. price3() {
  145. let price = Math.floor(this.price * 10) / 100;
  146. return price.toFixed(2);
  147. },
  148. price4() {
  149. let price = Math.floor(this.price * 1) / 100;
  150. return price.toFixed(2);
  151. },
  152. price5() {
  153. let price = Math.floor(this.price * 85) / 100;
  154. return price.toFixed(2);
  155. }
  156. },
  157. mounted() {
  158. this.passFn();
  159. this.$http.get('/asset/get/' + this.$route.query.id).then(res => {
  160. this.info = res;
  161. this.Image = this.info.pic[0].url
  162. });
  163. },
  164. methods: {
  165. keyboardEnter() {
  166. this.changeScroll(1000);
  167. this.showKeyboard = true;
  168. },
  169. passFn() {
  170. this.$http
  171. .get('/user/tradeCodeStatus', {
  172. userId: this.userInfo.id
  173. })
  174. .then(res => {
  175. console.log(res);
  176. this.sets = res.set;
  177. });
  178. },
  179. agree() {
  180. this.agreement = true;
  181. this.submit();
  182. },
  183. submit() {
  184. // this.$router.push('/ConsignmentSuccess?id=' + this.info.id);
  185. if (Number(this.price) > 20000 && !this.agreement) {
  186. this.$refs.agree.init();
  187. } else if (Number(this.price)) {
  188. this.$dialog
  189. .confirm({
  190. title: '寄售',
  191. message: `商品将以<span style='color:#ff4f50;font-weight:bold;font-size:18px;margin:0 5px'>${this.price}</span>的价格上架`,
  192. allowHtml: true
  193. })
  194. .then(() => {
  195. this.$toast.loading({
  196. message: '加载中...',
  197. forbidClick: true
  198. });
  199. return new Promise((resolve, reject) => {
  200. this.$http
  201. .post('/user/verifyTradeCode', {
  202. tradeCode: this.password
  203. })
  204. .then(_ => resolve())
  205. .catch(e => {
  206. reject({ error: '密码错误' });
  207. });
  208. });
  209. })
  210. .then(() => {
  211. return this.$http.post('/asset/consignment', {
  212. id: this.$route.query.id,
  213. price: this.price
  214. });
  215. })
  216. .catch(e => {
  217. if (e.error) {
  218. this.$toast(e.error || '出现错误,请稍后再试');
  219. }
  220. return Promise.reject('cancel');
  221. })
  222. .then(res => {
  223. this.$toast.success('寄售成功');
  224. setTimeout(() => {
  225. this.$router.push('/ConsignmentSuccess?id=' + this.info.id);
  226. // this.$router.go(-1);
  227. }, 1000);
  228. })
  229. .catch(e => {
  230. if (e && e.error) {
  231. this.$toast(e.error);
  232. }
  233. });
  234. } else {
  235. this.$toast('请输入价格');
  236. }
  237. },
  238. goRouter() {
  239. if (!this.showKeyboard) {
  240. this.$router.push('/tradingPassword');
  241. }
  242. },
  243. keyBlur() {
  244. setTimeout(() => {
  245. this.showKeyboard = false;
  246. }, 100);
  247. }
  248. }
  249. };
  250. </script>
  251. <style lang="less" scoped>
  252. .content {
  253. width: 100%;
  254. // height: 100%;
  255. // position: absolute;
  256. background: #191d27;
  257. padding: 15px;
  258. padding-bottom: 0px;
  259. box-sizing: border-box;
  260. .consignment_top {
  261. background: #1e222c;
  262. border-radius: 0px 18px 18px 0px;
  263. display: flex;
  264. position: relative;
  265. .bottom_texture{
  266. width: 115px;
  267. height: 100px;
  268. position: absolute;
  269. right: 0;
  270. bottom: 0;
  271. }
  272. .consignment_top_title {
  273. width: calc(100% - 150px);
  274. margin-left: 12px;
  275. padding: 16px 0px;
  276. box-sizing: border-box;
  277. .consignment_top_title_one {
  278. width: 100%;
  279. font-size: 16px;
  280. font-family: PingFangSC-Medium, PingFang SC;
  281. font-weight: 500;
  282. color: #ffffff;
  283. line-height: 22px;
  284. white-space: nowrap;
  285. overflow: hidden;
  286. text-overflow: ellipsis;
  287. margin-bottom: 12px;
  288. }
  289. .consignment_top_title_two {
  290. display: flex;
  291. margin-bottom: 12px;
  292. font-size: 12px;
  293. font-family: PingFangSC-Regular, PingFang SC;
  294. font-weight: 400;
  295. .consignment_top_title_two_text1 {
  296. padding: 0px 6px;
  297. box-sizing: border-box;
  298. height: 18px;
  299. background: #f9ddb3;
  300. color: #282d3a;
  301. border-radius: 3px;
  302. line-height: 18px;
  303. margin-right: 6px;
  304. }
  305. .consignment_top_title_two_text2 {
  306. padding: 0px 6px;
  307. box-sizing: border-box;
  308. height: 18px;
  309. background: #323743;
  310. border-radius: 3px;
  311. color: #f9ddb3;
  312. line-height: 18px;
  313. }
  314. }
  315. .consignment_top_title_three {
  316. font-size: 18px;
  317. font-family: PingFangSC-Semibold, PingFang SC;
  318. font-weight: 600;
  319. color: #ffffff;
  320. line-height: 24px;
  321. .consignment_top_title_three_text1{
  322. font-size: 16px;
  323. line-height: 22px;
  324. }
  325. }
  326. }
  327. }
  328. .consignment_title {
  329. font-size: 20px;
  330. font-family: PingFangSC-Medium, PingFang SC;
  331. font-weight: 500;
  332. color: #ffffff;
  333. line-height: 28px;
  334. margin-bottom: 8px;
  335. }
  336. .consignment_tip {
  337. font-size: 13px;
  338. font-family: PingFangSC-Regular, PingFang SC;
  339. font-weight: 400;
  340. color: #ffffff;
  341. line-height: 18px;
  342. opacity: 0.5;
  343. margin-bottom: 20px;
  344. }
  345. .hanging_sale_list {
  346. width: 100%;
  347. background: #1e222c;
  348. border-radius: 12px;
  349. padding: 20px 15px;
  350. box-sizing: border-box;
  351. .consignment_set_price {
  352. font-size: 13px;
  353. font-family: PingFangSC-Regular, PingFang SC;
  354. font-weight: 400;
  355. color: #ffffff;
  356. line-height: 18px;
  357. margin-bottom: 8px;
  358. }
  359. /deep/ .van-cell-group {
  360. margin: 0;
  361. }
  362. /deep/ .van-cell {
  363. border-radius: 4px;
  364. border: 1px solid rgba(151, 151, 151, 0.1);
  365. margin-bottom: 20px;
  366. .van-field__control {
  367. color: #ffffff;
  368. }
  369. }
  370. .transaction_password {
  371. display: flex;
  372. justify-content: space-between;
  373. margin-bottom: 8px;
  374. font-size: 13px;
  375. font-family: PingFangSC-Regular, PingFang SC;
  376. font-weight: 400;
  377. .transaction_password_title {
  378. color: #ffffff;
  379. line-height: 18px;
  380. }
  381. .transaction_password_forget {
  382. color: #077dff;
  383. line-height: 18px;
  384. }
  385. }
  386. .van-password-input {
  387. margin: 0;
  388. /deep/ .van-password-input__security li {
  389. width: 45px;
  390. height: 50px;
  391. border-radius: 4px;
  392. border: 1px solid rgba(151, 151, 151, 0.1);
  393. color: #ffffff;
  394. background: #1e222c;
  395. }
  396. }
  397. }
  398. }
  399. .consignment_content{
  400. padding: 20px 30px;
  401. box-sizing: border-box;
  402. background: linear-gradient(360deg, #1E222C 0%, rgba(25, 29, 39, 0) 100%);
  403. border-radius: 0px 0px 20px 20px;
  404. .consignment_content_one{
  405. font-size: 14px;
  406. font-family: PingFangSC-Regular, PingFang SC;
  407. font-weight: 400;
  408. color: #FFFFFF;
  409. line-height: 20px;
  410. margin-bottom: 24px;
  411. opacity: 0.5;
  412. }
  413. .consignment_content_two{
  414. display: flex;
  415. padding-bottom: 16px;
  416. border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  417. font-size: 36px;
  418. font-family: PingFangSC-Semibold, PingFang SC;
  419. font-weight: 600;
  420. color: #FFFFFF;
  421. line-height: 40px;
  422. .consignment_content_two_text{
  423. margin-right: 10px;
  424. }
  425. .van-field{
  426. padding-left: 10px;
  427. font-size: 30px;
  428. padding: 0;
  429. }
  430. }
  431. }
  432. .consignment_confirmation {
  433. width: 100%;
  434. height: 56px;
  435. background: #15152d;
  436. position: fixed;
  437. bottom: 0;
  438. padding: 8px 16px;
  439. box-sizing: border-box;
  440. display: flex;
  441. justify-content: space-between;
  442. font-size: 16px;
  443. font-family: PingFangSC-Medium, PingFang SC;
  444. font-weight: 500;
  445. text-align: center;
  446. .consignment_confirmation_left {
  447. width: 164px;
  448. height: 40px;
  449. border-radius: 8px;
  450. border: 1px solid #28b6ff;
  451. color: #28b6ff;
  452. line-height: 40px;
  453. }
  454. .consignment_confirmation_right {
  455. width: 164px;
  456. height: 40px;
  457. background: #28b6ff;
  458. border-radius: 8px;
  459. color: #ffffff;
  460. line-height: 40px;
  461. }
  462. }
  463. .consignment_cost{
  464. padding: 0px 15px;
  465. box-sizing: border-box;
  466. margin-top: 16px;
  467. .consignment_cost_con{
  468. padding: 18px 15px;
  469. box-sizing: border-box;
  470. background: #1E222C;
  471. border-radius: 12px;
  472. .consignment_cost_con_one{
  473. display: flex;
  474. justify-content: space-between;
  475. margin-bottom: 14px;
  476. font-size: 14px;
  477. font-family: PingFangSC-Regular, PingFang SC;
  478. font-weight: 400;
  479. line-height: 20px;
  480. .consignment_cost_con_one_text1{
  481. color: #FFFFFF;
  482. opacity: 0.3;
  483. }
  484. .consignment_cost_con_one_text2{
  485. color: #FFFFFF;
  486. }
  487. }
  488. .consignment_cost_con_one:last-child{
  489. margin-bottom: 0px;
  490. }
  491. }
  492. }
  493. .consignment_button{
  494. width: 100%;
  495. position: fixed;
  496. bottom: 64px;
  497. padding: 0px 82px;
  498. box-sizing: border-box;
  499. .consignment_button_con{
  500. width: 100%;
  501. height: 50px;
  502. background: #F9DDB3;
  503. border-radius: 8px;
  504. text-align: center;
  505. line-height: 50px;
  506. font-size: 18px;
  507. font-family: PingFangSC-Medium, PingFang SC;
  508. font-weight: 500;
  509. color: #503A1E;
  510. }
  511. }
  512. @bottom: 6px;
  513. @gray3: #f2f4f5;
  514. .popup {
  515. color: #000;
  516. position: relative;
  517. padding-bottom: calc(@bottom+ constant(safe-area-inset-bottom));
  518. padding-bottom: calc(@bottom + env(safe-area-inset-bottom));
  519. padding-bottom: 280px;
  520. .title {
  521. text-align: center;
  522. padding: 13px 0px;
  523. font-size: 17px;
  524. font-family: PingFangSC-Medium, PingFang SC;
  525. font-weight: 500;
  526. color: #ffffff;
  527. line-height: 24px;
  528. border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  529. }
  530. .popup_password_forget {
  531. font-size: 13px;
  532. font-family: PingFangSC-Regular, PingFang SC;
  533. font-weight: 400;
  534. color: #077dff;
  535. line-height: 18px;
  536. position: absolute;
  537. top: 132px;
  538. right: 28px;
  539. }
  540. .van-password-input {
  541. margin: 0 !important;
  542. padding: 19px 32px 12px;
  543. /deep/ .van-password-input__security li {
  544. width: 45px;
  545. height: 50px;
  546. border-radius: 4px;
  547. background: #1e222c;
  548. color: #ffffff;
  549. }
  550. }
  551. .cancel {
  552. width: 24px;
  553. height: 24px;
  554. position: absolute;
  555. // font-size: 16px;
  556. // font-family: PingFangSC-Regular, PingFang SC;
  557. // font-weight: 400;
  558. // color: #939599;
  559. // line-height: 22px;
  560. // padding: 21px 20px;
  561. left: 10px;
  562. top: 13px;
  563. }
  564. .phone {
  565. padding: 12px 0 20px;
  566. text-align: center;
  567. font-size: 12px;
  568. color: #aaabad;
  569. line-height: 24px;
  570. }
  571. /deep/.van-password-input {
  572. margin: 0 80px;
  573. }
  574. /deep/.van-key {
  575. &:hover {
  576. background-color: @gray3;
  577. }
  578. &:focus {
  579. background-color: @gray3;
  580. }
  581. &:active {
  582. background-color: @gray3;
  583. }
  584. &:link {
  585. background-color: @gray3;
  586. }
  587. &:visited {
  588. background-color: @gray3;
  589. }
  590. &.van-key--active {
  591. background-color: @gray3;
  592. }
  593. }
  594. /deep/[class*='van-hairline']::after {
  595. border-color: @gray3;
  596. }
  597. /deep/.van-key--blue {
  598. background: linear-gradient(135deg, @prim 0%, @warn 100%);
  599. color: @btnText;
  600. }
  601. }
  602. </style>