mxPopup.vue 8.7 KB

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