order.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. <template>
  2. <view class="page-container">
  3. <view class="page-container">
  4. <!-- <tui-sel-cascade :lvlLeaf="2" title="选择仓位" dotColor="#26ae7e" :selLeaf="false" v-model="eareId" :postKey="[]"
  5. keyId="id" :rootData="repData" keyLabel="name" @change="getAreaPosition">
  6. <template slot-scope="{ selData }">
  7. <uni-list-item showArrow title="选择仓位" :note="selData.fulltext" borderRight="0rpx" rightText="选择仓位">
  8. </uni-list-item>
  9. </template>
  10. </tui-sel-cascade> -->
  11. <!-- <uni-forms labelWidth="100px">
  12. <uni-forms-item required name="hobby" label="请选择仓位">
  13. </uni-forms-item>
  14. </uni-forms> -->
  15. <tui-load-list ref="list" v-model="scaleList" apiUrl="/product/whse/list" :postData={type:orderType}
  16. :limit="100">
  17. <view v-for="(item,index) in scaleList " :key="index">
  18. <uni-list-item :showArrow="false">
  19. <!-- <template v-slot:header>
  20. <checkbox @tap="selchange(item)" style="margin-right: 10px;align-content: center;"
  21. value="item.id" :checked="item.ispick" />
  22. </template> -->
  23. <template v-slot:body>
  24. <div class="flex-1 flex">
  25. <div class="flex-1 ">
  26. <div class="font-24">PO号:<span class="font-28">{{item.poNum}}</span><uni-tag :circle="true" size="mini" :text="item.status==0?'草稿':'确认'" type="warning" /></div>
  27. <div class="font-24">{{'指令号:'+item.manuNum}}</div>
  28. <div class="font-24">{{'双数:'+item.entQty}} &nbsp;&nbsp;&nbsp;&nbsp;
  29. {{'件数:'+item.entPcsQty}}
  30. </div>
  31. <div class="font-24"></div>
  32. </div>
  33. </div>
  34. </template>
  35. <template v-slot:footer>
  36. <div></div>
  37. <div @click="popupShow(item)" v-if="item.posName" class="font-32"
  38. style="align-content: center;text-align: right;color:blue;">
  39. {{item.posName}} >
  40. <!-- <uni-data-picker ref="picker" v-model="item.repid" :localdata="repData" popup-title="仓位"
  41. @change="onchange($event,item)"></uni-data-picker> -->
  42. </div>
  43. <div v-else style="align-content: center;text-align: right;color:blue;">
  44. <!-- <uni-data-picker ref="picker" v-model="item.repid" :localdata="repData" popup-title="仓位"
  45. @change="onchange($event,item)"></uni-data-picker> --><tui-button :size="22" @click="popupShow(item)"
  46. width="70px" height="28px">选择仓位</tui-button>
  47. </div>
  48. </template>
  49. <template></template>
  50. </uni-list-item>
  51. </view>
  52. </tui-load-list>
  53. <view style="height:100px"></view>
  54. <view class="fixedbombtn flex">
  55. <!-- <tui-button style="margin-right: 10rpx;" type="danger" class=" flex-1 margin-right-sm "
  56. @click="deleteBtn">清空</tui-button> -->
  57. <!-- <tui-button class=" flex-2 " @click="entry">{{butText}}</tui-button> -->
  58. </view>
  59. </view>
  60. <!-- <uni-fab ref="fab" :pattern="pattern" :horizontal="horizontal" :vertical="vertical" @fabClick="scan" /> -->
  61. <!-- <tui-tabbar :tabBar="tabBar" :current="current" v-if="current>=0"></tui-tabbar> -->
  62. <!-- <uni-popup ref="popup" type="center" :animation="false" style="width: 95%;">
  63. <view style="width: 380px;background-color: white;padding: 30rpx; font-size: 26rpx;">
  64. <uni-forms labelWidth="100px">
  65. <uni-forms-item required name="hobby" label="请选择仓位">
  66. <uni-data-picker ref="picker" v-model="repid" :localdata="repData" popup-title="仓位"
  67. @change="onchange($event)"></uni-data-picker>
  68. </uni-forms-item>
  69. </uni-forms>
  70. <tui-button height="46px" class=" flex-2 " @click="entry">确认</tui-button>
  71. </view>
  72. </uni-popup> -->
  73. <tui-bottom-popup :show="bottomPopup" :radius="false" @close="hideModal">
  74. <scroll-view class="tui-scroll-box" scroll-y scroll-with-animation :scroll-top="scrollTop">
  75. <view class="padding-30">
  76. <view class="font-bold font-30" style="color: #bb5159;">请选择仓位</view>
  77. <view class="back-f4 padding-30 mt-10" style="border-radius: 10rpx;">
  78. <view class="df jc-space-between mt-20 ">
  79. <view @click="setcutday(item,index)" :class="item.issel?'cur':''"
  80. v-for="(item,index) in repData" :key="index" class="font-30 seldata">
  81. {{item.parent.name}}
  82. </view>
  83. </view>
  84. </view>
  85. <view>
  86. <view style="margin-left: -20rpx;flex-wrap: wrap;" class=" flex ">
  87. <view @click="selRep(item) " v-for="(item,index) in curRep.children" :key="index"
  88. :class="item.issel?'cur':''" class="seltime font-28 ml-20 mt-20" style="">
  89. {{item.name}}
  90. <!-- <view class="font-18">{{obj.data}}</view> -->
  91. </view>
  92. </view>
  93. </view>
  94. <!-- <view v-if="first&&last" class="pt-10 pb-10 seltiembox">
  95. 已选择时段:{{first.data|setJtime}} {{first.time_name}}至{{last.data|setJtime}}
  96. {{last.time_name}},共{{(seldata.length-1)/2}}小时
  97. </view>
  98. <view v-if="packageList.length>0" class="mt-20">
  99. <view class="font-30 color-333">套餐选择</view>
  100. </view> -->
  101. </view>
  102. </scroll-view>
  103. <view style="height: 140rpx;"></view>
  104. <view class="bombox df sure">
  105. <tui-button @click="cancelAll()" type="green" style="flex: 1;" :plain="true">取消</tui-button>
  106. <tui-button @click="entry" class="ml-20" style="flex: 2;" backColor="#3f9f81">确定<text
  107. class="font-24"></text>
  108. </tui-button>
  109. </view>
  110. </tui-bottom-popup>
  111. </view>
  112. </template>
  113. <script>
  114. import scaleListCom from '../scaleListCom.vue';
  115. import {
  116. parseAdd,
  117. whseAdd,
  118. whseTeam,
  119. whseRemove,
  120. whseRetAdd,
  121. whseInfolist,
  122. setRepId
  123. } from '@/api/whse.js'
  124. export default {
  125. components: {
  126. scaleListCom
  127. },
  128. data() {
  129. return {
  130. repData: [],
  131. setItemData: null,
  132. selRepData: null,
  133. scrollTop: 0,
  134. curRep: 0,
  135. bottomPopup: false,
  136. orderType: null,
  137. gcCode: '',
  138. gcName: '',
  139. is_color_type: false,
  140. scaleList: [],
  141. current: 1,
  142. proTeamid: [],
  143. butText: '设置仓位',
  144. repid: '',
  145. selReplist: []
  146. }
  147. },
  148. created() {
  149. this.getRepData()
  150. },
  151. onLoad(option) {
  152. // console.log(option, 'option')
  153. this.orderType = option.type
  154. var pageTitle = ''
  155. if (this.orderType == 'PRO') {
  156. pageTitle = '生产入库'
  157. this.butText = '入库'
  158. } else if (this.orderType == 'OQC') {
  159. pageTitle = '品检入库'
  160. this.butText = '入库'
  161. } else if (this.orderType == 'FTB') {
  162. pageTitle = '翻箱入库'
  163. this.butText = '入库'
  164. } else if (this.orderType == 'OQCRET') {
  165. pageTitle = '品检退库'
  166. this.butText = '退库'
  167. } else if (this.orderType == 'FTBRET') {
  168. pageTitle = '翻箱退库'
  169. this.butText = '退库'
  170. } else {
  171. this.butText = '设置仓位'
  172. pageTitle = '生产入库'
  173. }
  174. uni.setNavigationBarTitle({
  175. title: pageTitle
  176. })
  177. },
  178. onPullDownRefresh() {
  179. uni.stopPullDownRefresh();
  180. this.$refs.list.loadData("rush")
  181. },
  182. onReachBottom() {
  183. this.$refs.list.loadData()
  184. },
  185. onPageScroll(e) {
  186. this.scrollTop = e.scrollTop;
  187. },
  188. methods: {
  189. popupShow(item) {
  190. if(item.status==0){
  191. this.bottomPopup=true
  192. this.setItemData = item
  193. }
  194. },
  195. setcutday(item, index) {
  196. this.repData.forEach(v => {
  197. v.issel = 0
  198. })
  199. item.issel = 1
  200. this.curRep = item
  201. this.dayindex = index
  202. },
  203. selRep(item) {
  204. this.$set(item, 'issel', !item.issel)
  205. this.$nextTick(()=>{
  206. if (item.issel === true) {
  207. this.selReplist.push(item)
  208. } else {
  209. const index = this.selReplist.indexOf(item)
  210. if (index > -1) {
  211. this.selReplist.splice(index, 1)
  212. }
  213. }
  214. })
  215. },
  216. cancelAll() {
  217. this.bottomPopup = false
  218. this.curday = 0
  219. this.dayindex = 0
  220. this.selReplist = []
  221. this.repData.forEach(v=>{
  222. v.children.map(v=>{
  223. this.$set(v, 'issel', false)
  224. })
  225. })
  226. },
  227. whseSucss() {
  228. this.$refs.list.loadData("rush")
  229. uni.hideLoading()
  230. this.$qsk.modal({
  231. title: this.butText + "成功",
  232. content: '',
  233. showCancel: false,
  234. confirmText: '确定'
  235. })
  236. },
  237. entry(rep, item) {
  238. // console.log(this.selReplist, len, this.setItemData, 'text')
  239. if(this.selReplist.length<1){
  240. this.$qsk.toast('请选择仓位')
  241. return false
  242. }
  243. const selId=[]
  244. var selName=''
  245. this.selReplist.forEach((v,index)=>{
  246. selId.push(v.id)
  247. selName+=v.name+'、'
  248. })
  249. // console.log(selId,selName,this.setItemData,'selName')
  250. this.$qsk.modal({
  251. title: "确认入库到" +selName + "?",
  252. content: '',
  253. showCancel: true,
  254. confirmText: '确定'
  255. }).then(res2 => {
  256. setRepId({
  257. id: this.setItemData.id,
  258. posIds: selId
  259. }).then(res => {
  260. this.cancelAll()
  261. this.$refs.list.loadData("rush")
  262. }).catch(error => {
  263. uni.hideLoading()
  264. })
  265. }).catch(() => {})
  266. },
  267. onchange(e, item) {
  268. console.log('onchange:', e);
  269. this.selRepData = e.detail
  270. // this.entry(e, item)
  271. },
  272. getRepData() {
  273. whseInfolist().then(res => {
  274. this.repData = res.data
  275. if (this.repData && this.repData.length > 0) {
  276. this.curRep = this.repData[0]
  277. this.$set(this.curRep,'issel','true')
  278. }
  279. }).catch(err => {
  280. })
  281. },
  282. deleteBtn(item) {
  283. let ids = []
  284. let text = '清空'
  285. if (item) {
  286. ids.push(item.id)
  287. text = "删除"
  288. }
  289. this.$qsk.modal({
  290. title: "您是否确认" + text + "数据?",
  291. content: '',
  292. showCancel: false,
  293. confirmText: '确定'
  294. }).then(res2 => {
  295. whseRemove({
  296. ids: ids,
  297. type: this.orderType
  298. }).then(res => {
  299. this.$refs.list.loadData("rush")
  300. })
  301. })
  302. },
  303. onnodeclick(node) {},
  304. changeValue() {},
  305. dialogOpend() {
  306. this.$refs.alertDialog.open()
  307. },
  308. dialogClosed() {
  309. this.$refs.alertDialog.close()
  310. },
  311. getUpQMImg(val) {
  312. this.picList.forEach((v, index) => {
  313. if (v.categ == val.categ) {
  314. this.picList.splice(index, 1)
  315. return
  316. }
  317. })
  318. this.picList.push(val)
  319. },
  320. clecKListkHasItem(list, objName) {
  321. return list.some(item => item.categ == objName)
  322. },
  323. addAssetsBtn() {
  324. this.$tab.navigateTo('/pages/takestock/addAssets/index')
  325. },
  326. selectAssetsBtn() {
  327. this.$tab.navigateTo('/pages/takestock/assetsList/index')
  328. },
  329. }
  330. }
  331. </script>
  332. <style lang="scss" scoped>
  333. .page-container {
  334. width: 100%;
  335. min-height: 100%;
  336. background-color: $uni-bg-color;
  337. overflow: hidden;
  338. .bombox {
  339. height: 108rpx;
  340. padding: 18rpx 30rpx;
  341. background-color: #fff;
  342. position: fixed;
  343. bottom: constant(safe-area-inset-bottom);
  344. bottom: env(safe-area-inset-bottom);
  345. left: 0;
  346. right: 0;
  347. z-index: 22;
  348. &.sure {
  349. z-index: 9999;
  350. }
  351. }
  352. .tui-scroll-box {
  353. width: 100%;
  354. height: 80vh;
  355. box-sizing: border-box;
  356. position: relative;
  357. z-index: 99;
  358. color: #fff;
  359. font-size: 30rpx;
  360. word-break: break-all;
  361. }
  362. .seldata {
  363. background: #f4f4f4;
  364. color: #999;
  365. border-radius: 10rpx;
  366. padding: 14rpx 60rpx;
  367. text-align: center;
  368. &.cur {
  369. background: #3f9f81;
  370. color: #fff
  371. }
  372. }
  373. .seltime {
  374. background: #f4f4f4;
  375. color: #999;
  376. border-radius: 6rpx;
  377. width: 120rpx;
  378. text-align: center;
  379. padding: 14rpx 0;
  380. &.cur {
  381. background: #3f9f81;
  382. color: #fff
  383. }
  384. &.used {
  385. background: #ee7875;
  386. color: #fff
  387. }
  388. }
  389. .tc {
  390. background: #f4f4f4;
  391. border: #f4f4f4 2rpx solid;
  392. border-radius: 10rpx;
  393. line-height: 1.5;
  394. margin-top: 16rpx;
  395. &.selecd {
  396. background: #b6dacf;
  397. border: #3f9f81 2rpx solid;
  398. }
  399. }
  400. .seltiembox {
  401. border-bottom: 0.5px solid #d5d5d5;
  402. margin-top: 10px;
  403. background: #fdeded;
  404. font-size: 28rpx;
  405. color: #ee7875;
  406. border-radius: 6rpx;
  407. }
  408. }
  409. </style>