| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- <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-ellipsis gui-color-white gui-primary-text"
- >装箱</text>
- <!-- 此处加一个右侧展位元素与左侧同宽,实现标题居中 -->
- <!-- 实际宽度请根据自己情况设置 -->
- <view style="width:40px;" />
- <!-- 如果右侧有其他内容可以利用条件编译和定位来实现-->
- </view>
- </template>
- <template #gBody>
- <view class="list-content">
- <view class="row-1">
- <view class="row-1-card">
- <text
- class="gui-form-input input-200 gui-color-gray"
- >{{ materialCode? materialCode:"请扫描物料条码" }}</text>
- <view style="display: flex; flex-direction: row;">
- <text class="font-icons" @click="handleMapass('row1')"></text>
- </view>
- </view>
- </view>
- <view class="card">
- <view v-if="materialList.length > 0">
- <view v-for="item in materialList" :key="item.id" class="card-list-flexbox">
- <uni-swipe-action>
- <!-- 基础用法 -->
- <uni-swipe-action-item
- :right-options="options"
- :left-options="options"
- @click="handleDeleteRow(item)"
- >
- <template #left>
- <view />
- </template>
- <view class="flex-row">
- <view class="card-list-item">
- <text class="text-1 gui-color-gray">成品SN码</text>
- <text class="text-2 gui-color-gray">{{ item.materialSerinalNo }}</text>
- </view>
- <view class="card-list-item">
- <text class="text-1 gui-color-gray">生产时间</text>
- <text
- class="text-2 gui-color-gray"
- >{{ $parseTime(item.createTime) }}</text>
- </view>
- </view>
- </uni-swipe-action-item>
- </uni-swipe-action>
- </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="handleMerge"
- >
- <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 options = ref([{
- text: '删除',
- style: {
- backgroundColor: '#dd524d'
- }
- }])
- const materialCode = ref('')
- const materialList = ref([])
- const inputting = function(e) {
- console.log(e)
- }
- const goBack = function() {
- uni.$goBack('/pages/workbranch/warehouse/box/boxList')
- }
- const handleMapass = function(state) {
- // uni.$reqGet("scanWmsBoxSn", {
- // materialSerinalNo: "1633655975151833090"
- // })
- // .then(({
- // data
- // }) => {
- // if (data) {
- // materialCode.value = data?.materialSerinalNo;
- // materialList.value.push(data);
- // }
- // })
- 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('scanWmsBoxSn', {
- qrCode: ret.resp_result
- })
- .then(({
- data
- }) => {
- if (data) {
- materialCode.value = data?.materialSerinalNo
- materialList.value.push(data)
- }
- })
- }
- })
- }
- // 装箱
- const handleMerge = function() {
- if (materialList.value.length > 0) {
- uni.$reqPost('boxRepacking', materialList.value)
- .then(({
- data
- }) => {
- uni.$grace.msg('装箱成功')
- // // 时间格式转换
- // data?.forEach(item => item.createTime = formatDateTime(item
- // .createTime));
- // let message = {
- // "ClientId": "webclient",
- // 'templateName': "http://192.168.1.156:9900/Upload/Tables/s_reportmodel/202302271114052667/WMS.btw",
- // 'DataList': data
- // }
- // uni.$useStore().mqttConfig.publish("adminS001", JSON.stringify(message), {
- // qos: 1
- // }, (err) => {});
- })
- }
- }
- const handleDeleteRow = function(data) {
- const fdIndex = materialList.value.findIndex(item => item.id === data.id)
- materialList.value.splice(fdIndex, 1)
- }
- return {
- goBack,
- options,
- materialCode,
- materialList,
- inputting,
- handleMapass,
- handleMerge,
- handleDeleteRow
- }
- }
- })
- </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);
- }
- .list-content {
- margin-top: 80px;
- }
- .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;
- }
- .card {
- margin-top: 8px;
- .card-list-flexbox {
- display: flex;
- flex-direction: row;
- align-items: center;
- flex-wrap: wrap;
- .flex-row {
- display: flex;
- flex-wrap: wrap;
- margin-top: 2px;
- background-color: white;
- .card-list-item {
- width: 750rpx;
- height: 40px;
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- uni-text {
- font-size: 14px;
- height: 50rpx;
- text-align: left;
- padding: 0 12px;
- display: flex;
- flex-direction: row;
- align-items: center;
- }
- }
- }
- }
- }
- </style>
|