shish 4 лет назад
Родитель
Сommit
72f0a8156c
2 измененных файлов с 59 добавлено и 24 удалено
  1. 8 0
      hdPad/src/api/work/index.js
  2. 51 24
      hdPad/src/pages/home/components/orderInfo.vue

+ 8 - 0
hdPad/src/api/work/index.js

@@ -14,3 +14,11 @@ export const getFullInfo = data => {
 export const finish = data =>{
 	return https.post('/work/finish', data)
 }
+
+export const lockWork = data => {
+	return https.get('/work/lock', data)
+}
+
+export const cancelWork = data => {
+	return https.get('/work/cancel', data)
+}

+ 51 - 24
hdPad/src/pages/home/components/orderInfo.vue

@@ -84,8 +84,8 @@
 
       <view class="button-area">
         <view :class="[orderInfo.status==0 ? 'active' : '']" @tap="finishFn()">完成</view>
-        <view :class="[orderInfo.stockLock==0 ? 'active' : '']" @click="modifyItem(orderInfo)">修改</view>
-        <view :class="[orderInfo.stockLock==0 ? 'active' : '']" @click="lockFn()">锁定</view>
+        <view :class="[orderInfo.status != 2 && orderInfo.stockLock==0 ? 'active' : '']" @click="modifyItem(orderInfo)">修改</view>
+        <view :class="[orderInfo.status != 2 && orderInfo.stockLock==0 ? 'active' : '']" @click="lockFn()">锁定</view>
         <view :class="[orderInfo.status==1 ? 'active' : '']" @click="printFn()">打印</view>
         <view :class="[orderInfo.status==0 ? 'active' : '']" @click="cancelFn()">取消</view>
       </view>
@@ -96,11 +96,19 @@
           @cancelWastageSelectNum="cancelWastageSelectNum"></wastageSelectNum>
       </uni-popup>
 
+      <uni-popup ref="cancelWorkRef" type="dialog">
+          <uni-popup-dialog type="info" cancelText="取消" confirmText="确认" title="提示" content="确认取消?" @confirm="confirmCancel"></uni-popup-dialog>
+      </uni-popup>
+
+      <uni-popup ref="lockWorkRef" type="dialog">
+          <uni-popup-dialog type="info" cancelText="取消" confirmText="确认" title="提示" content="确认锁定?" @confirm="confirmLock"></uni-popup-dialog>
+      </uni-popup>
+
   </view>
 </view>
 </template>
 <script>
-import { getFullInfo,finish } from '@/api/work'
+import { getFullInfo,finish,lockWork,cancelWork } from '@/api/work'
 import {modifyWastage} from '@/api/work-item'
 import wastageSelectNum from './wastageSelectNum.vue'
 export default {
@@ -136,13 +144,33 @@ export default {
   },
   methods:{
     printFn(){
-
+      this.$msg('开发中')
     },
     lockFn(){
-
+      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(){
-
+      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}
@@ -160,11 +188,9 @@ export default {
       })
     },
     finishFn(){
-
-    },
-    confirmFinish(form){
-      this.$refs.finishWorkRef.close()
-      finish({...form,id:this.orderInfo.id}).then(res=>{
+      uni.showLoading({mask:true})
+      finish({id:this.orderInfo.id}).then(res=>{
+        uni.hideLoading()
         if(res.code == 1){
           this.$msg(res.msg)
           this.getOrderDetail(this.orderInfo.id)
@@ -180,19 +206,20 @@ export default {
       this.$util.pageTo({url:'/pages/home/modify',query: { id:info.id }})
     },
     getStatus(status) {
-        switch (status) {
-            case "0":
-            return "待完成";
-            break;
-            case "1":
-            return "已完成";
-            break;
-            case "2":
-            return "已取消";
-            break;
-            default:
-            return "待完成";
-        }
+      status = Number(status)
+      switch (status) {
+          case 0:
+          return "待完成";
+          break;
+          case 1:
+          return "已完成";
+          break;
+          case 2:
+          return "已取消";
+          break;
+          default:
+          return "待完成";
+      }
     },
     getOrderDetail(id){
       getFullInfo({id}).then(res=>{