index.vue 8.2 KB

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