gs.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <view class="content">
  3. <view class="flex gs-item">
  4. <view class="item-name">
  5. 参考价格
  6. </view>
  7. <input type="text" class="item-val val-red" disabled v-model="pUser.points_transaction" />
  8. </view>
  9. <!-- //挂售价格(元) -->
  10. <view class="flex gs-item">
  11. <view class="item-name">
  12. 挂售价格(元)
  13. </view>
  14. <input type="text" class="item-val" placeholder="请输入您的挂售价(单价)" v-model="total_price" />
  15. </view>
  16. <view class="flex gs-item">
  17. <view class="item-name">
  18. 挂售数量
  19. </view>
  20. <input type="text" class="item-val" placeholder="请输入挂售数量" v-model="amount" />
  21. </view>
  22. <view class="flex gs-item" v-if="type !=1">
  23. <view class="item-name">
  24. 联系方式
  25. </view>
  26. <input type="text" class="item-val" placeholder="请输入联系方式" v-model="phone" />
  27. </view>
  28. <view class="fwf" v-if="type != 1">
  29. 服务费:<text>{{(total_price * amount * pUser.fee_ratio / 100).toFixed(2) || 0}} 阅读积分</text>
  30. </view>
  31. <view class="fwf" v-else>
  32. 服务费:<text>{{( amount * 0.05).toFixed(4) || 0}} 余额宝</text>
  33. </view>
  34. <view class="btn" @click="createGs">
  35. 确认
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import {
  41. createGs,
  42. passUser
  43. } from '@/api/zero.js'
  44. export default {
  45. data() {
  46. return {
  47. type: 0,
  48. total_price: '',
  49. amount: '',
  50. phone: '',
  51. pUser: {}
  52. }
  53. },
  54. onLoad(opt) {
  55. if (opt.type) {
  56. this.type = opt.type
  57. }
  58. },
  59. onShow() {
  60. this.passUser()
  61. },
  62. onReachBottom() {
  63. },
  64. onReady() {
  65. },
  66. methods: {
  67. passUser() {
  68. passUser().then(res => {
  69. this.pUser = res.data
  70. })
  71. },
  72. createGs() {
  73. let that = this
  74. if(!that.total_price) {
  75. return that.$api.msg('请输入挂售单价')
  76. }
  77. if(!that.amount) {
  78. return that.$api.msg('请输入挂售数量')
  79. }
  80. createGs({
  81. total_price: that.total_price * that.amount,
  82. amount: that.amount,
  83. phone: that.phone,
  84. type: that.type
  85. }).then(res => {
  86. uni.showToast({
  87. title: '挂售成功',
  88. duration: 2000
  89. });
  90. setTimeout(() => {
  91. uni.navigateBack()
  92. }, 1500)
  93. })
  94. }
  95. }
  96. }
  97. </script>
  98. <style lang="scss" scoped>
  99. .gs-item {
  100. height: 135rpx;
  101. background-color: #fff;
  102. padding: 0 65rpx;
  103. .item-val {
  104. width: 405rpx;
  105. height: 87rpx;
  106. background: #F4F4F4;
  107. border-radius: 10rpx;
  108. text-align: center;
  109. font-size: 36rpx;
  110. font-weight: bold;
  111. }
  112. .val-red {
  113. color: #FD3B39;
  114. }
  115. }
  116. .fwf {
  117. font-size: 30rpx;
  118. font-weight: bold;
  119. color: #333333;
  120. text-align: right;
  121. padding-right: 65rpx;
  122. background-color: #fff;
  123. padding-bottom: 62rpx;
  124. text {
  125. color: #FD3B39;
  126. }
  127. }
  128. .btn {
  129. width: 616rpx;
  130. height: 88rpx;
  131. background: #ff4c4c;
  132. border-radius: 10rpx;
  133. font-size: 36rpx;
  134. font-weight: bold;
  135. color: #FFFFFF;
  136. line-height: 88rpx;
  137. text-align: center;
  138. margin: 60rpx auto;
  139. }
  140. </style>