123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- <template>
- <view class="content">
- <view v-if="pageData.list">
- <view class="box">
- <view class="title">报价记录</view>
- <!-- <view class="offer_detail hflex acenter">
- <view class="offer_money" v-if="pageData.list.length == 0">未填写报价</view>
- </view> -->
- <block v-for="(item,index) in pageData.list" :key="index">
- <view class="offer_detail hflex acenter">
- <view class="offer_left">第{{index + 1}}次报价</view>
- <view class="offer_money" v-if="item.price != 0">{{item.price}}</view>
- </view>
- </block>
- <view class="text_style1" style="padding: 20rpx 0;" v-if="status == 3">图片及资质证明图片</view>
- <view class="hflex acenter" v-if="status == 3">
- <block v-for="(item,index) in pageData.imgs" :key="index">
- <image :src="item" class="imgs"></image>
- </block>
- </view>
- </view>
- </view>
- <view class="box" v-if="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="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="status != 3">
- <view class="btn" @click="create">{{pageData.list.length > 0 ? '重新报价' : '立即报价'}}</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: '',
- status: '',
- }
- },
- onLoad(options) {
- that = this
- that.id = options.id
- that.status = options.status
- that.getData()
- },
- methods: {
- getData() {
- $api.req({
- url: '/data/api.auth.ShipEngineMaintenance/offerinfo',
- method: 'POST',
- data: {
- id: that.id
- }
- }, function(res) {
- if(res.code == 1) {
- that.pageData = res.data
- /* if(that.pageData.list) {
- that.money = that.pageData.list[that.pageData.list.length - 1].price
- } */
- for(var i=0;i<res.data.imgs.length;i++) {
- var img = {
- url: res.data.imgs[i]
- }
- that.fileList1.push(img)
- }
- }
- })
- },
- // 删除图片
- 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 = ''
- console.log(that.money);
- if(!that.money) {
- $api.info('请填写报价')
- return
- }
- for(var i=0;i<that.fileList1.length;i++) {
- if(i == that.fileList1.length -1) {
- images += that.fileList1[i].url
- } else {
- images += that.fileList1[i].url + ','
- }
- }
-
-
- $api.req({
- url: '/data/api.auth.ShipEngineMaintenance/repairoffer',
- method: 'POST',
- data: {
- id: that.id,
- price: that.money,
- imgs: images,
- }
- }, function(res) {
- if(res.code == 1) {
- that.getData()
- that.name = "",
- that.money = ""
- that.fileList1 = []
- }
- })
- }
- },
- }
- </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;
- }
- .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 20rpx 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>
|