productAfterSalesOrder.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. <template>
  2. <div class="order-content">
  3. <div class="order-status" v-if="afterSales!=null" >
  4. <el-steps :active="afterSales.status==4?afterSales.status+1:afterSales.status" align-center>
  5. <el-step title="待审核(24小时自动审核)"></el-step>
  6. <el-step title="平台已审核等待用户发货"></el-step>
  7. <el-step title="用户已发货待仓库审核"></el-step>
  8. <el-step title="财务审核"></el-step>
  9. <el-step title="退款成功"></el-step>
  10. </el-steps>
  11. </div>
  12. <div v-if="afterSales!=null">
  13. <el-card shadow="never" style="margin-top: 15px">
  14. <div class="operate-container">
  15. <span style="margin-left: 20px" class="color-danger">售后状态:
  16. <el-tag prop="status" v-for="(item, index) in salesStatusOptions" v-if="afterSales.salesStatus==item.dictValue">{{item.dictLabel}}</el-tag>
  17. </span>
  18. <div class="operate-button-container" >
  19. <el-button size="mini" v-hasPermi="['store:storeAfterSales:edit']" v-show="afterSales.salesStatus==0&&afterSales.status===1" @click="addDelivery">编辑物流</el-button>
  20. <el-button size="mini" @click="showOrder">查看订单</el-button>
  21. </div>
  22. </div>
  23. <div style="margin: 20px 0px">
  24. <span class="font-small">基本信息</span>
  25. </div>
  26. <el-descriptions :column="4" border >
  27. <el-descriptions-item label="订单单号" >
  28. <span v-if="afterSales!=null">
  29. {{afterSales.orderCode}}
  30. </span>
  31. </el-descriptions-item>
  32. <el-descriptions-item label="会员" >
  33. <span v-if="user!=null">
  34. {{user.nickname}}({{user.phone}})
  35. </span>
  36. </el-descriptions-item>
  37. <el-descriptions-item label="退款金额" >
  38. <span v-if="afterSales!=null">
  39. {{afterSales.refundAmount}}
  40. </span>
  41. </el-descriptions-item>
  42. <el-descriptions-item label="申请类型" >
  43. <span v-if="afterSales!=null">
  44. <el-tag prop="serviceType" v-for="(item, index) in serviceTypeOptions" v-if="afterSales.serviceType==item.dictValue">{{item.dictLabel}}</el-tag>
  45. </span>
  46. </el-descriptions-item>
  47. <el-descriptions-item label="申请原因" >
  48. <span v-if="afterSales!=null">
  49. {{afterSales.reasons}}
  50. </span>
  51. </el-descriptions-item>
  52. <el-descriptions-item label="说明" >
  53. <span v-if="afterSales!=null">
  54. {{afterSales.explains}}
  55. </span>
  56. </el-descriptions-item>
  57. <el-descriptions-item label="状态" >
  58. <span v-if="afterSales!=null">
  59. <el-tag v-for="(item, index) in statusOptions" v-if="afterSales.status==item.dictValue" >{{item.dictLabel}}</el-tag>
  60. </span>
  61. </el-descriptions-item>
  62. <el-descriptions-item label="售后状态" >
  63. <span v-if="afterSales!=null">
  64. <el-tag v-for="(item, index) in salesStatusOptions" v-if="afterSales.salesStatus==item.dictValue" >{{item.dictLabel}}</el-tag>
  65. </span>
  66. </el-descriptions-item>
  67. </el-descriptions>
  68. <div style="margin: 20px 0px">
  69. <span class="font-small">收货信息</span>
  70. </div>
  71. <el-descriptions :column="4" border >
  72. <el-descriptions-item label="收货人" >
  73. <span v-if="afterSales!=null">
  74. {{afterSales.consignee}}
  75. </span>
  76. </el-descriptions-item>
  77. <el-descriptions-item label="收货人" >
  78. <span v-if="afterSales!=null">
  79. {{afterSales.consignee}}
  80. </span>
  81. </el-descriptions-item>
  82. <el-descriptions-item label="手机号码" >
  83. <span v-if="afterSales!=null">
  84. {{afterSales.phoneNumber}}
  85. </span>
  86. </el-descriptions-item>
  87. <el-descriptions-item label="收货地址" >
  88. <span v-if="afterSales!=null">
  89. {{afterSales.address}}
  90. </span>
  91. </el-descriptions-item>
  92. <el-descriptions-item label="快递公司" >
  93. <span v-if="afterSales!=null">
  94. {{afterSales.deliveryName}}
  95. </span>
  96. </el-descriptions-item>
  97. <el-descriptions-item label="运单号" >
  98. <span v-if="afterSales!=null">
  99. {{afterSales.deliverySn}}
  100. </span>
  101. </el-descriptions-item>
  102. </el-descriptions>
  103. <div style="margin-top: 20px">
  104. <span class="font-small">商品信息</span>
  105. </div>
  106. <el-table
  107. border
  108. :data="items"
  109. size="small"
  110. style="width: 100%;margin-top: 20px" >
  111. <el-table-column label="商品图片" width="150" align="center">
  112. <template slot-scope="scope">
  113. <img :src="JSON.parse(scope.row.jsonInfo).image" style="height: 80px">
  114. </template>
  115. </el-table-column>
  116. <el-table-column label="商品名称" width="300" align="center">
  117. <template slot-scope="scope">
  118. <p>{{JSON.parse(scope.row.jsonInfo).productName}}</p>
  119. </template>
  120. </el-table-column>
  121. <el-table-column label="价格" width="240" align="center">
  122. <template slot-scope="scope">
  123. <p>价格:¥{{JSON.parse(scope.row.jsonInfo).price}}</p>
  124. </template>
  125. </el-table-column>
  126. <el-table-column label="属性" width="240" align="center">
  127. <template slot-scope="scope">
  128. {{JSON.parse(scope.row.jsonInfo).sku}}
  129. </template>
  130. </el-table-column>
  131. <el-table-column label="数量" width="180" align="center">
  132. <template slot-scope="scope">
  133. {{JSON.parse(scope.row.jsonInfo).num}}
  134. </template>
  135. </el-table-column>
  136. <el-table-column label="小计" align="center">
  137. <template slot-scope="scope">
  138. ¥{{JSON.parse(scope.row.jsonInfo).num*JSON.parse(scope.row.jsonInfo).price}}
  139. </template>
  140. </el-table-column>
  141. </el-table>
  142. <div style="margin-top: 20px">
  143. <span class="font-small">操作信息</span>
  144. </div>
  145. <el-table style="margin-top: 20px;width: 100%"
  146. ref="orderHistoryTable"
  147. :data="logs" border>
  148. <el-table-column label="操作时间" width="160" align="center">
  149. <template slot-scope="scope">
  150. {{scope.row.changeTime}}
  151. </template>
  152. </el-table-column>
  153. <el-table-column label="备注" align="center">
  154. <template slot-scope="scope">
  155. {{scope.row.changeMessage}}
  156. </template>
  157. </el-table-column>
  158. </el-table>
  159. </el-card>
  160. </div>
  161. <el-dialog :title="audit.title" :visible.sync="audit.open" width="800px" append-to-body>
  162. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  163. <el-form-item label="退款金额" prop="refundAmount" >
  164. <el-input-number v-model="form.refundAmount" />
  165. </el-form-item>
  166. <el-form-item label="退货联系人" prop="consignee" v-if="form.serviceType==1" >
  167. <el-input v-model="form.consignee" placeholder="请输入收货人" />
  168. </el-form-item>
  169. <el-form-item label="退货手机号" prop="phoneNumber" v-if="form.serviceType==1">
  170. <el-input v-model="form.phoneNumber" placeholder="请输入手机号" />
  171. </el-form-item>
  172. <el-form-item label="退货地址" prop="address" v-if="form.serviceType==1">
  173. <el-input v-model="form.address" placeholder="请输入地址" />
  174. </el-form-item>
  175. </el-form>
  176. <div slot="footer" class="dialog-footer">
  177. <el-button type="primary" @click="submitAuditForm">确 定</el-button>
  178. </div>
  179. </el-dialog>
  180. <el-dialog :title="show.title" v-if="show.open" :visible.sync="show.open" width="1000px" append-to-body>
  181. <product-order ref="productOrder" />
  182. </el-dialog>
  183. <el-dialog :title="add.title" :visible.sync="add.open" width="500px" append-to-body>
  184. <div slot="footer" class="dialog-footer">
  185. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  186. <el-form-item label="id" prop="id" v-if="false">
  187. <el-input v-model="form.id" placeholder="请输入" />
  188. </el-form-item>
  189. <el-form-item label="快递公司" prop="deliveryName">
  190. <el-input v-model="form.deliveryName" placeholder="请输入" />
  191. </el-form-item>
  192. <el-form-item label="运单号" prop="deliverySn">
  193. <el-input v-model="form.deliverySn" placeholder="请输入" />
  194. </el-form-item>
  195. </el-form>
  196. <el-button type="primary" @click="submitForm">确 定</el-button>
  197. <el-button @click="cancel1">取 消</el-button>
  198. </div>
  199. </el-dialog>
  200. </div>
  201. </template>
  202. <script>
  203. import {getStoreAfterSales,cancel,refund,audit,updateStoreAfterSales } from "@/api/store/storeAfterSales";
  204. import productOrder from "./productOrder";
  205. export default {
  206. components: { productOrder },
  207. name: "order",
  208. data() {
  209. return {
  210. show:{
  211. open:false,
  212. title:"订单详情"
  213. },
  214. audit:{
  215. title:"审核",
  216. open:false,
  217. },
  218. add:{
  219. open:false,
  220. title:"添加物流"
  221. },
  222. order:null,
  223. user:null,
  224. serviceTypeOptions:[],
  225. salesStatusOptions:[],
  226. statusOptions:[],
  227. afterSales:null,
  228. items:[],
  229. logs:[],
  230. form:{
  231. serviceType:1,
  232. refundAmount:0,
  233. consignee:null,
  234. phoneNumber:null,
  235. address:null,
  236. },
  237. rules:{
  238. status: [
  239. { required: true, message: "状态不能为空", trigger: "blur" }
  240. ],
  241. refundAmount: [
  242. { required: true, message: "退款金额不能为空", trigger: "blur" }
  243. ],
  244. consignee: [
  245. { required: true, message: "退货联系人不能为空", trigger: "blur" }
  246. ],
  247. phoneNumber: [
  248. { required: true, message: "退货手机号不能为空", trigger: "blur" }
  249. ],
  250. address: [
  251. { required: true, message: "退货地址不能为空", trigger: "blur" }
  252. ],
  253. }
  254. };
  255. },
  256. created() {
  257. this.getDicts("store_after_sales_sales_status").then((response) => {
  258. this.salesStatusOptions = response.data;
  259. });
  260. this.getDicts("store_after_sales_status").then((response) => {
  261. this.statusOptions = response.data;
  262. });
  263. this.getDicts("store_after_sales_service_type").then((response) => {
  264. this.serviceTypeOptions = response.data;
  265. });
  266. },
  267. methods: {
  268. submitForm() {
  269. var id=this.afterSales.id;
  270. this.form.id = id;
  271. updateStoreAfterSales(this.form).then(response => {
  272. if (response.code === 200) {
  273. this.msgSuccess("添加成功");
  274. this.add.open = false;
  275. this.getStoreAfterSales(id);
  276. }
  277. });
  278. },
  279. cancel1(){
  280. this.add.open = false;
  281. },
  282. addDelivery(){
  283. this.add.open = true;
  284. },
  285. showOrder(){
  286. this.show.open=true;
  287. const orderId = this.order.id ;
  288. setTimeout(() => {
  289. this.$refs.productOrder.getOrder(orderId);
  290. }, 500);
  291. },
  292. handleAudit(){
  293. this.audit.open=true;
  294. this.form.serviceType=this.afterSales.serviceType;
  295. this.form.salesId=this.afterSales.id;
  296. this.form.refundAmount=this.afterSales.refundAmount;
  297. },
  298. submitAuditForm() {
  299. this.$refs["form"].validate(valid => {
  300. if (valid) {
  301. audit(this.form).then(response => {
  302. if (response.code === 200) {
  303. this.audit.open = false;
  304. this.getStoreAfterSales(this.afterSales.id);
  305. this.msgSuccess("操作成功");
  306. }
  307. });
  308. }
  309. });
  310. },
  311. cancel(){
  312. var id=this.afterSales.id;
  313. this.$confirm('是否确认取消订单?', "警告", {
  314. confirmButtonText: "确定",
  315. cancelButtonText: "取消",
  316. type: "warning"
  317. }).then(function() {
  318. var data={salesId:id}
  319. return cancel(data);
  320. }).then(() => {
  321. this.getStoreAfterSales(id);
  322. this.msgSuccess("操作成功");
  323. }).catch(function() {});
  324. },
  325. refund(){
  326. var id=this.afterSales.id;
  327. this.$confirm('是否确认收货,确认后将自动退款给客户', "警告", {
  328. confirmButtonText: "确定",
  329. cancelButtonText: "取消",
  330. type: "warning"
  331. }).then(function() {
  332. var data={salesId:id}
  333. console.log(data)
  334. return refund(data);
  335. }).then(() => {
  336. this.getStoreAfterSales(id);
  337. this.msgSuccess("操作成功");
  338. }).catch(function() {});
  339. },
  340. getStoreAfterSales(id){
  341. getStoreAfterSales(id).then(response => {
  342. this.afterSales = response.afterSales;
  343. this.logs = response.logs;
  344. this.items = response.items;
  345. this.user=response.user;
  346. this.order=response.order;
  347. });
  348. }
  349. }
  350. };
  351. </script>
  352. <style scoped>
  353. .order-content{
  354. margin: 10px;
  355. }
  356. .detail-container {
  357. width: 80%;
  358. padding: 20px 20px 20px 20px;
  359. margin: 20px auto;
  360. }
  361. .operate-container {
  362. background: #F2F6FC;
  363. height: 80px;
  364. margin: -20px -20px 0;
  365. line-height: 80px;
  366. }
  367. .operate-button-container {
  368. float: right;
  369. margin-right: 20px
  370. }
  371. </style>