Browse Source

订单列表优化

shish 4 years ago
parent
commit
baec114ff8

+ 2 - 153
hdPad/src/pages/home/components/orderInfo.vue

@@ -10,11 +10,6 @@
       </view>
       <view class="order-item">
 
-        <view v-if="beginCount > 0 && orderInfo.fromType == 4" style="min-height:35upx;height:auto;">
-          <text class="left">开始制作</text>
-          <text class="right" style="color:red;font-weight:bold;font-size:20upx;">{{beginCount}} 秒后</text>
-        </view>
-
         <view>
           <text class="left">配送</text>
           <text class="right" v-if="orderInfo.sendType == 1" style="color:red;font-weight:bold;">到店自取</text>
@@ -149,8 +144,7 @@
 </view>
 </template>
 <script>
-import { getFullInfo,finish,lockWork,cancelWork,print } from '@/api/work'
-import {modifyWastage} from '@/api/work-item'
+import { getDetail } from '@/api/order'
 import wastageSelectNum from './wastageSelectNum.vue'
 import { mapGetters } from "vuex";
 import productMins from "@/mixins/product";
@@ -196,7 +190,6 @@ export default {
     // #endif          
   },
 	destroyed(){
-
     if(this.INT){
       clearInterval(this.INT)
     }
@@ -212,106 +205,6 @@ export default {
 		previewImage(url){
 			uni.previewImage({urls:[url]})
 		},
-		calcFn(){
-			this.calc = this.calc == 'add' ? 'sub' : 'add'
-      		this.$emit('calcFn',this.calc)
-		},
-    printFn(item){
-      if(item.status ==1){
-        print({id:item.id}).then(res=>{
-          if(res.code == 1){
-            this.$msg(res.msg)
-          }
-        })
-      }
-    },
-    lockFn(info){
-      if(info.stockLock == 0){
-        this.$refs.lockWorkRef.open('center')
-      }
-    },
-    confirmLock(){
-      uni.showLoading({mask:true})
-      lockWork({id:this.orderInfo.id}).then(res=>{
-        uni.hideLoading()
-        if(res.code == 1){
-          this.$msg('已锁定')
-          this.getOrderDetail(this.orderInfo.id)
-        }
-      })
-    },
-    cancelFn(info){
-      this.$msg('开发中')
-      return false
-      this.$util.hitVoice()
-      if(info.status == 0){
-        this.$refs.cancelWorkRef.open('center')
-      }
-    },
-    confirmCancel(){
-      uni.showLoading({mask:true})
-      cancelWork({id:this.orderInfo.id}).then(res=>{
-        uni.hideLoading()
-        if(res.code == 1){
-          this.$msg('已取消')
-          this.getOrderDetail(this.orderInfo.id)
-        }
-      })
-    },
-    wastageFn(item){
-      this.customData = {...item,currentNum:1,property:1}
-      this.$refs.wastageSelectNumRef.open('center')
-      this.workItemId = item.id
-    },
-    confirmWastageSelectNum(info){
-      this.$refs.wastageSelectNumRef.close()
-      modifyWastage({...info,id:this.workItemId,num:info.currentNum}).then(res=>{
-        if(res.code == 1){
-           this.getOrderDetail(this.orderInfo.id)
-        }else{
-          this.$msg('报损失败,请重试')
-        }
-      })
-    },
-    cancelWastageSelectNum(){
-      this.$util.hitVoice()
-      this.$refs.wastageSelectNumRef.close()
-    },
-    finishFn(info){
-      this.$util.hitVoice()
-      if(info.status == 0){
-        this.$refs.finishRef.open('center')
-      }
-    },
-    confirmFinish(){
-      let params = {id:this.orderInfo.id}
-      if(!this.$util.isEmpty(this.selectList)){
-        const newItem = this.selectList.map(ele=>{
-          return {productId:ele.id,num:ele.currentNum,unitType:ele.unitType,unitPrice:ele.unitPrice}
-        })
-        params = {...params,itemList:JSON.stringify(newItem)}
-      }
-      uni.showLoading({mask:true})
-      finish(params).then(res=>{
-        uni.hideLoading()
-        if(res.code == 1){
-          this.$msg(res.msg)
-          this.getOrderDetail(this.orderInfo.id)
-          //完成之后刷新列表
-          this.$emit('finishNotice')
-        }
-      })
-    },
-    cancelFinish(){
-			this.$util.hitVoice()
-			this.$refs.finishWorkRef.close()
-    },
-    modifyItem(info){
-      if(info.stockLock == 0){
-        this.$util.hitVoice()
-        this.$util.pageTo({url:'/pages/home/modify',query: { id:info.id }})
-      }
-    },
     getStatus(status) {
       status = Number(status)
       switch (status) {
@@ -329,53 +222,9 @@ export default {
       }
     },
     getOrderDetail(id){
-
-      getFullInfo({id}).then(res=>{
+      getDetail({id}).then(res=>{
         if(res.code == 1){
           this.orderInfo = res.data.info
-
-          let that = this
-          this.beginCount = Number(this.orderInfo.beginCount)
-          if(this.beginCount > 0 && this.orderInfo.fromType ==4){
-            if(this.INT){
-              clearInterval(this.INT)
-            }
-            that.INT = setInterval(function(){
-              that.beginCount--
-              if(that.beginCount <= 0){
-                clearInterval(that.INT)
-              }
-            },1000)
-          }
-
-          let bigNum = 0
-          let smallNum = 0
-          this.orderItem = res.data.item
-          if(!this.$util.isEmpty(this.orderItem)){
-            for (const ele of this.orderItem) {
-              if(ele.unitType ==0){
-                bigNum = bigNum + Number(ele.num)
-              }else{
-                smallNum = smallNum + Number(ele.num)
-              }
-            }
-            bigNum = bigNum.toFixed()
-            smallNum = smallNum.toFixed()
-          }
-
-  				if(this.orderItem && !this.$util.isEmpty(this.orderItem)){
-						const newItem = this.orderItem.map(ele=>{
-							return {name:ele.name,cover:ele.cover,shortCover:ele.shortCover,itemId:ele.ptItemId,id:ele.itemId,unitName:ele.unitName,unitType:ele.unitType,
-              unitPrice:ele.unitPrice,ratio:ele.ratio,mainId:ele.mainId,currentNum:ele.num,bigUnit:ele.bigName,smallUnit:ele.smallName,property:1}
-						})
-  					this.pushToSave(newItem)
-          }
-
-          this.unitUseItem = {bigNum,smallNum}
-          let orderNum = this.orderInfo.num || 0
-          let totalBig = (bigNum*Number(orderNum)).toFixed()
-          let totalSmall = (smallNum*Number(orderNum)).toFixed()
-          this.totalUseItem = {bigNum:totalBig,smallNum:totalSmall}
         }
       })
     }

+ 9 - 12
hdPad/src/pages/home/components/orderList.vue

@@ -78,7 +78,7 @@ export default {
         }
     },
     created(){
-        this.getWorkInfoList()
+        this.getOrderInfoList()
         if(this.mt == 'yes'){
             this.snTitle = '美团编号'
         }
@@ -92,12 +92,12 @@ export default {
             //有新制作单时自动刷新
             let that = this
             this.t = setInterval(function () {
-                that.getWorkInfoList(1)
+                that.getOrderInfoList(1)
             },5000)
         },
         refreshList(){
             this.resetList()
-            this.getWorkInfoList()
+            this.getOrderInfoList()
         },
         dialogInputConfirm(val){
             this.resetList()
@@ -106,7 +106,7 @@ export default {
             }else{
                 this.sn = val
             }
-            this.getWorkInfoList()
+            this.getOrderInfoList()
         },
         select(){
             this.$refs.inputDialog.open('center')
@@ -121,7 +121,7 @@ export default {
                 this.triggered = true
             }
             this.resetList()
-            this.getWorkInfoList()
+            this.getOrderInfoList()
             setTimeout(() => {
                 //触发onRestore,并关闭刷新图标  
                 this.triggered = false
@@ -146,22 +146,19 @@ export default {
             }
             this.status = status
             this.resetList()
-            this.getWorkInfoList()
+            this.getOrderInfoList()
         },
         reachBottom() {
             if (!this.list.finished) {
-                this.getWorkInfoList().then((res) => {
+                this.getOrderInfoList().then((res) => {
                     uni.stopPullDownRefresh();
                 });
             } else {
                 uni.stopPullDownRefresh();
             }
         },
-        getWorkInfoList(type=0){
+        getOrderInfoList(type=0){
             let params = {page: this.list.page,pageSize:50,status:this.status,sn:this.sn,thirdSn:this.thirdSn,isCashier:1}
-            if(this.mt == 'yes'){
-                params = {...params,fromType:4}
-            }
             return getList(params).then(res=>{
                 if(res.code == 1){
                     if(type == 1){
@@ -170,7 +167,7 @@ export default {
                     }
                     this.completes(res)
                     if(this.list.data && this.list.data[0]){
-                        //this.getOrderInfo(this.list.data[0])
+                        this.getOrderInfo(this.list.data[0])
                     }
                 }
             })