store-in.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <!-- 手动入库 -->
  2. <template>
  3. <view class="container-wrap">
  4. <uni-nav-bar title="手动入库" :status-bar="true" background-color="#3F92F9" color="#FFF">
  5. <view slot="left">
  6. <u-icon name="account-fill" color="#FFF" size="35"></u-icon>
  7. <span style="padding: 0 5rpx;color: #FFFFFF;">{{ userInfo.name }}</span>
  8. </view>
  9. <view slot="right" @tap="$utils.back()">
  10. <span style="color: #FFFFFF;">返回</span>
  11. </view>
  12. </uni-nav-bar>
  13. <view class="container">
  14. <view class="title">
  15. <span>
  16. <span style="color: red;">*</span>
  17. 入库信息
  18. </span>
  19. </view>
  20. <view class="text">
  21. <view class="label">领料人:</view>
  22. <select-lay :value="operateUser" placeholder="默认当前用户" :options="userList" @selectitem="selectitem" :zindex="2000"></select-lay>
  23. </view>
  24. <view class="text">
  25. <view class="label">仓库:</view>
  26. <select-lay :zindex="1000" :value="plcStationCode" :options="selectList" @selectitem="storeSelectitem"></select-lay>
  27. </view>
  28. <view class="text">
  29. <view class="label">入库类型:</view>
  30. <select-lay :value="stockChangeType" :options="typeList" @selectitem="typeSelectitem"></select-lay>
  31. </view>
  32. <view class="text" style="align-items: flex-start;">
  33. <view class="label">备注:</view>
  34. <u-input v-model="remark" type="textarea" :border="true" />
  35. </view>
  36. <view class="text" style="margin: 20rpx 0 30rpx 0;">
  37. <view class="label">领料时间:</view>
  38. <view style="line-height: 1;">{{ time }}</view>
  39. </view>
  40. <view class="title flex-between">
  41. <span>
  42. <span style="color: red;">*</span>
  43. 入库列表
  44. </span>
  45. <a href="#" @click="scan">+扫描添加</a>
  46. </view>
  47. <view class="list">
  48. <view class="item" v-for="(item, index) in scanList" :key="index">
  49. <view class="row">
  50. <view class="col">
  51. <view class="value">{{ item.materialCode }}</view>
  52. </view>
  53. <view class="col">
  54. <view class="value">{{ item.materialName }}</view>
  55. </view>
  56. </view>
  57. <view class="row sub-row">
  58. <view class="col">
  59. <view class="label">规格:</view>
  60. <view class="value">{{ item.spec }}</view>
  61. </view>
  62. <view class="col">
  63. <view class="label">数量:</view>
  64. <view class="value">{{ item.quantity }}米</view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <my-fixed-button :customClick="true" @click="cfm" text="提交"></my-fixed-button>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. import DateFormat from '../../../js_sdk/xfl-DateFormat/DateFormat.js';
  75. import utils from '@/libs/utils/util.js'
  76. export default {
  77. data() {
  78. return {
  79. timer: null,
  80. time: new DateFormat(new Date()).toString(),
  81. show: false,
  82. operateUser: this.$storage.getStorageSync('userInfo').id,
  83. plcStationCode: '1',
  84. stockChangeType: '10',
  85. remark: '',
  86. isReading: false,
  87. scanList: [],
  88. userList: [],
  89. selectList: [],
  90. typeList: [
  91. { label: '入库', value: 10 },
  92. { label: '盘点新增', value: 11 },
  93. { label: '补入库', value: 13 },
  94. ]
  95. };
  96. },
  97. methods: {
  98. /* 选择类型 */
  99. typeSelectitem(index, item) {
  100. this.stockChangeType = item.value;
  101. },
  102. /* 选择领料人 */
  103. selectitem(index, item) {
  104. this.operateUser = item.value;
  105. },
  106. /* 选择仓库 */
  107. storeSelectitem(index, item) {
  108. this.plcStationCode = item.value;
  109. uni.setStorage({
  110. key: 'plcStationCode',
  111. data: item.value
  112. })
  113. },
  114. cfm(){
  115. let obj = {
  116. userId: this.operateUser,
  117. plcCode: this.plcStationCode,
  118. rfidItems: this.scanList.map(item => item.rfidCode),
  119. stockChangeType: this.stockChangeType,
  120. remark: this.remark
  121. }
  122. console.log(obj)
  123. this.$http.HandleMacStockInOut(obj).then(res => {
  124. console.log(res)
  125. if(res.code === 0) {
  126. this.$msg.showToast(res.msg || '操作成功!')
  127. this.timer = setTimeout(() => {
  128. this.$utils.back()
  129. }, 2000)
  130. }
  131. })
  132. },
  133. /* 扫描添加 */
  134. scan() {
  135. this.$utils.open('/pages/store-in-manage/store-in/store-in-scan')
  136. },
  137. getList () {
  138. this.$http.GetApplyStockOutTemp().then(res => {
  139. console.log(res)
  140. if(res.code === 0) {
  141. this.scanList = res.result
  142. }
  143. })
  144. },
  145. /* 添加扫描到的退货数据 */
  146. pushData(data) {
  147. console.log(this.scanList)
  148. let flag = true
  149. this.scanList.forEach(item => {
  150. if(item.rfidCode === data.rfidCode) {
  151. flag = false
  152. }
  153. })
  154. if(flag) {
  155. this.scanList.push(data)
  156. } else {
  157. setTimeout(() => {
  158. this.$msg.showToast('标签已存在!')
  159. }, 100)
  160. }
  161. },
  162. /* 获取用户列表 */
  163. getUserPageList() {
  164. this.userList = utils.getUserList(1).map(item => {
  165. return {
  166. label: item.name,
  167. value: item.id
  168. }
  169. })
  170. },
  171. /* 手持机获取仓库 */
  172. getStockHouse() {
  173. this.$post('/storage-restructure/stockHouse/page',{
  174. pageNum:1,
  175. pageSize:10000,
  176. }).then(res=>{
  177. this.selectList = res.data.records.map(item => {
  178. return {
  179. label: item.name,
  180. value: item.id
  181. }
  182. })
  183. })
  184. }
  185. },
  186. onLoad(option) {
  187. this.getUserPageList()
  188. this.getStockHouse()
  189. console.log(option)
  190. uni.$on('scan-list', res => {
  191. console.log('?????????????')
  192. console.log(res)
  193. this.pushData(res)
  194. })
  195. uni.getStorage({
  196. key: 'plcStationCode',
  197. success: (res) => {
  198. this.plcStationCode = res.data
  199. }
  200. });
  201. },
  202. onUnload() {
  203. clearTimeout(this.timer)
  204. uni.$off('scan-list')
  205. }
  206. }
  207. </script>
  208. <style lang="scss" scoped>
  209. .container-wrap {
  210. overflow: hidden;
  211. .container {
  212. padding: 20rpx;
  213. height: calc(100vh - var(--status-bar-height) - 44px);
  214. overflow: auto;
  215. padding-bottom: 100rpx;
  216. .text {
  217. padding: 10rpx 0;
  218. display: flex;
  219. align-items: center;
  220. font-size: 24rpx;
  221. .label {
  222. width: 150rpx;
  223. text-align: right;
  224. }
  225. }
  226. .list {
  227. margin: 10rpx 0;
  228. .item {
  229. padding: 20rpx;
  230. margin-bottom: 10rpx;
  231. background-color: #FFFFFF;
  232. border: 1rpx solid rgba(215, 215, 215, 1);
  233. border-radius: 10rpx;
  234. .row {
  235. &.border {
  236. border-bottom: 1px solid rgba(215, 215, 215, 1);
  237. }
  238. .label {
  239. width: 80rpx;
  240. }
  241. .col {
  242. &:last-child {
  243. justify-content: flex-end;
  244. }
  245. }
  246. }
  247. .sub-row {
  248. align-items: flex-start;
  249. .label, .value {
  250. font-size: 24rpx;
  251. color: #7F7F7F;
  252. }
  253. }
  254. }
  255. }
  256. }
  257. }
  258. </style>