addBackOrder.vue 12 KB

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