index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <view class="order-detail">
  3. <view class="detail-state">
  4. <template
  5. v-if="
  6. orderInfo.state == 8 ||
  7. orderInfo.state == 9 ||
  8. orderInfo.state == 2 ||
  9. orderInfo.state == 3
  10. "
  11. >
  12. <view class="state-error">
  13. <image class="" src="@/static/image/order/error_icon.png" />
  14. <text v-if="orderInfo.state == 8">当前订单待核销(未付款)</text>
  15. <text v-if="orderInfo.state == 9">当前订单待核销(已付款)</text>
  16. <text v-if="orderInfo.state == 2">待发货</text>
  17. <text v-if="orderInfo.state == 3">待收货</text>
  18. </view></template
  19. >
  20. <template v-else-if="orderInfo.state == 10 || orderInfo.state == 4">
  21. <view class="state-success">
  22. <image class="" src="@/static/image/order/success_icon.png" />
  23. <text v-if="orderInfo.state == 10">当前订单已核销</text>
  24. <text v-if="orderInfo.state == 4">当前订单已完成</text>
  25. </view>
  26. </template>
  27. <template v-else-if="orderInfo.state == 5">
  28. <view class="state-complete">
  29. <image class="" src="@/static/image/order/complete_icon.png" />
  30. <text>当前订单交易关闭(已取消)</text>
  31. </view>
  32. </template>
  33. </view>
  34. <view class="product-detail">
  35. <view class="product-list">
  36. <view
  37. class="product-item"
  38. v-for="item in renderData"
  39. :key="item.productId"
  40. >
  41. <view class="item-left">
  42. <image class="" :src="item.image" />
  43. </view>
  44. <view class="item-right">
  45. <view class="right-title">{{ item.productName }}</view>
  46. <view class="right-bottom">
  47. <view class="number">数量&nbsp;&nbsp;*{{ item.number }}</view>
  48. <view class="onePrice">¥{{ item.productPrice }}/1个</view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="load-more" v-if="productData.length > 2">
  54. <template v-if="!isShow">
  55. <view @click="expand">
  56. <tui-icon name="down" :size="16" color="#EF530E"></tui-icon>
  57. <text
  58. >展开剩余&nbsp;{{
  59. productData.length - renderData.length
  60. }}&nbsp;件商品</text
  61. >
  62. </view>
  63. </template>
  64. <template v-else>
  65. <view @click="expand">
  66. <tui-icon name="up" :size="16" color="#EF530E"></tui-icon>
  67. <text>收起</text>
  68. </view>
  69. </template>
  70. </view>
  71. </view>
  72. <view class="order-info">
  73. <view class="info-title">订单信息</view>
  74. <view class="info-detail">
  75. <view class="info-box">
  76. <text>订单编号</text>
  77. <text>{{ orderInfo.orderFormid }}</text>
  78. </view>
  79. <view class="info-box">
  80. <text>创建时间</text>
  81. <text>{{ orderInfo.createTime }}</text>
  82. </view>
  83. <view class="info-box">
  84. <text>订单类型</text>
  85. <text v-if="orderInfo.scanType == 1">常规订单</text>
  86. <text v-if="orderInfo.scanType == 2">收款码订单</text>
  87. </view>
  88. <view class="info-box">
  89. <text>下单账户</text>
  90. <text>{{ orderInfo.customerName }}</text>
  91. </view>
  92. <view class="info-box">
  93. <text>下单号码</text>
  94. <text>{{ orderInfo.buyerPhone }}</text>
  95. </view>
  96. </view>
  97. </view>
  98. <view class="pay-info">
  99. <view class="info-title">支付信息</view>
  100. <view class="info-detail">
  101. <view class="info-box">
  102. <text>支付方式</text>
  103. <text v-if="orderInfo.paymentMode == 1">微信</text>
  104. <text v-else-if="orderInfo.paymentMode == 2">支付宝</text>
  105. <text v-else-if="orderInfo.paymentMode == 3">花呗分期</text>
  106. <text v-else-if="orderInfo.paymentMode == 4">通联支付</text>
  107. <text v-else-if="orderInfo.paymentMode == 5">平台余额支付</text>
  108. <text v-else-if="orderInfo.paymentMode == 6">商家余额支付</text>
  109. <text v-else-if="orderInfo.paymentMode == 7">佣金支付</text>
  110. <text v-else-if="orderInfo.paymentMode == 8">消费金支付</text>
  111. <text v-else-if="orderInfo.paymentMode == 9">惠市宝支付</text>
  112. <text v-else>--</text>
  113. </view>
  114. <view class="info-box">
  115. <text>支付时间</text>
  116. <text>{{ orderInfo.paymentTime || "--" }}</text>
  117. </view>
  118. <view class="info-box price">
  119. <text>支付金额</text>
  120. <text>{{ orderInfo.price }}元</text>
  121. </view>
  122. <view class="info-box price">
  123. <text>赠送代金券</text>
  124. <text>{{ orderInfo.presenterVoucher }}</text>
  125. </view>
  126. </view>
  127. </view>
  128. <view class="write-off" v-if="orderInfo.state == 8 || orderInfo.state == 9">
  129. <view class="off-btn" @click="navigateTo('/pages_module/scanCode/index')"
  130. >去核销</view
  131. >
  132. <view class="seat"></view>
  133. </view>
  134. </view>
  135. </template>
  136. <script>
  137. import { orderGetById } from "@/config/index.js";
  138. export default {
  139. onLoad(option) {
  140. this.orderId = option.orderId;
  141. console.log(this.orderId, option);
  142. this.orderGetDetail();
  143. },
  144. data() {
  145. return {
  146. orderId: "",
  147. orderInfo: {},
  148. // 实际渲染的数据
  149. renderData: [],
  150. // 总商品数据
  151. productData: [],
  152. // 控制收起以及展开
  153. isShow: false,
  154. };
  155. },
  156. methods: {
  157. // 请求订单详情
  158. async orderGetDetail() {
  159. try {
  160. let res = await orderGetById({ orderId: this.orderId });
  161. this.orderInfo = res.data;
  162. this.productData = res.data.products;
  163. // 判断上坡是否超过两行
  164. if (res.data.products.length > 2) {
  165. this.renderData = res.data.products.slice(0, 2);
  166. } else {
  167. this.renderData = res.data.products;
  168. }
  169. } catch (error) {
  170. console.log(error);
  171. }
  172. },
  173. // 展开商品 expand
  174. expand() {
  175. this.isShow = !this.isShow;
  176. if (this.isShow) {
  177. this.renderData = this.productData;
  178. } else {
  179. this.renderData = this.productData.slice(0, 2);
  180. }
  181. },
  182. },
  183. };
  184. </script>
  185. <style lang="scss" scoped>
  186. @import "./index.scss";
  187. </style>