index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <div class="order-container">
  3. <h2>下单记录</h2>
  4. <van-dropdown-menu
  5. :active-color="'#4D69A4'">
  6. <van-dropdown-item
  7. :title="'类型'"
  8. v-model="orderPlatformSonType"
  9. :options="ordertype"
  10. @change="handleTypeChange"/>
  11. <van-dropdown-item
  12. :title="'状态'"
  13. v-model="orderStatus"
  14. :options="arrOrderStatus"
  15. @change="handleStatusChange"/>
  16. </van-dropdown-menu>
  17. <Main
  18. :orderPlatformSonType="orderPlatformSonType"
  19. :orderStatus="orderStatus"
  20. @setOrderDetail="setOrderDetail"
  21. ref="myMain"/>
  22. <van-popup
  23. class="fbt-van-popup"
  24. v-model="showDetail"
  25. position="bottom">
  26. <div class="fbt-van-popup-body">
  27. <h3>订单详情</h3>
  28. <p>
  29. <span class="label" style="color: #333333;">{{ orderDetail.product_name }}</span>
  30. <span class="value"></span>
  31. </p>
  32. <p>
  33. <span class="label">创建时间:</span>
  34. <span class="value">{{ orderDetail.created_at }}</span>
  35. </p>
  36. <p>
  37. <span class="label">支付时间:</span>
  38. <span class="value">{{ orderDetail.order_pay_at }}</span>
  39. </p>
  40. <p>
  41. <span class="label">订单号:</span>
  42. <span class="value">
  43. <i>{{ orderDetail.order_number }}</i>
  44. <a href="javascript:;">复制</a>
  45. </span>
  46. </p>
  47. <p>
  48. <span class="label">支付金额:</span>
  49. <span class="value">¥{{ orderDetail.order_realy_price | fen2Yuan }}</span>
  50. </p>
  51. <p>
  52. <span class="label">预计收益:</span>
  53. <span class="value" style="color: #FA4A4A;">¥{{ orderDetail.order_commission | fen2Yuan }}</span>
  54. </p>
  55. <p>
  56. <span class="label">订单平台类型:</span>
  57. <span class="value">{{ orderPlatformType[orderDetail.order_platform_type] }}</span>
  58. </p>
  59. <template
  60. v-if="[4, 5].findIndex(item => item === orderDetail.order_status) > -1">
  61. <p>
  62. <span class="label">退款时间:</span>
  63. <span class="value">{{ orderDetail.order_refund_at }}</span>
  64. </p>
  65. <p>
  66. <span class="label">退款金额:</span>
  67. <span class="value">{{ orderDetail.order_refund_price }}</span>
  68. </p>
  69. </template>
  70. <p class="status">{{ allOrderStatus[orderDetail.order_status] }}</p>
  71. </div>
  72. </van-popup>
  73. </div>
  74. </template>
  75. <script>
  76. import { DropdownMenu, DropdownItem, Popup } from 'vant'
  77. import Main from './child/main'
  78. export default {
  79. name: 'index',
  80. components: {
  81. 'van-dropdown-menu': DropdownMenu,
  82. 'van-dropdown-item': DropdownItem,
  83. Main,
  84. 'van-popup': Popup
  85. },
  86. data () {
  87. return {
  88. orderPlatformSonType: 0,
  89. orderStatus: 0,
  90. arrOrderStatus: [
  91. { text: '全部', value: 0 },
  92. { text: '未结算', value: 1 },
  93. { text: '已结算', value: 2 }
  94. ],
  95. showDetail: false,
  96. orderDetail: {}
  97. }
  98. },
  99. computed: {
  100. ordertype () {
  101. const result = this.$store.getters['common/orderType'].map(item => ({
  102. ...item,
  103. text: item.type_name,
  104. value: item.order_platform_son_type
  105. }))
  106. return [{ text: '全部', value: 0 }, ...result]
  107. },
  108. orderPlatformType () {
  109. return this.$store.getters['common/orderPlatformType']
  110. },
  111. allOrderStatus () {
  112. return this.$store.getters['common/allOrderStatus']
  113. }
  114. },
  115. async mounted () {
  116. await this.$nextTick()
  117. },
  118. methods: {
  119. handleTypeChange () {
  120. this.$nextTick(() => {
  121. this.$refs.myMain.onRefresh()
  122. })
  123. },
  124. handleStatusChange () {
  125. this.$nextTick(() => {
  126. this.$refs.myMain.onRefresh()
  127. })
  128. },
  129. setOrderDetail (obj) {
  130. if (Object.prototype.toString.call(obj) === '[object Object]') {
  131. this.orderDetail = obj
  132. this.showDetail = true
  133. }
  134. }
  135. }
  136. }
  137. </script>
  138. <style lang="scss" scoped>
  139. .order-container {
  140. position: absolute;
  141. left: 0;
  142. top: 0;
  143. right: 0;
  144. bottom: 0;
  145. width: 100%;
  146. }
  147. h2 {
  148. padding: 16px 0 16px 24px;
  149. font-size: 24px;
  150. font-family: PingFangSC-Medium, PingFang SC;
  151. font-weight: 500;
  152. color: #333333;
  153. line-height: 33px;
  154. }
  155. .fbt-van-popup {
  156. background: transparent;
  157. &-body {
  158. display: flex;
  159. flex-direction: column;
  160. align-items: center;
  161. width: 343px;
  162. background: #FFFFFF;
  163. border-radius: 8px;
  164. padding-top: 24px;
  165. margin: 0 auto 16px;
  166. h3 {
  167. width: 304px;
  168. font-size: 24px;
  169. font-family: PingFangSC-Medium, PingFang SC;
  170. font-weight: 500;
  171. color: #333333;
  172. line-height: 33px;
  173. }
  174. p {
  175. display: flex;
  176. align-items: center;
  177. width: 304px;
  178. margin-top: 12px;
  179. &:nth-of-type(1) {
  180. margin-top: 20px;
  181. }
  182. span {
  183. font-size: 14px;
  184. line-height: 20px;
  185. }
  186. .label {
  187. width: 100px;
  188. color: #999999;
  189. }
  190. .value {
  191. display: flex;
  192. align-items: center;
  193. justify-content: flex-end;
  194. width: calc(100% - 100px);
  195. text-align: right;
  196. color: #333333;
  197. i {
  198. font-size: 14px;
  199. color: #333333;
  200. line-height: 20px;
  201. }
  202. a {
  203. padding-left: 10px;
  204. font-size: 14px;
  205. color: #4D69A4;
  206. line-height: 20px;
  207. }
  208. }
  209. }
  210. .status {
  211. justify-content: flex-end;
  212. padding: 15px 0 17px;
  213. margin-top: 20px;
  214. border-top: 1px solid rgba(31, 49, 74, 0.1);
  215. font-size: 20px;
  216. font-family: PingFangSC-Medium, PingFang SC;
  217. font-weight: 500;
  218. color: #FA4A4A;
  219. line-height: 28px;
  220. }
  221. }
  222. }
  223. </style>