index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. <template>
  2. <view class="container_box">
  3. <u-navbar height="40px" bgColor="transparent">
  4. <view class="u-nav-slot btn-left" slot="left" @click="meunClick">
  5. <image src="@/static/image/home/bulletpoint.png" mode=""></image>
  6. </view>
  7. <view slot="center" class="depot-label" @click="stashClick">
  8. <view class="name">{{ cangName }}</view>
  9. <u-icon name="arrow-down-fill" color="#999999" size="12"></u-icon>
  10. </view>
  11. <view class="u-nav-slot btn-right" slot="right" @click="noticeClick">
  12. <image src="@/static/image/home/notice-icon.png" mode=""></image>
  13. <u-badge
  14. type="error"
  15. :isDot="true"
  16. :show="noticeShow"
  17. :absolute="true"
  18. :offset="[-2, 1]"
  19. ></u-badge>
  20. </view>
  21. </u-navbar>
  22. <view class="container_main">
  23. <view class="header-box">
  24. <view class="user-content-box">
  25. <view class="user-info-box">
  26. <image src="@/static/image/home/avatar.png" mode=""></image>
  27. <view class="user-info-content">
  28. <view class="user-name">
  29. {{ userInfo.username }}
  30. </view>
  31. <view class="user-phone">
  32. {{ userInfo.phonenum }}
  33. </view>
  34. </view>
  35. </view>
  36. <view class="user-txt"> 您的移动仓库管家 </view>
  37. </view>
  38. <image
  39. src="@/static/image/home/home-top-img.png"
  40. class="header-bg"
  41. mode=""
  42. ></image>
  43. </view>
  44. <view class="container_cont">
  45. <view
  46. class="operate-item"
  47. v-for="(item, i) in operateList"
  48. :key="i"
  49. @click="operateClick(item)"
  50. >
  51. <view class="operate-img">
  52. <image :src="item.src" mode=""></image>
  53. <u-badge
  54. type="error"
  55. absolute
  56. max="99"
  57. :value="item.num"
  58. :offset="[-5, -5]"
  59. ></u-badge>
  60. </view>
  61. <view class="operate-text">{{ item.text }}</view>
  62. </view>
  63. </view>
  64. </view>
  65. <!-- 菜单弹框 -->
  66. <use-pop
  67. :userInfo="userInfo"
  68. v-model="meunShow"
  69. @close="meunShow = false"
  70. ></use-pop>
  71. <!-- 版本更新 -->
  72. <u-popup
  73. :show="showUpdatePop"
  74. :closeOnClickOverlay="false"
  75. :safeAreaInsetBottom="false"
  76. mode="center"
  77. :round="16"
  78. >
  79. <view class="reason-box">
  80. <image
  81. class="icon-img"
  82. src="https://qiuyu-shuzhi.oss-cn-beijing.aliyuncs.com/image/task-pop-img.png"
  83. mode=""
  84. ></image>
  85. <view class="reason-box-title">象力WMS邀请你升级至新版本</view>
  86. <view class="btn-box">
  87. <button class="reset-button cancel-btn" @click="updateShow = false">
  88. 稍后再说
  89. </button>
  90. <button class="reset-button confirm-btn" @click="toUpdate">
  91. 下载更新
  92. </button>
  93. </view>
  94. </view>
  95. </u-popup>
  96. <!-- 中心仓弹窗 -->
  97. <u-picker
  98. :show="stashShow"
  99. keyName="label"
  100. :defaultIndex="defaultIndex"
  101. :columns="stashColumns"
  102. @confirm="pickerConfirm"
  103. @cancel="stashShow = false"
  104. ></u-picker>
  105. </view>
  106. </template>
  107. <script>
  108. import usePop from "./components/use-pop.vue";
  109. import { downloadApkWithJsonPost } from "@/common/utils/app-update.js";
  110. import { depotSpinnerList } from "@/common/request/apis/purchase";
  111. // const Base64 = require('js-base64').Base64
  112. import { mapGetters } from "vuex";
  113. export default {
  114. components: {
  115. usePop,
  116. },
  117. data() {
  118. return {
  119. operateList: [
  120. {
  121. src: require("@/static/image/home/icon-jhrw.png"),
  122. text: "拣货任务",
  123. num: 0,
  124. url: "/pages/picking-task/index",
  125. },
  126. {
  127. src: require("@/static/image/home/icon-cgrk.png"),
  128. text: "采购入库",
  129. num: 0,
  130. url: "/pages/purchase/index",
  131. },
  132. {
  133. src: require("@/static/image/home/icon-chcx.png"),
  134. text: "存货查询",
  135. num: 0,
  136. url: "/pages/inventory-inquiry/index",
  137. },
  138. {
  139. src: require("@/static/image/home/icon-pdrw.png"),
  140. text: "盘点任务",
  141. num: 0,
  142. url: "/pages/inventory-task/index",
  143. },
  144. {
  145. src: require("@/static/image/home/icon-fhrw.png"),
  146. text: "复核任务",
  147. num: 0,
  148. url: "/pages/inventory-task/index",
  149. },
  150. {
  151. src: require("@/static/image/home/icon-hwlr.png"),
  152. text: "货物录入",
  153. num: 0,
  154. url: "/pages/inventory-task/index",
  155. },
  156. ],
  157. meunShow: false,
  158. noticeShow: true,
  159. updateShow: true,
  160. // 选择仓库
  161. stashShow: false,
  162. cangName: "",
  163. stashColumns: [],
  164. defaultIndex: [],
  165. };
  166. },
  167. onLoad() {
  168. // JSON.parse(Base64.decode(that.$Route.query.classData))
  169. this.getDepotSpinnerList();
  170. },
  171. onShow() {
  172. if (!this.isLogin) {
  173. uni.$u.toast("请先登录!");
  174. setTimeout(() => {
  175. uni.redirectTo({
  176. url: "/pages/login/login",
  177. });
  178. }, 1500);
  179. }
  180. },
  181. computed: {
  182. ...mapGetters(["isLogin", "userInfo"]),
  183. showUpdatePop() {
  184. return this.$store.state.update.update && this.updateShow;
  185. },
  186. },
  187. methods: {
  188. toUpdate() {
  189. const params = this.$store.state.update.downloadApkParams;
  190. const url = this.$BASE_URL + "/pda/downloadApk";
  191. console.log(url, "url");
  192. console.log("params=======", params);
  193. downloadApkWithJsonPost(url, params);
  194. },
  195. meunClick() {
  196. if (!this.isLogin) {
  197. uni.$u.toast("请先登录!");
  198. setTimeout(() => {
  199. uni.redirectTo({
  200. url: "/pages/login/login",
  201. });
  202. }, 1500);
  203. } else {
  204. this.meunShow = true;
  205. }
  206. },
  207. operateClick(item) {
  208. uni.navigateTo({
  209. url: item.url,
  210. });
  211. },
  212. noticeClick() {
  213. uni.navigateTo({
  214. url: "/pages/index/notice-page",
  215. });
  216. },
  217. // 仓库
  218. getDepotSpinnerList() {
  219. depotSpinnerList().then((res) => {
  220. if (res.code == 200) {
  221. console.log(1111, res);
  222. this.stashColumns = [res.data];
  223. this.cangName = res.data[0].label;
  224. this.$store.commit("setcangName", this.cangName);
  225. this.$store.commit("setDepotInfo", {
  226. depotName: res.data[0].label,
  227. id: res.data[0].value,
  228. });
  229. }
  230. });
  231. },
  232. pickerConfirm(val) {
  233. console.log("pickerConfirm======", val);
  234. this.cangName = val.value[0].label;
  235. this.stashShow = false;
  236. this.$store.commit("setcangName", val.value[0].label);
  237. this.$store.commit("setDepotInfo", {
  238. depotName: val.value[0].label,
  239. id: val.value[0].value,
  240. });
  241. },
  242. stashClick() {
  243. this.defaultIndex = this.getDefaultIndex(
  244. this.cangName,
  245. this.stashColumns
  246. );
  247. this.stashShow = true;
  248. },
  249. // 获取picker默认index
  250. getDefaultIndex(val, list) {
  251. let arr = [];
  252. let index = list[0].findIndex((item) => item.label == val);
  253. arr = [index];
  254. return arr;
  255. },
  256. },
  257. };
  258. </script>
  259. <style lang="scss" scoped>
  260. .btn-center {
  261. display: flex;
  262. align-items: center;
  263. .cang-name {
  264. color: rgba(51, 51, 51, 1);
  265. text-align: center;
  266. font-family: "PingFang SC";
  267. font-size: 28rpx;
  268. font-weight: 600;
  269. margin-right: 10rpx;
  270. }
  271. }
  272. .btn-left {
  273. image {
  274. width: 48rpx;
  275. height: 48rpx;
  276. }
  277. }
  278. .btn-right {
  279. position: relative;
  280. image {
  281. width: 40rpx;
  282. height: 44rpx;
  283. }
  284. }
  285. .container_box {
  286. .container_main {
  287. .header-box {
  288. position: relative;
  289. height: 375rpx;
  290. .header-bg {
  291. width: 100%;
  292. height: 375rpx;
  293. }
  294. }
  295. .user-content-box {
  296. position: absolute;
  297. bottom: 32rpx;
  298. left: 32rpx;
  299. z-index: 99;
  300. .user-info-box {
  301. display: flex;
  302. image {
  303. width: 80rpx;
  304. height: 80rpx;
  305. margin-right: 20rpx;
  306. }
  307. .user-name {
  308. font-family: PingFang SC;
  309. font-weight: 500;
  310. font-size: 32rpx;
  311. color: #0f1828;
  312. }
  313. .user-phone {
  314. font-family: PingFang SC;
  315. font-weight: 400;
  316. font-size: 24rpx;
  317. color: #666666;
  318. }
  319. }
  320. .user-txt {
  321. margin-top: 20rpx;
  322. width: 350rpx;
  323. height: 44rpx;
  324. padding: 0 26rpx;
  325. border-radius: 64rpx;
  326. background: linear-gradient(90deg, #5cc4e8 0%, #0256ff 100%);
  327. font-family: PingFang SC;
  328. font-weight: 500;
  329. font-size: 24rpx;
  330. letter-spacing: 2;
  331. text-align-last: justify;
  332. line-height: 44rpx;
  333. color: #ffffff;
  334. }
  335. }
  336. }
  337. .container_cont {
  338. padding: 32rpx;
  339. display: flex;
  340. align-items: center;
  341. justify-content: space-between;
  342. flex-wrap: wrap;
  343. .operate-item {
  344. width: 326rpx;
  345. height: 262rpx;
  346. border-radius: 16rpx;
  347. background: #fff;
  348. display: flex;
  349. flex-direction: column;
  350. align-items: center;
  351. justify-content: center;
  352. margin-bottom: 32rpx;
  353. .operate-img {
  354. position: relative;
  355. image {
  356. width: 128rpx;
  357. height: 128rpx;
  358. }
  359. }
  360. .operate-text {
  361. color: #333;
  362. font-family: "PingFang SC";
  363. font-size: 32rpx;
  364. font-weight: 500;
  365. margin-top: 20rpx;
  366. }
  367. }
  368. }
  369. }
  370. .reason-box {
  371. width: 700rpx;
  372. background: url("https://qiuyu-shuzhi.oss-cn-beijing.aliyuncs.com/image/task-pop-bg.png")
  373. no-repeat;
  374. background-size: 100% 100%;
  375. padding: 0 60rpx 46rpx;
  376. box-sizing: border-box;
  377. .icon-img {
  378. width: 200rpx;
  379. height: 200rpx;
  380. border-radius: 50%;
  381. position: absolute;
  382. top: -100rpx;
  383. left: 50%;
  384. transform: translateX(-50%);
  385. }
  386. .reason-box-title {
  387. padding-top: 150rpx;
  388. color: #1d212a;
  389. font-family: "PingFang SC";
  390. font-size: 32rpx;
  391. font-weight: bold;
  392. text-align: center;
  393. }
  394. .btn-box {
  395. display: flex;
  396. align-items: center;
  397. justify-content: space-between;
  398. margin-top: 60rpx;
  399. .cancel-btn,
  400. .confirm-btn {
  401. width: 244rpx;
  402. height: 80rpx;
  403. border-radius: 16rpx;
  404. font-size: 32rpx;
  405. }
  406. .cancel-btn {
  407. border: 1px solid #bfc8db;
  408. color: #86909c;
  409. }
  410. .confirm-btn {
  411. background: #0256ff;
  412. color: #fff;
  413. font-weight: 500;
  414. }
  415. }
  416. }
  417. </style>