123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507 |
- <template>
- <view class="picking-task-page">
- <u-navbar
- height="40px"
- title="拣货任务"
- bgColor="#F0F6FB"
- autoBack
- placeholder
- >
- <view class="u-nav-slot depot-label" slot="right">
- <view class="name">{{ curDepotName }}</view>
- </view>
- </u-navbar>
- <view class="container_main">
- <u-sticky :offsetTop="offsetTop" bgColor="#F0F6FB">
- <view class="search-box">
- <u-search
- placeholder="请输入单据编号"
- bgColor="#fff"
- shape="square"
- v-model="params.number"
- :showAction="false"
- @search="searchClick"
- @clear="searchClick"
- ></u-search>
- <view class="flex_box" @click="scanCode">
- <view class="scan-text">扫描单据二维码</view>
- <view class="scan-icon">
- <image src="@/static/image/scan-icon.png" mode=""></image>
- </view>
- </view>
- </view>
- <view class="type-box flex_box">
- <view class="type-item" @click="tabClick(1)">
- <view class="type-val">{{ type1 }}</view>
- <u-icon name="arrow-down-fill" color="#999999" size="12"></u-icon>
- </view>
- <view class="type-item" @click="tabClick(2)">
- <view class="type-val">{{ type2 }}</view>
- <u-icon name="arrow-down-fill" color="#999999" size="12"></u-icon>
- </view>
- </view>
- </u-sticky>
- <view class="task-cont">
- <block v-for="(item, i) in taskList" :key="i">
- <task-card
- :key="`${item.id}-${item.status}`"
- :columns="taskColumns"
- :formData="item"
- @handleClickField="handleClickField"
- >
- <!-- 状态 -->
- <view slot="rightTop">
- <u-tag
- v-if="item.status == 1"
- text="待拣货"
- plain
- borderColor="rgba(255, 59, 29, 0.2)"
- color="#ff3b1d"
- bgColor="rgba(255, 59, 29, 0.2)"
- ></u-tag>
- <u-tag
- v-if="item.status == 6"
- text="待复核"
- plain
- borderColor="rgba(255, 59, 29, 0.2)"
- color="#ff3b1d"
- bgColor="rgba(255, 59, 29, 0.2)"
- ></u-tag>
- <u-tag
- v-if="item.status == 7"
- text="复核驳回"
- plain
- borderColor="rgba(255, 59, 29, 0.2)"
- color="#ff3b1d"
- bgColor="rgba(255, 59, 29, 0.2)"
- ></u-tag>
- <u-tag
- v-if="item.status == 3"
- text="部分拣货"
- plain
- borderColor="rgba(0, 185, 123, 0.2)"
- color="#00b97b"
- bgColor="rgba(0, 185, 123, 0.2)"
- ></u-tag>
- <u-tag
- v-if="item.status == 2"
- text="已拣货"
- plain
- borderColor="rgba(0, 185, 123, 0.2)"
- color="#00b97b"
- bgColor="rgba(0, 185, 123, 0.2)"
- ></u-tag>
- <u-tag
- v-if="item.status == 4"
- text="拣货中"
- plain
- borderColor="rgba(245, 151, 1, 0.2)"
- color="#f57701"
- bgColor="rgba(245, 151, 1, 0.2)"
- ></u-tag>
- </view>
- <!-- 操作栏 -->
- <view slot="action" class="action-box">
- <view class="action-left-box" v-if="item.status == 7"
- >驳回原因:{{ item.reject }}</view
- >
- <view class="task-bottom">
- <view
- class="btn btn-1"
- @click="toStorage(item)"
- v-if="
- item.status == 1 || item.status == 4 || item.status == 7
- "
- >{{ item.status == 7 ? "重新出库" : "去出库" }}</view
- >
- <view class="btn btn-2" @click="toDetail(item)" v-else
- >详情</view
- >
- </view>
- </view>
- </task-card>
- </block>
- <u-loadmore v-if="taskList.length > 0" :status="status" />
- <u-empty
- mode="data"
- text="暂无内容"
- marginTop="60"
- icon="https://xiangli-erp.oss-cn-hangzhou.aliyuncs.com/APP/no-notifcations.png"
- v-if="taskList.length == 0"
- ></u-empty>
- </view>
- </view>
- <!-- 状态 -->
- <u-picker
- :show="statusShow"
- keyName="label"
- :defaultIndex="defaultIndex2"
- :columns="statusColumns"
- @confirm="statusConfirm"
- @cancel="statusShow = false"
- ></u-picker>
- <!-- 月份 -->
- <u-picker
- :show="dateShow"
- :defaultIndex="defaultIndex3"
- :columns="dateColumns"
- @confirm="dateConfirm"
- @cancel="dateShow = false"
- ></u-picker>
- </view>
- </template>
- <script>
- import taskCard from "@/components/task-card/task-card.vue";
- import { saleOrder } from "@/common/request/apis/picking";
- import { orderStartHandle } from "@/common/request/apis/purchase";
- import { mapGetters } from "vuex";
- export default {
- components: {
- taskCard,
- },
- data() {
- return {
- offsetTop: 0,
- type1: "全部",
- type2: "月份",
- statusShow: false,
- dateShow: false,
- statusColumns: [
- [
- {
- label: "全部",
- id: "",
- },
- {
- label: "待拣货",
- id: "1",
- },
- {
- label: "待复核",
- id: "6",
- },
- {
- label: "复核驳回",
- id: "7",
- },
- {
- label: "拣货中",
- id: "4",
- },
- {
- label: "部分拣货",
- id: "3",
- },
- {
- label: "已拣货",
- id: "2",
- },
- ],
- ],
- dateColumns: [
- [
- "全年",
- "一月",
- "二月",
- "三月",
- "四月",
- "五月",
- "六月",
- "七月",
- "八月",
- "九月",
- "十月",
- "十一月",
- "十二月",
- ],
- ],
- taskColumns: [
- {
- title: "单据编号",
- key: "number",
- titleStyle: {
- color: "#333",
- fontSize: "28rpx",
- fontWeight: 500,
- },
- valueStyle: {
- color: "#333",
- fontSize: "28rpx",
- fontWeight: 500,
- },
- },
- {
- title: "客户名称",
- key: "supplierName",
- },
- {
- title: "单据日期",
- key: "operTime",
- },
- {
- title: "货物总数",
- key: "goodsQuantity",
- span: 12,
- valueStyle: {
- color: "#0256ff",
- },
- },
- {
- title: "货物种类",
- key: "goodsTypeCount",
- span: 12,
- valueStyle: {
- color: "#0256ff",
- },
- },
- ],
- defaultIndex2: [],
- defaultIndex3: [],
- taskList: [],
- params: {
- beginTime: "",
- endTime: "",
- number: "",
- status: "",
- currentPage: 1,
- pageSize: 10,
- },
- status: "loadmore",
- lastPage: 1,
- };
- },
- computed: {
- ...mapGetters(["depotInfo"]),
- curDepotId() {
- return this.depotInfo ? this.depotInfo.id : "";
- },
- curDepotName() {
- return this.depotInfo ? this.depotInfo.depotName : "";
- },
- },
- onLoad() {
- let systemInfo = uni.getSystemInfoSync();
- let statusBarHeight = systemInfo.statusBarHeight;
- this.offsetTop = statusBarHeight + 40;
- this.init();
- },
- onHide() {
- uni.$off("scanFinish");
- },
- onUnload() {
- uni.$off("scanFinish");
- },
- onReachBottom() {
- if (this.params.currentPage < this.lastPage) {
- this.params.currentPage++;
- this.getSaleOrder();
- }
- },
- onShow() {
- uni.$on("scanFinish", (data) => {
- this.params.number = data;
- this.init();
- });
- if (uni.getStorageSync("orderRefresh")) {
- this.init();
- uni.removeStorageSync("orderRefresh");
- }
- },
- methods: {
- scanCode() {
- this.$scan.scanCode();
- },
- init() {
- uni.showLoading();
- this.params.currentPage = 1;
- this.taskList = [];
- this.getSaleOrder();
- },
- searchClick() {
- this.init();
- },
- tabClick(type) {
- switch (type) {
- case 1:
- this.statusShow = true;
- break;
- case 2:
- this.dateShow = true;
- break;
- default:
- break;
- }
- },
- getSaleOrder() {
- saleOrder({ ...this.params, depotId: this.curDepotId })
- .then((res) => {
- if (res.code == 200) {
- this.status = "loading";
- this.lastPage = Math.ceil(
- (res.data.total * 1) / this.params.pageSize
- );
- if (this.params.currentPage < this.lastPage) {
- this.status = "loadmore";
- } else {
- this.status = "nomore";
- }
- this.taskList = [...this.taskList, ...res.data.rows];
- console.log("taskList========", res.data.rows);
- }
- uni.hideLoading();
- })
- .catch((err) => {
- uni.hideLoading();
- });
- },
- statusConfirm(val) {
- this.type1 = val.value[0].label;
- this.params.status = val.value[0].id;
- this.statusShow = false;
- this.init();
- },
- dateConfirm(val) {
- this.type2 = val.value[0];
- this.dateShow = false;
- let month = val.indexs[0];
- this.getLastDayOfMonth(month);
- this.init();
- },
- // 获取开始时间、结束时间
- getLastDayOfMonth(month) {
- let year = new Date().getFullYear();
- if (month != 0) {
- let monthStart = new Date(year, month, 0).getDate();
- this.params.beginTime = `${year}-${month}-01`;
- this.params.endTime = `${year}-${month}-${monthStart}`;
- } else {
- this.params.beginTime = "";
- this.params.endTime = "";
- }
- },
- // 出库
- toStorage(val) {
- uni.setStorageSync("orderRefresh", true);
- orderStartHandle(val.id).then((res) => {
- if (res.code == 200) {
- uni.navigateTo({
- url: `/pages/picking-task/delivery?id=${val.id}`,
- });
- }
- });
- },
- toDetail(val) {
- console.log(val, "val");
- uni.navigateTo({
- url: `/pages/picking-task/detail?id=${val.id}`,
- });
- },
- handleClickField(key, itemData) {
- this.toDetail(itemData);
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .picking-task-page {
- min-height: 100vh;
- background: #f0f6fb;
- .container_main {
- .search-box {
- display: flex;
- align-items: center;
- padding: 0 32rpx;
- .scan-text {
- color: #333;
- font-family: "PingFang SC";
- font-size: 24rpx;
- font-weight: 400;
- margin-right: 20rpx;
- margin-left: 30rpx;
- }
- .scan-icon {
- width: 36rpx;
- height: 36rpx;
- background-color: #fff;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- image {
- width: 24rpx;
- height: 24rpx;
- }
- }
- }
- .type-box {
- .type-item {
- width: 50%;
- height: 88rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- .type-val {
- color: #000;
- font-family: "PingFang SC";
- font-size: 28rpx;
- font-weight: 400;
- margin-right: 10rpx;
- }
- }
- }
- .task-cont {
- padding: 0 24rpx;
- }
- }
- }
- .action-box {
- padding-bottom: 24rpx;
- height: 80rpx;
- box-sizing: border-box;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- width: 100%;
- }
- .action-left-box {
- color: #ff3b1d;
- font-family: "PingFang SC";
- font-size: 28rpx;
- font-weight: 400;
- width: 400rpx;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- .task-bottom {
- flex: 1;
- display: inline-flex;
- align-items: center;
- justify-content: flex-end;
- .btn {
- width: 144rpx;
- height: 56rpx;
- border-radius: 8rpx;
- font-size: 28rpx;
- line-height: 56rpx;
- text-align: center;
- margin-left: 12rpx;
- font-family: "PingFang SC";
- }
- .btn-1 {
- background: #0256ff;
- color: #fff;
- }
- .btn-2 {
- border: 1px solid #0256ff;
- background: rgba(2, 86, 255, 0.2);
- color: #0256ff;
- }
- }
- </style>
|