addBackOrder.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. <template>
  2. <view class="content flex flex_column">
  3. <u-navbar back-text="新增调回单" :border-bottom="false" :background="{backgroundColor: $config('primaryColor')}" back-icon-color="#fff" :back-text-style="{ color: '#fff' }">
  4. <template v-slot:right>
  5. <view style="padding: 0 30upx;color: #ffffff;" v-if="recallBillList.length" @click="toChooseProduct">
  6. <u-icon name="chuangjiandingdan" custom-prefix="iscm-icon"></u-icon>
  7. <text style="margin-left: 6rpx;">选择产品</text>
  8. </view>
  9. </template>
  10. </u-navbar>
  11. <view class="headerName u-flex">
  12. <text class="barBox"></text>
  13. <view class="shelfName u-line-1">{{ shelfName }}</view>
  14. <!-- <view class="screeningBox" @click="chooseShow = true">
  15. <text>滞销天数</text>
  16. <u-icon color="#666666" size="36" name="shaixuan" custom-prefix="iscm-icon"></u-icon>
  17. </view> -->
  18. </view>
  19. <view class="backOrderCon">
  20. <view v-if="recallBillList && recallBillList.length>0">
  21. <view class="partList-list-box" v-for="(item,index) in recallBillList" :key="item.id">
  22. <view class="product flex align_center">
  23. <view class="uni-col-1" @click="delDetail(item,index)">
  24. <u-icon name="close-circle" color="#ff5500" size="35"></u-icon>
  25. </view>
  26. <view class="flex flex_1">
  27. <view class="pimgs">
  28. <u-image :src="item.productImageUrl?item.productImageUrl:`../../static/${$config('themePath')}/def_img@2x.png`" width="120" height="120" border-radius="10"></u-image>
  29. </view>
  30. <view class="pinfo">
  31. <view class="pname item-name">
  32. <text>{{item.shelfPlaceCode}}</text>
  33. {{item.productCode}}
  34. </view>
  35. <view class="productName u-line-2">
  36. {{item.productName}}
  37. </view>
  38. <view class="ptxt flex align_center">
  39. <view>
  40. 最大库容
  41. <text class="pnums">{{item.maxQty}}</text>
  42. </view>
  43. <view>
  44. /货架库存
  45. <text class="pnums">{{item.qty}}</text>
  46. </view>
  47. <view>
  48. /滞销
  49. <text class="pnums">{{!item.unsalableDays || (item.unsalableDays&&item.unsalableDays) == 0 ?'--天':item.unsalableDays}}</text>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="ptools flex align_center u-row-between">
  56. <view class="ptools_l u-flex">
  57. <view v-if="item.replenishBillQty && item.replenishBillQty!=0">
  58. 补货在途
  59. <text class="pnums">{{item.replenishBillQty}}</text>
  60. </view>
  61. <view v-if="item.recallBillQty && item.recallBillQty!=0">
  62. {{item.replenishBillQty && item.replenishBillQty!=0 ? '/':''}}调回在途
  63. <text class="pnums">{{item.recallBillQty}}</text>
  64. </view>
  65. </view>
  66. <view class="pcurnums flex align_center">
  67. <text>调回数量</text>
  68. <view class="u-ninput"><u-number-box color="#000" bg-color="#fff" :input-height="60" v-model="item.confirmQty" :min="item.recallBillQty?item.qty - item.recallBillQty>0 ?1 :0 :1" :max="item.recallBillQty?item.qty - item.recallBillQty>0 ?item.qty - item.recallBillQty :0 :item.qty"></u-number-box></view>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="nodata" v-else>
  74. <image :src="`/static/${$config('themePath')}/def_no_data@3x.png`"></image>
  75. <view class="nodataTip">
  76. 暂无产品,请点击
  77. <text @click="toChooseProduct">选择产品</text>
  78. </view>
  79. </view>
  80. </view>
  81. <view class="backOrderFooter u-flex" :style="{zIndex:(detailFlag? 99999:11)}">
  82. <view class="footerBox u-flex u-row-between">
  83. <view class="footerBox_m u-flex">
  84. <view class="middle_l">
  85. 已选
  86. <text>{{totalCategory}}</text>
  87. 款/<text>{{totalQty}}</text>件
  88. </view>
  89. <view class="middle_r" @click="clearList" v-if="recallBillList && recallBillList.length>0">
  90. 清空列表
  91. </view>
  92. </view>
  93. <view class="footerBox_r"><u-button size="medium" @click="addBackOrder" :custom-style="customBtnStyle" shape="circle" type="primary" hover-class="none" >新增调回单</u-button></view>
  94. </view>
  95. </view>
  96. </view>
  97. </template>
  98. <script>
  99. import { reportPage } from '@/api/vinLog';
  100. import { controlQueryList,insert } from '@/api/shelf';
  101. import productList from './productList.vue'
  102. import { clzConfirm } from '@/libs/tools'
  103. export default {
  104. components: {
  105. productList
  106. },
  107. data() {
  108. return {
  109. shelfSn: '',
  110. shelfName: '',
  111. recallBillList:[],//回调单列表
  112. chooseArr:[],
  113. noDataText: '暂无产品,请点击选择产品',
  114. totalNum: 0,
  115. detailFlag:false,//查看详情
  116. chooseShow: false,//滞销天数弹窗
  117. theme: '',
  118. customBtnStyle: { // 自定义按钮样式
  119. borderColor: this.$config('primaryColor'),
  120. backgroundColor: this.$config('primaryColor'),
  121. color: '#fff'
  122. },
  123. allChecked: false,
  124. keyword: '',//搜索
  125. queryParam: { // 查询条件
  126. shelfSn:undefined,
  127. productCode: undefined,
  128. productName: undefined,
  129. unsalableDaysBegin: undefined,
  130. unsalableDaysEnd: undefined,
  131. queryWord:undefined
  132. },
  133. };
  134. },
  135. onLoad(options) {
  136. const _this = this
  137. _this.theme = getApp({ allowDefault: true }).globalData.theme;
  138. _this.shelfSn = options.shelfSn;
  139. _this.shelfName = options.shelfName;
  140. _this.recallBillList=_this.$store.state.vuex_shuntBackList || []
  141. uni.$on("chooseBackProduct",function(data){
  142. _this.recallBillList = _this.recallBillList.concat(data).sort(function(a,b){
  143. return (a.shelfPlaceCode+'').localeCompare(b.shelfPlaceCode+'');
  144. });
  145. })
  146. },
  147. onBackPress(e) {
  148. if (this.sortShow && e.from == "backbutton") {
  149. this.chooseShow = false;
  150. this.detailPopup = false;
  151. return true;
  152. }
  153. },
  154. computed: {
  155. totalCategory () {
  156. return this.recallBillList.length
  157. },
  158. totalQty () {
  159. let ret = 0
  160. this.recallBillList.map(item => {
  161. ret = ret + item.confirmQty
  162. })
  163. return ret
  164. },
  165. chooseKey(){
  166. let ret = []
  167. this.recallBillList.map(item => {
  168. ret.push(item.id)
  169. })
  170. return ret
  171. },
  172. },
  173. methods: {
  174. toChooseProduct(){
  175. let nowData={
  176. shelfSn:this.shelfSn,
  177. shelfName:this.shelfName,
  178. chooseKey :this.chooseKey
  179. }
  180. uni.navigateTo({
  181. url: "/pages/shuntBackManage/chooseProduct?data="+encodeURIComponent(JSON.stringify(nowData))
  182. })
  183. },
  184. //清空列表
  185. clearList(){
  186. const _this = this
  187. clzConfirm({
  188. title: '提示',
  189. content: '确认要清空列表吗?',
  190. success (ret) {
  191. if (ret.confirm || ret.index == 0) {
  192. _this.clearChoose()
  193. }
  194. }
  195. })
  196. },
  197. clearChoose(){
  198. this.recallBillList = []
  199. },
  200. //删除调回单列表
  201. delDetail(item,i){
  202. const index = this.recallBillList.findIndex(k => k.id == item.id)
  203. this.recallBillList.splice(index,1)
  204. // 全部清空
  205. if(this.recallBillList.length==0){
  206. this.clearChoose()
  207. }
  208. },
  209. addBackOrder(){
  210. const arr = []
  211. const arrInd = []
  212. if(this.recallBillList.length == 0){
  213. uni.showToast({
  214. title:'请先选择调回产品',
  215. icon:'none'
  216. })
  217. return;
  218. }
  219. this.recallBillList.forEach((item, index) => {
  220. if (item.confirmQty * 1>0) {
  221. arr.push({
  222. shelfSn: item.shelfSn,
  223. shelfPlaceSn: item.shelfPlaceSn,
  224. shelfPlaceCode: item.shelfPlaceCode,
  225. productSn: item.productSn,
  226. productCode: item.productCode,
  227. productName: item.productName,
  228. qty: item.confirmQty
  229. })
  230. } else {
  231. arrInd.push(index + 1)
  232. }
  233. })
  234. if (arrInd.length > 0) {
  235. uni.showToast({
  236. title:'调回数量不能为空或0,请移除后提交',
  237. icon:'none'
  238. })
  239. return
  240. }
  241. uni.showLoading({
  242. title: '保存中...'
  243. });
  244. const params = {
  245. shelfSn: this.shelfSn,
  246. detailList: arr
  247. }
  248. insert(params).then(res => {
  249. if (res.status == 200) {
  250. uni.showToast({
  251. title:res.message
  252. })
  253. setTimeout(()=>{
  254. uni.redirectTo({
  255. url:'/pages/shuntBackManage/cancellingStocks?sn='+res.data
  256. })
  257. },800)
  258. }
  259. uni.hideLoading()
  260. });
  261. },
  262. // 校验滞销天数数值范围
  263. checkValueRange () {
  264. const isONull = this.queryParam.unsalableDaysBegin === null || this.queryParam.unsalableDaysBegin === undefined
  265. const isOEmpty = this.queryParam.unsalableDaysBegin === ''
  266. const isOZero = this.queryParam.unsalableDaysBegin === 0
  267. const isTNull = this.queryParam.unsalableDaysEnd === null || this.queryParam.unsalableDaysEnd === undefined
  268. const isTEmpty = this.queryParam.unsalableDaysEnd === ''
  269. const isTZero = this.queryParam.unsalableDaysEnd === 0
  270. // 第一个为空(可为null可为空字符)第二个不为空
  271. // 第一个不为空第二个为空(可为null可为空字符)
  272. // 第一个大于第二个
  273. if ((isONull || isOEmpty) && (this.queryParam.unsalableDaysEnd || isTZero)) {
  274. uni.showToast({
  275. title:'请输入正确的滞销天数查询范围!',
  276. icon:'none'
  277. })
  278. return false
  279. }
  280. if ((this.queryParam.unsalableDaysBegin || isOZero) && (isTNull || isTEmpty)) {
  281. uni.showToast({
  282. title:'请输入正确的滞销天数查询范围!',
  283. icon:'none'
  284. })
  285. return false
  286. }
  287. if (this.queryParam.unsalableDaysBegin*1 > this.queryParam.unsalableDaysEnd *1) {
  288. uni.showToast({
  289. title:'请输入正确的滞销天数查询范围!',
  290. icon:'none'
  291. })
  292. return false
  293. }
  294. this.queryParam.unsalableDaysBegin = this.queryParam.unsalableDaysBegin > 999999999 ? 999999999 : this.queryParam.unsalableDaysBegin
  295. this.queryParam.unsalableDaysEnd = this.queryParam.unsalableDaysEnd > 999999999 ? 999999999 : this.queryParam.unsalableDaysEnd
  296. return true
  297. }
  298. }
  299. };
  300. </script>
  301. <style lang="less" scoped>
  302. .content {
  303. background: #ffffff;
  304. width: 100%;
  305. height: 100vh;
  306. .headerName {
  307. padding:20rpx 20rpx 16rpx;
  308. color: #222;
  309. font-size: 30rpx;
  310. .barBox {
  311. display: block;
  312. height: 30rpx;
  313. width: 6rpx;
  314. background: #0485f6;
  315. margin-right: 10rpx;
  316. border-radius: 10rpx;
  317. }
  318. .shelfName {
  319. font-weight: bold;
  320. width: calc(100% - 16rpx);
  321. }
  322. .screeningBox {
  323. font-size: 26rpx;
  324. width: 150rpx;
  325. text-align: right;
  326. text {
  327. vertical-align: top;
  328. }
  329. }
  330. }
  331. .backOrderCon {
  332. width: 100%;
  333. flex-grow:1;
  334. overflow: auto;
  335. .partList-list-box {
  336. width: 100%;
  337. padding: 10px 20rpx;
  338. box-sizing: border-box;
  339. border-bottom: 2rpx solid #f5f5f5;
  340. &:last-child {
  341. border: 0;
  342. }
  343. .product {
  344. flex-grow: 1;
  345. .checkbox {
  346. width: 60rpx;
  347. }
  348. .pinfo {
  349. flex-grow: 1;
  350. padding-left: 20rpx;
  351. .pname {
  352. font-size: 26rpx;
  353. color:#222;
  354. text {
  355. font-weight: normal;
  356. margin-right: 10rpx;
  357. padding: 0 10rpx;
  358. background: rgba(3, 54, 146, 0.15);
  359. border-radius: 30rpx;
  360. color: #033692;
  361. font-size: 24rpx;
  362. }
  363. }
  364. .productName{
  365. width: 100%;
  366. font-size: 26rpx;
  367. margin:6rpx 0;
  368. }
  369. .pno {
  370. background-color: rgba(3, 54, 146, 0.15);
  371. border-radius: 50rpx;
  372. padding: 0 20rpx;
  373. color: #033692;
  374. font-size: 24rpx;
  375. margin-right: 10rpx;
  376. }
  377. .ptxt {
  378. font-size: 24rpx;
  379. color: #999;
  380. .pnums {
  381. color: #222;
  382. padding: 0 4upx;
  383. }
  384. }
  385. }
  386. }
  387. .ptools {
  388. margin-top: 30rpx;
  389. margin-left: 60rpx;
  390. .ptools_l{
  391. font-size: 24rpx;
  392. color: #999;
  393. view{
  394. :nth-child(2)::before{
  395. content: '/';
  396. }
  397. }
  398. .pnums {
  399. color: #ff5500;
  400. padding: 0 4rpx;
  401. }
  402. }
  403. .pcurnums {
  404. > text {
  405. font-size: 24rpx;
  406. color: #999;
  407. margin-right: 20rpx;
  408. }
  409. }
  410. .u-ninput {
  411. border: 2rpx solid #eee;
  412. border-radius: 50rpx;
  413. padding: 0 6rpx;
  414. }
  415. ::v-deep .u-icon-disabled {
  416. background: #fff !important;
  417. }
  418. ::v-deep .u-number-input {
  419. margin: 0 0;
  420. border: 2rpx solid #eee;
  421. border-top: 0;
  422. border-bottom: 0;
  423. }
  424. ::v-deep .u-icon-plus,
  425. ::v-deep .u-icon-minus {
  426. border-radius: 50rpx;
  427. }
  428. }
  429. }
  430. .nodata{
  431. text-align: center;
  432. image{
  433. width: 180rpx;
  434. height: 180rpx;
  435. margin-top: 200rpx;
  436. }
  437. .nodataTip{
  438. text{
  439. color: #00aaff;
  440. margin-left: 10rpx;
  441. margin-top: 20rpx;
  442. }
  443. }
  444. }
  445. }
  446. .backOrderFooter {
  447. height: 98rpx;
  448. box-sizing: border-box;
  449. padding: 10rpx 20rpx;
  450. position: relative;
  451. background-color: #f8f8f8;
  452. .footerBox {
  453. width: 100%;
  454. .footerBox_m {
  455. .middle_l {
  456. text {
  457. color: red;
  458. margin: 0 6rpx;
  459. }
  460. }
  461. .middle_r {
  462. font-size: 24rpx;
  463. color: #999;
  464. margin-left: 10rpx;
  465. color: red;
  466. }
  467. }
  468. .footerBox_r {
  469. width: 200rpx;
  470. button {
  471. width: 100%;
  472. font-size: 26rpx;
  473. }
  474. }
  475. }
  476. }
  477. }
  478. </style>