addBackOrder.vue 14 KB

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