addBackOrder.vue 13 KB

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