Commit 35237f1d by honghong

发布

parent 76b833dc
......@@ -6,6 +6,11 @@ import {
const userNeedSquare = (params) => {
return ApiHttp('/xinrenli/order/userDemandSquare',params,'GET')
}
// 获取订单列表
const orderDetailList = (params) => {
return ApiHttp('/xinrenli/order/list',params,'GET')
}
// 获取订单详细信息
const orderDetailMsg = (params) => {
return ApiHttp('/xinrenli/order/',params,'GET')
......@@ -19,10 +24,14 @@ const orderDetailMsgNew = (params) => {
const myNeedList = (params) => {
return ApiHttp('/xinrenli/order/MyNeeds',params,'GET')
}
// 上传图片视频
// const = () => {
// return ApiHttp('/system/oss/upload')
// }
// 新增订单(发布)
const addOrderFunction = (params) =>{
return ApiHttp('/xinrenli/order',params,'POST')
return ApiHttp('/xinrenli/order/add',params,'POST')
}
// 修改订单(发布)
......@@ -37,6 +46,7 @@ const removeOrderFunction = (params) =>{
export {
userNeedSquare,
orderDetailList,
orderDetailMsg,
orderDetailMsgNew,
myNeedList,
......
......@@ -106,6 +106,9 @@
</template>
<script>
import {
addOrderFunction
} from '@/api/system/index.js'
import freeAudio from '@/components/chengpeng-audio/free-audio.vue'
import recordCom from '@/components/record/record.vue'
export default {
......@@ -198,11 +201,31 @@
handleUpdateForm(){
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() {
console.log(this.formInfo, '数据')
let that = this
this.$refs.form.validate().then(res => {
uni.$u.toast('校验通过')
if(res){
that.handleAdd()
}
}).catch(errors => {
uni.$u.toast('校验失败')
})
......@@ -253,13 +276,22 @@
},
resetForm() {
this.formInfo = {
title: undefined, //标题
linkman: undefined, //联系人
phone: undefined, //联系电话
title: '', //标题
linkman: '', //联系人
phone: '', //联系电话
repairTime: undefined, //维修时间
repairAddress: undefined, //维修地址
budget: undefined, //预算金额
remark: undefined, //备注说明
repairAddress: '', //维修地址
budget: '', //预算金额
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>
<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">
<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'">
<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>
</view>
......@@ -13,16 +15,16 @@
</template>
<script>
// import apiBaseConfig from '@/config/index.js';
export default {
import apiBaseConfig from '@/config/index.js';
export default {
props: {
imgType: {
type: String,
default: 'cross' //camera cross
},
acceptType:{
type:String,
default:'image'
acceptType: {
type: String,
default: 'image'
},
crossTextShow: {
type: Boolean,
......@@ -31,19 +33,8 @@ export default {
},
data() {
return {
// imgBgUrl: apiBaseConfig.imgBgUrl,
// globalData: getApp().globalData,
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'
},
]
uploadUrl: apiBaseConfig.upload,
fileList1: [],
};
},
onLoad() {},
......@@ -52,72 +43,77 @@ export default {
deletePic(event) {
this[`fileList${event.name}`].splice(event.index, 1);
},
// 新增图片
async afterRead(event) {
console.log(event,'短时间内')
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
let lists = [].concat(event.file);
let fileListLen = this[`fileList${event.name}`].length;
lists.map(item => {
console.log(event)
// 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
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, {
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
})
);
fileListLen++;
}))
fileListLen++
}
},
//上传图片
uploadFilePromise(url) {
let that = this
return new Promise((resolve, reject) => {
let a = uni.uploadFile({
url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
//url: this.$common.domain+'/api/common/upload', // 仅为示例,非真实的接口地址
url:that.uploadUrl , // 仅为示例,非真实的接口地址
filePath: url,
name: 'file',
formData: {
user: 'test'
},
success: res => {
success: (res) => {
console.log(res, '第三款')
setTimeout(() => {
resolve(res.data.data);
}, 1000);
resolve(res.data.data)
}, 1000)
}
});
});
}
})
},
}
};
};
</script>
<style lang="scss" scoped>
.index {
.index {
&-upload {
width: 170rpx;
height: 170rpx;
// width: 170rpx;
// height: 170rpx;
width: 210rpx;
height: 210rpx;
background-color: #f3f3f3;
> image {
>image {
width: 52rpx;
height: 52rpx;
}
&-tlo {
width: 100%;
height: 100%;
image {
width: 40rpx;
height: 40rpx;
}
view {
width: 100%;
text-align: center;
......@@ -126,13 +122,15 @@ export default {
color: #000000;
margin-top: -45rpx;
}
&-lp {
margin-top: 43rpx;
}
}
}
}
.index-upload-tlo-lp{
}
.index-upload-tlo-lp {
margin-bottom: 30rpx;
}
}
</style>
......@@ -39,7 +39,8 @@ const apiBaseConfig = {
// #ifdef MP-WEIXIN
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,
// bWeChatAppid: 'wxb323afcbe152514f',
bWeChatAppid: 'wx862d98c98e4fe97d',
......
......@@ -8,7 +8,7 @@
<script>
import {
orderDetailMsg,
orderDetailMsgNew,
updateOrderFunction
} from '../../api/system/index.js'
import releaseForm from '@/components/form.vue'
......@@ -32,7 +32,7 @@
//获取订单详情列表
getOrder() {
let that = this
orderDetailMsg({
orderDetailMsgNew({
id: that.detailInfo.id
}).then(res => {
console.log('订单详情', res)
......
......@@ -65,7 +65,9 @@
// 3.授权手机号登录拿到encryptedData和iv
getPhoneNumber(e) {
// 同意登录
console.log(e,'第三节')
if (e.detail.errMsg == "getPhoneNumber:ok") {
console.log(e,'Dasnj ')
const iv = e.detail.iv
const encryptedData = e.detail.encryptedData
this.getNumberAndToken(iv,encryptedData)
......
......@@ -11,7 +11,8 @@
</view>
</view>
<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>
<view v-else class="diagram">
<image src="@/static/icon/qst.png" mode=""></image>
......@@ -56,6 +57,7 @@
<script>
import {
myNeedList,
orderDetailList,
removeOrderFunction
} from '../../api/system/index.js'
import apiBaseConfig from '@/config/index.js';
......@@ -77,12 +79,13 @@
}, {
name: '已接单'
}],
subscript: '0',//状态
subscript: '0', //状态
needInfo: {
pageSize: 1,
pageNum: 10,
pageSize: 10,
pageNum: 1,
status: 0,
deleteStatus:0
deleteStatus: 0,
userId: 1
},
statusNeedList: []
}
......@@ -91,26 +94,29 @@
comindex
},
onLoad(option) {
// console.log(option, 'pppppp')
if (option.id) {
this.subscript = option.id
}
this.getMyNeedList()
},
methods: {
getMyNeedList() {
async getMyNeedList() {
let that = this
that.needInfo.status = that.subscript
myNeedList(that.needInfo).then(res => {
console.log(res, '我的需求')
if (res.code == 200) {
if (res.total > 0) {
that.statusNeedList = res.rows
const data_back = await orderDetailList(that.needInfo)
const {
code,
total,
rows
} = data_back
if (code == 200) {
if (total > 0) {
that.statusNeedList = rows
} else {
that.statusNeedList = []
}
}
})
},
jump(ind) {
let that = this
......@@ -118,29 +124,33 @@
that.getMyNeedList()
},
// 取消订单接口
async handleCancle(id){
async handleCancle(id) {
let that = this
const back_data = await removeOrderFunction({id:id})
console.log(back_data,'取消')
const {code} = back_data
if(code == 200){
const back_data = await removeOrderFunction({
id: id
})
console.log(back_data, '取消')
const {
code
} = back_data
if (code == 200) {
uni.showToast({
title:'取消成功!',
icon:'none',
duration:2000,
title: '取消成功!',
icon: 'none',
duration: 2000,
success() {
setTimeout(()=>{
setTimeout(() => {
that.getMyNeedList()
},1000)
}, 1000)
}
})
}
},
// 取消订单2 立即退款3
handleStatus(val,id){
console.log(val,id,'装订好')
handleStatus(val, id) {
console.log(val, id, '装订好')
let that = this
if(val == 2){
if (val == 2) {
that.handleCancle(id)
}
}
......
......@@ -42,7 +42,7 @@
</template>
<script>
import {addOrderFunction} from '@/api/system/index.js'
import releaseForm from '@/components/form.vue'
export default {
components: {
......@@ -51,27 +51,33 @@
data() {
return {
globalData: getApp().globalData,
statusBtn:-1
statusBtn: -1,
form: {
title: undefined, //标题
linkman: undefined, //联系人
phone: undefined, //联系电话
repairTime: undefined, //维修时间
repairAddress: undefined, //维修地址
budget: undefined, //预算金额
remark: undefined, //备注说明
}
}
},
onShow() {
let that = this
},
methods: {
handleSubmit(info){
console.log(info,'拿到表单')
},
handleAdd(){
addOrderFunction().then(res=>{
console.log('发布')
})
handleSubmit(info) {
console.log(info, '拿到表单')
},
}
}
</script>
<style scoped>
@import url("@/css/form.css");
::v-deep .u-border {
border: 0 !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