addBackOrder.vue 16 KB

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