detail_orderDetail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  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. <el-col>
  15. <p>{{ address.name }},{{ address.phone }}</p>
  16. </el-col>
  17. <el-col>
  18. <p>{{ address.province }} , {{ address.city }} , {{ address.area }} , {{ address.address }}</p>
  19. </el-col>
  20. </el-col>
  21. </el-col>
  22. <el-col :span="24" class="shop"> <i class="el-icon-s-shop"></i>{{ shop.name }}</el-col>
  23. <el-col :span="24" v-for="(item, index) in list" :key="index">
  24. <el-col :span="24" class="goods bode">
  25. <el-col :span="6"><el-image :src="item.goods.file[0].url"></el-image></el-col>
  26. <el-col :span="18">
  27. <el-col :span="12">
  28. <el-col>
  29. <p>{{ item.goods.name }}</p>
  30. </el-col>
  31. <el-col>
  32. <p>规格:{{ item.name }}</p>
  33. </el-col>
  34. </el-col>
  35. <el-col :span="12" class="money">
  36. <el-col>
  37. <p v-if="form.type == '0'">¥{{ item.sell_money }}</p>
  38. <p v-else-if="form.type == '1'">¥{{ item.group_config.money }}</p>
  39. </el-col>
  40. <el-col>
  41. <p>X{{ item.buy_num }}</p>
  42. </el-col>
  43. <el-col>
  44. <span class="spanfour" style="color: blue" @click="toUrl(item.goods.url)"> 查看商品来源:{{ item.goods.source }}</span>
  45. </el-col>
  46. <el-col>
  47. <p>{{ item.is_afterSale == true ? '已申请售后' : '未申请售后' }}</p>
  48. </el-col>
  49. <el-col>
  50. <p>{{ item.is_rate == true ? '已评价' : '未评价' }}</p>
  51. </el-col>
  52. </el-col>
  53. </el-col>
  54. </el-col>
  55. <el-col :span="24" class="bode">
  56. <el-col :span="6">运费</el-col>
  57. <el-col :span="18" class="other" v-if="!item.goods.freight == '0'">{{ item.goods.freight }}</el-col>
  58. <el-col :span="18" class="other" v-else>包邮</el-col>
  59. </el-col>
  60. <!-- <el-col :span="24" class="bode">
  61. <el-col :span="6">查看商品来源:</el-col>
  62. <el-col :span="18" class="other">{{ item.goods.source || '暂无来源' }}</el-col>
  63. </el-col>
  64. <el-col :span="24" class="bode">
  65. <el-col :span="6">网址:</el-col>
  66. <el-col :span="18" class="other">
  67. <span class="spanfour" @click="toUrl(goods.goods.url)"> {{ goods.goods.url || '暂无网址' }} </span>
  68. </el-col>
  69. </el-col> -->
  70. </el-col>
  71. <el-col :span="24" class="bode">
  72. <el-col :span="6">订单备注</el-col>
  73. <el-col :span="18" class="other" v-if="form.remarks">{{ form.remarks }}</el-col>
  74. <el-col :span="18" class="other" v-else>暂无备注</el-col>
  75. </el-col>
  76. <el-col :span="24" class="bode">
  77. <el-col :span="6">配送方式</el-col>
  78. <el-col :span="18" class="other">快递配送</el-col>
  79. </el-col>
  80. <el-col :span="24" class="goods_total bode">
  81. <el-col :span="6">快递费</el-col>
  82. <el-col :span="18" class="other">
  83. <p>¥{{ total_detail.freight_total }}</p>
  84. </el-col>
  85. </el-col>
  86. <el-col :span="24" class="goods_total bode">
  87. <el-col :span="8">优惠后实付金额</el-col>
  88. <el-col :span="16" class="other">
  89. <p>¥{{ pay.pay_money }}</p>
  90. </el-col>
  91. </el-col>
  92. <el-col :span="24" class="bode">
  93. <el-col :span="6">下单时间</el-col>
  94. <el-col :span="18" class="other">{{ form.buy_time }}</el-col>
  95. </el-col>
  96. <el-col :span="24" class="bode">
  97. <el-col :span="6">支付时间</el-col>
  98. <el-col :span="18" class="other">{{ form.pay_time }}</el-col>
  99. </el-col>
  100. <el-col :span="24" class="bode" v-if="form.status == '3'">
  101. <el-col :span="6">寄出运单号</el-col>
  102. <el-col :span="18" class="other">{{ transport.shop_transport_no || '暂无单号' }}</el-col>
  103. </el-col>
  104. <el-col :span="24" class="bode" v-if="form.status == '3'">
  105. <el-col :span="6">寄出快递类型</el-col>
  106. <el-col :span="18" class="other">{{ transport.shop_transport_name || '暂无快递信息' }}</el-col>
  107. </el-col>
  108. <el-col :span="24" class="form" v-if="form.status == '1' || form.status == '2'">
  109. <el-form :model="form" ref="form" :rules="rules" label-width="100px" class="demo-ruleForm">
  110. <el-form-item label="寄出运单号" prop="shop_transport_no">
  111. <el-input v-model="form.shop_transport_no" placeholder="请输入运单号,快递类型,同时填入" size="small"></el-input>
  112. </el-form-item>
  113. <el-form-item label="快递类型" prop="shop_transport_type">
  114. <el-select
  115. v-model="form.shop_transport_type"
  116. filterable
  117. remote
  118. reserve-keyword
  119. placeholder="请选择快递类型,运单号,同时填入"
  120. :remote-method="querySearch"
  121. :loading="loading"
  122. @change="handleSelect"
  123. size="small"
  124. style="width: 100%"
  125. >
  126. <el-option v-for="item in shop_transport_typeList" :key="item.id" :label="item.label" :value="item.value"> </el-option>
  127. </el-select>
  128. </el-form-item>
  129. <el-form-item>
  130. <el-col>
  131. <el-button type="primary" @click="onSubmit('form', '2')" v-if="form.status == '1'"> 发货 </el-button>
  132. <el-button type="primary" @click="onSubmit('form', '3')" v-if="form.status == '2'"> 确认收货 </el-button>
  133. </el-col>
  134. </el-form-item>
  135. </el-form>
  136. </el-col>
  137. </el-col>
  138. <el-col :span="9" class="one" v-if="transport.shop_transport_no">
  139. <el-col :span="24">{{ activit.is_check || '暂无快递信息' }}</el-col>
  140. <el-col :span="24">{{ transport.shop_transport_name || '暂无快递信息' }}: {{ activit.no || '暂无快递信息' }}</el-col>
  141. <el-col :span="24">
  142. <p>订单编号: {{ form.id }}</p>
  143. </el-col>
  144. <el-col :span="24">
  145. <p>收货地址:{{ address.province }} , {{ address.city }} , {{ address.area }} , {{ address.address }}</p>
  146. </el-col>
  147. <el-col :span="24">
  148. <el-timeline :reverse="reverse">
  149. <el-timeline-item v-for="(activity, index) in activities" :key="index" :timestamp="activity.time" :color="activity.color">
  150. {{ activity.context }}
  151. </el-timeline-item>
  152. </el-timeline>
  153. </el-col>
  154. </el-col>
  155. </el-col>
  156. </el-row>
  157. </div>
  158. </template>
  159. <script>
  160. const _ = require('lodash');
  161. const moment = require('moment');
  162. import { mapState, mapGetters, createNamespacedHelpers } from 'vuex';
  163. const { mapActions } = createNamespacedHelpers('orderDetail');
  164. const { mapActions: dictData } = createNamespacedHelpers('dictData');
  165. const { mapActions: sot } = createNamespacedHelpers('sot');
  166. export default {
  167. name: 'form-1',
  168. props: {},
  169. components: {},
  170. data: function () {
  171. return {
  172. form: {},
  173. // 地址
  174. address: {},
  175. // 实付金额
  176. total_detail: {},
  177. // 商铺
  178. shop: {},
  179. // 运单号
  180. transport: {},
  181. pay: {},
  182. // 商品列表
  183. list: [],
  184. // 物流
  185. reverse: false,
  186. activities: [],
  187. activit: {},
  188. // 订单状态
  189. order_processList: [],
  190. // 快递类型
  191. shop_transport_typeList: [],
  192. loading: false,
  193. rules: {
  194. shop_transport_no: [{ required: true, message: '请输入快递单号', trigger: 'blur' }],
  195. shop_transport_type: [{ required: true, message: '请选择快递类型', trigger: 'change' }],
  196. },
  197. };
  198. },
  199. async created() {
  200. await this.searchOther();
  201. await this.search();
  202. },
  203. methods: {
  204. ...dictData({ dictQuery: 'query' }),
  205. ...sot({ sotFetch: 'fetch' }),
  206. ...mapActions(['query', 'fetch', 'create', 'update']),
  207. // 查询
  208. async search() {
  209. let res;
  210. res = await this.fetch(this.id);
  211. if (this.$checkRes(res)) {
  212. this.$set(this, `form`, res.data);
  213. // 地址
  214. this.$set(this, `address`, res.data.address);
  215. this.$set(this, `shop`, res.data.shop);
  216. // 商品
  217. this.$set(this, `list`, res.data.goods);
  218. // 应付金额
  219. this.$set(this, `total_detail`, res.data.total_detail);
  220. this.$set(this, `pay`, res.data.order.pay);
  221. if (res.data.transport) {
  222. let arr = await this.dictQuery({ code: 'transport_type', value: res.data.transport.shop_transport_type });
  223. if (this.$checkRes(arr)) {
  224. let type = arr.data.find((i) => i.value == res.data.transport.shop_transport_type);
  225. if (type) {
  226. res.data.transport.shop_transport_name = type.label;
  227. this.querySearch(type.label);
  228. }
  229. this.$set(this, `transport`, res.data.transport);
  230. this.$set(this.form, `shop_transport_type`, this.transport.shop_transport_type);
  231. this.$set(this.form, `shop_transport_no`, this.transport.shop_transport_no);
  232. }
  233. res = await this.sotFetch(this.id);
  234. if (this.$checkRes(res)) {
  235. if (res.errcode == '0') {
  236. let activities = res.data.list;
  237. activities[0].color = '#0bbd87';
  238. this.$set(this, `activities`, activities);
  239. this.$set(this, `activit`, res.data);
  240. }
  241. }
  242. }
  243. }
  244. },
  245. async querySearch(value) {
  246. this.loading = true;
  247. let res = await this.dictQuery({ code: 'transport_type', label: value });
  248. if (this.$checkRes(res)) {
  249. this.$set(this, 'shop_transport_typeList', res.data);
  250. }
  251. this.loading = false;
  252. },
  253. toUrl(url) {
  254. console.log(url);
  255. if (url) {
  256. window.open(url, '_blank');
  257. } else {
  258. this.$message.error('该商品还未添加网址,无法跳转');
  259. }
  260. },
  261. handleSelect(value) {},
  262. // 提交
  263. async onSubmit(formName, val) {
  264. this.$refs[formName].validate(async (valid) => {
  265. if (valid) {
  266. this.$confirm('是否确认保存', '提示', {
  267. confirmButtonText: '确定',
  268. cancelButtonText: '取消',
  269. type: 'warning',
  270. }).then(async () => {
  271. let form = this.form;
  272. let transport = {};
  273. let res;
  274. if (form.shop_transport_no) transport.shop_transport_no = form.shop_transport_no;
  275. if (form.shop_transport_type) transport.shop_transport_type = form.shop_transport_type;
  276. form.transport = transport;
  277. form.status = val;
  278. if (form.id) res = await this.update(form);
  279. if (this.$checkRes(res)) {
  280. this.$message({ type: `success`, message: `维护信息成功` });
  281. this.search();
  282. }
  283. });
  284. } else {
  285. console.log('error submit!!');
  286. return false;
  287. }
  288. });
  289. },
  290. // 返回
  291. toBack() {
  292. window.history.go('-1');
  293. },
  294. // 查询其他信息
  295. async searchOther() {
  296. let res;
  297. // 减免方式
  298. res = await this.dictQuery({ code: 'order_process' });
  299. if (this.$checkRes(res)) {
  300. this.$set(this, `order_processList`, res.data);
  301. }
  302. },
  303. },
  304. computed: {
  305. id() {
  306. return this.$route.query.id;
  307. },
  308. },
  309. metaform() {
  310. return { title: this.$route.meta.title };
  311. },
  312. watch: {
  313. test: {
  314. deep: true,
  315. immediate: true,
  316. handler(val) {},
  317. },
  318. },
  319. };
  320. </script>
  321. <style lang="less" scoped>
  322. .main {
  323. .one {
  324. margin: 10px 0 0 5%;
  325. padding: 5px;
  326. .add {
  327. border-bottom: 2px dashed #ccc;
  328. margin: 0 0 5px 0;
  329. padding: 5px 0;
  330. }
  331. .shop {
  332. padding: 4px 0;
  333. font-size: 18px;
  334. border-bottom: 1px solid #ccc;
  335. }
  336. .goods {
  337. padding: 10px 0;
  338. .money {
  339. text-align: right;
  340. }
  341. }
  342. .other {
  343. text-align: right;
  344. word-break: break-all;
  345. p {
  346. color: red;
  347. }
  348. .spanfour {
  349. color: blue;
  350. }
  351. }
  352. .el-col {
  353. margin: 3px 0;
  354. }
  355. .bode {
  356. border-bottom: 1px solid rgb(238, 237, 237);
  357. }
  358. .form {
  359. margin: 20px 0 0 0;
  360. }
  361. }
  362. }
  363. /deep/.el-timeline {
  364. margin: 20px 0 0 0;
  365. font-size: 16px;
  366. }
  367. /deep/.el-timeline-item__node:nth-child(1) {
  368. background-color: green;
  369. }
  370. </style>