index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  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="`${item.id}-${item.status}`">
  46. <task-item
  47. :item="item"
  48. @toAudit="toAudit"
  49. @toDetail="toDetail"
  50. type="caigou"
  51. ></task-item>
  52. </block>
  53. <u-loadmore v-if="taskList.length > 0" :status="status" />
  54. <u-empty
  55. mode="data"
  56. text="暂无内容"
  57. marginTop="60"
  58. icon="https://xiangli-erp.oss-cn-hangzhou.aliyuncs.com/APP/no-notifcations.png"
  59. v-if="taskList.length == 0"
  60. ></u-empty>
  61. </view>
  62. </view>
  63. <!-- 状态 -->
  64. <u-picker
  65. :show="statusShow"
  66. keyName="label"
  67. :defaultIndex="defaultIndex2"
  68. :columns="statusColumns"
  69. @confirm="statusConfirm"
  70. @cancel="statusShow = false"
  71. ></u-picker>
  72. <!-- 月份 -->
  73. <u-picker
  74. :show="dateShow"
  75. :defaultIndex="defaultIndex3"
  76. :columns="dateColumns"
  77. @confirm="dateConfirm"
  78. @cancel="dateShow = false"
  79. ></u-picker>
  80. </view>
  81. </template>
  82. <script>
  83. import taskItem from "./components/task-item.vue";
  84. import {
  85. purchaseInventory,
  86. orderStartHandle,
  87. } from "@/common/request/apis/purchase";
  88. import { mapGetters } from "vuex";
  89. export default {
  90. components: {
  91. taskItem,
  92. },
  93. data() {
  94. return {
  95. offsetTop: 0,
  96. type1: "全部",
  97. type2: "月份",
  98. statusShow: false,
  99. dateShow: false,
  100. statusColumns: [
  101. [
  102. {
  103. label: "全部",
  104. id: "",
  105. },
  106. {
  107. label: "待入库",
  108. id: "1",
  109. },
  110. {
  111. label: "入库中",
  112. id: "4",
  113. },
  114. {
  115. label: "已入库",
  116. id: "2",
  117. },
  118. ],
  119. ],
  120. dateColumns: [
  121. [
  122. "全年",
  123. "一月",
  124. "二月",
  125. "三月",
  126. "四月",
  127. "五月",
  128. "六月",
  129. "七月",
  130. "八月",
  131. "九月",
  132. "十月",
  133. "十一月",
  134. "十二月",
  135. ],
  136. ],
  137. defaultIndex2: [],
  138. defaultIndex3: [],
  139. taskList: [
  140. {
  141. number: "CGDD00000000692",
  142. status: "1",
  143. id: "1",
  144. supplierName: "快马阳光便利店",
  145. createTime: "2021-11-21 00:00:03",
  146. goodsQuantity: "55",
  147. goodsTypeCount: "5",
  148. },
  149. ],
  150. params: {
  151. beginTime: "",
  152. endTime: "",
  153. number: "",
  154. status: "",
  155. currentPage: 1,
  156. pageSize: 10,
  157. },
  158. status: "loadmore",
  159. lastPage: 1,
  160. };
  161. },
  162. computed: {
  163. ...mapGetters(["depotInfo"]),
  164. curDepotId() {
  165. return this.depotInfo ? this.depotInfo.id : "";
  166. },
  167. curDepotName() {
  168. return this.depotInfo ? this.depotInfo.depotName : "";
  169. },
  170. },
  171. onLoad() {
  172. let systemInfo = uni.getSystemInfoSync();
  173. let statusBarHeight = systemInfo.statusBarHeight;
  174. this.offsetTop = statusBarHeight + 40;
  175. // this.init();
  176. },
  177. onShow() {
  178. uni.$on("scanFinish", (data) => {
  179. this.params.number = data;
  180. this.init();
  181. });
  182. if (uni.getStorageSync("orderRefresh")) {
  183. this.init();
  184. uni.removeStorageSync("orderRefresh");
  185. }
  186. },
  187. onHide() {
  188. uni.$off("scanFinish");
  189. },
  190. onUnload() {
  191. uni.$off("scanFinish");
  192. },
  193. onReachBottom() {
  194. if (this.params.currentPage < this.lastPage) {
  195. this.params.currentPage++;
  196. this.getPurchaseInventory();
  197. }
  198. },
  199. methods: {
  200. scanCode() {
  201. this.$scan.scanCode();
  202. },
  203. init() {
  204. uni.showLoading();
  205. this.params.currentPage = 1;
  206. this.taskList = [];
  207. this.getPurchaseInventory();
  208. },
  209. searchClick() {
  210. this.init();
  211. },
  212. // 点击操作
  213. toOrderStartHandle(id, status) {
  214. orderStartHandle(id).then((res) => {
  215. if (res.code == 200) {
  216. uni.navigateTo({
  217. url: `/pages/purchase/put-storage?id=${id}&status=${status}`,
  218. });
  219. }
  220. });
  221. },
  222. tabClick(type) {
  223. switch (type) {
  224. case 1:
  225. this.statusShow = true;
  226. break;
  227. case 2:
  228. this.dateShow = true;
  229. break;
  230. default:
  231. break;
  232. }
  233. },
  234. getPurchaseInventory() {
  235. console.log("getPurchaseInventory======", this.params);
  236. purchaseInventory({ ...this.params, depotId: this.curDepotId })
  237. .then((res) => {
  238. if (res.code == 200) {
  239. this.status = "loading";
  240. this.lastPage = Math.ceil(
  241. (res.data.total * 1) / this.params.pageSize
  242. );
  243. if (this.params.currentPage < this.lastPage) {
  244. this.status = "loadmore";
  245. } else {
  246. this.status = "nomore";
  247. }
  248. this.taskList = [...this.taskList, ...res.data.rows];
  249. console.log("this.taskList=======", this.taskList);
  250. }
  251. uni.hideLoading();
  252. })
  253. .catch((err) => {
  254. uni.hideLoading();
  255. });
  256. },
  257. statusConfirm(val) {
  258. this.type1 = val.value[0].label;
  259. this.params.status = val.value[0].id;
  260. this.statusShow = false;
  261. this.init();
  262. },
  263. dateConfirm(val) {
  264. this.type2 = val.value[0];
  265. this.dateShow = false;
  266. let month = val.indexs[0];
  267. this.getLastDayOfMonth(month);
  268. this.init();
  269. },
  270. // 获取开始时间、结束时间
  271. getLastDayOfMonth(month) {
  272. let year = new Date().getFullYear();
  273. if (month != 0) {
  274. let monthStart = new Date(year, month, 0).getDate();
  275. this.params.beginTime = `${year}-${month}-01`;
  276. this.params.endTime = `${year}-${month}-${monthStart}`;
  277. } else {
  278. this.params.beginTime = "";
  279. this.params.endTime = "";
  280. }
  281. },
  282. // 审核
  283. toAudit(val) {
  284. uni.navigateTo({
  285. url: `/pages/audit-task/go-audit?id=${val.id}&status=${val.status}`,
  286. });
  287. // this.toOrderStartHandle(val.id, val.status);
  288. },
  289. toDetail(val) {
  290. uni.navigateTo({
  291. url: `/pages/purchase/detail?id=${val.id}&status=${val.status}`,
  292. });
  293. },
  294. },
  295. };
  296. </script>
  297. <style lang="scss" scoped>
  298. .picking-task-page {
  299. min-height: 100vh;
  300. background: #f0f6fb;
  301. .container_main {
  302. .search-box {
  303. display: flex;
  304. align-items: center;
  305. padding: 0 32rpx;
  306. .scan-text {
  307. color: #333;
  308. font-family: "PingFang SC";
  309. font-size: 24rpx;
  310. font-weight: 400;
  311. margin-right: 20rpx;
  312. margin-left: 30rpx;
  313. }
  314. .scan-icon {
  315. width: 36rpx;
  316. height: 36rpx;
  317. background-color: #fff;
  318. border-radius: 50%;
  319. display: flex;
  320. align-items: center;
  321. justify-content: center;
  322. image {
  323. width: 24rpx;
  324. height: 24rpx;
  325. }
  326. }
  327. }
  328. .type-box {
  329. .type-item {
  330. width: 50%;
  331. height: 88rpx;
  332. display: flex;
  333. align-items: center;
  334. justify-content: center;
  335. .type-val {
  336. color: #000;
  337. font-family: "PingFang SC";
  338. font-size: 28rpx;
  339. font-weight: 400;
  340. margin-right: 10rpx;
  341. }
  342. }
  343. }
  344. .task-cont {
  345. padding: 0 24rpx;
  346. }
  347. }
  348. }
  349. </style>