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"
width="210" height="210" :accept="acceptType">
<view class="index-upload d-flex j-center a-center"> <view class="index-upload d-flex j-center a-center">
<image v-if="imgType === 'camera'" src="@/static/icon/camera.png" mode="widthFix"></image> <image v-if="imgType === 'camera'" src="@/static/icon/camera.png" mode="widthFix"></image>
<view class="index-upload-tlo d-flex flex-wrap j-center" v-else-if="imgType === 'cross'"> <view class="index-upload-tlo d-flex flex-wrap j-center" v-else-if="imgType === 'cross'">
<image :class="crossTextShow ? 'index-upload-tlo-lp' : ''" src="@/static/icon/cross.png" mode=""></image> <image :class="crossTextShow ? 'index-upload-tlo-lp' : ''" src="@/static/icon/cross.png" mode="">
</image>
<view class="" v-if="crossTextShow">上传</view> <view class="" v-if="crossTextShow">上传</view>
</view> </view>
</view> </view>
...@@ -13,16 +15,16 @@ ...@@ -13,16 +15,16 @@
</template> </template>
<script> <script>
// import apiBaseConfig from '@/config/index.js'; import apiBaseConfig from '@/config/index.js';
export default { export default {
props: { props: {
imgType: { imgType: {
type: String, type: String,
default: 'cross' //camera cross default: 'cross' //camera cross
}, },
acceptType:{ acceptType: {
type:String, type: String,
default:'image' default: 'image'
}, },
crossTextShow: { crossTextShow: {
type: Boolean, type: Boolean,
...@@ -31,19 +33,8 @@ export default { ...@@ -31,19 +33,8 @@ export default {
}, },
data() { data() {
return { return {
// imgBgUrl: apiBaseConfig.imgBgUrl, uploadUrl: apiBaseConfig.upload,
// globalData: getApp().globalData, fileList1: [],
fileList: [
{
url:'https://img2.baidu.com/it/u=955956276,3392954639&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500'
},
{
url:'https://img1.baidu.com/it/u=3486651663,3991438881&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500'
},
{
url:'https://img2.baidu.com/it/u=955956276,3392954639&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500'
},
]
}; };
}, },
onLoad() {}, onLoad() {},
...@@ -52,72 +43,77 @@ export default { ...@@ -52,72 +43,77 @@ export default {
deletePic(event) { deletePic(event) {
this[`fileList${event.name}`].splice(event.index, 1); this[`fileList${event.name}`].splice(event.index, 1);
}, },
// 新增图片
async afterRead(event) { async afterRead(event) {
console.log(event,'短时间内') console.log(event)
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式 // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
let lists = [].concat(event.file); let lists = [].concat(event.file)
let fileListLen = this[`fileList${event.name}`].length; let fileListLen = this[`fileList${event.name}`].length
lists.map(item => { lists.map((item) => {
this[`fileList${event.name}`].push({ this[`fileList${event.name}`].push({
...item, ...item,
status: 'uploading', status: 'uploading',
message: '上传中' message: '上传中'
}); })
}); })
for (let i = 0; i < lists.length; i++) { for (let i = 0; i < lists.length; i++) {
const result = await this.uploadFilePromise(lists[i].url); const result = await this.uploadFilePromise(lists[i].url)
let item = this[`fileList${event.name}`][fileListLen]; let item = this[`fileList${event.name}`][fileListLen]
this[`fileList${event.name}`].splice( this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
fileListLen,
1,
Object.assign(item, {
status: 'success', status: 'success',
message: '', message: '',
url: result url: result
}) }))
); fileListLen++
fileListLen++;
} }
}, },
//上传图片
uploadFilePromise(url) { uploadFilePromise(url) {
let that = this
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let a = uni.uploadFile({ let a = uni.uploadFile({
url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址 //url: this.$common.domain+'/api/common/upload', // 仅为示例,非真实的接口地址
url:that.uploadUrl , // 仅为示例,非真实的接口地址
filePath: url, filePath: url,
name: 'file', name: 'file',
formData: { formData: {
user: 'test' user: 'test'
}, },
success: res => { success: (res) => {
console.log(res, '第三款')
setTimeout(() => { setTimeout(() => {
resolve(res.data.data); resolve(res.data.data)
}, 1000); }, 1000)
} }
}); });
}); })
} },
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.index { .index {
&-upload { &-upload {
width: 170rpx; // width: 170rpx;
height: 170rpx; // height: 170rpx;
width: 210rpx;
height: 210rpx;
background-color: #f3f3f3; background-color: #f3f3f3;
> image {
>image {
width: 52rpx; width: 52rpx;
height: 52rpx; height: 52rpx;
} }
&-tlo { &-tlo {
width: 100%; width: 100%;
height: 100%; height: 100%;
image { image {
width: 40rpx; width: 40rpx;
height: 40rpx; height: 40rpx;
} }
view { view {
width: 100%; width: 100%;
text-align: center; text-align: center;
...@@ -126,13 +122,15 @@ export default { ...@@ -126,13 +122,15 @@ export default {
color: #000000; color: #000000;
margin-top: -45rpx; margin-top: -45rpx;
} }
&-lp { &-lp {
margin-top: 43rpx; margin-top: 43rpx;
} }
} }
} }
} }
.index-upload-tlo-lp{
.index-upload-tlo-lp {
margin-bottom: 30rpx; 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
} = data_back
if (code == 200) {
if (total > 0) {
that.statusNeedList = rows
} else { } else {
that.statusNeedList = [] 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)
} }
} }
......
...@@ -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,27 +51,33 @@ ...@@ -51,27 +51,33 @@
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;
......
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