addBackOrder.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  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 || (item.unsalableDays&&item.unsalableDays) == 0 ?'--天':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. {{item.replenishBillQty && item.replenishBillQty!=0 ? '/':''}}调回在途
  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="1" :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 ref="detailPopup" @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:undefined,
  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. this.queryParam.shelfSn = options.shelfSn
  167. let ajaxData = {
  168. shelfSn: options.shelfSn
  169. };
  170. this.loadData(ajaxData);
  171. },
  172. onBackPress(e) {
  173. if (this.sortShow) {
  174. this.sortShow = false;
  175. this.isSortFlag = 0;
  176. return true;
  177. }
  178. },
  179. methods: {
  180. // 获取列表
  181. loadData(params) {
  182. const _this = this;
  183. uni.showLoading({
  184. title: '加载中...'
  185. });
  186. controlQueryList(params).then(res => {
  187. if (res.status == 200) {
  188. res.data.forEach(item=>{
  189. item.isChecked= false
  190. item.confirmQty = item.qty
  191. })
  192. this.recallBillList=res.data;
  193. }
  194. uni.hideLoading()
  195. });
  196. },
  197. checkGroupChange(e){
  198. let flag = this.recallBillList.every(con => con.isChecked )
  199. if(flag){
  200. this.allChecked = true
  201. }else{
  202. this.allChecked = false
  203. }
  204. this.calculateTypeTotal()
  205. this.calculateTotal()
  206. },
  207. // 全选
  208. allCheckedChange(e){
  209. if(e.value){
  210. this.recallBillList.map(item=>{
  211. item.isChecked = true;
  212. })
  213. }else{
  214. this.recallBillList.map(item=>{
  215. item.isChecked = false;
  216. })
  217. }
  218. this.calculateTotal()
  219. this.calculateTypeTotal()
  220. },
  221. // 计算选中总款数
  222. calculateTypeTotal(){
  223. this.chooseArr = this.recallBillList.filter(item=>{
  224. return item.isChecked
  225. })
  226. },
  227. // 计算选中总件数
  228. calculateTotal(){
  229. this.totalNum = this.recallBillList.filter(item=>{
  230. return item.isChecked
  231. }).reduce((pre,cur)=>{
  232. return pre + cur.confirmQty
  233. },0)
  234. },
  235. //查看选中详情
  236. seeDetail(){
  237. if(this.chooseArr.length == 0){
  238. uni.showToast({
  239. title:'请先选择调回产品',
  240. icon:'none'
  241. })
  242. }else{
  243. this.detailFlag = true;
  244. }
  245. },
  246. // 详情删除其中一条选中数据
  247. clearOneList(id){
  248. let i = this.recallBillList.findIndex(val =>{
  249. return val.id == id;
  250. })
  251. this.recallBillList[i].isChecked = false
  252. this.calculateTotal();
  253. },
  254. clearAll(){
  255. this.recallBillList.map(item=>{
  256. item.isChecked = false;
  257. })
  258. this.allChecked =false;
  259. this.chooseArr = []
  260. this.calculateTotal();
  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.chooseShow =false;
  293. this.loadData(this.queryParam);
  294. }
  295. },
  296. // 搜索
  297. getSearchCon() {
  298. var reg = new RegExp('[\\u4E00-\\u9FFF]+', 'g');
  299. if (reg.test(this.keyword)) {
  300. //包含汉字
  301. this.queryParam.productName = this.keyword.trim()
  302. } else {
  303. this.queryParam.productCode=this.keyword.trim()
  304. }
  305. this.queryParam.shelfSn = this.shelfSn
  306. this.loadData(this.queryParam);
  307. },
  308. // 清空搜索内容
  309. clearSearch() {
  310. this.keyword = '';
  311. this.reset();
  312. },
  313. // 扫描
  314. handleScanCode(){
  315. this.mpaasScanModule = uni.requireNativePlugin("wss-scan")
  316. this.mpaasScanModule.scan(
  317. {
  318. "scanMode":"Customized",
  319. "scanStyle":{
  320. "scanFrameSizePlus":{"width":250,"height":250},
  321. "scanFrameSize":200,
  322. "scanLight":"visible",
  323. "scanText":"对准条形码/二维码进行识别",
  324. "scanTitle":"扫码搜索货位产品",
  325. }
  326. },
  327. (result) => {
  328. if(result.scanStatus == 1){
  329. this.scanResult(result)
  330. }
  331. })
  332. },
  333. // 扫描结果
  334. scanResult(data){
  335. // 二维码
  336. if(data.scanType == 'QRCODE'){
  337. const ret = data.scanValue.split("&")
  338. this.queryParam.queryWord = ret[1] // 产品编码
  339. }else{
  340. this.queryParam.queryWord = 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. .header_box {
  445. width: 100%;
  446. height: 142rpx;
  447. padding: 0 20rpx 20rpx;
  448. .headerName {
  449. padding-bottom: 15rpx;
  450. color: #222;
  451. font-size: 30rpx;
  452. .barBox {
  453. display: block;
  454. height: 30rpx;
  455. width: 6rpx;
  456. background: #0485f6;
  457. margin-right: 10rpx;
  458. border-radius: 10rpx;
  459. }
  460. .shelfName {
  461. font-weight: bold;
  462. width: calc(100% - 166rpx);
  463. }
  464. .screeningBox {
  465. font-size: 26rpx;
  466. width: 150rpx;
  467. text-align: right;
  468. text {
  469. vertical-align: top;
  470. }
  471. }
  472. }
  473. .searchBox {
  474. width: 100%;
  475. display: flex;
  476. align-items: center;
  477. padding: 0 20rpx;
  478. border: 1rpx solid #e0e0e0;
  479. border-radius: 50rpx;
  480. box-sizing: border-box;
  481. .searchBox_l {
  482. width: 87%;
  483. }
  484. .searchBox_r {
  485. width: 13%;
  486. text-align: right;
  487. font-size: 46rpx;
  488. color: #999;
  489. }
  490. }
  491. }
  492. .backOrderCon {
  493. width: 100%;
  494. height: calc(100vh - 280rpx);
  495. .scroll-view{
  496. height: 100%;
  497. .partList-list-box {
  498. width: 700rpx;
  499. padding: 10px 0;
  500. border-bottom: 2rpx solid #f5f5f5;
  501. &:last-child {
  502. border: 0;
  503. }
  504. .product {
  505. flex-grow: 1;
  506. .checkbox {
  507. width: 60rpx;
  508. }
  509. .pinfo {
  510. flex-grow: 1;
  511. padding-left: 20rpx;
  512. .pname {
  513. font-size: 26rpx;
  514. color:#222;
  515. text {
  516. font-weight: normal;
  517. margin-right: 10rpx;
  518. padding: 0 10rpx;
  519. background: rgba(3, 54, 146, 0.15);
  520. border-radius: 30rpx;
  521. color: #033692;
  522. font-size: 24rpx;
  523. }
  524. }
  525. .productName{
  526. width: 100%;
  527. font-size: 26rpx;
  528. margin:6rpx 0;
  529. }
  530. .pno {
  531. background-color: rgba(3, 54, 146, 0.15);
  532. border-radius: 50rpx;
  533. padding: 0 20rpx;
  534. color: #033692;
  535. font-size: 24rpx;
  536. margin-right: 10rpx;
  537. }
  538. .ptxt {
  539. font-size: 24rpx;
  540. color: #999;
  541. .pnums {
  542. color: #222;
  543. padding: 0 4upx;
  544. }
  545. }
  546. }
  547. }
  548. .ptools {
  549. margin-top: 30rpx;
  550. margin-left: 60rpx;
  551. .ptools_l{
  552. font-size: 24rpx;
  553. color: #999;
  554. view{
  555. :nth-child(2)::before{
  556. content: '/';
  557. }
  558. }
  559. .pnums {
  560. color: #ff5500;
  561. padding: 0 4rpx;
  562. }
  563. }
  564. .pcurnums {
  565. > text {
  566. font-size: 24rpx;
  567. color: #999;
  568. margin-right: 20rpx;
  569. }
  570. }
  571. .u-ninput {
  572. border: 2rpx solid #eee;
  573. border-radius: 50rpx;
  574. padding: 0 6rpx;
  575. }
  576. /deep/ .u-icon-disabled {
  577. background: #fff !important;
  578. }
  579. /deep/ .u-number-input {
  580. margin: 0 0;
  581. border: 2rpx solid #eee;
  582. border-top: 0;
  583. border-bottom: 0;
  584. }
  585. /deep/ .u-icon-plus,
  586. /deep/ .u-icon-minus {
  587. border-radius: 50rpx;
  588. }
  589. }
  590. }
  591. }
  592. }
  593. .backOrderFooter {
  594. height: 98rpx;
  595. box-sizing: border-box;
  596. padding: 10rpx 0;
  597. vertical-align: top;
  598. position: relative;
  599. background-color: #fff;
  600. .checkBox {
  601. width: 20%;
  602. }
  603. .footerBox {
  604. width: 80%;
  605. .footerBox_m {
  606. .middle_l {
  607. text {
  608. color: #ff5500;
  609. margin: 0 6rpx;
  610. }
  611. }
  612. .middle_r {
  613. font-size: 24rpx;
  614. color: #999;
  615. margin-left: 10rpx;
  616. }
  617. }
  618. .footerBox_r {
  619. width: 200rpx;
  620. button {
  621. width: 100%;
  622. font-size: 26rpx;
  623. }
  624. }
  625. }
  626. }
  627. // 弹窗样式
  628. .choosePopup {
  629. padding: 30rpx 20rpx;
  630. box-sizing: border-box;
  631. .chooseTit {
  632. text-align: center;
  633. }
  634. .chooseDay {
  635. margin: 60rpx 0;
  636. .u-input {
  637. border-bottom: 1rpx solid #e0e0e0;
  638. }
  639. }
  640. .butBox {
  641. margin-top: 100rpx;
  642. .u-size-medium {
  643. padding: 0 60rpx !important;
  644. }
  645. }
  646. }
  647. }
  648. </style>