orderDetail.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <div class="orderDetail">
  3. <div class="Detail_con">
  4. <div class="p_t">{{ order.product_name }}</div>
  5. </div>
  6. <div class="money card">
  7. <div class="li flex_r flex_jb">
  8. <span>消费金额</span>
  9. <span>¥{{ order.attachment.custom_price || 0 }}</span>
  10. </div>
  11. <div class="li flex_r flex_jb">
  12. <span>消费金抵扣</span>
  13. <span class="corg">-¥{{ order.attachment.custom_integral || 0 }}</span>
  14. </div>
  15. <div class="li flex_r flex_jb">
  16. <span>实付金额</span>
  17. <span>¥{{ order.actually_paid || order.pay_amount }}</span>
  18. </div>
  19. </div>
  20. <div class="money card">
  21. <div class="li flex_r flex_jb">
  22. <span>赠送茶宝</span>
  23. <span>{{ order.attachment.chabao || 0 }}</span>
  24. </div>
  25. </div>
  26. <div class="info card">
  27. <p>产品品牌:{{ order.restaurant_name }}</p>
  28. <p>产品名称:{{ order.product_name }}</p>
  29. <p>充值手机号:{{ order.phone }}</p>
  30. <p>订单金额:¥{{ order.actually_paid || order.pay_amount }}</p>
  31. <p>订单编号:{{ order.trade_no }}</p>
  32. <p>下单时间:{{ order.create_time }}</p>
  33. </div>
  34. <div class="footbtn" v-if="order.status == 0" @click="pay">立即支付</div>
  35. </div>
  36. </template>
  37. <script>
  38. import { ToPayOpre } from "@/utils/reqTools.js";
  39. let toPayOpre = new ToPayOpre();
  40. import { post } from "@/request/api.js";
  41. export default {
  42. name: "orderDetail",
  43. props: {},
  44. data() {
  45. return {
  46. order: {},
  47. orders: [],
  48. pda: {},
  49. // Integral: 0,
  50. // deduction: 0,
  51. };
  52. },
  53. methods: {
  54. getOrderDetail(da) {
  55. post("local/ofpay/orderDetail", da).then(res => {
  56. if (res.code == 0) {
  57. let da = res.data.order
  58. da.product_name = da.orderGoods[0].product_name;
  59. if(da.orderGoods[0]?.attachment){
  60. da.attachment = JSON.parse(da.orderGoods[0].attachment);
  61. }
  62. delete da.orderGoods;
  63. this.order = da;
  64. // this.getIntegral()
  65. }
  66. })
  67. },
  68. // getIntegral() {
  69. // post("local/getIntegral", { type: 6 }).then(res => {
  70. // if (res.code == 0) {
  71. // let i1 = res.data.integral;
  72. // this.Integral = this.$h.Mul(i1, 100);
  73. // this.deduction = this.$h.Mul(this.order.order_amount, i1).toFixed(2);
  74. // }
  75. // })
  76. // },
  77. pay() {
  78. let type = "";
  79. // #ifdef H5
  80. type = "H5";
  81. // #endif
  82. // #ifdef APP
  83. type = "app";
  84. // #endif
  85. // #ifdef MP-WEIXIN
  86. type = "jsapi";
  87. // #endif
  88. post("local/goOrderPay", { trade_no: this.order.trade_no,trade_type: type }).then(res => {
  89. if(res.data && res.data != 200){
  90. let data = JSON.parse(res.data)
  91. data.prepayid = data.package?data.package.split('prepay_id=')[1]:''
  92. if (res.code == 0 && data.prepayid) {
  93. toPayOpre.toPay(data, (rea) => {
  94. if (!rea) {
  95. // 支付成功
  96. this.getOrderDetail(this.pda);
  97. } else {
  98. // 支付失败
  99. }
  100. });
  101. }
  102. }
  103. })
  104. },
  105. },
  106. onLoad(da) {
  107. this.getOrderDetail(da);
  108. this.pda = da;
  109. },
  110. onShow() {},
  111. mounted() {},
  112. };
  113. </script>
  114. <style scoped lang='scss'>
  115. .orderDetail{
  116. padding: 28rpx 30rpx;
  117. }
  118. .Detail_con{
  119. background-color: #fff;
  120. border-radius: 20rpx;
  121. padding: 28rpx 30rpx;
  122. margin-bottom: 30rpx;
  123. box-shadow: 4rpx 4rpx 8rpx 4rpx rgba(0, 0, 0, 0.12);
  124. .p_t{
  125. font-size: 30rpx;
  126. font-weight: bold;
  127. }
  128. }
  129. .info{
  130. p{
  131. font-size: 28rpx;
  132. color: #666;
  133. margin-bottom: 8rpx;
  134. &:last-child {
  135. margin-bottom: 0;
  136. }
  137. }
  138. }
  139. .card {
  140. background-color: #fff;
  141. border-radius: 20rpx;
  142. margin-bottom: 30rpx;
  143. padding: 28rpx 30rpx;
  144. font-size: 32rpx;
  145. box-shadow: 4rpx 4rpx 8rpx 4rpx rgba(0, 0, 0, 0.12);
  146. &:last-child {
  147. margin-bottom: 0;
  148. }
  149. }
  150. .footbtn {
  151. width: calc(100% - 60rpx);
  152. height: 80rpx;
  153. background: #17bb87;
  154. border-radius: 45rpx;
  155. position: fixed;
  156. bottom: 50rpx;
  157. left: 30rpx;
  158. color: #fff;
  159. font-size: 36rpx;
  160. text-align: center;
  161. line-height: 80rpx;
  162. }
  163. .money{
  164. .li{
  165. margin-bottom: 16rpx;
  166. &:last-child{
  167. margin-bottom: 0;
  168. }
  169. span{
  170. font-size: 30rpx;
  171. }
  172. }
  173. .corg{
  174. color: #18bb88;
  175. margin-left: 5rpx;
  176. }
  177. }
  178. </style>