detail.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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="shop"> <i class="el-icon-s-shop"></i>{{ shop.name }}</el-col>
  10. <el-col :span="24" class="goods">
  11. <el-col :span="6"><el-image :src="file"></el-image></el-col>
  12. <el-col :span="18">
  13. <el-col :span="12">
  14. <p>{{ goods.name }}</p>
  15. <p>规格:{{ good.name }}</p>
  16. </el-col>
  17. <el-col :span="12" class="money">
  18. <p>¥{{ good.sell_money }}</p>
  19. <p>X{{ good.buy_num }}</p>
  20. </el-col>
  21. </el-col>
  22. </el-col>
  23. <el-col :span="24">
  24. <el-col :span="6">申请时间</el-col>
  25. <el-col :span="18" class="other">{{ info.apply_time }}</el-col>
  26. </el-col>
  27. <el-col :span="24">
  28. <el-col :span="6">结束时间</el-col>
  29. <el-col :span="18" class="other">{{ info.end_time || '暂无' }}</el-col>
  30. </el-col>
  31. <el-col :span="24">
  32. <el-col :span="6">售后类型</el-col>
  33. <el-col :span="18" class="other">{{ info.zhType }}</el-col>
  34. </el-col>
  35. <el-col :span="24">
  36. <el-col :span="6">退款金额</el-col>
  37. <el-col :span="18" class="other">{{ info.money }}</el-col>
  38. </el-col>
  39. <el-col :span="24">
  40. <el-col :span="6">售后状态</el-col>
  41. <el-col :span="18" class="other">{{ info.zhStatus }}</el-col>
  42. </el-col>
  43. <el-col :span="24" v-if="info.type == '2'">
  44. <el-col :span="6">退回运单号</el-col>
  45. <el-col :span="18" class="other">{{ transport.customer_transport_no || '暂无单号' }}</el-col>
  46. </el-col>
  47. <el-col :span="24" v-if="info.type == '2'">
  48. <el-col :span="6">寄出运单号</el-col>
  49. <el-col :span="18" class="other">{{ transport.shop_transport_no || '暂无单号' }}</el-col>
  50. </el-col>
  51. <el-col :span="24">
  52. <el-col :span="6">售后描述</el-col>
  53. <el-col :span="18" class="other">{{ info.desc }}</el-col>
  54. </el-col>
  55. <el-col :span="24">
  56. <el-form :model="form" ref="form" label-width="100px" class="demo-ruleForm">
  57. <el-form-item label="售后状态" prop="status">
  58. <el-select v-model="form.status" clearable filterable placeholder="请选择" style="width: 100%" size="small">
  59. <el-option v-for="i in status" :key="i.label" :label="i.label" :value="i.value"></el-option>
  60. </el-select>
  61. </el-form-item>
  62. <el-form-item label="寄出运单号" prop="shop_transport_no" v-if="info.type == '2' && !transport.shop_transport_no">
  63. <el-input v-model="form.shop_transport_no" placeholder="请输入运单号,快递类型,同时填入" size="small"></el-input>
  64. </el-form-item>
  65. <el-form-item label="快递类型" prop="shop_transport_type" v-if="info.type == '2' && !transport.shop_transport_no">
  66. <el-select
  67. v-model="form.shop_transport_type"
  68. clearable
  69. filterable
  70. placeholder="请选择快递类型,运单号,同时填入"
  71. size="small"
  72. style="width: 100%"
  73. >
  74. <el-option v-for="i in shop_transport_typeList" :key="i._id" :label="i.label" :value="i.value"> </el-option>
  75. </el-select>
  76. </el-form-item>
  77. <el-form-item label="售后结束时间" prop="end_time" v-if="!info.end_time">
  78. <el-date-picker v-model="form.end_time" type="datetime" placeholder="选择时间" value-format="yyyy-MM-dd HH:mm:ss"> </el-date-picker>
  79. </el-form-item>
  80. <el-form-item>
  81. <el-button type="primary" @click="onSubmit()">保存</el-button>
  82. </el-form-item>
  83. </el-form>
  84. </el-col>
  85. </el-col>
  86. </el-col>
  87. </el-row>
  88. </div>
  89. </template>
  90. <script>
  91. const _ = require('lodash');
  92. const moment = require('moment');
  93. import { mapState, mapGetters, createNamespacedHelpers } from 'vuex';
  94. const { mapActions } = createNamespacedHelpers('afterSale');
  95. const { mapActions: dictData } = createNamespacedHelpers('dictData');
  96. const { mapActions: sot } = createNamespacedHelpers('sot');
  97. export default {
  98. name: 'form-1',
  99. props: {},
  100. components: {},
  101. data: function () {
  102. return {
  103. shop: {},
  104. file: '',
  105. goods: {},
  106. good: {},
  107. transport: {},
  108. typeList: [],
  109. statusList: [],
  110. status: [],
  111. form: {},
  112. info: {},
  113. shop_transport_typeList: [],
  114. };
  115. },
  116. async created() {
  117. await this.searchOther();
  118. await this.search();
  119. },
  120. methods: {
  121. ...sot({ sotFetch: 'fetch' }),
  122. ...dictData({ dictQuery: 'query' }),
  123. ...mapActions(['fetch', 'create', 'update']),
  124. // 查询
  125. async search() {
  126. let res = await this.fetch(this.id);
  127. if (this.$checkRes(res)) {
  128. let type = this.typeList.find((i) => i.value == res.data.type);
  129. if (type) res.data.zhType = type.label;
  130. let status = this.statusList.find((i) => i.value == res.data.status);
  131. if (status) res.data.zhStatus = status.label;
  132. this.$set(this, `info`, res.data);
  133. this.$set(this, `shop`, res.data.shop);
  134. if (res.data.transport) {
  135. this.$set(this, `transport`, res.data.transport);
  136. }
  137. // 图片
  138. this.$set(this, `file`, res.data.goods.goods.file[0].url);
  139. // 商品
  140. this.$set(this, `goods`, res.data.goods.goods);
  141. // 规格
  142. this.$set(this, `good`, res.data.goods);
  143. this.getStatusList();
  144. }
  145. },
  146. async getStatusList() {
  147. let form = this.form;
  148. let e = this.statusList;
  149. let list = [];
  150. if (form.type == '0') {
  151. for (const val of e) {
  152. if (val.value == '0' || val.value == '1' || val.value == '-1') {
  153. list.push(val);
  154. }
  155. }
  156. } else if (form.type == '1') {
  157. for (const val of e) {
  158. if (val.value == '0' || val.value == '2' || val.value == '-2') {
  159. list.push(val);
  160. }
  161. }
  162. } else {
  163. for (const val of e) {
  164. if (val.value == '0' || val.value == '3' || val.value == '-3') {
  165. list.push(val);
  166. }
  167. }
  168. }
  169. this.$set(this, `status`, list);
  170. },
  171. // 提交
  172. async onSubmit() {
  173. let form = this.form;
  174. let transport = {};
  175. let res;
  176. if (form.shop_transport_no && form.shop_transport_type) {
  177. transport.shop_transport_no = form.shop_transport_no;
  178. transport.shop_transport_type = form.shop_transport_type;
  179. form.transport = transport;
  180. }
  181. if (form.id) res = await this.update(form);
  182. if (this.$checkRes(res)) {
  183. this.$message({ type: `success`, message: `维护信息成功` });
  184. this.toBack();
  185. }
  186. },
  187. // 查询其他信息
  188. async searchOther() {
  189. let res;
  190. // 类型
  191. res = await this.dictQuery({ code: 'afterSale_type' });
  192. if (this.$checkRes(res)) {
  193. this.$set(this, `typeList`, res.data);
  194. }
  195. res = await this.dictQuery({ code: 'afterSale_status' });
  196. if (this.$checkRes(res)) {
  197. this.$set(this, `statusList`, res.data);
  198. }
  199. // 减免方式
  200. res = await this.dictQuery({ code: 'transport_type' });
  201. if (this.$checkRes(res)) {
  202. this.$set(this, `shop_transport_typeList`, res.data);
  203. }
  204. },
  205. // 返回
  206. toBack() {
  207. window.history.go('-1');
  208. },
  209. },
  210. computed: {
  211. id() {
  212. return this.$route.query.id;
  213. },
  214. },
  215. metaform() {
  216. return { title: this.$route.meta.title };
  217. },
  218. watch: {
  219. test: {
  220. deep: true,
  221. immediate: true,
  222. handler(val) {},
  223. },
  224. },
  225. };
  226. </script>
  227. <style lang="less" scoped>
  228. .main {
  229. .one {
  230. font-size: 20px;
  231. margin: 10px 0 0 20%;
  232. padding: 5px;
  233. .add {
  234. border-bottom: 2px dashed #ccc;
  235. margin: 0 0 5px 0;
  236. padding: 5px 0;
  237. }
  238. .shop {
  239. padding: 4px 0;
  240. font-size: 22px;
  241. border-bottom: 1px solid #ccc;
  242. }
  243. .goods {
  244. padding: 10px 0;
  245. .money {
  246. text-align: right;
  247. }
  248. }
  249. .other {
  250. text-align: right;
  251. p {
  252. color: red;
  253. }
  254. }
  255. .el-col {
  256. margin: 4px 0;
  257. }
  258. }
  259. }
  260. </style>