修改小程序端提交采购信息

This commit is contained in:
lewis 2024-12-25 17:56:06 +08:00
parent 4e897e94e8
commit 84fa9344d8
2 changed files with 90 additions and 32 deletions

View File

@ -10,3 +10,6 @@ export const purchaseProductOfferUpdate = (data) => {
export const purchaseProductOfferOutboundFloatingLv = (data) => { export const purchaseProductOfferOutboundFloatingLv = (data) => {
return request.get('/purchase_product_offer/purchaseproductoffer/outbound_floating_lv', data); return request.get('/purchase_product_offer/purchaseproductoffer/outbound_floating_lv', data);
} }
export const supplierListApi = (data) => {
return request.get('/purchase_product_offer/purchaseproductoffer/supplier', data);
}

View File

@ -36,8 +36,8 @@
<view class="card-footer"> <view class="card-footer">
<up-button size="small" type="primary" shape="circle" @click="cancleOrder(item)" <up-button size="small" type="primary" shape="circle" @click="cancleOrder(item)"
v-if="item.buyer_confirm==0">确认已采购</up-button> v-if="item.buyer_confirm==0">确认已采购</up-button>
<up-button size="small" type="success" shape="circle" v-else <up-button size="small" type="success" shape="circle" v-else @click="cancleOrder(item)"
disabled>{{item.buyer_confirm_name}}/{{item.update_time}}</up-button> >修改采购信息</up-button>
</view> </view>
<up-line style="margin-top: 30rpx;" color="#F3F3F3"></up-line> <up-line style="margin-top: 30rpx;" color="#F3F3F3"></up-line>
</view> </view>
@ -47,37 +47,49 @@
</up-transition> </up-transition>
<up-modal :show="show" title="采购确认" showCancelButton @cancel="show=false" @confirm="offerUpdate()"> <up-modal :show="show" title="采购确认" showCancelButton @cancel="show=false" @confirm="offerUpdate()">
<up-form labelPosition="left"> <up-form labelPosition="left">
<up-form-item label="供应商" labelWidth='auto'>
<up-input @click="showSupplier = true">
<template #suffix>
<span>{{supplierText}}</span>
</template>
</up-input>
</up-form-item>
<up-form-item label="名称"> <up-form-item label="名称">
<up-input v-model="formData.store_name" border="none" disabled=""></up-input> <up-input v-model="formData.store_name" border="none" disabled=""></up-input>
</up-form-item> </up-form-item>
<up-form-item label="数量"> <up-form-item label="数量">
<up-input v-model="formData.nums" @change='changeInputPrice'> <template #suffix> <up-input v-model="formData.buyer_nums" @change='changeInputPrice'> <template #suffix>
<span>{{formData.unit_name}}</span> <span>{{formData.unit_name}}</span>
</template></up-input> </template></up-input>
</up-form-item> </up-form-item>
<up-form-item label="单价"> <up-form-item label="单价">
<up-input v-model="formData.price" @change='changeInputPrice'></up-input> <up-input v-model="formData.purchase" @change='changeInputPrice'></up-input>
</up-form-item> </up-form-item>
<up-form-item label="总价"> <up-form-item label="总价">
<up-input v-model="formData.total_price"></up-input> <up-input v-model="formData.total_price"></up-input>
</up-form-item> </up-form-item>
<up-form-item label="出库价" labelWidth='auto'>
<up-input @click="pickerShow=true" v-model="formData.outbound_price">
<template #suffix>
<span>{{pickerText}}</span>
</template>
</up-input>
</up-form-item>
<up-form-item label="付款方式" labelWidth='auto'> <up-form-item label="付款方式" labelWidth='auto'>
<up-radio-group v-model="radio_value"> <up-radio-group v-model="radio_value">
<up-radio v-for="(item, index) in radiolist1" :key="index" :label="item.name" <up-radio v-for="(item, index) in radiolist1" :key="index" :label="item.name"
:name="item.name" @change="radioChange"></up-radio> :name="item.name" @change="radioChange"></up-radio>
</up-radio-group> </up-radio-group>
</up-form-item> </up-form-item>
<up-form-item label="包装">
<up-input v-model="formData.package"></up-input>
</up-form-item>
<up-form-item label="规格">
<up-input v-model="formData.store_info"></up-input>
</up-form-item>
<up-form-item label="型号">
<up-input v-model="formData.marques"></up-input>
</up-form-item>
<up-form-item label="售后">
<up-input v-model="formData.after_sales"></up-input>
</up-form-item>
</up-form> </up-form>
</up-modal> </up-modal>
<up-picker :show="pickerShow" :columns="columns" keyName="name" @confirm="pickerConfirm" <up-picker :show="showSupplier" :columns="supplierList" keyName="mer_name" @confirm="supplierConfirm"
@cancel="pickerShow=false"></up-picker> @cancel="showSupplier = false"></up-picker>
</view> </view>
</view> </view>
@ -90,6 +102,7 @@
reactive, reactive,
} from "vue" } from "vue"
import { import {
supplierListApi,
purchaseProductOfferLists, purchaseProductOfferLists,
purchaseProductOfferUpdate, purchaseProductOfferUpdate,
purchaseProductOfferOutboundFloatingLv purchaseProductOfferOutboundFloatingLv
@ -103,22 +116,26 @@
}) })
} }
const show = ref(false) const show = ref(false)
const showSupplier = ref(false)
const supplierText = ref('')
const pickerText = ref('') const pickerText = ref('')
const picker_price = ref(0) const picker_price = ref(0)
const pickerShow = ref(false) const pickerShow = ref(false)
const formData = ref({ const formData = ref({
"id": '', id: '',
"store_name": '', bhoid: '',
'product_id': '', supplier_id: '',
'nums': '', purchase: '',
'price': '', total_price: '',
'total_price': '', buyer_nums: 0,
'outbound_price': '', package: '',
'unit_name': '', store_info: '',
'pay_type':1 marques: '',
after_sales: '',
pay_type: 1
}) })
// tabsindex // tabsindex
const radiolist1=ref([{name:'赊账'},{name:'现金'}]) const radiolist1=ref([{name:'赊账', value: 1},{name:'现金', value: 2}])
const radio_value=ref('赊账') const radio_value=ref('赊账')
const tabIndex = ref(1) const tabIndex = ref(1)
const { const {
@ -144,6 +161,17 @@
let res = await purchaseProductOfferLists(where.value) let res = await purchaseProductOfferLists(where.value)
goodsList1.value = res.data.lists goodsList1.value = res.data.lists
} }
const supplierList = ref([])
const getSupplierList = () => {
supplierListApi().then(res => {
supplierList.value = [res.data.lists]
})
}
const supplierConfirm = (e) => {
showSupplier.value = false
supplierText.value = e.value[0].mer_name
formData.value.supplier_id = e.value[0].id
}
const cancleOrder = (item) => { const cancleOrder = (item) => {
columns.value[0].forEach(e => { columns.value[0].forEach(e => {
if (e['name_b'] == item['category_name']) { if (e['name_b'] == item['category_name']) {
@ -154,9 +182,38 @@
show.value = true show.value = true
formData.value.store_name = item['store_name'] formData.value.store_name = item['store_name']
formData.value.id = item['id'] formData.value.id = item['id']
formData.value.nums = item['need_num'] formData.value.bhoid = item.order_id
formData.value.buyer_nums = item['need_num']
formData.value.product_id = item['product_id'] formData.value.product_id = item['product_id']
formData.value.unit_name = item['unit_name'] formData.value.unit_name = item['unit_name']
if (item.buyer_confirm == 1) {
formData.value.purchase = item.price
formData.value.buyer_nums = item.buyer_nums
formData.value.total_price = item.total_price
formData.value.supplier_id = item.supplier_id
formData.value.package = item.package
formData.value.store_info = item.store_info
formData.value.marques = item.marques
formData.value.after_sales = item.after_sales
formData.value.pay_type = item.pay_type
supplierText.value = item.supplier_name
if (item.pay_type == 1) {
radio_value.value = '赊账'
} else {
radio_value.value = '现金'
}
} else {
formData.value.purchase = ''
formData.value.total_price =
formData.value.supplier_id = ''
formData.value.package = ''
formData.value.store_info = ''
formData.value.marques = ''
formData.value.after_sales = ''
formData.value.pay_type = 1
supplierText.value = ''
radio_value.value = '赊账'
}
} }
const offerUpdate = () => { const offerUpdate = () => {
purchaseProductOfferUpdate(formData.value).then(res => { purchaseProductOfferUpdate(formData.value).then(res => {
@ -166,16 +223,13 @@
}) })
} }
const changeInputPrice = (e) => { const changeInputPrice = (e) => {
if (formData.value.nums > 0 && formData.value.price > 0) { if (formData.value.buyer_nums > 0 && formData.value.purchase > 0) {
formData.value.total_price = (formData.value.nums * formData.value.price).toFixed(2) formData.value.total_price = (formData.value.buyer_nums * formData.value.purchase).toFixed(2)
if (picker_price.value > 0) {
let outbound_price = (formData.value.price * picker_price.value)
formData.value.outbound_price = (parseInt(formData.value.price) + outbound_price).toFixed(2)
}
} }
} }
const sectionChange = (index) => { const sectionChange = (index) => {
where.value.buyer_confirm = index where.value.buyer_confirm = index
goodsList1.value = []
getGoodsList() getGoodsList()
} }
const columns = ref([]); const columns = ref([]);
@ -192,13 +246,14 @@
} }
const radioChange=(e)=>{ const radioChange=(e)=>{
if(e=='赊账'){ if(e=='赊账'){
formData.pay_type=1 formData.value.pay_type = 1
}else{ }else{
formData.pay_type=2 formData.value.pay_type = 2
} }
} }
getGoodsList() getGoodsList()
OutboundFloatingLv() OutboundFloatingLv()
getSupplierList()
</script> </script>
<style lang="scss"> <style lang="scss">