mxPopup.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. <template>
  2. <view class="mxpopup-container">
  3. <uni-drawer ref="showRight" mode="right" :mask-click="false" :width="drawerWidth" style="background-color: rgba(0, 0, 0, 0.1);">
  4. <view class="query_view" v-show="isShowButton">
  5. <button type="primary" @click="getList">查询当前单据</button>
  6. <button type="default" @click="getHeadList" style="margin-top:10px">切换其它单据</button>
  7. </view>
  8. <scroll-view class="mxpop_scroll" scroll-y="true" v-show="isShowList">
  9. <view class="uni-list">
  10. <slot v-for="(item, index) in listData">
  11. <view class="uni-list-cell"
  12. hover-class="uni-list-cell-hover"
  13. :class="{ 'selected': rkid === item.wmsStockIns.id }"
  14. :key="index" @click="goProDetail(item, index, $event)"
  15. >
  16. <view style="display: flex;">
  17. <view class="titleV">货位:</view>
  18. <view class="detailV">{{ item.wmsStockIns.locationName }}</view>
  19. <view class="tailV">{{ index+1 }}</view>
  20. </view>
  21. <view style="display: flex;">
  22. <view class="titleV">物料:</view>
  23. <view class="detailV">{{item.wmsStockIns.materialName}}</view>
  24. </view>
  25. <view style="display: flex;">
  26. <view class="titleV">规格:</view>
  27. <view class="detailV">{{item.wmsStockIns.materialSpecification}}</view>
  28. </view>
  29. <view style="display: flex;">
  30. <view class="titleV">标签:</view>
  31. <view class="detailV">{{item.wmsStockIns.labelCode}}</view>
  32. </view>
  33. <view style="display: flex;">
  34. <view class="titleV">数量:</view>
  35. <view class="detailV">{{ item.wmsStockIns.stockQty }}</view>
  36. </view>
  37. <view style="display: flex;">
  38. <view class="titleV">批号:</view>
  39. <view class="detailV">{{ item.wmsStockIns.batch }}</view>
  40. </view>
  41. <view style="display: flex;">
  42. <view class="titleV">批号1:</view>
  43. <view class="detailV">{{ item.wmsStockIns.batch1 }}</view>
  44. </view>
  45. <!-- <view><text>货位:{{item.hw}},物料:{{item.wl}},数量:{{item.sl}},批号:{{item.ph}} </text></view> -->
  46. </view>
  47. <view class="s-line" />
  48. </slot>
  49. </view>
  50. </scroll-view>
  51. <view class="page-bottom">
  52. <view class="p-b-btn" @click="examine">
  53. <text class="box-text" v-show="!isShowButton">提交</text>
  54. </view>
  55. <view class="p-b-btn" @click="del">
  56. <text class="box-text" v-show="!isShowButton">删除</text>
  57. </view>
  58. <view class="p-b-btn" @click="closeDrawer">
  59. <text class="box-text">返回</text>
  60. </view>
  61. </view>
  62. </uni-drawer>
  63. <!-- 选择其它单据 -->
  64. <StockPopup ref="StockPopup" :title="'入库单'" :idxFlag="'stock'" :formData="formData" @sendData="getSendData"/>
  65. </view>
  66. </template>
  67. <script>
  68. import { listStockIn, delStockIn, checkStatus } from '@/api/wms/stockIn.js'
  69. import storage from '../../../../utils/storage';
  70. import StockPopup from './commonpopup.vue' // 选择其它单据
  71. export default {
  72. components: {
  73. StockPopup
  74. },
  75. props: {
  76. formData:{
  77. type: Object,
  78. require: true
  79. }
  80. },
  81. data() {
  82. return {
  83. isShowButton: true, //显示查询按钮
  84. isShowList: false, // 显示list
  85. drawerWidth: 300,
  86. cellBackColor: 'white',
  87. rkid: 0, // 当前选中数据
  88. selectedItemIndex: -1,
  89. listData:[],
  90. // listData: [
  91. // {
  92. // select: false,
  93. // hw: "234234234",
  94. // wl: "左/右前门锁加强板 831 361B/362B 左",
  95. // sl: "23",
  96. // ph: "4324"
  97. // },
  98. // {
  99. // select: false,
  100. // hw: "234234234",
  101. // wl: "左/右前门锁加强板 831 361B/362B 左/右前门锁加强板 831 361B/362B左/右前门锁加强板 831 361B/362B左/右前门锁加强板 831 361B/362B左/右前门锁加强板 831 361B/362B",
  102. // sl: "23",
  103. // ph: "444"
  104. // }
  105. // ],
  106. };
  107. },
  108. created(){
  109. let that = this;
  110. uni.getSystemInfo({
  111. success:(res=>{
  112. that.drawerWidth = res.windowWidth;
  113. })
  114. });
  115. },
  116. mounted(){
  117. },
  118. methods:{
  119. showPopup() {
  120. this.$refs.mx_popup.open('bottom');
  121. },
  122. hidePopup() {
  123. this.$refs.mx_popup.close();
  124. },
  125. showDrawer() {
  126. this.isShowButton = true;
  127. this.isShowList = false;
  128. this.$refs.showRight.open();
  129. },
  130. closeDrawer() {
  131. this.selectedItemIndex = -1;
  132. this.listData = [];
  133. this.$refs.showRight.close();
  134. },
  135. del(){
  136. //删除
  137. let queryParams = this.rkid;
  138. if(queryParams && queryParams!=0){
  139. delStockIn(queryParams).then(res => {
  140. if(res.code === 200){
  141. uni.showToast({
  142. title: '删除成功',
  143. icon: 'none'
  144. })
  145. this.rkid = 0;
  146. this.getList();
  147. }
  148. });
  149. }
  150. },
  151. examine(){
  152. //审核
  153. let queryParams = [];
  154. for(let i=0;i<this.listData.length;i++){
  155. if(this.listData[i].id!=null && this.listData[i].id!=undefined && queryParams.indexOf(this.listData[i].id) == -1 ){
  156. queryParams.push(this.listData[i].id);
  157. }
  158. }
  159. if(queryParams && queryParams.length!=0){
  160. uni.showToast({
  161. title: '提交中,请稍等',
  162. icon: 'none',
  163. duration:30000
  164. })
  165. checkStatus(queryParams).then(res => {
  166. if(res.code === 200){
  167. uni.showToast({
  168. title: '提交成功',
  169. icon: 'none'
  170. })
  171. this.getList();
  172. }
  173. });
  174. }
  175. },
  176. goProDetail(item, index, event){
  177. //点击行 改变选中背景色
  178. try{
  179. this.selectedItemIndex = index;
  180. this.rkid = item.wmsStockIns.id;
  181. }catch{
  182. this.rkid = 0;
  183. }
  184. },
  185. getList(){
  186. let queryParams = {"params":{}};
  187. let storageData = uni.getStorageSync('stock_key');
  188. if(storageData){
  189. // 显示列表
  190. this.isShowList = true;
  191. // 不显示按钮
  192. this.isShowButton = false;
  193. queryParams.params.stockIdArr = "'"+storageData.stockIdList.join("','")+"'";
  194. queryParams.status = 1;
  195. listStockIn(queryParams).then(res => {
  196. if(res.code === 200){
  197. // 表头id
  198. let stockIdList = [];
  199. const newData = res.rows.map((item) => {
  200. // 在每个对象中插入新变量
  201. item['selected'] = false;
  202. // 插入表头id
  203. stockIdList.push(item["id"]);
  204. // 返回修改后的对象
  205. return item;
  206. });
  207. this.listData = newData;
  208. //更新表头id
  209. let data = uni.getStorageSync('stock_key');
  210. data.stockIdList = stockIdList;
  211. uni.setStorageSync('stock_key', data);
  212. // 赋值数量
  213. this.$emit("sendNum", this.listData.length)
  214. }
  215. });
  216. }else{
  217. uni.showToast({
  218. title: "当前没有单据",
  219. icon: "none"
  220. })
  221. }
  222. },
  223. getHeadList(){
  224. this.$refs.StockPopup.showPopup();
  225. },
  226. getSendData(res){ //基础资料
  227. let cFlag = res.currentFlag;
  228. if (cFlag == 'stock'){
  229. let data = {
  230. "stockId": res.selectData.id,
  231. "stockIdList": [res.selectData.id]
  232. }
  233. uni.setStorageSync('stock_key', data);
  234. this.getList();
  235. this.$emit("sendData", res);
  236. }
  237. },
  238. }
  239. }
  240. </script>
  241. <style lang="less">
  242. .mxpopup-container{
  243. // top: 50px;
  244. background-color: white
  245. }
  246. .mx-bottom-toolbar{
  247. background-color: #fcfcfc;
  248. // height: 100rpx;
  249. width: 100%;
  250. position: fixed;
  251. bottom: 0;
  252. display: flex;
  253. justify-content: space-between;
  254. }
  255. .bottm-btn{
  256. width: 50%;
  257. text-align: center;
  258. line-height: 50px;
  259. font-size: 16px;
  260. color: black;
  261. }
  262. .selected {
  263. background-color: #f8edb8;
  264. }
  265. ::v-deep .uni-section-header{
  266. background-color: lightgray;
  267. }
  268. .uni-list-cell {
  269. flex-direction: column;
  270. // margin-top: 10px;
  271. // background-color: white;
  272. padding: 8px 12px;
  273. }
  274. .titleV {
  275. color: #888888;
  276. font-size: 12px;
  277. height: 26px;
  278. line-height: 26px;
  279. width: 60px;
  280. // width: auto !important;
  281. }
  282. .detailV {
  283. margin-left: 4px;
  284. color: #333333;
  285. font-size: 13px;
  286. height: auto;
  287. line-height: 26px;
  288. width: calc(100vw - 70px);
  289. // width: auto !important;;
  290. }
  291. .tailV {
  292. color: #888888;
  293. font-size: 12px;
  294. height: 26px;
  295. line-height: 26px;
  296. width: 10px;
  297. }
  298. .s-line{
  299. top: 0;
  300. right: 0;
  301. left: 0;
  302. height: 1px;
  303. margin-top: 5px;
  304. -webkit-transform: scaleY(0.5);
  305. transform: scaleY(0.5);
  306. background-color: #e5e5e5;
  307. z-index: 1;
  308. }
  309. .box-text{
  310. font-size: 16px;
  311. }
  312. /* 底部操作菜单 */
  313. .page-bottom{
  314. position:fixed;
  315. left: 30upx;
  316. right: 30upx;
  317. bottom:20upx;
  318. z-index: 95;
  319. display: flex;
  320. /* justify-content: center; */
  321. justify-content: space-between;
  322. padding: 10px 20px 10px 20px;
  323. align-items: center;
  324. // width: 690upx;
  325. // width: 90%;
  326. height: 100upx;
  327. background: rgba(255,255,255,.9);
  328. box-shadow: 0 0 20upx 0 rgba(0,0,0,.5);
  329. border-radius: 16upx;
  330. .p-b-btn{
  331. display:flex;
  332. flex-direction: column;
  333. align-items: center;
  334. justify-content: center;
  335. // color: $font-color-base;
  336. width: 96upx;
  337. height: 80upx;
  338. font-size: 16px;
  339. }
  340. }
  341. .query_view{
  342. padding: 15px;
  343. }
  344. ::v-deep .uni-drawer{
  345. /* #ifndef APP-PLUS */
  346. top: 45px !important;
  347. /* #endif */
  348. /* #ifdef APP-PLUS */
  349. top: 70px !important;
  350. /* #endif */
  351. }
  352. .mxpop_scroll{
  353. /* #ifndef APP-PLUS */
  354. height: calc(100vh - 100px)
  355. /* #endif */
  356. /* #ifdef APP-PLUS */
  357. height: calc(100vh - 125px)
  358. /* #endif */
  359. }
  360. </style>