| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- <template>
- <view class="order-page">
- <view scroll-y class="order-list">
- <block v-if="!$util.isEmpty(list.data)">
- <OrderItem v-for="(item, index) in list.data" :key="index" :info="item" @click="gotoDetails(item)"></OrderItem>
- </block>
- <block v-else>
- <AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
- </block>
- </view>
- <view class="app-footer open_btn">
- <view @click="addEvent" class="admin-button-com middle blue">新增采购</view>
- </view>
- </view>
- </template>
- <script>
- import Tabs from "@/components/plugin/tabs";
- import OrderItem from "./orderItem";
- import AppWrapperEmpty from "@/components/app-wrapper-empty";
- import { list } from "@/mixins";
- import { PURCHASE_ORDER_STATUS } from "@/utils/declare";
- import { getPurchaseListApi } from "@/api/purchase/index";
- export default {
- components: {
- Tabs,
- OrderItem,
- AppWrapperEmpty
- },
- mixins: [list],
- data() {
- return {
- PURCHASE_ORDER_STATUS,
- tabIndex: 0,
- tabs: [
- {
- name: "全部",
- key: "",
- value: "25"
- },
- {
- name: "待确认",
- key: "1",
- value: "25"
- },
- {
- name: "待配送",
- key: "2",
- value: "25"
- },
- {
- name: "配送中",
- key: "3",
- value: "25"
- },
- {
- name: "已完成",
- key: "4",
- value: "25"
- }
- ]
- };
- },
- onPullDownRefresh() {
- this.resetList();
- this._list().then(res => {
- uni.stopPullDownRefresh();
- });
- },
- methods: {
- async init() {
- this._list();
- },
- _list() {
- let options = {
- page: this.list.page,
- pageSize: this.list.pageSize,
- status: this.tabs[this.tabIndex].key
- };
- return getPurchaseListApi(options)
- .then(res => {
- const {
- data: { allNum, unPayNum, unSendNum, sendingNum, finishNum }
- } = res;
- this.completes(res);
- for (let index = 0; index < this.tabs.length; index++) {
- const element = this.tabs[index];
- if (element.key == "") {
- // this.tabs[index].value = allNum;
- this.$set(this.tabs, index, {
- ...this.tabs[index],
- value: allNum
- });
- } else if (element.key == PURCHASE_ORDER_STATUS.CONFIRM) {
- this.tabs[index].value = unPayNum;
- } else if (element.key == PURCHASE_ORDER_STATUS.UNDIS) {
- this.tabs[index].value = unSendNum;
- } else if (element.key == PURCHASE_ORDER_STATUS.DIS) {
- this.tabs[index].value = sendingNum;
- } else if (element.key == PURCHASE_ORDER_STATUS.DONE) {
- this.tabs[index].value = finishNum;
- }
- }
- })
- .catch(err => {
- console.log(3333, err);
- });
- },
- changeTabEvent(info) {
- const { index } = info;
- if (this.tabIndex == index) {
- return false;
- } else {
- this.tabIndex = index;
- this.resetList();
- this._list();
- }
- },
- getItemStatusName(status) {
- let name = "";
- switch (status) {
- case OUT_STATUS.CONFIRM:
- name = "待出库";
- break;
- case OUT_STATUS.DONE:
- name = "已出库";
- break;
- default:
- break;
- }
- return name;
- },
- addEvent() {
- uni.navigateTo({
- url: `/pagesPurchase/add`,
- success: result => {},
- fail: () => {},
- complete: () => {}
- });
- },
- gotoDetails(item) {
- uni.navigateTo({
- url: `/pagesPurchase/info?orderSn=${item.orderSn}`,
- success: result => {},
- fail: () => {},
- complete: () => {}
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .order-page {
- height: 100%;
- display: flex;
- flex-direction: column;
- background-color: #f9fbfc;
- .order-list {
- padding-top: 20upx;
- padding-bottom: 80upx;
- flex: 1;
- // padding-bottom: 50upx;
- .allot-item {
- margin-bottom: 1px;
- padding: 30upx;
- display: flex;
- align-items: center;
- box-shadow: 0px 1px 0px 0px #eeeeee;
- background-color: #fff;
- .info {
- flex: 1;
- margin-right: 20px;
- .info-order {
- font-size: 32upx;
- font-weight: 600;
- color: #333333;
- }
- .info-name {
- margin: 40upx 0 20upx;
- font-size: 28upx;
- font-weight: 400;
- color: #666666;
- }
- .info-time {
- margin-right: 30upx;
- font-size: 28upx;
- font-weight: 400;
- color: #666666;
- }
- }
- .status {
- display: flex;
- flex-direction: column;
- align-items: center;
- flex-shrink: 0;
- width: 100upx;
- color: #cccccc;
- .status-name {
- margin-top: 10upx;
- font-size: 24upx;
- }
- .iconfont {
- font-size: 46upx;
- }
- &.primary {
- color: #3385ff;
- }
- &.gray {
- color: #cccccc;
- }
- &.warn {
- color: #ffaf1d;
- }
- }
- }
- }
- .bar-view {
- flex-shrink: 0;
- display: flex;
- justify-content: flex-end;
- align-items: center;
- padding: 0 30upx;
- width: 100%;
- height: 100upx;
- box-shadow: 0px -1px 6px 0px rgba(4, 0, 0, 0.06);
- .btn-view {
- display: flex;
- .admin-button-com {
- margin: 0 10upx;
- width: 140upx;
- }
- }
- }
- }
- </style>
|