productAfterSalesOrder.vue 17 KB

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