| <template> | 
|     <view class="overflow"> | 
|         <cu-custom bgColor="bg-white" :isBack="true"> | 
|             <block slot="backText"> | 
|             </block> | 
|             <block slot="content">领用单拍照留底</block> | 
|         </cu-custom> | 
|         <view class="flex justify-end align-center padding_right30rpx padding_top12rpx"> | 
|             <text class="fontSize12rpx"> 操作人:{{operator}} </text> | 
|         </view> | 
|         <modal-code ref="resmodal" :rescode='rescode' :resmessage='resmessage' /> | 
|         <view class=""> | 
|             <u-form labelPosition="top" :model="warehouse" ref="warehouseRef"> | 
|                 <u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;"> | 
|                     <u-col span="10"> | 
|                         <u-form-item label="领用单号:" prop="warehouseCode" required | 
|                             style="font-size: 16px;font-weight: bold;padding: 0 0 10rpx;"> | 
|                             <input v-model="warehouse.warehouseCode" @focus="focu=true" placeholder="请录入或扫码" | 
|                                 @blur="getMaterialDetails" class="width padding_left25rpx" | 
|                                 style="font-weight: bolder;margin-left: 30rpx;" /> | 
|                             <u-icon v-if="warehouse.warehouseCode && focu" @click="warehouse.warehouseCode=''" | 
|                                 name="close-circle-fill" color="#848484"></u-icon> | 
|                         </u-form-item> | 
|                     </u-col> | 
|                     <u-col span="2"> | 
|                         <u-icon class="iconfont icon-saoma fontSize60rpx"></u-icon> | 
|                     </u-col> | 
|                 </u-row> | 
|             </u-form> | 
|             <scroll-view scroll-y="true" style="height: 67vh;"> | 
|                 <u-swipe-action :show="item.show" :index="eindex" v-for="(item, eindex) in singlist" :key="eindex" | 
|                     @click="longpredel" @open="open" @close='close' :options="options"> | 
|                     <view class="item u-border-bottom"> | 
|                         <!-- 此层wrap在此为必写的,否则可能会出现标题定位错误 --> | 
|                         <view class="title-wrap "> | 
|                             <view :key="eindex+'singlist'" :class="item.cardNum?'bd-ffe6c9':item.edit?'clickactive':''" | 
|                                 class="fontSize30rpx width margin_auto background_fff padding15 border_radius margin_bottom10rpx relative box_sizing transition"> | 
|                                 <u-row> | 
|                                     <u-col span="12" class="flex"> | 
|                                         <view class="flex justify-center align-center" | 
|                                             style="background-color: #f18202;color: #fff;border-radius: 50vh;width: 20px;height: 20px;"> | 
|                                             {{eindex+1}} | 
|                                         </view> | 
|                                         <view class="color_f18202 padding_left10rpx"> | 
|                                             {{item.wareMaterialCode}} ({{item.wareMaterialName}}) {{item.barNo}} | 
|                                         </view> | 
|                                     </u-col> | 
|                                 </u-row> | 
|                                 <u-row> | 
|                                     <u-col span="4"> | 
|                                         <view class="" style="padding: 10rpx 0 10rpx 45rpx;color: #808080;"> | 
|                                             大类:{{item.wareMaterialTypeName}} | 
|                                         </view> | 
|                                     </u-col> | 
|                                     <u-col span="4"> | 
|                                         <view class="" style="padding: 10rpx 0 10rpx 45rpx;color: #808080;"> | 
|                                             小类:{{item.wareMaterialSubTypeName}} | 
|                                         </view> | 
|                                     </u-col> | 
|                                     <u-col span="4"> | 
|                                         <view class="" style="padding: 10rpx 0 10rpx 45rpx;color: #808080;"> | 
|                                             数量:{{item.quantity}} | 
|                                         </view> | 
|                                     </u-col> | 
|                                 </u-row> | 
|                             </view> | 
|                         </view> | 
|                     </view> | 
|                 </u-swipe-action> | 
|             </scroll-view> | 
|             <u-popup v-model="detailshow" border-radius="14" @close="detailshow=false" mode="bottom" v-if="!printflag"> | 
|                 <!-- <view class="pop "> --> | 
|                 <h2 class="text_align_center padding_bottom18 padding15">物料信息</h2> | 
|                 <view class="line flex justify-between"> | 
|                     <text class="text-gray">物料编号</text> | 
|                     <text>{{materlist.wareMaterialCode}}</text> | 
|                 </view> | 
|                 <view class="line flex justify-between"> | 
|                     <text class="text-gray">物料大类</text> | 
|                     <text>{{materlist.wareMaterialTypeName}}</text> | 
|                 </view> | 
|                 <view class="line flex justify-between"> | 
|                     <text class="text-gray">物料小类</text> | 
|                     <text>{{materlist.wareMaterialSubTypeName}}</text> | 
|                 </view> | 
|                 <view class="line flex justify-between"> | 
|                     <text class="text-gray">物料规格</text> | 
|                     <text>{{materlist.specificationModel}}</text> | 
|                 </view> | 
|                 <view class="line flex justify-between"> | 
|                     <text class="text-gray">长(mm)</text> | 
|                     <text>{{materlist.long}}</text> | 
|                 </view> | 
|                 <view class="line flex justify-between"> | 
|                     <text class="text-gray">宽(mm)</text> | 
|                     <text>{{materlist.width}}</text> | 
|                 </view> | 
|                 <view class="line flex justify-between"> | 
|                     <text class="text-gray">高(mm)</text> | 
|                     <text>{{materlist.high}}</text> | 
|                 </view> | 
|                 <view class="line flex justify-between"> | 
|                     <text class="text-gray">重量(kg)</text> | 
|                     <text>{{materlist.weight}}</text> | 
|                 </view> | 
|                 <view class="line flex justify-between"> | 
|                     <text class="text-gray">条码</text> | 
|                     <text>{{materlist.barCode}}</text> | 
|                 </view> | 
|                 <view class="line flex justify-between"> | 
|                     <text class="text-gray">单位</text> | 
|                     <text>{{materlist.unit}}</text> | 
|                 </view> | 
|                 <view class="line flex justify-between"> | 
|                     <text class="text-gray">数量</text> | 
|                     <text>{{materlist.quantity}}</text> | 
|                 </view> | 
|                 <!-- </view> --> | 
|                 <!--                 <view class="margin_top140rpx"> | 
|                     <button-modal :subShow='true' garmenTitle='打印' @submit='init' @reset='rest' /> | 
|                 </view> --> | 
|             </u-popup> | 
|             <u-popup v-model="detailshow" border-radius="14" @close="detailshow=false" mode="bottom" v-if="printflag"> | 
|                 <!-- <view class="pop "> --> | 
|                 <h2 class="text_align_center">物料标签</h2> | 
|                 <view class="border margin" style="margin-bottom: 0;"> | 
|                     <h2 class="text_align_center padding_bottom18 padding15 margin_top10rpx margin_bottom10rpx"> | 
|                         {{materlist.wareMaterialCode}} | 
|                     </h2> | 
|                     <view class="margin" style="margin-top: 0;"> | 
|                         <table border="1" cellpadding='12' width='100%' | 
|                             style='border-collapse:collapse;color: #515151;'> | 
|                             <tr> | 
|                                 <th>物料大类</th> | 
|                                 <th>{{materlist.materialTypeName}}</th> | 
|                             </tr> | 
|                             <tr> | 
|                                 <th>物料小类</th> | 
|                                 <th>{{materlist.wareMaterialSubTypeName}}</th> | 
|                             </tr> | 
|                             <tr> | 
|                                 <th>物料规格</th> | 
|                                 <th>{{materlist.specificationModel}}</th> | 
|                             </tr> | 
|                         </table> | 
|                         <tki-barcode ref="barcode" onval :val="code" :load-make="true" :opations="barOpations" /> | 
|                     </view> | 
|                 </view> | 
|             </u-popup> | 
|             <!--     <view | 
|                 class="width fixed bottom140 margin_auto background_fff padding15 border_radius margin_bottom10rpx relative box_sizing transition"> | 
|                 <u-upload :action="action" :before-upload="beforeUpload" upload-text="领用单照片" :file-list="fileList1" | 
|                     @on-success="successPic" @on-remove="remove"> | 
|                 </u-upload> | 
|             </view> --> | 
|   | 
|             <view | 
|                 class="width fixed bottom140 margin_auto background_fff padding15 border_radius margin_bottom10rpx relative box_sizing transition"> | 
|                 <view class="" style="width: 250rpx;height: 250rpx;border: 1px dashed #aaaaaa;position: relative;"> | 
|                     <image :src="image" mode="" @click="imgClick(image)" style="width: 100%;height: 100%;"></image> | 
|                 </view> | 
|                 <u-icon @click="delimage" name='close-circle-fill' color='red' size='60' v-if="image!==''" | 
|                     style='position: absolute;left:200rpx;top: 20rpx;'></u-icon> | 
|                 <view class="" style="color: #aaaaaa;" v-if="image==''"> | 
|                     <u-icon name="plus" @click='upload' size='48' style='position: absolute;left: 120rpx;top: 100rpx;'> | 
|                     </u-icon> | 
|                     <text class="fontSize32rpx" style="position: absolute;left: 85rpx;top: 160rpx;">选择图片</text> | 
|                 </view> | 
|             </view> | 
|             <button-modal :issueShow='true' issueTitle="打印" subTitle='提交' restTiltle='重置' @reset='reset' | 
|                 @submit='submit' /> | 
|         </view> | 
|     </view> | 
| </template> | 
|   | 
| <script> | 
|     import ButtonModal from '@/components/buttonModal.vue' | 
|     import ModalCode from '@/components/ModalCode.vue' | 
|     import tkiBarcode from '@/components/tki-barcode/tki-barcode' | 
|     import { | 
|         pathToBase64 | 
|     } from 'image-tools' | 
|     import { | 
|         query, | 
|         updateHead | 
|     } from '@/api/borrow/borrow.js' | 
|     export default { | 
|         data() { | 
|             return { | 
|                 detailshow: false, | 
|                 rescode: 0, | 
|                 resmessage: "", | 
|                 current: 0, //滑块默认值 | 
|                 printNum: "", //打印数量 | 
|                 focu: false, | 
|                 printflag: false, //打印/物料信息,true为物料信息 | 
|                 fileList: [], | 
|                 fileList1: [], //上传图片列表 | 
|                 lastlist: [], | 
|                 overlist: [], //收货列表 | 
|                 lacklist: [], //缺料列表 | 
|                 flag: true, | 
|                 action: this.$myHOST + '/sysFileInfo/uploadImages', | 
|                 singlist: [ | 
|                     //     { | 
|                     //     "id": 0, | 
|                     //     "deliverDate": "string", | 
|                     //     "wareMaterialCode": "string", | 
|                     //     "name": "string", | 
|                     //     "describe": "string", | 
|                     //     "category": "string", | 
|                     //     "materialTypeId": "string", | 
|                     //     "materialTypeName": "string", | 
|                     //     "specificationModel": "string", | 
|                     //     "long": "string", | 
|                     //     "width": "string", | 
|                     //     "high": "string", | 
|                     //     "weight": "string", | 
|                     //     "purchaseNo": "string", | 
|                     //     "barCode": "string", | 
|                     //     "surplusQuantity": 11, | 
|                     //     "unit": "string", | 
|                     //     "basicExpressInfoCode": "string", | 
|                     //     "basicExpressInfoName": "string", | 
|                     //     "deliveryQuantity": "string", | 
|                     //     "goodsQuantity": "string", | 
|                     //     "deliveryNo": "string" | 
|                     // }, | 
|                 ], //物料详情 | 
|                 base: '', | 
|                 image: '', | 
|                 lists: [{ | 
|                     name: '收货(50)' | 
|                 }, { | 
|                     name: '缺料' | 
|                 }], | 
|                 list: [], | 
|                 arr: [], | 
|                 materlist: {}, //物料详情数据 | 
|                 warehouse: { | 
|                     warehouseCode: '' | 
|                 }, | 
|                 warehouseRules: { | 
|                     warehouseCode: [{ | 
|                         required: true, | 
|                         message: '领用单号不能为空', | 
|                         trigger: 'blur' | 
|                     }] | 
|                 }, | 
|                 options: [{ | 
|                     text: '详情', | 
|                     style: { | 
|                         backgroundColor: '#fc9f35' | 
|                     } | 
|                 }], | 
|                 operator: '', | 
|                 QuantityTotal: '', //送货总数 | 
|                 uncollectedTotal: '', //收货总数 | 
|                 lackTotal: '', //缺货总数 | 
|                 code: '', | 
|                 barOpations: { | 
|                     width: 1.8, | 
|                     height: 120, | 
|                     fontSize: 24, | 
|                     fontColor: "#000000", | 
|                     displayValue: true, | 
|                     textAlign: "center", | 
|                     textPosition: "bottom", | 
|                     textMargin: 5, | 
|                     background: "#FFFFFF", | 
|                     margin: 5 | 
|                 } | 
|             }; | 
|         }, | 
|         components: { | 
|             ButtonModal, | 
|             ModalCode, | 
|             tkiBarcode | 
|         }, | 
|         onReady() { | 
|             this.$refs.warehouseRef.setRules(this.warehouseRules) | 
|         }, | 
|         mounted() { | 
|             this.operator = JSON.parse(uni.getStorageSync('userInfo')).name | 
|         }, | 
|         methods: { | 
|             init() { | 
|                 // this.tomy() | 
|                 this.printflag = true | 
|                 this.code = this.materlist.wareMaterialCode // 生成一维码和二维码 | 
|             }, | 
|             upload() { | 
|                 uni.chooseImage({ | 
|                     sourceType: ["camera", "album"], | 
|                     sizeType: "original", | 
|                     count: 1, | 
|                     success: (res) => { | 
|                         pathToBase64(res.tempFilePaths[0]).then(base64 => { | 
|                             this.image = res.tempFilePaths[0] | 
|                             this.base=JSON.stringify(base64) | 
|                             uni.uploadFile({ | 
|                                 url: this.action, | 
|                                 filePath: res.tempFilePaths[0], | 
|                                 formData: { | 
|                                     'images': JSON.stringify(base64) | 
|                                 }, | 
|                                 success: (res) => { | 
|                                     var str = JSON.parse(res.data) | 
|                                 } | 
|                             }) | 
|                         }) | 
|                     } | 
|                 }) | 
|             }, | 
|             delimage() { | 
|                 this.image = '' | 
|                 this.$u.toast('移除成功') | 
|             }, | 
|             imgClick(url) { | 
|                 if(this.image!==''){ | 
|                     var imgArr = []; | 
|                     imgArr.push(url) | 
|                     //预览图片 | 
|                     uni.previewImage({ | 
|                         urls: imgArr, | 
|                         current: imgArr[0] | 
|                     }); | 
|                 } | 
|             }, | 
|             //编辑状态样式 | 
|             dc(e) { | 
|                 e.cardNum = true | 
|                 this.$forceUpdate() | 
|             }, | 
|             //物料查询 | 
|             getMaterialDetails() { | 
|                 this.$refs.warehouseRef.validate(valid => { | 
|                     if (valid) { | 
|                         setTimeout(() => { | 
|                             this.focu = false | 
|                             if (this.warehouse.warehouseCode !== '') { | 
|                                 query(this.warehouse.warehouseCode).then((res) => { | 
|                                     if (res.code == 200) { | 
|                                         this.singlist = res.data.rows | 
|                                         if (res.data.rows.length == 0) { | 
|                                             this.resmessage = '暂无数据' | 
|                                             this.rescode = 400 | 
|                                             this.$refs.resmodal.show = true | 
|                                         } | 
|                                     } else { | 
|                                         this.resmessage = res.message | 
|                                         this.rescode = res.code | 
|                                         this.$refs.resmodal.show = true | 
|                                     } | 
|                                 }) | 
|                             } | 
|   | 
|                         }, 200) | 
|                     } | 
|                 }) | 
|             }, | 
|             //删除详情 | 
|             longpredel(index, eindex) { | 
|                 this.singlist[index].cardNum = true | 
|                 this.printflag = false | 
|                 if (eindex == 1) { | 
|                     this.singlist.splice(index, 1) | 
|                 } else { | 
|                     this.materlist = this.singlist[index] | 
|                     this.detailshow = true | 
|                 } | 
|             }, | 
|             //卡片选中 | 
|             click(e) { | 
|                 e.cardNum = true | 
|                 this.$forceUpdate() | 
|             }, | 
|             // 如果打开一个的时候,不需要关闭其他,则无需实现本方法 | 
|             open(index) { | 
|                 // 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制, | 
|                 // 原本为'false',再次设置为'false'会无效 | 
|                 this.singlist[index].cardNum = true; | 
|                 this.singlist[index].show = true; | 
|                 this.singlist.map((val, idx) => { | 
|                     if (index != idx) this.singlist[idx].show = false; | 
|                 }) | 
|                 this.$forceUpdate() | 
|             }, | 
|             close(index) { | 
|                 this.singlist[index].show = false; | 
|                 this.singlist[index].cardNum = false; | 
|                 this.$forceUpdate() | 
|             }, | 
|             // successPic(data, index, lists, name) { | 
|             //     this.fileList.push(data.data) | 
|             // }, | 
|             // //删除图片 | 
|             // remove(index, lists, name) { | 
|             //     this.fileList.splice(index, 1) | 
|             // }, | 
|             //确认收货 | 
|             submit() { | 
|                 let params = { | 
|                     id: this.singlist[0].ordersId, | 
|                     // remarks: this.fileList.toString() | 
|                     remarks:this.base | 
|                 } | 
|                 updateHead(params).then((res) => { | 
|                     this.rescode = res.code | 
|                     this.resmessage = res.message | 
|                     this.$refs.resmodal.show = true | 
|                     if (res.code == 200) { | 
|                         this.reset() | 
|                     } | 
|                 }) | 
|             }, | 
|             //清楚选中 | 
|             reset() { | 
|                 this.singlist = [] | 
|                 this.warehouse.warehouseCode = '' | 
|                 this.fileList = [] | 
|                 this.fileList1 = [] | 
|             }, | 
|             //打印 | 
|             onPrint() { | 
|                 let _this = this | 
|                 if (!uni.getStorageSync("deviceId")) { | 
|                     uni.showToast({ | 
|                         title: '请连接打印机', | 
|                         icon: 'error', | 
|                         duration: 2000 | 
|                     }) | 
|                     return | 
|                 } | 
|                 this.writeBLECharacteristicValue() | 
|             }, | 
|         } | 
|     } | 
| </script> | 
|   | 
| <style lang="scss"> | 
|   | 
| </style> |