Browse Source

增加了欠款明细页面

wangn 5 years ago
parent
commit
52dbf68eac

+ 1 - 1
hdApp/src/api/purchase/index.js

@@ -29,7 +29,7 @@ export const createPurchaseOrderApi = async data => {
 };
 };
 
 
 /** *
 /** *
- * 供货商列表
+ * 采购记录
  */
  */
  export const purchaseList = async data => {
  export const purchaseList = async data => {
 	return https.get("/purchase/list", data);
 	return https.get("/purchase/list", data);

+ 7 - 0
hdApp/src/pages.json

@@ -638,6 +638,13 @@
 						"enablePullDownRefresh": true
 						"enablePullDownRefresh": true
 					}
 					}
 				},
 				},
+        {
+					"path": "gathering",
+					"style": {
+						"navigationBarTitleText": "欠款明细",
+						"enablePullDownRefresh": true
+					}
+				},
 				{
 				{
 					"path": "details",
 					"path": "details",
 					"style": {
 					"style": {

+ 12 - 0
hdApp/src/pagesPurchase/gathering.vue

@@ -0,0 +1,12 @@
+<template>
+  <view class="order-page">
+    123
+  </view>
+</template>
+<script>
+
+export default {
+}
+</script>
+<style lang="scss" scoped>
+</style>

+ 87 - 27
hdApp/src/pagesPurchase/order.vue

@@ -4,16 +4,12 @@
 				isAdd
 				isAdd
 				addText="筛选" -->
 				addText="筛选" -->
     <view class="tabs">
     <view class="tabs">
-      <Tabs
-        :isFixed="true"
-        :tabs="tabs"
-        :currentTab="tabIndex"
-        @change="changeTabEvent"
-        itemWidth="20%"
-        @add="addEvent"
-        :isAdd="false"
-        addText="新增"
-      ></Tabs>
+      <view
+        v-for="(item, index) in tabList"
+        :key="index"
+        :class="{'active': tabIndex === index}"
+        @click="changeTabEvent(index)"
+      >{{item}}</view>
     </view>
     </view>
     <scroll-view
     <scroll-view
       scroll-y
       scroll-y
@@ -35,7 +31,17 @@
               <view class="accumulative">累计采购: {{item.expendAmount}}</view>
               <view class="accumulative">累计采购: {{item.expendAmount}}</view>
             </view>
             </view>
             <view class="store_btn">
             <view class="store_btn">
-              <view class="btn_entrance">
+              <view
+                class="btn_entrance"
+                v-if="Number(item.debtAmount) <= 0"
+                @click="settleAccounts(item.debtAmount)"
+              >
+                结账
+              </view>
+              <view
+                class="btn_entrance btn_forbid"
+                v-else
+              >
                 结账
                 结账
               </view>
               </view>
               <view class="btn_entrance">
               <view class="btn_entrance">
@@ -56,28 +62,35 @@
       class="pay_list"
       class="pay_list"
       v-if="tabIndex == 1"
       v-if="tabIndex == 1"
     >
     >
-      <Tabs
-        :isFixed="true"
-        :tabs="tabs"
-        :currentTab="tabIndex"
-        @change="changeTabEvent"
-        itemWidth="20%"
-        @add="addEvent"
-        :isAdd="false"
-        addText="新增"
-      ></Tabs>
+      <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>
     </scroll-view>
     </scroll-view>
   </view>
   </view>
 </template>
 </template>
 
 
 <script>
 <script>
 import Tabs from "@/components/plugin/tabs";
 import Tabs from "@/components/plugin/tabs";
+import OrderItem from "./orderItem";
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
 import { ghsList, purchaseList } from "@/api/purchase/index";
 import { ghsList, purchaseList } from "@/api/purchase/index";
 export default {
 export default {
   components: {
   components: {
     Tabs,
     Tabs,
-    AppWrapperEmpty
+    AppWrapperEmpty,
+    OrderItem
   },
   },
   data () {
   data () {
     return {
     return {
@@ -91,13 +104,17 @@ export default {
           key: "1",
           key: "1",
         },
         },
       ],
       ],
-
+      tabList: ['供货商', '采购记录'],
+      list: {
+        data: []
+      },
       supplierList: [],
       supplierList: [],
       tabIndex: 0
       tabIndex: 0
     }
     }
   },
   },
   mounted () {
   mounted () {
     this.getGHSList()
     this.getGHSList()
+    this.getpurchaseList()
   },
   },
   methods: {
   methods: {
     getGHSList () {
     getGHSList () {
@@ -106,14 +123,28 @@ export default {
         console.log(this.supplierList, 111)
         console.log(this.supplierList, 111)
       }).catch(err => { console.log(err) })
       }).catch(err => { console.log(err) })
     },
     },
+    // tab切换
     changeTabEvent (info) {
     changeTabEvent (info) {
-      const { index } = info;
+      const index = info;
       if (this.tabIndex == index) {
       if (this.tabIndex == index) {
         return false;
         return false;
       } else {
       } else {
         this.tabIndex = index;
         this.tabIndex = index;
       }
       }
-      console.log('this.tabIndex', this.tabIndex)
+    },
+    // 获取采购记录列表
+    getpurchaseList () {
+      purchaseList({ status: 0 }).then(res => {
+        console.log(res, 222222)
+        this.list.data = res.data.list
+      }).catch(err => { console.log(err) })
+    },
+    // 结账
+    settleAccounts (num) {
+      console.log('点击了结账', num)
+      uni.navigateTo({
+        url: '/pagesPurchase/gathering'
+      })
     }
     }
   }
   }
 }
 }
