Consignment.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <template>
  2. <div class="top">
  3. <div class="top-content">
  4. <div class="title">寄售说明</div>
  5. <div class="name" v-for="(item, index) in list" :key="index">
  6. <span>{{ item.title }}</span>
  7. </div>
  8. <div class="border border1"></div>
  9. <div class="content">
  10. <van-field type="number" label="寄售价格(元)" placeholder="请设置寄售价格" v-model="price" />
  11. </div>
  12. <div class="border"></div>
  13. <div class="input">
  14. <div class="text1">请输入交易密码,验证信息</div>
  15. <div v-if="sets">
  16. <van-password-input :value="password" :focused="showKeyboard" @focus="showKeyboard = true" />
  17. <van-number-keyboard
  18. v-model="password"
  19. :show="showKeyboard"
  20. @blur="showKeyboard = false"
  21. maxlength="6"
  22. />
  23. <div class="text2" @click="$router.push('/tradingPassword')">忘记密码?</div>
  24. </div>
  25. <div v-else class="text3" @click="$router.push('/tradingPassword')">您当前没有交易密码,点击去设置</div>
  26. </div>
  27. </div>
  28. <div class="bottom van-safe-area-bottom" ref="bottom">
  29. <van-notice-bar
  30. :color="$colors.prim"
  31. :background="$colors.prim"
  32. text="出售成功的加密作品将会携带加密作品的所有信息转让于购买方,包括但不限于:加密空间、权益的使用、加密作品的区块信息等"
  33. />
  34. <div class="bottom-content">
  35. <div class="btn1" @click="$router.go(-1)">取消</div>
  36. <div class="btn2" @click="submit">确认寄售</div>
  37. </div>
  38. </div>
  39. <div class="border"></div>
  40. </div>
  41. </template>
  42. <script>
  43. import { mapState } from 'vuex';
  44. export default {
  45. name: 'Top',
  46. data() {
  47. return {
  48. price: '',
  49. showKeyboard: false,
  50. password: '',
  51. sets: false,
  52. list: [
  53. {
  54. title: '1. 作品寄售为单个作品价格'
  55. },
  56. {
  57. title: '2. 用户将会看到加密作品的权益、加密空间的使用情况'
  58. },
  59. {
  60. title: '3. 交易成功后加密作品的点赞数量将会被清除'
  61. },
  62. {
  63. title: '4. 平台会收取作品出售价格的 5% 作为服务费'
  64. },
  65. {
  66. title: '5. 因电子支付通道限制,单笔限额20000元'
  67. }
  68. ]
  69. };
  70. },
  71. computed: {
  72. ...mapState(['userInfo'])
  73. },
  74. mounted() {
  75. this.passFn();
  76. },
  77. methods: {
  78. passFn() {
  79. this.$http
  80. .get('/user/tradeCodeStatus', {
  81. userId: this.userInfo.id
  82. })
  83. .then(res => {
  84. console.log(res);
  85. this.sets = res.set;
  86. });
  87. },
  88. submit() {
  89. if (this.price != '') {
  90. this.$http
  91. .post('/user/verifyTradeCode', {
  92. tradeCode: this.password
  93. })
  94. .then(() => {
  95. this.$http
  96. .post('/asset/consignment', {
  97. id: this.$route.query.id,
  98. price: this.price
  99. })
  100. .then(res => {
  101. this.$toast.success('寄售成功');
  102. setTimeout(() => {
  103. this.$router.go(-1);
  104. }, 1000);
  105. })
  106. .catch(e => {
  107. if (e) {
  108. this.$toast.success(e.error);
  109. }
  110. });
  111. })
  112. .catch(e => {
  113. if (e) {
  114. this.$toast('密码错误');
  115. }
  116. });
  117. } else {
  118. this.$toast('请输入价格');
  119. }
  120. }
  121. }
  122. };
  123. </script>
  124. <style lang="less" scoped>
  125. /deep/ .van-notice-bar {
  126. background: rgba(255, 108, 0, 0.1) !important;
  127. }
  128. /deep/ .van-password-input {
  129. margin: 0 0;
  130. .van-password-input__security {
  131. border: 1px solid @text3;
  132. height: 42px;
  133. border-radius: 2px;
  134. li {
  135. background-color: transparent;
  136. &:not(:last-child) {
  137. border-right: 1px solid @text3;
  138. }
  139. i {
  140. // background-color: #fff;
  141. }
  142. }
  143. }
  144. }
  145. /deep/.van-number-keyboard__body {
  146. background-color: fade(#4a4a4a, 50%);
  147. .van-key {
  148. background-color: @bg;
  149. &:active {
  150. background-color: @bg3;
  151. }
  152. }
  153. }
  154. .input {
  155. padding: 20px 0;
  156. .text1 {
  157. font-size: @font2;
  158. color: @text0;
  159. line-height: 24px;
  160. margin-bottom: 6px;
  161. }
  162. }
  163. .top-content {
  164. background-color: @bg;
  165. padding-top: 10px;
  166. }
  167. .top {
  168. background-color: @bg3;
  169. /deep/ .van-password-input {
  170. margin: 10px 0;
  171. padding: 0 25px;
  172. .van-password-input__security {
  173. border: 1px solid @text3;
  174. height: 42px;
  175. border-radius: 2px;
  176. li {
  177. background-color: transparent;
  178. &:not(:last-child) {
  179. border-right: 1px solid @text3;
  180. }
  181. i {
  182. // background-color: #fff;
  183. }
  184. }
  185. }
  186. }
  187. /deep/ .van-cell {
  188. padding-top: 20px;
  189. }
  190. /deep/.van-cell__title {
  191. font-size: @font2;
  192. font-weight: bold;
  193. color: @text0;
  194. line-height: 24px;
  195. }
  196. // background-color: @bg3;;
  197. padding-bottom: 100px;
  198. .title {
  199. font-size: 20px;
  200. font-weight: bold;
  201. color: @text0;
  202. line-height: 30px;
  203. margin-top: 5px;
  204. padding-left: 16px;
  205. }
  206. .name {
  207. padding-left: 16px;
  208. span {
  209. font-size: 12px;
  210. font-weight: 400;
  211. color: @text3;
  212. line-height: 22px;
  213. }
  214. }
  215. .bottom {
  216. position: fixed;
  217. bottom: 0px;
  218. left: 0;
  219. right: 0;
  220. background-color: @bg;
  221. z-index: 20;
  222. border-top: 1px solid @tabBorder;
  223. .bottom-content {
  224. padding: 6px 16px;
  225. display: flex;
  226. align-items: center;
  227. justify-content: space-between;
  228. .btn1 {
  229. width: 161px;
  230. height: 44px;
  231. border-radius: 22px;
  232. line-height: 44px;
  233. color: @text3;
  234. text-align: center;
  235. border: 1px solid @text3;
  236. }
  237. .btn2 {
  238. width: 162px;
  239. height: 44px;
  240. line-height: 44px;
  241. text-align: center;
  242. color: @btnText;
  243. background: linear-gradient(135deg, @prim 0%, @warn 100%);
  244. border-radius: 22px;
  245. }
  246. .van-button {
  247. flex-grow: 1;
  248. color: #333230 !important;
  249. max-width: 210px;
  250. }
  251. .text {
  252. font-size: @font2;
  253. color: @text3;
  254. line-height: 20px;
  255. word-break: keep-all;
  256. }
  257. }
  258. }
  259. .border {
  260. width: 375px;
  261. height: 5px;
  262. background: @bg3;
  263. &.border1 {
  264. margin-top: 20px;
  265. }
  266. }
  267. .content {
  268. width: 375px;
  269. height: 70px;
  270. line-height: 70px;
  271. background: @bg;
  272. }
  273. .input {
  274. margin-top: 20px;
  275. width: 100%;
  276. .text1 {
  277. font-size: @font2;
  278. color: @text0;
  279. line-height: 24px;
  280. margin-bottom: 6px;
  281. text-align: center;
  282. }
  283. .text2 {
  284. font-size: @font2;
  285. text-align: right;
  286. font-weight: 400;
  287. color: @text3;
  288. line-height: 24px;
  289. margin-right: 15px;
  290. }
  291. .text3 {
  292. font-size: @font2;
  293. color: #ff4f50;
  294. line-height: 24px;
  295. margin-top: 25px;
  296. display: flex;
  297. justify-content: center;
  298. }
  299. }
  300. }
  301. </style>