index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. <template>
  2. <view class="picking-task-page">
  3. <u-navbar
  4. height="40px"
  5. title="拣货任务"
  6. bgColor="#F0F6FB"
  7. autoBack
  8. placeholder
  9. >
  10. <view class="u-nav-slot depot-label" slot="right">
  11. <view class="name">{{ curDepotName }}</view>
  12. </view>
  13. </u-navbar>
  14. <view class="container_main">
  15. <u-sticky :offsetTop="offsetTop" bgColor="#F0F6FB">
  16. <view class="search-box">
  17. <u-search
  18. placeholder="请输入单据编号"
  19. bgColor="#fff"
  20. shape="square"
  21. v-model="params.number"
  22. :showAction="false"
  23. @search="searchClick"
  24. @clear="searchClick"
  25. ></u-search>
  26. <view class="flex_box" @click="scanCode">
  27. <view class="scan-text">扫描单据二维码</view>
  28. <view class="scan-icon">
  29. <image src="@/static/image/scan-icon.png" mode=""></image>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="type-box flex_box">
  34. <view class="type-item" @click="tabClick(1)">
  35. <view class="type-val">{{ type1 }}</view>
  36. <u-icon name="arrow-down-fill" color="#999999" size="12"></u-icon>
  37. </view>
  38. <view class="type-item" @click="tabClick(2)">
  39. <view class="type-val">{{ type2 }}</view>
  40. <u-icon name="arrow-down-fill" color="#999999" size="12"></u-icon>
  41. </view>
  42. </view>
  43. </u-sticky>
  44. <view class="task-cont">
  45. <block v-for="(item, i) in taskList" :key="i">
  46. <task-card
  47. :key="`${item.id}-${item.status}`"
  48. :columns="taskColumns"
  49. :formData="item"
  50. @handleClickField="handleClickField"
  51. >
  52. <!-- 状态 -->
  53. <view slot="rightTop">
  54. <u-tag
  55. v-if="item.status == 1"
  56. text="待拣货"
  57. plain
  58. borderColor="rgba(255, 59, 29, 0.2)"
  59. color="#ff3b1d"
  60. bgColor="rgba(255, 59, 29, 0.2)"
  61. ></u-tag>
  62. <u-tag
  63. v-if="item.status == 6"
  64. text="待复核"
  65. plain
  66. borderColor="rgba(255, 59, 29, 0.2)"
  67. color="#ff3b1d"
  68. bgColor="rgba(255, 59, 29, 0.2)"
  69. ></u-tag>
  70. <u-tag
  71. v-if="item.status == 7"
  72. text="复核驳回"
  73. plain
  74. borderColor="rgba(255, 59, 29, 0.2)"
  75. color="#ff3b1d"
  76. bgColor="rgba(255, 59, 29, 0.2)"
  77. ></u-tag>
  78. <u-tag
  79. v-if="item.status == 3"
  80. text="部分拣货"
  81. plain
  82. borderColor="rgba(0, 185, 123, 0.2)"
  83. color="#00b97b"
  84. bgColor="rgba(0, 185, 123, 0.2)"
  85. ></u-tag>
  86. <u-tag
  87. v-if="item.status == 2"
  88. text="已拣货"
  89. plain
  90. borderColor="rgba(0, 185, 123, 0.2)"
  91. color="#00b97b"
  92. bgColor="rgba(0, 185, 123, 0.2)"
  93. ></u-tag>
  94. <u-tag
  95. v-if="item.status == 4"
  96. text="拣货中"
  97. plain
  98. borderColor="rgba(245, 151, 1, 0.2)"
  99. color="#f57701"
  100. bgColor="rgba(245, 151, 1, 0.2)"
  101. ></u-tag>
  102. </view>
  103. <!-- 操作栏 -->
  104. <view slot="action" class="action-box">
  105. <view class="action-left-box" v-if="item.status == 7"
  106. >驳回原因:{{ item.reject }}</view
  107. >
  108. <view class="task-bottom">
  109. <view
  110. class="btn btn-1"
  111. @click="toStorage(item)"
  112. v-if="
  113. item.status == 1 || item.status == 4 || item.status == 7
  114. "
  115. >{{ item.status == 7 ? "重新出库" : "去出库" }}</view
  116. >
  117. <view class="btn btn-2" @click="toDetail(item)" v-else
  118. >详情</view
  119. >
  120. </view>
  121. </view>
  122. </task-card>
  123. </block>
  124. <u-loadmore v-if="taskList.length > 0" :status="status" />
  125. <u-empty
  126. mode="data"
  127. text="暂无内容"
  128. marginTop="60"
  129. icon="https://xiangli-erp.oss-cn-hangzhou.aliyuncs.com/APP/no-notifcations.png"
  130. v-if="taskList.length == 0"
  131. ></u-empty>
  132. </view>
  133. </view>
  134. <!-- 状态 -->
  135. <u-picker
  136. :show="statusShow"
  137. keyName="label"
  138. :defaultIndex="defaultIndex2"
  139. :columns="statusColumns"
  140. @confirm="statusConfirm"
  141. @cancel="statusShow = false"
  142. ></u-picker>
  143. <!-- 月份 -->
  144. <u-picker
  145. :show="dateShow"
  146. :defaultIndex="defaultIndex3"
  147. :columns="dateColumns"
  148. @confirm="dateConfirm"
  149. @cancel="dateShow = false"
  150. ></u-picker>
  151. </view>
  152. </template>
  153. <script>
  154. import taskCard from "@/components/task-card/task-card.vue";
  155. import { saleOrder } from "@/common/request/apis/picking";
  156. import { orderStartHandle } from "@/common/request/apis/purchase";
  157. import { mapGetters } from "vuex";
  158. export default {
  159. components: {
  160. taskCard,
  161. },
  162. data() {
  163. return {
  164. offsetTop: 0,
  165. type1: "全部",
  166. type2: "月份",
  167. statusShow: false,
  168. dateShow: false,
  169. statusColumns: [
  170. [
  171. {
  172. label: "全部",
  173. id: "",
  174. },
  175. {
  176. label: "待拣货",
  177. id: "1",
  178. },
  179. {
  180. label: "待复核",
  181. id: "6",
  182. },
  183. {
  184. label: "复核驳回",
  185. id: "7",
  186. },
  187. {
  188. label: "拣货中",
  189. id: "4",
  190. },
  191. {
  192. label: "部分拣货",
  193. id: "3",
  194. },
  195. {
  196. label: "已拣货",
  197. id: "2",
  198. },
  199. ],
  200. ],
  201. dateColumns: [
  202. [
  203. "全年",
  204. "一月",
  205. "二月",
  206. "三月",
  207. "四月",
  208. "五月",
  209. "六月",
  210. "七月",
  211. "八月",
  212. "九月",
  213. "十月",
  214. "十一月",
  215. "十二月",
  216. ],
  217. ],
  218. taskColumns: [
  219. {
  220. title: "单据编号",
  221. key: "number",
  222. titleStyle: {
  223. color: "#333",
  224. fontSize: "28rpx",
  225. fontWeight: 500,
  226. },
  227. valueStyle: {
  228. color: "#333",
  229. fontSize: "28rpx",
  230. fontWeight: 500,
  231. },
  232. },
  233. {
  234. title: "客户名称",
  235. key: "supplierName",
  236. },
  237. {
  238. title: "单据日期",
  239. key: "operTime",
  240. },
  241. {
  242. title: "货物总数",
  243. key: "goodsQuantity",
  244. span: 12,
  245. valueStyle: {
  246. color: "#0256ff",
  247. },
  248. },
  249. {
  250. title: "货物种类",
  251. key: "goodsTypeCount",
  252. span: 12,
  253. valueStyle: {
  254. color: "#0256ff",
  255. },
  256. },
  257. ],
  258. defaultIndex2: [],
  259. defaultIndex3: [],
  260. taskList: [],
  261. params: {
  262. beginTime: "",
  263. endTime: "",
  264. number: "",
  265. status: "",
  266. currentPage: 1,
  267. pageSize: 10,
  268. },
  269. status: "loadmore",
  270. lastPage: 1,
  271. };
  272. },
  273. computed: {
  274. ...mapGetters(["depotInfo"]),
  275. curDepotId() {
  276. return this.depotInfo ? this.depotInfo.id : "";
  277. },
  278. curDepotName() {
  279. return this.depotInfo ? this.depotInfo.depotName : "";
  280. },
  281. },
  282. onLoad() {
  283. let systemInfo = uni.getSystemInfoSync();
  284. let statusBarHeight = systemInfo.statusBarHeight;
  285. this.offsetTop = statusBarHeight + 40;
  286. this.init();
  287. },
  288. onHide() {
  289. uni.$off("scanFinish");
  290. },
  291. onUnload() {
  292. uni.$off("scanFinish");
  293. },
  294. onReachBottom() {
  295. if (this.params.currentPage < this.lastPage) {
  296. this.params.currentPage++;
  297. this.getSaleOrder();
  298. }
  299. },
  300. onShow() {
  301. uni.$on("scanFinish", (data) => {
  302. this.params.number = data;
  303. this.init();
  304. });
  305. if (uni.getStorageSync("orderRefresh")) {
  306. this.init();
  307. uni.removeStorageSync("orderRefresh");
  308. }
  309. },
  310. methods: {
  311. scanCode() {
  312. this.$scan.scanCode();
  313. },
  314. init() {
  315. uni.showLoading();
  316. this.params.currentPage = 1;
  317. this.taskList = [];
  318. this.getSaleOrder();
  319. },
  320. searchClick() {
  321. this.init();
  322. },
  323. tabClick(type) {
  324. switch (type) {
  325. case 1:
  326. this.statusShow = true;
  327. break;
  328. case 2:
  329. this.dateShow = true;
  330. break;
  331. default:
  332. break;
  333. }
  334. },
  335. getSaleOrder() {
  336. saleOrder({ ...this.params, depotId: this.curDepotId })
  337. .then((res) => {
  338. if (res.code == 200) {
  339. this.status = "loading";
  340. this.lastPage = Math.ceil(
  341. (res.data.total * 1) / this.params.pageSize
  342. );
  343. if (this.params.currentPage < this.lastPage) {
  344. this.status = "loadmore";
  345. } else {
  346. this.status = "nomore";
  347. }
  348. this.taskList = [...this.taskList, ...res.data.rows];
  349. console.log("taskList========", res.data.rows);
  350. }
  351. uni.hideLoading();
  352. })
  353. .catch((err) => {
  354. uni.hideLoading();
  355. });
  356. },
  357. statusConfirm(val) {
  358. this.type1 = val.value[0].label;
  359. this.params.status = val.value[0].id;
  360. this.statusShow = false;
  361. this.init();
  362. },
  363. dateConfirm(val) {
  364. this.type2 = val.value[0];
  365. this.dateShow = false;
  366. let month = val.indexs[0];
  367. this.getLastDayOfMonth(month);
  368. this.init();
  369. },
  370. // 获取开始时间、结束时间
  371. getLastDayOfMonth(month) {
  372. let year = new Date().getFullYear();
  373. if (month != 0) {
  374. let monthStart = new Date(year, month, 0).getDate();
  375. this.params.beginTime = `${year}-${month}-01`;
  376. this.params.endTime = `${year}-${month}-${monthStart}`;
  377. } else {
  378. this.params.beginTime = "";
  379. this.params.endTime = "";
  380. }
  381. },
  382. // 出库
  383. toStorage(val) {
  384. uni.setStorageSync("orderRefresh", true);
  385. orderStartHandle(val.id).then((res) => {
  386. if (res.code == 200) {
  387. uni.navigateTo({
  388. url: `/pages/picking-task/delivery?id=${val.id}`,
  389. });
  390. }
  391. });
  392. },
  393. toDetail(val) {
  394. console.log(val, "val");
  395. uni.navigateTo({
  396. url: `/pages/picking-task/detail?id=${val.id}`,
  397. });
  398. },
  399. handleClickField(key, itemData) {
  400. console.log(123333);
  401. console.log("key===", key);
  402. console.log("itemData===", itemData);
  403. if (
  404. itemData.status == 1 ||
  405. itemData.status == 4 ||
  406. itemData.status == 7
  407. ) {
  408. this.toStorage(itemData);
  409. } else {
  410. this.toDetail(itemData);
  411. }
  412. },
  413. },
  414. };
  415. </script>
  416. <style lang="scss" scoped>
  417. .picking-task-page {
  418. min-height: 100vh;
  419. background: #f0f6fb;
  420. .container_main {
  421. .search-box {
  422. display: flex;
  423. align-items: center;
  424. padding: 0 32rpx;
  425. .scan-text {
  426. color: #333;
  427. font-family: "PingFang SC";
  428. font-size: 24rpx;
  429. font-weight: 400;
  430. margin-right: 20rpx;
  431. margin-left: 30rpx;
  432. }
  433. .scan-icon {
  434. width: 36rpx;
  435. height: 36rpx;
  436. background-color: #fff;
  437. border-radius: 50%;
  438. display: flex;
  439. align-items: center;
  440. justify-content: center;
  441. image {
  442. width: 24rpx;
  443. height: 24rpx;
  444. }
  445. }
  446. }
  447. .type-box {
  448. .type-item {
  449. width: 50%;
  450. height: 88rpx;
  451. display: flex;
  452. align-items: center;
  453. justify-content: center;
  454. .type-val {
  455. color: #000;
  456. font-family: "PingFang SC";
  457. font-size: 28rpx;
  458. font-weight: 400;
  459. margin-right: 10rpx;
  460. }
  461. }
  462. }
  463. .task-cont {
  464. padding: 0 24rpx;
  465. }
  466. }
  467. }
  468. .action-box {
  469. padding-bottom: 24rpx;
  470. height: 80rpx;
  471. box-sizing: border-box;
  472. display: flex;
  473. align-items: center;
  474. justify-content: flex-end;
  475. width: 100%;
  476. }
  477. .action-left-box {
  478. color: #ff3b1d;
  479. font-family: "PingFang SC";
  480. font-size: 28rpx;
  481. font-weight: 400;
  482. width: 400rpx;
  483. overflow: hidden;
  484. white-space: nowrap;
  485. text-overflow: ellipsis;
  486. }
  487. .task-bottom {
  488. flex: 1;
  489. display: inline-flex;
  490. align-items: center;
  491. justify-content: flex-end;
  492. .btn {
  493. width: 144rpx;
  494. height: 56rpx;
  495. border-radius: 8rpx;
  496. font-size: 28rpx;
  497. line-height: 56rpx;
  498. text-align: center;
  499. margin-left: 12rpx;
  500. font-family: "PingFang SC";
  501. }
  502. .btn-1 {
  503. background: #0256ff;
  504. color: #fff;
  505. }
  506. .btn-2 {
  507. border: 1px solid #0256ff;
  508. background: rgba(2, 86, 255, 0.2);
  509. color: #0256ff;
  510. }
  511. }
  512. </style>