| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- import { cloudPrintOrder } from "@/api/order";
- export default {
- data(){
- return {
- }
- },
- computed:{
- },
- mounted () {
- },
- watch:{
- },
- methods: {
- toConfrim(params,title){
- let that = this
- that.$util.confirmModal({title: '订单完成',content:title},() => {
- that.toConfirmRequest(params)
- })
- },
- toConfirmRequest(params){
- let that = this
- confirmFinish(params).then((res) => {
- uni.showToast({title:res.msg,icon:'none'})
- if(res.code == 1){
- //订单变成完成
- that.list.data.forEach((item, index,array) => {
- if(item.id == params.id){
- array[index].status = '4'
- array[index].buttonList.forEach((it,ind,arr)=>{
- if(it.type == 'confirm'){
- arr[ind].disable = 1
- }
- })
- }
- });
- }
- })
- },
- // 免发货
- freeShipModalClick(e) {
- freeShipping({ id: this.operateData.id }).then((res) => {
- this._list();
- this.$msg("操作成功!");
- });
- },
- // 查看配送
- seeSendFn(item) {
- this.$util.pageTo({
- url: "/admin/order/ship",
- query: {
- id: item.id,
- pageStatus: 5,
- },
- });
- },
- orderEventBtn(s, item) {
- let that = this
- this.orderId=item.id;
- if (s.type === "selfGet") {
- this.operateData = item;
- let that = this;
- that.$util.confirmModal({content:'确认客户已自取?'},() => {
- that.freeShipModalClick();
- })
- //发货
- } else if (s.type === "send") {
- this.pageTo({
- url: "/pagesOrder/ship",
- query: {
- id: item.id,
- },
- });
- }else if (s.type === "print") {
- uni.showLoading({title: '打印中...'});
- cloudPrintOrder({id:item.id}).then((res) => {
- uni.hideLoading()
- if(res.code == 1){
- if(res.data.hasNoPrint == 1){
- that.$util.confirmModal({content:'请先设置打印机'},() => {
- that.$util.pageTo({url: "/admin/shop/print"})
- })
- return false
- }else{
- item.printNum++
- console.log('aaaa',item)
- }
- }
- })
- }else if(s.type == 'confirm'){
- let self = this;
- uni.showActionSheet({
- itemList: ['请选择结算方式:', '欠款', '已收款'],
- success: function (res) {
- if(res.tapIndex == 0){
- return false
- }
- let payWay = 0
- let title = res.tapIndex == 1 ? '确认客户欠款?' : '确认已收款?'
- //1欠款 2已收款
- let clearType = res.tapIndex == 1 ? 1 : 2;
- //选择的已收款,还需要选择收款方式
- if(clearType == 2){
- uni.showActionSheet({
- itemList: ['请选择收款方式:', '微信', '支付宝','现金','银行卡'],
- success: function (respond) {
- let currentIndex = respond.tapIndex
- let inWay = [{name:"未选择",id:-1},{name:"微信",id:0},{name:"支付宝",id:1},{name:"现金",id:4},{name:"银行卡",id:5}]
- if(currentIndex == 0){
- return false
- }
- payWay = inWay[currentIndex].id
- let params = {id:item.id,clearType:clearType,payWay:payWay}
- self.toConfrim(params,title)
- }
- })
- }else{
- let params = {id:item.id,clearType:clearType,payWay:payWay}
- self.toConfrim(params,title)
- }
- }
- });
- }else if(s.type == 'cancel'){
- let that = this;
- that.$util.confirmModal({content:'确认取消?'},() => {
- cancel({id:item.id}).then((res) => {
- uni.showToast({title:res.msg,icon:'none'})
- that._list();
- })
- })
- }
- },
- }
- }
|