detail_orderDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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="9" 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" class="shop"> <i class="el-icon-s-shop"></i>{{ shop.name }}</el-col>
  19. <el-col :span="24" v-for="(item, index) in list" :key="index">
  20. <el-col :span="24" class="goods">
  21. <el-col :span="6"><el-image :src="item.goods.file[0].url"></el-image></el-col>
  22. <el-col :span="18">
  23. <el-col :span="12">
  24. <p>{{ item.goods.name }}</p>
  25. <p>规格:{{ item.name }}</p>
  26. </el-col>
  27. <el-col :span="12" class="money">
  28. <p v-if="form.type == '0'">¥{{ item.sell_money }}</p>
  29. <p v-else-if="form.type == '1'">¥{{ item.group_config.money }}</p>
  30. <p>X{{ item.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="!item.goods.freight == '0'">{{ item.goods.freight }}</el-col>
  37. <el-col :span="18" class="other" v-else>包邮</el-col>
  38. </el-col>
  39. </el-col>
  40. <el-col :span="24">
  41. <el-col :span="6">订单备注</el-col>
  42. <el-col :span="18" class="other" v-if="form.remarks">{{ form.remarks }}</el-col>
  43. <el-col :span="18" class="other" v-else>暂无备注</el-col>
  44. </el-col>
  45. <el-col :span="24">
  46. <el-col :span="6">配送方式</el-col>
  47. <el-col :span="18" class="other">快递配送</el-col>
  48. </el-col>
  49. <el-col :span="24" class="goods_total">
  50. <el-col :span="6">商品金额</el-col>
  51. <el-col :span="18" class="other">
  52. <p>¥{{ total_detail.goods_total }}</p>
  53. </el-col>
  54. </el-col>
  55. <el-col :span="24" class="goods_total">
  56. <el-col :span="6">快递费</el-col>
  57. <el-col :span="18" class="other">
  58. <p>¥{{ total_detail.freight_total }}</p>
  59. </el-col>
  60. </el-col>
  61. <el-col :span="24" class="goods_total">
  62. <el-col :span="8">优惠后实付金额</el-col>
  63. <el-col :span="16" class="other">
  64. <p>¥{{ pay.pay_money }}</p>
  65. </el-col>
  66. </el-col>
  67. <el-col :span="24">
  68. <el-col :span="6">下单时间</el-col>
  69. <el-col :span="18" class="other">{{ form.buy_time }}</el-col>
  70. </el-col>
  71. <el-col :span="24">
  72. <el-col :span="6">支付时间</el-col>
  73. <el-col :span="18" class="other">{{ form.pay_time }}</el-col>
  74. </el-col>
  75. <el-col :span="24">
  76. <el-col :span="6">寄出运单号</el-col>
  77. <el-col :span="18" class="other">{{ transport.shop_transport_no || '暂无单号' }}</el-col>
  78. </el-col>
  79. <el-col :span="24">
  80. <el-col :span="6">寄出快递类型</el-col>
  81. <el-col :span="18" class="other">{{ transport.shop_transport_name || '暂无快递信息' }}</el-col>
  82. </el-col>
  83. <el-col :span="24">
  84. <el-form :model="form" ref="form" label-width="100px" class="demo-ruleForm">
  85. <el-form-item
  86. label="寄出运单号"
  87. prop="shop_transport_no"
  88. v-if="(form.status == '1' || form.status == '2') && (!transport.shop_transport_no || !transport.shop_transport_name)"
  89. >
  90. <el-input v-model="form.shop_transport_no" placeholder="请输入运单号,快递类型,同时填入" size="small"></el-input>
  91. </el-form-item>
  92. <el-form-item
  93. label="快递类型"
  94. prop="shop_transport_type"
  95. v-if="(form.status == '1' || form.status == '2') && (!transport.shop_transport_no || !transport.shop_transport_name)"
  96. >
  97. <el-select
  98. v-model="form.shop_transport_type"
  99. clearable
  100. filterable
  101. placeholder="请选择快递类型,运单号,同时填入"
  102. size="small"
  103. style="width: 100%"
  104. >
  105. <el-option v-for="i in shop_transport_typeList" :key="i._id" :label="i.label" :value="i.value"> </el-option>
  106. </el-select>
  107. </el-form-item>
  108. <el-form-item label="订单状态" prop="status">
  109. <el-select v-model="form.status" clearable filterable placeholder="请选择订单状态" size="small" style="width: 100%">
  110. <el-option v-for="i in order_processList" :key="i.label" :label="i.label" :value="i.value"> </el-option>
  111. </el-select>
  112. </el-form-item>
  113. <el-form-item>
  114. <el-button type="primary" @click="onSubmit()">保存</el-button>
  115. </el-form-item>
  116. </el-form>
  117. </el-col>
  118. </el-col>
  119. <el-col :span="9" class="one" v-if="transport.shop_transport_no">
  120. <el-col :span="24">{{ activit.is_check || '暂无快递信息' }}</el-col>
  121. <el-col :span="24">{{ transport.shop_transport_name || '暂无快递信息' }}: {{ activit.no || '暂无快递信息' }}</el-col>
  122. <el-col :span="24">
  123. <p>订单编号:{{ form.id }}</p>
  124. <p>收货地址:{{ address.province }} , {{ address.city }} , {{ address.area }} , {{ address.address }}</p>
  125. </el-col>
  126. <el-col :span="24">
  127. <el-timeline :reverse="reverse">
  128. <el-timeline-item v-for="(activity, index) in activities" :key="index" :timestamp="activity.time" :color="activity.color">
  129. {{ activity.context }}
  130. </el-timeline-item>
  131. </el-timeline>
  132. </el-col>
  133. </el-col>
  134. </el-col>
  135. </el-row>
  136. </div>
  137. </template>
  138. <script>
  139. const _ = require('lodash');
  140. const moment = require('moment');
  141. import { mapState, mapGetters, createNamespacedHelpers } from 'vuex';
  142. const { mapActions } = createNamespacedHelpers('orderDetail');
  143. const { mapActions: dictData } = createNamespacedHelpers('dictData');
  144. const { mapActions: sot } = createNamespacedHelpers('sot');
  145. export default {
  146. name: 'form-1',
  147. props: {},
  148. components: {},
  149. data: function () {
  150. return {
  151. form: {},
  152. // 地址
  153. address: {},
  154. // 实付金额
  155. total_detail: {},
  156. // 商铺
  157. shop: {},
  158. // 运单号
  159. transport: {},
  160. pay: {},
  161. // 商品列表
  162. list: [],
  163. // 物流
  164. reverse: false,
  165. activities: [],
  166. activit: {},
  167. // 订单状态
  168. order_processList: [],
  169. // 快递类型
  170. shop_transport_typeList: [],
  171. };
  172. },
  173. async created() {
  174. await this.searchOther();
  175. await this.search();
  176. },
  177. methods: {
  178. ...dictData({ dictQuery: 'query' }),
  179. ...sot({ sotFetch: 'fetch' }),
  180. ...mapActions(['query', 'fetch', 'create', 'update']),
  181. // 查询
  182. async search() {
  183. let res;
  184. res = await this.fetch(this.id);
  185. if (this.$checkRes(res)) {
  186. this.$set(this, `form`, res.data);
  187. // 地址
  188. this.$set(this, `address`, res.data.address);
  189. this.$set(this, `shop`, res.data.shop);
  190. // 商品
  191. this.$set(this, `list`, res.data.goods);
  192. // 应付金额
  193. this.$set(this, `total_detail`, res.data.total_detail);
  194. this.$set(this, `pay`, res.data.order.pay);
  195. if (res.data.transport) {
  196. let type = this.shop_transport_typeList.find((i) => i.value == res.data.transport.shop_transport_type);
  197. if (type) res.data.transport.shop_transport_name = type.label;
  198. this.$set(this, `transport`, res.data.transport);
  199. res = await this.sotFetch(this.id);
  200. if (this.$checkRes(res)) {
  201. if (res.errcode == '0') {
  202. console.log(res);
  203. let activities = res.data.list;
  204. activities[0].color = '#0bbd87';
  205. this.$set(this, `activities`, activities);
  206. this.$set(this, `activit`, res.data);
  207. }
  208. }
  209. }
  210. }
  211. },
  212. // 提交
  213. async onSubmit() {
  214. let form = this.form;
  215. let transport = {};
  216. let res;
  217. if (form.shop_transport_no && form.shop_transport_type) {
  218. transport.shop_transport_no = form.shop_transport_no;
  219. transport.shop_transport_type = form.shop_transport_type;
  220. form.transport = transport;
  221. }
  222. if (form.id) res = await this.update(form);
  223. if (this.$checkRes(res)) {
  224. this.$message({ type: `success`, message: `维护信息成功` });
  225. this.toBack();
  226. }
  227. },
  228. // 返回
  229. toBack() {
  230. window.history.go('-1');
  231. },
  232. // 查询其他信息
  233. async searchOther() {
  234. let res;
  235. // 减免方式
  236. res = await this.dictQuery({ code: 'order_process' });
  237. if (this.$checkRes(res)) {
  238. this.$set(this, `order_processList`, res.data);
  239. }
  240. // 减免方式
  241. res = await this.dictQuery({ code: 'transport_type' });
  242. if (this.$checkRes(res)) {
  243. this.$set(this, `shop_transport_typeList`, res.data);
  244. }
  245. },
  246. },
  247. computed: {
  248. id() {
  249. return this.$route.query.id;
  250. },
  251. },
  252. metaform() {
  253. return { title: this.$route.meta.title };
  254. },
  255. watch: {
  256. test: {
  257. deep: true,
  258. immediate: true,
  259. handler(val) {},
  260. },
  261. },
  262. };
  263. </script>
  264. <style lang="less" scoped>
  265. .main {
  266. .one {
  267. margin: 10px 0 0 5%;
  268. padding: 5px;
  269. .add {
  270. border-bottom: 2px dashed #ccc;
  271. margin: 0 0 5px 0;
  272. padding: 5px 0;
  273. }
  274. .shop {
  275. padding: 4px 0;
  276. font-size: 18px;
  277. border-bottom: 1px solid #ccc;
  278. }
  279. .goods {
  280. padding: 10px 0;
  281. .money {
  282. text-align: right;
  283. }
  284. }
  285. .other {
  286. text-align: right;
  287. p {
  288. color: red;
  289. }
  290. }
  291. .el-col {
  292. margin: 4px 0;
  293. }
  294. }
  295. }
  296. /deep/.el-timeline {
  297. margin: 20px 0 0 0;
  298. font-size: 16px;
  299. }
  300. /deep/.el-timeline-item__node:nth-child(1) {
  301. background-color: green;
  302. }
  303. </style>