diff --git a/components/my-components/my-reportDamage.vue b/components/my-components/my-reportDamage.vue index 9c70e87..e71d6cd 100644 --- a/components/my-components/my-reportDamage.vue +++ b/components/my-components/my-reportDamage.vue @@ -2,24 +2,24 @@ - {{item.title}} - + {{title}} + - - {{item.name}} + + {{item.conName}} - {{vdata.num}} + {{vdata.stockNumber}} 商品单位 - + {{item.conUnit}} 报损图片 @@ -49,14 +49,25 @@ computed, ref, reactive, + onMounted, watch } from 'vue'; import { $uploadFile } from '@/http/yskApi/file.js' + import { consumableBreakage , productBreakage ,tbConCheck} from '@/http/yskApi/breakage.js' + const props = defineProps({ show:{ type: Boolean, default: false }, + type:{ + type: String, + default: "" + }, + title:{ + type: String, + default: "" + }, item:{ type: Object, }, @@ -64,16 +75,23 @@ }) const emits = defineEmits(['close','open',"affirm"]) const vdata = reactive({ - num: 1, + stockNumber: 1, imgUrlList: [], }) + let show = ref(props.show) + let type = ref(props.type) + let itemData = ref(props.item) watch(()=>props.show,(newval)=>{ show.value=newval }) - let show = ref(props.show) - + onMounted(() => { + + }) + function close() { - show.value = false + show.value = false; + vdata.imgUrlList = []; + vdata.stockNumber = 1; emits('close') } @@ -81,7 +99,7 @@ * 打开报损弹窗 */ function open() { - show.value = true + show.value = true; emits('open') } @@ -89,17 +107,17 @@ * 报损数量减少 */ function minus() { - if ( vdata.num <= 1) { + if ( vdata.stockNumber <= 1) { return; } - vdata.num--; + vdata.stockNumber--; } /** * 报损数量增加 */ function plus() { - vdata.num++; + vdata.stockNumber++; } @@ -155,7 +173,28 @@ * 确认 */ function affirm () { - emits('affirm') + // emits('affirm') + if (vdata.imgUrlList.length <= 0) { + uni.showToast({ + title:'请上传报损图片', + icon:'none' + }) + return; + } + let params = { + coverImg: vdata.imgUrlList, + } + //商品报损 + if ( type.value == 'consumable') { + params.consId = itemData.value.conIn; + params.amount = vdata.stockNumber; + } + + consumableBreakage(params).then((res) => { + show.value = false; + vdata.imgUrlList = []; + vdata.stockNumber = 1; + }) } defineExpose({ diff --git a/http/yskApi/breakage.js b/http/yskApi/breakage.js new file mode 100644 index 0000000..a3c6f2e --- /dev/null +++ b/http/yskApi/breakage.js @@ -0,0 +1,33 @@ +import http from './http.js' +const request=http.request + + +/** + * 商品报损 + * @returns + */ +export function productBreakage(data) { + return request({ + url: `/api/tbProductStockDetail/frmLoss`, + method: 'post', + data:{ + shopId: uni.getStorageSync('shopId'), + ...data + } + }) +} + +/** + * 耗材报损 + * @returns + */ +export function consumableBreakage(data) { + return request({ + url: `/api/tbConsInfoFlow/frmLoss`, + method: 'post', + data:{ + shopId: uni.getStorageSync('shopId'), + ...data + } + }) +} diff --git a/pageInvoicing/index/index.vue b/pageInvoicing/index/index.vue index 4638b51..07492ab 100644 --- a/pageInvoicing/index/index.vue +++ b/pageInvoicing/index/index.vue @@ -71,7 +71,7 @@ - +