|
|
@@ -27,22 +27,24 @@
|
|
|
</view>
|
|
|
<view class="work-item-detail">
|
|
|
|
|
|
- <view class="flex-space right-detail-title" v-if="getMyShopInfo.stockModel && getMyShopInfo.stockModel == 1">每份用材</view>
|
|
|
- <view class="flex-space right-detail-title" v-else>使用花材</view>
|
|
|
+ <view class="flex-space right-detail-title" v-if="getMyShopInfo.stockModel && getMyShopInfo.stockModel == 1">每份用材
|
|
|
+ <text v-if="orderInfo.stockLock && orderInfo.stockLock == 1 && orderInfo.status == 0" style="color:red;">(不可修改)</text></view>
|
|
|
+ <view class="flex-space right-detail-title" v-else>使用花材
|
|
|
+ <text v-if="orderInfo.stockLock && orderInfo.stockLock == 1 && orderInfo.status == 0" style="color:red;">(不可修改)</text></view>
|
|
|
|
|
|
<view class="unit-use-item">
|
|
|
<view class="commodity-list">
|
|
|
- <view v-for="(s, idx) in orderItem" :key="idx" class="commodity-item" >
|
|
|
+ <view v-for="(s, idx) in selectList" :key="idx" class="commodity-item" >
|
|
|
<image class="item-icon" :src="s.cover" @click="pageTo({url:'/admin/item/detail',query:{id: s.id}})"></image>
|
|
|
<view class="item-info">
|
|
|
<view class="info-line">
|
|
|
<text class="item-name">{{ s.name }}</text>
|
|
|
<text class="item-price">
|
|
|
- <text class="unit">{{s.num}}{{s.unitName}}</text>
|
|
|
+ <text class="unit">{{s.currentNum}}{{s.unitName}}</text>
|
|
|
</text>
|
|
|
</view>
|
|
|
<view class="info-line">
|
|
|
- <text class="item-type">{{s.ratio}}{{s.smallName}}/{{s.bigName}}</text>
|
|
|
+ <text class="item-type">{{s.ratio}}{{s.smallUnit}}/{{s.bigUnit}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -55,17 +57,17 @@
|
|
|
|
|
|
<view class="total-use-item" v-if="getMyShopInfo.stockModel && getMyShopInfo.stockModel == 1">
|
|
|
<view class="commodity-list">
|
|
|
- <view v-for="(s, idx) in orderItem" :key="idx" class="commodity-item" >
|
|
|
+ <view v-for="(s, idx) in selectList" :key="idx" class="commodity-item" >
|
|
|
<image class="item-icon" :src="s.cover" @click="pageTo({url:'/admin/item/detail',query:{id: s.id}})" />
|
|
|
<view class="item-info">
|
|
|
<view class="info-line">
|
|
|
<text class="item-name">{{ s.name }}</text>
|
|
|
<text class="item-price">
|
|
|
- <text class="unit">{{(s.num*orderInfo.num).toFixed()}}{{s.unitName}}</text>
|
|
|
+ <text class="unit">{{(s.currentNum*orderInfo.num).toFixed()}}{{s.unitName}}</text>
|
|
|
</text>
|
|
|
</view>
|
|
|
<view class="info-line">
|
|
|
- <text class="item-type">{{s.ratio}}{{s.smallName}}/{{s.bigName}}</text>
|
|
|
+ <text class="item-type">{{s.ratio}}{{s.smallUnit}}/{{s.bigUnit}}</text>
|
|
|
<text style="font-size:9upx;position:relative;right:80upx;top:10upx;" v-if="Number(s.wastNum)>0">{{s.wastNum}}{{s.wastUnitName}}</text>
|
|
|
<button class="wastage" @click="wastageFn(s)">报损</button>
|
|
|
</view>
|
|
|
@@ -78,8 +80,9 @@
|
|
|
</view>
|
|
|
|
|
|
<view class="button-area">
|
|
|
- <view :class="[orderInfo.status != 2 && orderInfo.stockLock==0 ? 'active' : '']" @click="lockFn(orderInfo)">锁定</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(orderInfo)">锁定</view> -->
|
|
|
+ <view class="active" @click="calcFn">{{calc == 'add' ? '+' : '-'}}</view>
|
|
|
+ <!-- <view :class="[orderInfo.status != 2 && orderInfo.stockLock==0 ? 'active' : '']" @click="modifyItem(orderInfo)">修改</view> -->
|
|
|
<view :class="[orderInfo.status==0 ? 'active' : '']" @tap="finishFn(orderInfo)">完成</view>
|
|
|
<view :class="[orderInfo.status==1 ? 'active' : '']" @click="printFn(orderInfo)">打印</view>
|
|
|
<view :class="[orderInfo.status==0 ? 'active' : '']" @click="cancelFn(orderInfo)">取消</view>
|
|
|
@@ -111,8 +114,9 @@ import { getFullInfo,finish,lockWork,cancelWork,print } from '@/api/work'
|
|
|
import {modifyWastage} from '@/api/work-item'
|
|
|
import wastageSelectNum from './wastageSelectNum.vue'
|
|
|
import { mapGetters } from "vuex";
|
|
|
+import productMins from "@/mixins/product";
|
|
|
export default {
|
|
|
- name: "orderInfo",
|
|
|
+ name: "workInfo",
|
|
|
components: {wastageSelectNum},
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -122,13 +126,46 @@ export default {
|
|
|
totalUseItem:{bigNum:0,smallNum:0},
|
|
|
customData:{},
|
|
|
workItemId:0,
|
|
|
- today:''
|
|
|
+ today:'',
|
|
|
+ currentJobType:'modify',
|
|
|
+ currentJobId:0
|
|
|
}
|
|
|
},
|
|
|
+ props: {
|
|
|
+ selectOrderId:{
|
|
|
+ type: Number,
|
|
|
+ default: 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mixins: [productMins],
|
|
|
computed:{
|
|
|
...mapGetters(["getMyShopInfo"]),
|
|
|
},
|
|
|
+ watch:{
|
|
|
+ selectOrderId: {
|
|
|
+ handler(newId,oldId) {
|
|
|
+ this.currentJobId = Number(oldId)
|
|
|
+ this.removeFromSaveDirect()
|
|
|
+ this.currentJobId = Number(newId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ this.listenScanItem()
|
|
|
+ // #endif
|
|
|
+ },
|
|
|
+ destroyed(){
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ //避免重复,每次进来先移除全局自定义事件监听器
|
|
|
+ uni.$off('listenGetScanCode')
|
|
|
+ // #endif
|
|
|
+ this.removeFromSaveDirect()
|
|
|
+ },
|
|
|
methods:{
|
|
|
+ calcFn(){
|
|
|
+ this.calc = this.calc == 'add' ? 'sub' : 'add'
|
|
|
+ },
|
|
|
printFn(item){
|
|
|
if(item.status ==1){
|
|
|
print({id:item.id}).then(res=>{
|
|
|
@@ -192,8 +229,16 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
confirmFinish(){
|
|
|
+
|
|
|
+ if(this.$util.isEmpty(this.selectList)){
|
|
|
+ this.$msg('请选择花材')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ const newItem = this.selectList.map(ele=>{
|
|
|
+ return {productId:ele.id,num:ele.currentNum,unitType:ele.unitType,unitPrice:ele.unitPrice}
|
|
|
+ })
|
|
|
uni.showLoading({mask:true})
|
|
|
- finish({id:this.orderInfo.id}).then(res=>{
|
|
|
+ finish({id:this.orderInfo.id,itemList:JSON.stringify(newItem)}).then(res=>{
|
|
|
uni.hideLoading()
|
|
|
if(res.code == 1){
|
|
|
this.$msg(res.msg)
|
|
|
@@ -228,13 +273,14 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
getOrderDetail(id){
|
|
|
+
|
|
|
getFullInfo({id}).then(res=>{
|
|
|
if(res.code == 1){
|
|
|
this.orderInfo = res.data.info
|
|
|
- this.orderItem = res.data.item
|
|
|
this.today = res.data.today
|
|
|
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){
|
|
|
@@ -246,6 +292,15 @@ export default {
|
|
|
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()
|