123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421 |
- <template>
- <view class="content">
- <view class="box">
- <view class="hflex acenter">
- <image :src="pageData.user.headimg" class="avatar"></image>
- <view class="vflex" style="padding-left: 12rpx;">
- <view class="text_style1 text_hide" style="max-width: 500rpx;">{{pageData.user.nickname}}</view>
- <view class="hflex acenter">
- <view class="text_style2">{{pageData.city}}</view>
- <view class="text_style2" style="padding: 0 10rpx;">|</view>
- <view class="text_style2">{{pageData.create_at}}发布</view>
- </view>
- </view>
- </view>
- <view class="text_style3 cell">{{pageData.describe}}</view>
- <view class="cell">
- <block v-for="(item,index) in pageData.imgs" :key="index">
- <image :src="item" mode="aspectFill" class="img" @tap="preview"></image>
- </block>
- </view>
- <view class="hflex acenter jbetween cell">
- <view class="label">联系方式</view>
- <view class="text_style3">{{pageData.user.phone}}</view>
- </view>
- <view class="hflex acenter jbetween cell">
- <view class="label">维修时间</view>
- <view class="text_style3">{{pageData.start_time}}至{{pageData.end_time}}</view>
- </view>
- <view class="hflex acenter jbetween cell">
- <view class="label">维修地点</view>
- <view class="text_style3">{{pageData.city}} {{pageData.area}} {{pageData.address}}</view>
- </view>
- </view>
- <view class="box hflex acenter jbetween" style="margin-bottom: 186rpx;">
- <view class="title">订单类型</view>
- <view class="right">{{pageData.quick == 1 ? '普修' : '快修'}}</view>
- </view>
- <view class="bottom">
- <view class="bottom_btn" @click="openOffer" v-if="pageData.status == 1 ">立即接单</view>
- <view class="bottom_btn bottom_btn2" @click="openSee" v-else>已报价,立即查看</view>
- </view>
- <u-popup :show="quotation_show" mode="center" :round="10" :closeable="true" :safeAreaInsetBottom="false" @close="close">
- <view class="popup">
- <view class="popup_title">立即报价</view>
- <view class="input_bg hflex acenter">
- <view class="price">¥</view>
- <u-input v-model="offer" placeholder="填写你的报价" border="none"></u-input>
- </view>
- <view class="hflex acenter">
- <image src="https://ship-expert.zhousi.hdlkeji.com/common/icon_tips.png" style="width: 24rpx;height: 24rpx;padding-right: 6rpx"></image>
- <view class="popup_info">报价可先不填,可等评估后再填写</view>
- </view>
- <view class="hflex acenter" style="padding:30rpx 0 20rpx;">
- <view class="price">上传图片及资质证明图</view>
- </view>
- <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple :maxCount="9"></u-upload>
- <view class="popup_btn" @click="submit">提交</view>
- </view>
- </u-popup>
- <u-popup :show="detail_show" mode="center" :round="10" :closeable="true" :safeAreaInsetBottom="false" @close="close">
- <view class="popup">
- <view class="popup_title">报价信息</view>
- <view class="popup_name">当前报价</view>
- <view class="">
- <block v-for="(item,index) in offer_info.list" :key="index">
- <view class="hflex acenter input_bg">
- <view class="popup_text">第{{index + 1}}次报价</view>
- <view class="red">{{item.price == 0 ? '暂无报价' : item.price}}</view>
- </view>
- </block>
- </view>
- <!-- <view class="hflex acenter input_bg" v-if="offer_info.list.length >= 1">
- <view class="popup_text">第一次报价</view>
- <view class="red">{{offer_info.list[0].price}}</view>
- </view>
- <view class="hflex acenter input_bg" v-if="offer_info.list.length >= 2">
- <view class="popup_text">第二次报价</view>
- <view class="red">{{offer_info.list[1].price}}</view>
- </view>
- <view class="hflex acenter input_bg" v-if="offer_info.list.length >= 3">
- <view class="popup_text">第三次报价</view>
- <view class="red">{{offer_info.list[2].price}}</view>
- </view> -->
- <view class="popup_name">图片及资质证明图片</view>
- <view>
- <block v-for="(item,index) in offer_info.imgs" :key="index">
- <image :src="item" mode="aspectFill" style="width: 188rpx;height: 188rpx;margin: 0 14rpx 20rpx 0;border-radius: 16rpx;"></image>
- </block>
- </view>
- <view class="popup_btn" @click="toDetail">查看详情</view>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- import $api from '@/static/js/api.js'
- var that = ''
- export default {
- data() {
- return {
- pageData: {
- },
- quotation_show: false,
- offer: '',
- fileList1: [],
- imgs: '',
- detail_show: false,
- offer_info: {
- },
- id: '',
- }
- },
- onLoad(options) {
- that = this
- that.id = options.id
- that.getData()
- that.getOffer()
- },
- methods: {
- getData() {
- $api.req({
- url: '/data/api.auth.ShipEngineMaintenance/repairdetail',
- method: 'POST',
- data: {
- id: that.id
- }
- }, function(res) {
- if(res.code == 1) {
- console.log(res);
- that.pageData = res.data
- }
- })
- },
- getOffer() {
- $api.req({
- url: '/data/api.auth.ShipEngineMaintenance/offerinfo',
- method: 'POST',
- data: {
- id: that.id
- }
- }, function(res) {
- if(res.code == 1) {
- that.offer_info = res.data
- }
- })
- },
- preview() {
- uni.previewImage({
- urls: that.pageData.imgs
- })
- },
- // 立即接单
- openOffer() {
- var maintenance = uni.getStorageSync('maintenance')
- if(maintenance) {
- that.quotation_show = true
- } else {
- $api.info("请先成为维修工")
- }
- },
- submit() {
- console.log(that.pageData.status);
- that.pageData.status = 2
- console.log(that.pageData.status);
- $api.req({
- url: '/data/api.auth.ShipEngineMaintenance/repairoffer',
- method: 'POST',
- data: {
- id: that.id,
- price: that.offer,
- imgs: that.imgs
- }
- }, function(res) {
- if(res.code == 1) {
- $api.info(res.info)
- that.close()
- // that.pageData = {}
- // that.getData()
- }
- })
- },
- // 查看报价
- openSee() {
- that.detail_show = true
- },
- // 关闭
- close() {
- that.quotation_show = false
- that.detail_show = false
- },
- // 删除图片
- deletePic(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()
- }
- }
- if(that[`fileList${event.name}`].length > 0) {
- for(var i=0;i<that[`fileList${event.name}`].length;i++) {
- if(i == that[`fileList${event.name}`].length -1) {
- that.imgs += that[`fileList${event.name}`][i].url
- } else {
- that.imgs += that[`fileList${event.name}`][i].url + ','
- }
- }
- }
- },
- // 上传图片
- 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)
- }
- });
- })
- },
- toDetail() {
- $api.jump('/page_shop/pages/order/offer2?id=' + that.id + '&status=' + that.pageData.status)
- },
- },
- }
- </script>
- <style lang="scss" scoped>
- .content {
- background: #F4F4F4;
- .box {
- width: 690rpx;
- margin: 20rpx 30rpx 0;
- background: #FFFFFF;
- border-radius: 10px;
- box-sizing: border-box;
- padding: 20rpx;
- .avatar {
- width: 72rpx;
- height: 72rpx;
- border-radius: 50%;
- }
- .text_style1 {
- font-size: 28rpx;
- font-weight: 500;
- color: #222222;
- line-height: 40rpx;
- }
- .text_style2 {
- font-size: 22rpx;
- font-weight: 400;
- color: #B7B7B7;
- line-height: 32rpx;
- }
- .text_style3 {
- font-size: 28rpx;
- font-weight: 400;
- color: #444444;
- line-height: 44rpx;
- }
- .img {
- width: 200rpx;
- height: 200rpx;
- border-radius: 12rpx;
- margin: 0 14rpx 20rpx 0;
- }
- .img:nth-child(3n+3) {
- margin: 0 0 20rpx 0;
- }
- .label {
- width: 200rpx;
- font-size: 26rpx;
- font-weight: 400;
- color: #777777;
- line-height: 36rpx;
- }
- .title {
- font-size: 30rpx;
- font-weight: 400;
- color: #222222;
- line-height: 42rpx;
- }
- .right {
- font-size: 30rpx;
- font-weight: 500;
- color: #506DFF;
- line-height: 42rpx;
- }
- .cell {
- padding: 14rpx 0;
- }
- }
- .bottom {
- width: 100%;
- z-index: 9;
- position: fixed;
- bottom: 0;
- height: 166rpx;
- background: #FFFFFF;
- box-sizing: border-box;
- padding: 8rpx 40rpx 74rpx;
- .bottom_btn {
- width: 100%;
- height: 84rpx;
- background: #506DFF;
- border-radius: 42rpx;
- font-size: 36rpx;
- font-weight: 500;
- color: #FFFFFF;
- text-align: center;
- line-height: 84rpx;
- }
- .bottom_btn2 {
- background: rgba(80,109,255,0.5);
- }
- }
- .popup {
- width: 670rpx;
- background: #FFFFFF;
- border-radius: 10px;
- box-sizing: border-box;
- padding: 36rpx 30rpx 24rpx;
- .popup_title {
- width: 100%;
- text-align: center;
- font-size: 32rpx;
- font-weight: 500;
- color: #222222;
- margin-bottom: 24rpx;
- }
- .popup_name {
- font-size: 26rpx;
- font-weight: 400;
- color: #222222;
- padding: 28rpx 0 20rpx;
- }
- .popup_text {
- font-size: 22rpx;
- font-weight: 500;
- color: #777777;
- padding-right: 60rpx;
- }
- .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;
- }
- }
- .popup_info {
- font-size: 20rpx;
- font-weight: 400;
- color: #C0C0C0;
- line-height: 28rpx;
- }
- .popup_btn {
- width: 610rpx;
- height: 80rpx;
- background: #506DFF;
- border-radius: 40rpx;
- font-size: 32rpx;
- font-weight: 500;
- color: #FFFFFF;
- text-align: center;
- line-height: 80rpx;
- margin: 20rpx 0;
- }
- }
- }
- </style>
|