index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. <template>
  2. <view class="order" ref="container">
  3. <view class="navs">
  4. <view class="item" :class="type == '0' ? 'on' : ''" @click="settype('0')">待付款</view>
  5. <view class="item" :class="type == '1' ? 'on' : ''" @click="settype('1')">待配送</view>
  6. <view class="item" :class="type == '5' ? 'on' : ''" @click="settype('5')">待核销</view>
  7. <view class="item" :class="type == '3' ? 'on' : ''" @click="settype('3')">待评价</view>
  8. <view class="item" :class="type == '-3' ? 'on' : ''" @click="settype('-3')">退款</view>
  9. <view class="item" :class="type == '' ? 'on' : ''" @click="settype('')">全部</view>
  10. </view>
  11. <view class="cards">
  12. <view v-if="orderList.length">
  13. <view class="content" v-for="(item,index) in orderList">
  14. <view class="content_top pad" @click="toDetail(item)">
  15. <view class="content_top_left">
  16. <p>订单号:{{ item.order_id }}</p>
  17. <p class="time">下单时间:{{ item.add_time }}</p>
  18. </view>
  19. <view class="state" :class="(item.refund_status==0 && type !== 0 && item.refund.length)?'on':''">
  20. {{item.refund_status==1?'退款中':item.refund_status==2?'已退款':item.refund_status==3?'拒绝退款':item.status_name.status_name}}
  21. <text v-if="item.refund_status == 0 && type !== 0 && item.refund.length">{{item.is_all_refund?',退款中':',部分退款中'}}</text>
  22. </view>
  23. </view>
  24. <view class="content_font"></view>
  25. <view v-for="(val, key) in item._info" :key="key" @click="toDetail(item)">
  26. <view class="content_box acea-row row-between">
  27. <image :src="val.cart_info.productInfo.attrInfo?val.cart_info.productInfo.attrInfo.image:val.cart_info.productInfo.image" mode=""></image>
  28. <view class="content_box_title acea-row row-between">
  29. <view class="text_left acea-row row-between row-column">
  30. <view class="textbox line2"><text class="label" v-if="val.cart_info.is_gift">[赠品]</text>{{ val.cart_info.productInfo.store_name }}</view>
  31. <view class="attribute line1" v-if="val.cart_info.productInfo.attrInfo">属性:{{ val.cart_info.productInfo.attrInfo.suk }}</view>
  32. </view>
  33. <view class="text_right">
  34. <view>¥ {{ val.cart_info.productInfo.attrInfo?val.cart_info.productInfo.attrInfo.price:val.cart_info.productInfo.price }} </view>
  35. <view>x {{ val.cart_info.cart_num }}</view>
  36. <view class="info" v-if="val.cart_info.refund_num && item.refund_type !=6">{{val.cart_info.refund_num}}件退款中</view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="content_bottom">共{{ item.total_num }}件商品,实付款:<span class="money">¥{{ item.pay_price }}</span>( 邮费 ¥{{
  42. item.pay_postage
  43. }}
  44. )</view>
  45. <view class="content_btn">
  46. <view v-if="item._status == 1" class='box' :class="openErp?'on':''" @click="modify(item, 0)">一键改价</view>
  47. <view class='box' @click="modify(item, 1)">订单备注</view>
  48. <view v-if="item._status == 1 && item.pay_type == 'offline'" class='box' :class="openErp?'on':''" @click="offlinePay(item)">确认付款</view>
  49. <!-- && (item.split == null || item.split.length==0) 有子订单时加的这个条件 -->
  50. <view class="box boxblue" :class="openErp?'on':''" @click="modify(item, 2, 1)" v-if="(item.refund_type == 0 || item.refund_type == 1 || item.refund_type == 5) && type == -3 && parseFloat(item.pay_price) >= 0">
  51. 立即退款
  52. </view>
  53. <view class="box boxblue" :class="openErp?'on':''" @click="modify(item, 2, 0)" v-if="type == -3 && item.refund_type == 2">同意退货</view>
  54. <view class="wait" :class="openErp?'on':''" v-if="type == -3 && item.refund_type == 4">待用户发货</view>
  55. <view v-if="type == 1 && (item.shipping_type === 1 || item.shipping_type === 3) && (item.pinkStatus === null || item.pinkStatus === 2)" class='box boxblue' :class="openErp?'on':''" @click="goDelivery(item)">去发货</view>
  56. <!-- v-if="item._status == 2" -->
  57. </view>
  58. </view>
  59. </view>
  60. <view v-else class="nothing">
  61. <image v-if="!loading" :src="imgHost + '/statics/images/no-thing.png'" alt="">
  62. <view v-if="!loading">暂无记录</view>
  63. </view>
  64. <Loading :loaded="loaded" :loading="loading"></Loading>
  65. <PriceChange :change="change" :orderInfo="orderInfo" :isRefund="isRefund" v-on:statusChange="statusChange($event)" v-on:closechange="changeclose($event)" v-on:savePrice="savePrice"
  66. :status="status"></PriceChange>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. import { getOrderlistApi, getRefundMarkApi, getRefundlistApi, getOrderreMarkApi, getOrderPriceApi, getOrderOfflineApi, OrderRefund, storeRefundAgree } from '@/api/admin'
  72. import { erpConfig } from "@/api/esp.js";
  73. import PriceChange from '../../components/PriceChange/index.vue'
  74. import Loading from '@/components/Loading/index.vue'
  75. import { isMoney } from '@/utils/validate.js'
  76. import {HTTP_REQUEST_URL} from '@/config/app';
  77. export default {
  78. name: "order",
  79. components: {
  80. Loading,
  81. PriceChange
  82. },
  83. props: {},
  84. data: function() {
  85. return {
  86. openErp:false,
  87. orderList: [],
  88. type: '',
  89. page: 1,
  90. limit: 15,
  91. loading: false,
  92. loaded: false,
  93. change: false,
  94. orderInfo: {},
  95. status: "",
  96. isRefund:0, //1是仅退款;0是退货退款
  97. imgHost:HTTP_REQUEST_URL
  98. };
  99. },
  100. onLoad: function(options) {
  101. this.type = options.type;
  102. this.getErpConfig();
  103. },
  104. onShow(){
  105. this.settype(this.type);
  106. },
  107. computed: {
  108. },
  109. methods: {
  110. statusChange(e){
  111. this.status = e;
  112. },
  113. goDelivery(item){
  114. if(this.openErp) return
  115. uni.navigateTo({
  116. url: '/pages/admin/store/deliverGoods/index?id='+item.order_id+'&listId='+item.id+'&totalNum='+item.total_num+'&orderStatus='+item._status+'&comeType=1&productType='+item.product_type
  117. })
  118. },
  119. getErpConfig(){
  120. erpConfig().then(res=>{
  121. this.openErp = res.data.open_erp;
  122. }).catch(err=>{
  123. this.$util.Tips({
  124. title: err
  125. })
  126. })
  127. },
  128. settype:function(type) {
  129. this.type = type
  130. this.init()
  131. this.getList();
  132. },
  133. // 初始化
  134. init: function() {
  135. this.orderList = [];
  136. this.page = 1;
  137. this.loaded = false;
  138. this.loading = false;
  139. // this.getList();
  140. },
  141. getList: function(){
  142. if (this.loading || this.loaded) return;
  143. this.loading = true
  144. let data = {
  145. status: this.type,
  146. page: this.page,
  147. limit: this.limit
  148. }
  149. let obj = ''
  150. if(this.type == -3){
  151. obj = getRefundlistApi(data);
  152. }else{
  153. obj = getOrderlistApi(data);
  154. }
  155. obj.then(res=>{
  156. this.loading = false
  157. this.loaded = res.data.length < this.limit
  158. this.orderList.push.apply(this.orderList, res.data);
  159. this.page += 1
  160. })
  161. },
  162. onReachBottom(){
  163. this.getList()
  164. },
  165. toDetail(item){
  166. uni.navigateTo({
  167. url:`/pages/admin/store/orderDetail/index?id=${item.id}&types=${this.type}`
  168. })
  169. // console.log(item.order_id)
  170. },
  171. // 商品操作
  172. modify: function(item, status,type) {
  173. if(this.openErp && status !=1) return
  174. this.change = true;
  175. this.status = status.toString();
  176. this.orderInfo = item;
  177. if(status==2){
  178. this.isRefund = type
  179. }
  180. },
  181. changeclose: function(msg) {
  182. this.change = msg;
  183. },
  184. //确定付款
  185. offlinePay: function(item) {
  186. if(this.openErp) return
  187. getOrderOfflineApi({ order_id: item.order_id }).then(
  188. res => {
  189. this.$util.Tips({title:res.msg,icon:"success"});
  190. this.init();
  191. this.getList();
  192. },
  193. error => {
  194. this.$util.Tips(error);
  195. }
  196. );
  197. },
  198. objOrderRefund(data){
  199. let that = this;
  200. OrderRefund(data).then(
  201. res => {
  202. that.change = false;
  203. that.$util.Tips({title: res.msg});
  204. that.init();
  205. that.getList();
  206. },
  207. err => {
  208. that.change = false;
  209. that.$util.Tips({title: err});
  210. }
  211. );
  212. },
  213. async savePrice(opt) {
  214. let that = this,
  215. data = {},
  216. price = opt.price,
  217. refund_price = opt.refund_price,
  218. refund_status = that.orderInfo.refund_status,
  219. remark = opt.remark;
  220. data.order_id = that.orderInfo.order_id;
  221. if (that.status == 0) {
  222. if(!isMoney(price)){
  223. return that.$util.Tips({title: '请输入正确的金额'});
  224. }
  225. data.price = price;
  226. getOrderPriceApi(data).then(
  227. res => {
  228. that.change = false;
  229. that.$util.Tips({
  230. title:'改价成功',
  231. icon:'success'
  232. })
  233. this.init();
  234. this.getList()
  235. },
  236. err => {
  237. that.change = false;
  238. that.$util.Tips({
  239. title:'改价失败',
  240. icon:'none'
  241. })
  242. }
  243. );
  244. } else if (that.status == 2) {
  245. if(this.isRefund){
  246. if(!isMoney(refund_price)){
  247. return that.$util.Tips({title: '请输入正确的金额'});
  248. }
  249. data.price = refund_price;
  250. data.type = opt.type;
  251. this.objOrderRefund(data);
  252. // OrderRefund(data).then(
  253. // res => {
  254. // that.change = false;
  255. // that.$util.Tips({title: res.msg});
  256. // that.init();
  257. // that.getList();
  258. // },
  259. // err => {
  260. // that.change = false;
  261. // that.$util.Tips({title: err});
  262. // }
  263. // );
  264. }else{
  265. if(opt.type==1){
  266. storeRefundAgree(this.orderInfo.id).then(res=>{
  267. that.change = false;
  268. that.$util.Tips({
  269. title: res.msg
  270. });
  271. that.init();
  272. that.getList();
  273. }).catch(err=>{
  274. that.change = false;
  275. that.$util.Tips({
  276. title: err
  277. });
  278. })
  279. }
  280. }
  281. } else if (that.status == 8){
  282. data.type = opt.type;
  283. data.refuse_reason = opt.refuse_reason;
  284. this.objOrderRefund(data);
  285. } else {
  286. if(!remark){
  287. return this.$util.Tips({
  288. title:'请输入备注'
  289. })
  290. }
  291. data.remark = remark;
  292. let obj = '';
  293. if(that.type == -3){
  294. obj = getRefundMarkApi(data);
  295. }else{
  296. obj = getOrderreMarkApi(data);
  297. }
  298. obj.then(res=>{
  299. that.change = false;
  300. this.$util.Tips({
  301. title:res.msg,
  302. icon:'success'
  303. })
  304. }).catch(err=>{
  305. that.change = false;
  306. that.$util.Tips({title: err});
  307. })
  308. }
  309. }
  310. }
  311. }
  312. </script>
  313. <style lang="scss" scoped>
  314. .nothing{
  315. text-align: center;
  316. color: #cfcfcf;
  317. }
  318. .color1{color: #FF7E00;}
  319. .color2{color: #1890FF;}
  320. /*交易额统计*/
  321. .order .navs {
  322. width: 100%;
  323. height: 96upx;
  324. background-color: #fff;
  325. line-height: 96upx;
  326. position: fixed;
  327. top: 0;
  328. left: 0;
  329. z-index: 9;
  330. display: flex;
  331. justify-content: space-between;
  332. padding: 0upx 26upx;
  333. }
  334. .order .navs .item {
  335. font-size: 32upx;
  336. color: #282828;
  337. display: inline-block;
  338. }
  339. .order .navs .item.on {
  340. color: #2291f8;
  341. }
  342. .order .navs .item .iconfont {
  343. font-size: 25upx;
  344. margin-left: 13upx;
  345. }
  346. .order .cards{
  347. padding-top: 96upx;
  348. .content{
  349. margin: 28upx auto 16upx auto;
  350. width: 694upx;
  351. // height: 428upx;
  352. padding-bottom: 20upx;
  353. background: #FFFFFF;
  354. border-radius: 12upx;
  355. .pad{padding: 20upx 20upx 22upx;}
  356. .content_top{
  357. // height: 78upx;
  358. align-items: center;
  359. font-weight: 400;
  360. display: flex;
  361. justify-content: space-between;
  362. border-bottom: 2upx solid #F5F5F5;
  363. .state{
  364. color: #2291f8;
  365. &.on{
  366. font-size: 24rpx;
  367. width: 150rpx;
  368. text-align: right;
  369. }
  370. }
  371. .content_top_left{
  372. font-weight: bold;
  373. font-size: 30upx;
  374. .time{
  375. color: #666666;
  376. font-size: 24upx;
  377. }
  378. }
  379. .content_top_right{
  380. font-size: 30upx;
  381. // color: #1890FF;
  382. padding: 6upx 10upx;
  383. }
  384. }
  385. .content_font{
  386. font-size: 24upx;
  387. color: #666666;
  388. font-weight: 400;
  389. .txt{margin-bottom: 14upx;}
  390. }
  391. .content_box{
  392. // height: 70px;
  393. // background: #F5F5F5;
  394. border-radius: 8upx;
  395. // margin: 0upx 20upx 22upx;
  396. padding: 27upx;
  397. padding-right: 22upx;
  398. display: flex;
  399. justify-content: start;
  400. image{
  401. width: 140upx;
  402. height: 140upx;
  403. border-radius: 8upx;
  404. }
  405. .content_box_title{
  406. margin-left: 18upx;
  407. font-size: 20upx;
  408. font-weight: 400;
  409. width: 480rpx;
  410. display: flex;
  411. justify-content: space-between;
  412. font-size: 24upx;
  413. .textbox{
  414. text-overflow: ellipsis;
  415. overflow: hidden;
  416. .label{
  417. color: #F5222D;
  418. }
  419. }
  420. .text_left{
  421. width: 320rpx;
  422. }
  423. .text_right{
  424. text-align: right;
  425. .info{
  426. margin-top: 44rpx;
  427. font-size: 24rpx;
  428. }
  429. }
  430. .attribute{
  431. color: #999999;
  432. width: 340upx;
  433. text-overflow: ellipsis;
  434. overflow: hidden;
  435. }
  436. }
  437. }
  438. .content_bottom{
  439. text-align: right;
  440. font-size: 22upx;
  441. padding: 0upx 20upx;
  442. color: #666666;
  443. .money{
  444. font-size: 26upx;
  445. color: #F5222D;
  446. }
  447. }
  448. .content_btn{
  449. display: flex;
  450. padding: 28upx 28upx;
  451. padding-bottom: 0upx;
  452. justify-content: flex-end;
  453. .wait{
  454. margin-left: 20rpx;
  455. height: 60rpx;
  456. line-height: 60rpx;
  457. }
  458. .box{
  459. width: 172upx;
  460. height: 60upx;
  461. border-radius: 50upx;
  462. border: 2upx solid #EEEEEE;
  463. text-align: center;
  464. line-height: 60upx;
  465. color: #666666;
  466. margin: 0 10upx;
  467. &.on{
  468. color: #c5c8ce!important;
  469. background-color: #f7f7f7!important;
  470. border-color: #dcdee2!important;
  471. }
  472. }
  473. .boxblue{
  474. background-color: #1890FF;
  475. color: #FFFFFF;
  476. }
  477. }
  478. }
  479. }
  480. </style>