index.vue 15 KB

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