mxPopup.vue 8.9 KB

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