addBackOrder.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. <template>
  2. <view class="modal-box">
  3. <view class="header_box">
  4. <view class="headerName u-flex">
  5. <text class="barBox"></text>
  6. <view class="shelfName u-line-1">{{ shelfName }}</view>
  7. <view class="screeningBox" @click="chooseShow = true">
  8. <text>滞销天数</text>
  9. <u-icon color="#666666" size="36" name="shaixuan" custom-prefix="iscm-icon"></u-icon>
  10. </view>
  11. </view>
  12. <view class="searchBox">
  13. <view class="searchBox_l">
  14. <u-search
  15. placeholder="请输入产品编码或产品名称搜索"
  16. @change="getSearchCon"
  17. @search="getSearchCon"
  18. @custom="getSearchCon"
  19. @clear="clearSearch"
  20. v-model="keyword"
  21. bg-color="#FFF"
  22. shape="round"
  23. :show-action="false"
  24. ></u-search>
  25. </view>
  26. <view class="searchBox_r" @click="handleScanCode"><u-icon color="#666666" size="40" name="saomiao" custom-prefix="iscm-icon"></u-icon></view>
  27. </view>
  28. </view>
  29. <view class="backOrderCon">
  30. <scroll-view scroll-y class="scroll-view" v-if="recallBillList && recallBillList.length>0" >
  31. <u-checkbox-group :wrap="true" @change="checkGroupChange">
  32. <view class="partList-list-box" v-for="(item,index) in recallBillList" :key="item.id">
  33. <view class="product flex align_center">
  34. <view class="checkbox"><u-checkbox v-model="item.isChecked" :name="item.id" size="40" shape="circle"></u-checkbox></view>
  35. <view class="flex align_center flex_1">
  36. <view class="pimgs">
  37. <u-image src="`../../static/${$config('themePath')}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
  38. </view>
  39. <view class="pinfo">
  40. <view class="pname">
  41. <text>{{item.shelfPlaceCode}}</text>
  42. {{item.productCode}}
  43. </view>
  44. <view class="productName u-line-2">
  45. {{item.productName}}
  46. </view>
  47. <view class="ptxt flex align_center">
  48. <view>
  49. 最大库容
  50. <text class="pnums">{{item.maxQty}}</text>
  51. </view>
  52. <view>
  53. /货架库存
  54. <text class="pnums">{{item.qty}}</text>
  55. </view>
  56. <view>
  57. /滞销
  58. <text class="pnums">{{item.unsalableDays}}</text>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="ptools flex align_center justify_between">
  65. <view class="ptools_l u-flex">
  66. <view v-if="item.replenishBillQty && item.replenishBillQty!=0">
  67. 补货在途
  68. <text class="pnums">{{item.replenishBillQty}}</text>
  69. </view>
  70. <view v-if="item.recallBillQty && item.recallBillQty!=0">
  71. 调回在途
  72. <text class="pnums">{{item.recallBillQty}}</text>
  73. </view>
  74. </view>
  75. <view class="pcurnums flex align_center">
  76. <text>调回数量</text>
  77. <view class="u-ninput"><u-number-box color="#000" :input-height="60" bg-color="#fff" v-model="item.confirmQty" :min="0" :max="item.qty" @minus="minus" @plus="plus" @change="numberBoxChange"></u-number-box></view>
  78. </view>
  79. </view>
  80. </view>
  81. </u-checkbox-group>
  82. </scroll-view>
  83. <u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="200" :text="noDataText" img-width="120" v-else></u-empty>
  84. </view>
  85. <view class="backOrderFooter u-flex">
  86. <view class="checkBox">
  87. <u-checkbox-group><u-checkbox label-size="24" v-model="allChecked" shape="circle" @change="allCheckedChange">全选</u-checkbox></u-checkbox-group>
  88. </view>
  89. <view class="footerBox u-flex u-row-between">
  90. <view class="footerBox_m u-flex">
  91. <view class="middle_l">
  92. 已选
  93. <text>{{chooseArr.length}}</text>
  94. 款/
  95. <text>{{totalNum}}</text>
  96. </view>
  97. <view class="middle_r" @click="seeDetail">
  98. <text>查看明细</text>
  99. <u-icon name="arrow-up" color="#999" size="28"></u-icon>
  100. </view>
  101. </view>
  102. <view class="footerBox_r"><u-button type="primary" shape="circle">新增调回单</u-button></view>
  103. </view>
  104. </view>
  105. <!-- 排序弹窗 -->
  106. <u-popup v-model="chooseShow" mode="right" width="60%">
  107. <view class="choosePopup">
  108. <view class="chooseTit">滞销天数</view>
  109. <view class="chooseDay u-flex">
  110. <u-input v-model="queryParam.unsalableDaysBegin" input-align="center" placeholder="起始天数" type="number" />
  111. <text>至</text>
  112. <u-input v-model="queryParam.unsalableDaysEnd" input-align="center" placeholder="截止天数" type="number" />
  113. </view>
  114. <view class="butBox u-flex">
  115. <u-button hover-class="none" shape="circle" size="medium" @click="reset">重置</u-button>
  116. <u-button hover-class="none" :custom-style="customBtnStyle" size="medium" shape="circle" @click="handelFilter">查询</u-button>
  117. </view>
  118. </view>
  119. </u-popup>
  120. <!-- 查看明细弹窗 -->
  121. <detailModal @clearList='clearOneList' @clearAllList="clearAll" @changeNumRecount="recount" :detailShow="detailFlag" :chooseData="chooseArr" @close="detailFlag=false"></detailModal>
  122. </view>
  123. </template>
  124. <script>
  125. import { reportPage } from '@/api/vinLog';
  126. import { controlQueryList } from '@/api/shelf';
  127. import detailModal from './detailModal'
  128. export default {
  129. components: {
  130. detailModal
  131. },
  132. data() {
  133. return {
  134. shelfSn: '',
  135. shelfName: '',
  136. recallBillList:[],//回调单列表
  137. chooseArr:[],
  138. noDataText: '暂无调回单',
  139. totalNum: 0,
  140. detailFlag:false,//查看详情
  141. chooseShow: false,//滞销天数弹窗
  142. theme: '',
  143. customBtnStyle: {
  144. // 自定义按钮样式
  145. borderColor: this.$config('primaryColor'),
  146. backgroundColor: this.$config('primaryColor'),
  147. color: '#fff'
  148. },
  149. allChecked: false,
  150. keyword: '',//搜索
  151. queryParam: { // 查询条件
  152. shelfSn:this.shelfSn,
  153. productCode: undefined,
  154. productName: undefined,
  155. unsalableDaysBegin: undefined,
  156. unsalableDaysEnd: undefined,
  157. queryWord:undefined
  158. },
  159. };
  160. },
  161. onLoad(options) {
  162. this.theme = getApp().globalData.theme;
  163. this.shelfSn = options.shelfSn;
  164. this.shelfName = options.shelfName;
  165. let ajaxData = {
  166. shelfSn: options.shelfSn
  167. };
  168. this.loadData(ajaxData);
  169. },
  170. onBackPress(e) {
  171. if (this.sortShow) {
  172. this.sortShow = false;
  173. this.isSortFlag = 0;
  174. return true;
  175. }
  176. },
  177. methods: {
  178. // 获取列表
  179. loadData(params) {
  180. const _this = this;
  181. uni.showLoading({
  182. title: '加载中...'
  183. });
  184. controlQueryList(params).then(res => {
  185. if (res.status == 200) {
  186. res.data.forEach(item=>{
  187. item.isChecked= false
  188. item.confirmQty = item.qty
  189. })
  190. this.recallBillList=res.data;
  191. }
  192. uni.hideLoading()
  193. });
  194. },
  195. checkGroupChange(e){
  196. let newArr=[];
  197. e.forEach(item=>{
  198. this.recallBillList.map(info =>{
  199. if(item == info.id) {
  200. newArr.push(info);
  201. }
  202. })
  203. })
  204. this.chooseArr = newArr;
  205. let flag = this.recallBillList.every(con => con.isChecked )
  206. if(flag){
  207. this.allChecked = true
  208. }else{
  209. this.allChecked = false
  210. }
  211. this.calculateTotal()
  212. },
  213. // 全选
  214. allCheckedChange(e){
  215. if(e.value){
  216. this.recallBillList.map(item=>{
  217. item.isChecked = true;
  218. })
  219. this.chooseArr = this.recallBillList;
  220. }else{
  221. this.recallBillList.map(item=>{
  222. item.isChecked = false;
  223. })
  224. this.chooseArr =[]
  225. }
  226. this.calculateTotal()
  227. },
  228. // 计算选中总件数
  229. calculateTotal(){
  230. this.totalNum = this.recallBillList.filter(item=>{
  231. return item.isChecked
  232. }).reduce((pre,cur)=>{
  233. return pre + cur.confirmQty
  234. },0)
  235. },
  236. //查看选中详情
  237. seeDetail(){
  238. if(this.chooseArr.length == 0){
  239. uni.showToast({
  240. title:'请先选择调回单',
  241. icon:'none'
  242. })
  243. }else{
  244. this.detailFlag = true;
  245. }
  246. },
  247. // 详情删除其中一条选中数据
  248. clearOneList(id){
  249. let i =this.recallBillList.findIndex(val =>{
  250. return val.id == id;
  251. })
  252. this.recallBillList[i].isChecked = false
  253. this.calculateTotal();
  254. },
  255. clearAll(){
  256. this.recallBillList.map(item=>{
  257. item.isChecked = false;
  258. })
  259. this.chooseArr = []
  260. },
  261. //进步器change事件
  262. numberBoxChange(){
  263. this.calculateTotal();
  264. },
  265. minus(){
  266. this.calculateTotal();
  267. },
  268. plus(){
  269. this.calculateTotal();
  270. },
  271. // 详情改变重新计算总件数
  272. recount(){
  273. this.calculateTotal();
  274. },
  275. // 重置
  276. reset() {
  277. let ajaxData = {
  278. shelfSn:this.shelfSn,
  279. productCode: undefined,
  280. productName: undefined,
  281. unsalableDaysBegin: undefined,
  282. unsalableDaysEnd: undefined,
  283. queryWord:undefined
  284. };
  285. this.queryParam = ajaxData;
  286. this.loadData(this.queryParam);
  287. },
  288. handelFilter(){
  289. this.queryParam.shelfSn = this.shelfSn;
  290. this.loadData(this.queryParam);
  291. },
  292. // 搜索
  293. getSearchCon() {
  294. var reg = new RegExp('[\\u4E00-\\u9FFF]+', 'g');
  295. if (reg.test(this.keyword)) {
  296. //包含汉字
  297. this.queryParam.productName = this.keyword.trim()
  298. } else {
  299. this.queryParam.productCode=this.keyword.trim()
  300. }
  301. this.queryParam.shelfSn = this.shelfSn
  302. this.loadData(this.queryParam);
  303. },
  304. // 清空搜索内容
  305. clearSearch() {
  306. this.keyword = '';
  307. this.reset();
  308. },
  309. //扫码
  310. handleScanCode(){
  311. uni.scanCode({
  312. success: (res)=> {
  313. console.log('条码类型:' + res.scanType);
  314. console.log('条码内容:' + res.result);
  315. this.queryParam.queryWord = res.result;
  316. }
  317. });
  318. this.loadData(this.queryParam);
  319. }
  320. }
  321. };
  322. </script>
  323. <style lang="less" scoped>
  324. .modal-box {
  325. background: #ffffff;
  326. padding: 20rpx;
  327. width: 100%;
  328. height: 100vh;
  329. box-sizing: border-box;
  330. .header_box {
  331. width: 100%;
  332. height: 142rpx;
  333. padding: 0 20rpx 20rpx;
  334. .headerName {
  335. padding-bottom: 15rpx;
  336. color: #222;
  337. font-size: 30rpx;
  338. .barBox {
  339. display: block;
  340. height: 30rpx;
  341. width: 6rpx;
  342. background: #0485f6;
  343. margin-right: 10rpx;
  344. border-radius: 10rpx;
  345. }
  346. .shelfName {
  347. font-weight: bold;
  348. width: calc(100% - 166rpx);
  349. }
  350. .screeningBox {
  351. font-size: 26rpx;
  352. width: 150rpx;
  353. text-align: right;
  354. text {
  355. vertical-align: top;
  356. }
  357. }
  358. }
  359. .searchBox {
  360. width: 100%;
  361. display: flex;
  362. align-items: center;
  363. padding: 0 20rpx;
  364. border: 1rpx solid #e0e0e0;
  365. border-radius: 32rpx;
  366. box-sizing: border-box;
  367. .searchBox_l {
  368. width: 93%;
  369. }
  370. .searchBox_r {
  371. width: 7%;
  372. }
  373. }
  374. }
  375. .backOrderCon {
  376. width: 100%;
  377. height: calc(100vh - 280rpx);
  378. .scroll-view{
  379. height: 100%;
  380. .partList-list-box {
  381. width: 700rpx;
  382. padding: 10px 0;
  383. border-bottom: 2rpx solid #f5f5f5;
  384. &:last-child {
  385. border: 0;
  386. }
  387. .product {
  388. flex-grow: 1;
  389. .checkbox {
  390. width: 60rpx;
  391. }
  392. .pinfo {
  393. flex-grow: 1;
  394. padding-left: 20rpx;
  395. .pname {
  396. font-size: 32rpx;
  397. color: #191919;
  398. margin-bottom: 10rpx;
  399. text {
  400. font-weight: normal;
  401. margin-right: 6rpx;
  402. padding: 0 10rpx;
  403. background: rgba(3, 54, 146, 0.15);
  404. border-radius: 100rpx;
  405. color: #033692;
  406. font-size: 28rpx;
  407. }
  408. }
  409. .productName{
  410. width: 100%;
  411. font-size: 32rpx;
  412. color: #191919;
  413. font-weight: bold;
  414. margin:10rpx 0;
  415. }
  416. .pno {
  417. background-color: rgba(3, 54, 146, 0.15);
  418. border-radius: 50rpx;
  419. padding: 0 20rpx;
  420. color: #033692;
  421. font-size: 24rpx;
  422. margin-right: 10rpx;
  423. }
  424. .ptxt {
  425. font-size: 24rpx;
  426. color: #999;
  427. .pnums {
  428. color: #222;
  429. padding: 0 4upx;
  430. }
  431. }
  432. }
  433. }
  434. .ptools {
  435. margin-top: 30rpx;
  436. margin-left: 60rpx;
  437. .ptools_l{
  438. font-size: 24rpx;
  439. color: #999;
  440. view{
  441. :nth-child(2)::before{
  442. content: '/';
  443. }
  444. }
  445. .pnums {
  446. color: #ff5500;
  447. padding: 0 4rpx;
  448. }
  449. }
  450. .pcurnums {
  451. > text {
  452. font-size: 24rpx;
  453. color: #999;
  454. margin-right: 20rpx;
  455. }
  456. }
  457. .u-ninput {
  458. border: 2rpx solid #eee;
  459. border-radius: 50rpx;
  460. padding: 0 6rpx;
  461. }
  462. /deep/ .u-icon-disabled {
  463. background: #fff !important;
  464. }
  465. /deep/ .u-number-input {
  466. margin: 0 0;
  467. border: 2rpx solid #eee;
  468. border-top: 0;
  469. border-bottom: 0;
  470. }
  471. /deep/ .u-icon-plus,
  472. /deep/ .u-icon-minus {
  473. border-radius: 50rpx;
  474. }
  475. }
  476. }
  477. }
  478. }
  479. .backOrderFooter {
  480. height: 98rpx;
  481. box-sizing: border-box;
  482. padding: 10rpx 0;
  483. vertical-align: top;
  484. .checkBox {
  485. width: 20%;
  486. }
  487. .footerBox {
  488. width: 80%;
  489. .footerBox_m {
  490. .middle_l {
  491. text {
  492. color: #ff5500;
  493. margin: 0 6rpx;
  494. }
  495. }
  496. .middle_r {
  497. font-size: 24rpx;
  498. color: #999;
  499. margin-left: 10rpx;
  500. }
  501. }
  502. .footerBox_r {
  503. width: 200rpx;
  504. button {
  505. width: 100%;
  506. font-size: 26rpx;
  507. }
  508. }
  509. }
  510. }
  511. // 弹窗样式
  512. .choosePopup {
  513. padding: 30rpx 20rpx;
  514. box-sizing: border-box;
  515. .chooseTit {
  516. text-align: center;
  517. }
  518. .chooseDay {
  519. margin: 60rpx 0;
  520. .u-input {
  521. border-bottom: 1rpx solid #e0e0e0;
  522. }
  523. }
  524. .butBox {
  525. margin-top: 100rpx;
  526. .u-size-medium {
  527. padding: 0 60rpx !important;
  528. }
  529. }
  530. }
  531. }
  532. </style>