detailsType.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. title="选择类别(入库)"
  8. @clickLeft="backAdd"
  9. >
  10. <!--右菜单-->
  11. <template slot="float">
  12. <!-- <view class="nav-icon-caozuo rightNav" @click="getsure">
  13. <u-button type="success" size="small" class="u-reset-button" text="选择"></u-button>
  14. </view> -->
  15. </template>
  16. </uni-nav-bar>
  17. <view class="searchBox">
  18. <input
  19. v-model="searchForm.code"
  20. placeholder="请输入关键字搜索"
  21. class="searchInput"
  22. />
  23. <u-button
  24. type="icon-shixiangxinzeng"
  25. size="30"
  26. data-icon="Search"
  27. class="searchBtn"
  28. >
  29. <view class="iconfont icon-sousuo"> </view>
  30. <view class="text"> 搜索 </view>
  31. </u-button>
  32. </view>
  33. <view class="tab-title">
  34. <view
  35. v-for="(item, index) in tabList"
  36. :key="index"
  37. class="tab-item"
  38. v-text="item.label"
  39. :class="index === pickTabIndex ? 'active' : ''"
  40. @click="changeChartsTab(index)"
  41. >
  42. </view>
  43. <view class="screenIcon" @click="openPopup" style="padding: 0 5rpx">
  44. <span class="screenText"> 筛选 </span>
  45. <uni-icons
  46. custom-prefix="iconfont"
  47. type="icon-shaixuan"
  48. size="18"
  49. color="#ccc"
  50. ></uni-icons>
  51. </view>
  52. </view>
  53. <view class="listContent">
  54. <view class="listBox" v-for="(item, index) in listData" :key="index">
  55. <view class="listBox-sel">
  56. <checkbox
  57. :value="item.code"
  58. color="#fff"
  59. :disabled="item.disabled"
  60. :checked="item.checked"
  61. @click="selectVal(item, index)"
  62. />
  63. </view>
  64. <view class="listBox-con">
  65. <view class="listBox-top">
  66. <view class="listBox-name">
  67. {{ item.name }}
  68. </view>
  69. <view class="listBox-code">
  70. {{ item.code }}
  71. </view>
  72. </view>
  73. <view class="listBox-bottom">
  74. <view class="bot-left"> 牌号:{{ item.mark }} </view>
  75. <view class="bot-right"> 时间:{{ item.creatTime }} </view>
  76. </view>
  77. <view class="listBox-bottom">
  78. <view class="bot-left"> 批次号:{{ item.batchNumber }} </view>
  79. <view class="bot-right"> 包装单位:{{ item.packingUnit }} </view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. <view class="footer">
  85. <view class="bottom">
  86. <checkbox
  87. v-if="!seletedAll"
  88. color="#fff"
  89. :checked="seletedAll"
  90. @tap="_seletedAll"
  91. >全选</checkbox
  92. >
  93. <checkbox
  94. class="select-all"
  95. color="#fff"
  96. v-else
  97. :checked="seletedAll"
  98. @tap="_seletedAll"
  99. >取消全选
  100. </checkbox>
  101. </view>
  102. <u-button
  103. type="success"
  104. size="small"
  105. class="u-reset-button"
  106. @click="jumpAdd"
  107. >
  108. <view class="selBtn"> 选择( {{ checkListLen }} ) </view>
  109. </u-button>
  110. </view>
  111. <!-- 搜索组件 -->
  112. <get-Search
  113. :show="popupShow"
  114. :typeIndex="typeIndex"
  115. @openPopup="openPopup"
  116. @getPopupInfo="getPopupInfo"
  117. >
  118. </get-Search>
  119. </view>
  120. </template>
  121. <script>
  122. import getSearch from './components/search'
  123. import { post, postJ, get } from '@/utils/api.js'
  124. let [page, size, isEnd] = [1, 20, true]
  125. export default {
  126. components: {
  127. getSearch
  128. },
  129. data () {
  130. return {
  131. searchForm: {},
  132. tabList: [
  133. {
  134. value: '',
  135. label: '全部',
  136. list: []
  137. },
  138. {
  139. value: '1',
  140. label: '物料',
  141. list: []
  142. },
  143. {
  144. value: '2',
  145. label: '产品',
  146. list: []
  147. },
  148. {
  149. value: '3',
  150. label: '设备',
  151. list: []
  152. }
  153. ],
  154. pickTabIndex: 1,
  155. popupShow: false, //右侧搜索窗
  156. typeIndex: 1,
  157. listData: [], //列表数据
  158. seletedAll: false, //全选状态
  159. id: '',
  160. code: '',
  161. datas: ''
  162. }
  163. },
  164. //选择的列表长度
  165. computed: {
  166. checkListLen () {
  167. const list = this.listData.filter(el => {
  168. if (el.checked) {
  169. return el
  170. }
  171. })
  172. return list.length
  173. }
  174. },
  175. //触底刷新
  176. onReachBottom: function () {
  177. if (isEnd) {
  178. return
  179. }
  180. // 显示加载图标
  181. uni.showLoading({
  182. title: '数据加载中'
  183. })
  184. this.getMoreList()
  185. },
  186. onLoad (params) {
  187. this.datas = JSON.parse(params.data)
  188. console.log(data, typeof data, 'debugger')
  189. },
  190. mounted () {
  191. this.getInitList()
  192. },
  193. methods: {
  194. //列表数据
  195. async getInitList (...arg) {
  196. // uni.showLoading({
  197. // title: '加载中'
  198. // })
  199. let data = {
  200. page,
  201. size
  202. }
  203. //判断arg值
  204. if (arg.length > 0) {
  205. data = Object.assign(data, arg[0])
  206. }
  207. let info
  208. switch (this.pickTabIndex) {
  209. case 1:
  210. //物料
  211. // let materialsInfo = await get(this.apiWebUrl + "/main/material/type/tree", { model: 1 });
  212. // info = materialsInfo.data[0].code;
  213. // console.log(materialsInfo);
  214. let listArr = await post(
  215. this.apiUrl + '/wms/enter/material/V1/detaiList',
  216. {}
  217. )
  218. let arr = listArr.data.items
  219. arr.forEach(item => {
  220. item.checked = false
  221. })
  222. console.log(arr)
  223. this.listData = arr
  224. break
  225. case 2:
  226. //产品
  227. let productInfo = await get(this.apiUrl + '/main/product/type/tree', {
  228. model: 1
  229. })
  230. info = productInfo.data[0].code
  231. break
  232. case 3:
  233. let featureInfo = await get(this.apiUrl + '/feature/type/tree', {
  234. model: 1
  235. })
  236. console.log(featureInfo)
  237. info = featureInfo.data[0].code
  238. break
  239. }
  240. // this.listData.forEach((el) => {
  241. // this.$set(el, 'checked', true);
  242. // });
  243. },
  244. //切换tab
  245. changeChartsTab (index) {
  246. this.pickTabIndex = index
  247. this.getInitList()
  248. },
  249. //打开右侧搜索窗
  250. openPopup () {
  251. this.popupShow = !this.popupShow
  252. },
  253. //搜索传值
  254. getPopupInfo (val) {
  255. console.log(val)
  256. },
  257. //勾选
  258. selectVal (val, index) {
  259. // console.log(this.listData);
  260. this.listData[index].checked = !this.listData[index].checked
  261. let flag = false
  262. //取消全选
  263. this.listData.forEach(item => {
  264. if (item.checked == false) {
  265. flag = true
  266. }
  267. })
  268. if (flag) {
  269. this.seletedAll = false
  270. } else {
  271. this.seletedAll = true
  272. }
  273. },
  274. //全选按钮
  275. _seletedAll () {
  276. if (!this.seletedAll) {
  277. this.seletedAll = true
  278. this.listData.map(item => {
  279. this.$set(item, 'checked', true)
  280. })
  281. } else {
  282. this.seletedAll = false
  283. //this.checkListLen = 0;
  284. this.listData.map(item => {
  285. this.$set(item, 'checked', false)
  286. })
  287. }
  288. },
  289. //获取更多数据
  290. getMoreList () {
  291. //获取更多数据
  292. page++
  293. this.getList()
  294. },
  295. //跳转回添加页面
  296. jumpAdd () {
  297. console.log(this.listData)
  298. let arr = this.listData.filter(item => {
  299. return item.checked == true
  300. })
  301. console.log(arr)
  302. let items = encodeURIComponent(JSON.stringify(arr))
  303. uni.getStorage({
  304. key: 'id_code',
  305. success: function (res) {
  306. this.id = res.data.id
  307. this.code = res.data.code
  308. }
  309. })
  310. uni.redirectTo({
  311. url:
  312. '/pages/warehouse/enterHouse/details?selectList=' +
  313. items +
  314. '&id=' +
  315. this.id +
  316. '&code=' +
  317. this.code
  318. })
  319. },
  320. //返回添加页
  321. backAdd () {
  322. uni.redirectTo({
  323. url: '/pages/warehouse/enterHouse/addStock'
  324. })
  325. }
  326. }
  327. }
  328. </script>
  329. <style lang="scss" scoped>
  330. .mainBox {
  331. .searchBox {
  332. position: fixed;
  333. top: 90rpx;
  334. z-index: 99;
  335. background-color: #dedede;
  336. height: 50px;
  337. width: 100%;
  338. line-height: 50px;
  339. display: flex;
  340. justify-content: space-around;
  341. align-items: center;
  342. input {
  343. height: 40px;
  344. width: 65%;
  345. background: #f9f9f9 !important;
  346. margin-left: 20rpx;
  347. padding-left: 10rpx;
  348. border-radius: 5rpx;
  349. }
  350. .searchBtn {
  351. height: 40px;
  352. background: #f9f9f9 !important;
  353. color: #676767;
  354. font-size: 28rpx;
  355. padding: 0 42rpx;
  356. outline: none;
  357. border: none;
  358. .icon-sousuo {
  359. font-size: 22px;
  360. }
  361. .text {
  362. font-size: 16px;
  363. margin-left: 10px;
  364. }
  365. }
  366. }
  367. .tab-title {
  368. position: fixed;
  369. top: 190rpx;
  370. z-index: 99;
  371. width: 100%;
  372. display: flex;
  373. justify-content: space-between;
  374. align-items: center;
  375. height: $tab-height;
  376. line-height: $tab-height;
  377. background-color: #ffffff;
  378. border-bottom: 2rpx solid #f2f2f2;
  379. box-sizing: border-box;
  380. .tab-item {
  381. width: 25%;
  382. text-align: center;
  383. font-size: 32rpx;
  384. color: $uni-text-color-grey;
  385. }
  386. .tab-item.active {
  387. color: $j-primary-border-green;
  388. border-bottom: 1px solid $j-primary-border-green;
  389. font-weight: bold;
  390. }
  391. .tab-item.filter {
  392. flex: 1;
  393. padding: 0px 30rpx;
  394. .uni-icons {
  395. display: flex;
  396. padding-top: 5px;
  397. }
  398. }
  399. .screenIcon {
  400. display: flex;
  401. width: 80px;
  402. justify-content: center;
  403. .screenText {
  404. font-size: 32rpx;
  405. color: $uni-text-color-grey;
  406. }
  407. }
  408. }
  409. .listContent {
  410. margin-top: 200rpx;
  411. margin-bottom: 100rpx;
  412. .listBox {
  413. display: flex;
  414. height: 180rpx;
  415. border-bottom: 2rpx solid #e5e5e5;
  416. .listBox-sel {
  417. height: 180rpx;
  418. width: 80rpx;
  419. line-height: 180rpx;
  420. text-align: center;
  421. checkbox {
  422. transform: scale(1.2);
  423. }
  424. }
  425. .listBox-con {
  426. width: 100%;
  427. display: flex;
  428. flex-wrap: wrap;
  429. justify-content: space-between;
  430. align-items: center;
  431. .listBox-top {
  432. width: 100%;
  433. display: flex;
  434. justify-content: space-between;
  435. .listBox-name,
  436. .listBox-code {
  437. display: inline-block;
  438. width: 50%;
  439. font-size: 35rpx;
  440. }
  441. .listBox-code {
  442. width: 60%;
  443. }
  444. }
  445. .listBox-bottom {
  446. width: 100%;
  447. display: flex;
  448. justify-content: space-between;
  449. .bot-left,
  450. .bot-right {
  451. display: inline-block;
  452. width: 50%;
  453. color: $uni-text-color-grey;
  454. }
  455. .bot-right {
  456. width: 60%;
  457. }
  458. }
  459. }
  460. }
  461. }
  462. //底部按钮
  463. .footer {
  464. position: fixed;
  465. display: flex;
  466. justify-content: space-between;
  467. align-items: center;
  468. bottom: 0;
  469. width: 100%;
  470. height: 100rpx;
  471. border-top: 1rpx solid #eeecec;
  472. background-color: #ffffff;
  473. z-index: 999;
  474. .bottom {
  475. margin-left: 10rpx;
  476. }
  477. .u-reset-button {
  478. position: absolute;
  479. right: 10rpx;
  480. top: 20rpx;
  481. }
  482. }
  483. }
  484. </style>