detail_order.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <div id="form-1">
  3. <el-row>
  4. <el-col :span="24" class="main animate__animated animate__backInRight">
  5. <el-col class="top-btn">
  6. <el-button type="primary" size="mini" @click="toBack()">返回</el-button>
  7. </el-col>
  8. <el-col :span="8" class="one">
  9. <el-col :span="24" class="add">
  10. <el-col :span="2">
  11. <i class="el-icon-location"></i>
  12. </el-col>
  13. <el-col :span="22">
  14. <p>{{ address.name }},{{ address.phone }}</p>
  15. <p>{{ address.province }} , {{ address.city }} , {{ address.area }} , {{ address.address }}</p>
  16. </el-col>
  17. </el-col>
  18. <el-col :span="24" v-for="(item, index) in list" :key="index">
  19. <el-col :span="24" class="shop"> <i class="el-icon-s-shop"></i>{{ item.shop_name }}</el-col>
  20. <el-col :span="24" v-for="(goods, index) in item.goods" :key="index">
  21. <el-col :span="24" class="goods">
  22. <el-col :span="6"><el-image :src="goods.goods.file[0].url"></el-image></el-col>
  23. <el-col :span="18">
  24. <el-col :span="12">
  25. <p>{{ goods.goods.name }}</p>
  26. <p>规格:{{ goods.name }}</p>
  27. </el-col>
  28. <el-col :span="12" class="money">
  29. <p>¥{{ goods.sell_money }}</p>
  30. <p>X{{ goods.buy_num }}</p>
  31. </el-col>
  32. </el-col>
  33. </el-col>
  34. <el-col :span="24">
  35. <el-col :span="6">运费</el-col>
  36. <el-col :span="18" class="other" v-if="!goods.freight == '0'">{{ goods.freight }}</el-col>
  37. <el-col :span="18" class="other" v-else>包邮</el-col>
  38. </el-col>
  39. <el-col :span="24">
  40. <el-col :span="6">订单备注</el-col>
  41. <el-col :span="18" class="other" v-if="item.remarks">{{ item.remarks }}</el-col>
  42. <el-col :span="18" class="other" v-else>暂无备注</el-col>
  43. </el-col>
  44. </el-col>
  45. </el-col>
  46. <el-col :span="24">
  47. <el-col :span="6">配送方式</el-col>
  48. <el-col :span="18" class="other">快递配送</el-col>
  49. </el-col>
  50. <el-col :span="24" class="goods_total">
  51. <el-col :span="6">商品金额</el-col>
  52. <el-col :span="18" class="other">
  53. <p>¥{{ total_detail }}</p>
  54. </el-col>
  55. </el-col>
  56. <el-col :span="24" class="goods_total">
  57. <el-col :span="6">应付金额</el-col>
  58. <el-col :span="18" class="other">
  59. <p>¥{{ pay.pay_money }}</p>
  60. </el-col>
  61. </el-col>
  62. <el-col :span="24">
  63. <el-col :span="6">下单时间</el-col>
  64. <el-col :span="18" class="other">{{ info.buy_time }}</el-col>
  65. </el-col>
  66. <el-col :span="24">
  67. <el-col :span="6">支付时间</el-col>
  68. <el-col :span="18" class="other">{{ info.pay_time || '未支付' }}</el-col>
  69. </el-col>
  70. </el-col>
  71. </el-col>
  72. </el-row>
  73. </div>
  74. </template>
  75. <script>
  76. const _ = require('lodash');
  77. const moment = require('moment');
  78. import { mapState, mapGetters, createNamespacedHelpers } from 'vuex';
  79. const { mapActions } = createNamespacedHelpers('order');
  80. export default {
  81. name: 'form-1',
  82. props: {},
  83. components: {},
  84. data: function () {
  85. return {
  86. info: {},
  87. address: {},
  88. list: [],
  89. total_detail: '',
  90. typeList: [],
  91. statusList: [],
  92. pay: {},
  93. };
  94. },
  95. async created() {
  96. await this.search();
  97. },
  98. methods: {
  99. ...mapActions(['query', 'fetch', 'create', 'update']),
  100. // 查询
  101. async search() {
  102. let res = await this.fetch(this.id);
  103. if (this.$checkRes(res)) {
  104. this.$set(this, `info`, res.data);
  105. // 地址
  106. this.$set(this, `address`, res.data.address);
  107. // 商品
  108. this.$set(this, `list`, res.data.goods);
  109. // 实付金额
  110. // this.$set(this, `total_detail`, res.data.total_detail);
  111. let total_detail = 0;
  112. let total = res.data.total_detail;
  113. if (res.data.total_detail) {
  114. total_detail = total.freight_total + total.goods_total;
  115. }
  116. this.$set(this, `total_detail`, total_detail);
  117. this.$set(this, `pay`, res.data.pay);
  118. }
  119. },
  120. // 返回
  121. toBack() {
  122. window.history.go('-1');
  123. },
  124. },
  125. computed: {
  126. id() {
  127. return this.$route.query.id;
  128. },
  129. },
  130. metaInfo() {
  131. return { title: this.$route.meta.title };
  132. },
  133. watch: {
  134. test: {
  135. deep: true,
  136. immediate: true,
  137. handler(val) {},
  138. },
  139. },
  140. };
  141. </script>
  142. <style lang="less" scoped>
  143. .main {
  144. .one {
  145. font-size: 20px;
  146. margin: 10px 0 0 20%;
  147. padding: 5px;
  148. .add {
  149. border-bottom: 2px dashed #ccc;
  150. margin: 0 0 5px 0;
  151. padding: 5px 0;
  152. }
  153. .shop {
  154. padding: 4px 0;
  155. font-size: 22px;
  156. border-bottom: 1px solid #ccc;
  157. }
  158. .goods {
  159. padding: 10px 0;
  160. .money {
  161. text-align: right;
  162. }
  163. }
  164. .other {
  165. text-align: right;
  166. p {
  167. color: red;
  168. }
  169. }
  170. .el-col {
  171. margin: 4px 0;
  172. }
  173. }
  174. }
  175. </style>