@@ -121,11 +152,36 @@ export default {
 
 
 <style lang="scss" scoped>
 <style lang="scss" scoped>
 .order-page {
 .order-page {
+  .tabs {
+    height: 80upx;
+    line-height: 80upx;
+    & > view {
+      padding: 0 80upx;
+      font-size: 28upx;
+      color: #666;
+      display: inline-block;
+    }
+    & > .active {
+      position: relative;
+      color: #3385ff;
+      font-weight: 700;
+    }
+    & > .active::after {
+      content: "";
+      position: absolute;
+      bottom: 0;
+      left: 50%;
+      transform: translateX(-50%);
+      width: 70upx;
+      height: 6upx;
+      background: #3385ff;
+    }
+  }
   .order_list {
   .order_list {
     // height: 200upx;
     // height: 200upx;
     height: 100%;
     height: 100%;
     background: #f0f2f6;
     background: #f0f2f6;
-    padding: 100upx 0 20upx;
+    padding: 20upx 0;
     .list_item {
     .list_item {
       position: relative;
       position: relative;
       height: 180upx;
       height: 180upx;
@@ -164,11 +220,15 @@ export default {
           padding: 15upx 30upx;
           padding: 15upx 30upx;
           margin-left: 30upx;
           margin-left: 30upx;
         }
         }
+        & > .btn_forbid {
+          border: 1px solid #999;
+          color: #999;
+        }
       }
       }
     }
     }
   }
   }
   .pay_list {
   .pay_list {
-    padding-top: 100upx;
+    padding-top: 20upx;
   }
   }
 }
 }
 </style>
 </style>

+ 137 - 131
hdApp/src/pagesPurchase/orderItem.vue

@@ -1,149 +1,155 @@
 <template>
 <template>
