Commit 35237f1d by honghong

发布

parent 76b833dc
...@@ -6,6 +6,11 @@ import { ...@@ -6,6 +6,11 @@ import {
const userNeedSquare = (params) => { const userNeedSquare = (params) => {
return ApiHttp('/xinrenli/order/userDemandSquare',params,'GET') return ApiHttp('/xinrenli/order/userDemandSquare',params,'GET')
} }
// 获取订单列表
const orderDetailList = (params) => {
return ApiHttp('/xinrenli/order/list',params,'GET')
}
// 获取订单详细信息 // 获取订单详细信息
const orderDetailMsg = (params) => { const orderDetailMsg = (params) => {
return ApiHttp('/xinrenli/order/',params,'GET') return ApiHttp('/xinrenli/order/',params,'GET')
...@@ -19,10 +24,14 @@ const orderDetailMsgNew = (params) => { ...@@ -19,10 +24,14 @@ const orderDetailMsgNew = (params) => {
const myNeedList = (params) => { const myNeedList = (params) => {
return ApiHttp('/xinrenli/order/MyNeeds',params,'GET') return ApiHttp('/xinrenli/order/MyNeeds',params,'GET')
} }
// 上传图片视频
// const = () => {
// return ApiHttp('/system/oss/upload')
// }
// 新增订单(发布) // 新增订单(发布)
const addOrderFunction = (params) =>{ const addOrderFunction = (params) =>{
return ApiHttp('/xinrenli/order',params,'POST') return ApiHttp('/xinrenli/order/add',params,'POST')
} }
// 修改订单(发布) // 修改订单(发布)
...@@ -37,6 +46,7 @@ const removeOrderFunction = (params) =>{ ...@@ -37,6 +46,7 @@ const removeOrderFunction = (params) =>{
export { export {
userNeedSquare, userNeedSquare,
orderDetailList,
orderDetailMsg, orderDetailMsg,
orderDetailMsgNew, orderDetailMsgNew,
myNeedList, myNeedList,
......
...@@ -106,6 +106,9 @@ ...@@ -106,6 +106,9 @@
</template> </template>
<script> <script>
import {
addOrderFunction
} from '@/api/system/index.js'
import freeAudio from '@/components/chengpeng-audio/free-audio.vue' import freeAudio from '@/components/chengpeng-audio/free-audio.vue'
import recordCom from '@/components/record/record.vue' import recordCom from '@/components/record/record.vue'
export default { export default {
...@@ -198,11 +201,31 @@ ...@@ -198,11 +201,31 @@
handleUpdateForm(){ handleUpdateForm(){
this.$emit('submit', this.formInfo) this.$emit('submit', this.formInfo)
}, },
async handleAdd() {
let that = this
const data_back = await addOrderFunction(that.formInfo)
console.log(data_back,'提交')
const {code} = data_back
if(code == 200){
uni.showToast({
title:'发布成功!',
icon:'none',
duration:2000,
success() {
setTimeout(()=>{
that.resetForm()
},1000)
}
})
}
},
//发布需求按钮 //发布需求按钮
handlePublish() { handlePublish() {
console.log(this.formInfo, '数据') let that = this
this.$refs.form.validate().then(res => { this.$refs.form.validate().then(res => {
uni.$u.toast('校验通过') if(res){
that.handleAdd()
}
}).catch(errors => { }).catch(errors => {
uni.$u.toast('校验失败') uni.$u.toast('校验失败')
}) })
...@@ -253,13 +276,22 @@ ...@@ -253,13 +276,22 @@
}, },
resetForm() { resetForm() {
this.formInfo = { this.formInfo = {
title: undefined, //标题 title: '', //标题
linkman: undefined, //联系人 linkman: '', //联系人
phone: undefined, //联系电话 phone: '', //联系电话
repairTime: undefined, //维修时间 repairTime: undefined, //维修时间
repairAddress: undefined, //维修地址 repairAddress: '', //维修地址
budget: undefined, //预算金额 budget: '', //预算金额
remark: undefined, //备注说明 remark: '测试默认值', //备注说明
fileBoList:[
{
url:'https://img1.baidu.com/it/u=567782244,1695500002&fm=253&fmt=auto&app=138&f=JPEG?w=753&h=500',//地址
fileType:'picture',//文件类型video
},
],
// id:null,
userId:1,//用户id
} }
} }
} }
......
<template> <template>
<view class="index"> <view class="index">
<u-upload :fileList="fileList" @afterRead="afterRead" @delete="deletePic" name="6" multiple :maxCount="1" width="210" height="210" :accept="acceptType"> <u-upload :fileList="fileList1" name="1" @afterRead="afterRead" @delete="deletePic" :multiple="true" :maxCount="5"
<view class="index-upload d-flex j-center a-center"> width="210" height="210" :accept="acceptType">
<image v-if="imgType === 'camera'" src="@/static/icon/camera.png" mode="widthFix"></image> <view class="index-upload d-flex j-center a-center">
<view class="index-upload-tlo d-flex flex-wrap j-center" v-else-if="imgType === 'cross'"> <image v-if="imgType === 'camera'" src="@/static/icon/camera.png" mode="widthFix"></image>
<image :class="crossTextShow ? 'index-upload-tlo-lp' : ''" src="@/static/icon/cross.png" mode=""></image> <view class="index-upload-tlo d-flex flex-wrap j-center" v-else-if="imgType === 'cross'">
<view class="" v-if="crossTextShow">上传</view> <image :class="crossTextShow ? 'index-upload-tlo-lp' : ''" src="@/static/icon/cross.png" mode="">
</view> </image>
</view> <view class="" v-if="crossTextShow">上传</view>
</u-upload> </view>
</view> </view>
</template> </u-upload>
</view>
<script> </template>
// import apiBaseConfig from '@/config/index.js';
export default { <script>
props: { import apiBaseConfig from '@/config/index.js';
imgType: { export default {
type: String, props: {
default: 'cross' //camera cross imgType: {
type: String,
default: 'cross' //camera cross
},
acceptType: {
type: String,
default: 'image'
},
crossTextShow: {
type: Boolean,
default: true
}
}, },
acceptType:{ data() {
type:String, return {
default:'image' uploadUrl: apiBaseConfig.upload,
}, fileList1: [],
crossTextShow: { };
type: Boolean, },
default: true onLoad() {},
} methods: {
}, // 删除图片
data() { deletePic(event) {
return { this[`fileList${event.name}`].splice(event.index, 1);
// imgBgUrl: apiBaseConfig.imgBgUrl, },
// globalData: getApp().globalData, async afterRead(event) {
fileList: [ console.log(event)
{ // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
url:'https://img2.baidu.com/it/u=955956276,3392954639&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500' let lists = [].concat(event.file)
}, let fileListLen = this[`fileList${event.name}`].length
{ lists.map((item) => {
url:'https://img1.baidu.com/it/u=3486651663,3991438881&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500' this[`fileList${event.name}`].push({
}, ...item,
{ status: 'uploading',
url:'https://img2.baidu.com/it/u=955956276,3392954639&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500' message: '上传中'
}, })
] })
}; for (let i = 0; i < lists.length; i++) {
}, const result = await this.uploadFilePromise(lists[i].url)
onLoad() {}, let item = this[`fileList${event.name}`][fileListLen]
methods: { this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
// 删除图片 status: 'success',
deletePic(event) { message: '',
this[`fileList${event.name}`].splice(event.index, 1); url: result
}, }))
// 新增图片 fileListLen++
async afterRead(event) { }
console.log(event,'短时间内') },
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式 //上传图片
let lists = [].concat(event.file); uploadFilePromise(url) {
let fileListLen = this[`fileList${event.name}`].length; let that = this
lists.map(item => { return new Promise((resolve, reject) => {
this[`fileList${event.name}`].push({ let a = uni.uploadFile({
...item, //url: this.$common.domain+'/api/common/upload', // 仅为示例,非真实的接口地址
status: 'uploading', url:that.uploadUrl , // 仅为示例,非真实的接口地址
message: '上传中' filePath: url,
}); name: 'file',
}); formData: {
for (let i = 0; i < lists.length; i++) { user: 'test'
const result = await this.uploadFilePromise(lists[i].url); },
let item = this[`fileList${event.name}`][fileListLen]; success: (res) => {
this[`fileList${event.name}`].splice( console.log(res, '第三款')
fileListLen, setTimeout(() => {
1, resolve(res.data.data)
Object.assign(item, { }, 1000)
status: 'success', }
message: '', });
url: result })
}) },
); }
fileListLen++; };
} </script>
},
uploadFilePromise(url) { <style lang="scss" scoped>
return new Promise((resolve, reject) => { .index {
let a = uni.uploadFile({ &-upload {
url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址 // width: 170rpx;
filePath: url, // height: 170rpx;
name: 'file', width: 210rpx;
formData: { height: 210rpx;
user: 'test' background-color: #f3f3f3;
},
success: res => { >image {
setTimeout(() => { width: 52rpx;
resolve(res.data.data); height: 52rpx;
}, 1000); }
}
}); &-tlo {
}); width: 100%;
} height: 100%;
}
}; image {
</script> width: 40rpx;
height: 40rpx;
<style lang="scss" scoped> }
.index {
&-upload { view {
width: 170rpx; width: 100%;
height: 170rpx; text-align: center;
background-color: #f3f3f3; font-size: 24rpx;
> image { font-weight: 400;
width: 52rpx; color: #000000;
height: 52rpx; margin-top: -45rpx;
} }
&-tlo {
width: 100%; &-lp {
height: 100%; margin-top: 43rpx;
image { }
width: 40rpx; }
height: 40rpx; }
} }
view {
width: 100%; .index-upload-tlo-lp {
text-align: center; margin-bottom: 30rpx;
font-size: 24rpx; }
font-weight: 400;
color: #000000;
margin-top: -45rpx;
}
&-lp {
margin-top: 43rpx;
}
}
}
}
.index-upload-tlo-lp{
margin-bottom: 30rpx;
}
</style> </style>
...@@ -39,7 +39,8 @@ const apiBaseConfig = { ...@@ -39,7 +39,8 @@ const apiBaseConfig = {
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
domain: hostUrl + api, domain: hostUrl + api,
upload: hostUrl + api + '/group-buy/by-file/uploadOne', // upload: hostUrl + api + '/system/oss/upload',
upload: hostUrl + '/xinrenli/file/upload',
imgBgUrl: hostUrl + imgApi, imgBgUrl: hostUrl + imgApi,
// bWeChatAppid: 'wxb323afcbe152514f', // bWeChatAppid: 'wxb323afcbe152514f',
bWeChatAppid: 'wx862d98c98e4fe97d', bWeChatAppid: 'wx862d98c98e4fe97d',
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<script> <script>
import { import {
orderDetailMsg, orderDetailMsgNew,
updateOrderFunction updateOrderFunction
} from '../../api/system/index.js' } from '../../api/system/index.js'
import releaseForm from '@/components/form.vue' import releaseForm from '@/components/form.vue'
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
//获取订单详情列表 //获取订单详情列表
getOrder() { getOrder() {
let that = this let that = this
orderDetailMsg({ orderDetailMsgNew({
id: that.detailInfo.id id: that.detailInfo.id
}).then(res => { }).then(res => {
console.log('订单详情', res) console.log('订单详情', res)
......
...@@ -65,7 +65,9 @@ ...@@ -65,7 +65,9 @@
// 3.授权手机号登录拿到encryptedData和iv // 3.授权手机号登录拿到encryptedData和iv
getPhoneNumber(e) { getPhoneNumber(e) {
// 同意登录 // 同意登录
console.log(e,'第三节')
if (e.detail.errMsg == "getPhoneNumber:ok") { if (e.detail.errMsg == "getPhoneNumber:ok") {
console.log(e,'Dasnj ')
const iv = e.detail.iv const iv = e.detail.iv
const encryptedData = e.detail.encryptedData const encryptedData = e.detail.encryptedData
this.getNumberAndToken(iv,encryptedData) this.getNumberAndToken(iv,encryptedData)
......
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
</view> </view>
</view> </view>
<template v-if="statusNeedList && statusNeedList.length"> <template v-if="statusNeedList && statusNeedList.length">
<comindex :list="statusNeedList" class="content-mindex" :subscript='subscript' @getVal="handleStatus"></comindex> <comindex :list="statusNeedList" class="content-mindex" :subscript='subscript' @getVal="handleStatus">
</comindex>
</template> </template>
<view v-else class="diagram"> <view v-else class="diagram">
<image src="@/static/icon/qst.png" mode=""></image> <image src="@/static/icon/qst.png" mode=""></image>
...@@ -56,6 +57,7 @@ ...@@ -56,6 +57,7 @@
<script> <script>
import { import {
myNeedList, myNeedList,
orderDetailList,
removeOrderFunction removeOrderFunction
} from '../../api/system/index.js' } from '../../api/system/index.js'
import apiBaseConfig from '@/config/index.js'; import apiBaseConfig from '@/config/index.js';
...@@ -77,12 +79,13 @@ ...@@ -77,12 +79,13 @@
}, { }, {
name: '已接单' name: '已接单'
}], }],
subscript: '0',//状态 subscript: '0', //状态
needInfo: { needInfo: {
pageSize: 1, pageSize: 10,
pageNum: 10, pageNum: 1,
status: 0, status: 0,
deleteStatus:0 deleteStatus: 0,
userId: 1
}, },
statusNeedList: [] statusNeedList: []
} }
...@@ -91,26 +94,29 @@ ...@@ -91,26 +94,29 @@
comindex comindex
}, },
onLoad(option) { onLoad(option) {
// console.log(option, 'pppppp')
if (option.id) { if (option.id) {
this.subscript = option.id this.subscript = option.id
} }
this.getMyNeedList() this.getMyNeedList()
}, },
methods: { methods: {
getMyNeedList() { async getMyNeedList() {
let that = this let that = this
that.needInfo.status = that.subscript that.needInfo.status = that.subscript
myNeedList(that.needInfo).then(res => { const data_back = await orderDetailList(that.needInfo)
console.log(res, '我的需求') const {
if (res.code == 200) { code,
if (res.total > 0) { total,
that.statusNeedList = res.rows rows
} else { } = data_back
that.statusNeedList = [] if (code == 200) {
} if (total > 0) {
that.statusNeedList = rows
} else {
that.statusNeedList = []
} }
}) }
}, },
jump(ind) { jump(ind) {
let that = this let that = this
...@@ -118,29 +124,33 @@ ...@@ -118,29 +124,33 @@
that.getMyNeedList() that.getMyNeedList()
}, },
// 取消订单接口 // 取消订单接口
async handleCancle(id){ async handleCancle(id) {
let that = this let that = this
const back_data = await removeOrderFunction({id:id}) const back_data = await removeOrderFunction({
console.log(back_data,'取消') id: id
const {code} = back_data })
if(code == 200){ console.log(back_data, '取消')
const {
code
} = back_data
if (code == 200) {
uni.showToast({ uni.showToast({
title:'取消成功!', title: '取消成功!',
icon:'none', icon: 'none',
duration:2000, duration: 2000,
success() { success() {
setTimeout(()=>{ setTimeout(() => {
that.getMyNeedList() that.getMyNeedList()
},1000) }, 1000)
} }
}) })
} }
}, },
// 取消订单2 立即退款3 // 取消订单2 立即退款3
handleStatus(val,id){ handleStatus(val, id) {
console.log(val,id,'装订好') console.log(val, id, '装订好')
let that = this let that = this
if(val == 2){ if (val == 2) {
that.handleCancle(id) that.handleCancle(id)
} }
} }
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
<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 :statusBtn="statusBtn" @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="发布"
:titleStyle="{ color: '#000', fontSize: '32rpx',scrollTopHeader: scrollTopHeader }" /> :titleStyle="{ color: '#000', fontSize: '32rpx',scrollTopHeader: scrollTopHeader }" />
<com-tabbar :list=" [{ <com-tabbar :list=" [{
name: '首页', name: '首页',
icon: '/static/tabbar/tb1.png', icon: '/static/tabbar/tb1.png',
selectIcon:'/static/tabbar/td1.png', selectIcon:'/static/tabbar/td1.png',
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
</template> </template>
<script> <script>
import {addOrderFunction} from '@/api/system/index.js'
import releaseForm from '@/components/form.vue' import releaseForm from '@/components/form.vue'
export default { export default {
components: { components: {
...@@ -51,32 +51,38 @@ ...@@ -51,32 +51,38 @@
data() { data() {
return { return {
globalData: getApp().globalData, globalData: getApp().globalData,
statusBtn:-1 statusBtn: -1,
form: {
title: undefined, //标题
linkman: undefined, //联系人
phone: undefined, //联系电话
repairTime: undefined, //维修时间
repairAddress: undefined, //维修地址
budget: undefined, //预算金额
remark: undefined, //备注说明
}
} }
}, },
onShow() { onShow() {
let that = this let that = this
}, },
methods: { methods: {
handleSubmit(info){ handleSubmit(info) {
console.log(info,'拿到表单') console.log(info, '拿到表单')
},
handleAdd(){
addOrderFunction().then(res=>{
console.log('发布')
})
}, },
} }
} }
</script> </script>
<style scoped> <style scoped>
@import url("@/css/form.css"); @import url("@/css/form.css");
::v-deep .u-border { ::v-deep .u-border {
border: 0 !important; border: 0 !important;
background: #F5F5F5 !important; background: #F5F5F5 !important;
} }
::v-deep .u-upload__wrap__preview { ::v-deep .u-upload__wrap__preview {
margin: 0 6rpx 10rpx 0 !important; margin: 0 6rpx 10rpx 0 !important;
} }
......
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