| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- <template>
- <gui-page :custom-header="true" :is-header-sized="false" :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-h4 gui-blod gui-flex1 gui-text-center gui-color-white gui-ellipsis gui-primary-text"
- >拆箱</text>
- <!-- 此处加一个右侧展位元素与左侧同宽,实现标题居中 -->
- <!-- 实际宽度请根据自己情况设置 -->
- <view style="width:40px;" />
- <!-- 如果右侧有其他内容可以利用条件编译和定位来实现-->
- </view>
- </template>
- <template #gBody>
- <view class="form">
- <view class="row-1">
- <view class="row-1-card">
- <text
- class="gui-form-input input-200 gui-color-gray"
- >{{ productionList[0]?.boxNo? productionList[0]?.boxNo:"请扫描箱码" }}</text>
- <view style="display: flex; flex-direction: row;">
- <text class="font-icons" @click="handleMapass"></text>
- </view>
- </view>
- </view>
- <view class="checkbox-list">
- <view v-if="productionList.length > 0">
- <view
- v-for="(item, key) in productionList"
- :key="key"
- class="checkbox-item"
- @click="handleCheckedItem(item)"
- >
- <view v-if="computedChecked(item.id)" class="checkbox-cubes">
- <view class="checkbox-box" />
- <view class="checkbox-icon">✔</view>
- </view>
- <view class="checkbox-panel">
- <view class="checkbox-panel-item">
- <text>SN码</text>
- <text>{{ item.materialSerinalNo }}</text>
- </view>
- <view class="checkbox-panel-item">
- <text>产品编码</text>
- <text>{{ item.productCode }}</text>
- </view>
- <view class="checkbox-panel-item">
- <text>产品名称</text>
- <text>{{ item.productName }}</text>
- </view>
- </view>
- </view>
- </view>
- <view v-else>
- <view class="bg-image">
- <image src="@/static/empty.png" mode="heightFix" />
- <text>这里什么都没有...</text>
- </view>
- </view>
- </view>
- </view>
- <gui-right-menus>
- <!-- 扩展按钮 -->
- <template #menus-more>
- <view
- hover-class="gui-tap"
- class="menu-items gui-bg-green gui-flex gui-columns gui-justify-content-center"
- @click="handleSplit"
- >
- <text class="menu-text gui-block gui-text-center gui-color-white">拆分</text>
- </view>
- </template>
- <!-- 核心按钮 -->
- <template #menus-primary>
- <view class="menu-items gui-bg-primary gui-flex gui-columns gui-justify-content-center">
- <text class="menu-icon gui-color-white gui-block gui-text-center gui-icons"></text>
- <text class="menu-text gui-color-white gui-block gui-text-center">功能</text>
- </view>
- </template>
- </gui-right-menus>
- </template>
- </gui-page>
- </template>
- <script>
- import {
- computed,
- defineComponent,
- ref
- } from 'vue'
- export default defineComponent({
- setup() {
- const goBack = function() {
- uni.$goBack('/pages/workbranch/warehouse/box/boxList')
- }
- const productionList = ref([])
- const checkboxParams = ref({
- checkboxIds: [], // 待选项的物料批次集合
- checkedIds: [] // 选中的字段
- })
- const computedChecked = computed(() => {
- return item => checkboxParams.value.checkedIds.includes(item)
- })
- const inputting = function(e) {
- console.log(e)
- }
- // 多选事件
- const handleCheckedItem = function(item) {
- const ifExist = checkboxParams.value.checkedIds.includes(item?.id)
- if (ifExist) {
- const fdIndex = checkboxParams.value.checkedIds.findIndex(option => option === item?.id)
- checkboxParams.value.checkedIds.splice(fdIndex, 1)
- } else {
- checkboxParams.value.checkedIds.push(item?.id)
- }
- }
- const handleMapass = function() {
- // uni.$reqGet("getWmsBoxSnList", { boxNo: "1633704467249389570" })
- // .then(({
- // data
- // }) => {
- // // for(let x = 0; x < 10; x++) {
- // // data?.list?.forEach(item => {
- // // productionList.value.push(item);
- // // })
- // // }
- // // checkboxParams.value.checkboxIds = Array.from(productionList.value, item => item
- // // ?.id);
- // productionList.value = data?.list;
- // checkboxParams.value.checkboxIds = Array.from(productionList.value, item => item
- // ?.id);
- // })
- const mpaasScanModule = uni.requireNativePlugin('Mpaas-Scan-Module')
- mpaasScanModule.mpaasScan({
- // 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
- 'scanType': ['qrCode', 'barCode'],
- // 是否隐藏相册,默认false不隐藏
- 'hideAlbum': false
- },
- (ret) => {
- if (ret.resp_code === 1000) {
- uni.$reqGet('getWmsBoxSnList', {
- boxNo: ret.resp_code
- })
- .then(({
- data
- }) => {
- productionList.value = data?.list
- checkboxParams.value.checkboxIds = Array.from(productionList.value,
- item => item
- ?.id)
- })
- }
- })
- }
- // 拆分
- const handleSplit = function() {
- const ids = checkboxParams.value.checkedIds.toString(',')
- if (checkboxParams.value.checkedIds.length > 0) {
- uni.$reqGet('boxSplit', {
- ids
- })
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- uni.$grace.msg('拆分成功')
- setTimeout(() => {
- uni.redirectTo({
- url: '/pages/workbranch/warehouse/box/boxSplit'
- })
- }, 500)
- } else {
- uni.$grace.msg(msg)
- }
- })
- }
- }
- return {
- goBack,
- productionList,
- inputting,
- handleMapass,
- handleSplit,
- computedChecked,
- handleCheckedItem
- }
- }
- })
- </script>
- <style lang="scss" scoped>
- .gui-header-leader-btns {
- color: black;
- font-size: 24px !important;
- margin-left: 24rpx;
- }
- .gui-sbody {
- background-color: rgba(234, 239, 242, 1);
- }
- .form {
- margin-top: 85px;
- }
- .row-1 {
- height: 55px;
- display: flex;
- justify-content: center;
- background-color: white;
- .row-1-card {
- flex: 1;
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- padding-left: 10px;
- padding-right: 10px;
- }
- }
- .input-200 {
- width: 200px;
- padding-left: 10px;
- }
- .input-300 {
- width: 300px;
- padding-left: 10px;
- }
- .font-icons {
- width: 40px;
- font-size: 20px;
- }
- .checkbox-list {
- padding-top: 12px;
- .checkbox-item {
- display: flex;
- flex-direction: row;
- align-items: center;
- height: 126px;
- line-height: 42px;
- background-color: white;
- margin: 1px 0;
- .checkbox-cubes {
- width: 30px;
- height: 126px;
- position: absolute;
- .checkbox-box {
- /*宽高为0*/
- width: 0;
- height: 0;
- position: relative;
- /*在三角形底边设置一个边界颜色*/
- border-left: 28px solid skyblue;
- /*其它3边设置相同颜色,*/
- border-bottom: 25px solid transparent;
- }
- .checkbox-icon {
- height: 20px;
- position: absolute;
- top: 0;
- left: 3px;
- display: flex;
- align-items: center;
- font-size: 10px;
- font-weight: bold;
- color: white;
- }
- }
- .checkbox-panel {
- width: 100%;
- padding: 0 18px;
- .checkbox-panel-item {
- display: flex;
- justify-content: space-between;
- }
- }
- }
- }
- ::v-deep .uni-checkbox-input {
- border-radius: 50% !important;
- }
- </style>
|