-	<view class="order-item-view">
-		<view class="item-header">
-			<view class="title">
-				<image class="icon" :src="info.avatar" alt="商品图" />
-				<text class="name">
-					{{ info.nickName }}
-				</text>
-			</view>
-			<view class="status">{{ getStatusName }} </view>
-		</view>
-		<view class="item-main" @click="clickItemEvent">
-			<view class="item-info">
-				<view class="info-row">
-					<text class="info-label"> 日期:</text>
-					<text class="info-value">{{ info.addTime }} </text>
-				</view>
-				<view class="info-row">
-					<text class="info-label"> 单号:</text>
-					<text class="info-value">{{ info.orderSn }} </text>
-				</view>
-				<view class="info-row">
-					<text class="info-label"> 人员:</text>
-					<text class="info-value">{{ info.adminName }} </text>
-				</view>
-			</view>
-			<view class="item-price"
-				>¥{{ info.orderPrice }} <text class="iconfont iconxiangyou"></text>
-			</view>
-		</view>
-	</view>
+  <view class="order-item-view">
+    <view class="item-header">
+      <view class="title">
+        <image
+          class="icon"
+          :src="info.supplierAvatar"
+          alt="商品图"
+        />
+        <text class="name">
+          {{ info.supplierName }}
+        </text>
+      </view>
+      <view class="status">{{ getStatusName }} </view>
+    </view>
+    <view
+      class="item-main"
+      @click="clickItemEvent"
+    >
+      <view class="item-info">
+        <view class="info-row">
+          <text class="info-label"> 日期:</text>
+          <text class="info-value">{{ info.addTime }} </text>
+        </view>
+        <view class="info-row">
+          <text class="info-label"> 单号:</text>
+          <text class="info-value">{{ info.orderSn }} </text>
+        </view>
+        <view class="info-row">
+          <text class="info-label"> 人员:</text>
+          <text class="info-value">{{ info.adminName }} </text>
+        </view>
+      </view>
+      <view class="item-price">¥{{ info.actPrice }} <text class="iconfont iconxiangyou"></text>
+      </view>
+    </view>
+  </view>
 </template>
 </template>
 <script>
 <script>
 import { PURCHASE_ORDER_STATUS } from "@/utils/declare";
 import { PURCHASE_ORDER_STATUS } from "@/utils/declare";
 
 
 export default {
 export default {
-	props: {
-		info: {
-			required: true
-		}
-	},
-	data() {
-		return {
-			PURCHASE_ORDER_STATUS
-		};
-	},
-	computed: {
-		getStatusName() {
-			let statusName = "";
+  props: {
+    info: {
+      required: true
+    }
+  },
+  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;
+      switch (this.info.status) {
+        case 1:
+          statusName = "待付款";
+          break;
+        case 2:
+          statusName = "待配送";
+          break;
+        case 3:
+          statusName = "配送中";
+          break;
+        case 4:
+          statusName = "已完成";
+          break;
 
 
-				default:
-					break;
-			}
-			return statusName;
-		}
-	},
-	methods: {
-		clickItemEvent() {
-			this.$emit("click", this.info);
-		}
-	}
+        default:
+          break;
+      }
+      return statusName;
+    }
+  },
+  methods: {
+    clickItemEvent () {
+      this.$emit("click", this.info);
+    }
+  }
 };
 };
 </script>
 </script>
 <style lang="scss" scoped>
 <style lang="scss" scoped>
 .order-item-view {
 .order-item-view {
-	padding: 30upx;
-	margin-bottom: 20upx;
-	width: 100%;
-	background-color: #fff;
-	.item-header {
-		display: flex;
-		justify-content: space-between;
-		align-items: center;
-		margin-bottom: 20upx;
-		.title {
-			display: flex;
-			align-items: center;
-			flex: 1;
+  padding: 30upx;
+  margin-bottom: 20upx;
+  width: 100%;
+  background-color: #fff;
+  .item-header {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    margin-bottom: 20upx;
+    .title {
+      display: flex;
+      align-items: center;
+      flex: 1;
 
 
-			.icon {
-				margin-right: 20upx;
-				width: 50upx;
-				height: 50upx;
-				border-radius: 25upx;
-				border-radius: 50%;
-			}
-			.name {
-				font-size: 32upx;
-				font-weight: 600;
-				color: #333333;
-			}
-		}
-		.status {
-			flex-shrink: 0;
-			color: $mainColor;
-		}
-	}
-	.item-main {
-		display: flex;
+      .icon {
+        margin-right: 20upx;
+        width: 50upx;
+        height: 50upx;
+        border-radius: 25upx;
+        border-radius: 50%;
+      }
+      .name {
+        font-size: 32upx;
+        font-weight: 600;
+        color: #333333;
+      }
+    }
+    .status {
+      flex-shrink: 0;
+      color: $mainColor;
+    }
+  }
+  .item-main {
+    display: flex;
 
 
-		align-items: flex-end;
-		.item-info {
-			flex: 1;
+    align-items: flex-end;
+    .item-info {
+      flex: 1;
 
 
-			font-size: 26upx;
-			.info-row {
-				margin-top: 12upx;
-				display: flex;
-				align-items: center;
-			}
-			.info-label {
-				font-weight: 400;
-				color: #999999;
-			}
-			.info-value {
-				font-weight: 400;
-				color: #333333;
-			}
-		}
-		.item-price {
-			display: flex;
-			align-items: center;
-			flex-shrink: 0;
+      font-size: 26upx;
+      .info-row {
+        margin-top: 12upx;
+        display: flex;
+        align-items: center;
+      }
+      .info-label {
+        font-weight: 400;
+        color: #999999;
+      }
+      .info-value {
+        font-weight: 400;
+        color: #333333;
+      }
+    }
+    .item-price {
+      display: flex;
+      align-items: center;
+      flex-shrink: 0;
 
 
-			font-size: 30upx;
-			font-weight: 600;
-			color: #333333;
-			.iconfont {
-				font-size: 28upx;
-				color: #999999;
-			}
-		}
-	}
+      font-size: 30upx;
+      font-weight: 600;
+      color: #333333;
+      .iconfont {
+        font-size: 28upx;
+        color: #999999;
+      }
+    }
+  }
 }
 }
 </style>
 </style>