order.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. import { cloudPrintOrder } from "@/api/order";
  2. export default {
  3. data(){
  4. return {
  5. }
  6. },
  7. computed:{
  8. },
  9. mounted () {
  10. },
  11. watch:{
  12. },
  13. methods: {
  14. toConfrim(params,title){
  15. let that = this
  16. that.$util.confirmModal({title: '订单完成',content:title},() => {
  17. that.toConfirmRequest(params)
  18. })
  19. },
  20. toConfirmRequest(params){
  21. let that = this
  22. confirmFinish(params).then((res) => {
  23. uni.showToast({title:res.msg,icon:'none'})
  24. if(res.code == 1){
  25. //订单变成完成
  26. that.list.data.forEach((item, index,array) => {
  27. if(item.id == params.id){
  28. array[index].status = '4'
  29. array[index].buttonList.forEach((it,ind,arr)=>{
  30. if(it.type == 'confirm'){
  31. arr[ind].disable = 1
  32. }
  33. })
  34. }
  35. });
  36. }
  37. })
  38. },
  39. // 免发货
  40. freeShipModalClick(e) {
  41. freeShipping({ id: this.operateData.id }).then((res) => {
  42. this._list();
  43. this.$msg("操作成功!");
  44. });
  45. },
  46. // 查看配送
  47. seeSendFn(item) {
  48. this.$util.pageTo({
  49. url: "/admin/order/ship",
  50. query: {
  51. id: item.id,
  52. pageStatus: 5,
  53. },
  54. });
  55. },
  56. orderEventBtn(s, item) {
  57. let that = this
  58. this.orderId=item.id;
  59. if (s.type === "selfGet") {
  60. this.operateData = item;
  61. let that = this;
  62. that.$util.confirmModal({content:'确认客户已自取?'},() => {
  63. that.freeShipModalClick();
  64. })
  65. //发货
  66. } else if (s.type === "send") {
  67. this.pageTo({
  68. url: "/pagesOrder/ship",
  69. query: {
  70. id: item.id,
  71. },
  72. });
  73. }else if (s.type === "print") {
  74. uni.showLoading({title: '打印中...'});
  75. cloudPrintOrder({id:item.id}).then((res) => {
  76. uni.hideLoading()
  77. if(res.code == 1){
  78. if(res.data.hasNoPrint == 1){
  79. that.$util.confirmModal({content:'请先设置打印机'},() => {
  80. that.$util.pageTo({url: "/admin/shop/print"})
  81. })
  82. return false
  83. }else{
  84. item.printNum++
  85. console.log('aaaa',item)
  86. }
  87. }
  88. })
  89. }else if(s.type == 'confirm'){
  90. let self = this;
  91. uni.showActionSheet({
  92. itemList: ['请选择结算方式:', '欠款', '已收款'],
  93. success: function (res) {
  94. if(res.tapIndex == 0){
  95. return false
  96. }
  97. let payWay = 0
  98. let title = res.tapIndex == 1 ? '确认客户欠款?' : '确认已收款?'
  99. //1欠款 2已收款
  100. let clearType = res.tapIndex == 1 ? 1 : 2;
  101. //选择的已收款,还需要选择收款方式
  102. if(clearType == 2){
  103. uni.showActionSheet({
  104. itemList: ['请选择收款方式:', '微信', '支付宝','现金','银行卡'],
  105. success: function (respond) {
  106. let currentIndex = respond.tapIndex
  107. let inWay = [{name:"未选择",id:-1},{name:"微信",id:0},{name:"支付宝",id:1},{name:"现金",id:4},{name:"银行卡",id:5}]
  108. if(currentIndex == 0){
  109. return false
  110. }
  111. payWay = inWay[currentIndex].id
  112. let params = {id:item.id,clearType:clearType,payWay:payWay}
  113. self.toConfrim(params,title)
  114. }
  115. })
  116. }else{
  117. let params = {id:item.id,clearType:clearType,payWay:payWay}
  118. self.toConfrim(params,title)
  119. }
  120. }
  121. });
  122. }else if(s.type == 'cancel'){
  123. let that = this;
  124. that.$util.confirmModal({content:'确认取消?'},() => {
  125. cancel({id:item.id}).then((res) => {
  126. uni.showToast({title:res.msg,icon:'none'})
  127. that._list();
  128. })
  129. })
  130. }
  131. },
  132. }
  133. }