mxPopup.vue 8.5 KB

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