group.vue 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630
  1. <template>
  2. <view class="nvue-page-root">
  3. <view class="head">
  4. <view class="header-wrap">
  5. <view class="index-header">
  6. <uni-icons class="fanhui" custom-prefix="iconfont" type="icon-fanhui"
  7. @click="leftClick"></uni-icons>
  8. <view class="input-wrap">
  9. <text class="iconfont">组盘入库</text>
  10. </view>
  11. <view class="map-wrap">
  12. <uni-icons class="lanya"></uni-icons>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="blank"></view>
  17. </view>
  18. <view class="uni-common-mt" style="padding: 5px;">
  19. <view class="uni-form-item uni-column">
  20. <view class="uni-input-wrapper" style="margin: 5px auto;">
  21. <text class="uni-form-item__title" style="width: 25%;">托盘码</text>
  22. <input class="uni-input" ref="trayCodeInput" auto-focus="true" placeholder="请扫描托盘码"
  23. v-model="container_code" @input="handleTrayCodeInput" style="font-weight: bold;" />
  24. </view>
  25. <!-- 新增的到货单编号输入框 -->
  26. <view class="uni-input-wrapper" style="margin: 5px auto;">
  27. <text class="uni-form-item__title" style="width: 25%;">到货单编号</text>
  28. <input class="uni-input" ref="receiptCodeInput" placeholder="请扫描到货单编号" v-model="number"
  29. @input="handleReceiptCodeInput" style="font-weight: bold;" />
  30. </view>
  31. <view class="uni-input-wrapper" style="margin: 5px auto;">
  32. <text class="uni-form-item__title" style="width: 25%;">存货编码</text>
  33. <input class="uni-input" ref="pruductCodeInput" placeholder="请扫描存货编码" v-model="pruduct_code"
  34. @input="handlepruductCodeInput" style="font-weight: bold;" />
  35. </view>
  36. <view class="uni-input-wrapper" style="margin: 5px auto;">
  37. <text class="uni-form-item__title" style="width: 25%;">入库类别</text>
  38. <select-lay style="width: 75%;" :zindex="zindex5" :value="category_sn" name="category_sn"
  39. placeholder="请选择入库类别" :options="categoryList" @selectitem="selectCategory">
  40. </select-lay>
  41. </view>
  42. <view class="uni-input-wrapper" style="margin: 5px auto;">
  43. <text class="uni-form-item__title" style="width: 25%;">入库状态</text>
  44. <select-lay style="width: 75%;" :zindex="zindex4" :value="qualified" name="qualified"
  45. placeholder="请选择入库状态" :options="qualifiedList" @selectitem="selectQualified">
  46. </select-lay>
  47. </view>
  48. <view class="uni-input-wrapper" style="margin: 5px auto;">
  49. <text class="uni-form-item__title" style="width: 25%;">U8仓库 </text>
  50. <select-lay style="width: 75%;" :zindex="zindex3" :value="stockarea" name="stockarea"
  51. placeholder="请选择U8仓库" :options="stockareaList" @selectitem="selectStockArea">
  52. </select-lay>
  53. </view>
  54. <view class="uni-input-wrapper" style="margin: 5px auto;">
  55. <text class="uni-form-item__title" style="width: 25%;">库区</text>
  56. <select-lay style="width: 75%;" :zindex="zindex2" :value="area_sn" name="area_sn"
  57. placeholder="请选择库区" :options="areaList" @selectitem="selectArea">
  58. </select-lay>
  59. </view>
  60. <!-- <view class="uni-input-wrapper" style="margin: 5px auto;">
  61. <text class="uni-form-item__title" style="width: 25%;">入库口</text>
  62. <select-lay style="width: 75%;" :zindex="zindex1" :value="port_sn" name="port_sn"
  63. placeholder="请选择入库口" :options="portList" @selectitem="selectPort">
  64. </select-lay>
  65. </view> -->
  66. <!-- <view class="uni-input-wrapper button-sp-area">
  67. <button type="primary" @click="SelectProduct()">添加存货</button>
  68. </view> -->
  69. <view style="min-height:218px;overflow-y:auto;max-height:218px">
  70. <view class="cart-list">
  71. <!-- 滑动操作分区 -->
  72. <uni-swipe-action>
  73. <!-- 滑动操作项 -->
  74. <uni-swipe-action-item v-for="(item,index) in tableData" :key="index" class="cart-swipe">
  75. <!-- 商品信息 -->
  76. <view class="goods" style="border:1px solid #ccc">
  77. <view class="meta" style="padding-bottom:10px;width: 70%;">
  78. <view class="name" @click="Delete(item)">
  79. 编码:{{item.code}}
  80. 名称:{{item.name}}
  81. 型号:{{item.model}}
  82. 状态:{{item.status_view}}
  83. </view>
  84. </view>
  85. <!-- 商品数量 -->
  86. <view class="numGroup" @click="Update(item)">
  87. <text class="text_1">数量</text>
  88. <text class="inputs">{{item.num}}</text>
  89. <text class="text">{{item.unit}}</text>
  90. </view>
  91. </view>
  92. </uni-swipe-action-item>
  93. </uni-swipe-action>
  94. </view>
  95. </view>
  96. <view class="uni-input-wrapper button-sp-area">
  97. <button type="primary" plain="true" @click="groupDisk()" :disabled="BtnDisabled">组盘入库</button>
  98. <button type="primary" @click="SelectProduct()">添加存货</button>
  99. <button type="primary" plain="true" @click="addMaterial()">空筐入库</button>
  100. </view>
  101. <view class="uni-input-wrapper button-sp-area" style="margin-top: 5px;">
  102. <button type="primary" plain="true" @click="getOneNilCode()">1号入口</button>
  103. <button type="primary" style="visibility: hidden;">1111</button>
  104. <button type="primary" plain="true" @click="getTwoNilCode()">2号入口</button>
  105. </view>
  106. </view>
  107. </view>
  108. <!-- 提示窗示例 -->
  109. <uni-popup ref="deleteDialog" type="dialog">
  110. <uni-popup-dialog type="info" cancelText="取消" confirmText="确定" title="提示" :content="del_tips"
  111. @confirm="dialogConfirm" @close="dialogClose"></uni-popup-dialog>
  112. </uni-popup>
  113. <!-- 提示窗示例 -->
  114. <uni-popup ref="groupDialog" type="dialog">
  115. <uni-popup-dialog type="info" cancelText="取消" confirmText="确定" title="提示" content="确定组盘?"
  116. @confirm="dialogGroup" @close="dialogClose"></uni-popup-dialog>
  117. </uni-popup>
  118. <uni-popup ref="groupMaterialDialog" type="dialog">
  119. <uni-popup-dialog type="info" cancelText="取消" confirmText="确定" title="提示" content="确定空筐入库?"
  120. @confirm="dialogMaterialGroup" @close="dialogClose"></uni-popup-dialog>
  121. </uni-popup>
  122. <uni-popup ref="nilCodeOneDialog" type="dialog">
  123. <uni-popup-dialog type="info" cancelText="取消" confirmText="确定" title="提示" content="确定叫空托到1号入库口?"
  124. @confirm="dialogNilCodeOne" @close="dialogClose"></uni-popup-dialog>
  125. </uni-popup>
  126. <uni-popup ref="nilCodeTwoDialog" type="dialog">
  127. <uni-popup-dialog type="info" cancelText="取消" confirmText="确定" title="提示" content="确定叫空托到2号入库口?"
  128. @confirm="dialogNilCodeTwo" @close="dialogClose"></uni-popup-dialog>
  129. </uni-popup>
  130. <!-- 引入自定义模态框 -->
  131. <custom-modal :visible="updateModalVisible">
  132. <!-- 模态框的内容 -->
  133. <view>
  134. <text>提示</text>
  135. <view class="uni-input-wrapper" style="margin: 5px auto;">
  136. <text class="uni-form-item__title" style="width: 30%;">存货编码</text>
  137. <input class="uni-input" :value="code" disabled="true" />
  138. </view>
  139. <view class="uni-input-wrapper" style="margin: 5px auto;">
  140. <text class="uni-form-item__title" style="width: 30%;">存货名称</text>
  141. <input class="uni-input" :value="name" disabled="true" />
  142. </view>
  143. <view class="uni-input-wrapper" style="margin: 5px auto;">
  144. <text class="uni-form-item__title" style="width: 30%;">存货型号</text>
  145. <input class="uni-input" :value="model" disabled="true" />
  146. </view>
  147. <view class="uni-input-wrapper" style="margin: 5px auto;">
  148. <text class="uni-form-item__title" style="width: 30%;">存货品牌</text>
  149. <input class="uni-input" :value="brand" disabled="true" />
  150. </view>
  151. <view class="uni-input-wrapper" style="margin: 5px auto;">
  152. <text class="uni-form-item__title" style="width: 30%;">存货单位</text>
  153. <input class="uni-input" :value="unit" disabled="true" />
  154. </view>
  155. <view class="uni-input-wrapper" style="margin: 5px auto;">
  156. <text class="uni-form-item__title" style="width: 30%;">数量</text>
  157. <input type="number" class="uni-input" :value="num" @input="numChange" />
  158. </view>
  159. <view class="uni-input-wrapper" style="margin: 5px auto;">
  160. <text class="uni-form-item__title" style="width: 30%;">仓库备注</text>
  161. <input class="uni-input" :value="remark" @input="remarkChange" />
  162. </view>
  163. <br><br>
  164. <button class="mini-btn" size="mini" @click="closeUpdateModal"
  165. style="width: 50%;float: left;">关闭</button>
  166. <button class="mini-btn" type="primary" size="mini" @click="UpdateProduct"
  167. style="width: 50%;">更新</button>
  168. </view>
  169. </custom-modal>
  170. <!-- 引入自定义模态框 -->
  171. <custom-modal :visible="addModalVisible">
  172. <!-- 模态框的内容 -->
  173. <view>
  174. <text>提示</text>
  175. <view class="uni-input-wrapper" style="margin: 5px auto;">
  176. <text class="uni-form-item__title" style="width: 30%;">所属仓库</text>
  177. <input class="uni-input" :value="warehouse" disabled="true" />
  178. </view>
  179. <view class="uni-input-wrapper" style="margin: 5px auto;">
  180. <text class="uni-form-item__title" style="width: 30%;">存货编码</text>
  181. <input class="uni-input" :value="code" disabled="true" />
  182. </view>
  183. <view class="uni-input-wrapper" style="margin: 5px auto;">
  184. <text class="uni-form-item__title" style="width: 30%;">存货名称</text>
  185. <input class="uni-input" :value="name" disabled="true" />
  186. </view>
  187. <view class="uni-input-wrapper" style="margin: 5px auto;">
  188. <text class="uni-form-item__title" style="width: 30%;">存货型号</text>
  189. <input class="uni-input" :value="model" disabled="true" />
  190. </view>
  191. <view class="uni-input-wrapper" style="margin: 5px auto;">
  192. <text class="uni-form-item__title" style="width: 30%;">存货品牌</text>
  193. <input class="uni-input" :value="brand" disabled="true" />
  194. </view>
  195. <view class="uni-input-wrapper" style="margin: 5px auto;">
  196. <text class="uni-form-item__title" style="width: 30%;">存货单位</text>
  197. <input class="uni-input" :value="unit" disabled="true" />
  198. </view>
  199. <view class="uni-input-wrapper" style="margin: 5px auto;">
  200. <text class="uni-form-item__title" style="width: 30%;">数量</text>
  201. <input type="number" class="uni-input" :value="num" @input="numChange" />
  202. </view>
  203. <view class="uni-input-wrapper" style="margin: 5px auto;">
  204. <text class="uni-form-item__title" style="width: 30%;">仓库备注</text>
  205. <input class="uni-input" :value="remark" @input="remarkChange" />
  206. </view>
  207. <br><br>
  208. <button class="mini-btn" size="mini" @click="closeAddModal" style="width: 50%;float: left;">关闭</button>
  209. <button class="mini-btn" type="primary" size="mini" @click="AddProduct" style="width: 50%;">添加</button>
  210. </view>
  211. </custom-modal>
  212. </view>
  213. </template>
  214. <script>
  215. import CustomModal from "@/components/CustomModal/CustomModal.vue";
  216. import { storage } from '../../store/storage.js';
  217. let _this = null;
  218. import {
  219. mapGetters,
  220. mapActions
  221. } from 'vuex';
  222. import {
  223. GET_INFODATA,
  224. GET_CONNECTBLEDATA
  225. } from "@/store/gettersType.js";
  226. import {
  227. SET_CONNECTBLEDATA
  228. } from '@/store/actionsType.js';
  229. // #ifdef APP-PLUS
  230. const modal = uni.requireNativePlugin('modal');
  231. // #endif
  232. let print;
  233. const reqRootUrl = plus.storage.getItem("reqRootUrl");
  234. const ParamreqRootUrl = reqRootUrl + "/wms/api";
  235. const SpeechTTS = uni.requireNativePlugin('MT-TTS-Speech');
  236. export default {
  237. components: {
  238. CustomModal
  239. },
  240. data() {
  241. return {
  242. wId : "",
  243. /* types: "", */
  244. /* port_sn: "", */
  245. container_code: "",
  246. del_tips: "",
  247. updateModalVisible: false,
  248. addModalVisible: false,
  249. tableData: [],
  250. portList: [],
  251. BtnDisabled: false,
  252. sn: "",
  253. name: "",
  254. code:"",
  255. model: "",
  256. brand: "",
  257. unit: "",
  258. remark: "",
  259. warehouse:"",
  260. num: 0,
  261. area_sn: "",
  262. areaList: [],
  263. category_sn: "",
  264. stockarea : "",
  265. categoryList: [],
  266. stockareaList :[],
  267. qualified: "合格",
  268. qualifiedList: [{
  269. "label": "合格",
  270. "value": "合格"
  271. }, {
  272. "label": "不良",
  273. "value": "不良"
  274. }],
  275. /* zindex1: 1, */
  276. zindex2: 2,
  277. zindex3 :3,
  278. zindex4: 4,
  279. zindex5: 5,
  280. number: "",
  281. pruduct_code: "",
  282. }
  283. },
  284. computed: {
  285. ...mapGetters([GET_INFODATA, GET_CONNECTBLEDATA]),
  286. },
  287. methods: {
  288. onUnload() {
  289. SpeechTTS.destroy();
  290. },
  291. speak_init() {
  292. // console.log('>> TTS:init...')
  293. SpeechTTS.init((callback) => {
  294. // SpeechTTS.setEngine("com.iflytek.speechcloud"); // 设置引擎
  295. SpeechTTS.setEngine("com.google.android.tts"); // 设置引擎
  296. // console.log('>> tts: init success');
  297. SpeechTTS.setPitch(50); // 设置语调 setPitch(num) 0-100, 默认 50
  298. SpeechTTS.setSpeed(65); // 设置语速 setSpeed(num) 0-100, 默认 50
  299. });
  300. SpeechTTS.onDone((res) => {
  301. // console.log(">> tts: play end " + res)
  302. });
  303. },
  304. leftClick: function() {
  305. setTimeout(() => {
  306. uni.navigateBack();
  307. // uni.redirectTo({
  308. // url: '/pages/sample/main',
  309. // })
  310. }, 30);
  311. // this.$emit('change', this.value)
  312. },
  313. CateGet() {
  314. uni.request({
  315. url: ParamreqRootUrl + '/PortGet',
  316. method: 'POST',
  317. headers: {
  318. 'Content-Type': 'application/json'
  319. },
  320. data: JSON.stringify({
  321. "types": "in",
  322. "warehouse_id":_this.wId
  323. }),
  324. success: (ret) => {
  325. // console.log("ret", ret)
  326. if (ret.statusCode === 200) {
  327. this.portList = [];
  328. let rows = ret.data.data;
  329. for (var i = 0; i < rows.length; i++) {
  330. let lab = rows[i]["alias"]
  331. this.portList.push({
  332. label: lab,
  333. value: JSON.stringify(rows[i]["addr"])
  334. })
  335. }
  336. }
  337. },
  338. fail: (err) => {
  339. // console.log('request fail', err);
  340. },
  341. complete: () => {
  342. // console.log('complete');
  343. }
  344. })
  345. uni.request({
  346. url: ParamreqRootUrl + '/AreaAvailable',
  347. method: 'POST',
  348. headers: {
  349. 'Content-Type': 'application/json'
  350. },
  351. data: JSON.stringify({
  352. "disable": false,
  353. "warehouse_id":_this.wId
  354. }),
  355. success: (ret) => {
  356. // console.log("ret", ret)
  357. if (ret.statusCode === 200) {
  358. this.areaList = [];
  359. let rows = ret.data.data;
  360. // console.log("rows", rows);
  361. if (!_this.isEmpty(rows)) {
  362. for (var i = 0; i < rows.length; i++) {
  363. this.areaList.push({
  364. label: rows[i]["name"],
  365. value: rows[i]["sn"]
  366. })
  367. }
  368. }
  369. }
  370. },
  371. fail: (err) => {
  372. // console.log('request fail', err);
  373. },
  374. complete: () => {
  375. // console.log('complete');
  376. }
  377. })
  378. uni.request({
  379. url: ParamreqRootUrl + '/CategoryFind',
  380. method: 'POST',
  381. headers: {
  382. 'Content-Type': 'application/json'
  383. },
  384. data: JSON.stringify({
  385. "disable": false,
  386. "types": "in"
  387. }),
  388. success: (ret) => {
  389. if (ret.statusCode === 200) {
  390. this.categoryList = [];
  391. let rows = ret.data.data;
  392. if (!_this.isEmpty(rows)) {
  393. for (var i = 0; i < rows.length; i++) {
  394. this.categoryList.push({
  395. label: rows[i]["full_name"],
  396. value: rows[i]["sn"]
  397. })
  398. if (rows[i]["full_name"] == "BOM采购入库") {
  399. this.category_sn = rows[i]["sn"]
  400. }
  401. }
  402. }
  403. }
  404. },
  405. fail: (err) => {
  406. // console.log('request fail', err);
  407. },
  408. complete: () => {
  409. // console.log('complete');
  410. }
  411. })
  412. uni.request({
  413. url: ParamreqRootUrl + '/StockU8Find',
  414. method: 'POST',
  415. headers: {
  416. 'Content-Type': 'application/json'
  417. },
  418. data: JSON.stringify({
  419. "disable": false
  420. }),
  421. success: (ret) => {
  422. if (ret.statusCode === 200) {
  423. this.stockareaList = [];
  424. let rows = ret.data.data;
  425. if (!_this.isEmpty(rows)) {
  426. for (var i = 0; i < rows.length; i++) {
  427. this.stockareaList.push({
  428. label: rows[i]["name"],
  429. value: rows[i]["name"]
  430. })
  431. if (rows[i]["name"] == "原材料库") {
  432. this.stockarea = rows[i]["name"]
  433. }
  434. }
  435. }
  436. }
  437. },
  438. fail: (err) => {
  439. // console.log('request fail', err);
  440. },
  441. complete: () => {
  442. // console.log('complete');
  443. }
  444. })
  445. },
  446. selectArea(index, item) {
  447. if (index >= 0) {
  448. _this.area_sn = item.value;
  449. } else {
  450. _this.area_sn = ""
  451. }
  452. },
  453. /* selectPort(index, item) {
  454. if (index >= 0) {
  455. _this.port_sn = item.value;
  456. } else {
  457. _this.port_sn = ""
  458. }
  459. }, */
  460. selectCategory(index, item) {
  461. if (index >= 0) {
  462. _this.category_sn = item.value;
  463. } else {
  464. _this.category_sn = ""
  465. }
  466. },
  467. selectStockArea(index, item) {
  468. if (index >= 0) {
  469. _this.stockarea = item.value;
  470. } else {
  471. _this.stockarea = ""
  472. }
  473. },
  474. rightClick: function() {
  475. setTimeout(() => {
  476. uni.navigateTo({
  477. url: '/pages/sample/richAlert',
  478. })
  479. }, 30);
  480. // this.$emit("rightClick")
  481. },
  482. onLoad() {
  483. _this = this;
  484. _this.firstFocus = true;
  485. _this.getSn()
  486. },
  487. onShow() {
  488. uni.hideKeyboard();
  489. setTimeout(() => {
  490. _this.wId = storage.getItem('reqWarehouseId');
  491. _this.firstFocus = true;
  492. this.getList();
  493. this.speak_init();
  494. this.CateGet();
  495. }, 500);
  496. },
  497. selectQualified(index, item) {
  498. if (index >= 0) {
  499. _this.qualified = item.value;
  500. if (item.value == "不良") {
  501. _this.part = "无"
  502. } else {
  503. _this.part = "生产用料"
  504. }
  505. } else {
  506. _this.qualified = ""
  507. }
  508. },
  509. numChange: function(e) {
  510. this.num = e.target.value
  511. },
  512. remarkChange: function(e) {
  513. this.remark = e.target.value
  514. },
  515. // 新增明细单号处理方法
  516. handleReceiptCodeInput(event) {
  517. const code = event.target.value.trim();
  518. this.number = code;
  519. uni.setStorageSync("number", code);
  520. },
  521. // 新增方法:处理托盘码扫描
  522. handleTrayCodeScan() {
  523. const code = this.container_code.trim();
  524. if (!code) return;
  525. // 验证托盘码
  526. this.validateTrayCode(code);
  527. },
  528. handleTrayCodeInput(event) {
  529. const code = event.target.value.trim();
  530. if (code.length >= 1) { // 假设托盘码至少需要1个字符才触发验证
  531. this.validateTrayCode(code);
  532. }
  533. },
  534. // 修改后的方法:验证托盘码
  535. validateTrayCode(code) {
  536. uni.request({
  537. url: ParamreqRootUrl + '/CodeGet',
  538. method: 'POST',
  539. headers: {
  540. 'Content-Type': 'application/json'
  541. },
  542. data: JSON.stringify({
  543. "code": code,
  544. "warehouse_id":_this.wId
  545. }),
  546. success: (ret) => {
  547. if (ret.statusCode !== 200) {
  548. _this.alertInfo("托盘码错误,请重新扫描!");
  549. _this.container_code = "";
  550. _this.focusInput();
  551. return;
  552. }
  553. let rows = ret.data.data;
  554. if (_this.isEmpty(rows)) {
  555. _this.alertInfo("托盘码错误,请重新扫描!");
  556. _this.container_code = "";
  557. _this.focusInput();
  558. return;
  559. }
  560. this.container_code = code;
  561. uni.setStorageSync("container_code", code);
  562. if (!_this.isEmpty(rows["group_disk"])) {
  563. let disk = [];
  564. for (var i = 0; i < rows["group_disk"].length; i++) {
  565. if (rows["group_disk"][i]["status"] === "status_wait") {
  566. rows["group_disk"][i]["status_view"] = "待组盘"
  567. }
  568. if (rows["group_disk"][i]["status"] === "status_yes") {
  569. _this.BtnDisabled = true
  570. rows["group_disk"][i]["status_view"] = "已组盘"
  571. }
  572. disk.push(rows["group_disk"][i])
  573. }
  574. let rData = disk;
  575. if (rData.length > 0) {
  576. _this.product_name = rData[0]["product_name"];
  577. uni.setStorageSync("product_types", rData[0]["types"])
  578. _this.product_code = rData[0]["product_code"];
  579. _this.container_code = rData[0]["container_code"];
  580. uni.setStorageSync("container_code", rData[0]["container_code"])
  581. uni.setStorageSync("receipt_num", rData[0]["receipt_num"])
  582. }
  583. this.tableData = disk;
  584. }
  585. if (!_this.isEmpty(rows["container_code"])) {
  586. _this.container_code = code;
  587. uni.removeStorageSync('container_code');
  588. uni.setStorageSync("container_code", code)
  589. if (_this.tableData.length > 0) {
  590. for (let i = 0; i < _this.tableData.length; i++) {
  591. if (_this.tableData[i]["container_code"] === "") {
  592. uni.request({
  593. url: reqRootUrl + '/wms/api',
  594. method: 'POST',
  595. headers: {
  596. 'Content-Type': 'application/json'
  597. },
  598. data: JSON.stringify({
  599. "method": "GroupDiskUpdate",
  600. "param": {
  601. "sn": _this.tableData[i]["sn"],
  602. "container_code": code,
  603. "warehouse_id":_this.wId
  604. }
  605. }),
  606. success: (ret) => {
  607. if(ret.data.ret == "failed"){
  608. _this.alertInfo(ret.data.msg)
  609. return
  610. }
  611. _this.alertInfo("更新成功!")
  612. _this.getList()
  613. //处理成功逻辑
  614. },
  615. })
  616. } else {
  617. if (_this.tableData[i]["container_code"] !== code) {
  618. _this.getSn();
  619. _this.getList();
  620. }
  621. }
  622. }
  623. } else {
  624. _this.getList();
  625. }
  626. }
  627. },
  628. fail: (err) => {
  629. this.focusInput()
  630. this.alertInfo("请求失败,请重试!");
  631. },
  632. complete: () => {
  633. // 可以在这里添加一些完成后的操作
  634. }
  635. });
  636. },
  637. // 修改后的方法:隐藏键盘(可选)
  638. hideKeyboard: function(event) {
  639. // 不再自动隐藏键盘,让用户自己决定何时隐藏
  640. // 或者可以添加延迟自动隐藏
  641. // setTimeout(() => {
  642. // uni.hideKeyboard();
  643. // }, 100);
  644. },
  645. handlepruductCodeInput(event) {
  646. const code = event.target.value.trim();
  647. if (code.length >= 1) { // 假设明细单号至少需要1个字符才触发验证
  648. /**/if (_this.isEmpty(_this.container_code)) {
  649. _this.alertInfo("请先扫描托盘码");
  650. _this.focusInput();
  651. return
  652. }
  653. this.pruduct_code = code;
  654. uni.request({
  655. url: ParamreqRootUrl + '/ProductGet',
  656. method: 'POST',
  657. headers: {
  658. 'Content-Type': 'application/json'
  659. },
  660. data: JSON.stringify({
  661. "code": code,
  662. "disable": false,
  663. // "source": "U8"
  664. }),
  665. success: (ret) => {
  666. if (ret.statusCode !== 200) {
  667. _this.product_code = "";
  668. _this.alertInfo("存货编码错误,请重新扫描!");
  669. _this.focusInput();
  670. return;
  671. }
  672. let rows = ret.data.data;
  673. if (_this.isEmpty(rows)) {
  674. _this.product_code = "";
  675. _this.alertInfo("存货编码错误,请重新扫描!");
  676. _this.focusInput();
  677. return;
  678. }
  679. // AAAA
  680. _this.Add(rows[0])
  681. },
  682. fail: (err) => {
  683. this.alertInfo("请求失败,请重试!");
  684. },
  685. })
  686. }
  687. },
  688. closeAddModal() {
  689. // 关闭模态框
  690. _this.sn = "";
  691. _this.warehouse ="";
  692. _this.name = "";
  693. _this.code = "";
  694. _this.model = "";
  695. _this.brand = "";
  696. _this.unit = "";
  697. _this.remark = "";
  698. _this.num = 0;
  699. /* _this.zindex1 = 1; */
  700. _this.zindex2 = 2;
  701. _this.zindex3 = 3;
  702. _this.zindex4 = 4;
  703. _this.zindex5 = 5;
  704. this.addModalVisible = false;
  705. },
  706. Add(item) {
  707. _this.warehouse = item.warehouse_id;
  708. _this.alertInfo("请填写正确的数量!")
  709. _this.sn = item.sn;
  710. _this.name = item.name;
  711. _this.code = item.code;
  712. _this.model = item.model;
  713. _this.brand = item.brand;
  714. _this.unit = item.unit;
  715. _this.remark = item.remark;
  716. _this.num = 1;
  717. /* _this.zindex1 = 0; */
  718. _this.zindex2 = 0;
  719. _this.zindex3 = 0;
  720. _this.zindex4 = 0;
  721. _this.zindex5 = 0;
  722. _this.addModalVisible = true;
  723. },
  724. AddProduct() {
  725. let data = {};
  726. if (parseFloat(_this.num) <= 0) {
  727. _this.alertInfo("请填写正确的数量!")
  728. return
  729. }
  730. setTimeout(() => {
  731. let receiptNum = uni.getStorageSync("receipt_num")
  732. let number = uni.getStorageSync("number")
  733. let containerCode = uni.getStorageSync("container_code")
  734. uni.request({
  735. url: ParamreqRootUrl + '/GroupDiskAdd',
  736. method: 'POST',
  737. async: false,
  738. headers: {
  739. 'Content-Type': 'application/json'
  740. },
  741. data: JSON.stringify({
  742. "code": _this.pruduct_code,
  743. "num": parseFloat(_this.num),
  744. "remark": _this.remark,
  745. "types": "normal",
  746. "receipt_num": receiptNum,
  747. "number": number,
  748. "container_code": containerCode,
  749. "warehouse_id": _this.wId
  750. }),
  751. success: (ret) => {
  752. if (ret.statusCode === 200) {
  753. setTimeout(() => {
  754. if(ret.data.ret == "failed"){
  755. _this.alertInfo(ret.data.msg)
  756. }else{
  757. _this.alertInfo("添加成功!")
  758. }
  759. _this.$nextTick(() => {
  760. _this.pruduct_code = "";
  761. _this.number ="";
  762. _this.sn = "";
  763. _this.name = "";
  764. _this.code ="";
  765. _this.model = "";
  766. _this.brand = "";
  767. _this.unit = "";
  768. _this.remark = "";
  769. _this.num = 0;
  770. /* _this.zindex1 = 1; */
  771. _this.zindex2 = 2;
  772. _this.zindex3 = 3;
  773. _this.zindex4 = 4;
  774. _this.zindex5 = 5;
  775. // 关闭窗口后,恢复默认内容
  776. _this.addModalVisible = false;
  777. _this.getList();
  778. })
  779. }, 30);
  780. }
  781. },
  782. fail: (err) => {
  783. // console.log("BBBBBBBBBBBBBB ", err)
  784. // console.log('request fail', err);
  785. },
  786. complete: (DATE) => {
  787. // console.log("BBBBBBBBBBBBBB ", DATE)
  788. // console.log('complete');
  789. }
  790. })
  791. }, 30)
  792. },
  793. closeUpdateModal() {
  794. /* _this.zindex1 = 1; */
  795. _this.zindex2 = 2;
  796. _this.zindex3 = 3;
  797. _this.zindex4 = 4;
  798. _this.zindex5 = 5;
  799. // 关闭模态框
  800. _this.sn = "";
  801. _this.name = "";
  802. _this.code ="";
  803. _this.model = "";
  804. _this.brand = "";
  805. _this.unit = "";
  806. _this.remark = "";
  807. _this.num = 0;
  808. this.updateModalVisible = false;
  809. },
  810. Update(item) {
  811. if (item["allow_updates"] === false) {
  812. return
  813. }
  814. _this.sn = item.sn;
  815. _this.name = item.name;
  816. _this.code = item.code;
  817. _this.model = item.model;
  818. _this.brand = item.brand;
  819. _this.unit = item.unit;
  820. _this.remark = item.remark;
  821. _this.num = item.num;
  822. /* _this.zindex1 = 0; */
  823. _this.zindex2 = 0;
  824. _this.zindex3 = 0;
  825. _this.zindex4 = 0;
  826. _this.zindex5 = 0;
  827. _this.updateModalVisible = true;
  828. },
  829. UpdateProduct() {
  830. let data = {};
  831. if (parseFloat(_this.num) <= 0) {
  832. _this.alertInfo("请填写正确的数量!")
  833. return
  834. }
  835. setTimeout(() => {
  836. let receiptNum = uni.getStorageSync("receipt_num")
  837. let containerCode = uni.getStorageSync("container_code")
  838. uni.request({
  839. url: ParamreqRootUrl + '/GroupDiskUpdate',
  840. method: 'POST',
  841. async: false,
  842. headers: {
  843. 'Content-Type': 'application/json'
  844. },
  845. data: JSON.stringify({
  846. "sn": _this.sn,
  847. "num": parseFloat(_this.num),
  848. "remark": _this.remark,
  849. "warehouse_id": _this.wId
  850. }),
  851. success: (ret) => {
  852. if (ret.statusCode === 200) {
  853. setTimeout(() => {
  854. _this.alertInfo("更新成功!")
  855. _this.$nextTick(() => {
  856. _this.sn = "";
  857. _this.name = "";
  858. _this.code ="";
  859. _this.model = "";
  860. _this.brand = "";
  861. _this.remark = "";
  862. _this.num = 0;
  863. /* _this.zindex1 = 1; */
  864. _this.zindex2 = 2;
  865. _this.zindex3 = 3;
  866. _this.zindex4 = 4;
  867. _this.zindex5 = 5;
  868. // 关闭窗口后,恢复默认内容
  869. _this.updateModalVisible = false;
  870. _this.getList();
  871. })
  872. }, 30);
  873. }
  874. },
  875. fail: (err) => {
  876. // console.log("BBBBBBBBBBBBBB ", err)
  877. // console.log('request fail', err);
  878. },
  879. complete: (DATE) => {
  880. // console.log("BBBBBBBBBBBBBB ", DATE)
  881. // console.log('complete');
  882. }
  883. })
  884. }, 30)
  885. },
  886. Delete(item) {
  887. // 出库后 扫码再次组盘的条目 不允许删除和更新数量 allow_updates
  888. if (item["allow_updates"] === false) {
  889. return
  890. }
  891. this.sn = item["sn"]
  892. this.del_tips = "确定删除" + item["name"] + "?";
  893. this.$refs.deleteDialog.open()
  894. },
  895. dialogConfirm() {
  896. setTimeout(() => {
  897. uni.hideLoading()
  898. uni.request({
  899. url: ParamreqRootUrl + '/GroupDiskDelete',
  900. method: 'POST',
  901. async: false,
  902. headers: {
  903. 'Content-Type': 'application/json'
  904. },
  905. data: JSON.stringify({
  906. [_this.sn]: {}
  907. }),
  908. success: (ret) => {
  909. this.$refs.deleteDialog.close()
  910. _this.alertInfo("删除成功!")
  911. _this.getList()
  912. //处理成功逻辑
  913. },
  914. fail: (err) => {
  915. // console.log('request fail', err);
  916. },
  917. complete: () => {
  918. // console.log('complete');
  919. }
  920. })
  921. }, 30)
  922. },
  923. dialogClose() {
  924. _this.getList();
  925. },
  926. getList() {
  927. _this.$forceUpdate()
  928. _this.tableData = [];
  929. let receiptNum = uni.getStorageSync("receipt_num")
  930. // let number = uni.getStorageSync("number");
  931. let containerCode = uni.getStorageSync("container_code");
  932. /* if (!_this.isEmpty(number) && _this.isEmpty(_this.number)) {
  933. _this.number = number;
  934. } */
  935. if (!_this.isEmpty(containerCode) && _this.isEmpty(_this.container_code)) {
  936. _this.container_code = containerCode;
  937. }
  938. /**/
  939. if (_this.isEmpty(_this.container_code)) {
  940. return
  941. }
  942. uni.request({
  943. url: ParamreqRootUrl + '/GroupDiskGetByCode',
  944. method: 'POST',
  945. async: false,
  946. headers: {
  947. 'Content-Type': 'application/json'
  948. },
  949. data: JSON.stringify({
  950. /* "number": _this.number, */
  951. "code": _this.container_code,
  952. // "receipt_num": receiptNum,
  953. "warehouse_id": _this.wId
  954. }),
  955. success: (ret) => {
  956. //处理成功逻辑
  957. if (ret.statusCode === 200) {
  958. let rows = ret.data.data;
  959. if (!_this.isEmpty(rows)) {
  960. for (var c = 0; c < rows.length; c++) {
  961. if (rows[c]["status"] === "status_yes") {
  962. rows[c]["status_view"] = "已组盘"
  963. } else {
  964. rows[c]["status_view"] = "待组盘"
  965. }
  966. }
  967. _this.tableData = rows
  968. }
  969. }
  970. },
  971. fail: (err) => {
  972. // console.log('request fail', err);
  973. },
  974. complete: () => {
  975. // console.log('complete');
  976. }
  977. })
  978. },
  979. // 组盘入库
  980. groupDisk: function() {
  981. _this.firstFocus = false;
  982. console.log("4444",_this.wId )
  983. if (_this.isEmpty(_this.container_code)) {
  984. _this.alertInfo("托盘码不能为空")
  985. return
  986. }
  987. if (_this.BtnDisabled) {
  988. _this.alertInfo("已组盘货物不能再次组盘")
  989. return;
  990. }
  991. if (_this.qualified == "不良" && _this.isEmpty(_this.area_sn)) {
  992. _this.alertInfo("不良品入库,请选择库区")
  993. return;
  994. }
  995. if (_this.isEmpty(_this.category_sn)) {
  996. _this.alertInfo("请选择入库类别")
  997. return
  998. }
  999. if (_this.isEmpty(_this.qualified)) {
  1000. _this.alertInfo("请选择入库状态")
  1001. return
  1002. }
  1003. if (_this.isEmpty(_this.stockarea)) {
  1004. _this.alertInfo("请选择U8仓库")
  1005. return
  1006. }
  1007. /* if (_this.isEmpty(_this.port_sn) && _this.types != "out") {
  1008. _this.alertInfo("请选择入库口")
  1009. return
  1010. } */
  1011. let sns = [];
  1012. for (var d = 0; d < _this.tableData.length; d++) {
  1013. if (this.tableData[d]["status"] !== "status_wait") {
  1014. continue
  1015. }
  1016. sns.push(this.tableData[d].sn)
  1017. }
  1018. uni.request({
  1019. url: ParamreqRootUrl + '/VerifyWarehouse',
  1020. method: 'POST',
  1021. async: false,
  1022. headers: {
  1023. 'Content-Type': 'application/json'
  1024. },
  1025. data: JSON.stringify({
  1026. "group_disk_sn_list": sns,
  1027. "areaSn": _this.area_sn,
  1028. "warehouse_id": _this.wId
  1029. }),
  1030. success: (ret) => {
  1031. if(ret.data.ret =="failed"){
  1032. _this.alertInfo(ret.data.msg)
  1033. return
  1034. }
  1035. setTimeout(() => {
  1036. this.$refs.groupDialog.open()
  1037. }, 30)
  1038. },
  1039. fail: (err) => {
  1040. // console.log('request fail', err);
  1041. },
  1042. complete: () => {
  1043. // console.log('complete');
  1044. }
  1045. })
  1046. },
  1047. // 空筐入库
  1048. addMaterial: function() {
  1049. _this.firstFocus = false;
  1050. if (_this.isEmpty(_this.container_code)) {
  1051. _this.alertInfo("托盘码不能为空")
  1052. return
  1053. }
  1054. /* if (_this.isEmpty(_this.port_sn) && _this.types != "out") {
  1055. _this.alertInfo("请选择入库口")
  1056. return
  1057. } */
  1058. setTimeout(() => {
  1059. this.$refs.groupMaterialDialog.open()
  1060. }, 30)
  1061. },
  1062. // 确定组盘
  1063. dialogGroup() {
  1064. let sns = [];
  1065. for (var d = 0; d < _this.tableData.length; d++) {
  1066. if (this.tableData[d]["status"] !== "status_wait") {
  1067. continue
  1068. }
  1069. sns.push(this.tableData[d].sn)
  1070. }
  1071. let receiptNum = uni.getStorageSync("receipt_num")
  1072. if (_this.isEmpty(_this.container_code)) {
  1073. _this.alertInfo("组盘失败!托盘码不能为空")
  1074. return
  1075. }
  1076. if (_this.isEmpty(_this.category_sn)) {
  1077. _this.alertInfo("请选择入库类别")
  1078. return
  1079. }
  1080. if (_this.isEmpty(_this.qualified)) {
  1081. _this.alertInfo("请选择入库状态")
  1082. return
  1083. }
  1084. if (_this.isEmpty(_this.stockarea)) {
  1085. _this.alertInfo("请选择U8仓库")
  1086. return
  1087. }
  1088. uni.request({
  1089. url: ParamreqRootUrl + '/ReceiptAdd',
  1090. method: 'POST',
  1091. async: false,
  1092. headers: {
  1093. 'Content-Type': 'application/json'
  1094. },
  1095. data: JSON.stringify({
  1096. "group_disk_sn_list": sns,
  1097. "container_code": _this.container_code,
  1098. "receipt_num": receiptNum,
  1099. /* "types": _this.types, */
  1100. "areaSn": _this.area_sn,
  1101. "category_sn": _this.category_sn,
  1102. "upstreamstock" : _this.stockarea,
  1103. "qualified": _this.qualified,
  1104. "warehouse_id": _this.wId
  1105. /* "srcaddr": JSON.parse(_this.port_sn) */
  1106. }),
  1107. success: (ret) => {
  1108. if(ret.data.ret =="failed"){
  1109. _this.alertInfo(ret.data.msg)
  1110. return
  1111. }
  1112. _this.alertInfo("操作成功")
  1113. _this.$nextTick(() => {
  1114. _this.container_code = "";
  1115. uni.setStorageSync("container_code", "")
  1116. _this.number = "";
  1117. uni.setStorageSync("number", "")
  1118. _this.area_sn = "";
  1119. _this.port_sn = "";
  1120. _this.getSn();
  1121. _this.tableData = [];
  1122. sns = [];
  1123. })
  1124. _this.$forceUpdate()
  1125. },
  1126. fail: (err) => {
  1127. // console.log('request fail', err);
  1128. },
  1129. complete: () => {
  1130. // console.log('complete');
  1131. }
  1132. })
  1133. },
  1134. // 空筐确定
  1135. dialogMaterialGroup() {
  1136. let receiptNum = uni.getStorageSync("receipt_num")
  1137. if (_this.isEmpty(_this.container_code)) {
  1138. _this.alertInfo("组盘失败!托盘码不能为空")
  1139. return
  1140. }
  1141. uni.request({
  1142. url: ParamreqRootUrl + '/MaterialAdd',
  1143. method: 'POST',
  1144. async: false,
  1145. headers: {
  1146. 'Content-Type': 'application/json'
  1147. },
  1148. data: JSON.stringify({
  1149. "container_code": _this.container_code,
  1150. "receipt_num": receiptNum,
  1151. "warehouse_id": _this.wId
  1152. /* "srcaddr": JSON.parse(_this.port_sn) */
  1153. }),
  1154. success: (ret) => {
  1155. _this.alertInfo("操作成功")
  1156. _this.$nextTick(() => {
  1157. _this.container_code = "";
  1158. uni.setStorageSync("container_code", "")
  1159. _this.number = "";
  1160. uni.setStorageSync("number", "")
  1161. _this.area_sn = "";
  1162. _this.getSn();
  1163. _this.getList();
  1164. })
  1165. _this.$forceUpdate()
  1166. //_this.handlePrint(receiptNum)
  1167. },
  1168. fail: (err) => {
  1169. // console.log('request fail', err);
  1170. },
  1171. complete: () => {
  1172. // console.log('complete');
  1173. }
  1174. })
  1175. },
  1176. // 1号口
  1177. getOneNilCode: function() {
  1178. _this.firstFocus = false;
  1179. setTimeout(() => {
  1180. this.$refs.nilCodeOneDialog.open()
  1181. }, 30)
  1182. },
  1183. // 1号口确定
  1184. dialogNilCodeOne() {
  1185. uni.request({
  1186. url: ParamreqRootUrl + '/PDACallEmptyTray',
  1187. method: 'POST',
  1188. async: false,
  1189. headers: {
  1190. 'Content-Type': 'application/json'
  1191. },
  1192. data: JSON.stringify({
  1193. "export": "1",
  1194. "warehouse_id": _this.wId
  1195. }),
  1196. success: (ret) => {
  1197. if (ret.statusCode == "200") {
  1198. if (ret.data.ret == "failed") {
  1199. _this.alertInfo(ret.data.msg)
  1200. return
  1201. } else {
  1202. _this.alertInfo("操作成功")
  1203. return
  1204. }
  1205. } else {
  1206. _this.alertInfo("操作失败")
  1207. }
  1208. },
  1209. fail: (err) => {
  1210. // console.log('request fail', err);
  1211. },
  1212. complete: () => {
  1213. // console.log('complete');
  1214. }
  1215. })
  1216. },
  1217. // 2号口
  1218. getTwoNilCode: function() {
  1219. _this.firstFocus = false;
  1220. setTimeout(() => {
  1221. this.$refs.nilCodeTwoDialog.open()
  1222. }, 30)
  1223. },
  1224. // 2号口确定
  1225. dialogNilCodeTwo() {
  1226. uni.request({
  1227. url: ParamreqRootUrl + '/PDACallEmptyTray',
  1228. method: 'POST',
  1229. async: false,
  1230. headers: {
  1231. 'Content-Type': 'application/json'
  1232. },
  1233. data: JSON.stringify({
  1234. "export": "2",
  1235. "warehouse_id": _this.wId
  1236. }),
  1237. success: (ret) => {
  1238. if (ret.statusCode == "200") {
  1239. if (ret.data.ret == "failed") {
  1240. _this.alertInfo(ret.data.msg)
  1241. return
  1242. } else {
  1243. _this.alertInfo("操作成功")
  1244. return
  1245. }
  1246. } else {
  1247. _this.alertInfo("操作失败")
  1248. }
  1249. },
  1250. fail: (err) => {
  1251. // console.log('request fail', err);
  1252. },
  1253. complete: () => {
  1254. // console.log('complete');
  1255. }
  1256. })
  1257. },
  1258. isEmpty: function(obj) {
  1259. return typeof obj === undefined || obj == null || obj === "" || obj ===
  1260. "000000000000000000000000" ||
  1261. obj.length === 0;
  1262. },
  1263. alertInfo(str) {
  1264. SpeechTTS.speak({
  1265. text: str,
  1266. });
  1267. modal.toast({
  1268. message: str,
  1269. duration: 6,
  1270. });
  1271. },
  1272. onNavigationBarButtonTap: function(e) {
  1273. setTimeout(() => {
  1274. uni.navigateTo({
  1275. url: '/pages/sample/richAlert',
  1276. })
  1277. }, 500);
  1278. },
  1279. SelectProduct() {
  1280. setTimeout(() => {
  1281. _this.firstFocus = false;
  1282. uni.navigateTo({
  1283. url: '/pages/sample/product',
  1284. })
  1285. }, 30)
  1286. },
  1287. getSn() {
  1288. let today = new Date();
  1289. let year = today.getFullYear();
  1290. let month = today.getMonth() + 1;
  1291. let date = today.getDate();
  1292. let hours = today.getHours();
  1293. let minutes = today.getMinutes();
  1294. let seconds = today.getSeconds();
  1295. let millisecond = today.getMilliseconds()
  1296. if (month <= 9) {
  1297. month = '0' + month
  1298. }
  1299. if (minutes <= 9) {
  1300. minutes = '0' + minutes;
  1301. }
  1302. if (date <= 9) {
  1303. date = '0' + date;
  1304. }
  1305. if (seconds <= 9) {
  1306. seconds = '0' + seconds;
  1307. }
  1308. let sn = year + '' + month + '' + date + '' + hours + '' + minutes + '' + seconds + '' + millisecond
  1309. uni.removeStorageSync('receipt_num');
  1310. uni.setStorageSync("receipt_num", sn)
  1311. uni.removeStorageSync('port_sn');
  1312. return sn
  1313. },
  1314. formattedDate(d) {
  1315. const date = new Date(d);
  1316. const year = date.getFullYear();
  1317. const month = String(date.getMonth() + 1).padStart(2, '0');
  1318. const day = String(date.getDate()).padStart(2, '0');
  1319. const hours = String(date.getHours()).padStart(2, '0');
  1320. const minutes = String(date.getMinutes()).padStart(2, '0');
  1321. const seconds = String(date.getSeconds()).padStart(2, '0');
  1322. return `${year}-${month}-${day}`;
  1323. },
  1324. focusInput() {
  1325. setTimeout(() => {
  1326. _this.$refs.trayCodeInput.focus();
  1327. }, 0);
  1328. },
  1329. // 新增聚焦到明细单号输入框的方法
  1330. focusReceiptInput() {
  1331. setTimeout(() => {
  1332. _this.$refs.receiptCodeInput.focus();
  1333. }, 0);
  1334. },
  1335. // 新增聚焦到明细单号输入框的方法
  1336. focuspruductCodeInput() {
  1337. setTimeout(() => {
  1338. _this.$refs.pruductCodeInput.focus();
  1339. }, 0);
  1340. },
  1341. },
  1342. }
  1343. </script>
  1344. <style scoped>
  1345. .nvue-page-root {
  1346. background-color: #F8F8F8;
  1347. padding-bottom: 0px;
  1348. }
  1349. .uni-form-item__title {
  1350. margin: 5px auto;
  1351. }
  1352. .uni-input-wrapper {
  1353. /* #ifndef APP-NVUE */
  1354. display: flex;
  1355. /* #endif */
  1356. flex-direction: row;
  1357. flex-wrap: nowrap;
  1358. background-color: #FFFFFF;
  1359. }
  1360. .uni-input {
  1361. height: 28px;
  1362. line-height: 28px;
  1363. font-size: 15px;
  1364. padding: 1px;
  1365. flex: 1;
  1366. border-radius: 5px;
  1367. border: 1px solid #cfdadd;
  1368. background-color: #FFFFFF;
  1369. }
  1370. .mini-btn {
  1371. height: 30px;
  1372. padding-left: 1px;
  1373. padding-right: 1px;
  1374. }
  1375. .uni-eye-active {
  1376. color: #007AFF;
  1377. }
  1378. .table-title {
  1379. background-color: aliceblue;
  1380. font-weight: 700;
  1381. margin-top: 10px;
  1382. height: 40px;
  1383. }
  1384. .table-data {
  1385. background-color: aliceblue;
  1386. font-weight: 700;
  1387. margin-top: 1px;
  1388. height: 40px;
  1389. }
  1390. .tab-tr {
  1391. width: 25%;
  1392. line-height: 50px;
  1393. border-right: 1px solid #ccc;
  1394. margin: auto;
  1395. text-align: center;
  1396. }
  1397. .tab-tr-end {
  1398. width: 25%;
  1399. line-height: 50px;
  1400. border-right: 0px solid #ccc;
  1401. margin: auto;
  1402. text-align: center;
  1403. }
  1404. </style>
  1405. <style lang="scss">
  1406. $color-base: #0039a6;
  1407. $words-color-base: #333333;
  1408. $words-color-light: #999999;
  1409. .header-wrap {
  1410. width: 100%;
  1411. position: fixed;
  1412. top: 0;
  1413. z-index: 999;
  1414. .index-header {
  1415. height: 88upx;
  1416. line-height: 88upx;
  1417. padding: 0 30upx;
  1418. padding-top: 40upx;
  1419. background-color: $color-base;
  1420. font-Size: 28upx;
  1421. color: #fff;
  1422. display: flex;
  1423. align-items: center;
  1424. justify-content: space-between;
  1425. .fanhui {
  1426. color: #fff !important;
  1427. font-size: 28px;
  1428. padding-top: 5px;
  1429. font-weight: 700;
  1430. }
  1431. .lanya {
  1432. color: #fff !important;
  1433. font-size: 28px;
  1434. padding-top: 5px;
  1435. }
  1436. .map-wrap {
  1437. padding-top: 5px;
  1438. }
  1439. }
  1440. }
  1441. .blank {
  1442. height: 126upx;
  1443. }
  1444. // 购物车列表
  1445. .cart-list {
  1446. padding: 0 5rpx;
  1447. // 购物车商品
  1448. .goods {
  1449. display: flex;
  1450. padding: 5rpx;
  1451. border-radius: 10rpx;
  1452. background-color: #fff;
  1453. position: relative;
  1454. .meta {
  1455. // border:1px solid red;
  1456. flex: 1;
  1457. display: flex;
  1458. flex-direction: column;
  1459. justify-content: space-between;
  1460. margin-left: 5rpx;
  1461. }
  1462. .name {
  1463. height: auto;
  1464. font-size: 18px;
  1465. color: #000000;
  1466. }
  1467. .specs {
  1468. line-height: 2;
  1469. padding: 0 15rpx;
  1470. font-size: 16px;
  1471. align-self: flex-start;
  1472. border-radius: 4rpx;
  1473. color: #888;
  1474. background-color: #f7f7f8;
  1475. }
  1476. .status_view {
  1477. line-height: 1;
  1478. font-size: 18px;
  1479. color: #444;
  1480. margin-bottom: 2rpx;
  1481. color: #000000;
  1482. padding-top: 5px;
  1483. }
  1484. // 商品数量
  1485. .numGroup {
  1486. // border: 1px solid green;
  1487. // position: absolute;
  1488. // bottom: 70rpx;
  1489. // right: 5rpx;
  1490. display: flex;
  1491. justify-content: space-between;
  1492. align-items: center;
  1493. // width: 120px;
  1494. height: 48rpx;
  1495. .text_1 {
  1496. // border: 1px solid red;
  1497. width: 50px;
  1498. height: 100%;
  1499. padding: 0 5rpx;
  1500. font-size: 15px;
  1501. color: #444;
  1502. }
  1503. .text {
  1504. height: 100%;
  1505. padding: 0 5rpx;
  1506. font-size: 32rpx;
  1507. color: #444;
  1508. }
  1509. .inputs {
  1510. // border: 1px solid blue;
  1511. height: 100%;
  1512. padding-bottom: 10px;
  1513. text-align: center;
  1514. border-radius: 4rpx;
  1515. font-size: 20px;
  1516. color: #ff0000;
  1517. // background-color: #f6f6f6;
  1518. }
  1519. }
  1520. // 商品数量
  1521. .weightGroup {
  1522. // border: 1px solid green;
  1523. position: absolute;
  1524. bottom: 20rpx;
  1525. right: 5rpx;
  1526. display: flex;
  1527. justify-content: space-between;
  1528. align-items: center;
  1529. width: 120px;
  1530. height: 48rpx;
  1531. .text_1 {
  1532. // border: 1px solid red;
  1533. width: 50px;
  1534. height: 100%;
  1535. padding: 0 5rpx;
  1536. font-size: 15px;
  1537. color: #444;
  1538. }
  1539. .text {
  1540. height: 100%;
  1541. padding: 0 5rpx;
  1542. font-size: 32rpx;
  1543. color: #444;
  1544. }
  1545. .inputs {
  1546. // border: 1px solid blue;
  1547. height: 100%;
  1548. padding-bottom: 10px;
  1549. text-align: center;
  1550. border-radius: 4rpx;
  1551. font-size: 20px;
  1552. color: #ff0000;
  1553. // background-color: #f6f6f6;
  1554. }
  1555. }
  1556. }
  1557. .cart-swipe {
  1558. display: block;
  1559. margin: 20rpx 0;
  1560. }
  1561. }
  1562. </style>