Explorar o código

采购列表细化

shish %!s(int64=3) %!d(string=hai) anos
pai
achega
4d390dbb2e

+ 30 - 84
ghsApp/src/pagesPurchase/order.vue

@@ -1,6 +1,9 @@
 <template>
 <view class="app-content">
 	<view class="order-page">
+		<view class="tabs">
+			<Tabs :isFixed="true" :tabs="tabs" :currentTab="tabIndex" @change="changeTabEvent" itemWidth="25%"></Tabs>
+		</view>
 		<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>
@@ -20,7 +23,6 @@ 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: {
@@ -29,49 +31,42 @@ export default {
 		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"
+					value: ""
 				},
 				{
-					name: "配送中",
+					name: "待入库",
 					key: "3",
-					value: "25"
+					value: ""
 				},
 				{
-					name: "已完成",
+					name: "已入库",
 					key: "4",
-					value: "25"
+					value: ""
+				},
+				{
+					name: "已取消",
+					key: "5",
+					value: ""
 				}
 			]
 		};
 	},
 	onPullDownRefresh() {
 		this.resetList();
-		this._list().then(res => {
+		this.getCgList().then(res => {
 			uni.stopPullDownRefresh();
 		});
 	},
 	onReachBottom() {
 		if (!this.list.finished) {
-		this._list().then((res) => {
+		this.getCgList().then((res) => {
 			uni.stopPullDownRefresh();
 		});
 		} else {
@@ -80,78 +75,30 @@ export default {
 	},
 	methods: {
 		async init() {
-			this._list();
+			this.getCgList();
 		},
-		_list() {
-			let options = {
-				page: this.list.page,
-				pageSize: this.list.pageSize,
-				status: this.tabs[this.tabIndex].key,
-				ghsId:this.option.ghsId
-			};
-			return getPurchaseListApi(options)
-				.then(res => {
-					const { data: { allNum, unPayNum, unSendNum, sendingNum, finishNum } } = res
+		getCgList() {
+			let ghsId = this.option.ghsId || 0
+			let status = this.tabs[this.tabIndex].key
+			let options = { page: this.list.page, status: status, ghsId:ghsId }
+			return getPurchaseListApi(options) .then(res => {
 					this.completes(res);
-					for (let index = 0; index < this.tabs.length; index++) {
-						const element = this.tabs[index];
-						if (element.key == "") {
-							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;
+			} 
+			this.tabIndex = index;
+			this.resetList();
+			this.getCgList();
 		},
 		addEvent() {
-			uni.navigateTo({
-				url: `/pagesPurchase/supplier`,
-				success: result => {},
-				fail: () => {},
-				complete: () => {}
-			});
+			uni.navigateTo({ url: `/pagesPurchase/supplier` })
 		},
 		gotoDetails(item) {
-			uni.navigateTo({
-				url: `/pagesPurchase/info?orderSn=${item.orderSn}`,
-				success: result => {},
-				fail: () => {},
-				complete: () => {}
-			});
+			uni.navigateTo({ url: `/pagesPurchase/info?orderSn=${item.orderSn}` })
 		}
 	}
 };
@@ -163,10 +110,9 @@ export default {
 	flex-direction: column;
 	background-color: #f9fbfc;
 	.order-list {
-		padding-top: 20upx;
-		padding-bottom: 80upx;
+		padding-top:60upx;
+		padding-bottom:100upx;
 		flex: 1;
-		// padding-bottom: 50upx;
 		.allot-item {
 			margin-bottom: 1upx;
 			padding: 30upx;

+ 10 - 28
ghsApp/src/pagesPurchase/orderItem.vue

@@ -7,7 +7,10 @@
 			</view>
 			<view v-if="info.refund == 2" class="status" style="color:red;border:1upx solid red;border-radius:20upx;font-size:20upx;padding:5upx 12upx;margin-right:50upx;">有退款 </view>
 			<view v-if="info.debt == 1" class="status" style="color:red;border:1upx solid red;border-radius:20upx;font-size:20upx;padding:5upx 12upx;margin-right:50upx;">欠款 </view>
-			<view class="status">{{ getStatusName }} </view>
+			<view class="status">
+				<text v-if="info.status != 3">{{ info.status==1?'待确认':info.status==2?'待发货':info.status==3?'待入库':info.status==4?'已入库':'已取消' }}</text>
+				<text v-else style="font-weight:bold;color:green;">待入库</text>
+			</view>
 		</view>
 		<view class="item-main" >
 			<view class="item-info">
@@ -20,7 +23,11 @@
 					<text class="info-value">{{ info.orderSn }} </text>
 				</view>
 				<view class="info-row">
-					<text class="info-label"> 人员:</text>
+					<text class="info-label"> 数量:</text>
+					<text class="info-value">{{ info.itemNum?parseFloat(info.itemNum):0 }}扎 </text>
+				</view>
+				<view class="info-row">
+					<text class="info-label"> 操作:</text>
 					<text class="info-value" style="overflow: hidden; text-overflow:ellipsis; white-space: nowrap;width:300upx;">{{ info.adminName }} </text>
 				</view>
 				<view v-if="!$util.isEmpty(info.remark)" class="info-row">
@@ -34,7 +41,6 @@
 	</view>
 </template>
 <script>
-import { PURCHASE_ORDER_STATUS } from "@/utils/declare";
 export default {
 	props: {
 		info: {
@@ -43,32 +49,8 @@ export default {
 	},
 	data() {
 		return {
-			PURCHASE_ORDER_STATUS
-		};
-	},
-	computed: {
-		getStatusName() {
-			let statusName = "";
 
-			switch (this.info.status) {
-				case PURCHASE_ORDER_STATUS.CONFIRM:
-					statusName = "待付款";
-					break;
-				case PURCHASE_ORDER_STATUS.UNDIS:
-					statusName = "待配送";
-					break;
-				case PURCHASE_ORDER_STATUS.DIS:
-					statusName = "配送中";
-					break;
-				case PURCHASE_ORDER_STATUS.DONE:
-					statusName = "已完成";
-					break;
-
-				default:
-					break;
-			}
-			return statusName;
-		}
+		};
 	},
 	methods: {
 		clickItemEvent() {

+ 2 - 2
ghsApp/src/pagesPurchase/supplier.vue

@@ -16,9 +16,9 @@
               <view class="accumulative"></view>
             </view>
             <view class="store_btn">
-              <view class="btn_entrance" @click.stop="pageTo({ url: '/admin/clear/list',query: {ghsId: item.id}})"> 结账记录 </view>
+              <view class="btn_entrance" @click.stop="pageTo({ url: '/admin/clear/list?ghsId'+item.id})"> 结账记录 </view>
               <view class="btn_entrance" @click.stop="goToDebtList(item)"> 待结订单 </view>
-              <view class="btn_entrance" @click.stop="pageTo({url:'/pagesPurchase/order',query:{ghsId:item.id}})">采购记录</view>
+              <view class="btn_entrance" @click.stop="pageTo({url:'/pagesPurchase/order?ghsId='+item.id})">采购记录</view>
               <view class="cg-button">采购</view>
             </view>
           </view>