diff --git a/pages/my-offer/index.vue b/pages/my-offer/index.vue index a3e2a91..53c3482 100644 --- a/pages/my-offer/index.vue +++ b/pages/my-offer/index.vue @@ -11,7 +11,9 @@ {{ items.belongEnterpriseName }} - {{ controlItems[items.orderStatus - 1] }} + + {{ controlItems[items.replyStatus] }} + @@ -27,7 +29,7 @@ - {{ items.deliveryDay }} + {{ transformTime(items.replyTime) }} ¥{{ items.totalPrice }} @@ -44,6 +46,7 @@ import { back, go2 } from '@/utils/hook.js' import uGap from '@/components/u-gap/u-gap.vue' import scrollList from '@/components/scroll-list/scroll-list.vue' import { getMyReplyList } from '@/apis/trade.js' +import { difTime } from '@/utils/index' export default { // props: { // queryOrderData: { @@ -63,7 +66,12 @@ export default { }, orderData: [], controlCurrent: 0, - controlItems: ['待付款', '待发货', '待收货', '已完成', '已关闭'], + controlItems: { + 30128: '待报价', + 30130: '已报价', + 30139: '已下单', + 30102: '已过期' + }, orderOption: { size: 10, auto: true, @@ -79,7 +87,6 @@ export default { } } }, - filters: {}, watch: { orderParams: { handler(val) { @@ -97,6 +104,22 @@ export default { this.getMyReplyListQuery() }, methods: { + transformTime(time) { + if (!time) { + return '-' + } + const { day, hours, minutes, seconds } = difTime(new Date(), time) + if (day > 0) { + return `${day}天前` + } + if (hours > 0) { + return `${hours}小时前` + } + if (minutes > 0) { + return `${minutes}分钟前` + } + return `${seconds}秒前` + }, back, // 获取我的报价 getMyReplyListQuery() { diff --git a/pages/quotation-details/index.vue b/pages/quotation-details/index.vue index 06d6960..e27d77b 100644 --- a/pages/quotation-details/index.vue +++ b/pages/quotation-details/index.vue @@ -4,7 +4,7 @@ 报价详情 - 修改报价 + 修改报价 @@ -26,50 +26,53 @@ - - - {{ items.brandName }}|{{ items.gramWeight }}|{{ items.length }}*{{ items.width }}|{{ items.quantity }} + + + + {{ items.brandName }} | {{ items.gramWeight }}g | {{ items.length }}*{{ items.width }} | {{ items.quantity }}张 + - + - 重量(吨): - {{ items.wight }} + 重量(吨): + {{ items.weight }} - 单价(元/吨): - {{ items.unitFee }} + 单价(元/吨): + {{ items.unitFee }} - 小计(元): - {{ items.totalPrice }} + 小计(元): + {{ items.totalPrice }} - - + + 备注信息: + {{ items.remark }} - + - 其他费用: - ¥ {{ upDataObj.otherFee }} + 其他费用: + ¥ {{ upDataObj.otherFee }} - 合计: - ¥ {{ upDataObj.totalAllPrice }} + 合计: + ¥ {{ upDataObj.totalAllPrice }} - + - 有效时间: - {{ upDataObj.enquiryValidTime }} + 有效时间: + {{ upDataObj.enquiryValidTime }} - - + + 报价备注: - 29号5点前能送达。 + {{ upDataObj.remark }} 注:禁止偷克重、抵纸换纸,否则将被平台严厉处罚!包括但不限于账号禁用。 @@ -112,6 +115,7 @@ export default { }, data() { return { + id: null, value: '', visible: true, title: 'picker-view', @@ -120,12 +124,18 @@ export default { deliveryArea: '广东省/广州市/天河区', deliveryDay: '2021/12/29 12:30', enquiryValidTime: [12, 11, 10], - itemList: [] + itemList: [], + replyStatus: 30102 } } }, - onLoad(Option) { - this.getDetail(Option.id) + onLoad(option) { + if (option.id) { + this.id = option.id + } + }, + onShow() { + this.id && this.getDetail(this.id) }, methods: { back, @@ -135,9 +145,6 @@ export default { .then((res) => { if (res) { this.upDataObj = res - var timeb = this.upDataObj.enquiryValidTime.split(' ') - var timeabs = timeb[1].split(':') - this.$set(this.upDataObj, 'enquiryValidTimeSplit', timeabs) this.$set(this.upDataObj, 'otherFee', 0) this.$set(this.upDataObj, 'totalAllPrice', 0) this.priceFree() @@ -147,23 +154,6 @@ export default { reject(err) }) }, - // 商品操作按钮 - commodityModify(item) { - console.log(111) - this.$refs.popup.open('bottom') - }, - // 单价操作按钮 - priceModify() { - this.$refs.popupPrice.open('bottom') - }, - // 事件设置 - resetTime() { - this.$refs.popupTime.open('bottom') - }, - // 事件选择change事件 - bindChange(e) { - console.log(e.detail.value) - }, priceFree() { for (let i = 0; i < this.upDataObj.itemList.length; i++) { var totalAllPrice = parseFloat(this.upDataObj.totalAllPrice) + parseFloat(this.upDataObj.itemList[i].totalPrice) @@ -172,28 +162,11 @@ export default { this.upDataObj.otherFee = otherFee.toFixed(2) } }, - close() { - this.$refs.popup.close() - this.$refs.popupPrice.close() - }, - // 纸张选择下拉change事件 - onchange(e) { - console.log(e) - this.pickerValue = e.detail.value - }, - // 时间设置取消 - pickerCancel() { - this.$refs.popupTime.close() - }, - // 时间设置确认 - pickerSure() { - this.$refs.popupTime.close() - }, // 修改报价按钮 editPrice() { var params = { title: '修改报价', - id: this.upDataObj.id + id: this.upDataObj.id } go2('submit-quotation', params) } @@ -296,12 +269,12 @@ export default { margin-top: 20rpx; } } - .submit-contant { + .submit-content { background-color: #ffffff; // height: 368rpx; border-bottom: 2rpx solid rgba(221, 221, 221, 0.5); padding-bottom: 20rpx; - .submit-contant-head { + .submit-content-head { line-height: 90rpx; width: 750rpx; height: 90rpx; @@ -309,7 +282,7 @@ export default { display: flex; justify-content: space-between; } - .submit-contant-title { + .submit-content-title { font-family: PingFangSC-Semibold; font-size: 30rpx; color: rgba(0, 0, 0, 0.75); @@ -318,17 +291,17 @@ export default { font-weight: 600; padding: 0rpx 0rpx 0rpx 32rpx; } - .submit-contant-body { + .submit-content-body { line-height: 68rpx; padding-left: 32rpx; - .submit-contant-body-title { + .submit-content-body-title { font-family: PingFangSC-Regular; font-size: 28rpx; color: #555555; letter-spacing: 0; font-weight: 400; } - .submit-contant-body-subtitle { + .submit-content-body-subtitle { font-family: PingFangSC-Regular; font-size: 28rpx; color: #555555; @@ -337,15 +310,15 @@ export default { float: right; margin-right: 32rpx; } - .submit-contant-body-input { + .submit-content-body-input { margin-right: 32rpx; } - .submit-contant-body-inputClass { + .submit-content-body-inputClass { background-color: #f7f8fa; } } } - .submit-contant-order { + .submit-content-order { width: 750rpx; height: 90rpx; line-height: 90rpx; @@ -354,7 +327,7 @@ export default { padding-left: 32rpx; padding-right: 32rpx; justify-content: space-between; - .submit-contant-order-title { + .submit-content-order-title { width: 140rpx; height: 40rpx; font-family: PingFangSC-Regular; @@ -362,7 +335,7 @@ export default { color: rgba(0, 0, 0, 0.5); font-weight: 400; } - .submit-contant-order-subtitle { + .submit-content-order-subtitle { width: 101rpx; height: 40rpx; font-family: PingFangSC-Regular; @@ -372,7 +345,7 @@ export default { text-align: left; font-weight: 400; } - .submit-contant-order-money { + .submit-content-order-money { width: 172rpx; height: 42rpx; font-family: PingFangSC-Semibold; @@ -383,7 +356,7 @@ export default { font-weight: 600; } } - .submit-contant-time { + .submit-content-time { width: 750rpx; height: 88rpx; background: #ffffff; @@ -392,7 +365,7 @@ export default { padding-left: 32rpx; padding-right: 32rpx; justify-content: space-between; - .submit-contant-time-title { + .submit-content-time-title { width: 230rpx; height: 40rpx; font-size: 28rpx; @@ -400,7 +373,7 @@ export default { letter-spacing: 0; font-weight: 400; } - .submit-contant-time-subtitle { + .submit-content-time-subtitle { width: 56rpx; height: 40rpx; font-size: 28rpx; @@ -411,11 +384,11 @@ export default { cursor: pointer; } } - .submit-contant-remark { + .submit-content-remark { width: 750rpx; height: 88rpx; background: #ffffff; - .submit-contant-remark-title { + .submit-content-remark-title { font-family: PingFangSC-Regular; font-size: 30rpx; color: #000000; @@ -423,7 +396,7 @@ export default { font-weight: 400; padding: 28rpx 0rpx 0rpx 32rpx; } - .submit-contant-remark-input { + .submit-content-remark-input { background: #f7f8fa; border-radius: 20rpx; margin: 10rpx 32rpx 32rpx 32rpx; diff --git a/pages/submit-quotation/index.vue b/pages/submit-quotation/index.vue index 50fc1f5..84480e8 100644 --- a/pages/submit-quotation/index.vue +++ b/pages/submit-quotation/index.vue @@ -99,7 +99,7 @@ 报价备注 - + @@ -248,7 +248,7 @@ export default { months.push(i + '小时') } return { - quotationRemark: '', + // quotationRemark: '', vModelValue: '', indicatorStyle: `height: 50px;`, visible: true, @@ -298,6 +298,8 @@ export default { this.$set(this.upDataObj, 'otherFee', 0) this.$set(this.upDataObj, 'totalAllPrice', 0) this.priceFree() + // 询价备注 + // this.quotationRemark = res.remark // 计算每个纸品的重量 for (let i = 0; i < this.upDataObj.itemList.length; i++) { let target = this.upDataObj.itemList[i] @@ -491,8 +493,8 @@ export default { } } var params = { - remark: this.quotationRemark, // 报价备注 ...this.upDataObj, + // remark: this.quotationRemark, // 报价备注 userId: this.$store.state.userInfo.userId } return new Promise((resolve, reject) => { diff --git a/utils/index.js b/utils/index.js index 7d7a828..bbef794 100644 --- a/utils/index.js +++ b/utils/index.js @@ -160,3 +160,40 @@ export const makeSocket = async ({ pageInfo = '', retry = false }) => { export function round(number, precision) { return Math.round(+number + 'e' + precision) / Math.pow(10, precision) } + +/** + * {beyond:是否超出目标时间,day:天,hours:小时,minutes:分钟,seconds:秒钟} + * @param time 计算时间 + * @param target 对照时间 + * @returns 时间差对象 + */ +export const difTime = (time, target) => { + let begin = new Date(time).getTime() + // 兼容ios时间 + let end = new Date(target.replace(/-/g, '/')).getTime() + let beyond = begin < end ? false : true + let diff = Math.abs(begin - end) + // 计算天数 + let day = Math.floor(diff / (24 * 3600 * 1000)) + day != day ? (day = 0) : '' + diff = diff % (24 * 3600 * 1000) + // 计算小时数 + let hours = Math.floor(diff / (3600 * 1000)) + hours != hours ? (hours = 0) : '' + diff = diff % (3600 * 1000) + // 计算分钟数 + let minutes = Math.floor(diff / (60 * 1000)) + minutes != minutes ? (minutes = 0) : '' + diff = diff % (60 * 1000) + // 计算秒数 + let seconds = Math.floor(diff / 1000) + seconds != seconds ? (seconds = 0) : '' + diff = diff % 1000 + return { + beyond, + day, + hours, + minutes, + seconds + } +}