123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- <template>
- <view class="page-wrap">
- <view class="pageTabs">
- <uni-segmented-control :current="tabIdx" :values="tabs" style-type="text" active-color="#007aff" @clickItem="changeTab" />
- </view>
- <view class="head">
- <uni-section title="物资列表" type="line">
- <template v-slot:right>
- <view class="handle" @click="linkToRecord">出库/入库记录</view>
- </template>
- </uni-section>
- <view class="addbt" @click="onInbound('in',tabIdx+1)">
- <view class="word">物资入库</view>
- </view>
- </view>
- <view class="pageMain">
- <uni-card v-for="(item,idx) in items" :key="idx" padding="0">
- <template v-slot:title>
- <view class="title">
- <view class="name">
- <uni-tag :text="item.goodsCatTitle" type="primary"></uni-tag>
- </view>
- <uni-tag :text="`${item.count}`" custom-style="background-color: #ecf5ff; border-color: #d9ecff; color: #409eff;"></uni-tag>
- </view>
- </template>
- <view class="bottom">
- <view class="groupName">
- <uni-tag :text="item.groupName" type="success" :inverted="true"></uni-tag>
- </view>
- <div class="handle" @click="onOutbound(item)"><uni-tag text="出库" type="warning" size="normal" /></div>
- </view>
- </uni-card>
- </view>
- <CreateBound ref="bound" @success="onBoundSuccess" :cats="goodsCats"></CreateBound>
- </view>
- </template>
- <script>
- import CreateBound from './components/CreateBound.vue'
- import goodsApi from '@/api/goods.js'
- export default {
- components:{
- CreateBound
- },
- computed:{
- goodsType(){
- return this.tabIdx+1
- }
- },
- data() {
- return {
- tabIdx:0,
- tabs:['行业物质','镇办物资'],
- items:[],
- goodsCats:uni.getStorageSync('goodsCats')||[],
- keywords: ""
- }
- },
- onShow() {
- this.getData();
- this.init()
- },
- methods: {
- changeTab({currentIndex}){
- if (this.tabIdx !== currentIndex) {
- this.tabIdx = currentIndex
- this.getData()
- }
- },
- init(){
- if(!uni.getStorageSync('goodsCats')){
- goodsApi.getCatByList().then((res)=>{
- uni.setStorageSync('goodsCats',res.data)
- this.goodsCats=res.data
- })
- }
- },
- getData(){
- goodsApi.counterByCat({goodsType:this.tabIdx+1}).then((res)=>{
- this.items=res.data
- })
- },
- onInbound(){
- this.$refs.bound.show({type:'in',item:{goodsType:this.tabIdx+1}})
- },
- onOutbound(item){
- this.$refs.bound.show({type:'out',item:{
- ...item,
- goodsType:this.tabIdx+1
- }})
- },
- onBoundSuccess(type){
- uni.navigateTo({
- url:`/packageA/pages/goods/record?type=${type}`
- })
- },
- linkToRecord(){
- uni.navigateTo({
- url:`/packageA/pages/goods/record?type=${this.tabIdx+1}`
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .page-wrap{
- padding:0 20rpx;
- .pageTabs{
- background-color: #fff;
- }
- .head{
- margin-top: 20rpx;
- .handle{
- display: inline-block;
- // background-color: #007aff;
- color: #777777;
- text-align: center;
- padding:16rpx 20rpx;
- border-radius: 30rpx;
- // border: 1px solid #007aff;
- font-size: 28rpx;
- line-height: 1;
- box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
- }
- .addbt{
- width: 100rpx;
- height: 100rpx;
- border-radius: 50%;
- color: #fff;
- background-color: rgba(64,158,255,0.75);
- box-shadow:0 0 10rpx rgba(0,0,0,0.6);
- position: fixed;
- right: 10rpx;
- bottom: 20%;
- z-index: 99;
- text-align: center;
- display: flex;
- justify-content: center;
- align-items: center;
- .word{
- width: 80rpx;
- height: 80rpx;
- border-radius: 50%;
- margin: 5rpx auto;
- font-size: 28rpx;
- letter-spacing: 2px;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- }
- }
- .pageMain{
- margin-top: 20rpx;
- background-color: #f5f5f5;
- padding-bottom: 50rpx;
- .title{
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding-top: 16rpx;
- }
- .bottom{
- display: flex;
- justify-content: space-between;
- align-items: center;
- .handle{
- padding: 10px 0 10px 20px;
- }
- }
- }
- }
- </style>
|