detail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <template>
  2. <div id="form-1">
  3. <el-row>
  4. <el-col
  5. :span="24"
  6. class="main animate__animated animate__backInRight"
  7. v-loading="loading"
  8. element-loading-text="拼命加载中"
  9. element-loading-spinner="el-icon-loading"
  10. >
  11. <el-col class="top-btn">
  12. <el-button type="primary" size="mini" @click="toBack()">返回</el-button>
  13. </el-col>
  14. <el-col :span="8" class="one">
  15. <el-col :span="24" class="shop"> <i class="el-icon-s-shop"></i>{{ shop.name }}</el-col>
  16. <el-col v-if="info.type == '1' || info.type == '2' || info.type == '3'">
  17. <el-col :span="24" class="goods">
  18. <el-col :span="6"><el-image :src="file"></el-image></el-col>
  19. <el-col :span="18">
  20. <el-col :span="12">
  21. <p>{{ goods.name }}</p>
  22. <p>规格:{{ good.name }}</p>
  23. </el-col>
  24. <el-col :span="12" class="money">
  25. <p>¥{{ good.sell_money }}</p>
  26. <p>X{{ good.buy_num }}</p>
  27. </el-col>
  28. </el-col>
  29. </el-col>
  30. </el-col>
  31. <el-col v-if="info.type == '4' || info.type == '5'">
  32. <el-col :span="24" v-for="(item, index) in list" :key="index">
  33. <el-col :span="24" class="goods bode">
  34. <el-col :span="6"><el-image :src="item.goods.file[0].url"></el-image></el-col>
  35. <el-col :span="18">
  36. <el-col :span="12">
  37. <el-col>
  38. <p>{{ item.goods.name }}</p>
  39. </el-col>
  40. <el-col>
  41. <p>规格:{{ item.name }}</p>
  42. </el-col>
  43. </el-col>
  44. <el-col :span="12" class="money">
  45. <el-col>
  46. <p>¥{{ item.sell_money }}</p>
  47. </el-col>
  48. <el-col>
  49. <p>X{{ item.buy_num }}</p>
  50. </el-col>
  51. </el-col>
  52. </el-col>
  53. </el-col>
  54. <el-col :span="24" class="bode">
  55. <el-col :span="6">运费</el-col>
  56. <el-col :span="18" class="other" v-if="!item.goods.freight == '0'">{{ item.goods.freight }}</el-col>
  57. <el-col :span="18" class="other" v-else>包邮</el-col>
  58. </el-col>
  59. </el-col>
  60. </el-col>
  61. <el-col :span="24">
  62. <el-col :span="6">申请时间</el-col>
  63. <el-col :span="18" class="other">{{ info.apply_time }}</el-col>
  64. </el-col>
  65. <el-col :span="24">
  66. <el-col :span="6">结束时间</el-col>
  67. <el-col :span="18" class="other">{{ info.end_time || '暂无' }}</el-col>
  68. </el-col>
  69. <el-col :span="24">
  70. <el-col :span="6">售后类型</el-col>
  71. <el-col :span="18" class="other">{{ info.zhType }}</el-col>
  72. </el-col>
  73. <el-col :span="24" v-if="info.type == '1' || info.type == '2' || info.type == '4' || info.type == '5'">
  74. <el-col :span="6">退款金额</el-col>
  75. <el-col :span="18" class="other">{{ info.money || '' }}</el-col>
  76. </el-col>
  77. <el-col :span="24">
  78. <el-col :span="6">售后状态</el-col>
  79. <el-col :span="18" class="other">{{ info.zhStatus }}</el-col>
  80. </el-col>
  81. <el-col :span="24" v-if="info.type == '2' || info.type == '3'">
  82. <el-col :span="6">退回运单号</el-col>
  83. <el-col :span="18" class="other">{{ transport.customer_transport_no || '暂无单号' }}</el-col>
  84. </el-col>
  85. <el-col :span="24" v-if="info.type == '3'">
  86. <el-col :span="6">寄出运单号</el-col>
  87. <el-col :span="18" class="other">{{ transport.shop_transport_no || '暂无单号' }}</el-col>
  88. </el-col>
  89. <el-col :span="24" v-if="info.type == '1' || info.type == '2' || info.type == '3'">
  90. <el-col :span="6">售后描述</el-col>
  91. <el-col :span="18" class="other">{{ info.desc }}</el-col>
  92. </el-col>
  93. </el-col>
  94. <el-col :span="12" class="two">
  95. <steps-1 v-if="info.type == '1'" @exam="exam" :active="active" :form="form" :info="info"></steps-1>
  96. <steps-2 v-if="info.type == '2'" @exam="exam" :active="active" :customer="customer" :activit="activit" :form="form" :info="info"></steps-2>
  97. <steps-3
  98. v-if="info.type == '3'"
  99. @exam="exam"
  100. :active="active"
  101. @onSubmit="onSubmit"
  102. :form="form"
  103. :shop_transport_typeList="shop_transport_typeList"
  104. :activit="activit"
  105. @querySearch="querySearch"
  106. :customer="customer"
  107. :shopList="shopList"
  108. :transport="transport"
  109. ></steps-3>
  110. <steps-4 v-if="info.type == '4'" @exam="exam" :active="active"></steps-4>
  111. <steps-5 v-if="info.type == '5'" @exam="exam" :active="active"></steps-5>
  112. </el-col>
  113. </el-col>
  114. </el-row>
  115. </div>
  116. </template>
  117. <script>
  118. const _ = require('lodash');
  119. const moment = require('moment');
  120. import { mapState, mapGetters, createNamespacedHelpers } from 'vuex';
  121. const { mapActions } = createNamespacedHelpers('afterSale');
  122. const { mapActions: dictData } = createNamespacedHelpers('dictData');
  123. const { mapActions: sot } = createNamespacedHelpers('sot');
  124. const { mapActions: getTransportInfo } = createNamespacedHelpers('getTransportInfo');
  125. export default {
  126. name: 'form-1',
  127. props: {},
  128. components: {
  129. steps1: () => import('./parts/steps-1.vue'),
  130. steps2: () => import('./parts/steps-2.vue'),
  131. steps3: () => import('./parts/steps-3.vue'),
  132. steps4: () => import('./parts/steps-4.vue'),
  133. steps5: () => import('./parts/steps-5.vue'),
  134. },
  135. data: function () {
  136. return {
  137. // 商品
  138. shop: {},
  139. // 状态4,5商品
  140. list: [],
  141. // 图片
  142. file: '',
  143. // 商品
  144. goods: {},
  145. // 规格
  146. good: {},
  147. transport: {},
  148. typeList: [],
  149. statusList: [],
  150. status: [],
  151. form: {},
  152. info: {},
  153. // 物流
  154. shop_transport_typeList: [],
  155. customer: [],
  156. shopList: [],
  157. activit: {},
  158. active: 1,
  159. loading: true,
  160. };
  161. },
  162. async created() {
  163. await this.searchOther();
  164. await this.search();
  165. },
  166. methods: {
  167. ...sot({ sotFetch: 'fetch' }),
  168. ...dictData({ dictQuery: 'query' }),
  169. ...getTransportInfo({ getFetch: 'fetch' }),
  170. ...mapActions(['fetch', 'create', 'update']),
  171. // 查询
  172. async search() {
  173. let res = await this.fetch(this.id);
  174. if (this.$checkRes(res)) {
  175. let type = this.typeList.find((i) => i.value == res.data.type);
  176. if (type) res.data.zhType = type.label;
  177. let status = this.statusList.find((i) => i.value == res.data.status);
  178. if (status) res.data.zhStatus = status.label;
  179. this.$set(this, `info`, res.data);
  180. this.$set(this, `shop`, res.data.shop);
  181. if (res.data.type == '4' || res.data.type == '5') {
  182. // 商品
  183. this.$set(this, `list`, res.data.order_detail.goods);
  184. } else if (res.data.type == '1' || res.data.type == '2' || res.data.type == '3') {
  185. if (res.data.transport) this.$set(this, `transport`, res.data.transport);
  186. // 图片
  187. this.$set(this, `file`, res.data.goods.goods.file[0].url);
  188. // 商品
  189. this.$set(this, `goods`, res.data.goods.goods);
  190. // 规格
  191. this.$set(this, `good`, res.data.goods);
  192. }
  193. // 仅退款
  194. if (res.data.status == '-1') this.$set(this, `active`, 3);
  195. else if (res.data.status == '!1') this.$set(this, `active`, 4);
  196. // 退货
  197. else if (res.data.status == '2') this.$set(this, `active`, 2);
  198. else if (res.data.status == '-2') this.$set(this, `active`, 4);
  199. else if (res.data.status == '!2') this.$set(this, `active`, 5);
  200. // 换货
  201. else if (res.data.status == '3') this.$set(this, `active`, 2);
  202. else if (res.data.status == '-3') this.$set(this, `active`, 6);
  203. else if (res.data.status == '!3') this.$set(this, `active`, 7);
  204. // 取消订单
  205. else if (res.data.status == '-4') this.$set(this, `active`, 3);
  206. else if (res.data.status == '!4') this.$set(this, `active`, 4);
  207. // 拒收
  208. else if (res.data.status == '5') this.$set(this, `active`, 3);
  209. else if (res.data.status == '!5') this.$set(this, `active`, 5);
  210. else if (res.data.status == '-5') this.$set(this, `active`, 4);
  211. // 查询物流
  212. if (res.data.transport) {
  213. // 快递数据回显
  214. let arr = await this.dictQuery({ code: 'transport_type', value: res.data.transport.shop_transport_type });
  215. if (this.$checkRes(arr)) {
  216. let type = arr.data.find((i) => i.value == res.data.transport.shop_transport_type);
  217. if (type) {
  218. res.data.transport.shop_transport_name = type.label;
  219. this.querySearch(type.label);
  220. }
  221. this.$set(this, `transport`, res.data.transport);
  222. this.$set(this.form, `shop_transport_type`, this.transport.shop_transport_type);
  223. this.$set(this.form, `shop_transport_no`, this.transport.shop_transport_no);
  224. }
  225. // 显示物流
  226. res = await this.getFetch(this.id);
  227. if (this.$checkRes(res)) {
  228. if (res.errcode == '0') {
  229. if (res.data.customer) {
  230. let customer = res.data.customer.list;
  231. this.$set(this, `customer`, customer);
  232. customer[0].color = '#0bbd87';
  233. if (res.data.customer.is_check == '已签收' && this.info.status == '3') this.$set(this, `active`, 3);
  234. }
  235. if (res.data.shop) {
  236. let shopList = res.data.shop.list;
  237. this.$set(this, `shopList`, shopList);
  238. shopList[0].color = '#0bbd87';
  239. if (res.data.shop.is_check == '已签收' && this.info.status == '3') this.$set(this, `active`, 5);
  240. }
  241. this.$set(this, `activit`, res.data);
  242. }
  243. }
  244. }
  245. this.loading = false;
  246. }
  247. },
  248. async exam(status, form) {
  249. let info = this.info;
  250. info.status = status;
  251. if (status == '-2' && info.transport) info.transport.shop_receive = true;
  252. else if (status == '-2' && !info.transport) {
  253. let transport = {};
  254. transport.shop_receive = true;
  255. info.transport = transport;
  256. }
  257. if (status == '-3' && info.transport) info.transport.customer_receive = true;
  258. else if (status == '-3' && !info.transport) {
  259. let transport = {};
  260. transport.customer_receive = true;
  261. info.transport = transport;
  262. }
  263. if (form != undefined && form.money != undefined && (status == '2' || status == '1')) info.money = form.money;
  264. let res;
  265. this.$confirm('是否确认修改售后状态', '提示', {
  266. confirmButtonText: '确定',
  267. cancelButtonText: '取消',
  268. type: 'warning',
  269. }).then(async () => {
  270. if (info.id) res = await this.update(info);
  271. if (this.$checkRes(res)) {
  272. this.$message({ type: `success`, message: `维护信息成功` });
  273. this.search();
  274. }
  275. });
  276. },
  277. async querySearch(value) {
  278. let res = await this.dictQuery({ code: 'transport_type', label: value });
  279. if (this.$checkRes(res)) {
  280. this.$set(this, 'shop_transport_typeList', res.data);
  281. }
  282. },
  283. async onSubmit(val) {
  284. let info = this.info;
  285. let res;
  286. if (info.transport) {
  287. info.transport = { ...info.transport, shop_transport_no: val.shop_transport_no, shop_transport_type: val.shop_transport_type, shop_receive: true };
  288. } else {
  289. let transport = { shop_transport_no: val.shop_transport_no, shop_transport_type: val.shop_transport_type, shop_receive: true };
  290. info.transport = transport;
  291. }
  292. if (info.id) res = await this.update(info);
  293. if (this.$checkRes(res)) {
  294. this.$message({ type: `success`, message: `维护信息成功` });
  295. this.search();
  296. }
  297. },
  298. // 查询其他信息
  299. async searchOther() {
  300. let res;
  301. // 类型
  302. res = await this.dictQuery({ code: 'afterSale_type' });
  303. if (this.$checkRes(res)) {
  304. this.$set(this, `typeList`, res.data);
  305. }
  306. res = await this.dictQuery({ code: 'afterSale_status' });
  307. if (this.$checkRes(res)) {
  308. this.$set(this, `statusList`, res.data);
  309. }
  310. },
  311. // 返回
  312. toBack() {
  313. window.history.go('-1');
  314. },
  315. },
  316. computed: {
  317. id() {
  318. return this.$route.query.id;
  319. },
  320. },
  321. metaform() {
  322. return { title: this.$route.meta.title };
  323. },
  324. watch: {
  325. test: {
  326. deep: true,
  327. immediate: true,
  328. handler(val) {},
  329. },
  330. },
  331. };
  332. </script>
  333. <style lang="less" scoped>
  334. .main {
  335. .one {
  336. font-size: 20px;
  337. margin: 10px 4% 0 8%;
  338. padding: 5px;
  339. .add {
  340. border-bottom: 2px dashed #ccc;
  341. margin: 0 0 5px 0;
  342. padding: 5px 0;
  343. }
  344. .shop {
  345. padding: 4px 0;
  346. font-size: 22px;
  347. border-bottom: 1px solid #ccc;
  348. }
  349. .goods {
  350. padding: 10px 0;
  351. .money {
  352. text-align: right;
  353. }
  354. }
  355. .other {
  356. text-align: right;
  357. p {
  358. color: red;
  359. }
  360. }
  361. .el-col {
  362. margin: 4px 0;
  363. }
  364. }
  365. .two {
  366. margin: 0 0 0 20px;
  367. }
  368. }
  369. </style>