| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427 |
- <template>
- <gui-page :custom-header="true" :header-class="['gui-theme-background-color']">
- <template #gHeader>
- <view style="height:44px;" class="gui-flex gui-nowrap gui-rows gui-align-items-center">
- <!-- 使用组件实现返回按钮及返回首页按钮 -->
- <text style="font-size:44rpx;" class="gui-header-leader-btns gui-color-white font-icons"
- @tap="goBack"></text>
- <!-- 导航文本此处也可以是其他自定义内容 -->
- <text class="gui-flex1 gui-text-center gui-color-white">半成品签收【签收人:{{ scanPersonName }}】</text>
- <!-- 此处加一个右侧展位元素与左侧同宽,实现标题居中 -->
- <!-- 实际宽度请根据自己情况设置 -->
- <view style="width:40px;">
- <uni-easyinput v-model="batchNumber" type="text" class="hidden-focus" ref="scanRefs" focus @confirm="handleConfirmText" />
- </view>
- <!-- 如果右侧有其他内容可以利用条件编译和定位来实现-->
- </view>
- </template>
- <template #gBody>
- <view class="list-content">
- <div class="operation-header">
- <view class="operation-header-item">
- <text>条码号</text>
- <text>{{ formData.batchNumber }}</text>
- </view>
- <view class="operation-header-item">
- <text>产品名称</text>
- <text>{{ formData.productName }}</text>
- </view>
- <view class="operation-header-item">
- <text>条码数/已扫入总数</text>
- <text>{{ computedSumQty }}</text>
- </view>
- <view v-if="!scanPersonId" class="operation-header-item-tips">
- <text><text class="font-icons"></text>请扫描签收人员厂牌完成签收</text>
- </view>
- <view v-else class="operation-header-item-tips-success">
- <text><text class="font-icons"></text>已扫描员工码,可进行签收</text>
- </view>
- </div>
- <view class="collapsed-panel">
- <div class="collapsed-title">
- <text><text class="font-icons"></text>已签收列表</text>
- </div>
- <template v-if="cardList.length > 0">
- <div class="collapsed-item" v-for="item in cardList" :key="item.id"
- @click="handleShowDetail(item)">
- <text>{{ item.batchNumber }}/ {{ item.productName }}/ {{ item.boxQty }} PCS</text>
- </div>
- </template>
- <view v-else>
- <view class="bg-image">
- <image src="@/static/empty.png" mode="heightFix" />
- <text>这里什么都没有...</text>
- </view>
- </view>
- </view>
- </view>
- <uni-popup ref="errorTip" type="dialog">
- <uni-popup-dialog type="error" cancel-text="关闭" confirm-text="确认" title="提示" :content="errorTipMessage"
- @confirm="handleCloseErrorTipsModal" @close="handleCloseErrorTipsModal" />
- </uni-popup>
- </template>
- </gui-page>
- </template>
- <script>
- import {
- computed,
- reactive,
- defineComponent,
- onBeforeMount,
- toRefs,
- ref
- } from 'vue'
- import tsc from '@/unit/CHITEN_SDK_APP/tsc.js'
- import {
- onMounted
- } from 'vue';
- export default defineComponent({
- setup(options) {
- const errorState = ref(0)
- const errorTip = ref('')
- const errorTipMessage = ref('')
- const formData = ref({
- batchNumber: null,
- productName: null,
- boxQty: 0,
- sumQty: 0
- })
- const cardList = ref([])
- // 隐藏输入框
- const scanRefs = ref()
- const queryParams = reactive({
- batchNumber: '',
- scanPersonId: null,
- scanPersonName: '未绑定',
- })
- // 条码数/总数
- const computedSumQty = computed(() => {
- return formData.value.boxQty + '/' + formData.value.sumQty + ' PCS'
- })
- onMounted(() => {
- // 每3s自动定位到扫码框
- setInterval(() => {
- if (scanRefs.value.focusShow) {
- // #ifdef APP-PLUS
- setTimeout(() => {
- uni.hideKeyboard()
- }, 100)
- // #endif
- } else {
- scanRefs.value.onBlur()
- scanRefs.value.onFocus()
- }
- }, 1000)
- })
- // 获取签收列表
- const search = function() {
- uni.$reqGet('getProductMiddleDetailPage', {
- signStatus: 1,
- signPersonId: queryParams.scanPersonId,
- })
- .then(async ({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- cardList.value = data?.list ?? [];
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = 0
- }
- })
- }
- const goBack = function() {
- uni.$goBack('/pages/workbranch/warehouse/SemiFinishedProducts/indexPage')
- }
- const handleScanProductMiddle = function() {
- uni.$reqPost("scanProductMiddleDetailSign", {
- batchNumber: queryParams.batchNumber,
- signPersonId: queryParams.scanPersonId,
- signPerson: queryParams.scanPersonName
- })
- .then(async ({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- search()
- setInputFocus()
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = -1
- }
- })
- }
- const handleConfirmText = function(e) {
- // 扫码签收
- if (queryParams.scanPersonId && queryParams.scanPersonName) {
- // 存在员工码,扫码签收
- handleScanProductMiddle(e)
- } else {
- uni.$reqGet("getEmployeeMaster", {
- id: e
- })
- .then(async ({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- // 绑定员工
- if (!!data) {
- queryParams.scanPersonId = data.id
- queryParams.scanPersonName = data.employeeName
- search()
- setInputFocus()
- }
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = '员工码不正确,请检查!'
- errorTip.value.open()
- errorState.value = -1
- }
- })
- }
- }
- // 详情
- const handleShowDetail = function(ret) {
- Object.assign(formData.value, ret)
- }
- // 禁用软键盘
- const handleInputFocus = function() {
- // #ifdef APP-PLUS
- setTimeout(() => {
- uni.hideKeyboard()
- }, 100)
- // #endif
- }
- const setInputFocus = function() {
- queryParams.batchNumber = ''
- scanRefs.value.onBlur()
- scanRefs.value.onFocus()
- }
- // 关闭错误信息弹窗
- const handleCloseErrorTipsModal = async function() {
- errorTip.value.close()
- if (errorState.value === 0) {
- await setInputFocus()
- }
- }
- return {
- options: [{
- text: '删除',
- style: {
- backgroundColor: '#dd524d'
- }
- }],
- scanRefs,
- ...toRefs(queryParams),
- formData,
- cardList,
- goBack,
- errorTip,
- computedSumQty,
- handleShowDetail,
- errorTipMessage,
- handleInputFocus,
- handleConfirmText,
- handleCloseErrorTipsModal,
- }
- }
- })
- </script>
- <style lang="scss" scoped>
- .gui-header-leader-btns {
- color: black;
- margin-left: 24rpx;
- font-size: 24px !important;
- }
- .list-content {
- margin-top: 68px;
- min-height: calc(100vh - 68px);
- position: relative;
- background-color: #edeeee;
- }
- .input-200 {
- width: 200px;
- padding-left: 10px;
- }
- .icon-scan {
- font-size: 20px;
- text-align: right;
- }
- .scan {
- height: 45px;
- width: calc(100% - 48px);
- margin: 12px;
- padding: 0 12px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- border-radius: 6px;
- background-color: white;
- .scan-card {
- width: 100%;
- display: grid;
- grid-template-rows: 1fr;
- grid-template-columns: 7fr 2fr;
- align-items: center;
- input {
- height: 35px;
- line-height: 35px;
- }
- text {
- width: 100%;
- text-align: right;
- }
- }
- }
- span,
- text {
- font-size: 12px;
- }
-
-
- .collapsed-panel {
- // height: calc(100vh - 190px);
- width: calc(100vw - 24px);
- min-height: 230px;
- position: absolute;
- top: 105px;
- // bottom: 70px;
- bottom: 0px;
- padding: 0 12px;
- border-radius: 15px 15px 0 0;
- background-color: white;
- overflow-y: scroll;
-
- .collapsed-title {
- font-size: 14px;
- font-weight: bold;
- padding: 8px;
- position: sticky;
- top: 0;
- left: 0;
- width: calc(100% - 12px);
- z-index: 1;
- background-color: white;
- }
-
- .collapsed-item {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 8px;
- margin: 4px 0;
- border-radius: 4px;
- background-color: #f3f3f3;
-
- .font-icons {
- font-size: 14px;
- }
- }
-
- .collapsed-title+uni-view:nth-of-type(1) {
- margin-top: 8px;
- }
- }
-
- .operation-panel {
- padding: 12px 0;
- position: fixed;
- bottom: 0;
- width: 100%;
- display: grid;
- grid-template-columns: 1fr;
- grid-template-rows: 1fr;
- background-color: white;
-
- .operation-title {
- height: 40px;
- line-height: 40px;
- padding: 0 14px;
- font-size: 16px;
- font-weight: bold;
- }
- }
-
- .hidden-focus {
- position: fixed;
- top: 0;
- left: 0;
- z-index: -1;
- opacity: 0;
- }
-
- .operation-header {
- height: 130px;
- background-color: #4badf4;
-
- .operation-header-item {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- padding: 4px 12px;
- font-size: 12px;
- color: white;
- }
-
- .operation-header-item-tips {
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- padding: 2px 12px;
- font-size: 14px;
- font-weight: bold;
- color: gold;
- }
-
- .operation-header-item-tips-success {
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- padding: 2px 12px;
- font-size: 14px;
- font-weight: bold;
- color: lightgreen;
- }
- }
- </style>
|