index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. <template>
  2. <view class="pos-order-list" ref="container">
  3. <view class='search acea-row row-between-wrapper'>
  4. <view class='input acea-row row-between-wrapper'>
  5. <text class='iconfont icon-sousuo'></text>
  6. <input type='text' v-model='where.keywords' @confirm="inputConfirm" :focus='focus'
  7. :placeholder='$t(`搜索用户名/订单号/电话`)' placeholder-class='placeholder' @input="setValue"></input>
  8. </view>
  9. <view class='bnt' @tap='searchBut'>{{$t(`搜索`)}}</view>
  10. </view>
  11. <view class="nav acea-row row-around row-middle">
  12. <view class="item" :class="where.status == 0 ? 'on' : ''" @click="changeStatus(0)">
  13. {{$t(`待付款`)}}
  14. </view>
  15. <view class="item" :class="where.status == 1 ? 'on' : ''" @click="changeStatus(1)">
  16. {{$t(`待发货`)}}
  17. </view>
  18. <view class="item" :class="where.status == 2 ? 'on' : ''" @click="changeStatus(2)">
  19. {{$t(`待收货`)}}
  20. </view>
  21. <view class="item" :class="where.status == 3 ? 'on' : ''" @click="changeStatus(3)">
  22. {{$t(`待评价`)}}
  23. </view>
  24. <view class="item" :class="where.status == 4 ? 'on' : ''" @click="changeStatus(4)">
  25. {{$t(`已完成`)}}
  26. </view>
  27. <view class="item" :class="where.status == -3 ? 'on' : ''" @click="changeStatus(-3)">
  28. {{$t(`退款`)}}
  29. </view>
  30. </view>
  31. <view class="list" v-if="list.length">
  32. <view class="item" v-for="(item, index) in list" :key="index">
  33. <view class="order-num acea-row row-between-wrapper" @click="toDetail(item)">
  34. <view>
  35. <view>{{$t(`订单号`)}}:{{ item.order_id }}</view>
  36. <view class="time">{{$t(`下单时间`)}}:{{ item.add_time }}</view>
  37. </view>
  38. <view class="state"
  39. :class="(item.refund_status==0 && where.status != 0 && item.refund.length)?'on':''">
  40. {{item.refund_status==1?$t(`退款中`):item.refund_status==2?$t(`已退款`):item.refund_status==3?$t(`拒绝退款`):$t(item.status_name.status_name)}}
  41. <text
  42. v-if="item.refund_status==0 && where.status != 0 && item.refund.length">{{item.is_all_refund?$t(`退款中`):$t(`部分退款中`)}}</text>
  43. </view>
  44. </view>
  45. <view class="pos-order-goods" v-for="(val, key) in item._info" :key="key">
  46. <view class="goods acea-row row-between row-top" @click="toDetail(item)">
  47. <view class="picTxt acea-row row-between-wrapper">
  48. <view class="pictrue">
  49. <image
  50. :src="val.cart_info.productInfo.attrInfo?val.cart_info.productInfo.attrInfo.image:val.cart_info.productInfo.image" />
  51. </view>
  52. <view class="text acea-row row-between row-column">
  53. <view class="info line2">
  54. {{ val.cart_info.productInfo.store_name }}
  55. </view>
  56. <view class="attr" v-if="val.cart_info.productInfo.attrInfo">
  57. {{ val.cart_info.productInfo.attrInfo.suk }}
  58. </view>
  59. </view>
  60. </view>
  61. <view class="money">
  62. <view class="x-money">
  63. {{$t(`¥`)}}{{ val.cart_info.productInfo.attrInfo?val.cart_info.productInfo.attrInfo.price:val.cart_info.productInfo.price }}
  64. </view>
  65. <view class="num">x{{ val.cart_info.cart_num }}</view>
  66. <view class="info" v-if="val.cart_info.refund_num && item._status._type !=-2">
  67. {{val.cart_info.refund_num}}{{$t(`件退款中`)}}
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. <view class="public-total">
  73. {{$t(`共`)}}{{ item.total_num }}{{$t(`件商品,实付款`)}}
  74. <span class="money">{{$t(`¥`)}}{{ item.pay_price }}</span> ( {{$t(`邮费`)}} {{$t(`¥`)}}{{
  75. item.pay_postage
  76. }}
  77. )
  78. </view>
  79. <view class="operation acea-row row-between-wrapper">
  80. <view class="acea-row row-middle">
  81. <view class="bnt" @click="modify(item, 0)" v-if="where.status == 0">
  82. {{$t(`一键改价`)}}
  83. </view>
  84. <view class="bnt" @click="modify(item, 1)">{{$t(`订单备注`)}}</view>
  85. <view class="bnt" @click="modify(item, 2)"
  86. v-if="(item.refund_type == 0 || item.refund_type == 1 || item.refund_type == 5 ) && where.status == -3 && parseFloat(item.pay_price) > 0">
  87. {{$t(`立即退款`)}}
  88. </view>
  89. <view class="bnt" @click="agreeExpress(item)"
  90. v-if="where.status == -3 && item.refund_type == 2">{{$t(`同意退货`)}}</view>
  91. <view class="wait" v-if="where.status == -3 && item.refund_type == 4">{{$t(`待用户发货`)}}</view>
  92. <view class="bnt cancel" v-if="item.pay_type === 'offline' && item.paid === 0"
  93. @click="offlinePay(item)">
  94. {{$t(`确认付款`)}}
  95. </view>
  96. <navigator class="bnt"
  97. v-if="where.status == 1 && item.shipping_type === 1 && (item.pinkStatus === null || item.pinkStatus === 2)"
  98. :url="'/pages/admin/delivery/index?id='+item.order_id+'&listId='+item.id+'&totalNum='+item.total_num+'&orderStatus='+item._status+'&comeType=1'">
  99. {{$t(`去发货`)}}
  100. </navigator>
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. <view v-else class="nothing">
  106. <image v-if="!loading" :src="imgHost + '/statics/images/no-thing.png'" alt="">
  107. <view v-if="!loading">{{$t(`暂无记录`)}}</view>
  108. </view>
  109. <Loading :loaded="loaded" :loading="loading"></Loading>
  110. <PriceChange :change="change" :orderInfo="orderInfo" :isRefund="isRefund" v-on:closechange="changeclose($event)"
  111. v-on:savePrice="savePrice" :status="status"></PriceChange>
  112. </view>
  113. </template>
  114. <script>
  115. import {
  116. getAdminOrderList,
  117. setAdminOrderPrice,
  118. setAdminOrderRemark,
  119. setAdminRefundRemark,
  120. setOfflinePay,
  121. setOrderRefund,
  122. agreeExpress,
  123. orderRefund_order
  124. } from "@/api/admin";
  125. import Loading from '@/components/Loading/index'
  126. import PriceChange from '../components/PriceChange/index.vue'
  127. import {
  128. HTTP_REQUEST_URL
  129. } from '@/config/app'
  130. import {
  131. isMoney
  132. } from '@/utils/validate.js'
  133. export default {
  134. name: "AdminOrderList",
  135. components: {
  136. Loading,
  137. PriceChange
  138. },
  139. data() {
  140. return {
  141. imgHost: HTTP_REQUEST_URL,
  142. current: "",
  143. change: false,
  144. types: 0,
  145. where: {
  146. keywords: '',
  147. page: 1,
  148. limit: 10,
  149. status: 0
  150. },
  151. list: [],
  152. loaded: false,
  153. loading: false,
  154. focus: false,
  155. orderInfo: {},
  156. status: "",
  157. isRefund: 0 //1是仅退款;0是退货退款
  158. };
  159. },
  160. onLoad(option) {
  161. let type = option.types;
  162. this.where.status = type;
  163. this.init();
  164. },
  165. methods: {
  166. setValue(event) {
  167. this.$set(this.where, 'keywords', event.detail.value);
  168. },
  169. inputConfirm(event) {
  170. if (event.detail.value) {
  171. uni.hideKeyboard();
  172. this.getIndex();
  173. }
  174. },
  175. searchBut() {
  176. let that = this;
  177. if (!that.where.keywords.trim()) return this.$util.Tips({
  178. title: that.$t(`请输入要搜索的商品`)
  179. });
  180. that.focus = false;
  181. that.where.page = 1;
  182. that.loading = false;
  183. that.loaded = false;
  184. that.$set(that, 'list', []);
  185. uni.showLoading({
  186. title: that.$t(`正在搜索中`)
  187. });
  188. that.getIndex();
  189. },
  190. // 获取数据
  191. getIndex() {
  192. let that = this;
  193. if (that.loading || that.loaded) return;
  194. that.loading = true;
  195. let fn
  196. that.where.status == -3 ? fn = orderRefund_order : fn = getAdminOrderList
  197. fn(that.where).then(
  198. res => {
  199. that.loading = false;
  200. that.loaded = res.data.length < that.where.limit;
  201. that.list.push.apply(that.list, res.data);
  202. that.where.page = that.where.page + 1;
  203. uni.hideLoading();
  204. },
  205. err => {
  206. uni.hideLoading();
  207. that.$util.Tips({
  208. title: err
  209. })
  210. }
  211. );
  212. },
  213. // 初始化
  214. init() {
  215. this.list = [];
  216. this.where.page = 1;
  217. this.loaded = false;
  218. this.loading = false;
  219. this.getIndex();
  220. this.current = "";
  221. },
  222. // 导航切换
  223. changeStatus(val) {
  224. if (this.where.status != val) {
  225. this.where.status = val;
  226. this.init();
  227. }
  228. },
  229. // 商品操作
  230. modify(item, status) {
  231. this.change = true;
  232. this.status = status.toString();
  233. this.orderInfo = item;
  234. if (status == 2) {
  235. this.isRefund = 1
  236. }
  237. },
  238. changeclose(msg) {
  239. this.change = msg;
  240. },
  241. async savePrice(opt) {
  242. let that = this,
  243. data = {},
  244. price = opt.price,
  245. refund_price = opt.refund_price,
  246. refund_status = that.orderInfo.refund_status,
  247. remark = opt.remark;
  248. data.order_id = that.orderInfo.order_id;
  249. if (that.status == 0) {
  250. if (!isMoney(price)) {
  251. return that.$util.Tips({
  252. title: that.$t(`请输入正确的金额`)
  253. });
  254. }
  255. data.price = price;
  256. setAdminOrderPrice(data).then(
  257. res => {
  258. that.change = false;
  259. that.$util.Tips({
  260. title: that.$t(`改价成功`),
  261. icon: 'success'
  262. })
  263. that.init();
  264. },
  265. err => {
  266. that.change = false;
  267. that.$util.Tips({
  268. title: that.$t(`改价失败`),
  269. icon: 'none'
  270. })
  271. }
  272. );
  273. } else if (that.status == 2) {
  274. if (!isMoney(refund_price)) {
  275. return that.$util.Tips({
  276. title: that.$t(`请输入正确的金额`)
  277. });
  278. }
  279. data.price = refund_price;
  280. data.type = opt.type;
  281. setOrderRefund(data).then(
  282. res => {
  283. that.change = false;
  284. that.$util.Tips({
  285. title: res.msg
  286. });
  287. that.init();
  288. },
  289. err => {
  290. that.change = false;
  291. that.$util.Tips({
  292. title: err
  293. });
  294. }
  295. );
  296. } else {
  297. if (!remark) {
  298. return this.$util.Tips({
  299. title: that.$t(`请输入备注`)
  300. })
  301. }
  302. data.remark = remark;
  303. let obj = '';
  304. if (that.where.status == -3) {
  305. obj = setAdminRefundRemark(data);
  306. } else {
  307. obj = setAdminOrderRemark(data);
  308. }
  309. obj.then(
  310. res => {
  311. that.change = false;
  312. this.$util.Tips({
  313. title: res.msg,
  314. icon: 'success'
  315. })
  316. that.init();
  317. },
  318. err => {
  319. that.change = false;
  320. that.$util.Tips({
  321. title: err
  322. });
  323. }
  324. );
  325. }
  326. },
  327. agreeExpress(item) {
  328. let that = this;
  329. agreeExpress({
  330. id: item.id
  331. }).then(res => {
  332. that.$util.Tips({
  333. title: res.msg
  334. });
  335. that.init();
  336. }).catch(err => {
  337. that.$util.Tips({
  338. title: err
  339. });
  340. })
  341. },
  342. toDetail(item) {
  343. uni.navigateTo({
  344. url: `/pages/admin/orderDetail/index?id=${item.order_id}&types=${this.where.status}`
  345. })
  346. },
  347. offlinePay(item) {
  348. setOfflinePay({
  349. order_id: item.order_id
  350. }).then(
  351. res => {
  352. this.$util.Tips({
  353. title: res.msg,
  354. icon: "success"
  355. });
  356. this.init();
  357. },
  358. error => {
  359. this.$util.Tips(error);
  360. }
  361. );
  362. }
  363. },
  364. onReachBottom() {
  365. this.getIndex()
  366. }
  367. }
  368. </script>
  369. <style lang="scss" scoped>
  370. .pos-order-list {
  371. padding-top: 96rpx;
  372. .search {
  373. padding-left: 30rpx;
  374. padding-top: 30rpx;
  375. background-color: #fff;
  376. position: fixed;
  377. top: 0;
  378. left: 0;
  379. z-index: 99;
  380. .input {
  381. width: 598rpx;
  382. background-color: #f7f7f7;
  383. border-radius: 33rpx;
  384. padding: 0 35rpx;
  385. box-sizing: border-box;
  386. height: 66rpx;
  387. }
  388. .input input {
  389. width: 472rpx;
  390. font-size: 28rpx;
  391. }
  392. .input .placeholder {
  393. color: #999;
  394. }
  395. .input .iconfont {
  396. color: #555;
  397. font-size: 35rpx;
  398. }
  399. .bnt {
  400. width: 120rpx;
  401. text-align: center;
  402. height: 66rpx;
  403. line-height: 66rpx;
  404. font-size: 30rpx;
  405. color: #282828;
  406. }
  407. }
  408. }
  409. .pos-order-list .nav {
  410. width: 100%;
  411. height: 96upx;
  412. background-color: #fff;
  413. font-size: 28rpx;
  414. color: #282828;
  415. position: fixed;
  416. top: 96rpx;
  417. left: 0;
  418. z-index: 99;
  419. }
  420. .pos-order-list .nav .item.on {
  421. color: #2291f8;
  422. }
  423. .pos-order-list .list {
  424. margin-top: 120upx;
  425. }
  426. .pos-order-list .nothing {
  427. margin-top: 220upx;
  428. text-align: center;
  429. color: #cfcfcf;
  430. }
  431. .pos-order-list .list .item {
  432. background-color: #fff;
  433. width: 100%;
  434. }
  435. .pos-order-list .list .item~.item {
  436. margin-top: 24upx;
  437. }
  438. .pos-order-list .list .item .order-num {
  439. height: 124upx;
  440. border-bottom: 1px solid #eee;
  441. font-size: 30upx;
  442. font-weight: bold;
  443. color: #282828;
  444. padding: 0 30upx;
  445. }
  446. .pos-order-list .list .item .order-num .state {
  447. color: #2291f8;
  448. font-weight: normal;
  449. }
  450. .pos-order-list .list .item .order-num .state.on {
  451. font-size: 24rpx;
  452. width: 150rpx;
  453. text-align: right;
  454. }
  455. .pos-order-list .list .item .order-num .time {
  456. font-size: 26upx;
  457. font-weight: normal;
  458. color: #999;
  459. }
  460. .pos-order-list .list .item .operation {
  461. padding: 20upx 30upx;
  462. margin-top: 3upx;
  463. display: flex;
  464. justify-content: right;
  465. }
  466. .pos-order-list .list .item .operation .more {
  467. position: relative;
  468. }
  469. .pos-order-list .list .item .operation .icon-gengduo {
  470. font-size: 50upx;
  471. color: #aaa;
  472. }
  473. .pos-order-list .list .item .operation .order .arrow {
  474. width: 0;
  475. height: 0;
  476. border-left: 11upx solid transparent;
  477. border-right: 11upx solid transparent;
  478. border-top: 20upx solid #e5e5e5;
  479. position: absolute;
  480. left: 15upx;
  481. bottom: -18upx;
  482. }
  483. .pos-order-list .list .item .operation .order .arrow:before {
  484. content: '';
  485. width: 0;
  486. height: 0;
  487. border-left: 7upx solid transparent;
  488. border-right: 7upx solid transparent;
  489. border-top: 20upx solid #fff;
  490. position: absolute;
  491. left: -7upx;
  492. bottom: 0;
  493. }
  494. .pos-order-list .list .item .operation .order {
  495. width: 200upx;
  496. background-color: #fff;
  497. border: 1px solid #eee;
  498. border-radius: 10upx;
  499. position: absolute;
  500. top: -100upx;
  501. z-index: 9;
  502. }
  503. .pos-order-list .list .item .operation .order .items {
  504. height: 77upx;
  505. line-height: 77upx;
  506. text-align: center;
  507. }
  508. .pos-order-list .list .item .operation .order .items~.items {
  509. border-top: 1px solid #f5f5f5;
  510. }
  511. .pos-order-list .list .item .operation .bnt {
  512. font-size: 28upx;
  513. color: #5c5c5c;
  514. width: 170upx;
  515. height: 60upx;
  516. border-radius: 30upx;
  517. border: 1px solid #bbb;
  518. text-align: center;
  519. line-height: 60upx;
  520. }
  521. .pos-order-list .list .item .operation .bnt~.bnt {
  522. margin-left: 14upx;
  523. }
  524. .pos-order-list .list .item .operation .wait {
  525. margin-left: 30rpx;
  526. color: orangered;
  527. }
  528. .pos-order-goods {
  529. padding: 0 30upx;
  530. background-color: #fff;
  531. }
  532. .pos-order-goods .goods {
  533. padding: 28rpx 0;
  534. }
  535. .pos-order-goods .goods~.goods {
  536. border-top: 1px dashed #e5e5e5;
  537. }
  538. .pos-order-goods .goods .picTxt {
  539. width: 515upx;
  540. }
  541. .pos-order-goods .goods .picTxt .pictrue {
  542. width: 130upx;
  543. height: 130upx;
  544. }
  545. .pos-order-goods .goods .picTxt .pictrue image {
  546. width: 100%;
  547. height: 100%;
  548. border-radius: 6upx;
  549. }
  550. .pos-order-goods .goods .picTxt .text {
  551. width: 365upx;
  552. height: 130upx;
  553. }
  554. .pos-order-goods .goods .picTxt .text .info {
  555. width: 100%;
  556. font-size: 28upx;
  557. color: #282828;
  558. }
  559. .pos-order-goods .goods .picTxt .text .attr {
  560. width: 100%;
  561. overflow: hidden;
  562. white-space: nowrap;
  563. text-overflow: ellipsis;
  564. font-size: 24upx;
  565. color: #999;
  566. }
  567. .pos-order-goods .goods .money {
  568. width: 164upx;
  569. text-align: right;
  570. font-size: 28upx;
  571. }
  572. .pos-order-goods .goods .money .info {
  573. margin-top: 18rpx;
  574. font-size: 24rpx;
  575. }
  576. .pos-order-goods .goods .money .x-money {
  577. color: #282828;
  578. }
  579. .pos-order-goods .goods .money .num {
  580. color: #ff9600;
  581. margin: 5upx 0;
  582. }
  583. .pos-order-goods .goods .money .y-money {
  584. color: #999;
  585. text-decoration: line-through;
  586. }
  587. .public-total {
  588. font-size: 28upx;
  589. color: #282828;
  590. border-top: 1px solid #eee;
  591. height: 92upx;
  592. line-height: 92upx;
  593. text-align: right;
  594. padding: 0 30upx;
  595. background-color: #fff;
  596. }
  597. .public-total .money {
  598. color: #ff4c3c;
  599. }
  600. </style>