|
@@ -2,87 +2,127 @@
|
|
|
|
|
|
<view class='container '>
|
|
|
<view class='content'>
|
|
|
- <text class='title'>{{title}}</text>
|
|
|
<view class='item-table' scroll-y v-for="(item,index) in products" :key='index'>
|
|
|
+ <text class='title'>{{title}}</text>
|
|
|
<view class="uni-row table-layout">
|
|
|
<text class='tbhead left'>产品描述</text>
|
|
|
- <text class='tbhead right'>{{item['description']}}</text>
|
|
|
+ <text class='tbhead right'>{{item['productDescription']}}</text>
|
|
|
</view>
|
|
|
<view class="uni-row table-layout">
|
|
|
<text class='tbbody left'>批次</text>
|
|
|
- <text class='tbbody right'>{{item['batch']}}</Text>
|
|
|
+ <text class='tbbody right'>{{item['lotCode']}}</Text>
|
|
|
</view>
|
|
|
<view class="uni-row table-layout">
|
|
|
<text class='tbbody left'>箱数</text>
|
|
|
- <text class='tbbody right'>{{item['cases']}}</Text>
|
|
|
+ <text class='tbbody right'>{{item['carriers']}}</Text>
|
|
|
</view>
|
|
|
<view class="uni-row table-layout">
|
|
|
- <text class='tbbody left' style="height: 100%;">箱号</text>
|
|
|
- <text class='last-tbbody right'>{{item['boxno']}}</text>
|
|
|
+ <text class='tbbody left'>箱号</text>
|
|
|
+ <text class='tbbody right'>{{item['carrierName']}}</text>
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class='btn uni-row'>
|
|
|
- <button class='bottom-btn left-btn'>取消</button>
|
|
|
- <button class='bottom-btn right-btn' type="primary">确定接收</button>
|
|
|
+ <button class='bottom-btn left-btn' type="primary" @click="handleScanCode">扫码添加</button>
|
|
|
+ <button class='bottom-btn right-btn' type="primary" @click="handleConfirmReceipt">确定接收</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <dialog-confirm ref="confirm" @submit="handleDoIt"></dialog-confirm>
|
|
|
</template>
|
|
|
<script setup>
|
|
|
import {
|
|
|
ref
|
|
|
} from 'vue'
|
|
|
import {
|
|
|
- onLoad,
|
|
|
- onReady
|
|
|
+ onLoad
|
|
|
} from '@dcloudio/uni-app'
|
|
|
- onLoad(() => {
|
|
|
- for (let i = 0; i < products.value.length; i++) {
|
|
|
- sum.value += parseInt(products.value[i]['cases'].toString());
|
|
|
- }
|
|
|
- // this.title = '热处理' + this.sum + '箱'
|
|
|
- title.value = '热处理' + sum.value + '箱'
|
|
|
- })
|
|
|
+ import {
|
|
|
+ getDayworkItemByCarrierId,
|
|
|
+ updateDayWorkItemBatch
|
|
|
+ } from '@/api/business/dayWorkItem.js'
|
|
|
+ import {
|
|
|
+ store
|
|
|
+ } from '@/store/index.js'
|
|
|
+
|
|
|
const title = ref('热处理')
|
|
|
const sum = ref(0)
|
|
|
- const products = ref([{
|
|
|
- description: '博士_0395614149_15*110.1',
|
|
|
- batch: 'DC23727410070',
|
|
|
- cases: 5,
|
|
|
- boxno: 'X12522、X552222、X15522、J5211、J5112、X12522、X552222、X15522、J5211、J5112'
|
|
|
- },
|
|
|
- {
|
|
|
- description: '博士_0395614149_15*110.1',
|
|
|
- batch: 'DC23727410070',
|
|
|
- cases: 5,
|
|
|
- boxno: 'X12522、X552222、X15522、J5211、J5112'
|
|
|
- },
|
|
|
- {
|
|
|
- description: '博士_0395614149_15*110.1',
|
|
|
- batch: 'DC23727410070',
|
|
|
- cases: 5,
|
|
|
- boxno: 'X12522、X552222、X15522、J5211、J5112'
|
|
|
- },
|
|
|
- {
|
|
|
- description: '博士_0395614149_15*110.1',
|
|
|
- batch: 'DC23727410070',
|
|
|
- cases: 5,
|
|
|
- boxno: 'X12522、X552222、X15522、J5211、J5112'
|
|
|
- },
|
|
|
- {
|
|
|
- description: '博士_0395614149_15*110.1',
|
|
|
- batch: 'DC23727410070',
|
|
|
- cases: 5,
|
|
|
- boxno: 'X12522、X552222、X15522、J5211、J5112'
|
|
|
- },
|
|
|
- {
|
|
|
- description: '博士_0395614149_15*110.1',
|
|
|
- batch: 'DC23727410070',
|
|
|
- cases: 5,
|
|
|
- boxno: 'X12522、X552222、X15522、J5211、J5112'
|
|
|
+ const products = ref([])
|
|
|
+ const confirm = ref(null)
|
|
|
+
|
|
|
+ onLoad(() => {
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+ function handleScanCode() {
|
|
|
+ uni.scanCode({
|
|
|
+ scanType: ['qrCode'],
|
|
|
+ onlyFromCamera: true, // 只允许相机扫码
|
|
|
+ success: function(res) {
|
|
|
+ console.log(res.result)
|
|
|
+ let vehicleObj = JSON.parse(res.result);
|
|
|
+ getDayworkItemByCarrierId({
|
|
|
+ carrierId: vehicleObj.carrierId,
|
|
|
+ status: 6
|
|
|
+ }).then(response => {
|
|
|
+ for (let i = 0; i < products.value.length; i++) {
|
|
|
+ if (Object.entries(products.value[i]).toString() === Object.entries(res
|
|
|
+ .data)
|
|
|
+ .toString()) {
|
|
|
+ uni.showToast({
|
|
|
+ icon: "error",
|
|
|
+ title: "该批次已存在"
|
|
|
+ })
|
|
|
+ console.log("该批次已存在")
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ products.value.push(response.data);
|
|
|
+ for (let i = 0; i < products.value.length; i++) {
|
|
|
+ products.value[i].carriers = products.value[i].carrierName.split('、')
|
|
|
+ .length;
|
|
|
+ }
|
|
|
+ console.log(products.value)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function handleConfirmReceipt() {
|
|
|
+ if (products.value.length > 0) {
|
|
|
+ let msg = "是否确认接收";
|
|
|
+ confirm.value.open(msg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function handleDoReceipt() {
|
|
|
+ // 设置周转状态
|
|
|
+ for (var i = 0; i < products.value.length; i++) {
|
|
|
+ products.value[i].status = '7';
|
|
|
+ products.value[i].recipientId = store.userInfo.userId;
|
|
|
}
|
|
|
- ])
|
|
|
+ updateDayWorkItemBatch(products.value).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'success',
|
|
|
+ title: '操作成功',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ init();
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'error',
|
|
|
+ title: '操作失败',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ products.value = [];
|
|
|
+ }
|
|
|
+
|
|
|
+ function handleDoIt() {
|
|
|
+ handleDoReceipt();
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
@@ -96,7 +136,6 @@
|
|
|
/* height: auto; */
|
|
|
background-color: rgba(255, 255, 255, 1);
|
|
|
margin: 50rpx auto;
|
|
|
- padding-bottom: 144rpx;
|
|
|
border-radius: 12rpx;
|
|
|
|
|
|
.title {
|
|
@@ -141,16 +180,6 @@
|
|
|
.right {
|
|
|
flex: 3;
|
|
|
}
|
|
|
-
|
|
|
- .last-tbbody {
|
|
|
- font-size: 28rpx;
|
|
|
- background-color: rgba(238, 240, 245, 1);
|
|
|
- width: 70%;
|
|
|
- height: 100%;
|
|
|
- align-items: center;
|
|
|
- border-bottom: 1px solid lightgray;
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -172,7 +201,7 @@
|
|
|
color: #FFFFFF;
|
|
|
|
|
|
&.left-btn {
|
|
|
- background-color: #a4adb3;
|
|
|
+ // background-color: #a4adb3;
|
|
|
}
|
|
|
|
|
|
&.right-btn {
|