index.vue 13 KB

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