chenrui 3 年 前
コミット
3e3b51b951
2 ファイル変更53 行追加18 行削除
  1. 52 17
      pages/sales/chooseProduct.vue
  2. 1 1
      pages/sales/list.vue

+ 52 - 17
pages/sales/chooseProduct.vue

@@ -2,38 +2,41 @@
 	<view class="chooseProduct-wrap">
 		<!-- 标题 -->
 		<u-navbar title="选择产品" :safeAreaInsetTop="false" :border-bottom="true">
-			<view class="u-nav-slot" slot="right" style="padding-right: 30rpx;">
+			<view class="u-nav-slot" slot="right" style="padding-right: 40rpx;">
 				<u-icon name="search" color="#999" size="28" @click="openModal=true"></u-icon>查询
 			</view>
 		</u-navbar>
 		<!-- 产品列表 -->
 		<view class="product-list-box">
-			<scroll-view class="sales-list-con" :style="{height: scrollH+'upx'}" scroll-y @scrolltolower="onreachBottom">
-				<view class="sales-list-item border-b font_13 flex justify_between" v-for="(item, index) in listData" :key="item.id">
-					<view class="pimgs">
+			<scroll-view class="product-list-con" :style="{height: scrollH+'upx'}" scroll-y @scrolltolower="onreachBottom">
+				<view class="product-list-item border-b font_13 flex justify_between" v-for="(item, index) in listData" :key="item.id">
+					<view class="list-item-tit">
+						<u-section :title="item.productName":right="false" :line-color="$config('primaryColor')"></u-section>
+					</view>
+					<!-- <view class="pimgs">
 						<u-image :src="item.productMainMsg?item.productMainMsg:`../../static/${theme}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
 						<view v-if="item.oosFlag == 1" class="sign" :style="{backgroundColor: $config('errorColor')}">急</view>
 						<view v-if="item.price < item.cost" class="sign" :style="{backgroundColor: $config('errorColor')}">亏</view>
 						<view v-if="item.price == 0" class="sign" :style="{backgroundColor: $config('errorColor')}">赠</view>
 					</view>
-					<view class="sales-item-main flex_1">
-						<view class="sales-item-name">{{item.productName || '--'}}</view>
-						<view class="sales-item-txt flex align_center justify_between">
+					<view class="product-item-main flex_1">
+						<view class="product-item-name">{{item.productName || '--'}}</view>
+						<view class="product-item-txt flex align_center justify_between">
 							<view>{{item.productCode || '--'}}</view>
-							<u-icon v-if="pageData.type=='edit'" @click="handleDel(item)" name="trash-fill" :color="$config('errorColor')" size="34"></u-icon>
+							<u-icon @click="handleDel(item)" name="trash-fill" :color="$config('errorColor')" size="34"></u-icon>
 						</view>
-						<view class="sales-item-txt color_6" style="font-size: 24upx;" v-if="item.warehouseEntity&&item.warehouseEntity.name || item.warehouseLocationEntity&&item.warehouseLocationEntity.name">{{item.warehouseEntity&&item.warehouseEntity.name}} > {{item.warehouseLocationEntity&&item.warehouseLocationEntity.name}}</view>
-						<view class="sales-item-txt flex align_center justify_between">
-							<view class="sales-item-priceInfo">
+						<view class="product-item-txt color_6" style="font-size: 24upx;" v-if="item.warehouseEntity&&item.warehouseEntity.name || item.warehouseLocationEntity&&item.warehouseLocationEntity.name">{{item.warehouseEntity&&item.warehouseEntity.name}} > {{item.warehouseLocationEntity&&item.warehouseLocationEntity.name}}</view>
+						<view class="product-item-txt flex align_center justify_between">
+							<view class="product-item-priceInfo">
 								<view :style="{color: $config('errorColor'), display: 'inline-block'}">¥<text style="font-size: 30upx;">{{toThousands(item.price||0, 2)}}</text></view>
 								<text style="display: inline-block;margin: 0 10upx;">*</text> 
 								<text style="font-size: 30upx;">{{toThousands(item.qty||0)}}</text>
 								{{item.productUnit}}
 							</view>
-							<view class="sales-item-price">¥{{toThousands(item.totalAmount||0, 2)}}</view>
+							<view class="product-item-price">¥{{toThousands(item.totalAmount||0, 2)}}</view>
 						</view>
-						<view class="sales-item-price">折后¥{{toThousands(item.discountedAmount||0, 2)}}</view>
-					</view>
+						<view class="product-item-price">折后¥{{toThousands(item.discountedAmount||0, 2)}}</view>
+					</view> -->
 				</view>
 				<view v-if="listData && listData.length == 0">
 					<u-empty :text="noDataText" mode="list" :img-width="200" :margin-top="30"></u-empty>
@@ -48,6 +51,7 @@
 <script>
 	import ProductSearch from './productSearch.vue'
 	import { toThousands } from '@/libs/tools'
+	import { querySumByProductLocation } from '@/api/stock'
 	export default{
 		components: { ProductSearch },
 		data(){
@@ -94,10 +98,41 @@
 				const _this = this
 				this.searchParams = Object.assign(params, this.searchForm)
 				this.$nextTick(function(){
-					// _this.$refs.salesList.getList(1)
+					// _this.$refs.productList.getList(1)
 				})
 			},
-			getList(){}
+			// 列表
+			getList(pageNo){
+				const _this = this
+				if (pageNo) {
+					this.pageNo = pageNo
+				}
+				let params = {
+					pageNo: this.pageNo,
+					pageSize: this.pageSize
+				}
+				querySumByProductLocation(Object.assign(params, this.params)).then(res => {
+					if (res.status == 200) {
+						if(this.pageNo>1){
+							this.listData = this.listData.concat(res.data.list || [])
+						}else{
+							this.listData = res.data.list || []
+						}
+						this.totalNum = res.data.count || 0
+					} else {
+						this.listData = []
+						this.totalNum = 0
+						this.noDataText = res.message
+					}
+				})
+			},
+			// scroll-view到底部加载更多
+			onreachBottom() {
+				if(this.listData.length < this.totalNum){
+					this.pageNo += 1
+					this.getList()
+				}
+			},
 		}
 	}
 </script>
@@ -105,7 +140,7 @@
 <style lang="scss">
 	.chooseProduct-wrap{
 		width: 100%;
-		.list-box{
+		.product-list-box{
 			padding: 20upx 20upx;
 		}
 	}

+ 1 - 1
pages/sales/list.vue

@@ -2,7 +2,7 @@
 	<view class="sales-list-wrap">
 		<!-- 标题 -->
 		<u-navbar title="销售单" :safeAreaInsetTop="false" :border-bottom="true">
-			<view class="u-nav-slot" slot="right" style="padding-right: 30rpx;">
+			<view class="u-nav-slot" slot="right" style="padding-right: 40rpx;">
 				<u-icon name="search" color="#999" size="28" @click="openModal=true"></u-icon>查询
 			</view>
 		</u-navbar>