detail.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <div class="oDetail" v-loading="loading">
  3. <van-nav-bar
  4. title="订单详情"
  5. class="van-nav-bar-my-fixed"
  6. left-arrow
  7. @click-left="onClickLeft"
  8. fixedfixed
  9. />
  10. <div class="page-main">
  11. <van-cell-group title="订单信息">
  12. <van-cell
  13. size="mini"
  14. v-for="(item, i) in list1"
  15. :key="item.title + i"
  16. center
  17. :title="item.title"
  18. :value="item.value"
  19. /></van-cell-group>
  20. <div class="jiange"></div>
  21. <van-cell-group v-if="status === '2'" title="物流信息">
  22. <van-cell
  23. size="mini"
  24. v-for="(item, i) in list2"
  25. :key="item.title + i"
  26. :title="item.title"
  27. :value="item.value"
  28. /></van-cell-group>
  29. <div class="jiange" v-if="status === '2'"></div>
  30. <van-cell-group v-if="status === '2'" title="当前物流">
  31. <van-cell
  32. size="mini"
  33. v-for="(item, i) in list5"
  34. :key="item.title + i"
  35. :title="item.title"
  36. :value="item.value"
  37. /></van-cell-group>
  38. <div v-if="context" class="context">{{ context }}</div>
  39. <div class="jiange" v-if="status === '2'"></div>
  40. <van-cell-group title="收货地址">
  41. <van-cell
  42. size="mini"
  43. v-for="(item, i) in list3"
  44. :key="item.title + i"
  45. center
  46. :title="item.title"
  47. :value="item.value"
  48. /></van-cell-group>
  49. <div class="jiange"></div>
  50. <van-cell-group title="商品信息">
  51. <van-cell
  52. size="mini"
  53. v-for="(item, i) in list4"
  54. :key="item.title + i"
  55. center
  56. :title="item.title"
  57. :value="item.value"
  58. /></van-cell-group>
  59. </div>
  60. </div>
  61. </template>
  62. <script>
  63. import asyncRequest from "@/apis/order/index";
  64. import resToken from "@/mixins/resToken";
  65. import { getAdmin } from "@/utils/auth";
  66. export default {
  67. mixins: [resToken],
  68. components: {
  69. // "van-cell": cell,
  70. // "van-list": List,
  71. // "van-tab": Tab,
  72. // "van-tabs": Tabs,
  73. },
  74. data() {
  75. return {
  76. admin: "",
  77. id: "0",
  78. status: "0",
  79. options: [
  80. { value: "0", label: "未发货" },
  81. { value: "1", label: "暂无记录" },
  82. { value: "2", label: "在途中" },
  83. { value: "3", label: "派送中" },
  84. { value: "4", label: "已签收" },
  85. { value: "5", label: "用户拒签" },
  86. { value: "6", label: "疑难件" },
  87. { value: "7", label: "无效单" },
  88. { value: "8", label: "超时单" },
  89. { value: "9", label: "签收失败" },
  90. { value: "10", label: "退回" },
  91. ],
  92. list1: [
  93. { title: "订单编号:", value: "" },
  94. { title: "订单状态:", value: "" },
  95. { title: "下单时间:", value: "" },
  96. ],
  97. list2: [
  98. { title: "物流公司:", value: "" },
  99. { title: "物流编号:", value: "" },
  100. { title: "发货时间:", value: "" },
  101. ],
  102. list3: [
  103. { title: "联系人:", value: "" },
  104. { title: "联系电话:", value: "" },
  105. { title: "收货地址:", value: "" },
  106. ],
  107. list4: [
  108. { title: "商品名称:", value: "五常大米" },
  109. { title: "购买数量:", value: "" },
  110. ],
  111. list5: [
  112. { title: "物流状态:", value: "" },
  113. { title: "更新时间:", value: "" },
  114. ],
  115. context: "",
  116. loading: false,
  117. };
  118. },
  119. async created() {
  120. this.id = this.$route.query.id ? this.$route.query.id : "0";
  121. this.admin = getAdmin();
  122. await this.initData();
  123. },
  124. methods: {
  125. onClickLeft() {
  126. window.history.back(-1);
  127. },
  128. async initData() {
  129. const res = await asyncRequest.detail({ id: this.id });
  130. if (res && res.code === 0) {
  131. const {
  132. order_sn,
  133. status,
  134. unit,
  135. order_num,
  136. order_time,
  137. post_name,
  138. post_code,
  139. delivery_time,
  140. contector,
  141. contector_mobile,
  142. city_name,
  143. provice_name,
  144. area_name,
  145. addr,
  146. unit_weight,
  147. } = res.data;
  148. this.list1[0].value = order_sn;
  149. this.list1[1].value = status === "1" ? "待发货" : "待收货";
  150. this.status = status;
  151. this.list4[0].value =
  152. this.admin === "1" ? "红运稻2Kgx2" : this.admin === "2" ? "悦享泰康2.5Kgx1" : "";
  153. this.list4[1].value = order_num + "份";
  154. this.list1[2].value = order_time;
  155. if (this.status === "2") {
  156. this.list2[0].value = post_name;
  157. this.list2[1].value = post_code;
  158. this.list2[2].value = delivery_time;
  159. }
  160. this.list3[0].value = contector;
  161. this.list3[1].value = contector_mobile;
  162. let str =
  163. provice_name === city_name ? city_name : provice_name + city_name;
  164. this.list3[2].value = str + area_name + addr;
  165. if (status == "2") {
  166. await this.getLastPost(order_sn);
  167. }
  168. } else if (res && res.code >= 100 && res.code <= 104) {
  169. await this.logout();
  170. } else {
  171. this.show_title(res.msg);
  172. }
  173. },
  174. async getLastPost(order_sn) {
  175. const res = await asyncRequest.express({ order_sn: order_sn });
  176. if (res && res.code === 0) {
  177. const { last_data, status_cn, addtime } = res.data;
  178. const { context, time } = last_data;
  179. this.list5[0].value = status_cn;
  180. this.list5[1].value = time || addtime;
  181. this.context = context || "";
  182. console.log(res.data);
  183. } else if (res && res.code >= 100 && res.code <= 104) {
  184. await this.logout();
  185. } else {
  186. this.show_title(res.msg);
  187. }
  188. },
  189. },
  190. };
  191. </script>
  192. <style lang="scss" scoped>
  193. .oDetail {
  194. // background: #fff;
  195. background: transparent;
  196. overflow-y: scroll;
  197. .page-main {
  198. box-sizing: border-box;
  199. overflow-y: scroll;
  200. width: 100%;
  201. height: auto;
  202. // background: #fff;
  203. background: transparent;
  204. padding: 46px 0 50px 0;
  205. border: 0 !important;
  206. .context {
  207. box-sizing: border-box;
  208. padding: 7px 16px 12px 16px;
  209. font-size: 12px;
  210. color: rgb(150, 151, 153);
  211. word-break: break-all;
  212. }
  213. .jiange {
  214. height: 5px;
  215. // width: 100%;
  216. background: #f0f0f0 !important;
  217. width: calc(100% -32px);
  218. margin: 3px 16px 0 16px;
  219. }
  220. .van-cell::after {
  221. border: 0px !important;
  222. box-sizing: 0 !important;
  223. border: 0 !important;
  224. }
  225. .van-cell-group__title {
  226. font-weight: bolder;
  227. color: #333;
  228. box-sizing: 0 !important;
  229. border: 0 !important;
  230. }
  231. .van-cell {
  232. font-size: 12px;
  233. background: transparent !important;
  234. color: #787878;
  235. padding: 7px 16px 0px 16px;
  236. box-sizing: 0 !important;
  237. border: 0 !important;
  238. &:last-child {
  239. padding-bottom: 7px !important;
  240. box-sizing: 0 !important;
  241. border: 0 !important;
  242. }
  243. }
  244. .van-cell-group {
  245. background: transparent !important;
  246. box-sizing: 0 !important;
  247. border: 0 !important;
  248. }
  249. .van-hairline--top-bottom::after,
  250. .van-hairline-unset--top-bottom::after {
  251. border: 0 !important;
  252. }
  253. }
  254. }
  255. </style>