mxPopup.vue 7.6 KB

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