123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507 |
- <template>
- <view class="content">
- <view v-if="pageData.user_order && pageData.statue != 3">
- <view class="box">
- <view class="title">报价记录</view>
- <block v-for="(item,index) in pageData.user_order.amounts" :key="index">
- <view class="offer_detail hflex acenter" v-if="item.user_id == userId">
- <view class="offer_left">第{{index + 1}}次报价</view>
- <view class="offer_money">{{item.amount?item.amount:'暂无报价'}}</view>
- </view>
- </block>
- </view>
- </view>
- <view v-else-if="!pageData.user_order && pageData.item[index].statue != 3">
- <view class="box">
- <view class="title">报价记录</view>
- <block v-for="(item,index1) in pageData.items[index].user_order.amounts" :key="index1">
- <view class="offer_detail hflex acenter" v-if="item.user_id == userId">
- <view class="offer_left">第{{index1 + 1}}次报价</view>
- <view class="offer_money">{{item.amount?item.amount:'暂无报价'}}</view>
- </view>
- </block>
- </view>
- </view>
-
- <view class="box" v-if="pageData.tab == 1 && pageData.items[index].status !=3">
- <view class="title">订单报价</view>
- <view class="input hflex acenter">
- <view>¥</view>
- <u-input v-model="money" border="none" placeholder="请填写你的报价"></u-input>
- </view>
- <view class="input_bg hflex acenter" v-if="tab == 3 || tab == 4">
- <view class="price">报价说明</view>
- <u-input v-model="description" placeholder="例如:税前/税后" border="none"></u-input>
- </view>
- <view class="input_bg hflex acenter" v-if="tab == 1 || tab == 2">
- <view class="price">货期</view>
- <u-input v-model="lead_time" placeholder="例如: 1个月" border="none"></u-input>
- </view>
- <view class="input_bg" v-if="tab == 2 || tab == 1">
- <view class="price">产品介绍以及报价说明</view>
- <u--textarea v-model="description" placeholder="例如:税前/税后" border="none"></u--textarea>
- </view>
- <view class="hflex acenter jbetween" v-if="tab == 1">
- <view class="price">是否现货</view>
- <u-switch v-model="is_stock" activeColor="#506dff" @change="change"></u-switch>
- </view>
- <view class="text_style1">上传图片及资质证明图片</view>
- <view class="upload">
- <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" :maxCount="3" name="1" multiple :previewFullImage="true" width="200rpx" height="200rpx">
- </u-upload>
- </view>
- </view>
- <view class="box" v-if="pageData.status != 3 && pageData.tab !=1">
- <view class="title">订单报价</view>
- <view class="input hflex acenter">
- <view>¥</view>
- <u-input v-model="money" border="none" placeholder="请填写你的报价"></u-input>
- </view>
- <view class="input_bg hflex acenter" v-if="tab == 3 || tab == 4">
- <view class="price">报价说明</view>
- <u-input v-model="description" placeholder="例如:税前/税后" border="none"></u-input>
- </view>
- <view class="input_bg hflex acenter" v-if="tab == 1 || tab == 2">
- <view class="price">货期</view>
- <u-input v-model="lead_time" placeholder="例如: 1个月" border="none"></u-input>
- </view>
- <view class="input_bg" v-if="tab == 2 || tab == 1">
- <view class="price">产品介绍以及报价说明</view>
- <u--textarea v-model="description" placeholder="例如:税前/税后" border="none"></u--textarea>
- </view>
- <view class="hflex acenter jbetween" v-if="tab == 1">
- <view class="price">是否现货</view>
- <u-switch v-model="is_stock" activeColor="#506dff" @change="change"></u-switch>
- </view>
- <view class="text_style1">上传图片及资质证明图片</view>
- <view class="upload">
- <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" :maxCount="3" name="1" multiple :previewFullImage="true" width="200rpx" height="200rpx">
- </u-upload>
- </view>
- </view>
- <view v-if="pageData.user_order">
- <view class="box" v-if="pageData.status == 3">
- <view class="title">报价信息</view>
- <view class="hflex acenter cell" >
- <view class="left">价格</view>
- <view class="right" style="font-size: 32rpx;color: #222222;">{{money?money:'暂无报价'}}</view>
- </view>
- <view class="hflex acenter cell" v-if="lead_time">
- <view class="left">货期</view>
- <view class="right">{{lead_time}}</view>
- </view>
- <view class="hflex acenter cell">
- <view class="left">说明</view>
- <view class="right">{{description}}</view>
- </view>
- <view class="hflex acenter cell" v-if="is_stock">
- <view class="left">是否现货</view>
- <view class="right">{{is_stock==0?'否':'是'}}</view>
- </view>
- <!-- <block v-if="pageData.status == 3 && pageData.file">
- <view class="text_style1 cell">图片及资质证明图片</view>
- <view class="hflex acenter fwrap">
- <block v-for="(item,index1) in pageData.user_order.file" :key="index1">
- <image :src="item" mode="aspectFill" class="imgs"></image>
- </block>
- </view>
- </block> -->
- <block v-if="pageData.status == 3 && pageData.user_order.images">
- <view class="text_style1 cell">图片及资质证明图片</view>
- <view class="hflex acenter fwrap">
- <block v-for="(item,index1) in pageData.user_order.images" :key="index1">
- <image :src="item" mode="aspectFill" class="imgs"></image>
- </block>
- </view>
- </block>
- </view>
- </view>
- <view class="" v-if="pageData.items[index].user_order">
- <view class="box" v-if="pageData.items[index].status == 3">
- <view class="title">报价信息</view>
- <view class="hflex acenter cell" >
- <view class="left">价格</view>
- <view class="right" style="font-size: 32rpx;color: #222222;">{{money?money:'暂无报价'}}</view>
- </view>
- <view class="hflex acenter cell" v-if="lead_time">
- <view class="left">货期</view>
- <view class="right">{{lead_time}}</view>
- </view>
- <view class="hflex acenter cell">
- <view class="left">说明</view>
- <view class="right">{{description}}</view>
- </view>
- <view class="hflex acenter cell" v-if="is_stock">
- <view class="left">是否现货</view>
- <view class="right">{{is_stock==0?'否':'是'}}</view>
- </view>
- <block v-if="pageData.items[index].status == 3 && pageData.images">
- <view class="text_style1 cell">图片及资质证明图片</view>
- <view class="hflex acenter fwrap">
- <block v-for="(item,index1) in pageData.items[index].user_order.images" :key="index1">
- <image :src="item" mode="aspectFill" class="imgs"></image>
- </block>
- </view>
- </block>
- </view>
- </view>
- <view v-if="pageData.tab == 1 && pageData.items[index].status !=3">
- <view class="btn" @click="create" v-if="pageData.items[index].user_order">{{pageData.items[index].user_order.amounts.length > 0 ? '重新报价' : '立即报价'}}</view>
- <view class="btn" @click="create" v-else>立即报价</view>
- <view class="text">友情提醒</view>
- <view class="text text2">请认真核算报价,报价后不可修改和删除,报价时间约需x天内报价,逾期影响信用等级。</view>
- </view>
- <view v-if="pageData.status != 3 && pageData.tab != 1">
- <view class="btn" @click="create" v-if="pageData.user_order">{{pageData.user_order.amounts.length > 0 ? '重新报价' : '立即报价'}}</view>
- <view class="btn" @click="create" v-else>立即报价</view>
- <view class="text">友情提醒</view>
- <view class="text text2">请认真核算报价,报价后不可修改和删除,报价时间约需x天内报价,逾期影响信用等级。</view>
- </view>
- </view>
- </template>
- <script>
- import $api from '@/static/js/api.js'
- var that = ''
- export default {
- data() {
- return {
- id: '',
- pageData: {},
- tab: '',
- fileList1: [],
- money: '',
- index: '',
- is_stock: '',
- description: '',
- lead_time: '',
- userId: '',
- }
- },
- onLoad(options) {
- that = this
- that.userId = uni.getStorageSync('id')
- that.id = options.id
- that.tab = options.tab
- if(options.index) {
- that.index = options.index
- }
- that.getData()
- },
- methods: {
- getData() {
- var url = ""
- switch(that.tab) {
- case '1':
- url = '/data/api.auth.Purchase/show';
- break;
- case '2':
- url = '/data/api.auth.Purchase/production_show';
- break;
- case '3':
- url = '/data/api.auth.Purchase/coor_show';
- break;
- case '4':
- url = '/data/api.auth.Purchase/ocean_show';
- break;
- }
- $api.req({
- url: url,
- data: {
- id: that.id
- }
- }, function(res) {
- if(res.code == 1) {
- that.pageData = res.data
- if(that.tab == '1') {
- that.money = that.pageData.items[that.index].user_order.amount
- that.lead_time = that.pageData.items[that.index].user_order.date
- that.description = that.pageData.items[that.index].user_order.desc
- that.is_stock = that.pageData.items[that.index].user_order.is_have == 1 ? true : false
- for(var i=0;i<that.pageData.items[that.index].user_order.images.length;i++) {
- var img = {
- url: that.pageData.items[that.index].user_order.images[i]
- }
- that.fileList1.push(img)
- }
- // that.fileList1 = that.pageData.items[that.index].user_order.images
- } else {
- that.money = that.pageData.user_order.amount
- that.lead_time = that.pageData.user_order.date
- that.description = that.pageData.user_order.desc
- that.is_stock = that.pageData.user_order.is_have == 1 ? true : false
- for(var i=0;i<that.pageData.user_order.images.length;i++) {
- var img = {
- url: that.pageData.user_order.images[i]
- }
- that.fileList1.push(img)
- }
- }
- }
- })
- },
- // 是否现货
- change(e) {
- console.log(e);
- that.is_stock = e
- },
- // 删除图片
- deletePic(event) {
- // that.userInfo.imgList.splice(event.index, 1)
- console.log(event)
- this[`fileList${event.name}`].splice(event.index, 1)
- },
- // 新增图片
- async afterRead(event) {
- uni.showLoading({
- title: '上传中',
- mask: true
- })
- let lists = [].concat(event.file)
- let fileListLen = this[`fileList${event.name}`].length
- lists.map((item) => {
- this[`fileList${event.name}`].push({
- ...item,
- status: 'uploading',
- message: '上传中'
- })
- })
- for (let i = 0; i < lists.length; i++) {
- const result = await this.uploadFilePromise(lists[i].url)
- let item = this[`fileList${event.name}`][fileListLen]
- this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
- status: 'success',
- message: '',
- url: result.url
- }))
- fileListLen++
- if(lists.length - 1 == i) {
- uni.hideLoading()
- }
- }
- },
- uploadFilePromise(url) {
- return new Promise((resolve, reject) => {
- let a = uni.uploadFile({
- url: $api.config.baseUrl + '/data/api.auth.Center/upload',
- filePath: url,
- name: 'file',
- header: {
- 'content-type': 'application/x-www-form-urlencoded',
- 'api-token': uni.getStorageSync('token').token?uni.getStorageSync('token').token:'',
- 'api-name': 'wxapp'
- },
- formData: {
- user: 'test'
- },
- success: (res) => {
- setTimeout(() => {
- var data = JSON.parse(res.data)
- resolve(data.data)
- }, 1000)
- }
- });
- })
- },
- create() {
- var url = ""
- var images = []
- for(var i=0;i<that.fileList1.length;i++) {
- images.push(that.fileList1[i].url)
- }
- if(that.description == "") {
- $api.info('请填写报价说明')
- return
- }
- if(images.length == 0) {
- $api.info('请上传图片资质')
- return
- }
- var data = {}
- switch(that.pageData.tab) {
- case 1:
- url = '/data/api.auth.Purchase/purchase_create';
- data = {
- id: that.pageData.items[that.index].id,
- amount: that.money,
- date: that.lead_time,
- desc: that.description,
- is_have: that.is_stock?1:0,
- images: images,
- is_edit: 1
- };
- break;
- case 2:
- url = '/data/api.auth.Purchase/production_create';
- data = {
- id: that.pageData.id,
- amount: that.money,
- date: that.lead_time,
- desc: that.description,
- images: images,
- is_edit: 1
- };
- break;
- case 3:
- url = '/data/api.auth.Purchase/coor_create';
- data = {
- id: that.pageData.id,
- amount: that.money,
- desc: that.description,
- images: images,
- is_edit: 1
- };
- break;
- case 4:
- url = '/data/api.auth.Purchase/ocean_create';
- data = {
- id: that.pageData.id,
- amount: that.money,
- desc: that.description,
- images: images,
- is_edit: 1
- };
- break;
- }
- $api.req({
- url: url,
- method: 'POST',
- data: data
- }, function(res) {
- if(res.code == 1) {
- /* that.getData()
- that.name = "",
- that.money = ""
- that.fileList1 = [] */
- $api.jump(-1)
- }
- })
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- .content::v-deep {
- background: #F4F4F4;
- padding: 0 30rpx;
- .box {
- width: 100%;
- background: #FFFFFF;
- border-radius: 24rpx;
- box-sizing: border-box;
- padding: 24rpx 20rpx;
- margin-top: 20rpx;
- .title {
- font-size: 28rpx;
- font-weight: 500;
- color: #222222;
- }
- .cell {
- padding: 18rpx 0;
- }
- .left {
- font-size: 26rpx;
- font-weight: 400;
- color: #222222;
- line-height: 36rpx;
- padding-right: 20rpx;
- }
- .right {
- font-size: 26rpx;
- font-weight: 400;
- color: #222222;
- line-height: 36rpx;
- }
- .offer_detail {
- width: 100%;
- height: 68rpx;
- background: #F4F4F4;
- border-radius: 16rpx;
- box-sizing: border-box;
- padding: 20rpx;
- margin: 10rpx 0;
- .offer_left {
- font-size: 22rpx;
- font-weight: 400;
- color: #777777;
- margin-right: 40rpx;
- }
- .offer_money {
- font-size: 28rpx;
- font-weight: 400;
- color: #FF3636;
- }
-
- }
- .input {
- width: 100%;
- height: 88rpx;
- background: #F4F4F4;
- border-radius: 16rpx;
- font-size: 32rpx;
- font-weight: 500;
- color: #222222;
- box-sizing: border-box;
- padding: 0 20rpx;
- line-height: 88rpx;
- margin: 20rpx 0;
- }
- .input_bg {
- background: #F4F4F4;
- border-radius: 8px;
- box-sizing: border-box;
- padding: 16rpx 20rpx;
- margin: 20rpx 0;
- .price {
- font-size: 32rpx;
- font-weight: 500;
- color: #222222;
- padding-right: 20rpx;
- }
- .u-textarea {
- background-color: #F4F4F4 !important;
- }
- .red {
- font-size: 28rpx;
- font-weight: bold;
- color: #FF3636;
- }
- }
- .text_style1 {
- font-size: 28rpx;
- font-weight: 500;
- color: #444444;
- }
- .imgs {
- width: 200rpx;
- height: 200rpx;
- border-radius: 16rpx;
- margin: 0 15rpx 20rpx 0;
- }
- .upload {
- margin-top: 20rpx;
- }
- }
- .btn {
- margin: 56rpx 0 22rpx;
- width: 100%;
- height: 88rpx;
- background: #506DFF;
- border-radius: 44rpx;
- font-size: 36rpx;
- font-weight: 500;
- text-align: center;
- line-height: 88rpx;
- color: #FFFFFF;
- }
- .text {
- font-size: 24rpx;
- font-weight: 400;
- color: #222222;
- }
- .text2 {
- color: #999999;
- }
- }
- </style>
|