detail.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <view>
  3. <view class="product_detail">
  4. <!-- <image src="../../../static/news.jpg" mode="widthFix" class="pic"></image> -->
  5. <view class="box">
  6. <view class="title">{{ item.goodsName }}</view>
  7. <view class="clear"></view>
  8. <u-divider text="详情"></u-divider>
  9. <view class="item">
  10. <text class="desc">车牌号:</text>
  11. <text>{{ item.veNo }}</text>
  12. <view class="clear"></view>
  13. </view>
  14. <view class="item">
  15. <text class="desc">商品重量:</text>
  16. <text v-if="type==1">{{ item.goodsNames }} </text>
  17. <text v-if="type==2">{{ item.goodsName }} </text>
  18. </view>
  19. <view class="item">
  20. <text class="desc">商品名称:</text>
  21. <text v-if="type==1">{{ item.sumNetWt }} kg</text>
  22. <text v-if="type==2">{{ item.netWet }} kg</text>
  23. </view>
  24. <view class="item">
  25. <text class="desc">货主:</text>
  26. <text v-if="type==1">{{ item.shopName }}</text>
  27. <text v-if="type==2">{{ item.leaderName }}</text>
  28. </view>
  29. <view class="item">
  30. <text class="desc">互市区:</text>
  31. <text v-if="type==2">{{ item.tradeAreaName }}</text>
  32. <text v-if="type==1">{{ item.fieldName }}</text>
  33. <view class="clear"></view>
  34. </view>
  35. <view class="item">
  36. <text class="desc">发布时间:</text>
  37. <text>{{ item.createTime }}</text>
  38. <view class="clear"></view>
  39. </view>
  40. <view class="item">
  41. <text class="desc">总金额:</text>
  42. <text v-if="type==2" class="price">¥ {{ item.resalePrice }}</text>
  43. <text v-if="type==1" class="price">¥ {{ item.sumUpPrice }}</text>
  44. <view class="clear"></view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="mfooter">
  49. <view class="flex">
  50. <view class="f">
  51. <button class="btn" v-if="user.userType == 3" @click="pay()">立即购买</button>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. export default {
  59. data() {
  60. return {
  61. user: this.getUser(),
  62. item: {},
  63. id: '',
  64. type: 1
  65. };
  66. },
  67. onLoad(e) {
  68. if (e.id) {
  69. this.id = e.id;
  70. this.type = e.type
  71. this.getDetail()
  72. }
  73. },
  74. methods: {
  75. getDetail() {
  76. if (this.type == 1) {
  77. this.getWholeDetails();
  78. } else {
  79. this.getOrdersDetails()
  80. }
  81. },
  82. getOrdersDetails() {
  83. this.http.request({
  84. url: '/level-two-server/app/TbOrders/getDetailById',
  85. method: 'POST',
  86. data: {
  87. ids: this.id
  88. },
  89. success: res => {
  90. let data = res.data.data;
  91. this.item = data[0];
  92. }
  93. });
  94. },
  95. getWholeDetails() {
  96. this.http.request({
  97. url: '/level-one-server/app/HtTradeSettlement/getByIds',
  98. method: 'POST',
  99. data: {
  100. ids: this.id
  101. },
  102. success: res => {
  103. this.item = res.data.data[0];
  104. }
  105. });
  106. },
  107. buyOrder() {
  108. this.http.request({
  109. url: '/level-two-server/app/TbOrders/purchaserBuy',
  110. method: 'POST',
  111. data: {
  112. ids: this.id
  113. },
  114. success: res => {
  115. uni.navigateTo({
  116. url: '/pages/market/two/leader/success'
  117. });
  118. }
  119. });
  120. },
  121. buyWhole() {
  122. this.http.request({
  123. url: '/level-two-server/app/TbOrders/purchaserBuyWhole',
  124. method: 'POST',
  125. data: {
  126. ids: this.id
  127. },
  128. success: res => {
  129. uni.navigateTo({
  130. url: '/pages/market/two/leader/success'
  131. });
  132. }
  133. });
  134. },
  135. pay() {
  136. uni.showModal({
  137. title: '提示',
  138. content: '确定下单购买?',
  139. success: res => {
  140. if (res.confirm) {
  141. if (this.type == 1) {
  142. this.buyWhole()
  143. } else {
  144. this.buyOrder()
  145. }
  146. }
  147. }
  148. });
  149. }
  150. }
  151. };
  152. </script>
  153. <style lang="scss">
  154. page {
  155. .price {
  156. color: red;
  157. font-weight: bold;
  158. }
  159. background-color: $pg;
  160. }
  161. </style>