addBackOrder.vue 16 KB

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