123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- <template>
- <view class="chooseProduct-wrap">
- <!-- 标题 -->
- <u-navbar title="选择产品" :safeAreaInsetTop="false" :border-bottom="true">
- <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="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="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 @click="handleDel(item)" name="trash-fill" :color="$config('errorColor')" size="34"></u-icon>
- </view>
- <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="product-item-price">¥{{toThousands(item.totalAmount||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>
- </view>
- </scroll-view>
- </view>
- <!-- 查询右侧弹框 -->
- <productSearch :openModal="openModal" :defaultParams="searchForm" @refresh="refresh" @close="openModal=false" />
- </view>
- </template>
- <script>
- import ProductSearch from './productSearch.vue'
- import { toThousands } from '@/libs/tools'
- import { querySumByProductLocation } from '@/api/stock'
- export default{
- components: { ProductSearch },
- data(){
- return{
- toThousands,
- customBtnStyle: { // 自定义按钮样式
- borderColor: this.$config('primaryColor'),
- backgroundColor: this.$config('primaryColor'),
- color: '#fff'
- },
- listData: [],
- pageNo: 1,
- pageSize: 6,
- totalNum: 0,
- noDataText: '暂无数据',
- searchForm: {},
- searchParams: {},
- openModal: false,
- theme: '',
- chooseProductList: [],
- scrollH: 0,
- }
- },
- onLoad(opt) {
- this.theme = getApp().globalData.theme
- if(opt){
- this.chooseProductList = opt.data ? JSON.parse(opt.data) : null
- }
- console.log(this.chooseProductList)
- this.getList()
-
- const _this = this
- let footerH = _this.$refs.productTotal && _this.$refs.productTotal.$el && _this.$refs.productTotal.$el.offsetHeight || 0
- uni.getSystemInfo({
- success: function (res) {
- const winH = res.windowHeight * 2
- _this.scrollH = winH - footerH - 85
- }
- })
- },
- methods: {
- // 获取查询参数 刷新列表
- refresh(params){
- const _this = this
- this.searchParams = Object.assign(params, this.searchForm)
- this.$nextTick(function(){
- // _this.$refs.productList.getList(1)
- })
- },
- // 列表
- 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>
- <style lang="scss">
- .chooseProduct-wrap{
- width: 100%;
- .product-list-box{
- padding: 20upx 20upx;
- }
- }
- </style>
|