index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  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: "",
  149. // },
  150. // {
  151. // src: require("@/static/image/home/icon-hwlr.png"),
  152. // text: "货物录入",
  153. // num: 0,
  154. // url: "/pages/goods-enter/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. if (!item.url) {
  209. return;
  210. }
  211. uni.navigateTo({
  212. url: item.url,
  213. });
  214. },
  215. noticeClick() {
  216. uni.navigateTo({
  217. url: "/pages/index/notice-page",
  218. });
  219. },
  220. // 仓库
  221. getDepotSpinnerList() {
  222. depotSpinnerList().then((res) => {
  223. if (res.code == 200) {
  224. console.log(1111, res);
  225. this.stashColumns = [res.data];
  226. this.cangName = res.data[0].label;
  227. this.$store.commit("setcangName", this.cangName);
  228. this.$store.commit("setDepotInfo", {
  229. depotName: res.data[0].label,
  230. id: res.data[0].value,
  231. });
  232. }
  233. });
  234. },
  235. pickerConfirm(val) {
  236. console.log("pickerConfirm======", val);
  237. this.cangName = val.value[0].label;
  238. this.stashShow = false;
  239. this.$store.commit("setcangName", val.value[0].label);
  240. this.$store.commit("setDepotInfo", {
  241. depotName: val.value[0].label,
  242. id: val.value[0].value,
  243. });
  244. },
  245. stashClick() {
  246. this.defaultIndex = this.getDefaultIndex(
  247. this.cangName,
  248. this.stashColumns
  249. );
  250. this.stashShow = true;
  251. },
  252. // 获取picker默认index
  253. getDefaultIndex(val, list) {
  254. let arr = [];
  255. let index = list[0].findIndex((item) => item.label == val);
  256. arr = [index];
  257. return arr;
  258. },
  259. },
  260. };
  261. </script>
  262. <style lang="scss" scoped>
  263. .btn-center {
  264. display: flex;
  265. align-items: center;
  266. .cang-name {
  267. color: rgba(51, 51, 51, 1);
  268. text-align: center;
  269. font-family: "PingFang SC";
  270. font-size: 28rpx;
  271. font-weight: 600;
  272. margin-right: 10rpx;
  273. }
  274. }
  275. .btn-left {
  276. image {
  277. width: 48rpx;
  278. height: 48rpx;
  279. }
  280. }
  281. .btn-right {
  282. position: relative;
  283. image {
  284. width: 40rpx;
  285. height: 44rpx;
  286. }
  287. }
  288. .container_box {
  289. .container_main {
  290. .header-box {
  291. position: relative;
  292. height: 375rpx;
  293. .header-bg {
  294. width: 100%;
  295. height: 375rpx;
  296. }
  297. }
  298. .user-content-box {
  299. position: absolute;
  300. bottom: 32rpx;
  301. left: 32rpx;
  302. z-index: 99;
  303. .user-info-box {
  304. display: flex;
  305. image {
  306. width: 80rpx;
  307. height: 80rpx;
  308. margin-right: 20rpx;
  309. }
  310. .user-name {
  311. font-family: PingFang SC;
  312. font-weight: 500;
  313. font-size: 32rpx;
  314. color: #0f1828;
  315. }
  316. .user-phone {
  317. font-family: PingFang SC;
  318. font-weight: 400;
  319. font-size: 24rpx;
  320. color: #666666;
  321. }
  322. }
  323. .user-txt {
  324. margin-top: 20rpx;
  325. width: 350rpx;
  326. height: 44rpx;
  327. padding: 0 26rpx;
  328. border-radius: 64rpx;
  329. background: linear-gradient(90deg, #5cc4e8 0%, #0256ff 100%);
  330. font-family: PingFang SC;
  331. font-weight: 500;
  332. font-size: 24rpx;
  333. letter-spacing: 2;
  334. text-align-last: justify;
  335. line-height: 44rpx;
  336. color: #ffffff;
  337. }
  338. }
  339. }
  340. .container_cont {
  341. padding: 32rpx;
  342. display: flex;
  343. align-items: center;
  344. justify-content: space-between;
  345. flex-wrap: wrap;
  346. .operate-item {
  347. width: 326rpx;
  348. height: 262rpx;
  349. border-radius: 16rpx;
  350. background: #fff;
  351. display: flex;
  352. flex-direction: column;
  353. align-items: center;
  354. justify-content: center;
  355. margin-bottom: 32rpx;
  356. .operate-img {
  357. position: relative;
  358. image {
  359. width: 128rpx;
  360. height: 128rpx;
  361. }
  362. }
  363. .operate-text {
  364. color: #333;
  365. font-family: "PingFang SC";
  366. font-size: 32rpx;
  367. font-weight: 500;
  368. margin-top: 20rpx;
  369. }
  370. }
  371. }
  372. }
  373. .reason-box {
  374. width: 700rpx;
  375. background: url("https://qiuyu-shuzhi.oss-cn-beijing.aliyuncs.com/image/task-pop-bg.png")
  376. no-repeat;
  377. background-size: 100% 100%;
  378. padding: 0 60rpx 46rpx;
  379. box-sizing: border-box;
  380. .icon-img {
  381. width: 200rpx;
  382. height: 200rpx;
  383. border-radius: 50%;
  384. position: absolute;
  385. top: -100rpx;
  386. left: 50%;
  387. transform: translateX(-50%);
  388. }
  389. .reason-box-title {
  390. padding-top: 150rpx;
  391. color: #1d212a;
  392. font-family: "PingFang SC";
  393. font-size: 32rpx;
  394. font-weight: bold;
  395. text-align: center;
  396. }
  397. .btn-box {
  398. display: flex;
  399. align-items: center;
  400. justify-content: space-between;
  401. margin-top: 60rpx;
  402. .cancel-btn,
  403. .confirm-btn {
  404. width: 244rpx;
  405. height: 80rpx;
  406. border-radius: 16rpx;
  407. font-size: 32rpx;
  408. }
  409. .cancel-btn {
  410. border: 1px solid #bfc8db;
  411. color: #86909c;
  412. }
  413. .confirm-btn {
  414. background: #0256ff;
  415. color: #fff;
  416. font-weight: 500;
  417. }
  418. }
  419. }
  420. </style>