index.vue 11 KB

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