Commit 2b28a6b6 by honghong

修改接口对接方式

parent 041dd035
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
<view> <view>
<view class="content"> <view class="content">
<view class="content-form"> <view class="content-form">
<u--form :label-style="{'font-size':'26rpx'}" label-position="top" labelWidth="150" :model="formInfo" ref="form" :rules="rules"> <u--form :label-style="{'font-size':'26rpx'}" label-position="top" labelWidth="150" :model="formInfo"
ref="form" :rules="rules">
<u-form-item required label="标题" prop="title" borderBottom :customStyle="{ <u-form-item required label="标题" prop="title" borderBottom :customStyle="{
'flex-direction': 'row !important'}"> 'flex-direction': 'row !important'}">
<u--input fontSize="24rpx" placeholderStyle="color: #999" inputAlign="right" border="none" <u--input fontSize="24rpx" placeholderStyle="color: #999" inputAlign="right" border="none"
...@@ -52,7 +53,7 @@ ...@@ -52,7 +53,7 @@
<view> <view>
<view class="d-flex j-sb a-center form-item-height-only"> <view class="d-flex j-sb a-center form-item-height-only">
<view class="form-item-name">上传图片</view> <view class="form-item-name">上传图片</view>
<view class="form-tips">下内容三选一必填</view> <view class="form-tips">下内容三选一必填</view>
</view> </view>
<view class=""> <view class="">
<comUpload></comUpload> <comUpload></comUpload>
...@@ -80,11 +81,11 @@ ...@@ -80,11 +81,11 @@
<view>添加语音描述</view> <view>添加语音描述</view>
</view> </view>
</view> </view>
<u-popup :show="showPopup" @close="handleClosePopup" @open="handleOpenPopup"> <!-- <u-popup :show="showPopup" @close="handleClosePopup" @open="handleOpenPopup">
<view class="padding-y-two"> <view class="padding-y-two">
<recordCom></recordCom> <recordCom></recordCom>
</view> </view>
</u-popup> </u-popup> -->
</view> </view>
</view> </view>
...@@ -98,7 +99,9 @@ ...@@ -98,7 +99,9 @@
</u--form> </u--form>
</view> </view>
</view> </view>
<view class="submit-btn" @click="handlePublish">发布需求</view> <view v-if="statusBtn == -1" class="submit-btn" @click="handlePublish">发布需求</view>
<view class="submit-btn" v-else-if="statusBtn == 0" @click="handleUpdateForm">确认修改</view>
<view class="submit-btn" v-else-if="statusBtn == 1" @click="handleUpdateForm">重新发布</view>
</view> </view>
</template> </template>
...@@ -111,6 +114,10 @@ ...@@ -111,6 +114,10 @@
freeAudio, freeAudio,
recordCom, recordCom,
}, },
props: {
statusBtn: Number,
detailData: Object
},
data() { data() {
return { return {
showTime: false, //时间选择器是否显示 showTime: false, //时间选择器是否显示
...@@ -118,15 +125,16 @@ ...@@ -118,15 +125,16 @@
path: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3', path: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3',
voicePath: '', voicePath: '',
showPopup: false, showPopup: false,
formInfo: { // formInfo: {
title: undefined, //标题 // title: undefined, //标题
linkman: undefined, //联系人 // linkman: undefined, //联系人
phone: undefined, //联系电话 // phone: undefined, //联系电话
repairTime: undefined, //维修时间 // repairTime: undefined, //维修时间
repairAddress: undefined, //维修地址 // repairAddress: undefined, //维修地址
budget: undefined, //预算金额 // budget: undefined, //预算金额
remark: undefined, //备注说明 // remark: undefined, //备注说明
}, // },
formInfo: {},
rules: { rules: {
title: { title: {
type: 'string', type: 'string',
...@@ -156,7 +164,20 @@ ...@@ -156,7 +164,20 @@
}; };
}, },
watch: {
detailData: {
handler(newVal, oldVal) {
let that = this
if (newVal) {
that.formInfo = that.detailData
} else {
that.resetForm()
}
},
immediate: true,
deep: true
}
},
//暂停所有音频(一般用于页面切换时停止正在播放的音频) //暂停所有音频(一般用于页面切换时停止正在播放的音频)
onUnload() { //普通页面在 onUnload 生命周期中执行 onUnload() { //普通页面在 onUnload 生命周期中执行
uni.$emit('stop') uni.$emit('stop')
...@@ -167,17 +188,24 @@ ...@@ -167,17 +188,24 @@
created() { created() {
let that = this let that = this
// 时间格式化默认值 // 时间格式化默认值
that.formInfo.repairTime = uni.$u.timeFormat(Number(new Date()), 'yyyy-mm-dd'); if (!that.formInfo.repairTime) {
that.formInfo.repairTime = uni.$u.timeFormat(Number(new Date()), 'yyyy-mm-dd');
}
}, },
methods: { methods: {
//确认修改和重新发布按钮
handleUpdateForm(){
this.$emit('submit', this.formInfo)
},
//发布需求按钮 //发布需求按钮
handlePublish() { handlePublish() {
console.log(this.formInfo, '数据')
this.$refs.form.validate().then(res => { this.$refs.form.validate().then(res => {
uni.$u.toast('校验通过') uni.$u.toast('校验通过')
}).catch(errors => { }).catch(errors => {
uni.$u.toast('校验失败') uni.$u.toast('校验失败')
}) })
// this.$emit('submit', this.formInfo) // this.$emit('submit', this.formInfo)
}, },
// 时间选择器确认事件 // 时间选择器确认事件
...@@ -223,6 +251,17 @@ ...@@ -223,6 +251,17 @@
} }
return value return value
}, },
resetForm() {
this.formInfo = {
title: undefined, //标题
linkman: undefined, //联系人
phone: undefined, //联系电话
repairTime: undefined, //维修时间
repairAddress: undefined, //维修地址
budget: undefined, //预算金额
remark: undefined, //备注说明
}
}
} }
} }
</script> </script>
......
...@@ -99,8 +99,8 @@ ...@@ -99,8 +99,8 @@
if(option.detailInfo){ if(option.detailInfo){
this.detailInfo = JSON.parse(decodeURIComponent(option.detailInfo)) this.detailInfo = JSON.parse(decodeURIComponent(option.detailInfo))
console.log(this.detailInfo,'结束') console.log(this.detailInfo,'结束')
this.getOrder()
} }
this.getOrder()
return return
this.subs = option.subs this.subs = option.subs
......
<template> <template>
<view> <view>
<view class="paddding-x-two "> <view class="paddding-x-two" v-if="JSON.stringify(detailData) != '{}'">
<releaseForm></releaseForm> <releaseForm :detailData="detailData" :statusBtn="detailInfo.status" @submit="handleSubmit"></releaseForm>
<view class="submit-btn">确认修改</view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import {
orderDetailMsg,
updateOrderFunction
} from '../../api/system/index.js'
import releaseForm from '@/components/form.vue' import releaseForm from '@/components/form.vue'
export default { export default {
components: { components: {
...@@ -15,11 +18,36 @@ ...@@ -15,11 +18,36 @@
}, },
data() { data() {
return { return {
detailInfo: {},//从上个页面接受的参数
detailData:{},//详情页的数据
}
},
onLoad(option) {
if(option.detailInfo){
this.detailInfo = JSON.parse(decodeURIComponent(option.detailInfo))
this.getOrder()
} }
}, },
methods: { methods: {
//获取订单详情列表
getOrder() {
let that = this
orderDetailMsg({
id: that.detailInfo.id
}).then(res => {
console.log('订单详情', res)
if (res.code == 200) {
that.detailData = res.data
}
})
},
//重新发布和修改按钮事件
handleSubmit(data){
console.log(data,'表单重新提交')
updateOrderFunction(data).then(res=>{
console.log(res,'重新提交返回')
})
}
} }
} }
</script> </script>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
</view> </view>
<!-- // 已发布 --> <!-- // 已发布 -->
<view class="buttoncolor" v-if="subscript == '0'"> <view class="buttoncolor" v-if="subscript == '0'">
<button class="buttoncl" @click.stop="modify">修改</button> <button class="buttoncl" @click.stop="handleAgainAdd(item)">修改</button>
<button class="buttonclde" @click.stop="abolish(1)">取消订单</button> <button class="buttonclde" @click.stop="abolish(1)">取消订单</button>
</view> </view>
<!-- // 已驳回 --> <!-- // 已驳回 -->
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<view class="reject flex-1 hiddenMore"> <view class="reject flex-1 hiddenMore">
驳回理由:没有明确问题描述没有明确问题描述没有明确问题描述没有明确问题描述 驳回理由:没有明确问题描述没有明确问题描述没有明确问题描述没有明确问题描述
</view> </view>
<button @click.stop="handleAgainAdd" class="buttoncl" style="margin-left: 20rpx;">重新发布</button> <button @click.stop="handleAgainAdd(item)" class="buttoncl" style="margin-left: 20rpx;">重新发布</button>
</view> </view>
<!-- // 待支付 --> <!-- // 待支付 -->
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
已沟通审核通过,待支付<text>{{item.actualAmount ? item.actualAmount : 0}}</text> 已沟通审核通过,待支付<text>{{item.actualAmount ? item.actualAmount : 0}}</text>
</view> </view>
<view class=""> <view class="">
截止1小时内支付完成<text>00:59:42</text> 截止1小时内支付完成<text>{{isEndTime}}</text>
</view> </view>
</view> </view>
<view class="" @click.stop="payment"> <view class="" @click.stop="payment">
...@@ -75,6 +75,8 @@ ...@@ -75,6 +75,8 @@
}, },
data() { data() {
return { return {
timer: "", //定时器
isEndTime: "01:00:00", //倒计时要有个初始值
imgBgUrl: apiBaseConfig.imgBgUrl, imgBgUrl: apiBaseConfig.imgBgUrl,
globalData: getApp().globalData, globalData: getApp().globalData,
show: false, show: false,
...@@ -83,11 +85,26 @@ ...@@ -83,11 +85,26 @@
} }
}, },
onLoad() { mounted(){
this.timer = setInterval(()=>{
this.countDown()
},1000)
}, },
methods: { methods: {
// 1小时倒计时
countDown() {
let allTime = 0;
let h = this.isEndTime.substring(0, 2);
let m = this.isEndTime.substring(3, 5);
let s = this.isEndTime.substring(6, 8);
allTime = Number(h) * 60 * 60 + Number(m) * 60 + Number(s);
if (allTime <= 0) return clearInterval(this.timer); //执行倒计时结束逻辑
allTime--;
h = parseInt(allTime / 3600) < 10 ? '0' + String(parseInt(allTime / 3600)) : parseInt(allTime / 3600);
m = parseInt(allTime / 60) < 10 ? '0' + String(parseInt(allTime / 60)) : parseInt(allTime / 60);
s = allTime % 60 < 10 ? '0' + String(allTime % 60) : allTime % 60;
this.isEndTime = h + ":" + m + ":" + s;
},
// 跳转详情页 // 跳转详情页
jump(data) { jump(data) {
this.$uniGo.navigateTo({ this.$uniGo.navigateTo({
...@@ -122,10 +139,10 @@ ...@@ -122,10 +139,10 @@
} }
}, },
//重新发布按钮事件 //重新发布按钮事件
handleAgainAdd() { handleAgainAdd(info) {
let that = this let that = this
that.$uniGo.navigateTo({ that.$uniGo.navigateTo({
url: `/demand/updateForm/updateForm` url: `/demand/updateForm/updateForm?detailInfo=${encodeURIComponent(JSON.stringify(info))}`
}) })
}, },
// 再看看 // 再看看
......
...@@ -38,7 +38,8 @@ ...@@ -38,7 +38,8 @@
<view class=""> <view class="">
暂无数据 暂无数据
</view> </view>
</view> </view>
<u-loadmore iconSize="50px" @loadmore="loadMore" color="#6A6C6F" fontSize="24rpx" :nomore-text="nomoreText" :loading-text="loadingText" line :status="loadStatus" />
</view> </view>
<com-navbar :leftIcon="false" :homeShow="false" bgColor="transparent" title="首页" <com-navbar :leftIcon="false" :homeShow="false" bgColor="transparent" title="首页"
:titleStyle="{ color: '#FFFFFF', fontSize: '32rpx',scrollTopHeader: scrollTopHeader }" /> :titleStyle="{ color: '#FFFFFF', fontSize: '32rpx',scrollTopHeader: scrollTopHeader }" />
...@@ -90,7 +91,10 @@ ...@@ -90,7 +91,10 @@
queryParams:{ queryParams:{
pageNum:1, pageNum:1,
pageSize:10, pageSize:10,
} },
loadStatus:'loading',//加载时的状态(loadmore/ loading / nomore)
loadingText: '正在加载',
nomoreText: '已经到底了'
} }
}, },
onLoad() { onLoad() {
...@@ -102,9 +106,7 @@ ...@@ -102,9 +106,7 @@
}, },
onReachBottom() { onReachBottom() {
let that = this let that = this
if(that.total < that.queryParams.pageNum * that.queryParams.pageSize){ if(that.total < that.queryParams.pageNum * that.queryParams.pageSize) return that.nomore = 'nomore'
}
}, },
methods: { methods: {
getSquare(){ getSquare(){
...@@ -122,7 +124,10 @@ ...@@ -122,7 +124,10 @@
this.$uniGo.navigateTo({ this.$uniGo.navigateTo({
url: `/home/index/index?id=${info.id}` url: `/home/index/index?id=${info.id}`
}); });
}, },
loadMore(){
console.log('加载更多')
}
} }
} }
</script> </script>
......
...@@ -109,24 +109,30 @@ ...@@ -109,24 +109,30 @@
this.getArticleList() this.getArticleList()
}, },
methods: { methods: {
getArticleList(){ async getArticleList(){
let that = this let that = this
userArticleGet(that.queryParams).then(res=>{ // userArticleGet(that.queryParams).then(res=>{
console.log('文章列表',res.rows) // console.log('文章列表',res.rows)
if(res.code == 200){ // if(res.code == 200){
if(res.total > 0){ // if(res.total > 0){
that.articleList = res.rows // that.articleList = res.rows
that.total = res.total // that.total = res.total
} // }
} // }
}) // })
const data_back = await userArticleGet(that.queryParams);
const {code,total,rows} = data_back;
if(code === 200 && total > 0) {
that.articleList = rows
that.total = total
}
}, },
handleDetail(id) { handleDetail(id) {
let that = this let that = this
that.$uniGo.navigateTo({ that.$uniGo.navigateTo({
url: '/order/detail/detail?id='+id url: `/order/detail/detail?id=${id}`
}) })
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view> <view>
<view :style="{ height: `calc(${globalData.statusBarHeight}rpx + 130rpx)` }"></view> <view :style="{ height: `calc(${globalData.statusBarHeight}rpx + 130rpx)` }"></view>
<view class="paddding-x-two "> <view class="paddding-x-two ">
<releaseForm @submit="handleSubmit"></releaseForm> <releaseForm :statusBtn="statusBtn" @submit="handleSubmit"></releaseForm>
</view> </view>
<com-navbar :leftIcon="false" :homeShow="false" bgColor="#fff" title="发布" <com-navbar :leftIcon="false" :homeShow="false" bgColor="#fff" title="发布"
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
data() { data() {
return { return {
globalData: getApp().globalData, globalData: getApp().globalData,
statusBtn:-1
} }
}, },
onShow() { onShow() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment