productAfterSalesOrder.vue 17 KB

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