consume.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. <template>
  2. <!-- 515040620742443008 -->
  3. <!-- 514939600389537793 -->
  4. <view class="query-wrap">
  5. <view class="title-cont">
  6. <view class="search-view">
  7. <uni-easyinput prefixIcon="search" :value="value" placeholder="请输入或扫描SN码或RFID码" @input="input">
  8. </uni-easyinput>
  9. <qs-scanlistener @scan="scan"></qs-scanlistener>
  10. <view class="filter-text" @click.stop="addData()">
  11. 添加
  12. </view>
  13. </view>
  14. <view class="select-view">
  15. <picker mode="selector" @change="outHandleDate" :range="houseData" range-key='text'>
  16. <view class="date c-flex-align" :style="{ height:'100rpx'}">
  17. <view>{{ outRoom }}</view>
  18. <image src="https://i.loli.net/2020/07/15/xjVSvzWcH9NO7al.png" mode="" class="icon-triangle">
  19. </image>
  20. </view>
  21. </picker>
  22. <picker mode="selector" @change="targtHandleDate" :disabled="!outRoomId" :range="tarRoomData"
  23. range-key='text'>
  24. <view class="date c-flex-align" :style="{ height:'100rpx'}">
  25. <view>{{ tarRoom }}</view>
  26. <image src="https://i.loli.net/2020/07/15/xjVSvzWcH9NO7al.png" mode="" class="icon-triangle">
  27. </image>
  28. </view>
  29. </picker>
  30. </view>
  31. </view>
  32. <view class="inner-item" v-for="(item,index) in consumeData" :key="index" @click="itemDetails(item,index)">
  33. <view class="inventory-item">
  34. <view class="shuo-item-name">
  35. <view class="shuo-label-podnme">
  36. {{item.prodName||"" }}
  37. </view>
  38. <view class="shuo-unit">
  39. <span>{{item.purcUnt }}({{item.convrat }}{{item.prcUnt}}/{{item.purcUnt }})</span>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="inventory-item">
  44. <view class="shuo-item-name">
  45. <view class="shuo-label">
  46. 出库数量:
  47. </view>
  48. <view class="shuo-unit">
  49. {{item.children.length}}
  50. </view>
  51. </view>
  52. </view>
  53. <view class="inventory-item">
  54. <view class="shuo-item">
  55. <view class="shuo-label">
  56. 规格:
  57. </view>
  58. <view class="shuo-cont">
  59. {{item.spec}}
  60. </view>
  61. </view>
  62. <view class="shuo-item">
  63. <view class="shuo-label">
  64. 型号:
  65. </view>
  66. <view class="shuo-cont">
  67. {{item.mol}}
  68. </view>
  69. </view>
  70. </view>
  71. <view class="inventory-item">
  72. <view class="shuo-item-name">
  73. <view class="shuo-label">
  74. 注册证号:
  75. </view>
  76. <view class="shuo-cont">
  77. {{item.regcertno}}
  78. </view>
  79. </view>
  80. </view>
  81. <view class="inventory-item">
  82. <view class="shuo-item">
  83. <view class="shuo-label">
  84. 耗材类别:
  85. </view>
  86. <view class="shuo-cont">
  87. <span v-if="item.mcsType == '0'"> 普通耗材 </span>
  88. <span v-if="item.mcsType == '1'"> 高值耗材 </span>
  89. <span v-if="item.mcsType == '2'"> 试剂 </span>
  90. <span v-if="item.mcsType == '3'"> 总务耗材 </span>
  91. </view>
  92. </view>
  93. <view class="shuo-item">
  94. <view class="shuo-label">
  95. 生产来源:
  96. </view>
  97. <view class="shuo-cont">
  98. <span v-if="item.prodSouc == '1'" type="success"> 国产 </span>
  99. <span v-if="item.prodSouc == '2'" type="danger"> 进口 </span>
  100. </view>
  101. </view>
  102. </view>
  103. <view class="inventory-item">
  104. <view class="shuo-item-name">
  105. <view class="shuo-label">
  106. 生产企业:
  107. </view>
  108. <view class="shuo-cont">
  109. {{item.prodEntp}}
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. <view class="empty-cont" v-if="consumeData.length==0">
  115. 暂无明细
  116. </view>
  117. <view class="botm-btn">
  118. <button type="default" plain="true" style="width:200rpx;line-height: 70rpx;background: #01A992;color:#fff"
  119. @click.stop="orderAcept()">提交</button>
  120. </view>
  121. <uni-popup ref="popup">
  122. <uni-popup-dialog type="warn" :before-close="true" cancelText="取消" confirmText="确定" content="你确定提交?"
  123. @confirm="dialogConfirm" @close="dialogClose"></uni-popup-dialog>
  124. </uni-popup>
  125. </view>
  126. </template>
  127. <script>
  128. import {
  129. mapState,
  130. mapMutations,
  131. mapActions
  132. } from 'vuex';
  133. import {
  134. debounced
  135. } from '@/utils/debounced.js';
  136. import moment from "moment";
  137. import ZPMixin from '@/uni_modules/z-paging/components/z-paging/js/z-paging-mixin.js';
  138. export default {
  139. mixins: [ZPMixin],
  140. data() {
  141. return {
  142. index: 0,
  143. value: "",
  144. dataList: [],
  145. outRoom: '出库库房',
  146. outRoomId: "",
  147. tarRoom: '目标库房',
  148. tarRoomId: ""
  149. }
  150. },
  151. computed: {
  152. ...mapState(['houseData', 'tarRoomData', 'consumeData'])
  153. },
  154. onShow() {
  155. this.$forceUpdate();
  156. uni.$once('update', function(data) {
  157. // uni.redirectTo({
  158. // url: '/pages/grounding/grounding' //写你的路径
  159. // });
  160. })
  161. },
  162. onBackPress(event) {
  163. this.setConmData([]);
  164. },
  165. mounted() {
  166. },
  167. methods: {
  168. ...mapActions(['getTarRomData']),
  169. ...mapMutations(['setConmData']),
  170. //出库库房确定
  171. outHandleDate(e) {
  172. let idx = e.detail.value;
  173. this.outRoom = this.houseData[idx].text;
  174. this.outRoomId = this.houseData[idx].value;
  175. this.tarRoom = "目标库房";
  176. this.tarRoomId = "";
  177. this.getTarRomData({
  178. id: this.houseData[idx].value
  179. })
  180. },
  181. //目标位置确定
  182. targtHandleDate(e) {
  183. let idx = e.detail.value;
  184. this.tarRoom = this.tarRoomData[idx].text;
  185. this.tarRoomId = this.tarRoomData[idx].value;
  186. },
  187. input(value) {
  188. this.value = value;
  189. },
  190. //日期格式化
  191. forMatTime(time) {
  192. return moment(time).format("YYYY-MM-DD");
  193. },
  194. addData() {
  195. this.$http('outboundIng.addData', {
  196. id: this.value.trim(),
  197. soucStroomId: this.outRoomId,
  198. tagtStroomId: this.tarRoomId
  199. }, '加载中', true).then((res) => {
  200. if (res.success == true) {
  201. if (this.consumeData.length <= 0) {
  202. let aData = [
  203. ...this.consumeData,
  204. {
  205. ...res.data,
  206. children: [{
  207. ...res.data
  208. }]
  209. },
  210. ];
  211. this.setConmData(aData);
  212. return;
  213. }
  214. let newData = [...this.consumeData];
  215. newData.forEach((item, index) => {
  216. if (
  217. res.data &&
  218. item.prodCode == res.data.prodCode &&
  219. item.pacunt == res.data.pacunt
  220. ) {
  221. let filter = newData[index].children.filter((itm) => {
  222. return itm.id == res.data.id;
  223. });
  224. if (filter.length <= 0) {
  225. newData[index]["children"].push(res.data);
  226. }
  227. }
  228. });
  229. let newFilter = newData.filter((item) => {
  230. return (
  231. item.prodCode == res.data.prodCode &&
  232. item.pacunt == res.data.pacunt
  233. );
  234. });
  235. if (newFilter.length <= 0) {
  236. newData.push({
  237. ...res.data,
  238. children: [{
  239. ...res.data
  240. }],
  241. });
  242. }
  243. this.setConmData(newData);
  244. }
  245. })
  246. },
  247. dialogClose() {
  248. this.$refs.popup.close();
  249. },
  250. scan(code) {
  251. this.value = code;
  252. this.addData();
  253. },
  254. orderAcept() {
  255. if (this.consumeData.length <= 0) {
  256. uni.showToast({
  257. title: '请选择添加出库耗材',
  258. icon: 'none',
  259. });
  260. return;
  261. }
  262. if (this.outRoomId == "") {
  263. uni.showToast({
  264. title: '请选择出库库房',
  265. icon: 'none',
  266. });
  267. return;
  268. }
  269. if (this.tarRoomId == "") {
  270. uni.showToast({
  271. title: '请选择目标库房',
  272. icon: 'none',
  273. });
  274. return;
  275. }
  276. this.$refs.popup.open();
  277. },
  278. //二次确认提交数据
  279. dialogConfirm() {
  280. let subMitData = [];
  281. this.consumeData.forEach((item) => {
  282. item.children.forEach((itm) => {
  283. subMitData.push(itm.id);
  284. });
  285. });
  286. this.$http('outboundIng.subMitData', {
  287. snList: subMitData,
  288. soucStroomId: this.outRoomId,
  289. tagtStroomId: this.tarRoomId
  290. }, '加载中', true).then((res) => {
  291. if (res.success == true) {
  292. uni.showToast({
  293. title: '提交成功',
  294. icon: 'none',
  295. });
  296. this.value = "";
  297. this.$refs.popup.close();
  298. this.setConmData([]);
  299. } else {
  300. this.$refs.popup.close();
  301. }
  302. })
  303. },
  304. //跳转验收详情
  305. itemDetails(item, index) {
  306. uni.setStorage({
  307. key: 'sumeDetails',
  308. data: {
  309. snData: item,
  310. itx: index
  311. }
  312. });
  313. uni.navigateTo({
  314. url: '/pages/consemeview/index',
  315. success: function(res) {
  316. console.log(res, "res")
  317. }
  318. });
  319. },
  320. },
  321. watch: {
  322. }
  323. }
  324. </script>
  325. <style lang="scss" scoped>
  326. .query-wrap {
  327. width: 100%;
  328. height: 100%;
  329. padding: 20rpx;
  330. box-sizing: border-box;
  331. background-color: #F1F1F1;
  332. overflow-y: scroll;
  333. overflow-x: hidden;
  334. .empty-cont {
  335. width: 100%;
  336. height: 500rpx;
  337. display: flex;
  338. align-items: center;
  339. justify-content: center;
  340. background-color: #F1F1F1;
  341. }
  342. .botm-btn {
  343. width: 100%;
  344. height: 120rpx;
  345. background-color: #fff;
  346. position: fixed;
  347. left: 0;
  348. bottom: 0;
  349. padding-top: 40rpx;
  350. }
  351. .time-view {
  352. height: 350rpx;
  353. background-color: #fff;
  354. padding: 50rpx 50rpx 0 50rpx;
  355. box-sizing: border-box;
  356. .btn-view {
  357. width: 100%;
  358. height: 100rpx;
  359. margin-top: 100rpx;
  360. display: flex;
  361. justify-content: space-around;
  362. }
  363. }
  364. .title-cont {
  365. padding-top: 10rpx;
  366. width: 100%;
  367. background-color: #fff;
  368. .search-view {
  369. width: 100%;
  370. height: 100rpx;
  371. display: flex;
  372. align-items: center;
  373. padding: 0rpx 20rpx 0rpx 20rpx;
  374. box-sizing: border-box;
  375. .filter-text {
  376. width: 72rpx;
  377. height: 50rpx;
  378. line-height: 50rpx;
  379. color: rgba(1, 169, 146, 1);
  380. font-size: 36rpx;
  381. font-family: PingFangSC-bold;
  382. padding-left: 20rpx;
  383. }
  384. }
  385. .select-view {
  386. width: 100%;
  387. height: 100rpx;
  388. display: flex;
  389. align-items: center;
  390. padding: 0rpx 20rpx 0rpx 20rpx;
  391. box-sizing: border-box;
  392. display: flex;
  393. justify-content: space-around;
  394. .c-flex-align {
  395. display: flex;
  396. align-items: center;
  397. color: rgba(16, 16, 16, 1);
  398. }
  399. .icon-triangle {
  400. width: 16rpx;
  401. height: 16rpx;
  402. margin-left: 10rpx;
  403. }
  404. }
  405. }
  406. }
  407. uni-page-body {
  408. width: 100%;
  409. height: 100%;
  410. background-color: #F1F1F1;
  411. }
  412. </style>