scancodeout.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <!-- 出库扫码 -->
  2. <template>
  3. <view class="content">
  4. <view class="text-area">
  5. <scan @getCode="getScanCode"/>
  6. </view>
  7. <view class="stripe"></view>
  8. <view class="roll">
  9. <view>
  10. <view @click="show =! show">
  11. <u-icon name="edit-pen"></u-icon>手动录入
  12. </view>
  13. <view class="lnput" v-if="show==false">
  14. <input type="text" v-model="number_a" :placeholder="content" clearable="true" />
  15. <u-button type="primary" size="medium" @click="manualentry">确认录入</u-button>
  16. </view>
  17. <view class="" v-else>
  18. <view>{{tips}}:{{number}}</view>
  19. </view>
  20. </view>
  21. <view>
  22. <view></view>
  23. <view></view>
  24. <view style="width: 94%;height: 20px;background-color: #FFFFFF;margin: 0 auto;margin-top: -3rpx;border-radius: 0;">
  25. <image src="../../../static/sailun/line.png" style="width: 96%;height: 1rpx;;" mode=""></image>
  26. </view>
  27. </view>
  28. <view class="generate">
  29. <u-table font-size="24" border-color="#ffffff" bg-color="#fff">
  30. <u-tr class="u-tr">
  31. <u-th class="u-th" width="30%">胎号</u-th>
  32. <u-th class="u-th">规格</u-th>
  33. <u-th class="u-th" width="15%">操作</u-th>
  34. </u-tr>
  35. <u-tr class="u-tr" :key="index" v-for="(item, index) in lisi">
  36. <u-td class="u-td" width="30%">{{item.tireNumber}}</u-td>
  37. <u-td class="u-td">{{item.maktx}}</u-td>
  38. <u-td class="u-td" width="15%"><text @click="confirm(index)" style="color: #FA3534;">删除</text></u-td>
  39. </u-tr>
  40. </u-table>
  41. <u-divider color="rgb(144, 147, 153)" half-width="200" border-color="rgb(144, 147, 153)" margin-top="40">没有更多了</u-divider>
  42. </view>
  43. </view>
  44. <view class="determine">
  45. <u-button type="primary" shape="circle" @click="scancodein">扫码确认</u-button>
  46. </view>
  47. <view>
  48. </view>
  49. <u-toast ref="repeat" position="bottom" />
  50. </view>
  51. </template>
  52. <script>
  53. import {
  54. request
  55. } from '../../../common/request/request'
  56. require("promise.prototype.finally").shim()
  57. export default {
  58. data() {
  59. return {
  60. tips: '提示',
  61. number: '请扫码出库',
  62. nbTitle: '扫码标题',
  63. content: '请输入轮胎胎号',
  64. number_s: '',
  65. number_a: '',
  66. lisi: [],
  67. background: {
  68. backgroundColor: '#0094fe',
  69. },
  70. show: true,
  71. }
  72. },
  73. created() {
  74. const innerAudioContext = uni.createInnerAudioContext();
  75. innerAudioContext.autoplay = true;
  76. innerAudioContext.src = '../../../static/mp3/startscan.mp3';
  77. innerAudioContext.onPlay(() => {
  78. console.log('开始播放');
  79. });
  80. innerAudioContext.onError((res) => {
  81. console.log(res.errMsg);
  82. console.log(res.errCode);
  83. });
  84. },
  85. methods: {
  86. //手动录入调用
  87. manualentry() {
  88. request({
  89. url: '/storeScan/storeScanGetTyre',
  90. method: 'Post',
  91. data: {
  92. storeId:this.$store.state.storeInfo.storeId,
  93. userId:this.$store.state.storeInfo.userId,
  94. tyreNum: this.number_a
  95. }
  96. }).then(res => {
  97. for (let i = 0; i < this.lisi.length; i++) {
  98. if (this.lisi[i].tireNumber == res.data.data[0].tirenumber) {
  99. this.$refs.repeat.show({
  100. title: '请勿重复录入',
  101. type: 'default',
  102. position: 'bottom'
  103. })
  104. return
  105. }
  106. }
  107. this.$refs.repeat.show({
  108. title: '录入成功',
  109. type: 'success',
  110. position: 'bottom'
  111. })
  112. if (res.data.code == 500){
  113. this.$refs.repeat.show({
  114. title: res.data.msg,
  115. type: 'default',
  116. position: 'bottom'
  117. })
  118. return
  119. }
  120. this.number_a = ""
  121. console.log("我成功啦")
  122. this.lisi.push({
  123. specs: res.data.data[0].specs,
  124. flagRegular: res.data.data[0].isRegular,
  125. diameter: res.data.data[0].diameter,
  126. maktx: res.data.data[0].maktx,
  127. pattern: res.data.data[0].pattern,
  128. soldToPartyKunnr: res.data.data[0].soldToPartyKunnr,
  129. matnr: res.data.data[0].matnr,
  130. tireNumber: res.data.data[0].tirenumber,
  131. brand: res.data.data[0].brand,
  132. shippedDate: res.data.data[0].shippedDate,
  133. scanWay: '0'
  134. })
  135. console.log(this.lisi)
  136. }).catch(err => {
  137. this.$refs.repeat.show({
  138. title: "请重新录入",
  139. type: 'default',
  140. position: 'bottom'
  141. })
  142. console.log(err)
  143. })
  144. .finally(() => {
  145. // Loading.close()
  146. })
  147. },
  148. //获取扫码控件
  149. getScanCode(val) {
  150. console.log(val)
  151. this.number = val
  152. this.number_s = val
  153. request({
  154. url: '/storeScan/storeScanGetTyre',
  155. method: 'Post',
  156. data: {
  157. storeId:this.$store.state.storeInfo.storeId,
  158. userId:this.$store.state.storeInfo.userId,
  159. tyreNum: this.number_s
  160. }
  161. }).then(res => {
  162. this.tips = "胎号"
  163. for (let i = 0; i < this.lisi.length; i++) {
  164. if (this.lisi[i].tireNumber == res.data.data[0].tirenumber) {
  165. this.$refs.repeat.show({
  166. title: '请勿重复扫码',
  167. type: 'default',
  168. position: 'bottom'
  169. })
  170. const innerAudioContext = uni.createInnerAudioContext();
  171. innerAudioContext.autoplay = true;
  172. innerAudioContext.src = '../../../static/mp3/rescan.mp3';
  173. innerAudioContext.onPlay(() => {
  174. console.log('开始播放');
  175. });
  176. innerAudioContext.onError((res) => {
  177. console.log(res.errMsg);
  178. console.log(res.errCode);
  179. });
  180. return
  181. }
  182. }
  183. if (res.data.code == 500){
  184. this.$refs.repeat.show({
  185. title: res.data.msg,
  186. type: 'default',
  187. position: 'bottom'
  188. })
  189. const innerAudioContext = uni.createInnerAudioContext();
  190. innerAudioContext.autoplay = true;
  191. innerAudioContext.src = '../../../static/mp3/scanfailed.mp3';
  192. innerAudioContext.onPlay(() => {
  193. console.log('开始播放');
  194. });
  195. innerAudioContext.onError((res) => {
  196. console.log(res.errMsg);
  197. console.log(res.errCode);
  198. });
  199. return
  200. }
  201. this.number_s = ""
  202. console.log("我成功啦")
  203. console.log(res)
  204. this.lisi.push({
  205. specs: res.data.data[0].specs,
  206. flagRegular: res.data.data[0].isRegular,
  207. diameter: res.data.data[0].diameter,
  208. maktx: res.data.data[0].maktx,
  209. pattern: res.data.data[0].pattern,
  210. soldToPartyKunnr: res.data.data[0].soldToPartyKunnr,
  211. matnr: res.data.data[0].matnr,
  212. tireNumber: res.data.data[0].tirenumber,
  213. brand: res.data.data[0].brand,
  214. shippedDate: res.data.data[0].shippedDate,
  215. plyRating: res.data.data[0].plyRating,
  216. scanWay: '1'
  217. })
  218. const innerAudioContext = uni.createInnerAudioContext();
  219. innerAudioContext.autoplay = true;
  220. innerAudioContext.src = '../../../static/mp3/scansuccess.mp3';
  221. innerAudioContext.onPlay(() => {
  222. console.log('开始播放');
  223. });
  224. innerAudioContext.onError((res) => {
  225. console.log(res.errMsg);
  226. console.log(res.errCode);
  227. });
  228. this.$refs.repeat.show({
  229. title: '扫码成功',
  230. type: 'success',
  231. position: 'bottom'
  232. })
  233. console.log(this.lisi)
  234. }).catch(err => {
  235. if (code == 400) {
  236. this.$refs.repeat.show({
  237. title: "无网络",
  238. type: 'default',
  239. position: 'bottom'
  240. })
  241. } else {
  242. this.$refs.repeat.show({
  243. title: "请重新扫码",
  244. type: 'default',
  245. position: 'bottom'
  246. })
  247. }
  248. console.log(err)
  249. })
  250. .finally(() => {
  251. // Loading.close()
  252. })
  253. },
  254. confirm(index) {
  255. console.log(index + "什么情况")
  256. this.lisi.splice(index, 1)
  257. },
  258. scancodein() {
  259. if (this.lisi == '') {
  260. this.$refs.repeat.show({
  261. title: '请扫码或录入后再点击!',
  262. type: 'default',
  263. position: 'bottom'
  264. })
  265. } else {
  266. this.$u.route({
  267. type:'redirectTo',
  268. url: 'pages/home/Scan-code-out/index',
  269. })
  270. uni.$emit('update', {
  271. materialList: this.lisi
  272. })
  273. this.lisi = []
  274. }
  275. }
  276. }
  277. }
  278. </script>
  279. <style lang="scss" scoped>
  280. .lnput>input {
  281. background-color: none;
  282. width: 60%;
  283. font-size: 42rpx;
  284. float: left;
  285. margin-top: 10rpx;
  286. margin-left: 20rpx;
  287. }
  288. .generate {
  289. width: 98%;
  290. height: 300rpx;
  291. overflow: auto;
  292. margin: 0 auto;
  293. margin-top: 120rpx;
  294. }
  295. .determine {
  296. width: 690rpx;
  297. margin-top: 30rpx;
  298. }
  299. .content {
  300. display: flex;
  301. flex-direction: column;
  302. align-items: center;
  303. justify-content: center;
  304. // background-color: #F29100;
  305. padding-top: 400px;
  306. }
  307. .logo {
  308. height: 200rpx;
  309. width: 200rpx;
  310. margin-top: 200rpx;
  311. margin-left: auto;
  312. margin-right: auto;
  313. margin-bottom: 50rpx;
  314. }
  315. .stripe {
  316. width: 740rpx;
  317. height: 30rpx;
  318. background-color: #00A0EA;
  319. border-radius: 12rpx;
  320. margin: 0 auto;
  321. margin-top: -100rpx;
  322. }
  323. .text-area {
  324. width: 100%;
  325. display: flex;
  326. background-color: #000000;
  327. position: static;
  328. justify-content: center;
  329. padding-top: 180rpx;
  330. }
  331. .title {
  332. font-size: 36rpx;
  333. color: #8f8f94;
  334. }
  335. .roll {
  336. width: 710rpx;
  337. height: auto;
  338. background: #FFFFFF;
  339. margin: 0 auto;
  340. margin-top: -15rpx;
  341. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(101, 176, 249, 0.3);
  342. border-bottom-left-radius: 10rpx;
  343. border-bottom-right-radius: 10rpx;
  344. padding-top: 50rpx;
  345. padding-bottom: 50rpx;
  346. }
  347. .roll>view:nth-child(1)>view:nth-child(2) {
  348. font-size: 42rpx;
  349. font-weight: bold;
  350. color: #0192FD;
  351. text-align: center;
  352. margin-bottom: 50rpx;
  353. }
  354. .roll>view:nth-child(1)>view:nth-child(1) {
  355. width: 200rpx;
  356. color: #0094FE;
  357. position: relative;
  358. top: -40rpx;
  359. left: 500rpx;
  360. font-size: 32rpx;
  361. text-align: center;
  362. }
  363. .roll>view:nth-child(2)>view {
  364. width: 40rpx;
  365. height: 40rpx;
  366. background-color: #F4F4F4;
  367. border-radius: 100%;
  368. float: right;
  369. margin-right: -20rpx;
  370. }
  371. .roll>view:nth-child(2)>view:nth-child(1) {
  372. float: left;
  373. margin-left: -20rpx;
  374. }
  375. .status_bar {
  376. height: var(--status-bar-height);
  377. width: 100%;
  378. background-color: #0095FF;
  379. }
  380. </style>