index.vue 13 KB

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