王志国
3 weeks ago
4 changed files with 256 additions and 68 deletions
@ -0,0 +1,158 @@ |
|||
<template> |
|||
<view class="" style="background-color: #fff;"> |
|||
|
|||
<item-qty :dataContent="dataContent" :handleQty="dataContent.handleQty"></item-qty> |
|||
|
|||
<view class='split_line'></view> |
|||
<view class="" v-for="(item,index) in dataContent.subList"> |
|||
<uni-swipe-action ref="swipeAction"> |
|||
<uni-swipe-action-item @click="swipeClick($event,item)" |
|||
:right-options="item.scaned?scanOptions:detailOptions"> |
|||
<recommendBatch :detail="item"></recommendBatch> |
|||
</uni-swipe-action-item> |
|||
</uni-swipe-action> |
|||
<view class='split_line'></view> |
|||
</view> |
|||
|
|||
|
|||
<balance-qty-edit ref="qtyEdit" :settingParam="settingParam" @confirm="confirm"></balance-qty-edit> |
|||
<scrap-detail-info-popup ref="jobDetailPopup" :dataContent="showItem"></scrap-detail-info-popup> |
|||
<comMessage ref="message"></comMessage> |
|||
</view> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import itemQty from '@/mycomponents/item/itemQty.vue' |
|||
import recommend from '@/mycomponents/recommend/recommend.vue' |
|||
import recommendBatch from '@/mycomponents/recommend/recommendBatch.vue' |
|||
import jobDetailPopup from '@/mycomponents/detail/jobDetailPopup.vue' |
|||
import scrapDetailInfoPopup from '@/pages/scrap/coms/scrapDetailInfoPopup.vue' |
|||
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' |
|||
import location from '@/mycomponents/balance/location.vue' |
|||
import toLocation from '@/mycomponents/balance/toLocation.vue' |
|||
import batch from '@/mycomponents/balance/batch.vue' |
|||
import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue' |
|||
import config from '@/static/config.js' |
|||
|
|||
import { |
|||
getRemoveOption, |
|||
getEditRemoveOption, |
|||
getDetailEditRemoveOption, |
|||
} from '@/common/array.js'; |
|||
|
|||
import {ref, watch, onMounted} from 'vue'; |
|||
|
|||
// 定义 props |
|||
const props = defineProps({ |
|||
dataContent: { |
|||
type: Object, |
|||
default: () => ({}) |
|||
}, |
|||
settingParam: { |
|||
type: Object, |
|||
default: () => ({}) |
|||
}, |
|||
isEdit: { |
|||
type: Boolean, |
|||
default: true |
|||
} |
|||
}); |
|||
const emit = defineEmits(['remove', 'updateData']); |
|||
|
|||
const showItem = ref({}); |
|||
const editItem = ref({ |
|||
record: {} |
|||
}); |
|||
const detailOptions = ref([]); |
|||
const scanOptions = ref([]); |
|||
const options = ref([]); |
|||
const removeOptions = ref([]); |
|||
const editAndRemoveOptions = ref([]); |
|||
|
|||
const qtyEdit = ref(null); |
|||
const jobDetailPopup = ref(null); |
|||
const message = ref(null); |
|||
|
|||
onMounted(() => { |
|||
scanOptions.value = getDetailEditRemoveOption(); |
|||
removeOptions.value = getRemoveOption(); |
|||
editAndRemoveOptions.value = getEditRemoveOption(); |
|||
}); |
|||
|
|||
const swipeClick = (e, item) => { |
|||
if (e.content.text == "详情") { |
|||
detail(item); |
|||
} else if (e.content.text == "编辑") { |
|||
edit(item); |
|||
} else if (e.content.text == "移除") { |
|||
remove(item); |
|||
} |
|||
}; |
|||
|
|||
const edit = (item) => { |
|||
editItem.value = item; |
|||
qtyEdit.value.openEditPopup(item.balance, item.handleQty); |
|||
}; |
|||
|
|||
const detail = (item) => { |
|||
showItem.value = item; |
|||
console.log("提交参数", JSON.stringify(item)); |
|||
jobDetailPopup.value.openPopup(item); |
|||
}; |
|||
|
|||
const remove = (item) => { |
|||
message.value.showQuestionMessage("确定移除扫描信息?", res => { |
|||
if (res) { |
|||
item.scaned = false; |
|||
emit('remove', item); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
const confirm = (qty) => { |
|||
editItem.value.handleQty = qty; |
|||
emit('updateData'); |
|||
}; |
|||
|
|||
const isDevlement = () => { |
|||
return config.isDevelopment; |
|||
}; |
|||
|
|||
const copy = (detail) => { |
|||
console.log(detail); |
|||
const content = `HPQ;V1.0;I${detail.itemCode};P${detail.packingNumber};B${detail.batch};Q${detail.qty}`; |
|||
|
|||
// #ifdef H5 |
|||
navigator.clipboard.writeText(content).then( |
|||
() => { |
|||
uni.showToast({ |
|||
title: '复制采购标签成功', |
|||
icon: 'none' |
|||
}); |
|||
}, |
|||
() => { |
|||
uni.showToast({ |
|||
title: '复制失败', |
|||
icon: 'none' |
|||
}); |
|||
} |
|||
); |
|||
// #endif |
|||
|
|||
// #ifndef H5 |
|||
uni.setClipboardData({ |
|||
data: content, |
|||
success: () => { |
|||
uni.showToast({ |
|||
title: '复制采购标签成功' |
|||
}); |
|||
} |
|||
}); |
|||
// #endif |
|||
}; |
|||
|
|||
</script> |
|||
|
|||
|
|||
<style> |
|||
</style> |
Loading…
Reference in new issue