orderDetail.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <div class="orderDetail">
  3. <div class="Detail_con" v-if="order.type==3">
  4. <image :src="order.product_img" class="p_img" mode="widthFix" />
  5. <div class="p_t">{{ order.product_name }}</div>
  6. </div>
  7. <div class="card qupiao" v-for="(detail,s) in orders" :key="s">
  8. <uqrcode ref="uqcode" v-if="[0,2].includes(detail.card_type)" :code="detail.unique_code" class="code-img" :size="150" />
  9. <tki-barcode v-if="[1,2].includes(detail.card_type)" :val="detail.unique_code" />
  10. <p @click="copyText(detail.card_no)" v-if="detail.card_no">
  11. <span>卡号:{{ detail.card_no }}</span>
  12. <span class="iconfont ico">&#xe602;</span>
  13. </p>
  14. <p @click="copyText(detail.card_pwd)" v-if="detail.card_pwd">
  15. <span>卡密:{{ detail.card_pwd }}</span>
  16. <span class="iconfont ico">&#xe602;</span>
  17. </p>
  18. <p @click="copyText(detail.link_url)" v-if="detail.link_url">
  19. <span>卡券链接:{{detail.link_url}}</span>
  20. <span class="iconfont ico">&#xe602;</span>
  21. </p>
  22. </div>
  23. <div class="money card" v-if="order.type==2">
  24. <div class="li flex_r flex_jb">
  25. <span>数量</span>
  26. <span>x {{ order.number }}</span>
  27. </div>
  28. <div class="li flex_r flex_jb">
  29. <span>消费金额</span>
  30. <span>¥{{ order.order_amount || 0 }}</span>
  31. </div>
  32. <div class="li flex_r flex_jb">
  33. <span>消费金抵扣<span class="corg">{{Integral}}%</span></span>
  34. <span class="corg">-¥{{ deduction || 0 }}</span>
  35. </div>
  36. <div class="li flex_r flex_jb">
  37. <span>实付金额</span>
  38. <span>¥{{ order.pay_amount || 0 }}</span>
  39. </div>
  40. </div>
  41. <div class="info card">
  42. <template v-if="order.type==2">
  43. <p>产品品牌:{{ order.restaurant_name }}</p>
  44. <p>产品名称:{{ order.product_name }}</p>
  45. </template>
  46. <p>账号:{{ order.phone }}</p>
  47. <p>数量:{{ order.number }}</p>
  48. <p>订单金额:¥{{ order.pay_amount }}</p>
  49. <p>订单编号:{{ order.trade_no }}</p>
  50. <p>下单时间:{{ order.create_time }}</p>
  51. </div>
  52. <div class="msg" v-html="order.product_detail"></div>
  53. <div class="footbtn" v-if="order.status == 0" @click="pay">立即支付</div>
  54. </div>
  55. </template>
  56. <script>
  57. import { ToPayOpre } from "@/utils/reqTools.js";
  58. let toPayOpre = new ToPayOpre();
  59. import Uqrcode from '@/components/uqrcode/uqrcode';
  60. import tkiBarcode from "@/pagesB/components/tki-barcode/tkiBarcode.vue";
  61. import { post } from "@/request/api.js";
  62. import uniCopy from "@/utils/copy";
  63. export default {
  64. name: "orderDetail",
  65. props: {},
  66. components: { Uqrcode, tkiBarcode },
  67. data() {
  68. return {
  69. order: {},
  70. orders: [],
  71. pda: {},
  72. Integral: 0,
  73. deduction: 0,
  74. };
  75. },
  76. methods: {
  77. getOrderDetail(da) {
  78. post("local/coupon/orderDetail", da).then(res => {
  79. if (res.code == 0) {
  80. let da = res.data.order
  81. da.product_img = da.orderGoods[0].product_img;
  82. da.product_name = da.orderGoods[0].product_name;
  83. delete da.orderGoods;
  84. this.order = da;
  85. if(res.data.detail.code == 200){
  86. this.orders = res.data.detail.data;
  87. }
  88. if(this.order.type==2) this.getIntegral()
  89. }
  90. })
  91. },
  92. getIntegral() {
  93. post("local/getIntegral", { type: 3 }).then(res => {
  94. if (res.code == 0) {
  95. let i1 = res.data.integral;
  96. this.Integral = this.$h.Mul(i1, 100);
  97. this.deduction = this.$h.Mul(this.order.order_amount, i1).toFixed(2);
  98. }
  99. })
  100. },
  101. pay() {
  102. post("local/goOrderPay", { trade_no: this.order.trade_no }).then(res => {
  103. if (res.code == 0 && res.data.data.prepayid) {
  104. toPayOpre.toPay(res.data.data, (rea) => {
  105. if (!rea) {
  106. // 支付成功
  107. this.getOrderDetail(this.pda);
  108. } else {
  109. // 支付失败
  110. }
  111. });
  112. }
  113. })
  114. },
  115. copyText(e) {
  116. uniCopy({
  117. content: e,
  118. success: (res) => {},
  119. error: (e) => {},
  120. });
  121. },
  122. },
  123. onLoad(da) {
  124. this.getOrderDetail(da);
  125. this.pda = da;
  126. },
  127. onShow() {},
  128. mounted() {},
  129. };
  130. </script>
  131. <style scoped lang='scss'>
  132. .orderDetail{
  133. padding: 28rpx 30rpx;
  134. }
  135. .Detail_con{
  136. background-color: #fff;
  137. border-radius: 20rpx;
  138. padding: 28rpx 30rpx;
  139. margin-bottom: 30rpx;
  140. box-shadow: 4rpx 4rpx 16rpx 10rpx rgba($color: #000, $alpha: 0.15);
  141. .p_img{
  142. width: 100%;
  143. border-radius: 20rpx;
  144. }
  145. .p_t{
  146. font-size: 30rpx;
  147. font-weight: bold;
  148. }
  149. }
  150. .info{
  151. p{
  152. font-size: 28rpx;
  153. color: #666;
  154. margin-bottom: 8rpx;
  155. &:last-child {
  156. margin-bottom: 0;
  157. }
  158. }
  159. }
  160. .qupiao {
  161. position: relative;
  162. .code-img {
  163. display: flex;
  164. flex-direction: row;
  165. justify-content: center;
  166. margin: 0 auto;
  167. }
  168. .ico{
  169. float: right;
  170. }
  171. }
  172. .card {
  173. background-color: #fff;
  174. border-radius: 20rpx;
  175. margin-bottom: 30rpx;
  176. padding: 28rpx 30rpx;
  177. font-size: 32rpx;
  178. box-shadow: 4rpx 4rpx 16rpx 10rpx rgba($color: #000, $alpha: 0.15);
  179. &:last-child {
  180. margin-bottom: 0;
  181. }
  182. }
  183. .footbtn {
  184. width: calc(100% - 60rpx);
  185. height: 80rpx;
  186. background: #17bb87;
  187. border-radius: 45rpx;
  188. position: fixed;
  189. bottom: 50rpx;
  190. left: 30rpx;
  191. color: #fff;
  192. font-size: 36rpx;
  193. text-align: center;
  194. line-height: 80rpx;
  195. }
  196. .money{
  197. .li{
  198. margin-bottom: 16rpx;
  199. &:last-child{
  200. margin-bottom: 0;
  201. }
  202. span{
  203. font-size: 30rpx;
  204. }
  205. }
  206. .corg{
  207. color: #18bb88;
  208. margin-left: 5rpx;
  209. }
  210. }
  211. .msg {
  212. font-size: 26rpx;
  213. margin-top: 50rpx;
  214. }
  215. </style>