index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. title="物料入库单"
  8. @clickLeft="back"
  9. >
  10. <!--右菜单-->
  11. <template slot="float">
  12. <view class="nav-icon-caozuo rightNav" @click="openPopup">
  13. <uni-icons
  14. custom-prefix="iconfont"
  15. type="icon-shaixuan"
  16. size="18"
  17. color="#ccc"
  18. ></uni-icons>
  19. </view>
  20. </template>
  21. </uni-nav-bar>
  22. <view class="tab-title">
  23. <view
  24. v-for="(item, index) in tabList"
  25. :key="index"
  26. class="tab-item"
  27. v-text="item.label"
  28. :class="index === pickTabIndex ? 'active' : ''"
  29. @click="changeChartsTab(index)"
  30. ></view>
  31. </view>
  32. <view class="tab-title__placeholder"></view>
  33. <view
  34. class="listBox"
  35. v-for="(item, index) in tabList[pickTabIndex].list"
  36. :key="index"
  37. @click="viewDetails(item.id, item.code)"
  38. >
  39. <view class="listTit">
  40. <view style="display: inline-block">
  41. <u-tag
  42. :text="item.status.name"
  43. size="mini"
  44. shape="circle"
  45. type="success"
  46. v-if="item.status.id === 99"
  47. ></u-tag>
  48. <u-tag
  49. :text="item.status.name"
  50. size="mini"
  51. shape="circle"
  52. type="warning"
  53. v-if="item.status.id === 2"
  54. ></u-tag>
  55. <u-tag
  56. :text="item.status.name"
  57. size="mini"
  58. shape="circle"
  59. type="primary"
  60. v-if="item.status.id === 11"
  61. ></u-tag>
  62. <u-tag
  63. :text="item.status.name"
  64. size="mini"
  65. shape="circle"
  66. bgColor="#999"
  67. borderColor="#999"
  68. v-if="item.status.id === 91"
  69. ></u-tag>
  70. </view>
  71. <view class="name">{{ item.code }}</view>
  72. <view class="date">{{ item.appointTime }}</view>
  73. </view>
  74. <view class="listCont">
  75. <view class="item"><text>仓库:</text>{{ item.warehouse.name }}</view>
  76. <view class="item"
  77. ><text>入库登记人:</text>{{ item.executor.name }}</view
  78. >
  79. <view class="item"><text>负责人:</text>{{ item.creator.name }}</view>
  80. <view class="item"><text>送货人:</text>{{ item.sendName }}</view>
  81. </view>
  82. <view class="listbtn">
  83. <view class="operBox">
  84. <view v-if="item.status.id == 2">
  85. <u-button
  86. type="success"
  87. size="small"
  88. text="受理"
  89. @click="getAccept(item.id)"
  90. ></u-button>
  91. </view>
  92. <view v-if="item.status.id == 2">
  93. <u-button
  94. type="primary"
  95. size="small"
  96. text="作废"
  97. @click="getInvalid(item.id)"
  98. ></u-button>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. <view class="footBox">
  104. <view class="add" @click="addStock">
  105. <uni-icons
  106. custom-prefix="iconfont"
  107. type="icon-shixiangxinzeng"
  108. size="20"
  109. color="#fff"
  110. ></uni-icons>
  111. 新增入库单
  112. </view>
  113. <view class="reg" @click="regStock">
  114. <uni-icons
  115. custom-prefix="iconfont"
  116. type="icon-shixiangxinzeng"
  117. size="20"
  118. color="#fff"
  119. ></uni-icons>
  120. 直接登记
  121. </view>
  122. </view>
  123. <get-Search
  124. :show="popupShow"
  125. @openPopup="openPopup"
  126. @getPopupInfo="getPopupInfo"
  127. ></get-Search>
  128. </view>
  129. </template>
  130. <script>
  131. import { post, postJ } from '@/utils/api.js'
  132. import getSearch from './components/search'
  133. let [page, size, isEnd] = [1, 10, true]
  134. export default {
  135. components: {
  136. getSearch
  137. },
  138. data () {
  139. return {
  140. tabList: [
  141. {
  142. value: '',
  143. label: '全部',
  144. list: []
  145. },
  146. {
  147. value: '2',
  148. label: '已指派',
  149. list: []
  150. },
  151. {
  152. value: '11',
  153. label: '已受理',
  154. list: []
  155. },
  156. {
  157. value: '99',
  158. label: '已完成',
  159. list: []
  160. }
  161. ],
  162. pickTabIndex: 0,
  163. popupShow: false, //右侧筛选
  164. popupInfo: {} //筛选数据
  165. }
  166. },
  167. onLoad () {
  168. this.getFirstList()
  169. },
  170. //触底加载
  171. onReachBottom: function () {
  172. if (isEnd) {
  173. return
  174. }
  175. // 显示加载图标
  176. uni.showLoading({
  177. title: '数据加载中'
  178. })
  179. this.getMoreLists()
  180. },
  181. methods: {
  182. getFirstList () {
  183. page = 1
  184. isEnd = true
  185. uni.showLoading({
  186. title: '数据加载中'
  187. })
  188. this.getList(this.popupInfo)
  189. },
  190. getMoreLists () {
  191. //获取更多数据
  192. page++
  193. this.getList(this.popupInfo)
  194. },
  195. //获取列表信息
  196. getList (...arg) {
  197. uni.showLoading({
  198. title: '加载中'
  199. })
  200. let data = {
  201. page,
  202. size
  203. }
  204. //判断arg值
  205. if (arg.length > 0) {
  206. data = Object.assign(data, arg[0])
  207. }
  208. let status = this.tabList[this.pickTabIndex].value
  209. post(this.apiWebUrl + '/wms/enter/material/list?status=' + status, data)
  210. .then(res => {
  211. if (res.success == true) {
  212. let data = res.data.items
  213. let pageTotal = res.data.pageTotal
  214. if (page === 1) {
  215. this.tabList[this.pickTabIndex].list = res.data.items
  216. } else {
  217. data.forEach(element => {
  218. this.tabList[this.pickTabIndex].list.push(element)
  219. })
  220. }
  221. page < pageTotal ? (isEnd = false) : (isEnd = true)
  222. }
  223. })
  224. .then(() => {
  225. uni.hideLoading()
  226. })
  227. },
  228. //切换tab
  229. changeChartsTab (index) {
  230. this.pickTabIndex = index
  231. this.getFirstList()
  232. },
  233. //打开右侧窗
  234. openPopup () {
  235. this.popupShow = !this.popupShow
  236. },
  237. //获取搜索信息
  238. getPopupInfo (res) {
  239. if (res.code) {
  240. this.popupInfo.code = res.code
  241. }
  242. if (res.range) {
  243. this.popupInfo.beginTime = res.range[0]
  244. this.popupInfo.endTime = res.range[1]
  245. }
  246. //重置数据
  247. this.pickTabIndex = 0
  248. page = 1
  249. //console.log(this.popupInfo);
  250. this.getList(this.popupInfo)
  251. },
  252. //受理
  253. getAccept (index) {
  254. let that = this
  255. uni.showModal({
  256. title: '温馨提示',
  257. content: '是否确定受理?',
  258. success: function (res) {
  259. if (res.confirm) {
  260. let data = {
  261. id: index
  262. }
  263. post(that.apiWebUrl + '/wms/enter/material/accept', data)
  264. .then(res => {
  265. //等待后端修改逻辑
  266. })
  267. .catch(res => {})
  268. } else if (res.cancel) {
  269. console.log('用户点击取消')
  270. }
  271. }
  272. })
  273. },
  274. //作废
  275. getInvalid (index) {
  276. let that = this
  277. uni.showModal({
  278. title: '温馨提示',
  279. content: '是否确定作废?',
  280. success: function (res) {
  281. if (res.confirm) {
  282. let data = {
  283. id: index
  284. }
  285. post(that.apiWebUrl + '/wms/enter/material/disable', data)
  286. .then(res => {
  287. uni.showToast({
  288. icon: none,
  289. title: '作废成功'
  290. })
  291. })
  292. .catch(res => {})
  293. } else if (res.cancel) {
  294. console.log('用户点击取消')
  295. }
  296. }
  297. })
  298. },
  299. //登记
  300. getRegister (index) {
  301. console.log('登记', index)
  302. },
  303. //新增入库单
  304. addStock () {
  305. uni.navigateTo({
  306. url: '/pages/warehouse/material/addStock'
  307. })
  308. },
  309. //直接登记
  310. regStock () {
  311. uni.navigateTo({
  312. url: '/pages/warehouse/material/regStock'
  313. })
  314. },
  315. //查看详情
  316. viewDetails (id, code) {
  317. uni.navigateTo({
  318. url: '/pages/warehouse/material/details?id=' + id + '&code=' + code
  319. })
  320. }
  321. }
  322. }
  323. </script>
  324. <style lang="scss" scoped>
  325. .mainBox {
  326. padding-bottom: 120rpx;
  327. }
  328. .tab-title {
  329. position: fixed;
  330. z-index: 99;
  331. width: 100%;
  332. display: flex;
  333. justify-content: space-between;
  334. align-items: center;
  335. height: $tab-height;
  336. line-height: $tab-height;
  337. background-color: #ffffff;
  338. border-bottom: 1px solid #f2f2f2;
  339. box-sizing: border-box;
  340. .tab-item {
  341. width: 25%;
  342. text-align: center;
  343. font-size: 32rpx;
  344. color: $uni-text-color-grey;
  345. }
  346. .tab-item.active {
  347. color: $j-primary-border-green;
  348. border-bottom: 1px solid $j-primary-border-green;
  349. font-weight: bold;
  350. }
  351. .tab-item.filter {
  352. flex: 1;
  353. padding: 0px 30rpx;
  354. .uni-icons {
  355. display: flex;
  356. padding-top: 5px;
  357. }
  358. }
  359. }
  360. .listBox {
  361. padding: 20rpx 0;
  362. margin: 30rpx 20rpx;
  363. border-bottom: 1px #f2f2f2 solid;
  364. .listTit {
  365. display: flex;
  366. align-items: center;
  367. .name {
  368. font-size: $uni-font-size-base;
  369. margin-left: 10px;
  370. }
  371. .date {
  372. font-size: $uni-font-size-sm;
  373. margin-left: auto;
  374. color: #999;
  375. }
  376. }
  377. .listCont {
  378. display: flex;
  379. align-items: center;
  380. flex-wrap: wrap;
  381. margin-top: 15px;
  382. .item {
  383. width: 50%;
  384. font-size: $uni-font-size-sm;
  385. line-height: 48rpx;
  386. overflow: hidden;
  387. white-space: nowrap;
  388. text-overflow: ellipsis;
  389. -o-text-overflow: ellipsis;
  390. }
  391. .item text {
  392. color: #666;
  393. }
  394. }
  395. .listbtn {
  396. margin-top: 20rpx;
  397. display: flex;
  398. justify-content: flex-end;
  399. align-items: center;
  400. .operBox {
  401. display: flex;
  402. align-items: center;
  403. }
  404. }
  405. .listbtn button {
  406. margin-right: 20rpx;
  407. }
  408. }
  409. .footBox {
  410. position: fixed;
  411. left: 0px;
  412. bottom: 0px;
  413. height: 100rpx;
  414. width: 100%;
  415. display: flex;
  416. align-items: center;
  417. justify-content: space-between;
  418. view {
  419. width: 50%;
  420. height: 100%;
  421. text-align: center;
  422. color: #fff;
  423. display: flex;
  424. align-items: center;
  425. justify-content: center;
  426. }
  427. .add {
  428. background: $uni-color-primary;
  429. }
  430. .reg {
  431. background: $u-success-dark;
  432. }
  433. .uni-icons {
  434. margin-right: 8rpx !important;
  435. font-weight: bold;
  436. }
  437. }
  438. </style>