purchase-let/pageQuota/quotation/index.vue

370 lines
9.3 KiB
Vue
Raw Normal View History

2024-05-06 17:57:19 +08:00
<template>
2024-05-09 09:12:22 +08:00
<view class="">
2024-05-07 13:35:30 +08:00
<up-sticky bgColor="#fff">
2024-05-08 17:34:22 +08:00
<view class="head">
2024-05-09 09:12:22 +08:00
<!-- <up-search placeholder="请输入提货点名称" @search="searchKeyword" v-model="keyword"
@custom="searchKeyword"></up-search> -->
2024-05-07 13:35:30 +08:00
<view class="">
2024-05-07 15:11:40 +08:00
<view class="" style="display: flex;justify-content: space-around;margin-top: 24rpx;color:#777777">
2024-05-09 09:12:22 +08:00
<view :class="{act: tabIndex==1}" @click="changeTabs(1)">
2024-05-11 19:03:24 +08:00
报价列表
2024-05-07 13:35:30 +08:00
</view>
2024-05-09 09:12:22 +08:00
<view :class="{act: tabIndex==2}" @click="changeTabs(2)">
2024-05-07 13:35:30 +08:00
报价记录
</view>
2024-05-08 17:34:22 +08:00
</view>
2024-05-07 13:35:30 +08:00
<view style="height: 8rpx;" />
<view class="line" :style="{left:tabIndex==1?tabsLeft+'px':tabsRight+'px'}" />
2024-05-07 15:11:40 +08:00
</view>
2024-05-07 13:35:30 +08:00
</view>
</up-sticky>
2024-05-13 18:05:23 +08:00
2024-05-09 09:12:22 +08:00
<view class="content">
2024-05-13 18:05:23 +08:00
<swiper class="swiper" circular>
<swiper-item>
<view v-if="showGoods1">
<view class="" v-if="goodsList1.length>0">
<view class="card" v-for="(item,index) in goodsList1" :key='index'>
<view class="head">
2024-05-09 10:40:09 +08:00
</view>
2024-05-13 18:05:23 +08:00
<view class="card-content">
<view class="card-content-l" style="width: 152rpx;height: 152rpx;">
<image style="width: 152rpx;height: 152rpx;" :src="item.goods.imgs" mode="">
</image>
<view class="status">
{{tabIndex==1?"未报价":"已报价" }}
</view>
2024-05-11 10:31:59 +08:00
</view>
2024-05-13 18:05:23 +08:00
<view class="card-content-r">
<view class="title ellipsis">
{{item.goods.name}}
</view>
<view class="need">
需求量 {{item.need_num}}{{item.unit_name}}
</view>
<view class="ipt">
<up-input :placeholderStyle="{fontSize:'20rpx'}" placeholder="输入报价数量"
:readonly="tabIndex==2" v-model="item.nums"
style="background-color:#F6F6F6;border: none;"></up-input>
<view style="width: 10rpx;">
</view>
<up-input :placeholderStyle="{fontSize:'20rpx'}"
style="background-color: #F6F6F6;border: none;" placeholder="输入产品报价"
@blur="priceBlur(index,goodsList1)" :readonly="tabIndex==2"
v-model="item.price"></up-input>
2024-05-11 10:31:59 +08:00
</view>
</view>
2024-05-09 10:40:09 +08:00
</view>
2024-05-13 18:05:23 +08:00
<view class="card-footer" v-if="item.nums && item.price">
{{item.nums}}{{item.unit_name}}&nbsp; &nbsp;合计:<text
style="font-size: 28rpx;color: #FC452F;font-weight: 700;">{{item.nums*item.price}}</text>
</view>
<up-line style="margin-top: 30rpx;" color="#F3F3F3"></up-line>
2024-05-09 10:40:09 +08:00
</view>
</view>
2024-05-13 18:05:23 +08:00
<up-empty @click='test2' v-else mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
</up-empty>
2024-05-08 17:34:22 +08:00
</view>
2024-05-11 10:31:59 +08:00
2024-05-13 18:05:23 +08:00
</swiper-item>
<swiper-item>
<view v-if="showGoods2">
<view v-if="goodsList2.length>0">
<view class="card" v-for="(item,index) in goodsList2" :key='index'>
<view class="card-content">
<view class="card-content-l" style="width: 152rpx;height: 152rpx;">
<image style="width: 152rpx;height: 152rpx;" :src="item.goods.imgs" mode="">
</image>
<view class="status">
{{tabIndex==1?"未报价":"已报价" }}
</view>
2024-05-11 10:31:59 +08:00
</view>
2024-05-13 18:05:23 +08:00
<view class="card-content-r">
<view class="title ellipsis">
{{item.goods.name}}
</view>
<view class="need">
需求量 {{item.need_num}}{{item.unit_name}}
</view>
<view class="ipt">
<up-input placeholderStyle='fontSize:24rpx' placeholder="点击数入报价数量"
:readonly="tabIndex==2" v-model="item.nums"
style="margin-right: 10rpx;background-color:#F6F6F6;border: none;"></up-input>
<up-input placeholderStyle='fontSize:24rpx'
style="background-color: #F6F6F6;border: none;" placeholder="点击数入产品报价"
@blur="priceBlur(index,goodsList2)" :readonly="tabIndex==2"
v-model="item.price"></up-input>
</view>
2024-05-11 10:31:59 +08:00
</view>
2024-05-13 18:05:23 +08:00
<view class="status-png" v-if="tabIndex==2">
<image v-if="item.is_adopt==1" :src="waitPng"
style="width: 108rpx; height: 84rpx;">
</image>
<image v-else-if="item.is_adopt==2" :src="successPng"
style="width: 108rpx; height: 84rpx;">
</image>
<image v-else :src="errPng" style="width: 108rpx; height: 84rpx;">
</image>
2024-05-11 10:31:59 +08:00
</view>
</view>
2024-05-13 18:05:23 +08:00
<view class="card-footer" v-if="item.nums &&item.price">
{{item.nums}}{{item.unit_name}}&nbsp; &nbsp;合计:<text
style="font-size: 28rpx;color: #FC452F;font-weight: 700;">{{item.nums*item.price}}</text>
2024-05-09 10:40:09 +08:00
</view>
2024-05-13 18:05:23 +08:00
<up-line style="margin-top: 30rpx;" color="#F3F3F3"></up-line>
2024-05-09 10:40:09 +08:00
</view>
</view>
2024-05-13 18:05:23 +08:00
<up-empty v-else mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
</up-empty>
</view>
2024-05-11 10:31:59 +08:00
2024-05-13 18:05:23 +08:00
</swiper-item>
</swiper>
<!-- 报价列表 -->
<!-- 报价记录 -->
2024-05-06 17:57:19 +08:00
2024-05-09 10:40:09 +08:00
2024-05-11 10:31:59 +08:00
2024-05-13 18:05:23 +08:00
<view class="detail" @click="navgo('/pageQuota/Balance/detail')">
明细
</view>
2024-05-11 10:31:59 +08:00
<view class="submit-btn" v-if="tabIndex==1">
<up-button shape='circle' color='#20B128' @click="submit" text="提交"></up-button>
</view>
2024-05-08 17:34:22 +08:00
</view>
2024-05-13 18:05:23 +08:00
2024-05-06 17:57:19 +08:00
</view>
</template>
2024-05-07 13:35:30 +08:00
<script setup>
import {
ref,
2024-05-09 09:12:22 +08:00
reactive,
2024-05-07 13:35:30 +08:00
} from "vue"
2024-05-09 09:12:22 +08:00
import {
OpurchaseGoodsOfferApi,
OpurchaseGoodsOfferListApi
} from "@/api/quotation.js"
2024-05-07 13:35:30 +08:00
2024-05-09 18:01:57 +08:00
const test2 = () => {
console.log("点解")
uni.navigateTo({
url: '/pages/index/index'
})
}
2024-05-08 17:34:22 +08:00
// 状态图片url
const successPng = ref('https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/739c3202405071458553459.png')
const errPng = ref('https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/04c2c202405071501462462.png')
2024-05-11 16:43:09 +08:00
const waitPng = ref('https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/274ad202405111523222891.png')
2024-05-08 17:34:22 +08:00
// 状态图片url结束
2024-05-13 18:05:23 +08:00
const navgo = (url) => {
uni.navigateTo({
url
})
}
2024-05-07 13:35:30 +08:00
// tabsindex
const tabIndex = ref(1)
const {
windowWidth
} = uni.getSystemInfoSync();
const tabsLeft = ref(((windowWidth / 2) - 26) / 2)
const tabsRight = ref(tabsLeft.value + (windowWidth / 2))
// tabsindex结束
2024-05-06 17:57:19 +08:00
2024-05-11 10:31:59 +08:00
const priceBlur = (index, goodsList) => {
goodsList[index].price = Number(goodsList[index].price).toFixed(2)
2024-05-09 09:12:22 +08:00
}
2024-05-07 13:35:30 +08:00
2024-05-09 09:12:22 +08:00
// 列表
2024-05-09 10:40:09 +08:00
const showGoods = ref(false)
const showGoods1 = ref(false)
const showGoods2 = ref(false)
2024-05-09 09:12:22 +08:00
const goodsList = ref([])
2024-05-09 10:40:09 +08:00
const goodsList1 = ref([])
const goodsList2 = ref([])
2024-05-09 09:12:22 +08:00
2024-05-09 10:40:09 +08:00
const getGoodsList = async (type) => {
if (type == 1) {
showGoods2.value = false
showGoods1.value = false
let res = await OpurchaseGoodsOfferListApi({
type
})
goodsList1.value = res.data.lists
goodsList1.value.forEach(item => {
item.nums = item.nums ? item.nums : ''
item.price = (+item.price) ? item.price : ''
})
showGoods1.value = true
} else {
showGoods1.value = false
showGoods2.value = false
let res = await OpurchaseGoodsOfferListApi({
type
})
goodsList2.value = res.data.lists
goodsList2.value.forEach(item => {
item.nums = item.nums ? item.nums : ''
item.price = (+item.price) ? item.price : ''
})
showGoods2.value = true
}
2024-05-09 09:12:22 +08:00
}
2024-05-07 13:35:30 +08:00
2024-05-09 09:12:22 +08:00
const changeTabs = (num) => {
tabIndex.value = num
getGoodsList(num)
}
getGoodsList(tabIndex.value)
// 列表结束
const submit = async () => {
2024-05-11 10:31:59 +08:00
let datas = goodsList1.value.map(item => ({
2024-05-09 09:12:22 +08:00
id: item.id,
nums: item.nums,
price: item.price
}))
let newData = []
datas.forEach(item => {
if (item.nums && item.price) {
newData.push(item)
2024-05-07 13:35:30 +08:00
}
2024-05-09 09:12:22 +08:00
})
let res = await OpurchaseGoodsOfferApi({
data: newData
})
tabIndex.value = 2
getGoodsList(tabIndex.value)
}
2024-05-06 17:57:19 +08:00
</script>
2024-05-07 13:35:30 +08:00
<style lang="scss">
2024-05-09 09:12:22 +08:00
.head {
padding: 20rpx;
background-color: white;
position: relative;
.act {
color: #20B128;
}
.line {
width: 26px;
height: 5rpx;
background-color: #20B128;
border-radius: 50rpx;
position: absolute;
transition: 300ms;
2024-05-07 13:35:30 +08:00
}
2024-05-09 09:12:22 +08:00
}
2024-05-07 13:35:30 +08:00
.content {
2024-05-08 17:34:22 +08:00
padding: 20rpx;
padding-bottom: 150rpx;
2024-05-07 13:35:30 +08:00
.card {
width: 710rpx;
2024-05-08 17:34:22 +08:00
margin: 0 auto;
padding: 20rpx;
2024-05-07 13:35:30 +08:00
box-sizing: border-box;
2024-05-08 17:34:22 +08:00
background-color: white;
2024-05-07 13:35:30 +08:00
.card-content {
display: flex;
2024-05-08 17:34:22 +08:00
position: relative;
.card-content-l {
margin-right: 20rpx;
position: relative;
.status {
width: 152rpx;
height: 40rpx;
background-color: rgba(0, 0, 0, .3);
text-align: center;
color: white;
font-size: 24rpx;
line-height: 40rpx;
position: absolute;
bottom: 0;
}
}
.card-content-r {
display: flex;
flex-direction: column;
justify-content: space-between;
.title {
font-size: 30rpx;
width: 500rpx;
}
.need {
color: #777777;
font-size: 24rpx;
}
.ipt {
display: flex;
height: 56rpx;
}
}
.status-png {
position: absolute;
right: 20rpx;
}
2024-05-07 15:11:40 +08:00
2024-05-08 17:34:22 +08:00
}
2024-05-07 15:11:40 +08:00
2024-05-08 17:34:22 +08:00
.card-footer {
margin-top: 30rpx;
text-align: right;
font-size: 28rpx;
color: #060606;
2024-05-07 15:11:40 +08:00
}
2024-05-07 13:35:30 +08:00
}
2024-05-08 17:34:22 +08:00
.submit-btn {
position: fixed;
bottom: 50rpx;
width: 710rpx;
margin: 0 auto;
}
}
2024-05-13 18:05:23 +08:00
.detail {
width: 88rpx;
height: 88rpx;
border-radius: 88rpx;
text-align: center;
line-height: 88rpx;
background-color: #50C758;
color: white;
position: absolute;
bottom: 300rpx;
right: 20rpx;
}
2024-05-08 17:34:22 +08:00
.ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
2024-05-07 13:35:30 +08:00
}
2024-05-06 17:57:19 +08:00
</style>