addBackOrder.vue 16 KB

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