index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. <template>
  2. <div>
  3. <!-- <div class="i-layout-page-header"> -->
  4. <!-- <PageHeader
  5. class="product_tabs"
  6. :title="$route.meta.title"
  7. hidden-breadcrumb
  8. ></PageHeader> -->
  9. <!-- </div> -->
  10. <Card :bordered="false" dis-hover class="ivu-mt mt15">
  11. <Form ref="pagination" :model="pagination" :label-width="labelWidth" :label-position="labelPosition"
  12. @submit.native.prevent>
  13. <Row type="flex" class="mt10">
  14. <Col class="ivu-text-left mr">
  15. <FormItem label="订单状态:">
  16. <Select v-model="pagination.refund_type" style="width: 250px"
  17. @on-change="selectChange2(pagination.refund_type)">
  18. <Option v-for="item in num" :key="item.value" :value="item.value">{{ item.name }}</Option>
  19. </Select>
  20. <!-- <RadioGroup
  21. v-model="pagination.refund_type"
  22. type="button"
  23. @on-change="selectChange2(pagination.refund_type)"
  24. >
  25. <Radio v-for="(item, index) in num" :key="index" :label="index"
  26. >{{ item.name }} {{ '(' + item.num + ')' }}</Radio
  27. >
  28. </RadioGroup> -->
  29. </FormItem>
  30. </Col>
  31. <Col class="ml15">
  32. <FormItem label="退款时间:">
  33. <DatePicker :editable="false" @on-change="onchangeTime" :value="timeVal" format="yyyy/MM/dd"
  34. type="daterange" placement="bottom-start" placeholder="自定义时间" style="width: 250px"
  35. :options="options"></DatePicker>
  36. </FormItem>
  37. </Col>
  38. <Col class="ivu-text-left">
  39. <FormItem label="订单搜索:" label-for="title">
  40. <Input enter-button v-model="pagination.order_id" placeholder="请输入订单号" style="width: 250px" />
  41. <Button type="primary" class="ml10 search" @click="orderSearch">搜索</Button>
  42. </FormItem>
  43. </Col>
  44. </Row>
  45. </Form>
  46. </Card>
  47. <Card :bordered="false" dis-hover class="ivu-mt mt15">
  48. <Table :columns="thead" :data="tbody" ref="table" class="mt10" :loading="loading" highlight-row
  49. no-userFrom-text="暂无数据" no-filtered-userFrom-text="暂无筛选结果">
  50. <template slot-scope="{ row, index }" slot="order_id">
  51. <span v-text="row.order_id" style="display: block"></span>
  52. <span v-show="row.is_del === 1 && row.delete_time == null"
  53. style="color: #ed4014; display: block">用户已删除</span>
  54. </template>
  55. <template slot-scope="{ row, index }" slot="user">
  56. <div>用户名:{{ row.nickname }}</div>
  57. <div>用户ID:{{ row.uid }}</div>
  58. </template>
  59. <template slot-scope="{ row, index }" slot="refund_status">
  60. <div v-if="row.refund_status == 1">待审核</div>
  61. <div v-else-if="row.refund_status == 2">第一次审核通过</div>
  62. <div v-else-if="row.refund_status == 3">第二次审核通过</div>
  63. <div v-else-if="row.refund_status == 4">已全部退款</div>
  64. <div v-else-if="row.refund_status == 5">已部分退款</div>
  65. <div v-else-if="row.refund_status == -1">
  66. <div>拒绝退款</div>
  67. <div>原因:{{ row.refuse_reason }}</div>
  68. </div>
  69. </template>
  70. <template slot-scope="{ row, index }" slot="info">
  71. <div class="tabBox" v-for="(val, i) in row.info" :key="i">
  72. <div class="tabBox_img" v-viewer>
  73. <img v-lazy="val.slider_image" />
  74. </div>
  75. <span class="tabBox_tit">{{ val.store_name }}</span>
  76. <span class="tabBox_pice">{{'¥' + val.pay_price}}</span>
  77. </div>
  78. </template>
  79. <template slot-scope="{ row, index }" slot="pay_price">
  80. <span class="tabBox_pice">{{'¥' + showPrice(row.info)}}</span>
  81. </template>
  82. <template slot-scope="{ row, index }" slot="add_time">
  83. <span class="tabBox_pice">{{showTime(row.add_time)}}</span>
  84. </template>
  85. <template slot-scope="{ row, index }" slot="statusName">
  86. <div v-html="row.refund_reason" class="pt5"></div>
  87. <div v-html="row.refund_explain" class="pt5"></div>
  88. <div class="pictrue-box">
  89. <div v-viewer v-if="row.refund_img" v-for="(item, index) in row.refund_img || []" :key="index">
  90. <img class="pictrue mr10" v-lazy="item" :src="item" />
  91. </div>
  92. </div>
  93. </template>
  94. <template slot-scope="{ row, index }" slot="statusGoodName">
  95. <div v-html="row.refund_goods_explain" class="pt5"></div>
  96. <div class="pictrue-box">
  97. <div v-viewer v-if="row.refund_goods_img" v-for="(item, index) in row.refund_goods_img || []"
  98. :key="index">
  99. <img class="pictrue mr10" v-lazy="item" :src="item" />
  100. </div>
  101. </div>
  102. </template>
  103. <template slot-scope="{ row, index }" slot="action">
  104. <a @click="changeMenu(row, 1)" v-show="[1].includes(row.refund_status)">通过</a>
  105. <Divider type="vertical" v-show="[1].includes(row.refund_status)"/>
  106. <a @click="changeMenu(row, 0)">拒绝</a>
  107. </template>
  108. </Table>
  109. <div class="acea-row row-right page">
  110. <Page :total="total" :current="pagination.page" show-elevator show-total @on-change="pageChange"
  111. :page-size="pagination.limit" />
  112. </div>
  113. </Card>
  114. <!-- 编辑 退款 退积分 不退款-->
  115. <edit-from ref="edits" :FromData="FromData" @submitFail="submitFail"></edit-from>
  116. <!-- 详情 -->
  117. <details-from ref="detailss" :orderDatalist="orderDatalist" :orderId="orderId"
  118. :rowActive="rowActive"></details-from>
  119. <!-- 备注 -->
  120. <order-remark ref="remarks" remarkType="refund" :orderId="orderId" @submitFail="submitFail"></order-remark>
  121. <!-- 记录 -->
  122. <order-record ref="record"></order-record>
  123. </div>
  124. </template>
  125. <script>
  126. import {
  127. mapState
  128. } from 'vuex'
  129. import {
  130. orderRefundList,
  131. getDataInfo,
  132. getRefundDataInfo,
  133. getRefundFrom,
  134. getnoRefund,
  135. refundIntegral,
  136. getDistribution,
  137. getRefundOrderFrom,
  138. getServeRefund
  139. } from '@/api/order'
  140. import editFrom from '@/components/from/from'
  141. import detailsFrom from '../orderList/components/orderDetails'
  142. import orderRemark from '../orderList/components/orderRemark'
  143. import orderRecord from '../orderList/components/orderRecord'
  144. export default {
  145. components: {
  146. editFrom,
  147. detailsFrom,
  148. orderRemark,
  149. orderRecord
  150. },
  151. data() {
  152. return {
  153. grid: {
  154. xl: 7,
  155. lg: 7,
  156. md: 12,
  157. sm: 24,
  158. xs: 24,
  159. },
  160. thead: [{
  161. title: '订单号',
  162. align: 'center',
  163. slot: 'order_id',
  164. minWidth: 150,
  165. },
  166. {
  167. title: '用户昵称',
  168. key: 'real_name',
  169. minWidth: 130,
  170. },
  171. {
  172. title: '用户联系方式',
  173. key: 'user_phone',
  174. minWidth: 130,
  175. },
  176. {
  177. title: '商品信息',
  178. slot: 'info',
  179. minWidth: 300,
  180. },
  181. {
  182. title: '实际支付',
  183. slot: 'pay_price',
  184. minWidth: 70,
  185. },
  186. {
  187. title: '发起退款时间',
  188. slot: 'add_time',
  189. minWidth: 100,
  190. },
  191. {
  192. title: '退款状态',
  193. slot: 'refund_status',
  194. minWidth: 100,
  195. },
  196. // {
  197. // title: '退款信息',
  198. // slot: 'statusName',
  199. // minWidth: 100,
  200. // },
  201. // {
  202. // title: '退货信息',
  203. // slot: 'statusGoodName',
  204. // minWidth: 100,
  205. // },
  206. // {
  207. // title: '售后备注',
  208. // key: 'remark',
  209. // minWidth: 80,
  210. // },
  211. {
  212. title: '操作',
  213. slot: 'action',
  214. // fixed: "right",
  215. minWidth: 150,
  216. align: 'center',
  217. },
  218. ],
  219. tbody: [],
  220. num: [],
  221. orderDatalist: null,
  222. loading: false,
  223. FromData: null,
  224. total: 0,
  225. orderId: 0,
  226. animal: 1,
  227. pagination: {
  228. page: 1,
  229. limit: 15,
  230. refund_status: 1,
  231. order_id: '',
  232. time: '',
  233. refund_type: 0,
  234. },
  235. options: {
  236. shortcuts: [{
  237. text: '今天',
  238. value() {
  239. const end = new Date()
  240. const start = new Date()
  241. start.setTime(
  242. new Date(
  243. new Date().getFullYear(),
  244. new Date().getMonth(),
  245. new Date().getDate()
  246. )
  247. )
  248. return [start, end]
  249. },
  250. },
  251. {
  252. text: '昨天',
  253. value() {
  254. const end = new Date()
  255. const start = new Date()
  256. start.setTime(
  257. start.setTime(
  258. new Date(
  259. new Date().getFullYear(),
  260. new Date().getMonth(),
  261. new Date().getDate() - 1
  262. )
  263. )
  264. )
  265. end.setTime(
  266. end.setTime(
  267. new Date(
  268. new Date().getFullYear(),
  269. new Date().getMonth(),
  270. new Date().getDate() - 1
  271. )
  272. )
  273. )
  274. return [start, end]
  275. },
  276. },
  277. {
  278. text: '最近7天',
  279. value() {
  280. const end = new Date()
  281. const start = new Date()
  282. start.setTime(
  283. start.setTime(
  284. new Date(
  285. new Date().getFullYear(),
  286. new Date().getMonth(),
  287. new Date().getDate() - 6
  288. )
  289. )
  290. )
  291. return [start, end]
  292. },
  293. },
  294. {
  295. text: '最近30天',
  296. value() {
  297. const end = new Date()
  298. const start = new Date()
  299. start.setTime(
  300. start.setTime(
  301. new Date(
  302. new Date().getFullYear(),
  303. new Date().getMonth(),
  304. new Date().getDate() - 29
  305. )
  306. )
  307. )
  308. return [start, end]
  309. },
  310. },
  311. {
  312. text: "上月",
  313. value() {
  314. const end = new Date();
  315. const start = new Date();
  316. const day = new Date(start.getFullYear(), start.getMonth(), 0).getDate();
  317. start.setTime(
  318. start.setTime(
  319. new Date(new Date().getFullYear(), new Date().getMonth() - 1, 1)
  320. )
  321. );
  322. end.setTime(
  323. end.setTime(
  324. new Date(new Date().getFullYear(), new Date().getMonth() - 1, day)
  325. )
  326. );
  327. return [start, end];
  328. },
  329. },
  330. {
  331. text: '本月',
  332. value() {
  333. const end = new Date()
  334. const start = new Date()
  335. start.setTime(
  336. start.setTime(
  337. new Date(new Date().getFullYear(), new Date().getMonth(), 1)
  338. )
  339. )
  340. return [start, end]
  341. },
  342. },
  343. {
  344. text: '本年',
  345. value() {
  346. const end = new Date()
  347. const start = new Date()
  348. start.setTime(
  349. start.setTime(new Date(new Date().getFullYear(), 0, 1))
  350. )
  351. return [start, end]
  352. },
  353. },
  354. ],
  355. },
  356. timeVal: [],
  357. modal: false,
  358. qrcode: null,
  359. name: '',
  360. spin: false,
  361. rowActive: {},
  362. }
  363. },
  364. computed: {
  365. ...mapState('order', ['orderChartType']),
  366. // ...mapState("admin/layout", ["isMobile"]),
  367. labelWidth() {
  368. return this.isMobile ? undefined : 75
  369. },
  370. labelPosition() {
  371. return this.isMobile ? 'top' : 'right'
  372. },
  373. },
  374. created() {
  375. this.getOrderList()
  376. },
  377. methods: {
  378. showTime(time) {
  379. var date = new Date(time * 1000);
  380. var year = date.getFullYear(); // 获取年份
  381. var month = ("0" + (date.getMonth() + 1)).slice(-2); // 获取月份(注意月份从 0 开始,需要加 1)
  382. var day = ("0" + date.getDate()).slice(-2); // 获取日期
  383. var hours = ("0" + date.getHours()).slice(-2); // 获取小时
  384. var minutes = ("0" + date.getMinutes()).slice(-2); // 获取分钟
  385. var seconds = ("0" + date.getSeconds()).slice(-2); // 获取秒钟
  386. var dateString = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds; // 自定义时间格式
  387. return dateString
  388. },
  389. showPrice(list) {
  390. let price = 0;
  391. list.forEach(item => {
  392. price += item.pay_price * 1
  393. })
  394. return price
  395. },
  396. onchangeCode(e) {
  397. this.animal = e
  398. this.qrcodeShow()
  399. },
  400. // 具体日期搜索();
  401. onchangeTime(e) {
  402. this.pagination.page = 1
  403. this.timeVal = e
  404. this.pagination.time = this.timeVal[0] ? this.timeVal.join('-') : ''
  405. this.getOrderList()
  406. },
  407. // 操作
  408. changeMenu(row, name) {
  409. let titile;
  410. if(name == 1) {
  411. titile = '通过该退款审核?'
  412. }else {
  413. titile = '拒绝该退款审核?'
  414. }
  415. this.delfromData = {
  416. title: titile,
  417. url: `/refund/agree/${id}`,
  418. method: 'get',
  419. }
  420. },
  421. // 获取退款表单数据
  422. getRefundData(id, refund_type) {
  423. if (refund_type == 2) {
  424. this.delfromData = {
  425. title: '立即退货',
  426. url: `/refund/agree/${id}`,
  427. method: 'get',
  428. }
  429. this.$modalSure(this.delfromData)
  430. .then((res) => {
  431. this.$Message.success(res.msg)
  432. this.getOrderList()
  433. this.getData(this.orderId, 1)
  434. })
  435. .catch((res) => {
  436. this.$Message.error(res.msg)
  437. })
  438. } else {
  439. this.$modalForm(getRefundOrderFrom(id)).then(() => {
  440. this.getOrderList()
  441. this.getData(this.orderId, 1)
  442. this.$emit('changeGetTabs')
  443. })
  444. }
  445. },
  446. // 获取退积分表单数据
  447. getRefundIntegral(id) {
  448. refundIntegral(id)
  449. .then(async (res) => {
  450. this.FromData = res.data
  451. this.$refs.edits.modals = true
  452. })
  453. .catch((res) => {
  454. this.$Message.error(res.msg)
  455. })
  456. },
  457. // 获取详情表单数据
  458. getData(id, type) {
  459. getRefundDataInfo(id)
  460. .then(async (res) => {
  461. if (!type) {
  462. this.$refs.detailss.modals = true
  463. }
  464. this.$refs.detailss.activeName = 'detail'
  465. this.orderDatalist = res.data
  466. // if (this.orderDatalist.orderInfo.refund_reason_wap_img) {
  467. // try {
  468. // this.orderDatalist.orderInfo.refund_reason_wap_img = JSON.parse(
  469. // this.orderDatalist.orderInfo.refund_reason_wap_img
  470. // );
  471. // } catch (e) {
  472. // this.orderDatalist.orderInfo.refund_reason_wap_img = [];
  473. // }
  474. // }
  475. })
  476. .catch((res) => {
  477. this.$Message.error(res.msg)
  478. })
  479. },
  480. // 删除单条订单
  481. delOrder(row, data) {
  482. if (row.is_del === 1) {
  483. this.$modalSure(data)
  484. .then((res) => {
  485. this.$Message.success(res.msg)
  486. this.getOrderList()
  487. })
  488. .catch((res) => {
  489. this.$Message.error(res.msg)
  490. })
  491. } else {
  492. const title = '错误!'
  493. const content =
  494. '<p>您选择的的订单存在用户未删除的订单,无法删除用户未删除的订单!</p>'
  495. this.$Modal.error({
  496. title: title,
  497. content: content,
  498. })
  499. }
  500. },
  501. // 修改成功
  502. submitFail() {
  503. this.getOrderList()
  504. this.getData(this.orderId, 1)
  505. },
  506. // 订单选择状态
  507. selectChange2(tab) {
  508. this.pagination.page = 1
  509. this.pagination.refund_type = tab
  510. this.getOrderList(tab)
  511. },
  512. // 不退款表单数据
  513. getNoRefundData(id) {
  514. this.$modalForm(getnoRefund(id)).then(() => {
  515. this.getOrderList()
  516. this.getData(this.orderId, 1)
  517. this.$emit('changeGetTabs')
  518. })
  519. },
  520. // 订单列表
  521. getOrderList() {
  522. this.loading = true
  523. getServeRefund(this.pagination)
  524. .then((res) => {
  525. this.loading = false
  526. const {
  527. count,
  528. list,
  529. num
  530. } = res.data
  531. this.total = count
  532. this.tbody = list
  533. num.forEach((item, index) => {
  534. num[index] = ((Object.assign({}, item, {
  535. value: index
  536. })))
  537. })
  538. this.num = num
  539. list.forEach((item) => {
  540. if (item.id == this.orderId) {
  541. this.rowActive = item
  542. }
  543. })
  544. })
  545. .catch((err) => {
  546. this.loading = false
  547. this.$Message.error(err.msg)
  548. })
  549. },
  550. // 分页
  551. pageChange(index) {
  552. this.pagination.page = index
  553. this.getOrderList()
  554. },
  555. nameSearch() {
  556. this.pagination.page = 1
  557. this.getOrderList()
  558. },
  559. // 订单搜索
  560. orderSearch() {
  561. this.pagination.page = 1
  562. console.log(111)
  563. this.getOrderList()
  564. },
  565. // 配送信息表单数据
  566. delivery(row) {
  567. getDistribution(row.id)
  568. .then(async (res) => {
  569. this.FromData = res.data
  570. this.$refs.edits.modals = true
  571. })
  572. .catch((res) => {
  573. this.$Message.error(res.msg)
  574. })
  575. },
  576. },
  577. }
  578. </script>
  579. <style lang="stylus" scoped>
  580. /deep/.ivu-select-selected-value {
  581. font-size: 12px !important;
  582. }
  583. .code {
  584. position: relative;
  585. }
  586. .QRpic {
  587. width: 180px;
  588. height: 259px;
  589. img {
  590. width: 100%;
  591. height: 100%;
  592. }
  593. }
  594. .search {
  595. width: 86px;
  596. height: 32px;
  597. }
  598. .tabBox {
  599. width: 100%;
  600. height: 100%;
  601. display: flex;
  602. align-items: center;
  603. .tabBox_img {
  604. width: 36px;
  605. height: 36px;
  606. img {
  607. width: 100%;
  608. height: 100%;
  609. }
  610. }
  611. .tabBox_tit {
  612. width: 60%;
  613. font-size: 12px !important;
  614. margin: 0 2px 0 10px;
  615. letter-spacing: 1px;
  616. padding: 5px 0;
  617. box-sizing: border-box;
  618. }
  619. }
  620. .pictrue-box {
  621. display: flex;
  622. align-item: center;
  623. }
  624. .pictrue {
  625. width: 25px;
  626. height: 25px;
  627. }
  628. </style>