docking.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. <template>
  2. <view class="content">
  3. <view class="confirm-view">
  4. <text class="text">入库库位:</text>
  5. <uni-easyinput
  6. errorMessage
  7. type="text"
  8. v-model="sourceLocationId"
  9. focus
  10. :focus="focusState"
  11. @focus="focusFn"
  12. :class="recshow ? 'rec' : ''"
  13. @blur="focusState = false"
  14. @input="input"
  15. placeholder-style="font-size:16px;color: #a7a7a7;"
  16. :placeholder="placeholder"></uni-easyinput>
  17. <button
  18. type="default"
  19. @click="goto('/pages/Warehousing/select/index?show=6&tip=' + 1)">
  20. 选择
  21. </button>
  22. </view>
  23. <view class="confirm-view">
  24. <text class="text">出库库位:</text>
  25. <uni-easyinput
  26. errorMessage
  27. type="text"
  28. v-model="targetLocationld"
  29. focus
  30. :focus="focusStatetim"
  31. @focus="focusFnsw"
  32. :class="recshowsw ? 'rec' : ''"
  33. @blur="focusStatetim = false"
  34. @input="inputEasy"
  35. placeholder-style="font-size:16px;color: #a7a7a7;"
  36. :placeholder="placeholdesrs"></uni-easyinput>
  37. <!-- <button
  38. type="default"
  39. @click="goto('/pages/Warehousing/select/index?show=7&tip=' + 2)">
  40. 选择
  41. </button> -->
  42. </view>
  43. <view class="confirm-view">
  44. <text class="text">托盘:</text>
  45. <uni-easyinput
  46. type="text"
  47. errorMessage
  48. v-model="palletNo"
  49. focus
  50. :focus="focusStateto"
  51. @focus="focusFnto"
  52. :class="recshowto ? 'recto' : ''"
  53. @blur="focusStateto = false"
  54. placeholder-style="font-size:16px;color: #a7a7a7;"
  55. :placeholder="placeholders"></uni-easyinput>
  56. </view>
  57. <!-- <view class="confirm-view">
  58. <text class="text">数量:</text>
  59. <view class="" style="display: flex; align-items: center; width: 50%"> -->
  60. <!-- <uni-data-select
  61. v-model="qty"
  62. :localdata="range"
  63. @change="change"></uni-data-select> -->
  64. <!-- <text>4桶</text>
  65. </view>
  66. </view>
  67. <view class="confirm-view">
  68. <text class="text">物料:</text>
  69. <view class="">
  70. <view class="view_icon" @click="inputDialogToggle">
  71. <text v-if="valueTmia != ''">{{ valueTmia }}</text>
  72. <text v-else>请选择物料</text>
  73. </view> -->
  74. <!-- <view class="view_icon"><text>丁铵黑药</text></view> -->
  75. <!-- </view>
  76. </view> -->
  77. <view class="vercode_content">
  78. <view class="vontent_boby" @click="warehous">
  79. <view class="uicon-volume_text">
  80. <text class="text">物料:</text>
  81. <text v-if="valueTmia != ''">{{ valueTmia }}</text>
  82. <text v-else>请选择物料</text>
  83. </view>
  84. <view class="uicon-volume_text">
  85. <text>数量:4桶</text>
  86. </view>
  87. </view>
  88. </view>
  89. <view class="border-buttons">
  90. <!-- <view class="buttons" @click="Material">
  91. <text>新增物料</text>
  92. </view> -->
  93. <view class="buttons2" @click="WeakRefthree">
  94. <text>新增越库</text>
  95. </view>
  96. </view>
  97. <xw-scan></xw-scan>
  98. <uni-popup ref="inputDialog" type="dialog">
  99. <uni-popup-dialog
  100. ref="inputClose"
  101. title="选择物料"
  102. value="对话框预置提示内容!"
  103. placeholder="请输入内容"
  104. @confirm="dialogInputConfirm">
  105. <u-radio-group
  106. placement="column"
  107. :borderBottom="true"
  108. v-model="value"
  109. iconPlacement="right">
  110. <u-radio
  111. :customStyle="{ marginBottom: '8px' }"
  112. v-for="(item, index) in radiolist1"
  113. :key="index"
  114. :label="item.name"
  115. :name="item.name"
  116. @change="radioChange($event, item)"></u-radio>
  117. </u-radio-group>
  118. </uni-popup-dialog>
  119. </uni-popup>
  120. <u-toast ref="uToast" />
  121. </view>
  122. </template>
  123. <script>
  124. export default {
  125. data() {
  126. return {
  127. recshow: false,
  128. recshowto: false,
  129. recshowsw: false,
  130. focusState: false,
  131. focusStatetim: false,
  132. palletNo: "",
  133. materialType: "",
  134. sourceLocationId: "",
  135. qty: "4",
  136. valueTmia: "丁铵黑药",
  137. targetLocationld: "",
  138. radiolist1: [
  139. {
  140. name: "丁铵黑药",
  141. disabled: true,
  142. id: 5,
  143. },
  144. ],
  145. range: [
  146. { value: "1", text: "1" },
  147. { value: "2", text: "2" },
  148. { value: "3", text: "3" },
  149. { value: "4", text: "4" },
  150. ],
  151. focusStateto: false,
  152. value: "丁铵黑药",
  153. value2: "",
  154. targetLocationldTmname: "",
  155. placeholders: "请输入托盘号",
  156. placeholdesrs: "请输入出库单位",
  157. placeholder: "请输入入库单位",
  158. valueTmname: "",
  159. host: "",
  160. };
  161. },
  162. onLoad(option) {},
  163. onUnload() {
  164. // 移除监听事件
  165. uni.$off("xwscan");
  166. },
  167. onHide() {},
  168. onShow() {
  169. let that = this;
  170. let pages = getCurrentPages();
  171. let currPage = pages[pages.length - 1]; //当前页面
  172. if (currPage.testdata != undefined) {
  173. console.log("$attrs", currPage.testdata);
  174. this.sourceLocationId = currPage.testdata.name;
  175. }
  176. this.materialType = this.radiolist1[0].id;
  177. },
  178. created() {},
  179. watch: {
  180. scanCodeValue(value) {
  181. if (!!value) {
  182. document.onkeydown = null;
  183. } else {
  184. this.placeholder = "扫码失败,请重新扫码...";
  185. }
  186. },
  187. },
  188. mounted() {
  189. let _this = this;
  190. uni.getStorage({
  191. key: "hostappst",
  192. success(res) {
  193. console.log("获取成功", res.data);
  194. _this.host = res.data;
  195. },
  196. });
  197. this.getData();
  198. },
  199. onHide() {
  200. this.recshow = false;
  201. },
  202. methods: {
  203. otherFun(obj) {
  204. console.log(obj);
  205. if (obj.show == 6) {
  206. this.valueTmname = obj.id;
  207. this.sourceLocationId = obj.locationNo;
  208. } else if (obj.show == 7) {
  209. this.targetLocationldTmname = obj.id;
  210. this.targetLocationld = obj.locationNo;
  211. }
  212. },
  213. radioChange(val, row) {
  214. console.log(val, row);
  215. this.valueTmianame = val;
  216. this.materialType = row.id;
  217. },
  218. dialogInputConfirm(val) {
  219. this.valueTmia = this.valueTmianame;
  220. },
  221. Material() {
  222. uni.navigateTo({
  223. url: "/pages/Warehousing/selectMaterial/index",
  224. });
  225. },
  226. inputDialogToggle() {
  227. this.$refs.inputDialog.open();
  228. },
  229. WeakRefthree() {
  230. let text = "";
  231. if (this.sourceLocationId == "") {
  232. text = "请输入库位";
  233. } else if (this.materialType == "") {
  234. text = "请选择物料";
  235. } else if (this.palletNo == "") {
  236. text = "请输入托盘号";
  237. } else if (this.quantity == "") {
  238. text = "请选择数量";
  239. }
  240. if (text != "") {
  241. return uni.showToast({
  242. title: text,
  243. icon: "none",
  244. });
  245. }
  246. this.GetBanner();
  247. },
  248. change(e) {
  249. console.log("e", e);
  250. this.qty = e;
  251. },
  252. focusFn(e) {
  253. this.recshow = true;
  254. this.recshowto = false;
  255. this.recshowsw = false;
  256. uni.$off("xwscan");
  257. uni.$on("xwscan", (res) => {
  258. console.log("扫码结果:", res.code);
  259. this.sourceLocationId = res.code;
  260. this.valueTmname = res.code;
  261. });
  262. console.log("focus事件");
  263. },
  264. focusFnsw(e) {
  265. this.recshow = false;
  266. this.recshowto = false;
  267. this.recshowsw = true;
  268. uni.$off("xwscan");
  269. uni.$on("xwscan", (res) => {
  270. console.log("扫码结果:", res.code);
  271. this.targetLocationld = res.code;
  272. this.targetLocationldTmname = res.code;
  273. });
  274. console.log("focus事件");
  275. },
  276. focusFnto(e) {
  277. this.recshowto = true;
  278. this.recshow = false;
  279. this.recshowsw = false;
  280. uni.$off("xwscan");
  281. uni.$on("xwscan", (res) => {
  282. console.log("扫码结果:", res.code);
  283. this.palletNo = res.code;
  284. });
  285. console.log("focus事件");
  286. },
  287. startScan() {
  288. this.$nextTick(() => {
  289. this.focusState = true;
  290. });
  291. if (e.which === 13) {
  292. setTimeout(() => {
  293. if (this.sourceLocationId.length < 3) return;
  294. this.sourceLocationId = "";
  295. }, 500);
  296. return;
  297. }
  298. },
  299. getScancode(code) {
  300. console.log("进", code);
  301. code = code.trim();
  302. this.sourceLocationId = code;
  303. console.log(code);
  304. uni.showLoading({
  305. title: code,
  306. });
  307. setTimeout(() => {
  308. uni.hideLoading();
  309. }, 3000);
  310. },
  311. goto(data) {
  312. uni.navigateTo({
  313. url: data,
  314. });
  315. },
  316. input(e) {
  317. this.valueTmname = e;
  318. },
  319. inputEasy(e) {
  320. this.targetLocationldTmname = e;
  321. },
  322. GetBanner() {
  323. uni.showLoading({
  324. title: "加载中",
  325. });
  326. let params = {
  327. palletNo: this.palletNo,
  328. materialType: this.materialType.toString(),
  329. sourceLocationId: this.valueTmname,
  330. targetLocationId: this.targetLocationldTmname,
  331. quantity: Number(this.qty),
  332. };
  333. let that = this;
  334. uni.getStorage({
  335. key: "GetPhone_Token",
  336. success: function (res) {
  337. // 恢复请求
  338. uni.request({
  339. url: `http://${that.host}` + "/pda/agvCall/bucketCrossStorage",
  340. header: {
  341. Authorization: res.data,
  342. "content-type": "application/x-www-form-urlencoded",
  343. },
  344. data: params,
  345. method: "POST",
  346. success(respenon) {
  347. console.log("chaoShiPanDuan", respenon);
  348. if (respenon.data.code == 200) {
  349. uni.hideLoading();
  350. uni.showToast({
  351. title: respenon.data.msg,
  352. icon: "none",
  353. });
  354. setTimeout(function () {
  355. uni.navigateTo({
  356. url: "/pages/index/tabbar/tabbar",
  357. });
  358. }, 1000);
  359. } else {
  360. uni.showToast({
  361. title: respenon.data.msg,
  362. icon: "none",
  363. });
  364. }
  365. console.log("res", res);
  366. },
  367. });
  368. },
  369. });
  370. },
  371. getData() {
  372. let that = this;
  373. let dataobj = {
  374. cacheZoneSceneCode: "bucketCacheZoneOut",
  375. locationSceneCode: "bucketCacheOut",
  376. };
  377. uni.getStorage({
  378. key: "GetPhone_Token",
  379. success: function (res) {
  380. // 恢复请求
  381. uni.request({
  382. url:
  383. `http://${that.host}` + "/inv/asn/getCacheLocationInfoCacheList",
  384. header: {
  385. Authorization: res.data,
  386. },
  387. method: "GET",
  388. data: dataobj,
  389. success(res) {
  390. console.log("chaoShiPanDuan", res);
  391. if (res.data.code == 200) {
  392. res.data.data.forEach((item, index) => {
  393. that.targetLocationld = res.data.data[0].locationNo;
  394. that.targetLocationldTmname = res.data.data[0].id;
  395. });
  396. } else if (respenon.data.code == 401) {
  397. uni.reLaunch({
  398. url: "/pages/index/login",
  399. });
  400. }
  401. console.log("res", res);
  402. },
  403. });
  404. },
  405. });
  406. },
  407. },
  408. };
  409. </script>
  410. <style scoped>
  411. /deep/.is-input-border {
  412. display: flex;
  413. box-sizing: border-box;
  414. flex-direction: row;
  415. align-items: center;
  416. border-radius: 4px;
  417. background-color: rgb(245 245 245) !important;
  418. /* background: #24bdbd; */
  419. }
  420. /deep/uni-button {
  421. color: #000;
  422. border: 1px solid #ff0000;
  423. border-radius: 31px;
  424. width: 21%;
  425. background-color: #f5f5f5;
  426. height: 42px;
  427. font-size: 16px;
  428. color: #ff0000;
  429. }
  430. /deep/.uni-easyinput__content-input[data-v-abe12412] {
  431. width: auto;
  432. position: relative;
  433. overflow: hidden;
  434. flex: 1;
  435. line-height: 1;
  436. font-size: 14px;
  437. height: 35px;
  438. /* border-bottom: 1px solid #ff0000 !important; */
  439. }
  440. /deep/.is-input-border {
  441. display: flex;
  442. box-sizing: border-box;
  443. flex-direction: row;
  444. align-items: center;
  445. border: none !important;
  446. border-radius: 4px;
  447. }
  448. .recto {
  449. box-sizing: border-box;
  450. position: relative;
  451. overflow: hidden;
  452. /* margin: 300px auto; */
  453. /* width: 300px; */
  454. /* height: 4px; */
  455. /* border: 0.1px solid #ccc; */
  456. }
  457. .recto::before {
  458. position: absolute;
  459. bottom: 0;
  460. content: "";
  461. height: 2px;
  462. width: 258px;
  463. background-color: red;
  464. /* 依次对应:动画名、时长、匀速、无限循环 */
  465. animation: move 3s;
  466. }
  467. @keyframes move {
  468. from {
  469. left: -100%;
  470. }
  471. to {
  472. left: 100%;
  473. }
  474. }
  475. </style>
  476. <style lang="scss" scoped>
  477. .content {
  478. padding: 15px;
  479. .confirm-view {
  480. display: flex;
  481. // margin-bottom: 15px;
  482. align-items: center;
  483. height: 65px;
  484. /* border-top: 1px solid #dbdbdb; */
  485. /* border-bottom: 1px solid; */
  486. border-bottom: 1px solid #dbdbdb;
  487. .text {
  488. font-size: 16px;
  489. color: #6e6860;
  490. font-weight: 500;
  491. width: 80px;
  492. text-align-last: justify;
  493. }
  494. }
  495. .vontent_boby {
  496. // margin: 15px 0;
  497. // border-top: 1px solid #dbdbdb;
  498. display: flex;
  499. justify-content: space-between;
  500. font-size: 15px;
  501. color: #838383;
  502. border-bottom: 1px solid #dbdbdb;
  503. height: 55px;
  504. align-items: center;
  505. }
  506. .border-buttons {
  507. display: flex;
  508. position: absolute;
  509. button: 0;
  510. bottom: 32px;
  511. justify-content: space-between;
  512. width: 91%;
  513. text-align: center;
  514. .buttons {
  515. width: 46%;
  516. border: 1px solid #f00;
  517. border-radius: 34px;
  518. height: 42px;
  519. display: flex;
  520. justify-content: center;
  521. align-items: center;
  522. font-size: 18px;
  523. color: red;
  524. font-weight: 500;
  525. }
  526. .buttons2 {
  527. width: 100%;
  528. border: 1px solid #ff0505;
  529. border-radius: 34px;
  530. height: 42px;
  531. background: red;
  532. display: flex;
  533. justify-content: center;
  534. align-items: center;
  535. font-size: 18px;
  536. color: white;
  537. font-weight: 500;
  538. }
  539. }
  540. }
  541. </style>