feat: 添加采购商品列表和获取功能,优化订单获取逻辑

This commit is contained in:
mkm 2024-08-14 22:59:44 +08:00
parent 937730558c
commit d7255d9690
4 changed files with 71 additions and 23 deletions

View File

@ -3,3 +3,7 @@ import request from '@/utils/request';
export const purchaseProductOfferLists = (data) => { export const purchaseProductOfferLists = (data) => {
return request.get('/purchase_product_offer/purchaseproductoffer/lists', data); return request.get('/purchase_product_offer/purchaseproductoffer/lists', data);
} }
//报价单提交
export const purchaseProductOfferUpdate = (data) => {
return request.post('/purchase_product_offer/purchaseproductoffer/offer_update', data);
}

View File

@ -17,7 +17,7 @@ switch (env) {
WSS_URL = 'wss://ceshi-multi-store.lihaink.cn/pull' WSS_URL = 'wss://ceshi-multi-store.lihaink.cn/pull'
break; break;
case 'local': case 'local':
BASE_URL = 'http://192.168.1.22:8545'; BASE_URL = 'http://192.168.1.7:8545';
WSS_URL = 'wss://ceshi-multi-store.lihaink.cn/pull' WSS_URL = 'wss://ceshi-multi-store.lihaink.cn/pull'
break; break;
default: default:

View File

@ -1,8 +1,8 @@
<template> <template>
<view> <view>
<view class="content"> <view class="content">
<up-transition mode="slide-left"> <up-transition :show="true" mode="slide-left">
<view class="a" v-if="goodsList1.length>0"> <view v-if="goodsList1.length>0">
<view class="card" v-for="(item,index) in goodsList1" :key='index'> <view class="card" v-for="(item,index) in goodsList1" :key='index'>
<view class="head"> <view class="head">
<!-- <text> {{orer_sn}}</text> --> <!-- <text> {{orer_sn}}</text> -->
@ -16,15 +16,24 @@
<view class="title ellipsis"> <view class="title ellipsis">
{{item.store_name}} {{item.store_name}}
</view> </view>
<view class="need"> <view>
单位:{{item.unit_name}}
</view>
<view>
规格:{{item.store_info}}
</view>
<view style="color: red;">
需求量 {{item.need_num}} 需求量 {{item.need_num}}
</view> </view>
</view> </view>
</view> </view>
<view class="card-footer" v-if="item.nums && item.price">
{{item.nums}}{{item.unit_name}}&nbsp; &nbsp;合计:<text <view class="card-footer">
style="font-size: 28rpx;color: #FC452F;font-weight: 700;">{{item.nums*item.price}}</text> <up-button size="small" type="primary" shape="circle"
@click="cancleOrder(item)" v-if="item.buyer_confirm==0">确认已采购</up-button>
<up-button size="small" type="success" shape="circle"
v-else disabled >{{item.buyer_confirm_name}}</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>
@ -33,6 +42,23 @@
</up-empty> </up-empty>
<!-- <button @click="test2">叫我按钮</button> --> <!-- <button @click="test2">叫我按钮</button> -->
</up-transition> </up-transition>
<up-modal :show="show" title="采购确认" showCancelButton @cancel="show=false" @confirm="offerUpdate()">
<up-form labelPosition="left">
<up-form-item label="名称">
<up-input v-model="formData.store_name" border="none"></up-input>
</up-form-item>
<up-form-item label="数量">
<up-input v-model="formData.nums" border="none" @change='changeInputPrice'></up-input>
</up-form-item>
<up-form-item label="单价">
<up-input v-model="formData.price" border="none" @change='changeInputPrice'></up-input>
</up-form-item>
<up-form-item label="总价">
<up-input v-model="formData.total_price" border="none"></up-input>
</up-form-item>
</up-form>
</up-modal>
</view> </view>
</view> </view>
</template> </template>
@ -44,7 +70,8 @@
reactive, reactive,
} from "vue" } from "vue"
import { import {
purchaseProductOfferLists purchaseProductOfferLists,
purchaseProductOfferUpdate
} from "@/api/purchase_product_offer.js" } from "@/api/purchase_product_offer.js"
const test2 = () => { const test2 = () => {
@ -53,13 +80,15 @@
url: '/pages/index/index' url: '/pages/index/index'
}) })
} }
// url const show = ref(false)
const successPng = ref('https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/739c3202405071458553459.png') const formData = ref({
const errPng = ref('https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/04c2c202405071501462462.png') "id": '',
const waitPng = ref('https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/274ad202405111523222891.png') "store_name": '',
'product_id': '',
'nums': '',
'price': '',
'total_price':''
})
// tabsindex // tabsindex
const tabIndex = ref(1) const tabIndex = ref(1)
const { const {
@ -79,15 +108,30 @@
const goodsList = ref([]) const goodsList = ref([])
const goodsList1 = ref([]) const goodsList1 = ref([])
const getGoodsList = async (type) => { const getGoodsList = async () => {
let res = await purchaseProductOfferLists({ let res = await purchaseProductOfferLists({})
type
})
goodsList1.value = res.data.lists goodsList1.value = res.data.lists
} }
const cancleOrder = (item) => {
show.value = true
getGoodsList(tabIndex.value) formData.value.store_name = item['store_name']
formData.value.id = item['id']
formData.value.nums = item['need_num']
formData.value.product_id = item['product_id']
}
const offerUpdate = () => {
purchaseProductOfferUpdate(formData.value).then(res=>{
uni.$u.toast(res.msg);
show.value=false
getGoodsList()
})
}
const changeInputPrice=(e)=>{
if(formData.value.nums>0 && formData.value.price>0){
formData.value.total_price=formData.value.nums*formData.value.price
}
}
getGoodsList()
</script> </script>
<style lang="scss"> <style lang="scss">

View File

@ -124,7 +124,7 @@
<up-cell title="支付密码" :isLink="true" url="/pagesOrder/setPayPassword/index"></up-cell> <up-cell title="支付密码" :isLink="true" url="/pagesOrder/setPayPassword/index"></up-cell>
<up-cell title="商品列表" :isLink="true" url="pages/product/product" v-if="userInfo.system_store_id>0"></up-cell> <up-cell title="商品列表" :isLink="true" url="pages/product/product" v-if="userInfo.system_store_id>0"></up-cell>
<up-cell title="订单列表" :isLink="true" url="pagesOrder/delivery/index" v-if="userInfo.system_store_id>0"></up-cell> <up-cell title="订单列表" :isLink="true" url="pagesOrder/delivery/index" v-if="userInfo.system_store_id>0"></up-cell>
<up-cell title="采购列表" :isLink="true" url="pageQuota/purchase_product_offer/index"></up-cell> <up-cell title="采购列表" :isLink="true" url="pageQuota/purchase_product_offer/index" v-if="userInfo.delivery_service_id>0"></up-cell>
</up-cell-group> </up-cell-group>
</view> </view>