mxPopup.vue 8.4 KB

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