| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307 |
- <template>
- <view class="mainBox">
- <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="报损报溢" @clickLeft="back"></uni-nav-bar>
- <view class="tab-wrapper">
- <tabs @change="handleTabChange" @handleSearch="handleTabSearch" />
- </view>
- <CardList :list="tableData" />
- <view class="footBox">
- <view class="reg" @click="addStock">
- <uni-icons custom-prefix="iconfont" type="icon-shixiangxinzeng" size="20" color="#fff"></uni-icons>
- 新增报损报溢
- </view>
- </view>
- <!-- 搜索组件 -->
- <u-popup :show="searchVisible" mode="right" @close="searchVisible = false">
- <view class="search-container">
- <view class="title">筛选</view>
- <uni-forms ref="customForm" :modelValue="popupInfo" label-position="top" label-width="200">
- <uni-forms-item label="单号" name="code">
- <uni-easyinput v-model="popupInfo.code" :inputBorder="false" placeholder="请输入" />
- </uni-forms-item>
- <uni-forms-item label="名称" name="name">
- <uni-easyinput v-model="popupInfo.name" :inputBorder="false" placeholder="请输入" />
- </uni-forms-item>
- <uni-forms-item label="报损报溢部门" name="deliveryreportDeptNameName">
- <uni-easyinput :value="popupInfo.reportDeptName" disabled
- @click.native="$refs.treePicker._show()" :inputBorder="false" placeholder="请选择" />
- </uni-forms-item>
- <uni-forms-item label="报损报溢人" name="reportName">
- <uni-data-select v-model="popupInfo.reportId" :localdata="userList"></uni-data-select>
- </uni-forms-item>
- </uni-forms>
- <view class="footer">
- <view class="btn reset" @click="handleReset">重置</view>
- <view class="btn search" @click="handleSearch">搜索</view>
- </view>
- </view>
- </u-popup>
- <ba-tree-picker ref="treePicker" :multiple="false" @select-change="confirm" title="选择部门" :localdata="listData"
- valueKey="id" textKey="name" childrenKey="children" />
- </view>
- </template>
- <script>
- import {
- listOrganizations,
- getUserPage
- } from '@/api/myTicket/index.js'
- import {
- getPlanProfitLoss
- } from '@/api/warehouseManagement'
- import tabs from './components/tabs.vue'
- import CardList from './components/CardList.vue'
- import baTreePicker from '@/components/ba-tree-picker/ba-tree-picker.vue'
- export default {
- components: {
- tabs,
- CardList,
- baTreePicker
- },
- data() {
- return {
- listData: [],
- page: 1,
- size: 10,
- isEnd: true,
- searchVisible: false,
- status: '',
- pickerIndex: 0,
- pickTabIndex: 0,
- popupInfo: {
- code: '',
- name: '',
- reportDeptName: '',
- reportDeptId: '',
- reportName: '',
- reportId: ''
- }, //筛选数据
- userList: [],
- deptList: [],
- tableData: []
- }
- },
- onLoad() {
- this.getFirstList()
- this.getDept()
- },
- //触底加载
- onReachBottom: function() {
- if (this.isEnd) {
- return
- }
- this.getMoreLists()
- },
- methods: {
- back() {
- uni.switchTab({
- url: '/pages/index/index'
- })
- },
- getDept() {
- listOrganizations(1).then(data => {
- this.listData = data
- })
- },
- getUser(deptCode) {
- // 显示加载中的提示
- uni.showLoading({
- title: '加载中'
- })
- getUserPage({
- pageNum: 1,
- size: -1,
- groupId: deptCode
- })
- .then(data => {
- this.userList = data.list.map(item => {
- item.text = item.name
- item.value = item.id
- return item
- })
- })
- .finally(() => {
- uni.hideLoading()
- })
- },
- // 抬头下拉信息保存
- handlePicker(e, list, idKey, nameKey) {
- if (idKey) {
- this.popupInfo[idKey] = list[e.detail.value].id
- }
- if (nameKey) {
- this.popupInfo[nameKey] = list[e.detail.value].name
- }
- },
- handleSearch() {
- this.getFirstList()
- },
- getFirstList() {
- this.searchVisible = false
- this.page = 1
- this.isEnd = true
- this.getList()
- },
- getMoreLists() {
- //获取更多数据
- page++
- this.getList()
- },
- //获取列表信息
- getList() {
- uni.showLoading({
- title: '加载中'
- })
- let data = {
- pageNum: this.page,
- size: this.size,
- status: this.status
- }
- getPlanProfitLoss(data)
- .then(res => {
- if (this.page === 1) {
- this.tableData = res.list
- } else {
- this.tableData = this.tableData.concat(res.list)
- }
- this.isEnd = this.tableData.length >= res.count
- })
- .finally(() => {
- uni.hideLoading()
- })
- },
- confirm(data, name) {
- this.popupInfo.reportDeptName = name
- this.popupInfo.reportDeptId = data[0]
- this.popupInfo.reportName = ''
- this.popupInfo.reportId = ''
- this.getUser(data[0])
- },
- //切换tab
- handleTabChange(status) {
- this.status = status
- this.getFirstList()
- },
- //筛选
- handleTabSearch() {
- // this.getFirstList()
- this.searchVisible = true
- },
- handleReset() {
- this.popupInfo = {
- code: '',
- name: '',
- reportDeptName: '',
- reportDeptId: '',
- reportName: '',
- reportId: ''
- }
- this.getFirstList()
- },
- //新增
- addStock() {
- uni.navigateTo({
- url: '/pages/warehouse/reportLoss/edit'
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .mainBox {
- padding-bottom: 120rpx;
- }
- .tab-wrapper {
- z-index: 99;
- width: 100%;
- }
- .footBox {
- position: fixed;
- left: 0px;
- bottom: 0px;
- height: 100rpx;
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: space-between;
- view {
- width: 100%;
- height: 100%;
- text-align: center;
- color: #fff;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .add {
- background: $uni-color-primary;
- }
- .reg {
- background: $u-success-dark;
- }
- .uni-icons {
- margin-right: 8rpx !important;
- font-weight: bold;
- }
- }
- .search-container {
- width: 70vw;
- padding: 30rpx 36rpx;
- .footer {
- position: absolute;
- bottom: 0;
- left: 0;
- width: 100%;
- display: flex;
- box-shadow: 0 10rpx 30rpx 0 #000;
- .btn {
- width: 50%;
- height: 80rpx;
- border-radius: 0 !important;
- flex: 1;
- display: flex;
- justify-content: center;
- align-items: center;
- &.reset {
- color: $j-primary-border-green;
- }
- &.search {
- color: #fff;
- background-color: $j-primary-border-green;
- }
- }
- }
- .title {
- font-weight: bold;
- font-size: 30rpx;
- margin-bottom: 20rpx;
- }
- /deep/.uni-date__x-input,
- /deep/.uni-easyinput__content,
- /deep/.uni-easyinput__content-input {
- height: 60rpx;
- border-radius: 30rpx;
- overflow: hidden;
- background-color: rgba(242, 242, 242, 1);
- }
- }
- </style>
|