addBackOrder.vue 12 KB

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