index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <template>
  2. <view class="wrap">
  3. <view class='title'>仓库管理</view>
  4. <view class="dropdown">
  5. <view class="left" @click='show1=true'>
  6. <view>{{warehouseName}}</view>
  7. <u-icon name="arrow-right" color=""></u-icon>
  8. <u-picker @confirm="warehousechange" range-key='warehouseName' mode="selector" v-model="show1"
  9. :range="warehouseList"></u-picker>
  10. </view>
  11. <view class="right" @click='show2=true'>
  12. <view>{{positionName}}</view>
  13. <u-icon name="arrow-right" color=""></u-icon>
  14. <u-select v-model="show2" :default-value='[0]' :list="positionList" @confirm="confirmPositon">
  15. </u-select>
  16. </view>
  17. </view>
  18. <view class="cu-list grid" :class="['col-' + gridCol,gridBorder?'':'no-border']">
  19. <view class="cu-item" v-for="(item,index) in gridList" :key="index" @click="gridClick(item, index)"
  20. v-if="index<gridCol*2">
  21. <view :class="['cuIcon-' + item.cuIcon,'text-' + item.color]">
  22. <image :src="item.src" class="sign"></image>
  23. </view>
  24. <text>{{item.name}}</text>
  25. </view>
  26. </view>
  27. <u-modal v-model="isShowAlert" confirm-color='#22C572' confirm-text='立即开通' title='您尚未开通ERP业务'
  28. :content="content"></u-modal>
  29. </view>
  30. </template>
  31. <script>
  32. import {
  33. mapState
  34. } from 'vuex';
  35. export default {
  36. components: {
  37. },
  38. data() {
  39. return {
  40. show1: false,
  41. show2: false,
  42. isShowAlert: false,
  43. content: '易粮易运ERP系统包含合同管理、仓库管理、运输管理、结算管理等多个模块,可为粮企提供粮食贸易的全流程服务,平台诚邀您的加入。',
  44. warehouseName: '',
  45. positionName: '102仓位',
  46. warehouseList: [],
  47. positionList: [{
  48. "label": '102仓位',
  49. "value": '1'
  50. }],
  51. gridCol: 4,
  52. gridBorder: false,
  53. gridList: [{
  54. num: 0,
  55. name: '入库',
  56. // icon: 'cuIcon-apps',
  57. src: '../../static/img/erp/yaoqingyonghu@3x.png',
  58. tips: 0,
  59. url: '/pages/erp/warehousing/warehousing',
  60. show: true
  61. },
  62. {
  63. num: 1,
  64. name: '待完善入库',
  65. // icon: 'cuIcon-calendar',
  66. src: '../../static/img/erp/shougouzhijian@3x.png',
  67. tips: 0,
  68. url: '/pages/erp/improvedWrehousing/improvedWrehousing',
  69. show: true
  70. },
  71. {
  72. num: 2,
  73. name: '出库',
  74. // icon: 'cuIcon-copy',
  75. src: '../../static/img/erp/shougoujianjin@3x.png',
  76. tips: 0,
  77. url: '/pages/erp/exWarehousing/exWarehousing',
  78. show: true
  79. },
  80. {
  81. num: 3,
  82. name: '待完善出库',
  83. // icon: 'cuIcon-edit',
  84. src: '../../static/img/erp/shougouzhijian@3x.png',
  85. tips: 0,
  86. url: `/pages/erp/improvedExWaehousing/improvedExWaehousing`,
  87. show: true
  88. },
  89. {
  90. num: 4,
  91. name: '开通业务',
  92. // icon: 'cuIcon-edit',
  93. src: '../../static/img/erp/shougouzhijian@3x.png',
  94. tips: 0,
  95. url: `/pages/erp/improvedExWaehousing/improvedExWaehousing`,
  96. show: true
  97. },
  98. {
  99. num: 5,
  100. name: '联系客服',
  101. // icon: 'cuIcon-edit',
  102. src: '../../static/img/erp/shougouzhijian@3x.png',
  103. tips: 0,
  104. url: `/pages/erp/improvedExWaehousing/improvedExWaehousing`,
  105. show: true
  106. }
  107. ],
  108. }
  109. },
  110. onLoad() {
  111. this.init()
  112. },
  113. // #ifndef MP
  114. onNavigationBarButtonTap(e) {
  115. const index = e.index;
  116. if (index === 0) {
  117. this.navTo('/pages/set/set');
  118. } else if (index === 1) {
  119. // #ifdef APP-PLUS
  120. const pages = getCurrentPages();
  121. const page = pages[pages.length - 1];
  122. const currentWebview = page.$getAppWebview();
  123. currentWebview.hideTitleNViewButtonRedDot({
  124. index
  125. });
  126. // #endif
  127. uni.navigateTo({
  128. url: '/pages/notice/notice'
  129. })
  130. }
  131. },
  132. // #endif
  133. computed: {
  134. ...mapState(['hasLogin', 'userInfo']),
  135. },
  136. onShow() {
  137. this.$api.doRequest('get', '/commonUser/api/checkSession').then(res => {
  138. console.log("checkSession", res)
  139. if (res.data.data == "INVALID") {
  140. uni.showModal({
  141. title: '登录提示',
  142. content: 'Session过期需要重新登录,是否立即登录?',
  143. showCancel: true,
  144. confirmText: '登录',
  145. success: (e) => {
  146. if (e.confirm) {
  147. uni.navigateTo({
  148. url: '/pages/public/login'
  149. })
  150. }
  151. },
  152. fail: () => {},
  153. complete: () => {}
  154. })
  155. }
  156. })
  157. },
  158. methods: {
  159. /**
  160. * 统一跳转接口,拦截未登录路由
  161. * navigator标签现在默认没有转场动画,所以用view
  162. */
  163. navTo(url) {
  164. if (!this.hasLogin) {
  165. url = '/pages/public/login';
  166. }
  167. uni.navigateTo({
  168. url
  169. })
  170. },
  171. gridClick(item, index) {
  172. var that = this
  173. if (!this.hasLogin) {
  174. uni.showModal({
  175. title: '登录提示',
  176. content: '您尚未登录,是否立即登录?',
  177. showCancel: true,
  178. confirmText: '登录',
  179. success: (e) => {
  180. if (e.confirm) {
  181. uni.navigateTo({
  182. url: '/pages/public/login'
  183. })
  184. }
  185. },
  186. fail: () => {},
  187. complete: () => {}
  188. })
  189. } else {
  190. if (item.url) {
  191. uni.navigateTo({
  192. url: item.url
  193. })
  194. }
  195. }
  196. },
  197. confirmWarehouse() {},
  198. confirmPositon() {},
  199. init() {
  200. console.log(this.userInfo)
  201. this.$api.doRequest('get', '/warehouseBaseInfo/selectWarehouseViewinfo', {
  202. compId: '',
  203. }).then(res => {
  204. if (res.data.data) {
  205. console.log('res',res.data.data)
  206. if (res.data.data.length == 0) {
  207. this.isShowAlert = true
  208. } else {
  209. this.warehouseName = res.data.data[0].warehouseName
  210. this.warehouseList = res.data.data;
  211. this.makeBinNumber()
  212. }
  213. }
  214. })
  215. },
  216. makeBinNumber(){debugger
  217. let _data = this.warehouseList
  218. let _arr = []
  219. for(let i = 0;i<_data.length;i++){
  220. //判断当前对象是否在数组中
  221. let result = _arr.some(item=>{
  222. if(item.warehouseId==_data[i].warehouseId){
  223. _arr.cwList.push(_data[i].binNumber)
  224. return true
  225. }
  226. })
  227. console.log(result)
  228. if(!result){
  229. _arr.push(_data[i])
  230. _arr.cwList = [_data[i].binNumber]
  231. }
  232. }
  233. console.log(_arr)
  234. },
  235. warehousechange(e) {
  236. debugger
  237. this.warehouseName = this.warehouseList[e[0]].warehouseName
  238. console.log(e)
  239. },
  240. }
  241. }
  242. </script>
  243. <style lang='scss' scoped>
  244. page {
  245. background: #F5F6FA;
  246. }
  247. .container {
  248. padding-top: 85px;
  249. padding-top: 35px;
  250. background-color: #F5F6FA;
  251. position: relative;
  252. width: 100vw;
  253. height: 100vh;
  254. overflow: hidden;
  255. background: url('~@/static/img/login/bg_slices/bg@3x.png');
  256. background-size: 100% 100%;
  257. margin: 0 auto;
  258. }
  259. .wrap {
  260. background: #fff;
  261. margin: 10px;
  262. border-radius: 10px;
  263. padding: 10px;
  264. .title {
  265. font-size: 16px;
  266. }
  267. }
  268. .cu-list {
  269. /* height: 483rpx;
  270. overflow-y: scroll; */
  271. background: transparent;
  272. }
  273. .cu-list.grid.no-border {
  274. padding: 0;
  275. }
  276. .grid {
  277. display: flex;
  278. align-items: center;
  279. flex-wrap: wrap;
  280. /* border-top: 2upx solid rgba(172,172,172,.2); */
  281. .grid-item-3 {
  282. box-sizing: border-box;
  283. width: calc(100% / 3);
  284. border-bottom: 2upx solid rgba(172, 172, 172, .2);
  285. border-right: 2upx solid rgba(172, 172, 172, .2);
  286. text-align: center;
  287. padding: 40upx 0;
  288. position: relative;
  289. /* view{
  290. font-size: $font-sm;
  291. margin-top: 16upx;
  292. color: $font-color-dark;
  293. } */
  294. .grid_icon {
  295. font-size: 48upx;
  296. margin-bottom: 18upx;
  297. color: #fa436a;
  298. }
  299. .tip_text {
  300. display: block;
  301. padding: 4upx 8upx;
  302. text-align: center;
  303. border-radius: 36upx;
  304. font-size: 24upx;
  305. background-color: #fa436a;
  306. color: rgba(255, 255, 255, 1);
  307. position: absolute;
  308. right: 6upx;
  309. top: 6upx;
  310. }
  311. }
  312. .grid-item-3:nth-child(3n + 3),
  313. .grid-item-4:nth-child(4n + 4) {
  314. border-right: none;
  315. }
  316. }
  317. .sign {
  318. width: 40px;
  319. height: 40px;
  320. top: 4px;
  321. margin-right: 6px;
  322. }
  323. .dropdown {
  324. display: flex;
  325. margin: 20rpx 0;
  326. justify-content: space-between;
  327. .left,
  328. .right {
  329. display: flex;
  330. }
  331. }
  332. </style>