refund-detail.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('component/order-refund', __DIR__);
  4. ?>
  5. <style>
  6. .card-box {
  7. border: none;
  8. }
  9. .marign-b-20 {
  10. margin-bottom: 20px;
  11. }
  12. .step-box {
  13. margin-top: 10px;
  14. padding-top: 10px;
  15. }
  16. .step-inactive {
  17. position: absolute;
  18. top: 50%;
  19. left: 50%;
  20. width: 34px;
  21. height: 34px;
  22. border-radius: 50%;
  23. background-color: #e8e8e8;
  24. transform: translate(-50%, -50%);
  25. }
  26. .step-inside {
  27. position: absolute;
  28. top: 50%;
  29. left: 50%;
  30. width: 25px;
  31. height: 25px;
  32. border-radius: 50%;
  33. background-color: #cccbcb;
  34. transform: translate(-50%, -50%);
  35. text-align: center;
  36. line-height: 24px;
  37. z-index: 9;
  38. color: #fff;
  39. font-size: 12px;
  40. }
  41. .step-active {
  42. background-color: var(--primary, #fb6638);
  43. }
  44. .step-outside {
  45. background-color: transparent;
  46. }
  47. .step-box .el-step__title {
  48. font-size: 14px;
  49. }
  50. .text-other {
  51. padding: 10px 0;
  52. font-size: 12px;
  53. }
  54. .text-other>span:nth-child(1) {
  55. display: block;
  56. width: 100%;
  57. padding-left: 20px;
  58. text-align: left;
  59. }
  60. .text-child {
  61. padding: 5px 0 0 30px;
  62. color: #999;
  63. }
  64. .text-child>span {
  65. display: block;
  66. padding-top: 10px;
  67. }
  68. .text-item {
  69. padding: 10px 0;
  70. font-size: 12px;
  71. }
  72. .row-card-header {
  73. font-weight: 700;
  74. font-size: 14px;
  75. }
  76. .text-item>span:nth-child(1) {
  77. display: inline-block;
  78. width: 105px;
  79. padding-right: 20px;
  80. text-align: right;
  81. }
  82. .el-row-flex {
  83. display: flex;
  84. flex-flow: row wrap;
  85. }
  86. .el-row-flex .card-box {
  87. height: 100%;
  88. }
  89. .order-goods .el-table th>.cell,
  90. .order-goods .el-table {
  91. font-size: 13px;
  92. }
  93. .package-item {
  94. padding: 10px 0;
  95. font-size: 12px;
  96. }
  97. .package-item>span:nth-child(1) {
  98. display: inline-block;
  99. width: 105px;
  100. padding: 0 20px;
  101. text-align: left;
  102. }
  103. .package-item img {
  104. width: 55px;
  105. height: 55px;
  106. border-radius: 5px;
  107. margin-right: 10px;
  108. }
  109. .range-right {
  110. margin-right: 20px;
  111. }
  112. .color-red {
  113. color: red;
  114. }
  115. .color-green {
  116. color: green;
  117. }
  118. .consult {
  119. max-height: 600px;
  120. width: 100%;
  121. overflow-x: hidden;
  122. overflow-y: auto;
  123. }
  124. .consult li {
  125. border-bottom: 1px solid #EBEEF5;
  126. font-size: 12px;
  127. padding: 10px 0 20px 10px;
  128. }
  129. .consult li div {
  130. /* display: block; */
  131. padding: 5px 0;
  132. }
  133. .handle-btn {
  134. display: inline-block;
  135. position: absolute;
  136. right: 0px;
  137. top: -5px;
  138. }
  139. .el-dialog {
  140. border-radius: 5px;
  141. }
  142. .el-dialog__header {
  143. padding:10px 30px;
  144. border-bottom: 1px solid #f2f2f2;
  145. }
  146. .el-form-item--small {
  147. margin:10px 0;
  148. }
  149. .el-form-item--small {
  150. margin-bottom:0 !important;
  151. }
  152. </style>
  153. <div id="app" v-cloak>
  154. <el-card shadow="never" style="border: none;" body-style="background-color: #f3f3f3;padding: 10px 0 0;" v-loading="cardLoading">
  155. <div slot="header">
  156. <span>订单详情</span>
  157. </div>
  158. <el-card class="card-box step-box marign-b-20" shadow="never">
  159. <el-steps :active="stepArrActive">
  160. <el-step v-for="(item,index) in stepArr" :key="index" :title="item.title" :description="item.created_at|dateTimeFormat('Y-m-d H:i:s')">
  161. <template slot="icon">
  162. <div class="step-inactive" :class="item.is_step == 1 ? 'step-outside' : ''">
  163. <div class="step-inside" :class="item.is_step == 1 ? 'step-active' : ''">{{ index + 1 }}</div>
  164. </div>
  165. </template>
  166. </el-step>
  167. </el-steps>
  168. </el-card>
  169. <el-row :gutter="20" class="el-row-flex marign-b-20">
  170. <el-col :span="8">
  171. <el-card class="card-box" shadow="never">
  172. <div slot="header" class="clearfix row-card-header" style="position: relative;">
  173. <span>售后信息</span>
  174. <template v-if="step_status != -1 || step_status != -2">
  175. <!-- 仅退款 -->
  176. <!-- <div class="handle-btn" v-if="orderDetail.type == 1">
  177. <el-button type="primary" size="small" v-if="step_status == 5" @click="handle('handle', orderDetail, 6)">同意退款</el-button>
  178. <el-button plain size="small" v-if="step_status == 5" @click="handle('handle', orderDetail, -1)">拒绝售后申请</el-button>
  179. </div> -->
  180. <!-- 退货退款 -->
  181. <!-- <div class="handle-btn" v-if="orderDetail.type == 2">
  182. <el-button type="primary" size="small" v-if="step_status == 1" @click="handle('send_address', orderDetail, 2)">同意退货,发送退货地址</el-button>
  183. <el-button plain size="small" v-if="step_status == 1" @click="handle('handle', orderDetail, -1)">拒绝售后申请</el-button>
  184. <el-button plain size="small" v-if="step_status == 2" @click="handle('handle', orderDetail, 4)">已收到退货,同意退款</el-button>
  185. <el-button type="primary" size="small" v-if="step_status == 3" @click="handle('handle', orderDetail, 4)">确认收货并退款</el-button>
  186. <el-button plain size="small" v-if="step_status == 3" @click="handle('handle', orderDetail, -2)">拒绝确认收货</el-button>
  187. </div> -->
  188. <!-- 换货 -->
  189. <!-- <div class="handle-btn" v-if="orderDetail.type == 3">
  190. <el-button type="primary" size="small" v-if="step_status == 7" @click="handle('send_address', orderDetail, 8)">同意换货,发送退货地址</el-button>
  191. <el-button plain size="small" v-if="step_status == 7" @click="handle('handle', orderDetail, -1)">拒绝售后申请</el-button>
  192. <el-button plain size="small" v-if="step_status == 8" @click="handle('exchange', orderDetail, 10)">已收到退货,立即发货</el-button>
  193. <el-button type="primary" size="small" v-if="step_status == 9" @click="handle('exchange', orderDetail, 10)">确认收货并重新发货</el-button>
  194. <el-button plain size="small" v-if="step_status == 9" @click="handle('handle', orderDetail, -2)">拒绝确认收货</el-button>
  195. </div> -->
  196. </template>
  197. </div>
  198. <div class="text-item">
  199. <span>售后状态</span><span class="text-color-primary">{{ stepText.title }}</span>
  200. </div>
  201. <div class="text-item">
  202. <span>退款金额</span><span>¥{{ orderDetail.refund_price }} <span v-if="orderDetail.discount">+ {{orderDetail.discount}}</span></span>
  203. </div>
  204. <div class="text-item">
  205. <span>需返</span><span>{{ orderDetail.discount || '-' }}</span>
  206. </div>
  207. <div class="text-item">
  208. <span>售后原因</span><span>{{ orderDetail.reason || '-' }}</span>
  209. </div>
  210. <div class="text-item">
  211. <span>售后说明</span><span>{{ orderDetail.remark || '-' }}</span>
  212. </div>
  213. <div class="text-item">
  214. <span>售后编号</span><span>{{ orderDetail.order_no }}</span>
  215. </div>
  216. </el-card>
  217. </el-col>
  218. <el-col :span="8">
  219. <el-card class="card-box " shadow="never">
  220. <div slot="header" class="clearfix row-card-header">
  221. <span>其他信息</span>
  222. </div>
  223. <div class="text-other">
  224. {{ stepText.title }}
  225. </div>
  226. <div v-if="orderDetail.refund_status == 4" class="text-other" style="padding-bottom: 0px;">
  227. <span>客户退回信息</span>
  228. <div class="text-child">
  229. <span>快递公司:{{ orderDetail.express }}</span>
  230. <span>快递单号:{{ orderDetail.express_no }}</span>
  231. </div>
  232. </div>
  233. <div class="text-other">
  234. <span v-if="orderDetail.type == 1 && orderDetail.refund_status == 1">退款已完成,退款金额:{{ orderDetail.reality_refund_price }} 元 <span v-if="orderDetail.discount">+ {{orderDetail.discount}}</span></span><span></span>
  235. <span v-if="orderDetail.type == 2 && orderDetail.refund_status == 1">退款退货已完成,退款金额:{{ orderDetail.reality_refund_price }} 元 <span v-if="orderDetail.discount">+ {{orderDetail.discount}}</span></span><span></span>
  236. <span v-if="orderDetail.type == 3 && orderDetail.refund_status == 1">换货已完成</span><span></span>
  237. </div>
  238. </el-card>
  239. </el-col>
  240. <el-col :span="8">
  241. <el-card class="card-box" shadow="never">
  242. <div slot="header" class="clearfix row-card-header">
  243. <span>订单信息</span>
  244. </div>
  245. <div class="text-item">
  246. <span>订单状态</span><span :class="orderGoods.is_feedback == 1 ? 'color-red' : 'color-green'">{{ feedback_type_list[orderGoods.is_feedback] }}</span>
  247. </div>
  248. <div class="text-item">
  249. <span>订单编号</span><span>{{ orderDetail.order.order_no }}</span>
  250. </div>
  251. <div class="text-item">
  252. <span>交易单号</span><span>{{ orderDetail.order.out_trade_no || '-' }}</span>
  253. </div>
  254. <div class="text-item">
  255. <span>支付方式</span><span>{{ payment_type_list[orderDetail.order.payment_type] }}</span>
  256. </div>
  257. </el-card>
  258. </el-col>
  259. </el-row>
  260. <el-card class="card-box marign-b-20" shadow="never">
  261. <div slot="header" class="clearfix row-card-header">
  262. <span>商品信息</span>
  263. </div>
  264. <div class="order-goods">
  265. <el-table :data="orderGoodsList" style="width: 100%;" :header-cell-style="{background:'#F7F7F7','border-bottom': 0}">
  266. <el-table-column label="商品" width="260">
  267. <template slot-scope="scope">
  268. <div style="display: flex;align-items: center;">
  269. <el-image style="width: 50px; height: 50px;border-radius: 5px;margin-right: 10px" :src="scope.row.pic_url"></el-image>
  270. <com-ellipsis :line="2">
  271. {{ scope.row.goods_name }}
  272. </com-ellipsis>
  273. </div>
  274. </template>
  275. </el-table-column>
  276. <el-table-column label="单价" width="210">
  277. <template slot-scope="scope">
  278. <div>{{ getOrderPrice(scope.row) }}
  279. <span v-if="scope.row.adjust_money != 0">(调价:¥{{ scope.row.adjust_money }})</span>
  280. </div>
  281. </template>
  282. </el-table-column>
  283. <el-table-column label="购买数量" width="210">
  284. <template slot-scope="scope">
  285. <div>{{ scope.row.num }}</div>
  286. </template>
  287. </el-table-column>
  288. <el-table-column label="优惠" width="210">
  289. <template slot-scope="scope">
  290. <div>¥{{ (scope.row.price * scope.row.num - scope.row.goods_price).toFixed(2) }}</div>
  291. </template>
  292. </el-table-column>
  293. <el-table-column label="小计" width="210">
  294. <template slot-scope="scope">
  295. <div>{{ getOrderPrice(scope.row) }}</div>
  296. </template>
  297. </el-table-column>
  298. <el-table-column label="状态">
  299. <template slot-scope="scope">
  300. <div>{{ feedback_type_list[scope.row.is_feedback] }}</div>
  301. </template>
  302. </el-table-column>
  303. </el-table>
  304. </div>
  305. </el-card>
  306. <el-card v-if="orderDetail.step.length > 0" class="card-box marign-b-20" shadow="never">
  307. <div slot="header" class="clearfix row-card-header">
  308. <span>协商记录</span>
  309. </div>
  310. <ul class="consult">
  311. <li v-for="(item,index) in orderDetail.step">
  312. <div><span style="color: #409eff; padding-right: 10px;">{{ item.role == 1 ? '买家' : '商家' }}</span> {{ item.created_at|dateTimeFormat('Y-m-d H:i:s')}}</div>
  313. <template v-for="val in JSON.parse(item.content)">
  314. <template v-if="typeof val == 'object'">
  315. <el-image
  316. v-for="img,k in val"
  317. style="width: 100px; height: 100px; margin-right: 20px; display: inline-block;"
  318. :src="img"
  319. :key="k"
  320. :preview-src-list="val">
  321. </el-image>
  322. </template>
  323. <div v-else>{{ val }}</div>
  324. </template>
  325. </li>
  326. </ul>
  327. </el-card>
  328. <el-card>
  329. <el-button type="primary" v-if="orderDetail.order_status == 1" size="small" @click="handle('shipping', orderDetail)">发货</el-button>
  330. <el-button type="primary" v-if="orderDetail.order_status == 2" size="small" @click="handle('take-delivery', orderDetail)">确认收货</el-button>
  331. <el-button type="primary" v-if="orderDetail.order_status == 3" size="small" @click="handle('sales', orderDetail)">订单完成</el-button>
  332. </el-card>
  333. </el-card>
  334. <!-- 修改退货地址 -->
  335. <order-refund :is_show="isShowChangeShipping"
  336. :handle_step_status="handleStepStatus"
  337. :handle_type="handleType"
  338. :change-shipping-loading="changeShippingLoading"
  339. :refund_info="orderDetail"
  340. :default_address="default_address"
  341. @submit="handleShipping"
  342. @close="isShowChangeShipping = false"
  343. :address_list = "address_list"
  344. @address = "selectAddress"
  345. ></order-refund>
  346. </div>
  347. <script>
  348. const app = new Vue({
  349. el: '#app',
  350. data() {
  351. return {
  352. id: 0,
  353. store_id: 0,
  354. detail: {},
  355. isShowChangeShipping: false,
  356. changeShippingLoading: false,
  357. shipping_form: {},
  358. activePackage: '0',
  359. handleType: '',
  360. cardLoading: false,
  361. logLoading: false,
  362. step_status: 0,
  363. orderGoodsList: [],
  364. goodDetails: [],
  365. orderAction: [],
  366. feedback_type_list: {},
  367. stepArrs: {
  368. "1": [
  369. {
  370. title: '买家下单',
  371. created_at: '0',
  372. is_step: 0,
  373. },
  374. {
  375. title: '买家付款',
  376. created_at: '0',
  377. is_step: 0,
  378. },
  379. {
  380. title: '商家发货',
  381. created_at: '0',
  382. is_step: 0,
  383. },
  384. {
  385. title: '交易完成',
  386. created_at: '0',
  387. is_step: 0,
  388. }
  389. ],
  390. },
  391. stepArr: [
  392. {
  393. title: '售后申请',
  394. created_at: '0',
  395. is_step: 0,
  396. },
  397. {
  398. title: '处理售后申请',
  399. created_at: '0',
  400. is_step: 0,
  401. },
  402. {
  403. title: '售后完成',
  404. created_at: '0',
  405. is_step: 0,
  406. },
  407. ],
  408. stepArrActive: 0,
  409. handleStepStatus: 0,
  410. orderDetail: {
  411. express: [],
  412. step: [],
  413. order: {}
  414. },
  415. orderGoods: {},
  416. orderExpress: [],
  417. stepText: {},
  418. order_status_list: {
  419. '0': "待付款",
  420. '1': "待发货",
  421. '2': "已发货",
  422. '3': "已收货",
  423. '4': "已完成",
  424. '-1': "售后申请",
  425. '-2': "退款中",
  426. '-3': "售后完成",
  427. '-4': "已关闭",
  428. '-5': "撤销申请",
  429. },
  430. payment_type_list: {
  431. '0': "在线支付",
  432. '1': "微信",
  433. '2': "支付宝",
  434. '3': "银联卡",
  435. '5': "余额支付",
  436. '7': "汇聚支付",
  437. '8': "汇聚快捷支付",
  438. '100': "线下支付"
  439. },
  440. shipping_type_list: {
  441. '1': "物流配送",
  442. '2': "买家自提",
  443. '3': "货到付款",
  444. '4': "本地配送"
  445. },
  446. default_address: {},
  447. address_list : [],
  448. };
  449. },
  450. created() {
  451. this.id = getQuery('id');
  452. this.store_id = getQuery('store_id');
  453. },
  454. mounted() {
  455. this.getDetail();
  456. },
  457. methods: {
  458. handleShipping(data) {
  459. this.handle('send_address', data, null, true);
  460. },
  461. selectAddress(data) {
  462. this.handle('select_address', data);
  463. },
  464. getDetail() {
  465. let self = this;
  466. self.cardLoading = true;
  467. request({
  468. params: {
  469. r: 'mch/store-order/refund-detail',
  470. id: self.id,
  471. store_id: self.store_id
  472. },
  473. method: 'get',
  474. }).then(e => {
  475. self.cardLoading = false;
  476. if (e.data.code == 0) {
  477. var data = e.data.data;
  478. self.orderDetail = data.refund;
  479. self.orderGoods = data.refund.orderDetail;
  480. self.orderGoodsList = [data.refund.orderDetail];
  481. self.address_list = data.address_list;
  482. self.stepText = data.step_text;
  483. self.default_address = data.address_list[0];
  484. self.feedback_type_list = data.feedback_type_list;
  485. self.step_status = self.orderDetail.step[0].step_status;
  486. if (!isEmpty(data.step_arr)) self.getStepArr(data.step_arr, data.refund.step);
  487. } else {
  488. self.$message.error(e.data.msg);
  489. }
  490. }).catch(e => {
  491. console.log(e);
  492. });
  493. },
  494. getStepArr(stepArr, order) {
  495. var stepNumArr = [];
  496. var last_num = order[0].step_num;
  497. order.forEach(function (item) {
  498. stepNumArr[item.step_num] = item.created_at;
  499. });
  500. var newStepArr = [];
  501. stepArr.forEach(function (item) {
  502. let step = {};
  503. step['title'] = item.title;
  504. step['is_step'] = 1;
  505. if (stepNumArr[item.step_num]) {
  506. step['created_at'] = stepNumArr[item.step_num];
  507. } else if (last_num >= item.step_num && stepNumArr[last_num]) {// 如果一步到完成则获取最后一条时间
  508. console.info(last_num+'--'+item.step_num,'123')
  509. step['created_at'] = stepNumArr[last_num];
  510. } else {
  511. step['created_at'] = 0;
  512. step['is_step'] = 0;
  513. }
  514. newStepArr.push(step);
  515. });
  516. this.stepArrActive = this.orderDetail.step[0].step_num;
  517. this.stepArr = newStepArr;
  518. },
  519. handle(type, data, step_status = null, submit = false) {
  520. let id = data ? parseInt(data.id) : '';
  521. let store_id = data ? parseInt(data.store_id) : 0;
  522. switch (type) {
  523. // 订单详情
  524. case 'detail':
  525. let params = {
  526. r: 'mch/store-order/detail'
  527. };
  528. if (id) params = Object.assign(params, {
  529. id: id
  530. });
  531. if (store_id) params = Object.assign(params, {
  532. store_id: store_id
  533. });
  534. navigateTo(params);
  535. break;
  536. // 删除订单
  537. case 'destroy':
  538. param = {
  539. id: id,
  540. store_id: store_id,
  541. type
  542. };
  543. this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {
  544. type: 'warning'
  545. }).then(() => {
  546. this.send(param)
  547. }).catch((err) => {})
  548. break;
  549. // 售后处理
  550. case 'handle':
  551. param = {
  552. id: id,
  553. store_id: store_id,
  554. step_status: step_status,
  555. };
  556. this.send('mch/store-order/handle-refund', param);
  557. break;
  558. case 'exchange':// 换货
  559. case 'send_address':// 发送退货地址
  560. if (submit) {
  561. this.changeShippingLoading = true;
  562. this.send('mch/store-order/handle-refund', data, (resp) => {
  563. if (resp.code == 0) this.isShowChangeShipping = false;
  564. });
  565. setTimeout(() => {
  566. this.changeShippingLoading = false;
  567. }, 100);
  568. } else {
  569. this.isShowChangeShipping = true
  570. this.handleStepStatus = step_status;
  571. this.handleType = type;
  572. }
  573. break;
  574. //选择优惠券
  575. case 'select_address':
  576. for(let i = 0; i < this.address_list.length; i++) {
  577. if (this.address_list[i]['address'] == data) {
  578. this.default_address = this.address_list[i];
  579. }
  580. }
  581. }
  582. },
  583. send(url, params, callback) {
  584. let self = this;
  585. request({
  586. params: {
  587. r: url,
  588. },
  589. method: 'post',
  590. data: params
  591. }).then(e => {
  592. if (e.data.code == 0) {
  593. self.$message.success(e.data.msg);
  594. self.getDetail();
  595. } else {
  596. self.$message.error(e.data.msg);
  597. }
  598. if (callback) callback(e.data);
  599. }).catch(e => {
  600. console.log(e);
  601. });
  602. },
  603. getOrderPrice(data){
  604. let text = '';
  605. switch (data.marketing_type) {
  606. case 'ScoreMall' :
  607. text = data.extra_info;
  608. break;
  609. default :
  610. text = '¥'+data.goods_price;
  611. }
  612. return text;
  613. },
  614. }
  615. });
  616. </script>