index.vue 10 KB

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