index.vue 11 KB

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