| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // å·¡æ£ä¸ä¼ |
| | | import request from '@/utils/request' |
| | | |
| | | // éè´åºåºå表 |
| | | export function listPage(query) { |
| | | return request({ |
| | | url: '/stockin/listPage', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | //èªå®ä¹åºåºå表 |
| | | export function listPageByCustom(query) { |
| | | return request({ |
| | | url: '/stockin/listPageByCustom', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | //é¢ç¨ |
| | | export function stockout(query) { |
| | | return request({ |
| | | url: '/stockmanagement/stockout', |
| | | method: 'post', |
| | | data: query |
| | | }) |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // å·¡æ£ä¸ä¼ |
| | | import request from '@/utils/request' |
| | | |
| | | // éè´å
¥åºå表 |
| | | export function listPage(query) { |
| | | return request({ |
| | | url: '/stockin/listPage', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | //èªå®ä¹å
¥åºå表 |
| | | export function listPageByCustom(query) { |
| | | return request({ |
| | | url: '/stockin/listPageByCustom', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | //æ°å¢èªå®ä¹å
¥åº |
| | | // è·åç¨æ·ä¿¡æ¯ |
| | | export function addCustom(query) { |
| | | return request({ |
| | | url: '/stockin/addCustom', |
| | | method: 'post', |
| | | data: query |
| | | }) |
| | | } |
| | |
| | | const config = { |
| | | // baseUrl: 'https://vue.ruoyi.vip/prod-api', |
| | | // baseUrl: 'http://localhost/prod-api', |
| | | baseUrl: 'http://114.132.189.42:9066', // å®å¤æ¶¦æ³° |
| | | baseUrl: 'http://192.168.1.211:8888', // 天津åå¥ç¹ |
| | | // baseUrl: 'http://114.132.189.42:9066', // å®å¤æ¶¦æ³° |
| | | // baseUrl: 'http://114.132.189.42:9068', // æ°çæµ·å·å¼å¿ |
| | | // baseUrl: 'http://192.168.1.147:9036', |
| | | //cloudåå°ç½å
³å°å |
| | |
| | | "path": "code/index" |
| | | } |
| | | ] |
| | | } |
| | | }, |
| | | { |
| | | "root": "pages/inventoryManagement", |
| | | "pages": [ |
| | | { |
| | | "path": "receiptManagement/index", |
| | | "style": { |
| | | "navigationBarTitleText": "å
¥åºç®¡ç", |
| | | "navigationStyle": "custom", |
| | | "enablePullDownRefresh": true, |
| | | "backgroundColor": "#f8f8f8" |
| | | } |
| | | }, |
| | | { |
| | | "path": "receiptManagement/edit", |
| | | "style": { |
| | | "navigationBarTitleText": "èªå®ä¹å
¥åº", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "issueManagement/index", |
| | | "style": { |
| | | "navigationBarTitleText": "åºåºç®¡ç", |
| | | "navigationStyle": "custom", |
| | | "enablePullDownRefresh": true, |
| | | "backgroundColor": "#f8f8f8" |
| | | } |
| | | }, |
| | | { |
| | | "path": "issueManagement/edit", |
| | | "style": { |
| | | "navigationBarTitleText": "èªå®ä¹åºåº", |
| | | "navigationStyle": "custom" |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | ], |
| | | "tabBar": { |
| | | "color": "#000000", |
| | |
| | | <!-- </view>--> |
| | | <!-- </view>--> |
| | | <!-- </view>--> |
| | | |
| | | <!-- ä»å¨ç©æµæ¨¡å --> |
| | | <view class="common-module marketing-module"> |
| | | <view class="module-header"> |
| | | <view class="module-title-container"> |
| | | <text class="module-title">ä»å¨ç©æµ</text> |
| | | </view> |
| | | </view> |
| | | <view class="module-content"> |
| | | <up-grid |
| | | :border="false" |
| | | col="4" |
| | | > |
| | | <up-grid-item |
| | | v-for="(item, index) in warehousingLogisticsItems" |
| | | :key="index" |
| | | @click="handleCommonItemClick(item)" |
| | | > |
| | | <view class="icon-container" :style="{ background: item.bgColor }"> |
| | | <up-icon |
| | | :name="item.icon" |
| | | :size="58" |
| | | color="#ffffff" |
| | | ></up-icon> |
| | | </view> |
| | | <text class="item-label">{{item.label}}</text> |
| | | </up-grid-item> |
| | | </up-grid> |
| | | </view> |
| | | </view> |
| | | <!-- è¥éç®¡çæ¨¡å --> |
| | | <view class="common-module marketing-module"> |
| | | <view class="module-header"> |
| | |
| | | currentStatus.value = statusList[statusIndex] |
| | | }, 3000) |
| | | } |
| | | |
| | | //ä»å¨ç©æµåè½æ°æ® |
| | | const warehousingLogisticsItems = reactive([ |
| | | { |
| | | icon: '/static/images/icon/xiaoshoutaizhang@2x.png', |
| | | label: 'å
¥åºç®¡ç', |
| | | }, |
| | | { |
| | | icon: '/static/images/icon/kaipiaodengji@2x.png', |
| | | label: 'åºåºç®¡ç', |
| | | }, |
| | | { |
| | | icon: '/static/images/icon/kaipiaotaizhang@2x.png', |
| | | label: 'åºåºå°è´¦', |
| | | }, |
| | | { |
| | | icon: '/static/images/icon/huikuandengji@2x.png', |
| | | label: 'åºå管ç', |
| | | } |
| | | ]); |
| | | |
| | | // è¥é管çåè½æ°æ® |
| | | const marketingItems = reactive([ |
| | |
| | | url: '/pages/equipmentManagement/verification/index' |
| | | }); |
| | | break; |
| | | case 'å
¥åºç®¡ç': |
| | | uni.navigateTo({ |
| | | url: '/pages/inventoryManagement/receiptManagement/index' |
| | | }); |
| | | break |
| | | case 'åºåºç®¡ç': |
| | | uni.navigateTo({ |
| | | url: '/pages/inventoryManagement/issueManagement/index' |
| | | }); |
| | | break |
| | | default: |
| | | uni.showToast({ |
| | | title: `ç¹å»äº${item.label}`, |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <PageHeader :title="pageTitle" @back="goBack" /> |
| | | <view class="account-detail"> |
| | | <view class="box"> |
| | | <view class="form-box"> |
| | | <uni-forms :key="index" label-position="top" label-width="400rpx"> |
| | | |
| | | <uni-forms-item label="åç§°" required> |
| | | <uni-easyinput v-model="productCategory" placeholder="" disabled /> |
| | | </uni-forms-item> |
| | | <uni-forms-item label="åºåºæ°é/ä»¶" required> |
| | | <uni-number-box v-model="goods.quantity" :min="0"></uni-number-box> |
| | | </uni-forms-item> |
| | | <uni-forms-item label="åºåºæ¥æ" required> |
| | | <uni-datetime-picker type="date" :clear-icon="false" v-model="goods.time" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item label="åºåºäºº" required> |
| | | <picker :range="userList" @change="swichUser" range-key="nickName"> |
| | | <text>{{ userName||'è¯·éæ©' }}</text> |
| | | </picker> |
| | | </uni-forms-item> |
| | | </uni-forms> |
| | | </view> |
| | | <view style="display: flex;justify-content: flex-end;"> |
| | | <button class="mini-btn" type="primary" size="mini" |
| | | style="margin-left: 0;margin-right: 0;margin-right: 20rpx;" @click="submitForm">ç¡®å®</button> |
| | | <button class="mini-btn" size="mini" style="margin-left: 0;margin-right: 0;" @click="goBack">åæ¶</button> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref } from 'vue' |
| | | import { stockout } from '@/api/inventoryManagement/issueManagement.js' |
| | | const productCategory = ref('') |
| | | import { userListNoPageByTenantId } from "@/api/system/user" |
| | | const pageTitle = ref('é¢ç¨äº§å') |
| | | const userList = ref([]) |
| | | const userName = ref('') |
| | | const goods = ref({ |
| | | id: 0, |
| | | quantity: 0, |
| | | salesLedgerProductId: 0, |
| | | time: "", |
| | | type: 3, |
| | | userId: undefined |
| | | }) |
| | | const props = defineProps(['goods']) |
| | | |
| | | const goBack = () => { |
| | | uni.navigateBack() |
| | | } |
| | | const submitForm = async () => { |
| | | let res = await stockout(goods.value) |
| | | if (res.code !== 200) { |
| | | uni.showToast({ |
| | | title: res.msg, |
| | | icon: 'none' |
| | | }) |
| | | return |
| | | } |
| | | uni.showToast({ |
| | | title: 'æåé¢ç¨', |
| | | icon: 'none' |
| | | }) |
| | | goBack() |
| | | } |
| | | const initContacts = () => { |
| | | userListNoPageByTenantId().then((res) => { |
| | | console.log('userListNoPageByTenantId',res.data) |
| | | userList.value = res.data |
| | | }) |
| | | } |
| | | |
| | | const swichUser = (e) => { |
| | | goods.value.userId = userList.value[e.detail.value].userId |
| | | userName.value = userList.value[e.detail.value].nickName |
| | | } |
| | | |
| | | |
| | | onMounted(() => { |
| | | let _goods = JSON.parse(props.goods) |
| | | goods.value.id = _goods.id |
| | | productCategory.value = _goods.productCategory |
| | | initContacts() |
| | | }) |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | .box { |
| | | background-color: #fff; |
| | | box-sizing: border-box; |
| | | padding: 20rpx; |
| | | min-height: 80rpx; |
| | | padding-bottom: calc(30rpx + env(safe-area-inset-bottom)); |
| | | } |
| | | |
| | | .form-box { |
| | | box-sizing: border-box; |
| | | margin-bottom: 20rpx; |
| | | padding: 20rpx; |
| | | background-color: #f5f5f5; |
| | | border-radius: 20rpx; |
| | | } |
| | | |
| | | .add-img { |
| | | .img { |
| | | background-color: #efefef; |
| | | border-radius: 10rpx; |
| | | width: 200rpx; |
| | | height: 200rpx; |
| | | } |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view> |
| | | <PageHeader title="åºåºç®¡ç" @back="goBack" /> |
| | | <view class="tabs"> |
| | | <uni-segmented-control :current="tabCurrent" :values="tabItems" @clickItem="switchTab" /> |
| | | </view> |
| | | <view v-if="contentList?.length !== 0" class="content"> |
| | | <view v-if="tabCurrent === 0"> |
| | | <block v-for="item in contentList" :key="item.id"> |
| | | <view class="item-box item-box0"></view> |
| | | </block> |
| | | <uni-load-more :status="loadMoreStatus"></uni-load-more> |
| | | </view> |
| | | <view v-if="tabCurrent === 1"> |
| | | <block v-for="item in contentList" :key="item.id"> |
| | | <view class="item-box item-box1"> |
| | | <view class="item"> |
| | | <view class="label">产åå¾ç</view> |
| | | <view class="value"> |
| | | <image class="img" :src="baseUrl + item.url" mode="aspectFillâ" lazy-load></image> |
| | | </view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="label">å
¥åºæ¶é´</view> |
| | | <view class="value">{{ item.inboundDate }}</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="label">产ååç§°</view> |
| | | <view class="value">{{ item.productCategory }}</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="label">产åé«åº¦</view> |
| | | <view class="value">{{ item.specificationModel }}{{ item.unit }}</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="label">å
¥åºæ°é/ä»¶</view> |
| | | <view class="value">{{ item.inboundNum }}</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="label">åºåæ°é/ä»¶</view> |
| | | <view class="value">{{ item.inboundNum0 }}</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="label">æ¯ä»¶æ°é/æ¯</view> |
| | | <view class="value">{{ item.boxNum }}</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="label">åä»·ï¼å
ï¼/æ¯</view> |
| | | <view class="value">{{ item.taxInclusiveUnitPrice }}</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="label">çº¸ç®±è§æ ¼</view> |
| | | <view class="value">{{ item.cartonSpecifications }}cm</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="label">å
¥åºäºº</view> |
| | | <view class="value">{{ item.createBy }}</view> |
| | | </view> |
| | | <view class="item" style="justify-content: flex-end;"> |
| | | <button class="mini-btn" type="primary" size="mini" style="margin-left: 0;margin-right: 0;" |
| | | @click="openForm(item, 'edit')">é¢ç¨</button> |
| | | </view> |
| | | </view> |
| | | </block> |
| | | <uni-load-more :status="loadMoreStatus"></uni-load-more> |
| | | </view> |
| | | </view> |
| | | <view v-if="contentList?.length === 0" class="no-data"> |
| | | <text>ææ æ°æ®</text> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, computed } from 'vue' |
| | | import { listPage, listPageByCustom } from '@/api/inventoryManagement/issueManagement.js' |
| | | import { onShow, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app' |
| | | import config from '@/config' |
| | | const baseUrl = config.baseUrl |
| | | // tabç¸å
³ |
| | | const tabItems = reactive(['éè´åºåº', 'æååºåº']) |
| | | const tabCurrent = ref(0) |
| | | |
| | | const switchTab = (e) => { |
| | | if (tabCurrent.value !== e.currentIndex) { |
| | | tabCurrent.value = e.currentIndex |
| | | } |
| | | reloadPage() |
| | | } |
| | | |
| | | // è¿åä¸ä¸é¡µ |
| | | const goBack = () => { |
| | | uni.navigateBack() |
| | | } |
| | | |
| | | // æå¼ç¼è¾/æ°å¢ |
| | | const openForm = (goods, type) => { |
| | | uni.navigateTo({ |
| | | url: '/pages/inventoryManagement/issueManagement/edit?goods=' + JSON.stringify(goods) |
| | | }) |
| | | } |
| | | |
| | | // å页ç¸å
³ |
| | | const pageParams = reactive({ |
| | | size: 10, |
| | | current: 1 |
| | | }) |
| | | const totalSize = ref(0) |
| | | const noMore = computed(() => { |
| | | return contentList.value.length >= totalSize.value |
| | | }) |
| | | const loading = ref(false) |
| | | const contentList = ref([]) |
| | | const loadMoreStatus = computed(() => { |
| | | if (loading.value) { |
| | | return 'loading' |
| | | } |
| | | if (noMore.value) { |
| | | return 'noMore' |
| | | } |
| | | return 'more' |
| | | }) |
| | | const loadPage = () => { |
| | | if (noMore.value || loading.value) { |
| | | return |
| | | } |
| | | pageParams.current += 1 |
| | | getList() |
| | | } |
| | | const reloadPage = () => { |
| | | pageParams.current = 1 |
| | | contentList.value = [] |
| | | getList() |
| | | } |
| | | const getList = async () => { |
| | | let getListApi = null |
| | | if (tabCurrent.value == 1) { |
| | | getListApi = listPageByCustom |
| | | } else if (tabCurrent.value == 0) { |
| | | getListApi = listPage |
| | | } |
| | | loading.value = true |
| | | let resp = await getListApi(pageParams) |
| | | loading.value = false |
| | | if (resp.code != 200 || !resp.data) { |
| | | contentList.value = [] |
| | | totalSize.value = 0 |
| | | return |
| | | } |
| | | contentList.value = [...contentList.value, ...resp.data.records] |
| | | console.log(resp.data.records) |
| | | totalSize.value = resp.data.total |
| | | } |
| | | |
| | | onReachBottom(() => { |
| | | loadPage() |
| | | }) |
| | | onPullDownRefresh(() => { |
| | | reloadPage() |
| | | uni.stopPullDownRefresh() |
| | | }) |
| | | onShow(() => { |
| | | reloadPage() |
| | | }) |
| | | |
| | | </script> |
| | | |
| | | <style lang='scss' scoped> |
| | | .tabs { |
| | | box-sizing: border-box; |
| | | padding: 20rpx 40rpx; |
| | | } |
| | | |
| | | .no-data { |
| | | text-align: center; |
| | | padding: 40px 20px; |
| | | color: #999; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .item-box { |
| | | box-sizing: border-box; |
| | | margin: 20rpx; |
| | | padding: 20rpx; |
| | | border-radius: 10rpx; |
| | | background-color: #f5f5f5; |
| | | } |
| | | |
| | | .item { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | margin: 10rpx 0; |
| | | |
| | | .label {} |
| | | |
| | | .value { |
| | | .img { |
| | | width: 200rpx; |
| | | height: 200rpx; |
| | | background-color: #999; |
| | | border-radius: 10rpx; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // æµ®å¨æé®æ ·å¼ |
| | | .fab-button { |
| | | position: fixed; |
| | | bottom: calc(30px + env(safe-area-inset-bottom)); |
| | | right: 30px; |
| | | width: 56px; |
| | | height: 56px; |
| | | background: #2979ff; |
| | | border-radius: 50%; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | box-shadow: 0 4px 16px rgba(41, 121, 255, 0.3); |
| | | z-index: 1000; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <PageHeader :title="pageTitle" @back="goBack" /> |
| | | <view class="account-detail"> |
| | | <view class="box"> |
| | | <view v-if="type == 'add'"> |
| | | <button class="mini-btn" type="primary" size="mini" style="margin-left: 0;margin-right: 0;" |
| | | @click="addItem">æ°å¢</button> |
| | | </view> |
| | | <view v-for="(item, index) in goodsList" class="form-box"> |
| | | <uni-forms :key="index" label-position="top" label-width="400rpx"> |
| | | <uni-forms-item label="产åå¾ç" required> |
| | | <view class="add-img"> |
| | | <image v-if="item.url" class="img" :src="baseUrl + item.url" mode="aspectFill" /> |
| | | <uni-icons v-else type="camera-filled" size="56" style="color: #8a8a8a" |
| | | @click="addImg(index)"></uni-icons> |
| | | </view> |
| | | </uni-forms-item> |
| | | <uni-forms-item label="åç§°" required> |
| | | <uni-easyinput v-model="item.productCategory" placeholder="请è¾å
¥åç§°" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item label="é«åº¦" required> |
| | | <uni-easyinput v-model="item.specificationModel" type="number" placeholder="请è¾å
¥é«åº¦" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item label="é«åº¦åä½" required> |
| | | <uni-easyinput v-model="item.unit" placeholder="请è¾å
¥é«åº¦åä½" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item label="çº¸ç®±è§æ ¼" required> |
| | | <uni-easyinput v-model="item.cartonSpecifications" placeholder="请è¾å
¥çº¸ç®±è§æ ¼" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item label="å
¥åºæ°é/ä»¶" required> |
| | | <uni-number-box v-model="item.inboundNum" :min="0"></uni-number-box> |
| | | </uni-forms-item> |
| | | <uni-forms-item label="æ¯ä»¶æ°é/æ¯" required> |
| | | <uni-number-box v-model="item.boxNum" :min="0"></uni-number-box> |
| | | </uni-forms-item> |
| | | <uni-forms-item label="åä»·ï¼å
ï¼/æ¯" required> |
| | | <uni-number-box v-model="item.taxInclusiveUnitPrice" :min="0" :step="0.01"></uni-number-box> |
| | | </uni-forms-item> |
| | | <uni-forms-item label="å
¥åºæ¥æ" required> |
| | | <uni-datetime-picker type="date" :clear-icon="false" v-model="item.inboundDate" /> |
| | | </uni-forms-item> |
| | | </uni-forms> |
| | | </view> |
| | | <view style="display: flex;justify-content: flex-end;"> |
| | | <button class="mini-btn" type="primary" size="mini" |
| | | style="margin-left: 0;margin-right: 0;margin-right: 20rpx;" @click="submitForm">ç¡®å®</button> |
| | | <button class="mini-btn" size="mini" style="margin-left: 0;margin-right: 0;" @click="goBack">åæ¶</button> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref } from 'vue' |
| | | import { getToken } from "@/utils/auth"; |
| | | import { addCustom } from '@/api/inventoryManagement/receiptManagement.js' |
| | | import config from '@/config' |
| | | const baseUrl = config.baseUrl |
| | | const pageTitle = ref('æ°å¢èªå®ä¹å
¥åº') |
| | | const goodsList = ref([]) |
| | | const type = ref('add') |
| | | const props = defineProps(['goods']) |
| | | const defaultGoods = { |
| | | boxNum: 0, |
| | | cartonSpecifications: "", |
| | | id: null, |
| | | inboundDate: "", |
| | | inboundNum: 0, |
| | | itemType: "", |
| | | productCategory: "", |
| | | specificationModel: "", |
| | | supplierName: "", |
| | | taxExclusiveTotalPrice: 0, |
| | | taxInclusiveTotalPrice: 0, |
| | | taxInclusiveUnitPrice: 0, |
| | | taxRate: 0, |
| | | unit: "", |
| | | url: "", |
| | | } |
| | | |
| | | const goBack = () => { |
| | | uni.navigateBack() |
| | | } |
| | | const submitForm = async() => { |
| | | let res = await addCustom(goodsList.value) |
| | | if(res.code !== 200){ |
| | | uni.showToast({ |
| | | title: res.msg, |
| | | icon: 'none' |
| | | }) |
| | | return |
| | | } |
| | | uni.showToast({ |
| | | title: 'æ°å¢æå', |
| | | icon: 'none' |
| | | }) |
| | | goBack() |
| | | } |
| | | |
| | | const addImg = (index) => { |
| | | uni.chooseMedia({ |
| | | count: 1, |
| | | mediaType: ['image'], |
| | | sourceType: ['album', 'camera'], |
| | | sizeType: ['original', 'compressed'], |
| | | success: (res) => { |
| | | let imgList = [] |
| | | let isHeGe = true |
| | | if (res.tempFiles && res.tempFiles.length) { |
| | | res.tempFiles.forEach(item => { |
| | | imgList.push(item.tempFilePath) |
| | | if (item.size > 10000000) { |
| | | isHeGe = false |
| | | } |
| | | }) |
| | | } |
| | | if (!isHeGe) { |
| | | uni.showToast({ |
| | | title: "å¾çä¸è½å¤§äº10M", |
| | | icon: "none" |
| | | }) |
| | | return |
| | | } |
| | | UploadImage(imgList[0], index) |
| | | }, |
| | | fail: (e) => { |
| | | console.log('chooseMedia:fail', e) |
| | | if (e.errMsg == 'chooseMedia:fail cancel') { |
| | | return |
| | | } |
| | | uni.showToast({ |
| | | title: "ä¸ä¼ 失败", |
| | | icon: 'none', |
| | | duration: 1500 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | const UploadImage = (url, index) => { |
| | | uni.uploadFile({ |
| | | url: baseUrl + '/file/upload', // æ¿æ¢ä¸ºå®é
çä¸ä¼ æ¥å£ |
| | | filePath: url, |
| | | name: 'file', |
| | | header: { Authorization: 'Bearer ' + getToken() }, |
| | | success: (res) => { |
| | | const data = JSON.parse(res.data) |
| | | if (data.code === 200) { |
| | | goodsList.value[index].url = data.data.tempPath |
| | | uni.showToast({ |
| | | title: 'ä¸ä¼ æå', |
| | | icon: 'none', |
| | | duration: 1500 |
| | | }) |
| | | } else { |
| | | console.log('ä¸ä¼ 失败', res) |
| | | uni.showToast({ |
| | | title: 'ä¸ä¼ 失败', |
| | | icon: 'none' |
| | | }) |
| | | } |
| | | }, |
| | | fail: (e) => { |
| | | console.log('uploadFile:fail', e) |
| | | uni.showToast({ |
| | | title: 'ä¸ä¼ 失败', |
| | | icon: 'none' |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | onMounted(() => { |
| | | let _goods = JSON.parse(props.goods) |
| | | if (_goods.id) { |
| | | pageTitle.value = 'ç¼è¾èªå®ä¹å
¥åº' |
| | | type.value = 'edit' |
| | | } |
| | | goodsList.value.push({...defaultGoods,..._goods}) |
| | | }) |
| | | const addItem = () => { |
| | | goodsList.value.push({...defaultGoods}) |
| | | } |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | .box { |
| | | background-color: #fff; |
| | | box-sizing: border-box; |
| | | padding: 20rpx; |
| | | min-height: 80rpx; |
| | | padding-bottom: calc(30rpx + env(safe-area-inset-bottom)); |
| | | } |
| | | |
| | | .form-box { |
| | | box-sizing: border-box; |
| | | margin-bottom: 20rpx; |
| | | padding: 20rpx; |
| | | background-color: #f5f5f5; |
| | | border-radius: 20rpx; |
| | | } |
| | | |
| | | .add-img { |
| | | .img { |
| | | background-color: #efefef; |
| | | border-radius: 10rpx; |
| | | width: 200rpx; |
| | | height: 200rpx; |
| | | } |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view> |
| | | <PageHeader title="å
¥åºç®¡ç" @back="goBack" /> |
| | | <view class="tabs"> |
| | | <uni-segmented-control :current="tabCurrent" :values="tabItems" @clickItem="switchTab" /> |
| | | </view> |
| | | <!-- <button class="mini-btn" type="primary" size="mini" style="margin-left: 0;margin-right: 0;" @click="openForm({},'add')">æ°å¢å
¥åº</button> --> |
| | | <view v-if="contentList?.length !== 0" class="content"> |
| | | <view v-if="tabCurrent === 0"> |
| | | <block v-for="item in contentList" :key="item.id"> |
| | | <view class="item-box item-box0"></view> |
| | | </block> |
| | | <uni-load-more :status="loadMoreStatus"></uni-load-more> |
| | | </view> |
| | | <view v-if="tabCurrent === 1"> |
| | | <block v-for="item in contentList" :key="item.id"> |
| | | <view class="item-box item-box1"> |
| | | <view class="item"> |
| | | <view class="label">产åå¾ç</view> |
| | | <view class="value"> |
| | | <image class="img" :src="baseUrl + item.url" mode="aspectFillâ" lazy-load></image> |
| | | </view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="label">å
¥åºæ¶é´</view> |
| | | <view class="value">{{ item.inboundDate }}</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="label">产ååç§°</view> |
| | | <view class="value">{{ item.productCategory }}</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="label">产åé«åº¦</view> |
| | | <view class="value">{{ item.specificationModel }}{{ item.unit }}</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="label">å
¥åºæ°é/ä»¶</view> |
| | | <view class="value">{{ item.inboundNum }}</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="label">æ¯ä»¶æ°é/æ¯</view> |
| | | <view class="value">{{ item.boxNum }}</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="label">åä»·ï¼å
ï¼/æ¯</view> |
| | | <view class="value">{{ item.taxInclusiveUnitPrice }}</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="label">çº¸ç®±è§æ ¼</view> |
| | | <view class="value">{{ item.cartonSpecifications }}cm</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="label">å
¥åºäºº</view> |
| | | <view class="value">{{ item.createBy }}</view> |
| | | </view> |
| | | <view class="item" style="justify-content: flex-end;"> |
| | | <button class="mini-btn" type="primary" size="mini" style="margin-left: 0;margin-right: 0;" @click="openForm(item,'edit')">ç¼è¾</button> |
| | | </view> |
| | | </view> |
| | | </block> |
| | | <uni-load-more :status="loadMoreStatus"></uni-load-more> |
| | | </view> |
| | | </view> |
| | | <view class="fab-button" @click="openForm({},'add')"> |
| | | <up-icon name="plus" size="24" color="#ffffff"></up-icon> |
| | | </view> |
| | | <view v-if="contentList?.length === 0" class="no-data"> |
| | | <text>ææ æ°æ®</text> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, computed } from 'vue' |
| | | import { listPage, listPageByCustom } from '@/api/inventoryManagement/receiptManagement.js' |
| | | import { onShow, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app' |
| | | import config from '@/config' |
| | | const baseUrl = config.baseUrl |
| | | // tabç¸å
³ |
| | | const tabItems = reactive(['éè´å
¥åº', 'æåå
¥åº']) |
| | | const tabCurrent = ref(0) |
| | | |
| | | const switchTab = (e) => { |
| | | if (tabCurrent.value !== e.currentIndex) { |
| | | tabCurrent.value = e.currentIndex |
| | | } |
| | | reloadPage() |
| | | } |
| | | |
| | | // è¿åä¸ä¸é¡µ |
| | | const goBack = () => { |
| | | uni.navigateBack() |
| | | } |
| | | |
| | | // æå¼ç¼è¾/æ°å¢ |
| | | const openForm = (goods,type) => { |
| | | uni.navigateTo({ |
| | | url: '/pages/inventoryManagement/receiptManagement/edit?goods=' + JSON.stringify(goods) |
| | | }) |
| | | } |
| | | |
| | | // å页ç¸å
³ |
| | | const pageParams = reactive({ |
| | | size: 10, |
| | | current: 1 |
| | | }) |
| | | const totalSize = ref(0) |
| | | const noMore = computed(() => { |
| | | return contentList.value.length >= totalSize.value |
| | | }) |
| | | const loading = ref(false) |
| | | const contentList = ref([]) |
| | | const loadMoreStatus = computed(() => { |
| | | if (loading.value) { |
| | | return 'loading' |
| | | } |
| | | if (noMore.value) { |
| | | return 'noMore' |
| | | } |
| | | return 'more' |
| | | }) |
| | | const loadPage = () => { |
| | | if (noMore.value || loading.value) { |
| | | return |
| | | } |
| | | pageParams.current += 1 |
| | | getList() |
| | | } |
| | | const reloadPage = () => { |
| | | pageParams.current = 1 |
| | | contentList.value = [] |
| | | getList() |
| | | } |
| | | const getList = async () => { |
| | | let getListApi = null |
| | | if (tabCurrent.value == 1) { |
| | | getListApi = listPageByCustom |
| | | } else if (tabCurrent.value == 0) { |
| | | getListApi = listPage |
| | | } |
| | | loading.value = true |
| | | let resp = await getListApi(pageParams) |
| | | loading.value = false |
| | | if (resp.code != 200 || !resp.data) { |
| | | contentList.value = [] |
| | | totalSize.value = 0 |
| | | return |
| | | } |
| | | contentList.value = [...contentList.value, ...resp.data.records] |
| | | console.log(resp.data.records) |
| | | totalSize.value = resp.data.total |
| | | } |
| | | |
| | | onReachBottom(() => { |
| | | loadPage() |
| | | }) |
| | | onPullDownRefresh(() => { |
| | | reloadPage() |
| | | uni.stopPullDownRefresh() |
| | | }) |
| | | onShow(() => { |
| | | reloadPage() |
| | | }) |
| | | |
| | | </script> |
| | | |
| | | <style lang='scss' scoped> |
| | | .tabs { |
| | | box-sizing: border-box; |
| | | padding: 20rpx 40rpx; |
| | | } |
| | | |
| | | .no-data { |
| | | text-align: center; |
| | | padding: 40px 20px; |
| | | color: #999; |
| | | font-size: 14px; |
| | | } |
| | | .item-box{ |
| | | box-sizing: border-box; |
| | | margin: 20rpx; |
| | | padding: 20rpx; |
| | | border-radius: 10rpx; |
| | | background-color: #f5f5f5; |
| | | } |
| | | |
| | | .item { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | margin: 10rpx 0; |
| | | |
| | | .label {} |
| | | |
| | | .value { |
| | | .img { |
| | | width: 200rpx; |
| | | height: 200rpx; |
| | | background-color: #999; |
| | | border-radius: 10rpx; |
| | | } |
| | | } |
| | | } |
| | | // æµ®å¨æé®æ ·å¼ |
| | | .fab-button { |
| | | position: fixed; |
| | | bottom: calc(30px + env(safe-area-inset-bottom)); |
| | | right: 30px; |
| | | width: 56px; |
| | | height: 56px; |
| | | background: #2979ff; |
| | | border-radius: 50%; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | box-shadow: 0 4px 16px rgba(41, 121, 255, 0.3); |
| | | z-index: 1000; |
| | | } |
| | | </style> |